GNOME Bugzilla – Bug 538941
Incorrectly omits namespace declaration on created elements
Last modified: 2013-08-05 10:51:54 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.
This is a duplicate of bug 341870.
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 :-(.
*** This bug has been marked as a duplicate of bug 341870 ***