ReactOS 0.4.16-dev-2206-gc56950d
preproc.c
Go to the documentation of this file.
1/*
2 * preproc.c: Preprocessing of style operations
3 *
4 * References:
5 * http://www.w3.org/TR/1999/REC-xslt-19991116
6 *
7 * Michael Kay "XSLT Programmer's Reference" pp 637-643
8 * Writing Multiple Output Files
9 *
10 * XSLT-1.1 Working Draft
11 * http://www.w3.org/TR/xslt11#multiple-output
12 *
13 * See Copyright for the status of this software.
14 *
15 * daniel@veillard.com
16 */
17
18#define IN_LIBXSLT
19#include "libxslt.h"
20
21#include <string.h>
22
23#include <libxml/xmlmemory.h>
24#include <libxml/parser.h>
25#include <libxml/tree.h>
26#include <libxml/valid.h>
27#include <libxml/hash.h>
28#include <libxml/uri.h>
29#include <libxml/encoding.h>
30#include <libxml/xmlerror.h>
31#include "xslt.h"
32#include "xsltutils.h"
33#include "xsltInternals.h"
34#include "transform.h"
35#include "templates.h"
36#include "variables.h"
37#include "numbersInternals.h"
38#include "preproc.h"
39#include "extra.h"
40#include "imports.h"
41#include "extensions.h"
42#include "pattern.h"
43
44#ifdef WITH_XSLT_DEBUG
45#define WITH_XSLT_DEBUG_PREPROC
46#endif
47
48const xmlChar *xsltExtMarker = (const xmlChar *) "Extension Element";
49
50/************************************************************************
51 * *
52 * Grammar checks *
53 * *
54 ************************************************************************/
55
56#ifdef XSLT_REFACTORED
57 /*
58 * Grammar checks are now performed in xslt.c.
59 */
60#else
71static int
73 xmlNodePtr parent;
74 if ((style == NULL) || (inst == NULL) || (inst->ns == NULL))
75 return(-1);
76
77 parent = inst->parent;
78 if (parent == NULL) {
79 if (err) {
81 "internal problem: element has no parent\n");
82 style->errors++;
83 }
84 return(0);
85 }
86 if ((parent->ns == NULL) || (parent->type != XML_ELEMENT_NODE) ||
87 ((parent->ns != inst->ns) &&
88 (!xmlStrEqual(parent->ns->href, inst->ns->href))) ||
89 ((!xmlStrEqual(parent->name, BAD_CAST "stylesheet")) &&
90 (!xmlStrEqual(parent->name, BAD_CAST "transform")))) {
91 if (err) {
93 "element %s only allowed as child of stylesheet\n",
94 inst->name);
95 style->errors++;
96 }
97 return(0);
98 }
99 return(1);
100}
101
109static void
111 xmlNodePtr parent;
112 int has_ext;
113
114 if ((style == NULL) || (inst == NULL) || (inst->ns == NULL) ||
115 (style->literal_result))
116 return;
117
118 has_ext = (style->extInfos != NULL);
119
120 parent = inst->parent;
121 if (parent == NULL) {
123 "internal problem: element has no parent\n");
124 style->errors++;
125 return;
126 }
127 while ((parent != NULL) && (parent->type != XML_DOCUMENT_NODE)) {
128 if (((parent->ns == inst->ns) ||
129 ((parent->ns != NULL) &&
130 (xmlStrEqual(parent->ns->href, inst->ns->href)))) &&
131 ((xmlStrEqual(parent->name, BAD_CAST "template")) ||
132 (xmlStrEqual(parent->name, BAD_CAST "param")) ||
133 (xmlStrEqual(parent->name, BAD_CAST "attribute")) ||
134 (xmlStrEqual(parent->name, BAD_CAST "variable")))) {
135 return;
136 }
137
138 /*
139 * if we are within an extension element all bets are off
140 * about the semantic there e.g. xsl:param within func:function
141 */
142 if ((has_ext) && (parent->ns != NULL) &&
143 (xmlHashLookup(style->extInfos, parent->ns->href) != NULL))
144 return;
145
146 parent = parent->parent;
147 }
149 "element %s only allowed within a template, variable or param\n",
150 inst->name);
151 style->errors++;
152}
153
164static void
166 const xmlChar *allow1, const xmlChar *allow2) {
167 xmlNodePtr parent;
168
169 if ((style == NULL) || (inst == NULL) || (inst->ns == NULL) ||
170 (style->literal_result))
171 return;
172
173 parent = inst->parent;
174 if (parent == NULL) {
176 "internal problem: element has no parent\n");
177 style->errors++;
178 return;
179 }
180 if (((parent->ns == inst->ns) ||
181 ((parent->ns != NULL) &&
182 (xmlStrEqual(parent->ns->href, inst->ns->href)))) &&
183 ((xmlStrEqual(parent->name, allow1)) ||
184 (xmlStrEqual(parent->name, allow2)))) {
185 return;
186 }
187
188 if (style->extInfos != NULL) {
189 while ((parent != NULL) && (parent->type != XML_DOCUMENT_NODE)) {
190 /*
191 * if we are within an extension element all bets are off
192 * about the semantic there e.g. xsl:param within func:function
193 */
194 if ((parent->ns != NULL) &&
195 (xmlHashLookup(style->extInfos, parent->ns->href) != NULL))
196 return;
197
198 parent = parent->parent;
199 }
200 }
202 "element %s is not allowed within that context\n",
203 inst->name);
204 style->errors++;
205}
206#endif
207
208/************************************************************************
209 * *
210 * handling of precomputed data *
211 * *
212 ************************************************************************/
213
227#ifdef XSLT_REFACTORED
228 size_t size;
229#endif
230
231 if (style == NULL)
232 return(NULL);
233
234#ifdef XSLT_REFACTORED
235 /*
236 * URGENT TODO: Use specialized factory functions in order
237 * to avoid this ugliness.
238 */
239 switch (type) {
240 case XSLT_FUNC_COPY:
241 size = sizeof(xsltStyleItemCopy); break;
242 case XSLT_FUNC_SORT:
243 size = sizeof(xsltStyleItemSort); break;
244 case XSLT_FUNC_TEXT:
245 size = sizeof(xsltStyleItemText); break;
247 size = sizeof(xsltStyleItemElement); break;
249 size = sizeof(xsltStyleItemAttribute); break;
251 size = sizeof(xsltStyleItemComment); break;
252 case XSLT_FUNC_PI:
253 size = sizeof(xsltStyleItemPI); break;
254 case XSLT_FUNC_COPYOF:
255 size = sizeof(xsltStyleItemCopyOf); break;
257 size = sizeof(xsltStyleItemValueOf); break;;
258 case XSLT_FUNC_NUMBER:
259 size = sizeof(xsltStyleItemNumber); break;
261 size = sizeof(xsltStyleItemApplyImports); break;
263 size = sizeof(xsltStyleItemCallTemplate); break;
265 size = sizeof(xsltStyleItemApplyTemplates); break;
266 case XSLT_FUNC_CHOOSE:
267 size = sizeof(xsltStyleItemChoose); break;
268 case XSLT_FUNC_IF:
269 size = sizeof(xsltStyleItemIf); break;
271 size = sizeof(xsltStyleItemForEach); break;
273 size = sizeof(xsltStyleItemDocument); break;
275 size = sizeof(xsltStyleItemWithParam); break;
276 case XSLT_FUNC_PARAM:
277 size = sizeof(xsltStyleItemParam); break;
279 size = sizeof(xsltStyleItemVariable); break;
280 case XSLT_FUNC_WHEN:
281 size = sizeof(xsltStyleItemWhen); break;
282 case XSLT_FUNC_OTHERWISE:
283 size = sizeof(xsltStyleItemOtherwise); break;
284 default:
286 "xsltNewStylePreComp : invalid type %d\n", type);
287 style->errors++;
288 return(NULL);
289 }
290 /*
291 * Create the structure.
292 */
294 if (cur == NULL) {
296 "xsltNewStylePreComp : malloc failed\n");
297 style->errors++;
298 return(NULL);
299 }
300 memset(cur, 0, size);
301
302#else /* XSLT_REFACTORED */
303 /*
304 * Old behaviour.
305 */
307 if (cur == NULL) {
309 "xsltNewStylePreComp : malloc failed\n");
310 style->errors++;
311 return(NULL);
312 }
313 memset(cur, 0, sizeof(xsltStylePreComp));
314#endif /* XSLT_REFACTORED */
315
316 /*
317 * URGENT TODO: Better to move this to spezialized factory functions.
318 */
319 cur->type = type;
320 switch (cur->type) {
321 case XSLT_FUNC_COPY:
322 cur->func = xsltCopy;break;
323 case XSLT_FUNC_SORT:
324 cur->func = xsltSort;break;
325 case XSLT_FUNC_TEXT:
326 cur->func = xsltText;break;
328 cur->func = xsltElement;break;
330 cur->func = xsltAttribute;break;
332 cur->func = xsltComment;break;
333 case XSLT_FUNC_PI:
335 break;
336 case XSLT_FUNC_COPYOF:
337 cur->func = xsltCopyOf;break;
339 cur->func = xsltValueOf;break;
340 case XSLT_FUNC_NUMBER:
341 cur->func = xsltNumber;break;
343 cur->func = xsltApplyImports;break;
345 cur->func = xsltCallTemplate;break;
347 cur->func = xsltApplyTemplates;break;
348 case XSLT_FUNC_CHOOSE:
349 cur->func = xsltChoose;break;
350 case XSLT_FUNC_IF:
351 cur->func = xsltIf;break;
353 cur->func = xsltForEach;break;
355 cur->func = xsltDocumentElem;break;
357 case XSLT_FUNC_PARAM:
359 case XSLT_FUNC_WHEN:
360 break;
361 default:
362 if (cur->func == NULL) {
364 "xsltNewStylePreComp : no function for type %d\n", type);
365 style->errors++;
366 }
367 }
368 cur->next = style->preComps;
369 style->preComps = (xsltElemPreCompPtr) cur;
370
371 return(cur);
372}
373
380static void
382 if (comp == NULL)
383 return;
384#ifdef XSLT_REFACTORED
385 /*
386 * URGENT TODO: Implement destructors.
387 */
388 switch (comp->type) {
389 case XSLT_FUNC_LITERAL_RESULT_ELEMENT:
390 break;
391 case XSLT_FUNC_COPY:
392 break;
393 case XSLT_FUNC_SORT: {
394 xsltStyleItemSortPtr item = (xsltStyleItemSortPtr) comp;
395 if (item->comp != NULL)
396 xmlXPathFreeCompExpr(item->comp);
397 }
398 break;
399 case XSLT_FUNC_TEXT:
400 break;
402 break;
404 break;
406 break;
407 case XSLT_FUNC_PI:
408 break;
409 case XSLT_FUNC_COPYOF: {
410 xsltStyleItemCopyOfPtr item = (xsltStyleItemCopyOfPtr) comp;
411 if (item->comp != NULL)
412 xmlXPathFreeCompExpr(item->comp);
413 }
414 break;
415 case XSLT_FUNC_VALUEOF: {
416 xsltStyleItemValueOfPtr item = (xsltStyleItemValueOfPtr) comp;
417 if (item->comp != NULL)
418 xmlXPathFreeCompExpr(item->comp);
419 }
420 break;
421 case XSLT_FUNC_NUMBER: {
422 xsltStyleItemNumberPtr item = (xsltStyleItemNumberPtr) comp;
423 if (item->numdata.countPat != NULL)
424 xsltFreeCompMatchList(item->numdata.countPat);
425 if (item->numdata.fromPat != NULL)
426 xsltFreeCompMatchList(item->numdata.fromPat);
427 }
428 break;
430 break;
432 break;
434 xsltStyleItemApplyTemplatesPtr item =
435 (xsltStyleItemApplyTemplatesPtr) comp;
436 if (item->comp != NULL)
437 xmlXPathFreeCompExpr(item->comp);
438 }
439 break;
440 case XSLT_FUNC_CHOOSE:
441 break;
442 case XSLT_FUNC_IF: {
443 xsltStyleItemIfPtr item = (xsltStyleItemIfPtr) comp;
444 if (item->comp != NULL)
445 xmlXPathFreeCompExpr(item->comp);
446 }
447 break;
448 case XSLT_FUNC_FOREACH: {
449 xsltStyleItemForEachPtr item =
450 (xsltStyleItemForEachPtr) comp;
451 if (item->comp != NULL)
452 xmlXPathFreeCompExpr(item->comp);
453 }
454 break;
456 break;
457 case XSLT_FUNC_WITHPARAM: {
458 xsltStyleItemWithParamPtr item =
459 (xsltStyleItemWithParamPtr) comp;
460 if (item->comp != NULL)
461 xmlXPathFreeCompExpr(item->comp);
462 }
463 break;
464 case XSLT_FUNC_PARAM: {
465 xsltStyleItemParamPtr item =
466 (xsltStyleItemParamPtr) comp;
467 if (item->comp != NULL)
468 xmlXPathFreeCompExpr(item->comp);
469 }
470 break;
471 case XSLT_FUNC_VARIABLE: {
472 xsltStyleItemVariablePtr item =
473 (xsltStyleItemVariablePtr) comp;
474 if (item->comp != NULL)
475 xmlXPathFreeCompExpr(item->comp);
476 }
477 break;
478 case XSLT_FUNC_WHEN: {
479 xsltStyleItemWhenPtr item =
480 (xsltStyleItemWhenPtr) comp;
481 if (item->comp != NULL)
482 xmlXPathFreeCompExpr(item->comp);
483 }
484 break;
485 case XSLT_FUNC_OTHERWISE:
486 case XSLT_FUNC_FALLBACK:
487 case XSLT_FUNC_MESSAGE:
488 case XSLT_FUNC_INCLUDE:
489 case XSLT_FUNC_ATTRSET:
490
491 break;
492 default:
493 /* TODO: Raise error. */
494 break;
495 }
496#else
497 if (comp->comp != NULL)
498 xmlXPathFreeCompExpr(comp->comp);
499 if (comp->numdata.countPat != NULL)
501 if (comp->numdata.fromPat != NULL)
503 if (comp->nsList != NULL)
504 xmlFree(comp->nsList);
505#endif
506
507 xmlFree(comp);
508}
509
510
511/************************************************************************
512 * *
513 * XSLT-1.1 extensions *
514 * *
515 ************************************************************************/
516
530#ifdef XSLT_REFACTORED
531 xsltStyleItemDocumentPtr comp;
532#else
534#endif
535 const xmlChar *filename = NULL;
536
537 /*
538 * As of 2006-03-30, this function is currently defined in Libxslt
539 * to be used for:
540 * (in libxslt/extra.c)
541 * "output" in XSLT_SAXON_NAMESPACE
542 * "write" XSLT_XALAN_NAMESPACE
543 * "document" XSLT_XT_NAMESPACE
544 * "document" XSLT_NAMESPACE (from the abandoned old working
545 * draft of XSLT 1.1)
546 * (in libexslt/common.c)
547 * "document" in EXSLT_COMMON_NAMESPACE
548 */
549#ifdef XSLT_REFACTORED
550 comp = (xsltStyleItemDocumentPtr)
552#else
554#endif
555
556 if (comp == NULL)
557 return (NULL);
558 comp->inst = inst;
559 comp->ver11 = 0;
560
561 if (xmlStrEqual(inst->name, (const xmlChar *) "output")) {
562#ifdef WITH_XSLT_DEBUG_EXTRA
564 "Found saxon:output extension\n");
565#endif
566 /*
567 * The element "output" is in the namespace XSLT_SAXON_NAMESPACE
568 * (http://icl.com/saxon)
569 * The @file is in no namespace; it is an AVT.
570 * (http://www.computerwizards.com/saxon/doc/extensions.html#saxon:output)
571 *
572 * TODO: Do we need not to check the namespace here?
573 */
575 (const xmlChar *)"file",
576 NULL, &comp->has_filename);
577 } else if (xmlStrEqual(inst->name, (const xmlChar *) "write")) {
578#ifdef WITH_XSLT_DEBUG_EXTRA
580 "Found xalan:write extension\n");
581#endif
582 /* the filename need to be interpreted */
583 /*
584 * TODO: Is "filename need to be interpreted" meant to be a todo?
585 * Where will be the filename of xalan:write be processed?
586 *
587 * TODO: Do we need not to check the namespace here?
588 * The extension ns is "http://xml.apache.org/xalan/redirect".
589 * See http://xml.apache.org/xalan-j/extensionslib.html.
590 */
591 } else if (xmlStrEqual(inst->name, (const xmlChar *) "document")) {
592 if (inst->ns != NULL) {
593 if (xmlStrEqual(inst->ns->href, XSLT_NAMESPACE)) {
594 /*
595 * Mark the instruction as being of
596 * XSLT version 1.1 (abandoned).
597 */
598 comp->ver11 = 1;
599#ifdef WITH_XSLT_DEBUG_EXTRA
601 "Found xslt11:document construct\n");
602#endif
603 } else {
604 if (xmlStrEqual(inst->ns->href,
605 (const xmlChar *)"http://exslt.org/common")) {
606 /* EXSLT. */
607#ifdef WITH_XSLT_DEBUG_EXTRA
609 "Found exslt:document extension\n");
610#endif
611 } else if (xmlStrEqual(inst->ns->href, XSLT_XT_NAMESPACE)) {
612 /* James Clark's XT. */
613#ifdef WITH_XSLT_DEBUG_EXTRA
615 "Found xt:document extension\n");
616#endif
617 }
618 }
619 }
620 /*
621 * The element "document" is used in conjunction with the
622 * following namespaces:
623 *
624 * 1) XSLT_NAMESPACE (http://www.w3.org/1999/XSL/Transform version 1.1)
625 * <!ELEMENT xsl:document %template;>
626 * <!ATTLIST xsl:document
627 * href %avt; #REQUIRED
628 * @href is an AVT
629 * IMPORTANT: xsl:document was in the abandoned XSLT 1.1 draft,
630 * it was removed and isn't available in XSLT 1.1 anymore.
631 * In XSLT 2.0 it was renamed to xsl:result-document.
632 *
633 * All other attributes are identical to the attributes
634 * on xsl:output
635 *
636 * 2) EXSLT_COMMON_NAMESPACE (http://exslt.org/common)
637 * <exsl:document
638 * href = { uri-reference }
639 * TODO: is @href is an AVT?
640 *
641 * 3) XSLT_XT_NAMESPACE (http://www.jclark.com/xt)
642 * Example: <xt:document method="xml" href="myFile.xml">
643 * TODO: is @href is an AVT?
644 *
645 * In all cases @href is in no namespace.
646 */
648 (const xmlChar *)"href", NULL, &comp->has_filename);
649 }
650 if (!comp->has_filename) {
651 goto error;
652 }
653 comp->filename = filename;
654
655error:
656 return ((xsltElemPreCompPtr) comp);
657}
658
659/************************************************************************
660 * *
661 * Most of the XSLT-1.0 transformations *
662 * *
663 ************************************************************************/
664
672static void
674#ifdef XSLT_REFACTORED
675 xsltStyleItemSortPtr comp;
676#else
678#endif
679 if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
680 return;
681
682#ifdef XSLT_REFACTORED
683 comp = (xsltStyleItemSortPtr) xsltNewStylePreComp(style, XSLT_FUNC_SORT);
684#else
686#endif
687
688 if (comp == NULL)
689 return;
690 inst->psvi = comp;
691 comp->inst = inst;
692
693 comp->stype = xsltEvalStaticAttrValueTemplate(style, inst,
694 (const xmlChar *)"data-type",
695 NULL, &comp->has_stype);
696 if (comp->stype != NULL) {
697 if (xmlStrEqual(comp->stype, (const xmlChar *) "text"))
698 comp->number = 0;
699 else if (xmlStrEqual(comp->stype, (const xmlChar *) "number"))
700 comp->number = 1;
701 else {
703 "xsltSortComp: no support for data-type = %s\n", comp->stype);
704 comp->number = 0; /* use default */
705 if (style != NULL) style->warnings++;
706 }
707 }
708 comp->order = xsltEvalStaticAttrValueTemplate(style, inst,
709 (const xmlChar *)"order",
710 NULL, &comp->has_order);
711 if (comp->order != NULL) {
712 if (xmlStrEqual(comp->order, (const xmlChar *) "ascending"))
713 comp->descending = 0;
714 else if (xmlStrEqual(comp->order, (const xmlChar *) "descending"))
715 comp->descending = 1;
716 else {
718 "xsltSortComp: invalid value %s for order\n", comp->order);
719 comp->descending = 0; /* use default */
720 if (style != NULL) style->warnings++;
721 }
722 }
723 comp->case_order = xsltEvalStaticAttrValueTemplate(style, inst,
724 (const xmlChar *)"case-order",
725 NULL, &comp->has_use);
726 if (comp->case_order != NULL) {
727 if (xmlStrEqual(comp->case_order, (const xmlChar *) "upper-first"))
728 comp->lower_first = 0;
729 else if (xmlStrEqual(comp->case_order, (const xmlChar *) "lower-first"))
730 comp->lower_first = 1;
731 else {
733 "xsltSortComp: invalid value %s for order\n", comp->order);
734 comp->lower_first = 0; /* use default */
735 if (style != NULL) style->warnings++;
736 }
737 }
738
739 comp->lang = xsltEvalStaticAttrValueTemplate(style, inst,
740 (const xmlChar *)"lang",
741 NULL, &comp->has_lang);
742
743 comp->select = xsltGetCNsProp(style, inst,(const xmlChar *)"select", XSLT_NAMESPACE);
744 if (comp->select == NULL) {
745 /*
746 * The default value of the select attribute is ., which will
747 * cause the string-value of the current node to be used as
748 * the sort key.
749 */
750 comp->select = xmlDictLookup(style->dict, BAD_CAST ".", 1);
751 }
752 comp->comp = xsltXPathCompile(style, comp->select);
753 if (comp->comp == NULL) {
755 "xsltSortComp: could not compile select expression '%s'\n",
756 comp->select);
757 if (style != NULL) style->errors++;
758 }
759 if (inst->children != NULL) {
761 "xsl:sort : is not empty\n");
762 if (style != NULL) style->errors++;
763 }
764}
765
773static void
775#ifdef XSLT_REFACTORED
776 xsltStyleItemCopyPtr comp;
777#else
779#endif
780
781 if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
782 return;
783#ifdef XSLT_REFACTORED
784 comp = (xsltStyleItemCopyPtr) xsltNewStylePreComp(style, XSLT_FUNC_COPY);
785#else
787#endif
788
789 if (comp == NULL)
790 return;
791 inst->psvi = comp;
792 comp->inst = inst;
793
794
795 comp->use = xsltGetCNsProp(style, inst, (const xmlChar *)"use-attribute-sets",
797 if (comp->use == NULL)
798 comp->has_use = 0;
799 else
800 comp->has_use = 1;
801}
802
803#ifdef XSLT_REFACTORED
804 /* Enable if ever needed for xsl:text. */
805#else
816static void
818#ifdef XSLT_REFACTORED
819 xsltStyleItemTextPtr comp;
820#else
822#endif
823 const xmlChar *prop;
824
825 if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
826 return;
827
828#ifdef XSLT_REFACTORED
829 comp = (xsltStyleItemTextPtr) xsltNewStylePreComp(style, XSLT_FUNC_TEXT);
830#else
832#endif
833 if (comp == NULL)
834 return;
835 inst->psvi = comp;
836 comp->inst = inst;
837 comp->noescape = 0;
838
839 prop = xsltGetCNsProp(style, inst,
840 (const xmlChar *)"disable-output-escaping",
842 if (prop != NULL) {
843 if (xmlStrEqual(prop, (const xmlChar *)"yes")) {
844 comp->noescape = 1;
845 } else if (!xmlStrEqual(prop,
846 (const xmlChar *)"no")){
848 "xsl:text: disable-output-escaping allows only yes or no\n");
849 if (style != NULL) style->warnings++;
850 }
851 }
852}
853#endif /* else of XSLT_REFACTORED */
854
862static void
864#ifdef XSLT_REFACTORED
865 xsltStyleItemElementPtr comp;
866#else
868#endif
869
870 /*
871 * <xsl:element
872 * name = { qname }
873 * namespace = { uri-reference }
874 * use-attribute-sets = qnames>
875 * <!-- Content: template -->
876 * </xsl:element>
877 */
878 if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
879 return;
880
881#ifdef XSLT_REFACTORED
882 comp = (xsltStyleItemElementPtr) xsltNewStylePreComp(style, XSLT_FUNC_ELEMENT);
883#else
885#endif
886
887 if (comp == NULL)
888 return;
889 inst->psvi = comp;
890 comp->inst = inst;
891
892 /*
893 * Attribute "name".
894 */
895 /*
896 * TODO: Precompile the AVT. See bug #344894.
897 */
898 comp->name = xsltEvalStaticAttrValueTemplate(style, inst,
899 (const xmlChar *)"name", NULL, &comp->has_name);
900 if (! comp->has_name) {
902 "xsl:element: The attribute 'name' is missing.\n");
903 style->errors++;
904 goto error;
905 }
906 /*
907 * Attribute "namespace".
908 */
909 /*
910 * TODO: Precompile the AVT. See bug #344894.
911 */
912 comp->ns = xsltEvalStaticAttrValueTemplate(style, inst,
913 (const xmlChar *)"namespace", NULL, &comp->has_ns);
914
915 if (comp->name != NULL) {
916 if (xmlValidateQName(comp->name, 0)) {
918 "xsl:element: The value '%s' of the attribute 'name' is "
919 "not a valid QName.\n", comp->name);
920 style->errors++;
921 } else {
922 const xmlChar *prefix = NULL, *name;
923
924 name = xsltSplitQName(style->dict, comp->name, &prefix);
925 if (comp->has_ns == 0) {
926 xmlNsPtr ns;
927
928 /*
929 * SPEC XSLT 1.0:
930 * "If the namespace attribute is not present, then the QName is
931 * expanded into an expanded-name using the namespace declarations
932 * in effect for the xsl:element element, including any default
933 * namespace declaration.
934 */
935 ns = xmlSearchNs(inst->doc, inst, prefix);
936 if (ns != NULL) {
937 comp->ns = xmlDictLookup(style->dict, ns->href, -1);
938 comp->has_ns = 1;
939#ifdef XSLT_REFACTORED
940 comp->nsPrefix = prefix;
941 comp->name = name;
942#else
943 (void)name; /* Suppress unused variable warning. */
944#endif
945 } else if (prefix != NULL) {
947 "xsl:element: The prefixed QName '%s' "
948 "has no namespace binding in scope in the "
949 "stylesheet; this is an error, since the namespace was "
950 "not specified by the instruction itself.\n", comp->name);
951 style->errors++;
952 }
953 }
954 if ((prefix != NULL) &&
955 (!xmlStrncasecmp(prefix, (xmlChar *)"xml", 3)))
956 {
957 /*
958 * Mark is to be skipped.
959 */
960 comp->has_name = 0;
961 }
962 }
963 }
964 /*
965 * Attribute "use-attribute-sets",
966 */
967 comp->use = xsltEvalStaticAttrValueTemplate(style, inst,
968 (const xmlChar *)"use-attribute-sets",
969 NULL, &comp->has_use);
970
971error:
972 return;
973}
974
982static void
984#ifdef XSLT_REFACTORED
985 xsltStyleItemAttributePtr comp;
986#else
988#endif
989
990 /*
991 * <xsl:attribute
992 * name = { qname }
993 * namespace = { uri-reference }>
994 * <!-- Content: template -->
995 * </xsl:attribute>
996 */
997 if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
998 return;
999
1000#ifdef XSLT_REFACTORED
1001 comp = (xsltStyleItemAttributePtr) xsltNewStylePreComp(style,
1003#else
1005#endif
1006
1007 if (comp == NULL)
1008 return;
1009 inst->psvi = comp;
1010 comp->inst = inst;
1011
1012 /*
1013 * Attribute "name".
1014 */
1015 /*
1016 * TODO: Precompile the AVT. See bug #344894.
1017 */
1018 comp->name = xsltEvalStaticAttrValueTemplate(style, inst,
1019 (const xmlChar *)"name",
1020 NULL, &comp->has_name);
1021 if (! comp->has_name) {
1023 "XSLT-attribute: The attribute 'name' is missing.\n");
1024 style->errors++;
1025 return;
1026 }
1027 /*
1028 * Attribute "namespace".
1029 */
1030 /*
1031 * TODO: Precompile the AVT. See bug #344894.
1032 */
1033 comp->ns = xsltEvalStaticAttrValueTemplate(style, inst,
1034 (const xmlChar *)"namespace",
1035 NULL, &comp->has_ns);
1036
1037 if (comp->name != NULL) {
1038 if (xmlValidateQName(comp->name, 0)) {
1040 "xsl:attribute: The value '%s' of the attribute 'name' is "
1041 "not a valid QName.\n", comp->name);
1042 style->errors++;
1043 } else if (xmlStrEqual(comp->name, BAD_CAST "xmlns")) {
1045 "xsl:attribute: The attribute name 'xmlns' is not allowed.\n");
1046 style->errors++;
1047 } else {
1048 const xmlChar *prefix = NULL, *name;
1049
1050 name = xsltSplitQName(style->dict, comp->name, &prefix);
1051 if (prefix != NULL) {
1052 if (comp->has_ns == 0) {
1053 xmlNsPtr ns;
1054
1055 /*
1056 * SPEC XSLT 1.0:
1057 * "If the namespace attribute is not present, then the
1058 * QName is expanded into an expanded-name using the
1059 * namespace declarations in effect for the xsl:element
1060 * element, including any default namespace declaration.
1061 */
1062 ns = xmlSearchNs(inst->doc, inst, prefix);
1063 if (ns != NULL) {
1064 comp->ns = xmlDictLookup(style->dict, ns->href, -1);
1065 comp->has_ns = 1;
1066#ifdef XSLT_REFACTORED
1067 comp->nsPrefix = prefix;
1068 comp->name = name;
1069#else
1070 (void)name; /* Suppress unused variable warning. */
1071#endif
1072 } else {
1074 "xsl:attribute: The prefixed QName '%s' "
1075 "has no namespace binding in scope in the "
1076 "stylesheet; this is an error, since the "
1077 "namespace was not specified by the instruction "
1078 "itself.\n", comp->name);
1079 style->errors++;
1080 }
1081 }
1082 }
1083 }
1084 }
1085}
1086
1094static void
1096#ifdef XSLT_REFACTORED
1097 xsltStyleItemCommentPtr comp;
1098#else
1100#endif
1101
1102 if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
1103 return;
1104
1105#ifdef XSLT_REFACTORED
1106 comp = (xsltStyleItemCommentPtr) xsltNewStylePreComp(style, XSLT_FUNC_COMMENT);
1107#else
1109#endif
1110
1111 if (comp == NULL)
1112 return;
1113 inst->psvi = comp;
1114 comp->inst = inst;
1115}
1116
1124static void
1126#ifdef XSLT_REFACTORED
1127 xsltStyleItemPIPtr comp;
1128#else
1130#endif
1131
1132 if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
1133 return;
1134
1135#ifdef XSLT_REFACTORED
1136 comp = (xsltStyleItemPIPtr) xsltNewStylePreComp(style, XSLT_FUNC_PI);
1137#else
1139#endif
1140
1141 if (comp == NULL)
1142 return;
1143 inst->psvi = comp;
1144 comp->inst = inst;
1145
1146 comp->name = xsltEvalStaticAttrValueTemplate(style, inst,
1147 (const xmlChar *)"name",
1148 XSLT_NAMESPACE, &comp->has_name);
1149}
1150
1158static void
1160#ifdef XSLT_REFACTORED
1161 xsltStyleItemCopyOfPtr comp;
1162#else
1164#endif
1165
1166 if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
1167 return;
1168
1169#ifdef XSLT_REFACTORED
1170 comp = (xsltStyleItemCopyOfPtr) xsltNewStylePreComp(style, XSLT_FUNC_COPYOF);
1171#else
1173#endif
1174
1175 if (comp == NULL)
1176 return;
1177 inst->psvi = comp;
1178 comp->inst = inst;
1179
1180 comp->select = xsltGetCNsProp(style, inst, (const xmlChar *)"select",
1182 if (comp->select == NULL) {
1184 "xsl:copy-of : select is missing\n");
1185 if (style != NULL) style->errors++;
1186 return;
1187 }
1188 comp->comp = xsltXPathCompile(style, comp->select);
1189 if (comp->comp == NULL) {
1191 "xsl:copy-of : could not compile select expression '%s'\n",
1192 comp->select);
1193 if (style != NULL) style->errors++;
1194 }
1195}
1196
1204static void
1206#ifdef XSLT_REFACTORED
1207 xsltStyleItemValueOfPtr comp;
1208#else
1210#endif
1211 const xmlChar *prop;
1212
1213 if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
1214 return;
1215
1216#ifdef XSLT_REFACTORED
1217 comp = (xsltStyleItemValueOfPtr) xsltNewStylePreComp(style, XSLT_FUNC_VALUEOF);
1218#else
1220#endif
1221
1222 if (comp == NULL)
1223 return;
1224 inst->psvi = comp;
1225 comp->inst = inst;
1226
1227 prop = xsltGetCNsProp(style, inst,
1228 (const xmlChar *)"disable-output-escaping",
1230 if (prop != NULL) {
1231 if (xmlStrEqual(prop, (const xmlChar *)"yes")) {
1232 comp->noescape = 1;
1233 } else if (!xmlStrEqual(prop,
1234 (const xmlChar *)"no")){
1236"xsl:value-of : disable-output-escaping allows only yes or no\n");
1237 if (style != NULL) style->warnings++;
1238 }
1239 }
1240 comp->select = xsltGetCNsProp(style, inst, (const xmlChar *)"select",
1242 if (comp->select == NULL) {
1244 "xsl:value-of : select is missing\n");
1245 if (style != NULL) style->errors++;
1246 return;
1247 }
1248 comp->comp = xsltXPathCompile(style, comp->select);
1249 if (comp->comp == NULL) {
1251 "xsl:value-of : could not compile select expression '%s'\n",
1252 comp->select);
1253 if (style != NULL) style->errors++;
1254 }
1255}
1256
1257static void
1259 const xmlChar *propName,
1260 int mandatory,
1261 int *hasProp, const xmlChar **nsName,
1262 const xmlChar** localName)
1263{
1264 const xmlChar *prop;
1265
1266 if (nsName)
1267 *nsName = NULL;
1268 if (localName)
1269 *localName = NULL;
1270 if (hasProp)
1271 *hasProp = 0;
1272
1273 prop = xsltGetCNsProp(style, inst, propName, XSLT_NAMESPACE);
1274 if (prop == NULL) {
1275 if (mandatory) {
1277 "The attribute '%s' is missing.\n", propName);
1278 style->errors++;
1279 return;
1280 }
1281 } else {
1282 const xmlChar *URI;
1283
1284 if (xmlValidateQName(prop, 0)) {
1286 "The value '%s' of the attribute "
1287 "'%s' is not a valid QName.\n", prop, propName);
1288 style->errors++;
1289 return;
1290 } else {
1291 /*
1292 * @prop will be in the string dict afterwards, @URI not.
1293 */
1294 URI = xsltGetQNameURI2(style, inst, &prop);
1295 if (prop == NULL) {
1296 style->errors++;
1297 } else {
1298 if (localName)
1299 *localName = prop;
1300 if (hasProp)
1301 *hasProp = 1;
1302 if (URI != NULL) {
1303 /*
1304 * Fixes bug #308441: Put the ns-name in the dict
1305 * in order to pointer compare names during XPath's
1306 * variable lookup.
1307 */
1308 if (nsName)
1309 *nsName = xmlDictLookup(style->dict, URI, -1);
1310 /* comp->has_ns = 1; */
1311 }
1312 }
1313 }
1314 }
1315 return;
1316}
1317
1331static void
1333#ifdef XSLT_REFACTORED
1334 xsltStyleItemWithParamPtr comp;
1335#else
1337#endif
1338
1339 if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
1340 return;
1341
1342#ifdef XSLT_REFACTORED
1343 comp = (xsltStyleItemWithParamPtr) xsltNewStylePreComp(style, XSLT_FUNC_WITHPARAM);
1344#else
1346#endif
1347
1348 if (comp == NULL)
1349 return;
1350 inst->psvi = comp;
1351 comp->inst = inst;
1352
1353 /*
1354 * Attribute "name".
1355 */
1356 xsltGetQNameProperty(style, inst, BAD_CAST "name",
1357 1, &(comp->has_name), &(comp->ns), &(comp->name));
1358 if (comp->ns)
1359 comp->has_ns = 1;
1360 /*
1361 * Attribute "select".
1362 */
1363 comp->select = xsltGetCNsProp(style, inst, (const xmlChar *)"select",
1365 if (comp->select != NULL) {
1366 comp->comp = xsltXPathCompile(style, comp->select);
1367 if (comp->comp == NULL) {
1369 "XSLT-with-param: Failed to compile select "
1370 "expression '%s'\n", comp->select);
1371 style->errors++;
1372 }
1373 if (inst->children != NULL) {
1375 "XSLT-with-param: The content should be empty since "
1376 "the attribute select is present.\n");
1377 style->warnings++;
1378 }
1379 }
1380}
1381
1389static void
1391#ifdef XSLT_REFACTORED
1392 xsltStyleItemNumberPtr comp;
1393#else
1395#endif
1396 const xmlChar *prop;
1397
1398 if ((style == NULL) || (cur == NULL) || (cur->type != XML_ELEMENT_NODE))
1399 return;
1400
1401#ifdef XSLT_REFACTORED
1402 comp = (xsltStyleItemNumberPtr) xsltNewStylePreComp(style, XSLT_FUNC_NUMBER);
1403#else
1405#endif
1406
1407 if (comp == NULL)
1408 return;
1409 cur->psvi = comp;
1410
1411 comp->numdata.doc = cur->doc;
1412 comp->numdata.node = cur;
1413 comp->numdata.value = xsltGetCNsProp(style, cur, (const xmlChar *)"value",
1415
1417 (const xmlChar *)"format",
1418 XSLT_NAMESPACE, &comp->numdata.has_format);
1419 if (comp->numdata.has_format == 0) {
1420 comp->numdata.format = xmlDictLookup(style->dict, BAD_CAST "" , 0);
1421 } else {
1422 comp->numdata.format = prop;
1423 }
1424
1425 comp->numdata.count = xsltGetCNsProp(style, cur, (const xmlChar *)"count",
1427 comp->numdata.from = xsltGetCNsProp(style, cur, (const xmlChar *)"from",
1429
1430 prop = xsltGetCNsProp(style, cur, (const xmlChar *)"count", XSLT_NAMESPACE);
1431 if (prop != NULL) {
1432 comp->numdata.countPat = xsltCompilePattern(prop, cur->doc, cur, style,
1433 NULL);
1434 }
1435
1436 prop = xsltGetCNsProp(style, cur, (const xmlChar *)"from", XSLT_NAMESPACE);
1437 if (prop != NULL) {
1438 comp->numdata.fromPat = xsltCompilePattern(prop, cur->doc, cur, style,
1439 NULL);
1440 }
1441
1442 prop = xsltGetCNsProp(style, cur, (const xmlChar *)"level", XSLT_NAMESPACE);
1443 if (prop != NULL) {
1444 if (xmlStrEqual(prop, BAD_CAST("single")) ||
1445 xmlStrEqual(prop, BAD_CAST("multiple")) ||
1446 xmlStrEqual(prop, BAD_CAST("any"))) {
1447 comp->numdata.level = prop;
1448 } else {
1450 "xsl:number : invalid value %s for level\n", prop);
1451 if (style != NULL) style->warnings++;
1452 }
1453 }
1454
1455 prop = xsltGetCNsProp(style, cur, (const xmlChar *)"lang", XSLT_NAMESPACE);
1456 if (prop != NULL) {
1458 "xsl:number : lang attribute not implemented\n");
1459 XSLT_TODO; /* xsl:number lang attribute */
1460 }
1461
1462 prop = xsltGetCNsProp(style, cur, (const xmlChar *)"letter-value", XSLT_NAMESPACE);
1463 if (prop != NULL) {
1464 if (xmlStrEqual(prop, BAD_CAST("alphabetic"))) {
1466 "xsl:number : letter-value 'alphabetic' not implemented\n");
1467 if (style != NULL) style->warnings++;
1468 XSLT_TODO; /* xsl:number letter-value attribute alphabetic */
1469 } else if (xmlStrEqual(prop, BAD_CAST("traditional"))) {
1471 "xsl:number : letter-value 'traditional' not implemented\n");
1472 if (style != NULL) style->warnings++;
1473 XSLT_TODO; /* xsl:number letter-value attribute traditional */
1474 } else {
1476 "xsl:number : invalid value %s for letter-value\n", prop);
1477 if (style != NULL) style->warnings++;
1478 }
1479 }
1480
1481 prop = xsltGetCNsProp(style, cur, (const xmlChar *)"grouping-separator",
1483 if (prop != NULL) {
1484 comp->numdata.groupingCharacterLen = xmlStrlen(prop);
1485 comp->numdata.groupingCharacter =
1486 xsltGetUTF8Char(prop, &(comp->numdata.groupingCharacterLen));
1487 if (comp->numdata.groupingCharacter < 0)
1488 comp->numdata.groupingCharacter = 0;
1489 }
1490
1491 prop = xsltGetCNsProp(style, cur, (const xmlChar *)"grouping-size", XSLT_NAMESPACE);
1492 if (prop != NULL) {
1493 sscanf((char *)prop, "%d", &comp->numdata.digitsPerGroup);
1494 } else {
1495 comp->numdata.groupingCharacter = 0;
1496 }
1497
1498 /* Set default values */
1499 if (comp->numdata.value == NULL) {
1500 if (comp->numdata.level == NULL) {
1501 comp->numdata.level = xmlDictLookup(style->dict,
1502 BAD_CAST"single", 6);
1503 }
1504 }
1505
1506}
1507
1515static void
1517#ifdef XSLT_REFACTORED
1518 xsltStyleItemApplyImportsPtr comp;
1519#else
1521#endif
1522
1523 if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
1524 return;
1525
1526#ifdef XSLT_REFACTORED
1527 comp = (xsltStyleItemApplyImportsPtr) xsltNewStylePreComp(style, XSLT_FUNC_APPLYIMPORTS);
1528#else
1530#endif
1531
1532 if (comp == NULL)
1533 return;
1534 inst->psvi = comp;
1535 comp->inst = inst;
1536}
1537
1545static void
1547#ifdef XSLT_REFACTORED
1548 xsltStyleItemCallTemplatePtr comp;
1549#else
1551#endif
1552
1553 if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
1554 return;
1555
1556#ifdef XSLT_REFACTORED
1557 comp = (xsltStyleItemCallTemplatePtr)
1559#else
1561#endif
1562
1563 if (comp == NULL)
1564 return;
1565 inst->psvi = comp;
1566 comp->inst = inst;
1567
1568 /*
1569 * Attribute "name".
1570 */
1571 xsltGetQNameProperty(style, inst, BAD_CAST "name",
1572 1, &(comp->has_name), &(comp->ns), &(comp->name));
1573 if (comp->ns)
1574 comp->has_ns = 1;
1575}
1576
1584static void
1586#ifdef XSLT_REFACTORED
1587 xsltStyleItemApplyTemplatesPtr comp;
1588#else
1590#endif
1591
1592 if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
1593 return;
1594
1595#ifdef XSLT_REFACTORED
1596 comp = (xsltStyleItemApplyTemplatesPtr)
1598#else
1600#endif
1601
1602 if (comp == NULL)
1603 return;
1604 inst->psvi = comp;
1605 comp->inst = inst;
1606
1607 /*
1608 * Attribute "mode".
1609 */
1610 xsltGetQNameProperty(style, inst, BAD_CAST "mode",
1611 0, NULL, &(comp->modeURI), &(comp->mode));
1612 /*
1613 * Attribute "select".
1614 */
1615 comp->select = xsltGetCNsProp(style, inst, BAD_CAST "select",
1617 if (comp->select != NULL) {
1618 comp->comp = xsltXPathCompile(style, comp->select);
1619 if (comp->comp == NULL) {
1621 "XSLT-apply-templates: could not compile select "
1622 "expression '%s'\n", comp->select);
1623 style->errors++;
1624 }
1625 }
1626 /* TODO: handle (or skip) the xsl:sort and xsl:with-param */
1627}
1628
1636static void
1638#ifdef XSLT_REFACTORED
1639 xsltStyleItemChoosePtr comp;
1640#else
1642#endif
1643
1644 if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
1645 return;
1646
1647#ifdef XSLT_REFACTORED
1648 comp = (xsltStyleItemChoosePtr)
1650#else
1652#endif
1653
1654 if (comp == NULL)
1655 return;
1656 inst->psvi = comp;
1657 comp->inst = inst;
1658}
1659
1667static void
1669#ifdef XSLT_REFACTORED
1670 xsltStyleItemIfPtr comp;
1671#else
1673#endif
1674
1675 if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
1676 return;
1677
1678#ifdef XSLT_REFACTORED
1679 comp = (xsltStyleItemIfPtr)
1681#else
1683#endif
1684
1685 if (comp == NULL)
1686 return;
1687 inst->psvi = comp;
1688 comp->inst = inst;
1689
1690 comp->test = xsltGetCNsProp(style, inst, (const xmlChar *)"test", XSLT_NAMESPACE);
1691 if (comp->test == NULL) {
1693 "xsl:if : test is not defined\n");
1694 if (style != NULL) style->errors++;
1695 return;
1696 }
1697 comp->comp = xsltXPathCompile(style, comp->test);
1698 if (comp->comp == NULL) {
1700 "xsl:if : could not compile test expression '%s'\n",
1701 comp->test);
1702 if (style != NULL) style->errors++;
1703 }
1704}
1705
1713static void
1715#ifdef XSLT_REFACTORED
1716 xsltStyleItemWhenPtr comp;
1717#else
1719#endif
1720
1721 if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
1722 return;
1723
1724#ifdef XSLT_REFACTORED
1725 comp = (xsltStyleItemWhenPtr)
1727#else
1729#endif
1730
1731 if (comp == NULL)
1732 return;
1733 inst->psvi = comp;
1734 comp->inst = inst;
1735
1736 comp->test = xsltGetCNsProp(style, inst, (const xmlChar *)"test", XSLT_NAMESPACE);
1737 if (comp->test == NULL) {
1739 "xsl:when : test is not defined\n");
1740 if (style != NULL) style->errors++;
1741 return;
1742 }
1743 comp->comp = xsltXPathCompile(style, comp->test);
1744 if (comp->comp == NULL) {
1746 "xsl:when : could not compile test expression '%s'\n",
1747 comp->test);
1748 if (style != NULL) style->errors++;
1749 }
1750}
1751
1759static void
1761#ifdef XSLT_REFACTORED
1762 xsltStyleItemForEachPtr comp;
1763#else
1765#endif
1766
1767 if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
1768 return;
1769
1770#ifdef XSLT_REFACTORED
1771 comp = (xsltStyleItemForEachPtr)
1773#else
1775#endif
1776
1777 if (comp == NULL)
1778 return;
1779 inst->psvi = comp;
1780 comp->inst = inst;
1781
1782 comp->select = xsltGetCNsProp(style, inst, (const xmlChar *)"select",
1784 if (comp->select == NULL) {
1786 "xsl:for-each : select is missing\n");
1787 if (style != NULL) style->errors++;
1788 } else {
1789 comp->comp = xsltXPathCompile(style, comp->select);
1790 if (comp->comp == NULL) {
1792 "xsl:for-each : could not compile select expression '%s'\n",
1793 comp->select);
1794 if (style != NULL) style->errors++;
1795 }
1796 }
1797 /* TODO: handle and skip the xsl:sort */
1798}
1799
1807static void
1809#ifdef XSLT_REFACTORED
1810 xsltStyleItemVariablePtr comp;
1811#else
1813#endif
1814
1815 if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
1816 return;
1817
1818#ifdef XSLT_REFACTORED
1819 comp = (xsltStyleItemVariablePtr)
1821#else
1823#endif
1824
1825 if (comp == NULL)
1826 return;
1827
1828 inst->psvi = comp;
1829 comp->inst = inst;
1830 /*
1831 * The full template resolution can be done statically
1832 */
1833
1834 /*
1835 * Attribute "name".
1836 */
1837 xsltGetQNameProperty(style, inst, BAD_CAST "name",
1838 1, &(comp->has_name), &(comp->ns), &(comp->name));
1839 if (comp->ns)
1840 comp->has_ns = 1;
1841 /*
1842 * Attribute "select".
1843 */
1844 comp->select = xsltGetCNsProp(style, inst, (const xmlChar *)"select",
1846 if (comp->select != NULL) {
1847#ifndef XSLT_REFACTORED
1848 xmlNodePtr cur;
1849#endif
1850 comp->comp = xsltXPathCompile(style, comp->select);
1851 if (comp->comp == NULL) {
1853 "XSLT-variable: Failed to compile the XPath expression '%s'.\n",
1854 comp->select);
1855 style->errors++;
1856 }
1857#ifdef XSLT_REFACTORED
1858 if (inst->children != NULL) {
1860 "XSLT-variable: There must be no child nodes, since the "
1861 "attribute 'select' was specified.\n");
1862 style->errors++;
1863 }
1864#else
1865 for (cur = inst->children; cur != NULL; cur = cur->next) {
1866 if (cur->type != XML_COMMENT_NODE &&
1867 (cur->type != XML_TEXT_NODE || !xsltIsBlank(cur->content)))
1868 {
1870 "XSLT-variable: There must be no child nodes, since the "
1871 "attribute 'select' was specified.\n");
1872 style->errors++;
1873 }
1874 }
1875#endif
1876 }
1877}
1878
1886static void
1888#ifdef XSLT_REFACTORED
1889 xsltStyleItemParamPtr comp;
1890#else
1892#endif
1893
1894 if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE))
1895 return;
1896
1897#ifdef XSLT_REFACTORED
1898 comp = (xsltStyleItemParamPtr)
1900#else
1902#endif
1903
1904 if (comp == NULL)
1905 return;
1906 inst->psvi = comp;
1907 comp->inst = inst;
1908
1909 /*
1910 * Attribute "name".
1911 */
1912 xsltGetQNameProperty(style, inst, BAD_CAST "name",
1913 1, &(comp->has_name), &(comp->ns), &(comp->name));
1914 if (comp->ns)
1915 comp->has_ns = 1;
1916 /*
1917 * Attribute "select".
1918 */
1919 comp->select = xsltGetCNsProp(style, inst, (const xmlChar *)"select",
1921 if (comp->select != NULL) {
1922 comp->comp = xsltXPathCompile(style, comp->select);
1923 if (comp->comp == NULL) {
1925 "XSLT-param: could not compile select expression '%s'.\n",
1926 comp->select);
1927 style->errors++;
1928 }
1929 if (inst->children != NULL) {
1931 "XSLT-param: The content should be empty since the "
1932 "attribute 'select' is present.\n");
1933 style->warnings++;
1934 }
1935 }
1936}
1937
1938/************************************************************************
1939 * *
1940 * Generic interface *
1941 * *
1942 ************************************************************************/
1943
1950void
1953
1954 if (style == NULL)
1955 return;
1956
1957 cur = style->preComps;
1958 while (cur != NULL) {
1959 next = cur->next;
1960 if (cur->type == XSLT_FUNC_EXTENSION)
1961 cur->free(cur);
1962 else
1964 cur = next;
1965 }
1966}
1967
1968#ifdef XSLT_REFACTORED
1969
1979void
1981 /*
1982 * The xsltXSLTElemMarker marker was set beforehand by
1983 * the parsing mechanism for all elements in the XSLT namespace.
1984 */
1985 if (style == NULL) {
1986 if ((node != NULL) && (node->type == XML_ELEMENT_NODE))
1987 node->psvi = NULL;
1988 return;
1989 }
1990 if (node == NULL)
1991 return;
1992 if (! IS_XSLT_ELEM_FAST(node))
1993 return;
1994
1995 node->psvi = NULL;
1996 if (XSLT_CCTXT(style)->inode->type != 0) {
1997 switch (XSLT_CCTXT(style)->inode->type) {
2000 break;
2003 break;
2004 case XSLT_FUNC_VALUEOF:
2006 break;
2007 case XSLT_FUNC_COPY:
2009 break;
2010 case XSLT_FUNC_COPYOF:
2012 break;
2013 case XSLT_FUNC_IF:
2015 break;
2016 case XSLT_FUNC_CHOOSE:
2018 break;
2019 case XSLT_FUNC_WHEN:
2021 break;
2022 case XSLT_FUNC_OTHERWISE:
2023 /* NOP yet */
2024 return;
2025 case XSLT_FUNC_FOREACH:
2027 break;
2030 break;
2033 break;
2034 case XSLT_FUNC_ELEMENT:
2036 break;
2037 case XSLT_FUNC_SORT:
2039 break;
2040 case XSLT_FUNC_COMMENT:
2042 break;
2043 case XSLT_FUNC_NUMBER:
2045 break;
2046 case XSLT_FUNC_PI:
2048 break;
2051 break;
2052 case XSLT_FUNC_PARAM:
2054 break;
2055 case XSLT_FUNC_VARIABLE:
2057 break;
2058 case XSLT_FUNC_FALLBACK:
2059 /* NOP yet */
2060 return;
2061 case XSLT_FUNC_DOCUMENT:
2062 /* The extra one */
2063 node->psvi = (void *) xsltDocumentComp(style, node,
2065 break;
2066 case XSLT_FUNC_MESSAGE:
2067 /* NOP yet */
2068 return;
2069 default:
2070 /*
2071 * NOTE that xsl:text, xsl:template, xsl:stylesheet,
2072 * xsl:transform, xsl:import, xsl:include are not expected
2073 * to be handed over to this function.
2074 */
2076 "Internal error: (xsltStylePreCompute) cannot handle "
2077 "the XSLT element '%s'.\n", node->name);
2078 style->errors++;
2079 return;
2080 }
2081 } else {
2082 /*
2083 * Fallback to string comparison.
2084 */
2085 if (IS_XSLT_NAME(node, "apply-templates")) {
2087 } else if (IS_XSLT_NAME(node, "with-param")) {
2089 } else if (IS_XSLT_NAME(node, "value-of")) {
2091 } else if (IS_XSLT_NAME(node, "copy")) {
2093 } else if (IS_XSLT_NAME(node, "copy-of")) {
2095 } else if (IS_XSLT_NAME(node, "if")) {
2097 } else if (IS_XSLT_NAME(node, "choose")) {
2099 } else if (IS_XSLT_NAME(node, "when")) {
2101 } else if (IS_XSLT_NAME(node, "otherwise")) {
2102 /* NOP yet */
2103 return;
2104 } else if (IS_XSLT_NAME(node, "for-each")) {
2106 } else if (IS_XSLT_NAME(node, "apply-imports")) {
2108 } else if (IS_XSLT_NAME(node, "attribute")) {
2110 } else if (IS_XSLT_NAME(node, "element")) {
2112 } else if (IS_XSLT_NAME(node, "sort")) {
2114 } else if (IS_XSLT_NAME(node, "comment")) {
2116 } else if (IS_XSLT_NAME(node, "number")) {
2118 } else if (IS_XSLT_NAME(node, "processing-instruction")) {
2120 } else if (IS_XSLT_NAME(node, "call-template")) {
2122 } else if (IS_XSLT_NAME(node, "param")) {
2124 } else if (IS_XSLT_NAME(node, "variable")) {
2126 } else if (IS_XSLT_NAME(node, "fallback")) {
2127 /* NOP yet */
2128 return;
2129 } else if (IS_XSLT_NAME(node, "document")) {
2130 /* The extra one */
2131 node->psvi = (void *) xsltDocumentComp(style, node,
2133 } else if (IS_XSLT_NAME(node, "output")) {
2134 /* Top-level */
2135 return;
2136 } else if (IS_XSLT_NAME(node, "preserve-space")) {
2137 /* Top-level */
2138 return;
2139 } else if (IS_XSLT_NAME(node, "strip-space")) {
2140 /* Top-level */
2141 return;
2142 } else if (IS_XSLT_NAME(node, "key")) {
2143 /* Top-level */
2144 return;
2145 } else if (IS_XSLT_NAME(node, "message")) {
2146 return;
2147 } else if (IS_XSLT_NAME(node, "attribute-set")) {
2148 /* Top-level */
2149 return;
2150 } else if (IS_XSLT_NAME(node, "namespace-alias")) {
2151 /* Top-level */
2152 return;
2153 } else if (IS_XSLT_NAME(node, "decimal-format")) {
2154 /* Top-level */
2155 return;
2156 } else if (IS_XSLT_NAME(node, "include")) {
2157 /* Top-level */
2158 } else {
2159 /*
2160 * NOTE that xsl:text, xsl:template, xsl:stylesheet,
2161 * xsl:transform, xsl:import, xsl:include are not expected
2162 * to be handed over to this function.
2163 */
2165 "Internal error: (xsltStylePreCompute) cannot handle "
2166 "the XSLT element '%s'.\n", node->name);
2167 style->errors++;
2168 return;
2169 }
2170 }
2171 /*
2172 * Assign the current list of in-scope namespaces to the
2173 * item. This is needed for XPath expressions.
2174 */
2175 if (node->psvi != NULL) {
2176 ((xsltStylePreCompPtr) node->psvi)->inScopeNs =
2177 XSLT_CCTXT(style)->inode->inScopeNs;
2178 }
2179}
2180
2181#else
2182
2190void
2192 /*
2193 * URGENT TODO: Normally inst->psvi Should never be reserved here,
2194 * BUT: since if we include the same stylesheet from
2195 * multiple imports, then the stylesheet will be parsed
2196 * again. We simply must not try to compute the stylesheet again.
2197 * TODO: Get to the point where we don't need to query the
2198 * namespace- and local-name of the node, but can evaluate this
2199 * using cctxt->style->inode->category;
2200 */
2201 if ((inst == NULL) || (inst->type != XML_ELEMENT_NODE) ||
2202 (inst->psvi != NULL))
2203 return;
2204
2205 if (IS_XSLT_ELEM(inst)) {
2207
2208 if (IS_XSLT_NAME(inst, "apply-templates")) {
2211 } else if (IS_XSLT_NAME(inst, "with-param")) {
2212 xsltCheckParentElement(style, inst, BAD_CAST "apply-templates",
2213 BAD_CAST "call-template");
2214 xsltWithParamComp(style, inst);
2215 } else if (IS_XSLT_NAME(inst, "value-of")) {
2217 xsltValueOfComp(style, inst);
2218 } else if (IS_XSLT_NAME(inst, "copy")) {
2220 xsltCopyComp(style, inst);
2221 } else if (IS_XSLT_NAME(inst, "copy-of")) {
2223 xsltCopyOfComp(style, inst);
2224 } else if (IS_XSLT_NAME(inst, "if")) {
2226 xsltIfComp(style, inst);
2227 } else if (IS_XSLT_NAME(inst, "when")) {
2228 xsltCheckParentElement(style, inst, BAD_CAST "choose", NULL);
2229 xsltWhenComp(style, inst);
2230 } else if (IS_XSLT_NAME(inst, "choose")) {
2232 xsltChooseComp(style, inst);
2233 } else if (IS_XSLT_NAME(inst, "for-each")) {
2235 xsltForEachComp(style, inst);
2236 } else if (IS_XSLT_NAME(inst, "apply-imports")) {
2239 } else if (IS_XSLT_NAME(inst, "attribute")) {
2240 xmlNodePtr parent = inst->parent;
2241
2242 if ((parent == NULL) ||
2243 (parent->type != XML_ELEMENT_NODE) || (parent->ns == NULL) ||
2244 ((parent->ns != inst->ns) &&
2245 (!xmlStrEqual(parent->ns->href, inst->ns->href))) ||
2246 (!xmlStrEqual(parent->name, BAD_CAST "attribute-set"))) {
2248 }
2249 xsltAttributeComp(style, inst);
2250 } else if (IS_XSLT_NAME(inst, "element")) {
2252 xsltElementComp(style, inst);
2253 } else if (IS_XSLT_NAME(inst, "text")) {
2255 xsltTextComp(style, inst);
2256 } else if (IS_XSLT_NAME(inst, "sort")) {
2257 xsltCheckParentElement(style, inst, BAD_CAST "apply-templates",
2258 BAD_CAST "for-each");
2259 xsltSortComp(style, inst);
2260 } else if (IS_XSLT_NAME(inst, "comment")) {
2262 xsltCommentComp(style, inst);
2263 } else if (IS_XSLT_NAME(inst, "number")) {
2265 xsltNumberComp(style, inst);
2266 } else if (IS_XSLT_NAME(inst, "processing-instruction")) {
2269 } else if (IS_XSLT_NAME(inst, "call-template")) {
2272 } else if (IS_XSLT_NAME(inst, "param")) {
2273 if (xsltCheckTopLevelElement(style, inst, 0) == 0)
2275 xsltParamComp(style, inst);
2276 } else if (IS_XSLT_NAME(inst, "variable")) {
2277 if (xsltCheckTopLevelElement(style, inst, 0) == 0)
2279 xsltVariableComp(style, inst);
2280 } else if (IS_XSLT_NAME(inst, "otherwise")) {
2281 xsltCheckParentElement(style, inst, BAD_CAST "choose", NULL);
2283 return;
2284 } else if (IS_XSLT_NAME(inst, "template")) {
2286 return;
2287 } else if (IS_XSLT_NAME(inst, "output")) {
2289 return;
2290 } else if (IS_XSLT_NAME(inst, "preserve-space")) {
2292 return;
2293 } else if (IS_XSLT_NAME(inst, "strip-space")) {
2295 return;
2296 } else if ((IS_XSLT_NAME(inst, "stylesheet")) ||
2297 (IS_XSLT_NAME(inst, "transform"))) {
2298 xmlNodePtr parent = inst->parent;
2299
2300 if ((parent == NULL) || (parent->type != XML_DOCUMENT_NODE)) {
2302 "element %s only allowed only as root element\n",
2303 inst->name);
2304 style->errors++;
2305 }
2306 return;
2307 } else if (IS_XSLT_NAME(inst, "key")) {
2309 return;
2310 } else if (IS_XSLT_NAME(inst, "message")) {
2312 return;
2313 } else if (IS_XSLT_NAME(inst, "attribute-set")) {
2315 return;
2316 } else if (IS_XSLT_NAME(inst, "namespace-alias")) {
2318 return;
2319 } else if (IS_XSLT_NAME(inst, "include")) {
2321 return;
2322 } else if (IS_XSLT_NAME(inst, "import")) {
2324 return;
2325 } else if (IS_XSLT_NAME(inst, "decimal-format")) {
2327 return;
2328 } else if (IS_XSLT_NAME(inst, "fallback")) {
2330 return;
2331 } else if (IS_XSLT_NAME(inst, "document")) {
2333 inst->psvi = (void *) xsltDocumentComp(style, inst,
2335 } else if ((style == NULL) || (style->forwards_compatible == 0)) {
2337 "xsltStylePreCompute: unknown xsl:%s\n", inst->name);
2338 if (style != NULL) style->warnings++;
2339 }
2340
2341 cur = (xsltStylePreCompPtr) inst->psvi;
2342 /*
2343 * A ns-list is build for every XSLT item in the
2344 * node-tree. This is needed for XPath expressions.
2345 */
2346 if (cur != NULL) {
2347 int i = 0;
2348
2349 cur->nsList = xmlGetNsList(inst->doc, inst);
2350 if (cur->nsList != NULL) {
2351 while (cur->nsList[i] != NULL)
2352 i++;
2353 }
2354 cur->nsNr = i;
2355 }
2356 } else {
2357 inst->psvi =
2358 (void *) xsltPreComputeExtModuleElement(style, inst);
2359
2360 /*
2361 * Unknown element, maybe registered at the context
2362 * level. Mark it for later recognition.
2363 */
2364 if (inst->psvi == NULL)
2365 inst->psvi = (void *) xsltExtMarker;
2366 }
2367}
2368#endif /* XSLT_REFACTORED */
xsltElemPreCompPtr xsltPreComputeExtModuleElement(xsltStylesheetPtr style, xmlNodePtr inst)
Definition: extensions.c:1583
static void xsltFreeStylePreComp(xsltStylePreCompPtr comp)
Definition: preproc.c:381
static void xsltProcessingInstructionComp(xsltStylesheetPtr style, xmlNodePtr inst)
Definition: preproc.c:1125
static void xsltAttributeComp(xsltStylesheetPtr style, xmlNodePtr inst)
Definition: preproc.c:983
static void xsltChooseComp(xsltStylesheetPtr style, xmlNodePtr inst)
Definition: preproc.c:1637
void xsltFreeStylePreComps(xsltStylesheetPtr style)
Definition: preproc.c:1951
static void xsltCallTemplateComp(xsltStylesheetPtr style, xmlNodePtr inst)
Definition: preproc.c:1546
static void xsltCopyOfComp(xsltStylesheetPtr style, xmlNodePtr inst)
Definition: preproc.c:1159
static void xsltValueOfComp(xsltStylesheetPtr style, xmlNodePtr inst)
Definition: preproc.c:1205
void xsltStylePreCompute(xsltStylesheetPtr style, xmlNodePtr inst)
Definition: preproc.c:2191
static void xsltCommentComp(xsltStylesheetPtr style, xmlNodePtr inst)
Definition: preproc.c:1095
const xmlChar * xsltExtMarker
Definition: preproc.c:48
xsltElemPreCompPtr xsltDocumentComp(xsltStylesheetPtr style, xmlNodePtr inst, xsltTransformFunction function ATTRIBUTE_UNUSED)
Definition: preproc.c:528
static void xsltWithParamComp(xsltStylesheetPtr style, xmlNodePtr inst)
Definition: preproc.c:1332
static void xsltSortComp(xsltStylesheetPtr style, xmlNodePtr inst)
Definition: preproc.c:673
static int xsltCheckTopLevelElement(xsltStylesheetPtr style, xmlNodePtr inst, int err)
Definition: preproc.c:72
static void xsltElementComp(xsltStylesheetPtr style, xmlNodePtr inst)
Definition: preproc.c:863
static void xsltApplyImportsComp(xsltStylesheetPtr style, xmlNodePtr inst)
Definition: preproc.c:1516
static void xsltParamComp(xsltStylesheetPtr style, xmlNodePtr inst)
Definition: preproc.c:1887
static void xsltTextComp(xsltStylesheetPtr style, xmlNodePtr inst)
Definition: preproc.c:817
static void xsltIfComp(xsltStylesheetPtr style, xmlNodePtr inst)
Definition: preproc.c:1668
static void xsltCheckParentElement(xsltStylesheetPtr style, xmlNodePtr inst, const xmlChar *allow1, const xmlChar *allow2)
Definition: preproc.c:165
static void xsltCheckInstructionElement(xsltStylesheetPtr style, xmlNodePtr inst)
Definition: preproc.c:110
static void xsltCopyComp(xsltStylesheetPtr style, xmlNodePtr inst)
Definition: preproc.c:774
static void xsltNumberComp(xsltStylesheetPtr style, xmlNodePtr cur)
Definition: preproc.c:1390
static void xsltApplyTemplatesComp(xsltStylesheetPtr style, xmlNodePtr inst)
Definition: preproc.c:1585
static void xsltVariableComp(xsltStylesheetPtr style, xmlNodePtr inst)
Definition: preproc.c:1808
static void xsltForEachComp(xsltStylesheetPtr style, xmlNodePtr inst)
Definition: preproc.c:1760
static void xsltWhenComp(xsltStylesheetPtr style, xmlNodePtr inst)
Definition: preproc.c:1714
static xsltStylePreCompPtr xsltNewStylePreComp(xsltStylesheetPtr style, xsltStyleType type)
Definition: preproc.c:225
static void xsltGetQNameProperty(xsltStylesheetPtr style, xmlNodePtr inst, const xmlChar *propName, int mandatory, int *hasProp, const xmlChar **nsName, const xmlChar **localName)
Definition: preproc.c:1258
Arabic default style
Definition: afstyles.h:94
#define NULL
Definition: types.h:112
void xsltAttribute(xsltTransformContextPtr ctxt, xmlNodePtr contextNode, xmlNodePtr inst, xsltElemPreCompPtr castedComp)
Definition: attributes.c:748
xsltCompMatchPtr xsltCompilePattern(const xmlChar *pattern, xmlDocPtr doc, xmlNodePtr node, xsltStylesheetPtr style, xsltTransformContextPtr runtime)
Definition: pattern.c:2006
void xsltFreeCompMatchList(xsltCompMatchPtr comp)
Definition: pattern.c:211
void xsltForEach(xsltTransformContextPtr ctxt, xmlNodePtr contextNode, xmlNodePtr inst, xsltElemPreCompPtr castedComp)
Definition: transform.c:5401
void xsltCallTemplate(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltElemPreCompPtr castedComp)
Definition: transform.c:4719
void xsltValueOf(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltElemPreCompPtr castedComp)
Definition: transform.c:4519
void xsltSort(xsltTransformContextPtr ctxt, xmlNodePtr node ATTRIBUTE_UNUSED, xmlNodePtr inst, xsltElemPreCompPtr comp)
Definition: transform.c:3879
void xsltApplyImports(xsltTransformContextPtr ctxt, xmlNodePtr contextNode, xmlNodePtr inst, xsltElemPreCompPtr comp ATTRIBUTE_UNUSED)
Definition: transform.c:4650
void xsltProcessingInstruction(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltElemPreCompPtr castedComp)
Definition: transform.c:4309
void xsltCopyOf(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltElemPreCompPtr castedComp)
Definition: transform.c:4375
void xsltElement(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltElemPreCompPtr castedComp)
Definition: transform.c:4057
void xsltIf(xsltTransformContextPtr ctxt, xmlNodePtr contextNode, xmlNodePtr inst, xsltElemPreCompPtr castedComp)
Definition: transform.c:5295
void xsltDocumentElem(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltElemPreCompPtr castedComp)
Definition: transform.c:3363
void xsltComment(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltElemPreCompPtr comp ATTRIBUTE_UNUSED)
Definition: transform.c:4265
void xsltChoose(xsltTransformContextPtr ctxt, xmlNodePtr contextNode, xmlNodePtr inst, xsltElemPreCompPtr comp ATTRIBUTE_UNUSED)
Definition: transform.c:5136
void xsltText(xsltTransformContextPtr ctxt, xmlNodePtr node ATTRIBUTE_UNUSED, xmlNodePtr inst, xsltElemPreCompPtr comp ATTRIBUTE_UNUSED)
Definition: transform.c:4020
void xsltCopy(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltElemPreCompPtr castedComp)
Definition: transform.c:3901
void xsltNumber(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltElemPreCompPtr castedComp)
Definition: transform.c:4593
void xsltApplyTemplates(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltElemPreCompPtr castedComp)
Definition: transform.c:4822
_ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl _ACRTIMP int __cdecl sscanf(const char *, const char *,...) __WINE_CRT_SCANF_ATTR(2
r parent
Definition: btrfs.c:3010
#define XSLT_XT_NAMESPACE
Definition: extra.h:41
FxCollectionEntry * cur
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLsizeiptr size
Definition: glext.h:5919
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define ATTRIBUTE_UNUSED
Definition: i386-dis.c:36
const char * filename
Definition: ioapi.h:137
if(dx< 0)
Definition: linetemp.h:194
#define error(str)
Definition: mkdosfs.c:1605
static unsigned __int64 next
Definition: rand_nt.c:6
#define err(...)
const xmlChar * xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len)
Definition: dict.c:824
xmlFreeFunc xmlFree
Definition: globals.c:184
xmlMallocFunc xmlMalloc
Definition: globals.c:193
void * xmlHashLookup(xmlHashTablePtr hash, const xmlChar *key)
Definition: hash.c:739
#define memset(x, y, z)
Definition: compat.h:39
struct _xsltCompMatch * countPat
struct _xsltCompMatch * fromPat
xsltStyleType type
xmlXPathCompExprPtr comp
xsltNumberData numdata
Definition: fs.h:78
Definition: name.c:39
Definition: mxnamespace.c:38
const xmlChar * xsltEvalStaticAttrValueTemplate(xsltStylesheetPtr style, xmlNodePtr inst, const xmlChar *name, const xmlChar *ns, int *found)
Definition: templates.c:456
Character const *const prefix
Definition: tempnam.cpp:195
Definition: dlist.c:348
XMLPUBFUN int xmlStrlen(const xmlChar *str)
Definition: xmlstring.c:428
#define BAD_CAST
Definition: xmlstring.h:35
XMLPUBFUN int xmlStrEqual(const xmlChar *str1, const xmlChar *str2)
Definition: xmlstring.c:162
XMLPUBFUN int xmlStrncasecmp(const xmlChar *str1, const xmlChar *str2, int len)
Definition: xmlstring.c:302
unsigned char xmlChar
Definition: xmlstring.h:28
xsltStyleType
@ XSLT_FUNC_WHEN
@ XSLT_FUNC_CALLTEMPLATE
@ XSLT_FUNC_ELEMENT
@ XSLT_FUNC_APPLYIMPORTS
@ XSLT_FUNC_DOCUMENT
@ XSLT_FUNC_CHOOSE
@ XSLT_FUNC_VARIABLE
@ XSLT_FUNC_WITHPARAM
@ XSLT_FUNC_APPLYTEMPLATES
@ XSLT_FUNC_TEXT
@ XSLT_FUNC_ATTRIBUTE
@ XSLT_FUNC_COPYOF
@ XSLT_FUNC_FOREACH
@ XSLT_FUNC_PI
@ XSLT_FUNC_VALUEOF
@ XSLT_FUNC_NUMBER
@ XSLT_FUNC_SORT
@ XSLT_FUNC_COMMENT
@ XSLT_FUNC_EXTENSION
@ XSLT_FUNC_IF
@ XSLT_FUNC_COPY
@ XSLT_FUNC_PARAM
xsltElemPreComp * xsltElemPreCompPtr
xsltStylePreComp * xsltStylePreCompPtr
void(* xsltTransformFunction)(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltElemPreCompPtr comp)
int xsltIsBlank(xmlChar *str)
Definition: xslt.c:249
#define XSLT_NAMESPACE
Definition: xslt.h:46
void xsltTransformError(xsltTransformContextPtr ctxt, xsltStylesheetPtr style, xmlNodePtr node, const char *msg,...)
Definition: xsltutils.c:762
const xmlChar * xsltGetCNsProp(xsltStylesheetPtr style, xmlNodePtr node, const xmlChar *name, const xmlChar *nameSpace)
Definition: xsltutils.c:76
xmlXPathCompExprPtr xsltXPathCompile(xsltStylesheetPtr style, const xmlChar *str)
Definition: xsltutils.c:2593
xmlGenericErrorFunc xsltGenericDebug
Definition: xsltutils.c:632
int xsltGetUTF8Char(const unsigned char *utf, int *len)
Definition: xsltutils.c:251
const xmlChar * xsltGetQNameURI2(xsltStylesheetPtr style, xmlNodePtr node, const xmlChar **name)
Definition: xsltutils.c:911
void * xsltGenericDebugContext
Definition: xsltutils.c:633
const xmlChar * xsltSplitQName(xmlDictPtr dict, const xmlChar *name, const xmlChar **prefix)
Definition: xsltutils.c:804
#define IS_XSLT_NAME(n, val)
Definition: xsltutils.h:60
#define XSLT_TODO
Definition: xsltutils.h:31
#define IS_XSLT_ELEM(n)
Definition: xsltutils.h:51