Copied to clipboard

Flag this post as spam?

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


  • Cookie Monster 7 posts 27 karma points
    Dec 18, 2012 @ 10:52
    Cookie Monster
    0

    Node Children empty

    Hi I have the folling macro

     

     

    <xsl:template match="/">
    <ul class="nav">

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

    <li>
    <xsl:if test="count(./node) > 0">
    <xsl:attribute name="class">dropdown</xsl:attribute>
    </xsl:if>

    <a href="{umbraco.library:NiceUrl(@id)}">
    <xsl:value-of select="@nodeName"/>
    </a>
    </li>
    </xsl:for-each>
    </ul>

    </xsl:template>

     

     

    This issue i have is that for some reason the count for the child nodes always comes back as 0

    i am using the latest umbraco

    thanks!

     

  • Chriztian Steinmeier 2726 posts 8320 karma points MVP 4x admin c-trib
    Dec 18, 2012 @ 10:58
    Chriztian Steinmeier
    0

    Hi Cookie Monster (!)

    The check on "node" comes from the old "legacy" XML Schema - you can just check for any childnode instead:

    <xsl:template match="/">
        <ul class="nav">
            <xsl:for-each select="$currentPage/ancestor-or-self::*[@isDoc and @level = $level]/*[@isDoc and not(umbracoNaviHide = 1)]">
                <li>
                    <xsl:if test="*[@isDoc]">
                        <xsl:attribute name="class">dropdown</xsl:attribute>
                    </xsl:if>
                    <a href="{umbraco.library:NiceUrl(@id)}">
                        <xsl:value-of select="@nodeName"/>
                    </a>
                </li>
            </xsl:for-each>
        </ul>
    </xsl:template>

    But you may want to include the umbracoNaviHide check in there too..?

    /Chriztian 

  • Cookie Monster 7 posts 27 karma points
    Dec 18, 2012 @ 11:03
    Cookie Monster
    0

    Hi Chriztian

    Thanks for the help, that worked!

    When did umbraco undergo the last schema change  ?  is the latest schema different from 4.7 ?

  • Chriztian Steinmeier 2726 posts 8320 karma points MVP 4x admin c-trib
    Dec 18, 2012 @ 11:07
    Chriztian Steinmeier
    0

    Hi again,

    As of version 4.5 there was a new Schema: http://our.umbraco.org/wiki/reference/xslt/45-xml-schema

    No - no schema changes for the last couple of years, actually :-)

    But you could easily have been handed an older site, or work on a new version that was set to use the old schema.

    If you have *any* say in this, make sure to use the new one - it's far superior and easier to work with :-) 

    /Chriztian

  • 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