Quantcast
Channel: ActiveTopics
Viewing all articles
Browse latest Browse all 72689

Adding classes to xslt menu

$
0
0

Hi,

This is my XSLT top navigation menu

  <xsl:template match="/">

<xsl:variable name="level" select="1"/>
<xsl:variable name="dropDown" select="2"/>
   
   

<!-- The fun starts here -->
<ul id="menyn">
 

  <li >
       <xsl:attribute name="class">
         <xsl:if test="$currentPage/@level=$level">
          <xsl:text>current</xsl:text>
          </xsl:if>
     </xsl:attribute>
      <a href="/">    
         <xsl:value-of select="$currentPage/ancestor-or-self::*/@nodeName"/>
      </a> 
 </li>
 
  <xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1'][not(self::RF-Slide)]"> 
  <li >
     <xsl:attribute name="class">
         <xsl:if test="$currentPage/@id=@id">
          <xsl:text>current</xsl:text>
          </xsl:if>
     </xsl:attribute>
   
   
    <a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="@nodeName"/></a>   
    <!-- Drop Down Menu -->
    <xsl:if test="count(./* [@isDoc and string(umbracoNaviHide) != '1']) &gt; 0">
       <ul>
         <xsl:for-each select="./* [@isDoc and string(umbracoNaviHide) != '1']">
             <li>
              
                <xsl:attribute name="class">
                   <xsl:if test="$currentPage/descendant::* [@level=1]">                   
                    <xsl:text>current</xsl:text>
                  </xsl:if>
                </xsl:attribute>
              
               <a href="{umbraco.library:NiceUrl(@id)}" ><xsl:value-of select="@nodeName"/></a></li>
         </xsl:for-each>
       </ul>
    </xsl:if>
    <!-- End of Drop Down Menu -->
   
  </li>
  </xsl:for-each>
 
</ul>
</xsl:template>
    <!-- Never output these -->
    <xsl:template match="*[umbracoNaviHide = 1]" />

It generates a menu with drop down.I need to add a css clsss name to <li> tag.Currently it doesnt genrate a class.Here is the illustration whatI need

<ul id="menyn">
  <li class="current">
    <a href="/" class="Need-A-Class-Name-Here>Home</a>
  </li>
  <li class="Need-A-Class-Name-Here">
    <a href="/page.aspx">about</a>
    <ul>

Thanks

 


Viewing all articles
Browse latest Browse all 72689


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>