Copied to clipboard

Flag this post as spam?

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


  • Paul 55 posts 76 karma points
    Dec 29, 2011 @ 12:28
    Paul
    0

    display the parent and child nodes in a navigation

    I have the following pages in my content try and I and attempting to present the parent as well as the child nodes in the navigation bar.

    Content
    MySiteHomePage (Home)
    InformationPage
    Subpages 1
    Other subpages A
    Misc subpages 1
    Misc subpages 2
    Other subpages B
    Misc subpages 3
    Misc subpages 4
    Subpages 2
    Other subpages A
    Misc subpages 5
    Misc subpages 6 
    Other subpages B
    Misc subpages 7
    Misc subpages 8

    About Us
    Contact Us
    FAQs
    ...

     

    (1) When a click on the link -InformationPage- I will like to present the following menu

    Home | InformationPage  (Selected) | Subpages 1 | Subpages 2

    (2) When a click on the link  -Other subpages A- I will like to present the following menu

    Home | InformationPage | Subpages 1 |  Other subpages A  (Selected)

    (3) When a click on the link  - Misc subpages 1 -  I will like to present the following menu

    Home | InformationPage | Subpages 1 | Other subpages A (Selected)

    I am encountering issues with the url of the ancestor (Subpages 1) referencing a child node (Other subpages A).

    The code snippet has been presented below:

    <?xml version="1.0" encoding="UTF-8"?>

    <!DOCTYPE xsl:stylesheet [

        <!ENTITY nbsp "&#x00A0;">

    ]>

    <xsl:stylesheet

      version="1.0"

      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

      xmlns:msxml="urn:schemas-microsoft-com:xslt"

      xmlns:umbraco.library="urn:umbraco.library"

      exclude-result-prefixes="msxml umbraco.library">

     

     

        <xsl:output method="xml" omit-xml-declaration="yes" />

     

        <xsl:param name="currentPage"/>

     

        <!-- Input the documenttype you want here -->

        <xsl:variable name="level" select="[aLevelValue]"/>

     

        <xsl:template match="/">

     

        <ul id="middleNavigation">

          <li>

            <a href="/"><xsl:value-of select="umbraco.library:GetDictionaryItem('Home')"/></a>

          </li>

          <li>

            <a href="{umbraco.library:GetDictionaryItem(InformationPageUrl)}">

             <xsl:value-of select="umbraco.library:GetDictionaryItem('InformationPage')"/>

            </a>

          </li>

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

            <li>

     

              <xsl:if test="@id = $currentPage/@id">

                  <xsl:attribute name="class">current</xsl:attribute>

              </xsl:if>

              <a class="navigation" href="{umbraco.library:NiceUrl(@id)}">

                <span><xsl:value-of select="@nodeName"/></span>

              </a>

            </li>

          </xsl:for-each>

        </ul>

     

    </xsl:template>

     

    </xsl:stylesheet>

     

     

     

  • Stephen 204 posts 246 karma points
    Dec 30, 2011 @ 13:15
    Stephen
    0

    Do you mean you want to change the main menu or display a sub menu for whatever section you are in? If its the latter i think i've done what your after..

    http://www.theboardroomglasgow.com/

    Click on the venue, then it has a sub menu, click on a sub menu item it then displays the menu plus the parent page...is this what you mean?

    S

  • Paul 55 posts 76 karma points
    Dec 30, 2011 @ 22:09
    Paul
    0

    Yes, that is what I mean. So when you're 3 levels deep we'll still present the menu as:

    [ Home ][ Parent ][ Children 0 ] ... [ Children n ]

  • Paul 55 posts 76 karma points
    Dec 31, 2011 @ 08:11
    Paul
    0

    I was able to solve this problem after all by using a <xsl:apply-templates/> directive and a <xsl:call-template/> directive to iterate through the content tree. 

     

Please Sign in or register to post replies

Write your reply to:

Draft