GNOME Bugzilla – Bug 313890
namespace collision with xsl:element and xsl:attribute
Last modified: 2006-06-19 18:25:57 UTC
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]
Right that's a bug, Daniel
Fixed in CVS HEAD. Thanks for the report! The following input: <?xml version="1.0"?> <a xmlns:y="y2:y2:y2"> <b y:white="white"> <c y:black="black"> <d y:red="red"/> </c> </b> </a> Produces now this result: <?xml version="1.0"?> <a xmlns:y="y2:y2:y2" xmlns:y_1="y:y:y" y_1:foo="bar"> <b xmlns:y="y:y:y" xmlns:y_2="y2:y2:y2" y:foo="bar" y_2:white="white"> <c y:foo="bar" y_2:black="black"> <d y:foo="bar" y_2:red="red"/> </c> </b> </a>