Is an <xsl:param> statement required for all global variables? xsltproc will happily allow a reference to an undeclared param _if_ the param has a value passed in. I noticed today that a customer's script was depending on this behavior, which I thought would be an error.
In this example the variable "test" is not declared. Running xsltproc without a "--param test" gives an error but with a "--param test" it runs fine. % cat test.xsl <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/"> <out> <value> <xsl:value-of select="concat("test: ", $test)"/> </value> </out> </xsl:template> </xsl:stylesheet> % xsltproc test.xsl test.xml runtime error: file test.xsl line 6 element value-of Variable 'test' has not been declared. xmlXPathCompOpEval: parameter error runtime error: file test.xsl line 6 element value-of XPath evaluation returned no result. <?xml version="1.0"?> <out><value/></out> % xsltproc --param test '"test"' test.xsl test.xml <?xml version="1.0"?> <out><value>test: test</value></out> % Thanks, Phil _______________________________________________ xslt mailing list, project page http://xmlsoft.org/XSLT/ [email protected] http://mail.gnome.org/mailman/listinfo/xslt
