Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(819)

Side by Side Diff: third_party/libxslt/libexslt/functions.c

Issue 1193533007: Upgrade to libxml 2.9.2 and libxslt 1.1.28 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: no iconv Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/libxslt/libexslt/exsltconfig.h ('k') | third_party/libxslt/libexslt/libexslt.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #define IN_LIBEXSLT 1 #define IN_LIBEXSLT
2 #include "libexslt/libexslt.h" 2 #include "libexslt/libexslt.h"
3 3
4 #if defined(WIN32) && !defined (__CYGWIN__) && (!__MINGW32__) 4 #if defined(WIN32) && !defined (__CYGWIN__) && (!__MINGW32__)
5 #include <win32config.h> 5 #include <win32config.h>
6 #else 6 #else
7 #include "config.h" 7 #include "config.h"
8 #endif 8 #endif
9 9
10 #include <string.h> 10 #include <string.h>
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 exsltFuncRegisterImportFunc (exsltFuncFunctionData *data, 99 exsltFuncRegisterImportFunc (exsltFuncFunctionData *data,
100 exsltFuncImportRegData *ch, 100 exsltFuncImportRegData *ch,
101 const xmlChar *URI, const xmlChar *name, 101 const xmlChar *URI, const xmlChar *name,
102 ATTRIBUTE_UNUSED const xmlChar *ignored) { 102 ATTRIBUTE_UNUSED const xmlChar *ignored) {
103 exsltFuncFunctionData *func=NULL; 103 exsltFuncFunctionData *func=NULL;
104 104
105 if ((data == NULL) || (ch == NULL) || (URI == NULL) || (name == NULL)) 105 if ((data == NULL) || (ch == NULL) || (URI == NULL) || (name == NULL))
106 return; 106 return;
107 107
108 if (ch->ctxt == NULL || ch->hash == NULL) 108 if (ch->ctxt == NULL || ch->hash == NULL)
109 » return; 109 » return;
110 110
111 /* Check if already present */ 111 /* Check if already present */
112 func = (exsltFuncFunctionData*)xmlHashLookup2(ch->hash, URI, name); 112 func = (exsltFuncFunctionData*)xmlHashLookup2(ch->hash, URI, name);
113 if (func == NULL) { /* Not yet present - copy it in */ 113 if (func == NULL) { /* Not yet present - copy it in */
114 » func = exsltFuncNewFunctionData(); 114 » func = exsltFuncNewFunctionData();
115 memcpy(func, data, sizeof(exsltFuncFunctionData)); 115 memcpy(func, data, sizeof(exsltFuncFunctionData));
116 if (xmlHashAddEntry2(ch->hash, URI, name, func) < 0) { 116 if (xmlHashAddEntry2(ch->hash, URI, name, func) < 0) {
117 xsltGenericError(xsltGenericErrorContext, 117 xsltGenericError(xsltGenericErrorContext,
118 » » "Failed to register function {%s}%s\n", 118 » » "Failed to register function {%s}%s\n",
119 URI, name); 119 URI, name);
120 } else { /* Do the registration */ 120 } else { /* Do the registration */
121 xsltGenericDebug(xsltGenericDebugContext, 121 xsltGenericDebug(xsltGenericDebugContext,
122 "exsltFuncRegisterImportFunc: register {%s}%s\n", 122 "exsltFuncRegisterImportFunc: register {%s}%s\n",
123 URI, name); 123 URI, name);
124 xsltRegisterExtFunction(ch->ctxt, name, URI, 124 xsltRegisterExtFunction(ch->ctxt, name, URI,
125 exsltFuncFunctionFunction); 125 exsltFuncFunctionFunction);
126 } 126 }
127 } 127 }
128 } 128 }
(...skipping 10 matching lines...) Expand all
139 * functions with lower import precedence. 139 * functions with lower import precedence.
140 * 140 *
141 * Returns the data for this transformation 141 * Returns the data for this transformation
142 */ 142 */
143 static exsltFuncData * 143 static exsltFuncData *
144 exsltFuncInit (xsltTransformContextPtr ctxt, const xmlChar *URI) { 144 exsltFuncInit (xsltTransformContextPtr ctxt, const xmlChar *URI) {
145 exsltFuncData *ret; 145 exsltFuncData *ret;
146 xsltStylesheetPtr tmp; 146 xsltStylesheetPtr tmp;
147 exsltFuncImportRegData ch; 147 exsltFuncImportRegData ch;
148 xmlHashTablePtr hash; 148 xmlHashTablePtr hash;
149 149
150 ret = (exsltFuncData *) xmlMalloc (sizeof(exsltFuncData)); 150 ret = (exsltFuncData *) xmlMalloc (sizeof(exsltFuncData));
151 if (ret == NULL) { 151 if (ret == NULL) {
152 xsltGenericError(xsltGenericErrorContext, 152 xsltGenericError(xsltGenericErrorContext,
153 "exsltFuncInit: not enough memory\n"); 153 "exsltFuncInit: not enough memory\n");
154 return(NULL); 154 return(NULL);
155 } 155 }
156 memset(ret, 0, sizeof(exsltFuncData)); 156 memset(ret, 0, sizeof(exsltFuncData));
157 157
158 ret->result = NULL; 158 ret->result = NULL;
159 ret->error = 0; 159 ret->error = 0;
160 160
161 ch.hash = (xmlHashTablePtr) xsltStyleGetExtData(ctxt->style, URI); 161 ch.hash = (xmlHashTablePtr) xsltStyleGetExtData(ctxt->style, URI);
162 ret->funcs = ch.hash; 162 ret->funcs = ch.hash;
163 xmlHashScanFull(ch.hash, (xmlHashScannerFull) exsltFuncRegisterFunc, ctxt); 163 xmlHashScanFull(ch.hash, (xmlHashScannerFull) exsltFuncRegisterFunc, ctxt);
164 tmp = ctxt->style; 164 tmp = ctxt->style;
165 ch.ctxt = ctxt; 165 ch.ctxt = ctxt;
166 while ((tmp=xsltNextImport(tmp))!=NULL) { 166 while ((tmp=xsltNextImport(tmp))!=NULL) {
167 hash = xsltGetExtInfo(tmp, URI); 167 hash = xsltGetExtInfo(tmp, URI);
168 if (hash != NULL) { 168 if (hash != NULL) {
169 » xmlHashScanFull(hash, 169 » xmlHashScanFull(hash,
170 (xmlHashScannerFull) exsltFuncRegisterImportFunc, &ch); 170 (xmlHashScannerFull) exsltFuncRegisterImportFunc, &ch);
171 } 171 }
172 } 172 }
173 173
174 return(ret); 174 return(ret);
175 } 175 }
176 176
177 /** 177 /**
178 * exsltFuncShutdown: 178 * exsltFuncShutdown:
179 * @ctxt: an XSLT transformation context 179 * @ctxt: an XSLT transformation context
180 * @URI: the namespace URI for the extension 180 * @URI: the namespace URI for the extension
181 * @data: the module data to free up 181 * @data: the module data to free up
182 * 182 *
183 * Shutdown the EXSLT - Functions module 183 * Shutdown the EXSLT - Functions module
184 * Called at transformation-time. 184 * Called at transformation-time.
185 */ 185 */
186 static void 186 static void
187 exsltFuncShutdown (xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED, 187 exsltFuncShutdown (xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED,
188 const xmlChar *URI ATTRIBUTE_UNUSED, 188 const xmlChar *URI ATTRIBUTE_UNUSED,
189 exsltFuncData *data) { 189 exsltFuncData *data) {
190 if (data->result != NULL) 190 if (data->result != NULL)
191 xmlXPathFreeObject(data->result); 191 xmlXPathFreeObject(data->result);
192 xmlFree(data); 192 xmlFree(data);
(...skipping 12 matching lines...) Expand all
205 static xmlHashTablePtr 205 static xmlHashTablePtr
206 exsltFuncStyleInit (xsltStylesheetPtr style ATTRIBUTE_UNUSED, 206 exsltFuncStyleInit (xsltStylesheetPtr style ATTRIBUTE_UNUSED,
207 const xmlChar *URI ATTRIBUTE_UNUSED) { 207 const xmlChar *URI ATTRIBUTE_UNUSED) {
208 return xmlHashCreate(1); 208 return xmlHashCreate(1);
209 } 209 }
210 210
211 /** 211 /**
212 * exsltFuncStyleShutdown: 212 * exsltFuncStyleShutdown:
213 * @style: an XSLT stylesheet 213 * @style: an XSLT stylesheet
214 * @URI: the namespace URI for the extension 214 * @URI: the namespace URI for the extension
215 * @data: the stylesheet data to free up 215 * @data: the stylesheet data to free up
216 * 216 *
217 * Shutdown the EXSLT - Function module 217 * Shutdown the EXSLT - Function module
218 * Called at compile-time. 218 * Called at compile-time.
219 */ 219 */
220 static void 220 static void
221 exsltFuncStyleShutdown (xsltStylesheetPtr style ATTRIBUTE_UNUSED, 221 exsltFuncStyleShutdown (xsltStylesheetPtr style ATTRIBUTE_UNUSED,
222 const xmlChar *URI ATTRIBUTE_UNUSED, 222 const xmlChar *URI ATTRIBUTE_UNUSED,
223 xmlHashTablePtr data) { 223 xmlHashTablePtr data) {
224 xmlHashFree(data, (xmlHashDeallocator) xmlFree); 224 xmlHashFree(data, (xmlHashDeallocator) xmlFree);
225 } 225 }
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 * order (since a variable is "in scope" as soon as it is declared). 343 * order (since a variable is "in scope" as soon as it is declared).
344 * However, on entry to this routine, the values (from the caller) are 344 * However, on entry to this routine, the values (from the caller) are
345 * in reverse order (held on the XPath context variable stack). To 345 * in reverse order (held on the XPath context variable stack). To
346 * accomplish what is required, I have added code to pop the XPath 346 * accomplish what is required, I have added code to pop the XPath
347 * objects off of the stack at the beginning and save them, then use 347 * objects off of the stack at the beginning and save them, then use
348 * them (in the reverse order) as the params are evaluated. This 348 * them (in the reverse order) as the params are evaluated. This
349 * requires an xmlMalloc/xmlFree for each param set by the caller, 349 * requires an xmlMalloc/xmlFree for each param set by the caller,
350 * which is not very nice. There is probably a much better solution 350 * which is not very nice. There is probably a much better solution
351 * (like change other code to delay the evaluation). 351 * (like change other code to delay the evaluation).
352 */ 352 */
353 /* 353 /*
354 * In order to give the function params and variables a new 'scope' 354 * In order to give the function params and variables a new 'scope'
355 * we change varsBase in the context. 355 * we change varsBase in the context.
356 */ 356 */
357 oldBase = tctxt->varsBase; 357 oldBase = tctxt->varsBase;
358 tctxt->varsBase = tctxt->varsNr; 358 tctxt->varsBase = tctxt->varsNr;
359 /* If there are any parameters */ 359 /* If there are any parameters */
360 if (paramNode != NULL) { 360 if (paramNode != NULL) {
361 /* Fetch the stored argument values from the caller */ 361 /* Fetch the stored argument values from the caller */
362 for (i = 0; i < nargs; i++) { 362 for (i = 0; i < nargs; i++) {
363 savedObj = xmlMalloc(sizeof(struct objChain)); 363 savedObj = xmlMalloc(sizeof(struct objChain));
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 fake = xmlNewDocNode(tctxt->output, NULL, 404 fake = xmlNewDocNode(tctxt->output, NULL,
405 (const xmlChar *)"fake", NULL); 405 (const xmlChar *)"fake", NULL);
406 oldInsert = tctxt->insert; 406 oldInsert = tctxt->insert;
407 tctxt->insert = fake; 407 tctxt->insert = fake;
408 xsltApplyOneTemplate (tctxt, xmlXPathGetContextNode(ctxt), 408 xsltApplyOneTemplate (tctxt, xmlXPathGetContextNode(ctxt),
409 func->content, NULL, NULL); 409 func->content, NULL, NULL);
410 xsltLocalVariablePop(tctxt, tctxt->varsBase, -2); 410 xsltLocalVariablePop(tctxt, tctxt->varsBase, -2);
411 tctxt->insert = oldInsert; 411 tctxt->insert = oldInsert;
412 tctxt->varsBase = oldBase; /* restore original scope */ 412 tctxt->varsBase = oldBase; /* restore original scope */
413 if (params != NULL) 413 if (params != NULL)
414 » xsltFreeStackElemList(params); 414 » xsltFreeStackElemList(params);
415 415
416 if (data->error != 0) 416 if (data->error != 0)
417 goto error; 417 goto error;
418 418
419 if (data->result != NULL) { 419 if (data->result != NULL) {
420 ret = data->result; 420 ret = data->result;
421 } else 421 } else
422 ret = xmlXPathNewCString(""); 422 ret = xmlXPathNewCString("");
423 423
424 data->result = oldResult; 424 data->result = oldResult;
(...skipping 27 matching lines...) Expand all
452 } 452 }
453 453
454 454
455 static void 455 static void
456 exsltFuncFunctionComp (xsltStylesheetPtr style, xmlNodePtr inst) { 456 exsltFuncFunctionComp (xsltStylesheetPtr style, xmlNodePtr inst) {
457 xmlChar *name, *prefix; 457 xmlChar *name, *prefix;
458 xmlNsPtr ns; 458 xmlNsPtr ns;
459 xmlHashTablePtr data; 459 xmlHashTablePtr data;
460 exsltFuncFunctionData *func; 460 exsltFuncFunctionData *func;
461 461
462 if ((style == NULL) || (inst == NULL)) 462 if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
463 return; 463 return;
464 464
465
466 { 465 {
467 xmlChar *qname; 466 xmlChar *qname;
468 467
469 qname = xmlGetProp(inst, (const xmlChar *) "name"); 468 qname = xmlGetProp(inst, (const xmlChar *) "name");
470 name = xmlSplitQName2 (qname, &prefix); 469 name = xmlSplitQName2 (qname, &prefix);
471 xmlFree(qname); 470 xmlFree(qname);
472 } 471 }
473 if ((name == NULL) || (prefix == NULL)) { 472 if ((name == NULL) || (prefix == NULL)) {
474 xsltGenericError(xsltGenericErrorContext, 473 xsltGenericError(xsltGenericErrorContext,
475 "func:function: not a QName\n"); 474 "func:function: not a QName\n");
476 if (name != NULL) 475 if (name != NULL)
477 xmlFree(name); 476 xmlFree(name);
478 return; 477 return;
479 } 478 }
480 /* namespace lookup */ 479 /* namespace lookup */
481 ns = xmlSearchNs (inst->doc, inst, prefix); 480 ns = xmlSearchNs (inst->doc, inst, prefix);
482 if (ns == NULL) { 481 if (ns == NULL) {
483 xsltGenericError(xsltGenericErrorContext, 482 xsltGenericError(xsltGenericErrorContext,
484 "func:function: undeclared prefix %s\n", 483 "func:function: undeclared prefix %s\n",
485 prefix); 484 prefix);
486 xmlFree(name); 485 xmlFree(name);
487 xmlFree(prefix); 486 xmlFree(prefix);
488 return; 487 return;
489 } 488 }
490 xmlFree(prefix); 489 xmlFree(prefix);
491 490
491 xsltParseTemplateContent(style, inst);
492
492 /* 493 /*
493 * Create function data 494 * Create function data
494 */ 495 */
495 func = exsltFuncNewFunctionData(); 496 func = exsltFuncNewFunctionData();
496 func->content = inst->children; 497 func->content = inst->children;
497 while (IS_XSLT_ELEM(func->content) && 498 while (IS_XSLT_ELEM(func->content) &&
498 IS_XSLT_NAME(func->content, "param")) { 499 IS_XSLT_NAME(func->content, "param")) {
499 func->content = func->content->next; 500 func->content = func->content->next;
500 func->nargs++; 501 func->nargs++;
501 } 502 }
502 503
503 xsltParseTemplateContent(style, inst);
504
505 /* 504 /*
506 * Register the function data such that it can be retrieved 505 * Register the function data such that it can be retrieved
507 * by exslFuncFunctionFunction 506 * by exslFuncFunctionFunction
508 */ 507 */
509 #ifdef XSLT_REFACTORED 508 #ifdef XSLT_REFACTORED
510 /* 509 /*
511 * Ensure that the hash table will be stored in the *current* 510 * Ensure that the hash table will be stored in the *current*
512 * stylesheet level in order to correctly evaluate the 511 * stylesheet level in order to correctly evaluate the
513 * import precedence. 512 * import precedence.
514 */ 513 */
(...skipping 24 matching lines...) Expand all
539 xmlFree(name); 538 xmlFree(name);
540 } 539 }
541 540
542 static xsltElemPreCompPtr 541 static xsltElemPreCompPtr
543 exsltFuncResultComp (xsltStylesheetPtr style, xmlNodePtr inst, 542 exsltFuncResultComp (xsltStylesheetPtr style, xmlNodePtr inst,
544 xsltTransformFunction function) { 543 xsltTransformFunction function) {
545 xmlNodePtr test; 544 xmlNodePtr test;
546 xmlChar *sel; 545 xmlChar *sel;
547 exsltFuncResultPreComp *ret; 546 exsltFuncResultPreComp *ret;
548 547
548 if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
549 return (NULL);
550
549 /* 551 /*
550 * "Validity" checking 552 * "Validity" checking
551 */ 553 */
552 /* it is an error to have any following sibling elements aside 554 /* it is an error to have any following sibling elements aside
553 * from the xsl:fallback element. 555 * from the xsl:fallback element.
554 */ 556 */
555 for (test = inst->next; test != NULL; test = test->next) { 557 for (test = inst->next; test != NULL; test = test->next) {
556 if (test->type != XML_ELEMENT_NODE) 558 if (test->type != XML_ELEMENT_NODE)
557 continue; 559 continue;
558 if (IS_XSLT_ELEM(test) && IS_XSLT_NAME(test, "fallback")) 560 if (IS_XSLT_ELEM(test) && IS_XSLT_NAME(test, "fallback"))
559 continue; 561 continue;
560 xsltGenericError(xsltGenericErrorContext, 562 xsltGenericError(xsltGenericErrorContext,
561 "exsltFuncResultElem: only xsl:fallback is " 563 "exsltFuncResultElem: only xsl:fallback is "
562 "allowed to follow func:result\n"); 564 "allowed to follow func:result\n");
565 style->errors++;
563 return (NULL); 566 return (NULL);
564 } 567 }
565 /* it is an error for a func:result element to not be a descendant 568 /* it is an error for a func:result element to not be a descendant
566 * of func:function. 569 * of func:function.
567 * it is an error if a func:result occurs within a func:result 570 * it is an error if a func:result occurs within a func:result
568 * element. 571 * element.
569 * it is an error if instanciating the content of a variable 572 * it is an error if instanciating the content of a variable
570 * binding element (i.e. xsl:variable, xsl:param) results in the 573 * binding element (i.e. xsl:variable, xsl:param) results in the
571 * instanciation of a func:result element. 574 * instanciation of a func:result element.
572 */ 575 */
573 for (test = inst->parent; test != NULL; test = test->parent) { 576 for (test = inst->parent; test != NULL; test = test->parent) {
574 if (IS_XSLT_ELEM(test) && 577 if (IS_XSLT_ELEM(test) &&
575 IS_XSLT_NAME(test, "stylesheet")) { 578 IS_XSLT_NAME(test, "stylesheet")) {
576 xsltGenericError(xsltGenericErrorContext, 579 xsltGenericError(xsltGenericErrorContext,
577 "func:result element not a descendant " 580 "func:result element not a descendant "
578 "of a func:function\n"); 581 "of a func:function\n");
582 style->errors++;
579 return (NULL); 583 return (NULL);
580 } 584 }
581 if ((test->ns != NULL) && 585 if ((test->ns != NULL) &&
582 (xmlStrEqual(test->ns->href, EXSLT_FUNCTIONS_NAMESPACE))) { 586 (xmlStrEqual(test->ns->href, EXSLT_FUNCTIONS_NAMESPACE))) {
583 if (xmlStrEqual(test->name, (const xmlChar *) "function")) { 587 if (xmlStrEqual(test->name, (const xmlChar *) "function")) {
584 break; 588 break;
585 } 589 }
586 if (xmlStrEqual(test->name, (const xmlChar *) "result")) { 590 if (xmlStrEqual(test->name, (const xmlChar *) "result")) {
587 xsltGenericError(xsltGenericErrorContext, 591 xsltGenericError(xsltGenericErrorContext,
588 "func:result element not allowed within" 592 "func:result element not allowed within"
589 " another func:result element\n"); 593 " another func:result element\n");
594 style->errors++;
590 return (NULL); 595 return (NULL);
591 } 596 }
592 } 597 }
593 if (IS_XSLT_ELEM(test) && 598 if (IS_XSLT_ELEM(test) &&
594 (IS_XSLT_NAME(test, "variable") || 599 (IS_XSLT_NAME(test, "variable") ||
595 IS_XSLT_NAME(test, "param"))) { 600 IS_XSLT_NAME(test, "param"))) {
596 xsltGenericError(xsltGenericErrorContext, 601 xsltGenericError(xsltGenericErrorContext,
597 "func:result element not allowed within" 602 "func:result element not allowed within"
598 " a variable binding element\n"); 603 " a variable binding element\n");
604 style->errors++;
599 return (NULL); 605 return (NULL);
600 } 606 }
601 } 607 }
602 608
603 /* 609 /*
604 * Precomputation 610 * Precomputation
605 */ 611 */
606 ret = (exsltFuncResultPreComp *) 612 ret = (exsltFuncResultPreComp *)
607 xmlMalloc (sizeof(exsltFuncResultPreComp)); 613 xmlMalloc (sizeof(exsltFuncResultPreComp));
608 if (ret == NULL) { 614 if (ret == NULL) {
609 xsltPrintErrorContext(NULL, NULL, NULL); 615 xsltPrintErrorContext(NULL, NULL, NULL);
610 xsltGenericError(xsltGenericErrorContext, 616 xsltGenericError(xsltGenericErrorContext,
611 "exsltFuncResultComp : malloc failed\n"); 617 "exsltFuncResultComp : malloc failed\n");
618 style->errors++;
612 return (NULL); 619 return (NULL);
613 } 620 }
614 memset(ret, 0, sizeof(exsltFuncResultPreComp)); 621 memset(ret, 0, sizeof(exsltFuncResultPreComp));
615 622
616 xsltInitElemPreComp ((xsltElemPreCompPtr) ret, style, inst, function, 623 xsltInitElemPreComp ((xsltElemPreCompPtr) ret, style, inst, function,
617 (xsltElemPreCompDeallocator) exsltFreeFuncResultPreComp); 624 (xsltElemPreCompDeallocator) exsltFreeFuncResultPreComp);
618 ret->select = NULL; 625 ret->select = NULL;
619 626
620 /* 627 /*
621 * Precompute the select attribute 628 * Precompute the select attribute
(...skipping 15 matching lines...) Expand all
637 } 644 }
638 return ((xsltElemPreCompPtr) ret); 645 return ((xsltElemPreCompPtr) ret);
639 } 646 }
640 647
641 static void 648 static void
642 exsltFuncResultElem (xsltTransformContextPtr ctxt, 649 exsltFuncResultElem (xsltTransformContextPtr ctxt,
643 xmlNodePtr node ATTRIBUTE_UNUSED, xmlNodePtr inst, 650 xmlNodePtr node ATTRIBUTE_UNUSED, xmlNodePtr inst,
644 exsltFuncResultPreComp *comp) { 651 exsltFuncResultPreComp *comp) {
645 exsltFuncData *data; 652 exsltFuncData *data;
646 xmlXPathObjectPtr ret; 653 xmlXPathObjectPtr ret;
647 654
648 655
649 /* It is an error if instantiating the content of the 656 /* It is an error if instantiating the content of the
650 * func:function element results in the instantiation of more than 657 * func:function element results in the instantiation of more than
651 * one func:result elements. 658 * one func:result elements.
652 */ 659 */
653 data = (exsltFuncData *) xsltGetExtData (ctxt, EXSLT_FUNCTIONS_NAMESPACE); 660 data = (exsltFuncData *) xsltGetExtData (ctxt, EXSLT_FUNCTIONS_NAMESPACE);
654 if (data == NULL) { 661 if (data == NULL) {
655 xsltGenericError(xsltGenericErrorContext, 662 xsltGenericError(xsltGenericErrorContext,
656 "exsltFuncReturnElem: data == NULL\n"); 663 "exsltFuncReturnElem: data == NULL\n");
657 return; 664 return;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 xmlNodePtr oldInsert; 720 xmlNodePtr oldInsert;
714 xmlDocPtr container; 721 xmlDocPtr container;
715 722
716 container = xsltCreateRVT(ctxt); 723 container = xsltCreateRVT(ctxt);
717 if (container == NULL) { 724 if (container == NULL) {
718 xsltGenericError(xsltGenericErrorContext, 725 xsltGenericError(xsltGenericErrorContext,
719 "exsltFuncResultElem: out of memory\n"); 726 "exsltFuncResultElem: out of memory\n");
720 data->error = 1; 727 data->error = 1;
721 return; 728 return;
722 } 729 }
723 » xsltRegisterLocalRVT(ctxt, container);» 730 » xsltRegisterLocalRVT(ctxt, container);
724 731
725 oldInsert = ctxt->insert; 732 oldInsert = ctxt->insert;
726 ctxt->insert = (xmlNodePtr) container; 733 ctxt->insert = (xmlNodePtr) container;
727 xsltApplyOneTemplate (ctxt, ctxt->xpathCtxt->node, 734 xsltApplyOneTemplate (ctxt, ctxt->xpathCtxt->node,
728 inst->children, NULL, NULL); 735 inst->children, NULL, NULL);
729 ctxt->insert = oldInsert; 736 ctxt->insert = oldInsert;
730 737
731 ret = xmlXPathNewValueTree((xmlNodePtr) container); 738 ret = xmlXPathNewValueTree((xmlNodePtr) container);
732 if (ret == NULL) { 739 if (ret == NULL) {
733 xsltGenericError(xsltGenericErrorContext, 740 xsltGenericError(xsltGenericErrorContext,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 (xsltStyleExtShutdownFunction) exsltFuncStyleShutdown); 772 (xsltStyleExtShutdownFunction) exsltFuncStyleShutdown);
766 773
767 xsltRegisterExtModuleTopLevel ((const xmlChar *) "function", 774 xsltRegisterExtModuleTopLevel ((const xmlChar *) "function",
768 EXSLT_FUNCTIONS_NAMESPACE, 775 EXSLT_FUNCTIONS_NAMESPACE,
769 exsltFuncFunctionComp); 776 exsltFuncFunctionComp);
770 xsltRegisterExtModuleElement ((const xmlChar *) "result", 777 xsltRegisterExtModuleElement ((const xmlChar *) "result",
771 EXSLT_FUNCTIONS_NAMESPACE, 778 EXSLT_FUNCTIONS_NAMESPACE,
772 (xsltPreComputeFunction)exsltFuncResultComp, 779 (xsltPreComputeFunction)exsltFuncResultComp,
773 (xsltTransformFunction) exsltFuncResultElem); 780 (xsltTransformFunction) exsltFuncResultElem);
774 } 781 }
OLDNEW
« no previous file with comments | « third_party/libxslt/libexslt/exsltconfig.h ('k') | third_party/libxslt/libexslt/libexslt.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698