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:
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.
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/*"/>
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']) > '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>
<a class="navigation" href="{umbraco.library:NiceUrl(@id)}">
<span><xsl:value-of select="@nodeName"/></span>
</a>
</li>
</xsl:for-each>
</xsl:if>
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
Look at the sitemap xslt.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>
<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>
<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:template>
</xsl:stylesheet>
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
is working on a reply...