Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Dan 1288 posts 3921 karma points c-trib
    Sep 18, 2009 @ 15:24
    Dan
    0

    List all nodes of parent at current level

    Hi,

    How would I output a list of all nodes at the current level for the current parent?

    e.g. I have a website with three layers of navigation.  When inside a level 3 page, I want to show the names of all other level 3 pages for that particular level 2 node.

    Can anyone show me how to do this?  (I really need to learn XSLT quickly - I'm completely stuck at the moment without it!)

    Thanks

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Sep 18, 2009 @ 15:32
    Dirk De Grave
    0

    Hi Dan,

    you should try this:

    <xsl:for-each select="$currentPage/../node">...</xls:for-each>

    Basically, you're selecting all nodes ('/node' selector) after having applied the '/..' selector (selecting parent node) on the $currentPage (node currently being requested)

    Same snippet can be used to list all level 2 pages residing under the same parent node at level 1

     

    Does that make more sense now? Also, have a look at this wiki article (a good overview of available xpath and xpath axes) 

     

    Cheers,

    /Dirk

  • Dan 1288 posts 3921 karma points c-trib
    Sep 18, 2009 @ 16:01
    Dan
    0

    Perfect, thanks!

Please Sign in or register to post replies

Write your reply to:

Draft