Copied to clipboard

Flag this post as spam?

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


  • sravani 50 posts 70 karma points
    Jun 21, 2011 @ 11:49
    sravani
    0

    multi navigation accordion menu

    Hi All,

     

    This my code

     

     <xsl:output method="xml" omit-xml-declaration="yes" />

    <xsl:param name="currentPage"/>

        <xsl:variable name="parentNode" select="$currentPage/ancestor-or-self::*[@isDoc and @level =2]"/>

      <xsl:template match="/">

    <xsl:if test="count($parentNode/*[@isDoc and string(umbracoNaviHide)!='1']) &gt; 0">

          <ul id="secondary-navigation">

                  <xsl:for-each select="$currentPage/ancestor-or-self::* [@isDoc and @level != 1  and @level != 3 and @level != 4 ]/* [@isDoc and string(umbracoNaviHide) != '1']">

     <!--list for selected-->

              <li>

                 <xsl:if test="@id = $currentPage/@id and @level !=1">

            <xsl:attribute name="class">selected</xsl:attribute>

          </xsl:if>

     

     

                <a href="{umbraco.library:NiceUrl(@id)}">

                 <xsl:value-of select="@nodeName"/>

                </a>

                <!--Level 4-->

                <xsl:if test="count(*[@isDoc and string(umbracoNaviHide)!='1']) &gt; 0">

          <ol class="subnav">

     

         <xsl:for-each select="*[@isDoc and string(umbracoNaviHide)!='1']">

     

     

                      <li>

     <xsl:if test="@id = $currentPage/@id">

            <xsl:attribute name="class">selected</xsl:attribute>

          </xsl:if>

                       <a href="{umbraco.library:NiceUrl(@id)}">

                          <xsl:value-of select="@nodeName"/>

                        </a>

    </li>

                  </xsl:for-each>

                </ol>

    </xsl:if>

                          </li>

           </xsl:for-each>

          </ul>

        </xsl:if>

     

      </xsl:template>

     

    </xsl:stylesheet>

     

    Its working perfect but problem in I need accordion menu . In this menu parent node and child nodes are dispaly for the first time itself. I need child node display occure when I am selecting the parent node.

    Any Ideas? ? pls help me.....

    Thanks in advance,

    Sravani 

  • Lachlann 344 posts 626 karma points
    Jun 21, 2011 @ 12:07
    Lachlann
    0

    Hi Sravani,

    If i understand the problem correctly, you could you put an id statement around the second for loop to check if the current node is equaly to the current page. That way the child nodes will only display when you are on the parent.

    <xsl:if test="$currentPage/@id = ./@id ">

    Does that help of have i missunderstood your problem?

     

    L

  • sravani 50 posts 70 karma points
    Jun 21, 2011 @ 12:15
    sravani
    0

    Thnaks for the reply,

    I tried with that also but problem is If I select the child  node it will disappear 

    Regards,

    sravani.

  • Lachlann 344 posts 626 karma points
    Jun 21, 2011 @ 12:33
    Lachlann
    0

    ahh of course, if you make it

    <xsl:if test="$currentPage/@id = ./ancestor-or-self::*/[@isDoc]/@id ">

     

    that may work.

     

    L

  • sravani 50 posts 70 karma points
    Jun 21, 2011 @ 12:49
    sravani
    0

    Thanks Again,

    It display corectly but when I am selecting the child node all child node are disappear,

    my menu is like 

    Main menu

     . 2nd level node

       . 3rd level 

        .3rd level 1

       .3rd level 2

    .2nd level 1

      . 3rd level 

        .3rd level 1

       .3rd level 2

    like that  I need to display first time  all 2nd level nodes and when I am selecting 2nd level then related 3rd level nodes.

    ....etc . now I am getting the output like dispaly 2nd level nodes first then selecting 2nd level 3rd level is displaying  but when I am selecting 3rd level all 3rd level node are disappear

    Regards,

    sravani

     

     

       

  • Lachlann 344 posts 626 karma points
    Jun 21, 2011 @ 12:58
    Lachlann
    0

    Hey yeah,

    Basically you need to do a test before you loop through the children nodes to check if the current page id is equal to any of the children ids.

     <xsl:if test="./descendant-or-self::*/@id = $currentPage/@id">

    may work, I think

     

    L

     

     

  • sravani 50 posts 70 karma points
    Jun 21, 2011 @ 13:13
    sravani
    0

    Thanks a lot ,

    Its  working great.....

    Regards,

    sravani. 

Please Sign in or register to post replies

Write your reply to:

Draft