After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 705865 - xsl:key "Forbidden variable" bug in v1.1.28
xsl:key "Forbidden variable" bug in v1.1.28
Status: RESOLVED NOTABUG
Product: libxslt
Classification: Platform
Component: general
unspecified
Other Mac OS
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2013-08-12 17:53 UTC by Sanders Kleinfeld
Modified: 2013-08-13 16:38 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Sanders Kleinfeld 2013-08-12 17:53:59 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, &quot; &quot;, @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
Comment 1 Sanders Kleinfeld 2013-08-13 16:38:17 UTC
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