diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2016-06-22 14:10:16 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2016-06-22 14:10:46 +0900 |
commit | effb43a066e70763fa89eb7142b7cb7b428694ad (patch) | |
tree | d9712da186814a92d207016209bb7e19d7db5596 /libexslt/dynamic.c | |
parent | 195f644cf7b5e93208b033fa7c5501c41cf82f59 (diff) | |
download | libxslt-effb43a066e70763fa89eb7142b7cb7b428694ad.tar.gz libxslt-effb43a066e70763fa89eb7142b7cb7b428694ad.tar.bz2 libxslt-effb43a066e70763fa89eb7142b7cb7b428694ad.zip |
Imported Upstream version 1.1.29upstream/1.1.29
Change-Id: I7d894ba27f8f8e886dbcece3bb3df8e69059cae9
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'libexslt/dynamic.c')
-rw-r--r-- | libexslt/dynamic.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/libexslt/dynamic.c b/libexslt/dynamic.c index e0bfe817..7b95fc5e 100644 --- a/libexslt/dynamic.c +++ b/libexslt/dynamic.c @@ -167,10 +167,27 @@ exsltDynMapFunction(xmlXPathParserContextPtr ctxt, int nargs) ctxt->context->proximityPosition = 0; for (i = 0; i < nodeset->nodeNr; i++) { xmlXPathObjectPtr subResult = NULL; + xmlNodePtr cur = nodeset->nodeTab[i]; ctxt->context->proximityPosition++; - ctxt->context->node = nodeset->nodeTab[i]; - ctxt->context->doc = nodeset->nodeTab[i]->doc; + ctxt->context->node = cur; + + if (cur->type == XML_NAMESPACE_DECL) { + /* + * The XPath module sets the owner element of a ns-node on + * the ns->next field. + */ + cur = (xmlNodePtr) ((xmlNsPtr) cur)->next; + if ((cur == NULL) || (cur->type != XML_ELEMENT_NODE)) { + xsltGenericError(xsltGenericErrorContext, + "Internal error in exsltDynMapFunction: " + "Cannot retrieve the doc of a namespace node.\n"); + continue; + } + ctxt->context->doc = cur->doc; + } else { + ctxt->context->doc = cur->doc; + } subResult = xmlXPathCompiledEval(comp, ctxt->context); if (subResult != NULL) { |