GNOME Bugzilla – Bug 680938
libxslt does not signal an error on invalid xsl:key
Last modified: 2012-09-07 06:31:50 UTC
I reported this bug yesterday on http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=683353 and I could reproduce it after recompiling libxslt from the GIT repository. Consider the following stylesheet: <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:param name="var"/> <xsl:key name="key" match="*[@id != $var]" use="''"/> </xsl:stylesheet> The XSLT 1.0 specifications say in 12.2: It is an error for the value of either the use attribute or the match attribute to contain a VariableReference. and in 17: A conforming XSLT processor must signal any errors except for those that this document specifically allows an XSLT processor not to signal. So, since the match attribute contains $var, one would expect an error to be signaled. But: ypig:~> ~/software/libxslt/xsltproc/xsltproc tst.xsl tst.xsl <?xml version="1.0"?> ypig:~> ~/software/libxslt/xsltproc/xsltproc --version Using libxml 20800, libxslt 10126-GITv1.1.26-32-g8785a2f and libexslt 815 xsltproc was compiled against libxml 20800, libxslt 10126 and libexslt 815 libxslt 10126 was compiled against libxml 20800 libexslt 815 was compiled against libxml 20800
Okay, fixed upstream: thinkpad:~/XSLT -> xsltproc/xsltproc 680938.xsl 680938.xsl XPath error : Forbidden variable //*[@id != $var] ^ compilation error: file 680938.xsl line 5 element key xsl:key : XPath pattern compilation failed '//*[@id != $var]' thinkpad:~/XSLT -> echo $? 5 thinkpad:~/XSLT -> in commit: http://git.gnome.org/browse/libxslt/commit/?id=0ae3194eb58d954d0896ef05e3dacf76350a8bc2 this extra libxml2 commit improves the error message http://git.gnome.org/browse/libxml2/commit/?id=47881284aeaeeb93b3444419adeffc9e11ed1093 thanks ! Daniel