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 305739 - xsltproc uses the default namespace of the trafo instead of the one specified in the xsl:element name attribute using a QName
xsltproc uses the default namespace of the trafo instead of the one specified...
Status: RESOLVED FIXED
Product: libxslt
Classification: Platform
Component: general
1.1.14
Other Linux
: Normal normal
: ---
Assigned To: kbuchcik
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2005-05-28 11:40 UTC by haui
Modified: 2006-06-19 18:28 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description haui 2005-05-28 11:40:35 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.
Comment 1 kbuchcik 2006-06-19 18:28:13 UTC
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"/>