Copied to clipboard

Flag this post as spam?

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


  • J 447 posts 864 karma points
    Jul 03, 2013 @ 20:44
    J
    0

    Iterate through Second node

    I am using Umbraco and have created a macro with the below code. I can currently get all the nodes where i have created a root directory for them but have tried several ways to get the secondary items e.g.

    Folder1

    Folder2

    I can iterate through the above node but whatever is inside Folder1 and Folder2 i would like to iterate through them and display them. Here is my XSLT

    <?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"/>
    
    <!-- Input the documenttype you want here -->
    <xsl:variable name="level" select="1"/>
    
    <xsl:template match="/">
    
    <!-- The fun starts here -->
     <ul class="navbar">
       <li class="act"><a href="/">Home</a></li>
    <xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
      <li class="dropdown">
        <a href="{umbraco.library:NiceUrl(@id)}" class="dropdown-toggle" data-toggle="dropdown">
          <xsl:value-of select="@nodeName"/>
        </a>
    
              <xsl:if test="count(./child::*[@isDoc and string(umbracoNaviHide) != '1']) &gt; 0">
                    <ul class="dropdown-menu">
                       <xsl:for-each select="./child::*[@isDoc and string(umbracoNaviHide) != '1']">
                          <li>
                            <a href="{umbraco.library:NiceUrl(@id)}">
                              <xsl:value-of select="@nodeName"/>
                            </a>
                          </li>                     
                       </xsl:for-each>
                    </ul>     
        </xsl:if>     
        </li>
      </xsl:for-each>
      </ul>
        </xsl:template>
        </xsl:stylesheet>

    Any idea on how to resolve this?

    Thanks

  • Ernst Utvik 123 posts 235 karma points
    Jul 03, 2013 @ 23:12
    Ernst Utvik
    0

    Try replacing:

    <xsl:iftest="count(./child::*[@isDoc and string(umbracoNaviHide) != '1']) &gt; 0">
    <ulclass="dropdown-menu">
       
    <xsl:for-eachselect="./child::*[@isDoc and string(umbracoNaviHide) != '1']">

    With this:

    <xsl:iftest="count(child::*[@isDoc and string(umbracoNaviHide) != '1']) &gt; 0">
    <ulclass="dropdown-menu">
       
    <xsl:for-eachselect="child::*[@isDoc and string(umbracoNaviHide) != '1']">
Please Sign in or register to post replies

Write your reply to:

Draft