Copied to clipboard

Flag this post as spam?

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


  • Fuji Kusaka 2203 posts 4220 karma points
    Jun 08, 2011 @ 12:52
    Fuji Kusaka
    0

    Accessing a Drop Down Menu

    Hello Guys,

    I have the following structure in my Content and somehow I cant get my XSLT to populate the nodes as i want it to. Am actually using a Changeable Source XSLT with the following codes:

    <ul>
       <xsl:call-template name="drawNodes">  
          <xsl:with-param name="parent" select="$currentPage/ancestor-or-self::* [@isDoc and @level = 2 and string(umbracoNaviHide) != '1']"/>  
       </xsl:call-template>  
    </ul>
    </xsl:template>
        
        <xsl:template name="drawNodes">
        <xsl:param name="parent"/>   
        <xsl:if test="$parent/@level">
          <!--<ul>-->
            <xsl:for-each select="$parent/* [@isDoc and string(umbracoNaviHide) != '1']">
              <li>
                
                           
                
                   <xsl:attribute name="class">
                    <xsl:choose>
                         <xsl:when test="$parent/ancestor-or-self::* [@level = 3] ">
                             <xsl:text>left-menu-link</xsl:text>
                          </xsl:when>
                      
                          <xsl:otherwise>
                             <xsl:text></xsl:text>
                         </xsl:otherwise>                  
                    </xsl:choose>
                     
                    
                    
                    <xsl:if test="$currentPage/@id = current()/@id">
                       <xsl:text> active</xsl:text>
                    </xsl:if>
              </xsl:attribute>
               
              <a>
                 <xsl:attribute name="href"> <xsl:value-of select="umbraco.library:NiceUrl(@id)"/></xsl:attribute>
                 <xsl:value-of select="@nodeName"/>
              </a>
                
              </li>
                <!-- check if this is the current page AND if this has a child - if so run through again -->
                
              <xsl:if test="count(./* [@isDoc and string(umbracoNaviHide) != '1']) &gt; 0 and $currentPage/ancestor-or-self::*[@isDoc and @level]">   
                  <xsl:call-template name="drawNodes">    
                    <xsl:with-param name="parent" select="."/>    
                  </xsl:call-template>  
                </xsl:if>
              
              <!--</li>-->
            </xsl:for-each>
          <!--</ul>-->
        </xsl:if>
       
      </xsl:template>

    Here is how my Content Looks like and what am trying to do is to get the Nodes of SubContainer 1 to display.

    * Content

    ** Default

    ** Right Container (folder)

    // Sub Link 1

    // Sub Link 2

    ** Left Container (Folder)

    *** SubContainer 1

    // Sub Link 1

    // Sub Link 2

    /// Sub Sub Link 2

    /// Sub Sub Link 2

    // Sub Link 3

    *** SubContainer 2

    // Sub Link 1

    // Sub Link 2

    // Sub Link 3

     

    Can someone advise please??

     

    //Fuji

  • Tom Fulton 2030 posts 4996 karma points c-trib
    Jun 08, 2011 @ 14:10
    Tom Fulton
    0

    Hi Fuji,

    Is it displaying Subcontainer 1 and 2 but just not showing their sublinks when one is active?

    One thing I noticed is the line where you check for subpages and if the current node is the current page

                <!-- check if this is the current page AND if this has a child - if so run through again -->
              <xsl:if test="count(./* [@isDoc and string(umbracoNaviHide) != '1']) &gt; 0 and $currentPage/ancestor-or-self::*[@isDoc and @level]">

    I think it should be like below, to check if this page or it's parents ID match the current ID in the loop.

              <xsl:if test="count(./* [@isDoc and string(umbracoNaviHide) != '1']) &gt; 0 and $currentPage/ancestor-or-self::*[@isDoc]/@id = ./@id">

    -Tom

  • Fuji Kusaka 2203 posts 4220 karma points
    Jun 08, 2011 @ 15:50
    Fuji Kusaka
    0

    Hi Tom,

    What i want to achieve is only to show the nodes from SubContainer 1. The weird part of it is i got it working with one of my InnerTemplate but not the MasterHome Template.

    It must be because of the level am using....dont you think?

     

    //fuji

  • Fuji Kusaka 2203 posts 4220 karma points
    Jun 09, 2011 @ 06:56
    Fuji Kusaka
    0

    Tom I changed the Structure of my Content but still i cant get the Child Nodes. Like this

     

    *** SubContainer 1

    // Sub Link 1

    // Sub Link 2

    /// Sub Sub Link 2

    /// Sub Sub Link 2

    // Sub Link 3

  • Tom Fulton 2030 posts 4996 karma points c-trib
    Jun 10, 2011 @ 20:30
    Tom Fulton
    0

    Hey Fuji, sorry for the delay, did you get this figured out in your other threads?

    -Tom

  • Fuji Kusaka 2203 posts 4220 karma points
    Jun 11, 2011 @ 06:18
    Fuji Kusaka
    0

    Hi Tom, I changed the XSLT instead but thanks again for the support.

     

    //fuji

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies