Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
i have a problem in a menu i built, where i want set an "active" class on the <a> tag of the page and its parent when the page is selected.
<a href="{umbraco.library:NiceUrl(@id)}"> <xsl:if test="$currentPage/ancestor-or-self::node/@id = current()/@id"> <xsl:attribute name="class">active</xsl:attribute> </xsl:if> <xsl:value-of select="@nodeName"/></a>
does'nt apply "active" to any <a> , whereas the following sets the current page to "active" just fine
<a href="{umbraco.library:NiceUrl(@id)}"> <xsl:if test="$currentPage/@id = current()/@id"> <xsl:attribute name="class">active</xsl:attribute> </xsl:if> <xsl:value-of select="@nodeName"/></a>
im running 4.5.2 by the way
Hi Claushingebjerg,
Do you know if you are using the new XML schema? If so, try this:
<xsl:if test="$currentPage/ancestor-or-self::*[@isDoc]/@id = current()/@id">
Cheers, Lee.
By-the-way, you don't need to use the "current()" part either. Just "@id" is fine - the XSLT understands the context of the condition.
<xsl:if test="$currentPage/ancestor-or-self::*[@isDoc]/@id = @id">
Grrrrrr damn schema....
That did the trick, thanks :)
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
problem with ancestor-or-self::node
i have a problem in a menu i built, where i want set an "active" class on the <a> tag of the page and its parent when the page is selected.
does'nt apply "active" to any <a> , whereas the following sets the current page to "active" just fine
im running 4.5.2 by the way
Hi Claushingebjerg,
Do you know if you are using the new XML schema? If so, try this:
Cheers, Lee.
By-the-way, you don't need to use the "current()" part either. Just "@id" is fine - the XSLT understands the context of the condition.
Grrrrrr damn schema....
That did the trick, thanks :)
is working on a reply...