As you can see, I'm reading all nodes from level 3.
The problem is that this script only works correct if I'm at a level 3 page. If I'm on a page that's higher in the hierarchy, like the homepage, the left navigation is empty.
I suppose I should alter this bit: $currentPage/ancestor-or-self::* So that the nodes under the Activities nodes are read out, from wherever I'm am in the hierarchy, but I don't know how to do this.
Does anyone know how to read nodes from a certain level in the hierarchie, no matter the hierarchy of the current page?
How about always going all the way to the top and then back down to level 3? Something like this:
<xsl:for-each select="$currentPage/ancestor-or-self::*[@level=1 and @isDoc]/descendant::*[@level=$level and @isDoc]/* [@isDoc and string(umbracoNaviHide) != '1']" >
I am sorry for the sloppy suggestions but I don't have umbraco in front of me to actually try things out. Maybe this though?
<xsl:for-each select="$currentPage/ancestor-or-self::*[@level=1 and @isDoc]/descendant::*[@level=$level and @isDoc]/child::* [@isDoc and string(umbracoNaviHide) != '1']" >
The other thing you could do if you are only interested in the nodes under Activities is to use specifically the activities id:
<xsl:for-each select="$currentPage/ancestor-or-self::*[@level=1 and @isDoc]/descendant::*[@id=(activities id, hardcoded) and @isDoc]/child::* [@isDoc and string(umbracoNaviHide) != '1']" >
the xslt-script seems to read the right level now, but it reads all level 3 nodes:
This is what my Content tree in the Umbraco backend looks like (I changed the hierarchie)
So as you see, nodes from the 3rd level are read, but from the Staff node (level 2). While only the level 3 nodes from the Activities node should be read:
How about passing in the activities id as a parameter and making something like this?
<xsl:for-each select="$currentPage/ancestor-or-self::*[@level=1 and @isDoc]/descendant::*[@id=$id and @isDoc]/child::* [@isDoc and string(umbracoNaviHide) != '1']" >
xslt navigation
Hi,
I'm implementing a left navigation structure that should look like this:
My content tree in the Umbraco backend looks like this:
For the moment I'm trying to implement the activies node in the left navigation so I made an xslt file: LeftNavigationActivities.xslt
the xslt looks like this:
<div class="box_title">Activities</div>
<div class="menu">
<ul>
<xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
<li id="nav-seminars">
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
</li>
</xsl:for-each>
</ul>
</div>
As you can see, I'm reading all nodes from level 3.
The problem is that this script only works correct if I'm at a level 3 page. If I'm on a page that's higher in the hierarchy, like the homepage, the left navigation is empty.
I suppose I should alter this bit: $currentPage/ancestor-or-self::* So that the nodes under the Activities nodes are read out, from wherever I'm am in the hierarchy, but I don't know how to do this.
Does anyone know how to read nodes from a certain level in the hierarchie, no matter the hierarchy of the current page?
Thanks for your help,
Anthony Candaele
Belgium
How about always going all the way to the top and then back down to level 3? Something like this:
<xsl:for-each select="$currentPage/ancestor-or-self::*[@level=1 and @isDoc]/descendant::*[@level=$level and @isDoc]/* [@isDoc and string(umbracoNaviHide) != '1']" >
Dimitri
Hi Dimitri,
I tried your suggestion, but now the left navigation menu under 'activities' shows all level 3 nodes (see screenshot)
Hello Anthony,
I am sorry for the sloppy suggestions but I don't have umbraco in front of me to actually try things out. Maybe this though?
<xsl:for-each select="$currentPage/ancestor-or-self::*[@level=1 and @isDoc]/descendant::*[@level=$level and @isDoc]/child::* [@isDoc and string(umbracoNaviHide) != '1']" >
Dimitri
The other thing you could do if you are only interested in the nodes under Activities is to use specifically the activities id:
<xsl:for-each select="$currentPage/ancestor-or-self::*[@level=1 and @isDoc]/descendant::*[@id=(activities id, hardcoded) and @isDoc]/child::* [@isDoc and string(umbracoNaviHide) != '1']" >
Hi Dimitri,
the xslt-script seems to read the right level now, but it reads all level 3 nodes:
Hi Anthony,
How about passing in the activities id as a parameter and making something like this?
<xsl:for-each select="$currentPage/ancestor-or-self::*[@level=1 and @isDoc]/descendant::*[@id=$id and @isDoc]/child::* [@isDoc and string(umbracoNaviHide) != '1']" >
Dimitri
Hi Dimitri,
Yes!! This works.
Thanks a lot.
Anthony
No problem! Have a nice evening.
Dimitri
is working on a reply...