Copied to clipboard

Flag this post as spam?

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


  • lingjing 28 posts 45 karma points
    Jul 13, 2010 @ 02:07
    lingjing
    0

    XSLT Navigation problem

    Hi All. I am trying to build a simple top navigation with follow structure:

    <ul>

         <li class = "selected">

         Home

         </li>

         <li>

         About Us

         </li>

    </ul> 

     

    but I am having problem to define the current select node and apply style to it. Could anyone let me know how to check the current select node when building the navigation?

    Thank you

    Jing

  • Nik Wahlberg 639 posts 1237 karma points MVP
    Jul 13, 2010 @ 02:30
    Nik Wahlberg
    1

    Hi there, give this a try:

    <xsl:template match="/">
        <ul>
          <xsl:for-each select="$currentPage/descendant-or-self::node [string(data [@alias='umbracoNaviHide']) != '1']">
            <li>
                <xsl:attribute name="class">
                    <xsl:if test="$currentPage/@id=@id">
                        <xsl:text>active</xsl:text>
                    </xsl:if>
                </xsl:attribute>
                <a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="@nodeName"/></a>
            </li>
          </xsl:for-each>
        </ul>
    </xsl:template>

    HTH,
    Nik

Please Sign in or register to post replies

Write your reply to:

Draft