Copied to clipboard

Flag this post as spam?

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


  • Tom 713 posts 954 karma points
    Mar 26, 2011 @ 06:43
    Tom
    0

    New Schema Menu Not Working?

    Hi guys.. The new schema is giving me grief

    Try as i might i can't get a simple menu working

    I have the following output with the following xslt:

    <xsl:copy-of select="$currentPage/ancestor-or-self::root/*"/>
    <standardPage id="1086" parentID="-1" level="1" writerID="0" creatorID="0" nodeType="1084" template="1048" sortOrder="0" createDate="2011-03-26T15:10:56" updateDate="2011-03-26T16:03:03" nodeName="Home" urlName="home" writerName="actionadmin" creatorName="actionadmin" path="-1,1086" isDoc=""><umbracoNaviHide>0</umbracoNaviHide><bodyText></bodyText><siteName>Action Soundproofing</siteName><siteDescription>Action soundproofing</siteDescription><standardPage id="1087" parentID="1086" level="2" writerID="0" creatorID="0" nodeType="1084" template="1085" sortOrder="1" createDate="2011-03-26T15:12:20" updateDate="2011-03-26T15:51:14" nodeName="About Us" urlName="about-us" writerName="actionadmin" creatorName="actionadmin" path="-1,1086,1087" isDoc=""><umbracoNaviHide>0</umbracoNaviHide><bodyText>
    &lt;p&gt;moo&lt;/p&gt;
    
    </bodyText><siteName>About Us</siteName><siteDescription></siteDescription></standardPage><applications id="1099" parentID="1086" level="2" writerID="0" creatorID="0" nodeType="1092" template="1093" sortOrder="2" createDate="2011-03-26T15:18:05" updateDate="2011-03-26T16:11:53" nodeName="Applications" urlName="applications" writerName="actionadmin" creatorName="actionadmin" path="-1,1086,1099" isDoc=""><umbracoNaviHide>0</umbracoNaviHide><bodyText></bodyText><siteName>Applications</siteName><siteDescription></siteDescription></applications></standardPage>

    sorry for the stuffed pre's but in that output there are a number of nodes with a level of 2

    When i try to generate my nav menu using the following xslt.. none of the nodes at level 2 appear.. can someone please help.. this used to be simpler under the older schema.. ive tried republishing, etc but try as i might i can't get it to work:

      <xsl:if test="count($currentPage/ancestor::root/* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']) &gt; '0'">
          <xsl:for-each select="$currentPage/ancestor::root/* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
          <li>
           <xsl:if test="@id = $currentPage/@id">
            <xsl:attribute name="class">current</xsl:attribute>
          </xsl:if>
        <class="navigation" href="{umbraco.library:NiceUrl(@id)}">
          <span><xsl:value-of select="@nodeName"/></span>
        </a>
      </li>
    </xsl:for-each>
          </xsl:if>
  • Rich Green 2246 posts 4008 karma points
    Mar 26, 2011 @ 07:30
    Rich Green
    1

    Hey Tom,

    Add a new xslt file and choose 'Navigation Prototype' this will give you a great start for navigation under the new schema.

    For info in your code above you do not need to count the nodes before your loop, as if there are no records your loop will not find any, therefore the count is redundant.

    Rich

  • Daniel Bardi 927 posts 2562 karma points
    Mar 26, 2011 @ 07:34
    Daniel Bardi
    0

    Look at the sitemap 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"
      exclude-result-prefixes="msxml umbraco.library">

      <xsl:output method="html"/>

      <xsl:param name="currentPage"/>
      <xsl:variable name="maxLevelForSitemap" select="6"/>
      
      <xsl:template match="/">
        <div id="sitemap">
          <xsl:call-template name="drawNodes">
            <xsl:with-param name="parent" select="$currentPage/ancestor-or-self::* [@level = 1]"/>
          </xsl:call-template>
        </div>
      </xsl:template>

      <xsl:template name="drawNodes">
        <xsl:param name="parent"/>

        <ul>
          <xsl:for-each select="$parent/* [string(umbracoNaviHide) != '1' and @isDoc]">
            <li>
              <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:template>
    </xsl:stylesheet>

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Mar 26, 2011 @ 09:42
    Jan Skovgaard
    0

    Hi Tom

    I would like to add the following to the above answers - Tommy Poulsen have made an online converter tool, which makes it easier to convert the old XML syntax to the new one. Maybe you can benefit from it. Try it out here: http://blackpoint.dk/umbraco-workbench/tools/convert-xml-schema-to-45-.aspx

    Otherwise it's always a good idea to look at what some of the predefined XSLT snippets looks like.

    /Jan

Please Sign in or register to post replies

Write your reply to:

Draft