The way you're using it, current is just a piece of text that you're injecting, so it carries no "value" other than "current".
The test you're performing though, will only return true(), when tested in the XSLT visualizer, because that's the only place $currentPage will point to something above level 1 pages (if you pick the "Content" node as $currentPage).
So, in effect, if that piece of XSLT is running in your site, you won't get any "current" output...
This is XSlt i m using for Multi level navigation.. i m getting the output which i intended to.. but keeps me wondering how it comes. Check the bolded part of Xslt.. i dont know wats its doing ..
<!-- Input the documenttype you want here --> <!-- Typically '1' for topnavigtaion and '2' for 2nd level --> <!-- Use div elements around this macro combined with css --> <!-- for styling the navigation --> <xsl:variable name="level" select="1"/>
The code you are refering adds an class to the <li> tag named 'current', the idea being that you can style the item in your navigation to show the user which page they are currently on.
<!-- Input the documenttype you want here --> <!-- Typically '1' for topnavigtaion and '2' for 2nd level --> <!-- Use div elements around this macro combined with css --> <!-- for styling the navigation --> <xsl:variable name="level" select="1"/>
xslt help
Hi
<xsl:if test="$currentPage/descendant::* [@level=1]">
<xsl:text>current</xsl:text>
</xsl:if>
Wat will be the value of current
Hi dwarakesh,
The way you're using it, current is just a piece of text that you're injecting, so it carries no "value" other than "current".
The test you're performing though, will only return true(), when tested in the XSLT visualizer, because that's the only place $currentPage will point to something above level 1 pages (if you pick the "Content" node as $currentPage).
So, in effect, if that piece of XSLT is running in your site, you won't get any "current" output...
What are you trying to do?
/Chriztian
Hey
This is XSlt i m using for Multi level navigation.. i m getting the output which i intended to.. but keeps me wondering how it comes. Check the bolded part of Xslt.. i dont know wats its doing ..
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:tagsLib="urn:tagsLib" xmlns:BlogLibrary="urn:BlogLibrary"
exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets tagsLib BlogLibrary ">
<xsl:output method="xml" omit-xml-declaration="yes" />
<xsl:param name="currentPage"/>
<!-- Input the documenttype you want here -->
<!-- Typically '1' for topnavigtaion and '2' for 2nd level -->
<!-- Use div elements around this macro combined with css -->
<!-- for styling the navigation -->
<xsl:variable name="level" select="1"/>
<xsl:template match="/">
<ul id="jsddm">
<li>
<xsl:attribute name="class">
<xsl:if test="$currentPage/@level=$level">
<xsl:text>current</xsl:text>
</xsl:if>
</xsl:attribute>
</li>
<xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
<li>
<xsl:attribute name="class">
<xsl:if test="$currentPage/@id=@id">
<xsl:text>current</xsl:text>
</xsl:if>
</xsl:attribute>
<a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="@nodeName"/></a>
<!-- Drop Down Menu -->
<xsl:if test="count(./* [@isDoc and string(umbracoNaviHide) != '1']) > 0">
<ul>
<xsl:for-each select="./* [@isDoc and string(umbracoNaviHide) != '1']">
<li>
<xsl:attribute name="class">
<xsl:if test="$currentPage/descendant::* [@level=1]">
<xsl:text>current</xsl:text>
</xsl:if>
</xsl:attribute>
<a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="@nodeName"/></a></li>
</xsl:for-each>
</ul>
</xsl:if>
<!-- End of Drop Down Menu -->
</li>
</xsl:for-each>
</ul>
</xsl:template>
</xsl:stylesheet>
The code you are refering adds an class to the <li> tag named 'current', the idea being that you can style the item in your navigation to show the user which page they are currently on.
Rich
Hey
Wats the functionality of below line used in XSlt . Especially that select part
<xsl:for-each select="./* [@isDoc and string(umbracoNaviHide) != '1']">
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:tagsLib="urn:tagsLib" xmlns:BlogLibrary="urn:BlogLibrary"
exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets tagsLib BlogLibrary ">
<xsl:output method="xml" omit-xml-declaration="yes" />
<xsl:param name="currentPage"/>
<!-- Input the documenttype you want here -->
<!-- Typically '1' for topnavigtaion and '2' for 2nd level -->
<!-- Use div elements around this macro combined with css -->
<!-- for styling the navigation -->
<xsl:variable name="level" select="1"/>
<xsl:template match="/">
<ul id="jsddm">
<li>
<xsl:attribute name="class">
<xsl:if test="$currentPage/@level=$level">
<xsl:text>current</xsl:text>
</xsl:if>
</xsl:attribute>
</li>
<xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
<li>
<xsl:attribute name="class">
<xsl:if test="$currentPage/@id=@id">
<xsl:text>current</xsl:text>
</xsl:if>
</xsl:attribute>
<a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="@nodeName"/></a>
<!-- Drop Down Menu -->
<xsl:if test="count(./* [@isDoc and string(umbracoNaviHide) != '1']) > 0">
<ul>
<xsl:for-each select="./* [@isDoc and string(umbracoNaviHide) != '1']">
<li>
<xsl:attribute name="class">
<xsl:if test="$currentPage/descendant::* [@level=1]">
<xsl:text>current</xsl:text>
</xsl:if>
</xsl:attribute>
<a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="@nodeName"/></a></li>
</xsl:for-each>
</ul>
</xsl:if>
<!-- End of Drop Down Menu -->
</li>
</xsl:for-each>
</ul>
</xsl:template>
</xsl:stylesheet>
is working on a reply...