GNOME Bugzilla – Bug 70281
Namespace handling in variable RTF
Last modified: 2009-08-15 18:40:50 UTC
When using a variable to output a RTF, the root element looses its namespace : When applying this stylesheet on itself : <?xml version='1.0' encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns1="urn:test"> <xsl:output encoding="iso-8859-1" method="xml"/> <xsl:template match="/"> <xsl:variable name="out"> <ns1:root> <ns1:child>It only fails for the root element !</ns1:child> <xsl:apply-templates /> </ns1:root> </xsl:variable> <xsl:copy-of select="$out"/> </xsl:template> </xsl:stylesheet> We get : <?xml version="1.0" encoding="iso-8859-1"?> <root xmlns:ns1="urn:test"><ns1:child>It only fails for the root element !</ns1:child> It only fails for the root element ! </root> Where I think you should get : <?xml version="1.0" encoding="iso-8859-1"?> <ns1:root xmlns:ns1="urn:test"><ns1:child>It only fails for the root element !</ns1:child> It only fails for the root element ! </ns1:root>
1 line patch but hard to track ! Here is the patch fixing that bug: =================================================================== *** libxslt/transform.c 2002/01/27 12:56:30 1.162 --- libxslt/transform.c 2002/02/10 15:17:45 *************** *** 624,630 **** if (node->nsDef != NULL) xsltCopyNamespaceList(ctxt, copy, node->nsDef); if (node->ns != NULL) { ! copy->ns = xsltGetNamespace(ctxt, node, node->ns, insert); } if (node->properties != NULL) copy->properties = xsltCopyPropList(ctxt, copy, --- 624,630 ---- if (node->nsDef != NULL) xsltCopyNamespaceList(ctxt, copy, node->nsDef); if (node->ns != NULL) { ! copy->ns = xsltGetNamespace(ctxt, node, node->ns, copy); } if (node->properties != NULL) copy->properties = xsltCopyPropList(ctxt, copy, ================================================================== thanks for the report, Daniel
Fixed in libxslt-1.0.12, thanks for the report, Daniel