By searching on the forum, I have found something similar what I needed. I would like my menu to display subnodes if there any, if not, only parent nodes. but in the following code, I should first click parent page, then it displays subpage. How could I achieve what I need?
<xsl:param name="currentPage" /> <xsl:variable name="siteRoot" select="$currentPage/ancestor-or-self::*[@level = 2]" /> <xsl:template match="/"> <xsl:if test="$siteRoot/*[@isDoc][not(umbracoNaviHide = 1)]"> <ul class="sidebarInnerTopMenuNavSub"> <!-- Start with children of the site root --> <xsl:apply-templates select="$siteRoot/*[@isDoc]" /> </ul> </xsl:if> </xsl:template>
<xsl:template match="*[@isDoc]"> <li> <a href="{umb:NiceUrl(@id)}"> <!-- Check if $currentPage is below or at this level --> <xsl:if test="descendant-or-self::*[@id = $currentPage/@id]"> <xsl:attribute name="class">current</xsl:attribute> </xsl:if> <xsl:value-of select="@nodeName" /> </a> <!-- If currentPage is below or at this level AND there is at least one visible child --> <xsl:if test="descendant-or-self::*[@id = $currentPage/@id] and *[@isDoc][not(umbracoNaviHide = 1)]"> <ul> <xsl:apply-templates select="*[@isDoc]" /> </ul> </xsl:if> </li> </xsl:template>
<!-- This automatically hides items with umbracoNaviHide checked --> <xsl:template match="*[umbracoNaviHide = 1]" />
Display subnodes on menu if there is any?
By searching on the forum, I have found something similar what I needed. I would like my menu to display subnodes if there any, if not, only parent nodes. but in the following code, I should first click parent page, then it displays subpage. How could I achieve what I need?
-Page1
-Page 1.1
-Page 1.2
Page2
You can do something like that..it will check if there is any child node present and make a loop for other child
//Fuji
is working on a reply...