GNOME Bugzilla – Bug 409047
variable name with leading/trailing spaces causes problems
Last modified: 2007-02-18 00:11:04 UTC
The xsltproc included in the current Cygwin distribution barfs on a style sheet with the following template: <xsl:template match="/"> <xsl:variable name=" foo ">foo</xsl:variable> <xsl:value-of select="$foo"/> </xsl:template> ... xsltproc test.xsl test.xsl runtime error: file test.xsl line 7 element value-of unregistered variable foo xmlXPathCompiledEval: evaluation failed ... xsltproc -V Using libxml 20626, libxslt 10117-CVS1062 and libexslt 813-CVS1062 xsltproc was compiled against libxml 20626, libxslt 10117 and libexslt 813 Saxon 6.5.3 complains already about the variable definition: Error at xsl:variable on line 6 of file:/<snip>/test.xsl: Variable name must be a valid QName which ought to be correct according to the XSLT 1.0 Rec (section 11: "The value of the name attribute is a QName"). The problem originally arose with the iso-schematron.xsl style sheet, which claims to be checked against Saxon 8, which supports XSLT 2.0. I have not made the effort to check whether spaces around variable names in variable definitions are legal in XSLT 2.0, nor whether Saxon 8 indeed runs the file. Conclusion: Either add a check that the value of the name attribute of a variable definition is indeed a QName, or trim the spaces, whatever the supported XSLT rec says.
This problem has already been fixed in the current release - 1.1.20