Copied to clipboard

Flag this post as spam?

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

  • J 445 posts 862 karma points
    Jul 03, 2013 @ 20:44

    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.



    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;"> ]>
      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"/>
              <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']">
                            <a href="{umbraco.library:NiceUrl(@id)}">
                              <xsl:value-of select="@nodeName"/>

    Any idea on how to resolve this?


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

    Try replacing:

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

    With this:

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

Write your reply to: