Re: [xslt] Why is an invalid stylesheet parameter value not an error?


The subject line is a little misleading. If there is an undeclared
variable or param then the transform should error out. This is a bug.
With the extremely clear example from an earlier post, while passing in
a parameter named 'value', Saxon 6x, Saxon9x, and Xalan error out with
(a similar message):

SystemID: /home/me/tmp/test.xsl
Description: Failed to compile stylesheet. 1 error detected.

SystemID: /home/me/tmp/test.xsl
Location: 4:0
Description: Variable value has not been declared


When I run it with xsltproc. The transform succeeds AND fills in the
variable/param value! Definitely unexpected!

(from an earlier post in this thread):

This can be reproduced with xsltproc, BTW, using this XML file:


and this XSLT file:

<xsl:stylesheet xmlns:xsl="";;
    <xsl:template match="/">
        <a><xsl:value-of select="$value"/></a>

with this command:

    # xsltproc --param value "ival" test.xslt test.xml

The output is:

<?xml version="1.0"?>

It would really be helpful to get some kind of an error here, instead of
silently returning an unexpected result.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]