diff options
author | Daniel Veillard <veillard@src.gnome.org> | 2002-05-27 17:14:56 +0000 |
---|---|---|
committer | Daniel Veillard <veillard@src.gnome.org> | 2002-05-27 17:14:56 +0000 |
commit | 18dc8c87d4a7008cc2365f26caf53118527c0e33 (patch) | |
tree | 389cc89882ea992b38b5b01b604add19bff0490e | |
parent | d590144a326c772446662b1843635c9a5ff5851b (diff) | |
download | libxslt-18dc8c87d4a7008cc2365f26caf53118527c0e33.tar.gz libxslt-18dc8c87d4a7008cc2365f26caf53118527c0e33.tar.bz2 libxslt-18dc8c87d4a7008cc2365f26caf53118527c0e33.zip |
fix bug #81099 about duplicated namespace declarations, this might not be
* libxslt/namespaces.c libxslt/transform.c: fix bug #81099 about
duplicated namespace declarations, this might not be as generic as
it should but works well for DocBook stylesheets
Daniel
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | libxslt/namespaces.c | 6 | ||||
-rw-r--r-- | libxslt/transform.c | 14 |
3 files changed, 19 insertions, 7 deletions
@@ -1,3 +1,9 @@ +Mon May 27 19:14:46 CEST 2002 Daniel Veillard <daniel@veillard.com> + + * libxslt/namespaces.c libxslt/transform.c: fix bug #81099 about + duplicated namespace declarations, this might not be as generic as + it should but works well for DocBook stylesheets + Sat May 25 12:07:45 CEST 2002 Daniel Veillard <daniel@veillard.com> * libxslt.pc.in: fix bug #82970 diff --git a/libxslt/namespaces.c b/libxslt/namespaces.c index 801c7849..baff64c8 100644 --- a/libxslt/namespaces.c +++ b/libxslt/namespaces.c @@ -255,6 +255,12 @@ xsltCopyNamespaceList(xsltTransformContextPtr ctxt, xmlNodePtr node, while (cur != NULL) { if (cur->type != XML_NAMESPACE_DECL) break; + if ((node != NULL) && (node->ns != NULL) && + (xmlStrEqual(node->ns->href, cur->href)) && + (xmlStrEqual(node->ns->prefix, cur->prefix))) { + cur = cur->next; + continue; + } if (!xmlStrEqual(cur->href, XSLT_NAMESPACE)) { /* TODO apply cascading */ URI = (const xmlChar *) xmlHashLookup(ctxt->style->nsAliases, diff --git a/libxslt/transform.c b/libxslt/transform.c index c509a03d..56c86830 100644 --- a/libxslt/transform.c +++ b/libxslt/transform.c @@ -557,6 +557,11 @@ xsltCopyNode(xsltTransformContextPtr ctxt, xmlNodePtr node, if (copy != NULL) { copy->doc = ctxt->output; xmlAddChild(insert, copy); + if (((node->type == XML_ELEMENT_NODE) || + (node->type == XML_ATTRIBUTE_NODE)) && + (node->ns != NULL)) { + copy->ns = xsltGetNamespace(ctxt, node, node->ns, copy); + } if (node->type == XML_ELEMENT_NODE) { /* * Add namespaces as they are needed @@ -564,11 +569,6 @@ xsltCopyNode(xsltTransformContextPtr ctxt, xmlNodePtr node, if (node->nsDef != NULL) xsltCopyNamespaceList(ctxt, copy, node->nsDef); } - if (((node->type == XML_ELEMENT_NODE) || - (node->type == XML_ATTRIBUTE_NODE)) && - (node->ns != NULL)) { - copy->ns = xsltGetNamespace(ctxt, node, node->ns, copy); - } } else { xsltPrintErrorContext(ctxt, NULL, node); xsltGenericError(xsltGenericErrorContext, @@ -678,11 +678,11 @@ xsltCopyTree(xsltTransformContextPtr ctxt, xmlNodePtr node, /* * Add namespaces as they are needed */ - if (node->nsDef != NULL) - xsltCopyNamespaceList(ctxt, copy, node->nsDef); if (node->ns != NULL) { copy->ns = xsltGetNamespace(ctxt, node, node->ns, copy); } + if (node->nsDef != NULL) + xsltCopyNamespaceList(ctxt, copy, node->nsDef); if (node->properties != NULL) copy->properties = xsltCopyPropList(ctxt, copy, node->properties); |