Copied to clipboard

Flag this post as spam?

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


  • Joachim 16 posts 36 karma points
    Oct 17, 2013 @ 14:19
    Joachim
    0

    modifying sitemap script - problems

    Hello

    Here is my sitemap script, it works fine:

    <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" exclude-result-prefixes="msxml 
    umbraco.library">
    
        <xsl:output method="xml" omit-xml-declaration="yes"/>
    
        <xsl:param name="currentPage"/>
    
        <!-- update this variable on how deep your navigation should be -->
        <xsl:variable name="maxLevel" select="18"/>
    
        <xsl:template match="/">
        <div id="sitemap">
        <ul>                
            <xsl:call-template name="drawNodes">
                    <xsl:with-param name="parent" select="$currentPage/ancestor-or-self::* [@level=1 and @isDoc]"/>
            </xsl:call-template>
        </ul>
        </div>
        </xsl:template>
    
        <xsl:template name="drawNodes">
            <xsl:param name="parent"/>
            <xsl:if test="umbraco.library:IsProtected($parent/@id, $parent/@path) = 0 or (umbraco.library:IsProtected($parent/@id, $parent/@path) = 1 or umbraco.library:IsLoggedOn() = 1)">
                <xsl:for-each select="$parent/* [@isDoc and string(umbracoNaviHide) != '1' and @level <= $maxLevel]">
                    <li>
                        <a href="{umbraco.library:NiceUrl(@id)}">
                            <xsl:value-of select="siteName"/>
                        </a>
                        <xsl:if test="count(./* [@isDoc and string(umbracoNaviHide) != '1' and @level <= $maxLevel]) > 0">
                            <ul>
                                <xsl:call-template name="drawNodes">
                                    <xsl:with-param name="parent" select="."/>
                                </xsl:call-template>
                            </ul>
                        </xsl:if>
                    </li>
                </xsl:for-each>
            </xsl:if>
        </xsl:template>
    </xsl:stylesheet>
    

    What I want to do is modify it so that it will only show the currents pages children.

    Example tree looks like this:

    Home
     - Services
        - Nail Clipping
          - Nail Polish
          - Nail Cleaning
        - Feet Cleaning
     - About
    

    So if I am under Services it will output:

    Please help me modify the script above to only show the children of the current page, I have tried so many thinks but I cannot figure out how to achieve this.

  • Chriztian Steinmeier 2726 posts 8320 karma points MVP 4x admin c-trib
    Oct 20, 2013 @ 09:48
    Chriztian Steinmeier
    0

    Hi Joachim,

    Looking at the code, I'd guess that if you just send in $currentPage as the $parent, it should work as expected:

    <xsl:call-template name="drawNodes">
        <xsl:with-param name="parent" select="$currentPage" />
    </xsl:call-template>
    

    Have you tried that?

    /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