GNOME Bugzilla – Bug 305739
xsltproc uses the default namespace of the trafo instead of the one specified in the xsl:element name attribute using a QName
Last modified: 2006-06-19 18:28:25 UTC
This is closely related to Bug 136914, but it's not the same, since the test case for Bug 136914 still work in > rpm -q --whatprovides `which xsltproc` libxslt-1.1.14-0.1 > rpm -q --whatprovides `which xmlcatalog` libxml2-2.6.19-0.1 while the following test does'nt. Best regards, Bernhard Haumacher. Assume the following command: xsltproc test-trafo.xsl test-input.xml > test-output.xml with the files --- test-trafo.xsl <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns="http://www.haumacher.de/namespace/c" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:a="http://www.haumacher.de/namespace/a" xmlns:b="http://www.haumacher.de/namespace/b" exclude-result-prefixes="a xsl"> <xsl:template match="a:body"> <xsl:element name="b:body"/> </xsl:template> </xsl:stylesheet> --- --- test-input.xml <?xml version="1.0" encoding="UTF-8"?> <body xmlns="http://www.haumacher.de/namespace/a"/> --- xsltproc produces --- test-output.xml <?xml version="1.0"?> <b:body xmlns:b="http://www.haumacher.de/namespace/c"/> --- which is oviously wrong according to the spec, since the name attribute of xsl:element must be interpreted as QName. Therefor b:body must have the namespace http://www.haumacher.de/namespace/b associated instead of the default namespace of the trafo, which is http://www.haumacher.de/namespace/c The correct result should be: --- test-output-correct.xml <?xml version="1.0"?> <b:body xmlns:b="http://www.haumacher.de/namespace/b"/> --- xsltproc produces this correct result, when removing the default namespace declaration from the transformation, or specifying the namespace explicitly in the xsl:element as namespace attribute.
Fixed in CVS HEAD. Thanks for the report! The current result is: <?xml version="1.0"?> <b:body xmlns:b="http://www.haumacher.de/namespace/b"/>