[4suite] XSL Node-set parameter lost?
Mike Brown
mike at skew.org
Fri Nov 3 15:29:16 MST 2006
nico wrote:
> Hello,
>
> I use 4suite XML 1.0 to compile some docbook files, and have some troubles
> when using some node-sets in template parameters. The original XSL file is
> heavily stripped here to show the problem.
>
> The troublesome is when I do something like this, where the colspec param
> passed to the row template is a node-set:
>
> <xsl:template match="row" mode="newtbl">
> <xsl:param name="colspec"/>
Here you have defaulted $colspec to be an empty string if has not been
passed in. I would default it to an empty node-set:
<xsl:param name="colspec" select="/.."/>
>
> <xsl:variable name="entries">
> <xsl:copy-of select="entry"/>
> </xsl:variable>
>
> <i>
> <xsl:value-of select="count($colspec/*)"/>
> </i>
> <xsl:apply-templates select="exsl:node-set($entries)" mode="newtbl">
> <xsl:with-param name="colspec" select="$colspec"/>
> </xsl:apply-templates>
> </xsl:template>
exsl:node-set($entries) returns a root node, because $entries is a root node.
You do not have an explicit template matching a root node with mode="newtbl",
so the built-in one is applied. The built-in one just calls apply-templates
with no params. It does not acknowledge any params, so $colspec does not get
passed on to the row template. The default kicks in. This is why you see the
error.
If xsltproc does not catch this, xsltproc is wrong :)
More information about the 4suite
mailing list