Copied to clipboard

Flag this post as spam?

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


  • Kyle Skrinak 272 posts 327 karma points
    Jan 08, 2011 @ 18:26
    Kyle Skrinak
    0

    xslt to show peer nodes for nav element

    I can't find a reference for an xslt that will render peer nodes. This is for a section of a tree. For example

    root
         tierA
              node01
              node02
              node03
              node04
         tierB
         tierC

    I'd like to have an xslt/macro that will create a nav element so that the child nodes of tierA are listed by the children (as peers), not at the level above, i.e., tierA, i.e.,

    nodes01 - 4 would have the following code on their pages:

    <ul>
    <li><a href="linktonode1">node01</a></li>
    <li><a href="linktonode2">node02</a></li>
    <li><a href="linktonode3">node03</a></li>
    <li><a href="linktonode4">node04</a></li>
    </ul>

    I will appreciate any help -- thanks!

  • Rasmus Berntsen 215 posts 253 karma points c-trib
    Jan 08, 2011 @ 22:56
    Rasmus Berntsen
    1

    Hmnn... Check for the node above and list all items below that node? Is that the problem? :)

  • Kyle Skrinak 272 posts 327 karma points
    Jan 08, 2011 @ 23:33
    Kyle Skrinak
    0

    Well, the problem is my lack of familiarity with XSLT, thus the question. However, you sufficiently slapped my face for me to rethink my question:

    I changed this line of XSLT:

    <xsl:for-each select="$currentPage/ancestor-or-self::* [@isDoc and @level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">

    to this:

    <xsl:for-each select="$currentPage/ancestor-or-self::* [@isDoc and @level=4]/* [@isDoc and string(umbracoNaviHide) != '0']">

    Which gives me what I'm looking for (within the context of the default nav XSLT) I could probably remove the string comparison at the end of the select statement, since I don't want these items in the main nav, but I do for this one override, so I don't need to check this. I presume @level=4 moves me to the correct portion of the tree.

    Thanks!
    Kyle

  • Rasmus Berntsen 215 posts 253 karma points c-trib
    Jan 08, 2011 @ 23:54
    Rasmus Berntsen
    0

    Glad I could help. The solution to most of my XSLT problems is often to rethink my approach... :-)

Please Sign in or register to post replies

Write your reply to:

Draft