GNOME Bugzilla – Bug 338214
Incorrect scope for exclude-result-prefixes
Last modified: 2021-07-05 11:00:28 UTC
The scope of an xsl:exclude-result-prefixes on literal result elements is incorrectly not restricted to the subtree, but to the whole tree in general. 7.1.1 Literal Result Elements: "The designation of a namespace as an excluded namespace is effective within the subtree of the stylesheet rooted at the element bearing the exclude-result-prefixes or xsl:exclude-result-prefixes attribute" The following example demonstrates than the ns-declaration on <boo> with the prefix "bar" is removed, although it is excluded not until deeper in the tree on <bar>. (The fact that the resulting <foo> holds both ns-declarations is an other bug.) "erp.xsl" -------- <?xml version='1.0'?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <foo> <boo xmlns:foo="urn:test:foo" xmlns:bar="urn:test:bar" xsl:exclude-result-prefixes="foo"> <bar xmlns:foo="urn:test:foo" xmlns:bar="urn:test:bar" xsl:exclude-result-prefixes="bar"> <zoo xmlns:foo="urn:test:foo" xmlns:bar="urn:test:bar"/> </bar> </boo> </foo> </xsl:template> </xsl:stylesheet> type ..\test.xml <?xml version="1.0"?> <foo>zoo</foo> xsltproc erp.xsd ..\test.xml <?xml version="1.0"?> <foo xmlns:bar="urn:test:bar" xmlns:foo="urn:test:foo"><boo><bar><zoo/></bar></boo></foo>
Expected result: <?xml version="1.0"?> <foo><boo xmlns:bar="urn:test:bar"><bar><zoo/></bar></boo></foo>
This is fixed in the (not yet enabled) refactored code paths.
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org. As part of that, we are mass-closing older open tickets in bugzilla.gnome.org which have not seen updates for a longer time (resources are unfortunately quite limited so not every ticket can get handled). If you can still reproduce the situation described in this ticket in a recent and supported software version, then please follow https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines and create a new ticket at https://gitlab.gnome.org/GNOME/libxslt/-/issues/ Thank you for your understanding and your help.