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



On 2008-04-15 15:55:39 +0200, Stefan Behnel wrote:
> Ahhh, right! I didn't even see that the <xsl:param> declaration was missing
> (this was based on a user's bug report).

Yes, this one is a bug.

> Still, libxslt behaves the same, even when I add the <xsl:param>
> declarations.
> So, this leaves us with two problems that should raise an error:
> 
> - accessing an undeclared variable (e.g. xsl:value-of w/o xsl:param/variable)
> 
> - passing an invalid (i.e. non-evaluatable) value as a parameter

libxslt behaves correctly here. I recall my example:

vin:~> xsltproc --param value "ival[" tst.xsl tst.xml
XPath error : Invalid expression
runtime error
Evaluating user parameter value failed

But "ival" is valid:

vin:~> xsltproc --param value "ival" tst.xsl tst.xml
<?xml version="1.0"?>
<a/>

I really don't think a leading slash is necessary. FYI, xalan behaves
in the same way:

vin:~> xalan -xsl tst.xsl -in tst.xml -param value ival
<?xml version="1.0" encoding="UTF-8"?><a/>

-- 
Vincent Lefèvre <vincent vinc17 org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)


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