Copied to clipboard

Flag this post as spam?

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


  • Rik Hodiamont 56 posts 156 karma points
    May 03, 2011 @ 13:50
    Rik Hodiamont
    0

    Level 3 navigation

    I am new to XSLT and I'm having a problem generating a sublevel menu.

    I'm using the following structure:

    Menu-item 1

       Page 1

          SubPage 1

          SubPage 2

      Page 2

    Menu-item 2

    When i'm on subpage 2 I want a list of all the pages under Page 1. So I thought I could generate a list based on the parentID. But somehow that won't work:

    This is the code I'm using:

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

    Thanks in advance.

  • Fuji Kusaka 2203 posts 4220 karma points
    May 03, 2011 @ 13:53
    Fuji Kusaka
    0

    Hi Rik,

    Do you mean you are making a Top Nvagitaion Menu with 3 levels?

    Fuji

  • Rik Hodiamont 56 posts 156 karma points
    May 03, 2011 @ 13:56
    Rik Hodiamont
    0

    Hi Fuji,

    No, i want that if the user is on SubPage 2, he sees a list of all the pages under the parent page (page 1).

    So in this example the user sees a list of SubPage 1 and SubPage 2.

    Tnx!

    Rik

  • Fuji Kusaka 2203 posts 4220 karma points
    May 03, 2011 @ 14:08
    Fuji Kusaka
    0

    Rik,

    So you are looking for something like a breadcrumb but instead it will display the list of items under page1 ~ Subpage 1 + Subpage 2?

  • praveity 100 posts 125 karma points
    May 03, 2011 @ 14:14
    praveity
    0

    Hi Fuji,

    You could try this out.

    Here it will loop through all the child nodes (including itself) within the same parent node.

    This way you could get both subpage 1 and subpage 2, being at subpage 1 or subpage 2

    <xsl:for-each select="$currentPage/parent::*[@isDoc]//*[@isDoc]">
    <li>
        <href="{umbraco.library:NiceUrl(@id)}">
          <xsl:value-of select="@nodeName"/>
        </a>
      </li>
    </xsl:for-each>
  • Rik Hodiamont 56 posts 156 karma points
    May 03, 2011 @ 14:18
    Rik Hodiamont
    0

    Fuji, Praveity thank you a lot. It works!!

    For future reference: Where is the @isDoc value for?

    Tnx!

  • Fuji Kusaka 2203 posts 4220 karma points
    May 03, 2011 @ 14:20
    Fuji Kusaka
    0

    Rik,

    Try this out by using a XSLT breadCrumb.

     

    <xsl:if test="$currentPage/@level &gt; $minLevel">
          <ul>
              <xsl:for-each select="$currentPage/descendant::*[@isDoc]">
             <li>
                <a href="{umbraco.library:NiceUrl(@id)}">
                  <xsl:value-of select="@nodeName"/>
                </a>
              </li>
            </xsl:for-each>           
          </ul>
        </xsl:if>
  • Rik Hodiamont 56 posts 156 karma points
    May 03, 2011 @ 15:08
    Rik Hodiamont
    0

    Tnx Fuji. Both solutions worked :)

  • 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