Copied to clipboard

Flag this post as spam?

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


  • Philip 13 posts 33 karma points
    Nov 03, 2010 @ 18:36
    Philip
    0

    Sub-navigation changes as user goes deeper into site?

    Hi, I'm using this xslt code:
    <xsl:for-each select="$currentPage/* [@isDoc]">
    <ul>
    <li>
    nodename
    </li>
    </ul>
    </xsl:foreach>
    When I navigate past the secondary pages of the product site I'm working on, the sub nav changes to a list of products instead of the original options. Is there a way to maintain the initial sub nav?
    Thanks for any help.
    Philip

  • Dan 1288 posts 3921 karma points c-trib
    Nov 03, 2010 @ 19:17
    Dan
    1

    Hi Philip,

    You'll need to set your XSLT to retrieve nodes by level.  There's an XSLT template already for this, which should output something like the following:

    <xsl:param name="currentPage"/>

    <!-- Input the documenttype you want here -->
    <xsl:variable name="level" select="2"/>

    <xsl:template match="/">
    <ul>
    <xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
      <li>
        <a href="{umbraco.library:NiceUrl(@id)}">
          <xsl:value-of select="@nodeName"/>
        </a>
      </li>
    </xsl:for-each>
    </ul>

    </xsl:template>

    This is assuming you're using the new schema in 4.5.1.

    Hope this helps...

  • Kasper Dyrvig 246 posts 379 karma points
    Nov 04, 2010 @ 08:26
    Kasper Dyrvig
    0

    The reason to why the list changes, is because the "currentPage" changes. Your xslt code you wrote lists the child nodes of the current node. So when you are on the frontpage you'll get the subpages from there... when you go to a page without subpages you will get no output at all.

    So, as Dan point out, you'll have to specify from where the xslt should get its data from.

    - webspas

Please Sign in or register to post replies

Write your reply to:

Draft