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
Hi everyone,
Could anyone give a run through of how to do this vis xslt?
For example, if I wanted to output:
<ul>
<li class="menuItem1"><a href="#">link</a></li>
<li class="menuItem2"><a href="#">link</a></li>
<li class="menuItem3"><a href="#">link</a></li>
<li class="menuItem4"><a href="#">link</a></li>
</ul>
Just so I can do something a bit different with the css on my menu I need different classes on each :)
This is my menu here, my site only has two levels (so far...) so this works fine for me, apart from not having different classes:
<ul> <xsl:for-each select="$currentPage/ancestor-or-self::* [@level=1]/* [@isDoc and string(umbracoNaviHide) != '1']"> <li><xsl:if test="$currentPage/@id = current()/@id"> <xsl:attribute name="class"> <xsl:value-of select="'current'"/> </xsl:attribute> </xsl:if><xsl:if test="@id = $currentPage/parent::* /@id"> <xsl:attribute name="class"> <xsl:value-of select="'parent'"/> </xsl:attribute> </xsl:if> <a href="{umbraco.library:NiceUrl(@id)}"><span><xsl:value-of select="@nodeName"/></span></a> </li></xsl:for-each></ul>
Thanks.
Sam.
Hi Sam
If you want to insert a number that increases on each li-element, you can use the position() like this:
<xsl:attribute name="class"> <xsl:text>menuItem </xsl:text><xsl:value-of select="position()" /></xsl:attribute>
/Kim A
Thanks Kim. that's perfect :).
Great to hear Sam. And you are very welcome :)
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
Creating navigation with incremental class name
Hi everyone,
Could anyone give a run through of how to do this vis xslt?
For example, if I wanted to output:
<ul>
<li class="menuItem1"><a href="#">link</a></li>
<li class="menuItem2"><a href="#">link</a></li>
<li class="menuItem3"><a href="#">link</a></li>
<li class="menuItem4"><a href="#">link</a></li>
</ul>
Just so I can do something a bit different with the css on my menu I need different classes on each :)
This is my menu here, my site only has two levels (so far...) so this works fine for me, apart from not having different classes:
Thanks.
Sam.
Hi Sam
If you want to insert a number that increases on each li-element, you can use the position() like this:
/Kim A
Thanks Kim. that's perfect :).
Sam.
Great to hear Sam. And you are very welcome :)
/Kim A
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.