Copied to clipboard

Flag this post as spam?

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


  • Jules 276 posts 587 karma points
    May 10, 2011 @ 13:20
    Jules
    0

    Include both parent and child at same level in navigation

    I have a content structure like this

     

    Home
    About Us
    School History
    Ethos & Aims
    Board
    Junior
    One
    Two
    Etc...

    I need to create nvaigation for each Section ie About Us, Junior etc - essentially 2ndLevelNavigation.

    The problem I have is this.

    The navigation for About Us and each of its child pages needs to be

    About Us
    School History
    Ethos & Aims
    Board

    in other words the navigation needs to include the parent and the children.

    In xslt how can you loop through both teh parent and the children and get them to appear in the Nav.

    At the moment I am using the followign but it only works on the About Us page and not on the child pages.

    <?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" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"
    exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">

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

    <xsl:param name="currentPage"/>
    <xsl:variable name="level" select="2"/>
    <xsl:template match="/">

    <!-- The fun starts here -->
    <xsl:for-each select="$currentPage/* [@isDoc and string(umbracoNaviHide) != '1']">
    <div class="nav_button_l">
    <a href="{umbraco.library:NiceUrl(@id)}">
    <xsl:value-of select="@nodeName"/>
    </a>
    </div>
    </xsl:for-each>

    </xsl:template>

    </xsl:stylesheet>

  • Jules 276 posts 587 karma points
    May 10, 2011 @ 13:30
    Jules
    0

    PLEASE IGNORE THIS.  THE POST HAS GONE WRONG AND IS UNCLEAR

    AM REPOSTING

    AM UNABLE TO DELETE OR EDIT AS IT IS ERRORING OUT

  • Fuji Kusaka 2203 posts 4220 karma points
    May 10, 2011 @ 13:30
    Fuji Kusaka
    0

    Juliang,

    You can try using this

     

    <xsl:value-of select="$currentPage/ancestor-or-self::*[@level = 1]/Content" />
Please Sign in or register to post replies

Write your reply to:

Draft