one more libxslt bug
That's not funny. Again the namespaces, again a libxslt bug. Libxslt is confused when XSLT and XML use the same prefix with different URI.
The following stylesheet adds attribute "y:foo" to each element, the
full name of the attribute is "{y:y:y}foo".
[code]
<x:stylesheet
xmlns:x = "http://www.w3.org/1999/XSL/Transform"
xmlns:y = "y:y:y"
version = "1.0">
<!-- -->
<x:template match="node()|@*">
<x:copy>
<x:attribute name="y:foo">bar</x:attribute>
<x:apply-templates select="node()|@*"/>
</x:copy>
</x:template>
</x:stylesheet>
[/code]
Apply the stylesheet to the following XML.
[code]
<a xmlns:y="y2:y2:y2">
<b y:white="white">
<c y:black="black"/>
</b>
</a>
[/code]
Result is the following.
[code]
<?xml version="1.0"?>
<a xmlns:y="y2:y2:y2" y:foo="bar">
<b y:foo="bar" y:white="white">
<c y:foo="bar" y:black="black"/>
</b>
</a>
[/code]
The full name of the "foo" attribute is "{y2:y2:y2}foo", but should be
"{y:y:y}foo".
By the way, saxon generates the following:
[code]
<?xml version="1.0" encoding="utf-8"?>
<a xmlns:y="y2:y2:y2" xmlns:y.5="y:y:y" y.5:foo="bar">
<b y.5:foo="bar" y:white="white">
<c y.5:foo="bar" y:black="black"/>
</b>
</a>
[/code]
I've submitted the bug to the libxslt team.
Categories: