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 538941 - Incorrectly omits namespace declaration on created elements
Incorrectly omits namespace declaration on created elements
Status: RESOLVED DUPLICATE of bug 341870
Product: libxslt
Classification: Platform
Component: general
1.1.22
Other Linux
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2008-06-18 11:44 UTC by Mike Hommey
Modified: 2013-08-05 10:51 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Mike Hommey 2008-06-18 11:44:52 UTC
This was reported as bug 486818 in debian, and I verified it applies to last release (1.1.22). Reading the spec, it seems to me the namespace declaration should be there. Even if I'm reading badly the spec, the behaviour between the two cases exposed shouldn't be different.

Here is the original report:

Example stylesheet: missing.xsl

<xsl:stylesheet
  version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:xhtml="http://www.w3.org/1999/XHTML">

<xsl:template match="/">
  <xsl:element name="foo">
    <bar/>
  </xsl:element>
</xsl:template>

</xsl:stylesheet>

Let's apply it.

$xsltproc missing.xsl missing.xsl
<?xml version="1.0"?>
<foo><bar/></foo>

The output is wrong: the namespace prefix 'xhtml' should be declared on element
bar.

Using the following, equivalent stylesheet instead of the above:

<xsl:stylesheet
  version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:xhtml="http://www.w3.org/1999/XHTML">

<xsl:template match="/">
  <xsl:element name="foo">
    <xsl:call-template name="bar"/>
  </xsl:element>
</xsl:template>

<xsl:template name="bar">
  <bar/>
</xsl:template>
</xsl:stylesheet>

the output is

<?xml version="1.0"?>
<foo><bar xmlns:xhtml="http://www.w3.org/1999/XHTML"/></foo>

which is correct.
Comment 1 Nick Wellnhofer 2009-09-23 00:51:08 UTC
This is a duplicate of bug 341870.
Comment 2 Éric Bischoff 2011-04-14 12:31:36 UTC
I am hit by this bug as well.

Honestly, I would prefer avoiding to clutter the result with namespace declarations ;-). So, to my own taste, the "correct" version is the first one ;-).

I did not have a look at what the specification says about this. But in any case, this inconsistency is really puzzling :-(.
Comment 3 Nick Wellnhofer 2013-08-05 10:51:54 UTC

*** This bug has been marked as a duplicate of bug 341870 ***