Copied to clipboard

Flag this post as spam?

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


  • Natasha 79 posts 195 karma points
    Nov 02, 2012 @ 00:19
    Natasha
    0

    xslt menu title on a level 3 page

    Hi all I'm quite new to xslt and have searched for the answer to this, but come up with nothing so I apologise if this has been answered before.

    I am trying to write a xslt marco that will display the parent node name of level 2 (level 1 node name) when I am on a level 3 page.  i.e. if I'm on this page http://sef.ncb.org.uk/practice/faith,-values-sre/faith-considerations-primary-school-sre-policy-programme.aspx the left menu title should read 'practice'.  So far I have this which works on level 2 pages but not on level three:

    <xsl:choose>
      <xsl:when test="$currentPage/ancestor::* [@level=2]">
        <xsl:value-of select="$currentPage/parent::*[@isDoc]/@nodeName"/>
    <xsl:if test="$currentPage/ancestor::* [@level=3]">
    <xsl:value-of select="$currentPage/ancestor-or-self::node[@level=1]/@nodeName"/>
    </xsl:if>
    </xsl:when>
      
     
    <xsl:otherwise>
       <xsl:value-of select="$currentPage/@nodeName"/>  
    </xsl:otherwise>
    </xsl:choose>

    can anyone help me to get this working properly? thanks.

  • Natasha 79 posts 195 karma points
    Nov 02, 2012 @ 01:35
    Natasha
    0

    worked it out.  If anyone else needs the code:

     

    <xsl:choose>
      <xsl:when test="$currentPage/ancestor::* [@level=3]">
        <xsl:value-of select="$currentPage/../parent::*[@isDoc]/@nodeName"/>
    </xsl:when>
     <xsl:when test="$currentPage/ancestor::* [@level=2]">
        <xsl:value-of select="$currentPage/parent::*[@isDoc]/@nodeName"/>
    </xsl:when>
     
    <xsl:otherwise>
       <xsl:value-of select="$currentPage/@nodeName"/>  
    </xsl:otherwise>
    </xsl:choose>

  • 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