XSLT error after upgrading fra 2.7 to 3.0.3 Options
Michael Olsen
Posted: Tuesday, August 05, 2008 2:37:54 PM
Rank: Newbie

Joined: 8/5/2008
Posts: 4
Location: DK
Hi,

The following menu xslt stopped working after upgradering to 3.0.3

Any hints ?

<?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="xml" omit-xml-declaration="yes" />

<xsl:param name="currentPage"/>

<xsl:variable name="level" select="1"/>

<xsl:template match="/">

<xsl:call-template name="printListe">
<xsl:with-param name="node" select="$currentPage/ancestor-or-self::node [@level = 1 and string(data [@alias='umbracoNaviHide']) != '1']"/>
<xsl:with-param name="id" select="string('nav')"/>
</xsl:call-template>
</xsl:template>

<xsl:template name="printListe">
<xsl:param name="node"/>
<xsl:param name="id"/>
<xsl:if test="$node/@level &lt;= 2">

<xsl:if test="$id != ''">
<xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
</xsl:if>
<xsl:for-each select="$node/node [string(data [@alias='umbracoNaviHide']) != '1']">
<li>
<xsl:if test="$node/@level = 1">
<xsl:choose>
<xsl:when test="$currentPage/ancestor-or-self::node/@id = current()/@id">
<xsl:attribute name="class">selected</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="class">notselected</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
<a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="@nodeName"/></a>
<xsl:if test="count(./node) &gt; 0">
<xsl:if test="$node/@level &lt;= 1">
<ul>
<xsl:call-template name="printListe">
<xsl:with-param name="node" select="."/>
</xsl:call-template>
</ul>
</xsl:if>
</xsl:if>
</li>
</xsl:for-each>

</xsl:if>

</xsl:template>
</xsl:stylesheet>

Thanks
drobar
Posted: Tuesday, August 05, 2008 3:05:56 PM

Rank: Umbracoholic

Joined: 9/8/2006
Posts: 1,696
Location: KY, USA
When you say "stopped working"... what do you mean?

Does it give an XSLT error? If so, what's the error? (you can see it by adding ?umbDebugShowTrace=true to the end of your URL and then scroll down to the red text)

Does the XSLT work fine but the html output in the browser is different than it was? If so, look in the html code of your browser and see if there are any items that don't have an explicit closing tag. Likely offenders are <div/> <ul/> <li/>.

Let us know.

cheers,
doug.

MVP 2007-2009 - Official Umbraco Trainer for North America - Percipient Studios
Michael Olsen
Posted: Wednesday, August 06, 2008 10:41:55 AM
Rank: Newbie

Joined: 8/5/2008
Posts: 4
Location: DK
Hi Doug,

Sorry for the lack of details.

It renders with the typical error : Error parsing XSLT file

Debuggings shows the following error

Error parsing XSLT topmenu.xslt
An item of type 'Attribute' cannot be constructed within a node of type 'Root'.
at System.Xml.Xsl.Runtime.XmlQueryOutput.ThrowInvalidStateError(XPathNodeType constructorType)
at System.Xml.Xsl.Runtime.XmlQueryOutput.ConstructInEnumAttrs(XPathNodeType rootType)
at System.Xml.Xsl.Runtime.XmlQueryOutput.WriteStartAttribute(String prefix, String localName, String ns)
at System.Xml.Xsl.Runtime.XmlQueryOutput.WriteStartAttributeLocalName(String localName)
at <xsl:template name="printListe">(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, IList`1 node, String id)
at Root(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
at Execute(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlSequenceWriter results)
at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer, Boolean closeWriter)
at System.Xml.Xsl.XmlILCommand.Execute(IXPathNavigable contextDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter results)
at System.Xml.Xsl.XmlILCommand.Execute(IXPathNavigable contextDocument, XmlResolver dataSources, XsltArgumentList argumentList, TextWriter results)
at System.Xml.Xsl.XslCompiledTransform.Transform(IXPathNavigable input, XsltArgumentList arguments, TextWriter results)
at umbraco.macro.loadMacroXSLT(macro macro, Hashtable attributes, page umbPage)


Thanks.
Michael Olsen
Posted: Wednesday, August 06, 2008 11:03:18 AM
Rank: Newbie

Joined: 8/5/2008
Posts: 4
Location: DK
Hi again,

Fixed it, removed the following lines
<xsl:if test="$id != ''">
<xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
</xsl:if>

As far as I can tell, its not used anyway.
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.