I have the following xslt which is doing it's job to get the appropriate nodes into my navigation, every node above the current node up to the level 1 node, and the nodes at level 1 all the time...
It's not closing the html tags properly though, it seems like it creates a new <ul>every time it drops a level then closes it at the 1st level inside an <li> tag.
For some reason when I try that, it saves the xslt file correctly, but returns a "The connection was reset" error when I try to navigate anywhere. Odd...
Improper Nesting of Navigation
I have the following xslt which is doing it's job to get the appropriate nodes into my navigation, every node above the current node up to the level 1 node, and the nodes at level 1 all the time...
It's not closing the html tags properly though, it seems like it creates a new <ul>every time it drops a level then closes it at the 1st level inside an <li> tag.
<?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="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:param name="startLevel" select="1"/>
<xsl:template match="/">
<xsl:if test="count($currentPage/ancestor-or-self::node [@level = $startLevel]/node) > 0">
<ul id="mainNav">
<xsl:for-each select="$currentPage/ancestor-or-self::node [@level=$startLevel]/node [string(data [@alias='umbracoNaviHide']) != '1']">
<xsl:call-template name="drawnode">
<xsl:with-param name="level" select="1"/>
</xsl:call-template>
</xsl:for-each>
</ul>
</xsl:if>
</xsl:template>
<xsl:template name="drawnode">
<xsl:param name="level"/>
<li>
<xsl:choose>
<xsl:when test="@id=$currentPage/@id">
<xsl:attribute name="class">level<xsl:value-of select="$level"/>selected</xsl:attribute>
</xsl:when>
</xsl:choose>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
<xsl:if test="count(descendant-or-self::node [@id=$currentPage/@id]) > 0">
<ul>
<xsl:for-each select="node">
<xsl:call-template name="drawnode">
<xsl:with-param name="level" select="number($level)+1"/>
</xsl:call-template>
</xsl:for-each>
</ul>
</xsl:if>
</li>
</xsl:template>
</xsl:stylesheet>
Try start with change bottom part of code to:
Petr
For some reason when I try that, it saves the xslt file correctly, but returns a "The connection was reset" error when I try to navigate anywhere. Odd...
is working on a reply...