(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, IList`1 parent) at
(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime) at Root(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime) at Execute(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
I think it may be to do with evaluating to a list, but I have no idea why replacing a static '1' with the variable $level (which will contain a '1') causes an error?
variable template parameter problem
I am calling a template with the following code:
<xsl:template match="/">
<xsl:variable name="level" select="$currentPage/macro/startLevel"/>
<xsl:variable name="showList" select="$currentPage/macro/showList"/>
<ul class="{$showList}">
<xsl:call-template name="drawNodes">
<xsl:with-param name="parent" select="$currentPage/ancestor-or-self::node [@level ='1']" />
</xsl:call-template>
</ul>
</xsl:template>
which validates correctly, however when I use the "level" variable in the parent select value I get an error:
<xsl:template match="/">
<xsl:variable name="level" select="$currentPage/macro/startLevel"/>
<xsl:variable name="showList" select="$currentPage/macro/showList"/>
<ul class="{$showList}">
<xsl:call-template name="drawNodes">
<xsl:with-param name="parent" select="$currentPage/ancestor-or-self::node [@level = $level]" />
</xsl:call-template>
</ul>
</xsl:template>
error:
(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, IList`1 parent)
at
(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
at Root(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
at Execute(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
I think it may be to do with evaluating to a list, but I have no idea why replacing a static '1' with the variable $level (which will contain a '1') causes an error?
Any help would be gratefully received.
The level might be null or empty, the XSLT parser probably can't validate the xslt without knowing this, try this:
<xsl:if test="string($level) != ''>
<xsl:with-param name="parent" select="$currentPage/ancestor-or-self::node [@level = $level]" />
</xsl:if>
is working on a reply...