Developer forum

Forum » CMS - Standard features » RE: Navigation Expand all nodes

RE: Navigation Expand all nodes

Aditya Bante
Reply

Hi my navigation xslt is not expanding all the nodes in it . It unfolds the child elements only if the parentItem is checked.

Here is my Navigation.xslt

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >

  <xsl:output method="xml" omit-xml-declaration="yes" indent="yes"  encoding="utf-8" />
  <xsl:param name="html-content-type" />
  <xsl:template match="/NavigationTree">

    <xsl:if test="count(//Page) > 0">
      <ul>
        <xsl:apply-templates select="Page">
          <xsl:with-param name="depth" select="1"/>
        </xsl:apply-templates>
      </ul>
    </xsl:if>

  </xsl:template>

  <xsl:template match="//Page">
    <xsl:param name="depth"/>
    <li>
      <a>
        <xsl:attribute name="class">
          <xsl:if test="@InPath='True'">inpath </xsl:if>
          <xsl:if test="position() = 1">firstitem </xsl:if>
          <xsl:if test="position() = count(//Page)">lastitem </xsl:if>
          <xsl:if test="@Active='True'">activeitem</xsl:if>
        </xsl:attribute>
        <xsl:attribute name="href">
          <xsl:value-of select="@FriendlyHref" disable-output-escaping="yes"/>
        </xsl:attribute>
        <xsl:value-of select="@MenuText" disable-output-escaping="yes"/>
      </a>
      <xsl:if test="count(Page)">
        <ul class="M{@AbsoluteLevel}">
          <xsl:apply-templates select="Page">
            <xsl:with-param name="depth" select="$depth+1"/>
          </xsl:apply-templates>
        </ul>
      </xsl:if>
    </li>
  </xsl:template>

</xsl:stylesheet>

 

and here is the code which renders navigation on frontend

<ul id="navigationcompact" class="dwnavigation" settings="startlevel:1;endlevel:3;expandmode:expandall;template:NavigationCompactOffCanvas.xslt"></ul> 

does anyone has some thoughts about it? I would appreciat the feedback . Thanks.

Best Regards
Aditya Bante

 


Replies

 
Nicolai Høeg Pedersen
Reply

You have expandmode:expandall and it is called expandmode:all

 
Aditya Bante
Reply

Ohh. thanks it works :) 

 

You must be logged in to post in the forum