The issue does appear to be with that if statement. It's checking to see if there are any subpages under the current page. So when you are on a subpage - there won't be any pages under it. Instead you should probably have it walk up the tree to level 2, and see if it has any subpages. I think this should work:
<xsl:if test="count($currentPage/ancestor-or-self::* [@isDoc][@level=2]/* [@isDoc and string(umbracoNaviHide) != '1']) > 0"> <xsl:for-each select="$currentPage/ancestor-or-self::* [@isDoc and @level=2]/* [@isDoc and string(umbracoNaviHide) != '1']">
Also just a quick note, you shouldn't need the <xsl:sort tag as it should sort the nodes by their order in Umbraco by default.
XSLT menu, listing subpages
After several searches and trying out different solutions, I give up.
I got a typical menu;
- Main 1 (hardcoded)
- Main 2
------ sub 1
------ sub 2
------ sub 3
- Main 3
- Main 4
I've gotten it to show the Main and the sub menu fine, with the added class="selected" depending on what node you're on.
My submenu however, dissapears whenever I enter one of the sub pages.
My Content structure is as follows:
Primary node, the frontpage (1)
------ Textpage (2)
------------ Textpage (3)
------------ Textpage (3)
------ Textpage (2)
------ Textpage (2)
Here's the XSLT:
I also attempted doing the menu in Razor, but that went even worse, so I went with what I knew some of.
// Lars
I believe the issue is the if statement before the subMenu starts, but I'm not quite sure.
Hi Lars,
The issue does appear to be with that if statement. It's checking to see if there are any subpages under the current page. So when you are on a subpage - there won't be any pages under it. Instead you should probably have it walk up the tree to level 2, and see if it has any subpages. I think this should work:
Also just a quick note, you shouldn't need the <xsl:sort tag as it should sort the nodes by their order in Umbraco by default.
-Tom
Aha! Yeah that makes sense, looking at what you wrote -- it also worked.
Removed the sort too, you're right, there's no need for that.
is working on a reply...