diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2019-11-12 15:20:07 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2019-11-12 15:20:07 +0900 |
commit | 478150ad4e1d828cd9a7e500314d1dd2a273b73e (patch) | |
tree | 498ea6fcc835258afcb492a7e99ffa67d8701528 /libexslt/dynamic.c | |
parent | 5d63feac1d0058fc1ad291efc1003437becbd9fa (diff) | |
download | libxslt-478150ad4e1d828cd9a7e500314d1dd2a273b73e.tar.gz libxslt-478150ad4e1d828cd9a7e500314d1dd2a273b73e.tar.bz2 libxslt-478150ad4e1d828cd9a7e500314d1dd2a273b73e.zip |
Imported Upstream version 1.1.34upstream/1.1.34
Diffstat (limited to 'libexslt/dynamic.c')
-rw-r--r-- | libexslt/dynamic.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/libexslt/dynamic.c b/libexslt/dynamic.c index dd0804bc..a8cc72d9 100644 --- a/libexslt/dynamic.c +++ b/libexslt/dynamic.c @@ -127,7 +127,15 @@ exsltDynMapFunction(xmlXPathParserContextPtr ctxt, int nargs) goto cleanup; } - if (str == NULL || !xmlStrlen(str) || !(comp = xmlXPathCompile(str))) + tctxt = xsltXPathGetTransformContext(ctxt); + if (tctxt == NULL) { + xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, + "dyn:map : internal error tctxt == NULL\n"); + goto cleanup; + } + + if (str == NULL || !xmlStrlen(str) || + !(comp = xmlXPathCtxtCompile(tctxt->xpathCtxt, str))) goto cleanup; oldDoc = ctxt->context->doc; @@ -139,12 +147,6 @@ exsltDynMapFunction(xmlXPathParserContextPtr ctxt, int nargs) * since we really don't know we're going to be adding node(s) * down the road we create the RVT regardless */ - tctxt = xsltXPathGetTransformContext(ctxt); - if (tctxt == NULL) { - xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, - "dyn:map : internal error tctxt == NULL\n"); - goto cleanup; - } container = xsltCreateRVT(tctxt); if (container == NULL) { xsltTransformError(tctxt, NULL, NULL, @@ -194,10 +196,10 @@ exsltDynMapFunction(xmlXPathParserContextPtr ctxt, int nargs) case XPATH_BOOLEAN: if (container != NULL) { xmlNodePtr cur = - xmlNewChild((xmlNodePtr) container, NULL, - BAD_CAST "boolean", - BAD_CAST (subResult-> - boolval ? "true" : "")); + xmlNewTextChild((xmlNodePtr) container, NULL, + BAD_CAST "boolean", + BAD_CAST (subResult-> + boolval ? "true" : "")); if (cur != NULL) { cur->ns = xmlNewNs(cur, @@ -215,8 +217,8 @@ exsltDynMapFunction(xmlXPathParserContextPtr ctxt, int nargs) xmlXPathCastNumberToString(subResult-> floatval); xmlNodePtr cur = - xmlNewChild((xmlNodePtr) container, NULL, - BAD_CAST "number", val); + xmlNewTextChild((xmlNodePtr) container, NULL, + BAD_CAST "number", val); if (val != NULL) xmlFree(val); @@ -234,9 +236,9 @@ exsltDynMapFunction(xmlXPathParserContextPtr ctxt, int nargs) case XPATH_STRING: if (container != NULL) { xmlNodePtr cur = - xmlNewChild((xmlNodePtr) container, NULL, - BAD_CAST "string", - subResult->stringval); + xmlNewTextChild((xmlNodePtr) container, NULL, + BAD_CAST "string", + subResult->stringval); if (cur != NULL) { cur->ns = xmlNewNs(cur, |