GNOME Bugzilla – Bug 705865
xsl:key "Forbidden variable" bug in v1.1.28
Last modified: 2013-08-13 16:38:17 UTC
A user of one of my XSL stylesheets noticed that the following xsl:key instruction is throwing an error in v1.1.28 (but is fine in v.1.1.26): <xsl:key name="letter" match="h:a[@data-type='indexterm']" use="translate(substring(normalize-space(concat(@data-primary-sortas, " ", @data-primary)), 1, 1),$index-letter-chars,$index-letter-chars-normalized)"/> Error thrown is as follows: XPath error : Forbidden variable compilation error: file ../HTMLBook/htmlbook-xsl/indexgen.xsl line 29 element key xsl:key : 'use' expression compilation failed 'translate(substring(normalize-space(concat(@data-primary-sortas, " ", @data-primary)), 1, 1),$index-letter-chars,$index-letter-chars-normalized)' Full XSL stylesheet is attached for reference (via https://github.com/oreillymedia/HTMLBook/blob/master/htmlbook-xsl/indexgen.xsl). I suspect this error is related to an issue with variables being used in an xsl:key "use" attribute Let me know if you have any questions or need more info. Thanks, Sanders
Actually, on taking a closer look, I see that the XSLT 1.0 spec prohibits variable usage in the "use" attribute for an xsl:key, so the current behavior is indeed correct, and this is not a bug. Sorry for the erroneous report. Sanders