Copied to clipboard

Flag this post as spam?

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


  • Alexadar 17 posts 37 karma points
    Nov 19, 2011 @ 17:26
    Alexadar
    0

    Static second level navigation

    Hi!

    I trying to make a static level 2 navigation, but it is not working.

    My goal is to make a second level navigation what will be visible from all pages, what contains in a parent.

    This one not working.

     <ul class="pages">
       <xsl:for-each select="$currentPage/ancestor-or-self::*[@isDoc and @level = 2]/* [@isDoc and string(umbracoNaviHide) != '1']">
      <li>
        
             <xsl:if test="@id = $currentPage/@id">
                <xsl:attribute name="class">f</xsl:attribute>
              </xsl:if>
            <class="navigation" href="{umbraco.library:NiceUrl(@id)}">
              <span><xsl:value-of select="@nodeName"/></span>
            </a>
      </li>
      
      
    </xsl:for-each>
    </ul>

    Please help!

  • Dmitrij Jazel 86 posts 179 karma points
    Nov 19, 2011 @ 20:31
    Dmitrij Jazel
    0

    Hi Alexadar,

    I hope this helps, this is a 2nd level menu that I am using.

    <?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="AllLevel" select="1"/>
    
    <!-- Input the documenttype you want here -->
    <!-- Typically '1' for topnavigtaion and '2' for 2nd level -->
    <!-- Use div elements around this macro combined with css -->
    <!-- for styling the navigation -->
    <xsl:variable name="level" select="2"/>
    
    <xsl:template match="/">
      <ul>
        <xsl:for-each select="$currentPage/ancestor-or-self::* [@isDoc and @level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
          <li>
            <a href="{umbraco.library:NiceUrl(@id)}">
              <xsl:if test="$currentPage/ancestor-or-self::*/@id = current()/@id">
                <!-- we're under the item - you can do your own styling here -->
                <xsl:attribute name="class">Selected</xsl:attribute>
              </xsl:if>
              <xsl:value-of select="@nodeName"/>
            </a>
          </li>      
        </xsl:for-each>   
    
      </ul>
    
    </xsl:template>
    
    </xsl:stylesheet>

    Good luck :)

    Dmitrij

Please Sign in or register to post replies

Write your reply to:

Draft