| OLD | NEW |
| 1 /* | 1 /* |
| 2 * dynamic.c: Implementation of the EXSLT -- Dynamic module | 2 * dynamic.c: Implementation of the EXSLT -- Dynamic module |
| 3 * | 3 * |
| 4 * References: | 4 * References: |
| 5 * http://www.exslt.org/dyn/dyn.html | 5 * http://www.exslt.org/dyn/dyn.html |
| 6 * | 6 * |
| 7 * See Copyright for the status of this software. | 7 * See Copyright for the status of this software. |
| 8 * | 8 * |
| 9 * Authors: | 9 * Authors: |
| 10 * Mark Vakoc <mark_vakoc@jdedwards.com> | 10 * Mark Vakoc <mark_vakoc@jdedwards.com> |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 str = xmlXPathPopString(ctxt); | 67 str = xmlXPathPopString(ctxt); |
| 68 /* return an empty node-set if an empty string is passed in */ | 68 /* return an empty node-set if an empty string is passed in */ |
| 69 if (!str||!xmlStrlen(str)) { | 69 if (!str||!xmlStrlen(str)) { |
| 70 if (str) xmlFree(str); | 70 if (str) xmlFree(str); |
| 71 valuePush(ctxt,xmlXPathNewNodeSet(NULL)); | 71 valuePush(ctxt,xmlXPathNewNodeSet(NULL)); |
| 72 return; | 72 return; |
| 73 } | 73 } |
| 74 ret = xmlXPathEval(str,ctxt->context); | 74 ret = xmlXPathEval(str,ctxt->context); |
| 75 if (ret) | 75 if (ret) |
| 76 valuePush(ctxt,ret); | 76 valuePush(ctxt,ret); |
| 77 » else { | 77 » else { |
| 78 xsltGenericError(xsltGenericErrorContext, | 78 xsltGenericError(xsltGenericErrorContext, |
| 79 "dyn:evaluate() : unable to evaluate expression '%s'\n",
str); | 79 "dyn:evaluate() : unable to evaluate expression '%s'\n",
str); |
| 80 valuePush(ctxt,xmlXPathNewNodeSet(NULL)); | 80 valuePush(ctxt,xmlXPathNewNodeSet(NULL)); |
| 81 » }» | 81 » } |
| 82 xmlFree(str); | 82 xmlFree(str); |
| 83 return; | 83 return; |
| 84 } | 84 } |
| 85 | 85 |
| 86 /** | 86 /** |
| 87 * exsltDynMapFunction: | 87 * exsltDynMapFunction: |
| 88 * @ctxt: an XPath parser context | 88 * @ctxt: an XPath parser context |
| 89 * @nargs: the number of arguments | 89 * @nargs: the number of arguments |
| 90 * | 90 * |
| 91 * Evaluates the string as an XPath expression and returns the result | 91 * Evaluates the string as an XPath expression and returns the result |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 xsltGenericError(xsltGenericErrorContext, | 137 xsltGenericError(xsltGenericErrorContext, |
| 138 "exsltDynMapFunction: ret == NULL\n"); | 138 "exsltDynMapFunction: ret == NULL\n"); |
| 139 goto cleanup; | 139 goto cleanup; |
| 140 } | 140 } |
| 141 | 141 |
| 142 oldDoc = ctxt->context->doc; | 142 oldDoc = ctxt->context->doc; |
| 143 oldNode = ctxt->context->node; | 143 oldNode = ctxt->context->node; |
| 144 oldContextSize = ctxt->context->contextSize; | 144 oldContextSize = ctxt->context->contextSize; |
| 145 oldProximityPosition = ctxt->context->proximityPosition; | 145 oldProximityPosition = ctxt->context->proximityPosition; |
| 146 | 146 |
| 147 /** | 147 /** |
| 148 » * since we really don't know we're going to be adding node(s) | 148 » * since we really don't know we're going to be adding node(s) |
| 149 » * down the road we create the RVT regardless | 149 » * down the road we create the RVT regardless |
| 150 */ | 150 */ |
| 151 tctxt = xsltXPathGetTransformContext(ctxt); | 151 tctxt = xsltXPathGetTransformContext(ctxt); |
| 152 if (tctxt == NULL) { | 152 if (tctxt == NULL) { |
| 153 xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, | 153 xsltTransformError(xsltXPathGetTransformContext(ctxt), NULL, NULL, |
| 154 "dyn:map : internal error tctxt == NULL\n"); | 154 "dyn:map : internal error tctxt == NULL\n"); |
| 155 goto cleanup; | 155 goto cleanup; |
| 156 } | 156 } |
| 157 container = xsltCreateRVT(tctxt); | 157 container = xsltCreateRVT(tctxt); |
| 158 if (container == NULL) { | 158 if (container == NULL) { |
| 159 xsltTransformError(tctxt, NULL, NULL, | 159 xsltTransformError(tctxt, NULL, NULL, |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 void | 278 void |
| 279 exsltDynRegister (void) { | 279 exsltDynRegister (void) { |
| 280 xsltRegisterExtModuleFunction ((const xmlChar *) "evaluate", | 280 xsltRegisterExtModuleFunction ((const xmlChar *) "evaluate", |
| 281 EXSLT_DYNAMIC_NAMESPACE, | 281 EXSLT_DYNAMIC_NAMESPACE, |
| 282 exsltDynEvaluateFunction); | 282 exsltDynEvaluateFunction); |
| 283 xsltRegisterExtModuleFunction ((const xmlChar *) "map", | 283 xsltRegisterExtModuleFunction ((const xmlChar *) "map", |
| 284 EXSLT_DYNAMIC_NAMESPACE, | 284 EXSLT_DYNAMIC_NAMESPACE, |
| 285 exsltDynMapFunction); | 285 exsltDynMapFunction); |
| 286 | 286 |
| 287 } | 287 } |
| OLD | NEW |