GNOME Bugzilla – Bug 136914
namespace in output tree with xsl:element when name specifies a non default namespace
Last modified: 2009-08-15 18:40:50 UTC
It appears that when using xsl:element with a non default namespace for the name attribute the output element namespace is not computed as expected. Here is a small example (mixing xul, xhtml, xsl) : 1/ XML <?xml version="1.0"?> <a> hhhh </a> 2/ XSL <?xml version="1.0" encoding="iso-8859-1" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:xhtml="http://www.w3.org/1999/xhtml" > <xsl:output method="xml" indent="yes" encoding="iso-8859-1" /> <xsl:template match="/"> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <windows> <vbox flex="1"> <xsl:apply-templates /> </vbox> </windows> </xsl:template> <xsl:template match="a"> <vbox> <xhtml:div>Hello</xhtml:div> <xsl:element name="xhtml:div"> foo </xsl:element> </vbox> </xsl:template> </xsl:stylesheet> xsltproc produces : <?xml version="1.0" encoding="iso-8859-1"?> <windows xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" x mlns:xhtml="http://www.w3.org/1999/xhtml"> <vbox flex="1"> <vbox> <xhtml:div>Hello</xhtml:div> <xhtml:div xmlns:xhtml="http://www.mozilla.org/keymaster/gatekeeper/there. is.only.xul"> foo </xhtml:div> </vbox> </vbox> </windows> while sablotron, msxml produce the expected result : <?xml version="1.0" encoding="iso-8859-1"?> <windows xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <vbox flex="1"> <vbox> <xhtml:div>Hello</xhtml:div> <xhtml:div> foo </xhtml:div> </vbox> </vbox> </windows> Of course using an additionnal namespace="http://www.w3.org/1999/xhtml" solves the problem. Stephane
I added some additional code which should fix this (libxslt/namespaces.c). I also added your test case to the regression tests to assure future fixes will take account of it. Fixes are in CVS - thanks for the report.
This should be closed by release of libxslt-1.1.5, thanks, Daniel