I thought that this would be fairly simple but I'm struggling with it! What I am trying to do is build a menu up based upon the content items listed under a particular item of content. So in my content tree I have:
Home (Root node)
-FamilyHome (level 1)
--Family About Us
--Family Contact
--Family How
-RacingHome (level 1)
--Racing About Us
--Racing Contact
--Racing How
I would have thought that I could use something like:
<xsl:variable name="rootNode" select="$currentPage/ancestor-or-self::root" /> <xsl:variable name="homeNode" select="$rootNode/home/familyHome [@isDoc]" /> <!--loop through the root node and create the top level nav links--> <xsl:for-each select="$homeNode/* [@isDoc and @level = 3]"> <li> <!--Test to see if this item is the current page if it is attached the selected class to the href--> <xsl:choose> <xsl:when test="$currentPage/self::* [@isDoc]/@id = current()/@id"> <a class="current-menu-item" href="{umbraco.library:NiceUrl(@id)}"> <xsl:value-of select="@nodeName" /> </a> </xsl:when> <xsl:otherwise> <a href="{umbraco.library:NiceUrl(@id)}"> <xsl:value-of select="@nodeName" /> </a> </xsl:otherwise> </xsl:choose> </li> </xsl:for-each>
List items contained within a content node
Hi,
I thought that this would be fairly simple but I'm struggling with it! What I am trying to do is build a menu up based upon the content items listed under a particular item of content. So in my content tree I have:
Home (Root node)
-FamilyHome (level 1)
--Family About Us
--Family Contact
--Family How
-RacingHome (level 1)
--Racing About Us
--Racing Contact
--Racing How
I would have thought that I could use something like:
But it's not finding anything?
Any ideas anyone?
Thanks,
Craig
Hi Craig,
Usually, the aliases are CamelCased (e.g. Home and FamilyHome) - did you specifically change them to use a lowercase initial letter?
Also, you can shorten the XSLT a little like this:
/Chriztian
You my friend are an international superstar :)
Haha - thanks Craig :-)
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.