Copied to clipboard

Flag this post as spam?

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


  • Jules 205 posts 448 karma points
    May 10, 2011 @ 17:06
    Jules
    0

    List Level1 nodes

    Hi

    I currently have the xslt below for my top level navigation which works fine until I go to a level 2 page at which point the code reads all level 2 nodes.

    I need the top navigation to read level 1 nodes at all times regardless of current page.

    Can anyone suggest something

    Thanks

    JG

    <xsl:template match="/">
    <!-- The fun starts here -->
      <xsl:for-each select="$currentPage/../* [@isDoc][not(umbracoNaviHide = 1)]">
        <div class="nav_button">
          <a href="{umbraco.library:NiceUrl(@id)}">
            <xsl:value-of select="Exslt.ExsltStrings:uppercase(@nodeName)"/>
          </a>
        </div>
      </xsl:for-each>
    </xsl:template>

     

     

     

  • Rich Green 2246 posts 4006 karma points
    May 10, 2011 @ 18:23
    Rich Green
    0

    Hey,

    Create a new xslt file and select the "Navigation Prototype" tempalte, this will give you the code you need.

    Rich

  • Dennis Aaen 4457 posts 17970 karma points admin hq c-trib
    May 10, 2011 @ 18:32
    Dennis Aaen
    0

    Hi JG,

    You can use one of the bulid in templaes to get what you are looking for.

    You can use the template Navigation prototype.

    The template contains the following code,

    <xsl:variable name="level" select="1"/>

    <xsl:template match="/">

    <!-- The fun starts here -->
    <ul>
    <xsl:for-each select="$currentPage/ancestor-or-self::* [@isDoc and @level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
      <li>
        <a href="{umbraco.library:NiceUrl(@id)}">
          <xsl:if test="$currentPage/ancestor-or-self::*/@id = current()/@id">
            <!-- we're under the item - you can do your own styling here -->
            <xsl:attribute name="class">selected</xsl:attribute>
          </xsl:if>
          <xsl:value-of select="@nodeName"/>
        </a>
      </li>
    </xsl:for-each>
    </ul>

    </xsl:template>

    I hope you will get it work.

    /Dennis

     


  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies