Copied to clipboard

Flag this post as spam?

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


  • praveen 113 posts 164 karma points
    Jul 22, 2011 @ 01:35
    praveen
    0

    Umbraco 4.7 sitemap not working

    Hi there

    UMBRACO 4.7

    The sitemap does not work, the screen shot is as follows:

    The nodes from home to Contact are the nodes which needs to be displayed in the sitemap, and the flag "include from sitemap" is selected. Rest of the nodes need not appear in the sitemap so I have unselcted "include from sitemap"

    XSLT CODE

    <?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"/>

    <!-- update this variable on how deep your site map should be -->
    <xsl:variable name="maxLevelForSitemap" select="4"/>
     
    <xsl:template match="/">

    <div id="sitemap">
    <ul>
     <xsl:for-each select="$currentPage/ancestor-or-self::root/node[string(data [@alias='umbracoNaviHide']) != '1' and string(data [@alias='sitemapinclude']) = '1']">
      <li>
       <a href="{umbraco.library:NiceUrl(@id)}"> <xsl:value-of select="@nodeName"/></a>
       <xsl:call-template name="drawNodes"> 
        <xsl:with-param name="parent" select="."/> 
       </xsl:call-template>
      </li>
     </xsl:for-each>
     </ul>
    </div>

    <!--<div id="sitemap"><xsl:call-template name="drawNodes"><xsl:with-param name="parent" select="$currentPage/ancestor-or-self::root/node"/>  </xsl:call-template></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 and umbraco.library:IsLoggedOn() = 1)">
     <xsl:if test="count(./node [string(./data [@alias='umbracoNaviHide']) != '1' and string(./data [@alias='sitemapinclude']) = '1']) &gt; 0">
      <ul>
       <xsl:for-each select="$parent/node [string(./data [@alias='umbracoNaviHide']) != '1' and string(data [@alias='sitemapinclude']) = '1']">
       <li> 
        <a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="@nodeName"/></a> 
       
        <xsl:call-template name="drawNodes">   
         <xsl:with-param name="parent" select="."/>   
        </xsl:call-template> 
       
       </li>
       </xsl:for-each>
      </ul>
     </xsl:if>
    </xsl:if>
    </xsl:template>
    </xsl:stylesheet>

    Your help is greatly appreciated

    Kind Regards

    Praveen

     

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Jul 22, 2011 @ 07:54
    Dirk De Grave
    0

    Praveen,

    you're using umbraco v4.7+ which has a new xml schema by default unless you override this setting in the config file. So, instead of using /data [@alias = 'alias'], you should be using /alias

    For example

     <xsl:for-each select="$currentPage/ancestor-or-self::root/node[string(data [@alias='umbracoNaviHide']) != '1' and string(data [@alias='sitemapinclude']) = '1']">

    needs to be

     <xsl:for-each select="$currentPage/ancestor-or-self::root/node[@isDoc and umbracoNaviHide != '1' and sitemapinclude = '1']">

     

    Hope this helps.

    Regards,

    /Dirk

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Jul 22, 2011 @ 07:55
    Dirk De Grave
    0

    Ah, can't edit my post.

    2nd code snippet should be

    <xsl:for-eachselect="$currentPage/ancestor-or-self::root/*[@isDoc and umbracoNaviHide != '1' and sitemapinclude = '1']">

    Cheers,

    /Dirk

  • praveen 113 posts 164 karma points
    Jul 25, 2011 @ 05:12
    praveen
    0

    Hi Dirk

    I have modified the XSLT as advised, still does not work:

    <?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"/>

    <!-- update this variable on how deep your site map should be -->
    <xsl:variable name="maxLevelForSitemap" select="4"/>
     
    <xsl:template match="/">

    <div id="sitemap">
    <ul>
              <xsl:for-each select="$currentPage/ancestor-or-self::root/node[@isDoc and umbracoNaviHide != '1' and sitemapinclude = '1']">
      <li>
       <a href="{umbraco.library:NiceUrl(@id)}"> <xsl:value-of select="@nodeName"/></a>
       <xsl:call-template name="drawNodes"> 
        <xsl:with-param name="parent" select="."/> 
       </xsl:call-template>
      </li>
     </xsl:for-each>
     </ul>
    </div>

    <!--<div id="sitemap"><xsl:call-template name="drawNodes"><xsl:with-param name="parent" select="$currentPage/ancestor-or-self::root/node"/>  </xsl:call-template></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 and umbraco.library:IsLoggedOn() = 1)">
     <xsl:if test="count(./node [string(./data [@alias='umbracoNaviHide']) != '1' and string(./data [@alias='sitemapinclude']) = '1']) &gt; 0">
      <ul>
                                 <xsl:for-each select="$currentPage/ancestor-or-self::root/*[@isDoc and umbracoNaviHide != '1' and sitemapinclude = '1']">
       <li> 
        <a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="@nodeName"/></a> 
       
        <xsl:call-template name="drawNodes">   
         <xsl:with-param name="parent" select="."/>   
        </xsl:call-template> 
       
       </li>
       </xsl:for-each>
      </ul>
     </xsl:if>
    </xsl:if>
    </xsl:template>
    </xsl:stylesheet>

     

  • praveen 113 posts 164 karma points
    Jul 25, 2011 @ 05:18
    praveen
    0

    Hi Dirk,

    Please ignore my previous post, I used http://blackpoint.dk/umbraco-workbench/tools/convert-xml-schema-to-45-.aspx? to convert the code and now it works, many thanks for your help

    Regards

    /praveen

Please Sign in or register to post replies

Write your reply to:

Draft