diff options
author | William M. Brack <wbrack@src.gnome.org> | 2007-05-31 19:40:11 +0000 |
---|---|---|
committer | William M. Brack <wbrack@src.gnome.org> | 2007-05-31 19:40:11 +0000 |
commit | a43a12e28c008a3badfcfd8eef1b531769997b70 (patch) | |
tree | 1b93862c684aa2509c94364df854fbc975136072 | |
parent | 78ef3fda7bf7b5fa796571891b4072d02fc518f7 (diff) | |
download | libxslt-a43a12e28c008a3badfcfd8eef1b531769997b70.tar.gz libxslt-a43a12e28c008a3badfcfd8eef1b531769997b70.tar.bz2 libxslt-a43a12e28c008a3badfcfd8eef1b531769997b70.zip |
fixed obscure namespace problem related to exclude-result-prefix
* libxslt/xslt.c: fixed obscure namespace problem related to
exclude-result-prefix
svn path=/trunk/; revision=1429
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | libxslt/xslt.c | 25 |
2 files changed, 22 insertions, 8 deletions
@@ -1,3 +1,8 @@ +Thu May 31 12:38:08 PDT 2007 WIlliam Brack <wbrack@mmm.com.hk> + + * libxslt/xslt.c: fixed obscure namespace problem related to + exclude-result-prefix + Mon May 7 00:14:28 HKT 2007 William Brack <wbrack@mmm.com.hk> * libxslt/transform.c: fixed minor compilation warning; no change diff --git a/libxslt/xslt.c b/libxslt/xslt.c index bead6db5..b0b31601 100644 --- a/libxslt/xslt.c +++ b/libxslt/xslt.c @@ -3469,7 +3469,7 @@ xsltPrecomputeStylesheet(xsltStylesheetPtr style, xmlNodePtr cur) } if ((cur->nsDef != NULL) && (style->exclPrefixNr > 0)) { - xmlNsPtr ns = cur->nsDef, prev = NULL, next; + xmlNsPtr ns = cur->nsDef, prev = NULL, next, rns; xmlNodePtr root = NULL; int i, moved; @@ -3482,18 +3482,27 @@ xsltPrecomputeStylesheet(xsltStylesheetPtr style, xmlNodePtr cur) if ((ns->prefix != NULL) && (xmlStrEqual(ns->href, style->exclPrefixTab[i]))) { - /* - * Move the namespace definition on the root - * element to avoid duplicating it without - * loosing it. - */ + /* Remove the namespace from this node */ if (prev == NULL) { cur->nsDef = ns->next; } else { prev->next = ns->next; } - ns->next = root->nsDef; - root->nsDef = ns; + /* + * If this prefix is not already present, + * move the namespace definition on the root + * element to avoid duplicating it without + * loosing it. + */ + for (rns = root->nsDef; rns != NULL; rns = rns->next) + if (xmlStrEqual(ns->prefix, rns->prefix)) + break; + if (rns == NULL) { + ns->next = root->nsDef; + root->nsDef = ns; + } + else + xmlFreeNs(ns); moved = 1; break; } |