+Thu Jul 1 10:07:55 HKT 2004 William Brack <wbrack@mmm.com.hk>
+
+ * libxslt/transform.c: added coding to xsltCopyTree to copy
+ namespaces (bug 139578).
+ * tests/general/bug-128.out: changed to reflect above fix
+ * libxslt/xslt.c: minor change to an error message
+
Wed Jun 30 18:41:20 CEST 2004 Daniel Veillard <daniel@veillard.com>
* win32/Makefile.msvc win32/Makefile.mingw libexslt/Makefile.am
*/
if ((node->type == XML_ELEMENT_NODE) ||
(node->type == XML_ATTRIBUTE_NODE)) {
+ xmlNsPtr *nsList, *cur, ns;
if (node->ns != NULL)
copy->ns = xsltGetNamespace(ctxt, node, node->ns, copy);
- else if ((insert != NULL) && (insert->type == XML_ELEMENT_NODE) &&
- (insert->ns != NULL)) {
+ else if ((insert->type == XML_ELEMENT_NODE) && (insert->ns != NULL)) {
xmlNsPtr defaultNs;
defaultNs = xmlSearchNs(insert->doc, insert, NULL);
if (defaultNs != NULL)
xmlNewNs(copy, BAD_CAST "", NULL);
}
+ /*
+ * must also add in any new namespaces in scope for the node
+ */
+ nsList = xmlGetNsList(node->doc, node);
+ if (nsList != NULL) {
+ cur = nsList;
+ while (*cur != NULL) {
+ ns = xmlSearchNsByHref(insert->doc, insert, (*cur)->href);
+ if (ns == NULL)
+ xmlNewNs(copy, (*cur)->href, (*cur)->prefix);
+ cur++;
+ }
+ xmlFree(nsList);
+ }
}
if (node->nsDef != NULL) {
if (literal)
sizeof(xmlNsPtr));
if (ret == NULL) {
xmlGenericError(xmlGenericErrorContext,
- "xmlGetNsList : out of memory!\n");
+ "xsltGetInheritedNsList : out of memory!\n");
return(0);
}
ret[nbns] = NULL;
sizeof(xmlNsPtr));
if (ret == NULL) {
xmlGenericError(xmlGenericErrorContext,
- "xmlGetNsList : realloc failed!\n");
+ "xsltGetInheritedNsList : realloc failed!\n");
return(0);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<test:data xmlns:test="http://www.example.org/test">
- <test:a a="1"/>
- <test:b b="1"/>
+ <test:a xmlns:xsl="http://www.w3.org/1999/XSL/Transform" a="1"/>
+ <test:b xmlns:xsl="http://www.w3.org/1999/XSL/Transform" b="1"/>
</test:data>