1 | /* |
2 | * Summary: internal data structures, constants and functions |
3 | * Description: Internal data structures, constants and functions used |
4 | * by the XSLT engine. |
5 | * They are not part of the API or ABI, i.e. they can change |
6 | * without prior notice, use carefully. |
7 | * |
8 | * Copy: See Copyright for the status of this software. |
9 | * |
10 | * Author: Daniel Veillard |
11 | */ |
12 | |
13 | #ifndef __XML_XSLT_INTERNALS_H__ |
14 | #define __XML_XSLT_INTERNALS_H__ |
15 | |
16 | #include <libxml/tree.h> |
17 | #include <libxml/hash.h> |
18 | #include <libxml/xpath.h> |
19 | #include <libxml/xmlerror.h> |
20 | #include <libxml/dict.h> |
21 | #include <libxml/xmlstring.h> |
22 | #include <libxslt/xslt.h> |
23 | #include "xsltexports.h" |
24 | #include "xsltlocale.h" |
25 | #include "numbersInternals.h" |
26 | |
27 | #ifdef __cplusplus |
28 | extern "C" { |
29 | #endif |
30 | |
31 | /* #define XSLT_DEBUG_PROFILE_CACHE */ |
32 | |
33 | /** |
34 | * XSLT_IS_TEXT_NODE: |
35 | * |
36 | * check if the argument is a text node |
37 | */ |
38 | #define XSLT_IS_TEXT_NODE(n) ((n != NULL) && \ |
39 | (((n)->type == XML_TEXT_NODE) || \ |
40 | ((n)->type == XML_CDATA_SECTION_NODE))) |
41 | |
42 | |
43 | /** |
44 | * XSLT_MARK_RES_TREE_FRAG: |
45 | * |
46 | * internal macro to set up tree fragments |
47 | */ |
48 | #define XSLT_MARK_RES_TREE_FRAG(n) \ |
49 | (n)->name = (char *) xmlStrdup(BAD_CAST " fake node libxslt"); |
50 | |
51 | /** |
52 | * XSLT_IS_RES_TREE_FRAG: |
53 | * |
54 | * internal macro to test tree fragments |
55 | */ |
56 | #define XSLT_IS_RES_TREE_FRAG(n) \ |
57 | ((n != NULL) && ((n)->type == XML_DOCUMENT_NODE) && \ |
58 | ((n)->name != NULL) && ((n)->name[0] == ' ')) |
59 | |
60 | /** |
61 | * XSLT_REFACTORED_KEYCOMP: |
62 | * |
63 | * Internal define to enable on-demand xsl:key computation. |
64 | * That's the only mode now but the define is kept for compatibility |
65 | */ |
66 | #define XSLT_REFACTORED_KEYCOMP |
67 | |
68 | /** |
69 | * XSLT_FAST_IF: |
70 | * |
71 | * Internal define to enable usage of xmlXPathCompiledEvalToBoolean() |
72 | * for XSLT "tests"; e.g. in <xsl:if test="/foo/bar"> |
73 | */ |
74 | #define XSLT_FAST_IF |
75 | |
76 | /** |
77 | * XSLT_REFACTORED: |
78 | * |
79 | * Internal define to enable the refactored parts of Libxslt. |
80 | */ |
81 | /* #define XSLT_REFACTORED */ |
82 | /* ==================================================================== */ |
83 | |
84 | /** |
85 | * XSLT_REFACTORED_VARS: |
86 | * |
87 | * Internal define to enable the refactored variable part of libxslt |
88 | */ |
89 | #define XSLT_REFACTORED_VARS |
90 | |
91 | #ifdef XSLT_REFACTORED |
92 | |
93 | extern const xmlChar *xsltXSLTAttrMarker; |
94 | |
95 | |
96 | /* TODO: REMOVE: #define XSLT_REFACTORED_EXCLRESNS */ |
97 | |
98 | /* TODO: REMOVE: #define XSLT_REFACTORED_NSALIAS */ |
99 | |
100 | /** |
101 | * XSLT_REFACTORED_XSLT_NSCOMP |
102 | * |
103 | * Internal define to enable the pointer-comparison of |
104 | * namespaces of XSLT elements. |
105 | */ |
106 | /* #define XSLT_REFACTORED_XSLT_NSCOMP */ |
107 | |
108 | /** |
109 | * XSLT_REFACTORED_XPATHCOMP: |
110 | * |
111 | * Internal define to enable the optimization of the |
112 | * compilation of XPath expressions. |
113 | */ |
114 | #define XSLT_REFACTORED_XPATHCOMP |
115 | |
116 | #ifdef XSLT_REFACTORED_XSLT_NSCOMP |
117 | |
118 | extern const xmlChar *xsltConstNamespaceNameXSLT; |
119 | |
120 | /** |
121 | * IS_XSLT_ELEM_FAST: |
122 | * |
123 | * quick test to detect XSLT elements |
124 | */ |
125 | #define IS_XSLT_ELEM_FAST(n) \ |
126 | (((n) != NULL) && ((n)->ns != NULL) && \ |
127 | ((n)->ns->href == xsltConstNamespaceNameXSLT)) |
128 | |
129 | /** |
130 | * IS_XSLT_ATTR_FAST: |
131 | * |
132 | * quick test to detect XSLT attributes |
133 | */ |
134 | #define IS_XSLT_ATTR_FAST(a) \ |
135 | (((a) != NULL) && ((a)->ns != NULL) && \ |
136 | ((a)->ns->href == xsltConstNamespaceNameXSLT)) |
137 | |
138 | /** |
139 | * XSLT_HAS_INTERNAL_NSMAP: |
140 | * |
141 | * check for namespace mapping |
142 | */ |
143 | #define XSLT_HAS_INTERNAL_NSMAP(s) \ |
144 | (((s) != NULL) && ((s)->principal) && \ |
145 | ((s)->principal->principalData) && \ |
146 | ((s)->principal->principalData->nsMap)) |
147 | |
148 | /** |
149 | * XSLT_GET_INTERNAL_NSMAP: |
150 | * |
151 | * get pointer to namespace map |
152 | */ |
153 | #define XSLT_GET_INTERNAL_NSMAP(s) ((s)->principal->principalData->nsMap) |
154 | |
155 | #else /* XSLT_REFACTORED_XSLT_NSCOMP */ |
156 | |
157 | /** |
158 | * IS_XSLT_ELEM_FAST: |
159 | * |
160 | * quick check whether this is an xslt element |
161 | */ |
162 | #define IS_XSLT_ELEM_FAST(n) \ |
163 | (((n) != NULL) && ((n)->ns != NULL) && \ |
164 | (xmlStrEqual((n)->ns->href, XSLT_NAMESPACE))) |
165 | |
166 | /** |
167 | * IS_XSLT_ATTR_FAST: |
168 | * |
169 | * quick check for xslt namespace attribute |
170 | */ |
171 | #define IS_XSLT_ATTR_FAST(a) \ |
172 | (((a) != NULL) && ((a)->ns != NULL) && \ |
173 | (xmlStrEqual((a)->ns->href, XSLT_NAMESPACE))) |
174 | |
175 | |
176 | #endif /* XSLT_REFACTORED_XSLT_NSCOMP */ |
177 | |
178 | |
179 | /** |
180 | * XSLT_REFACTORED_MANDATORY_VERSION: |
181 | * |
182 | * TODO: Currently disabled to surpress regression test failures, since |
183 | * the old behaviour was that a missing version attribute |
184 | * produced a only a warning and not an error, which was incerrect. |
185 | * So the regression tests need to be fixed if this is enabled. |
186 | */ |
187 | /* #define XSLT_REFACTORED_MANDATORY_VERSION */ |
188 | |
189 | /** |
190 | * xsltPointerList: |
191 | * |
192 | * Pointer-list for various purposes. |
193 | */ |
194 | typedef struct _xsltPointerList xsltPointerList; |
195 | typedef xsltPointerList *xsltPointerListPtr; |
196 | struct _xsltPointerList { |
197 | void **items; |
198 | int number; |
199 | int size; |
200 | }; |
201 | |
202 | #endif |
203 | |
204 | /** |
205 | * XSLT_REFACTORED_PARSING: |
206 | * |
207 | * Internal define to enable the refactored parts of Libxslt |
208 | * related to parsing. |
209 | */ |
210 | /* #define XSLT_REFACTORED_PARSING */ |
211 | |
212 | /** |
213 | * XSLT_MAX_SORT: |
214 | * |
215 | * Max number of specified xsl:sort on an element. |
216 | */ |
217 | #define XSLT_MAX_SORT 15 |
218 | |
219 | /** |
220 | * XSLT_PAT_NO_PRIORITY: |
221 | * |
222 | * Specific value for pattern without priority expressed. |
223 | */ |
224 | #define XSLT_PAT_NO_PRIORITY -12345789 |
225 | |
226 | /** |
227 | * xsltRuntimeExtra: |
228 | * |
229 | * Extra information added to the transformation context. |
230 | */ |
231 | typedef struct _xsltRuntimeExtra ; |
232 | typedef xsltRuntimeExtra *; |
233 | struct { |
234 | void *; /* pointer to the extra data */ |
235 | xmlFreeFunc ; /* pointer to the deallocation routine */ |
236 | union { /* dual-purpose field */ |
237 | void *; /* data not needing deallocation */ |
238 | int ; /* integer value storage */ |
239 | } ; |
240 | }; |
241 | |
242 | /** |
243 | * XSLT_RUNTIME_EXTRA_LST: |
244 | * @ctxt: the transformation context |
245 | * @nr: the index |
246 | * |
247 | * Macro used to access extra information stored in the context |
248 | */ |
249 | #define (ctxt, nr) (ctxt)->extras[(nr)].info |
250 | /** |
251 | * XSLT_RUNTIME_EXTRA_FREE: |
252 | * @ctxt: the transformation context |
253 | * @nr: the index |
254 | * |
255 | * Macro used to free extra information stored in the context |
256 | */ |
257 | #define (ctxt, nr) (ctxt)->extras[(nr)].deallocate |
258 | /** |
259 | * XSLT_RUNTIME_EXTRA: |
260 | * @ctxt: the transformation context |
261 | * @nr: the index |
262 | * |
263 | * Macro used to define extra information stored in the context |
264 | */ |
265 | #define (ctxt, nr, typ) (ctxt)->extras[(nr)].val.typ |
266 | |
267 | /** |
268 | * xsltTemplate: |
269 | * |
270 | * The in-memory structure corresponding to an XSLT Template. |
271 | */ |
272 | typedef struct _xsltTemplate xsltTemplate; |
273 | typedef xsltTemplate *xsltTemplatePtr; |
274 | struct _xsltTemplate { |
275 | struct _xsltTemplate *next;/* chained list sorted by priority */ |
276 | struct _xsltStylesheet *style;/* the containing stylesheet */ |
277 | xmlChar *match; /* the matching string */ |
278 | float priority; /* as given from the stylesheet, not computed */ |
279 | const xmlChar *name; /* the local part of the name QName */ |
280 | const xmlChar *nameURI; /* the URI part of the name QName */ |
281 | const xmlChar *mode;/* the local part of the mode QName */ |
282 | const xmlChar *modeURI;/* the URI part of the mode QName */ |
283 | xmlNodePtr content; /* the template replacement value */ |
284 | xmlNodePtr elem; /* the source element */ |
285 | |
286 | /* |
287 | * TODO: @inheritedNsNr and @inheritedNs won't be used in the |
288 | * refactored code. |
289 | */ |
290 | int inheritedNsNr; /* number of inherited namespaces */ |
291 | xmlNsPtr *inheritedNs;/* inherited non-excluded namespaces */ |
292 | |
293 | /* Profiling information */ |
294 | int nbCalls; /* the number of time the template was called */ |
295 | unsigned long time; /* the time spent in this template */ |
296 | void *params; /* xsl:param instructions */ |
297 | |
298 | int templNr; /* Nb of templates in the stack */ |
299 | int templMax; /* Size of the templtes stack */ |
300 | xsltTemplatePtr *templCalledTab; /* templates called */ |
301 | int *templCountTab; /* .. and how often */ |
302 | }; |
303 | |
304 | /** |
305 | * xsltDecimalFormat: |
306 | * |
307 | * Data structure of decimal-format. |
308 | */ |
309 | typedef struct _xsltDecimalFormat xsltDecimalFormat; |
310 | typedef xsltDecimalFormat *xsltDecimalFormatPtr; |
311 | struct _xsltDecimalFormat { |
312 | struct _xsltDecimalFormat *next; /* chained list */ |
313 | xmlChar *name; |
314 | /* Used for interpretation of pattern */ |
315 | xmlChar *digit; |
316 | xmlChar *patternSeparator; |
317 | /* May appear in result */ |
318 | xmlChar *minusSign; |
319 | xmlChar *infinity; |
320 | xmlChar *noNumber; /* Not-a-number */ |
321 | /* Used for interpretation of pattern and may appear in result */ |
322 | xmlChar *decimalPoint; |
323 | xmlChar *grouping; |
324 | xmlChar *percent; |
325 | xmlChar *permille; |
326 | xmlChar *zeroDigit; |
327 | }; |
328 | |
329 | /** |
330 | * xsltDocument: |
331 | * |
332 | * Data structure associated to a parsed document. |
333 | */ |
334 | typedef struct _xsltDocument xsltDocument; |
335 | typedef xsltDocument *xsltDocumentPtr; |
336 | struct _xsltDocument { |
337 | struct _xsltDocument *next; /* documents are kept in a chained list */ |
338 | int main; /* is this the main document */ |
339 | xmlDocPtr doc; /* the parsed document */ |
340 | void *keys; /* key tables storage */ |
341 | struct _xsltDocument *includes; /* subsidiary includes */ |
342 | int preproc; /* pre-processing already done */ |
343 | int nbKeysComputed; |
344 | }; |
345 | |
346 | /** |
347 | * xsltKeyDef: |
348 | * |
349 | * Representation of an xsl:key. |
350 | */ |
351 | typedef struct _xsltKeyDef xsltKeyDef; |
352 | typedef xsltKeyDef *xsltKeyDefPtr; |
353 | struct _xsltKeyDef { |
354 | struct _xsltKeyDef *next; |
355 | xmlNodePtr inst; |
356 | xmlChar *name; |
357 | xmlChar *nameURI; |
358 | xmlChar *match; |
359 | xmlChar *use; |
360 | xmlXPathCompExprPtr comp; |
361 | xmlXPathCompExprPtr usecomp; |
362 | xmlNsPtr *nsList; /* the namespaces in scope */ |
363 | int nsNr; /* the number of namespaces in scope */ |
364 | }; |
365 | |
366 | /** |
367 | * xsltKeyTable: |
368 | * |
369 | * Holds the computed keys for key definitions of the same QName. |
370 | * Is owned by an xsltDocument. |
371 | */ |
372 | typedef struct _xsltKeyTable xsltKeyTable; |
373 | typedef xsltKeyTable *xsltKeyTablePtr; |
374 | struct _xsltKeyTable { |
375 | struct _xsltKeyTable *next; |
376 | xmlChar *name; |
377 | xmlChar *nameURI; |
378 | xmlHashTablePtr keys; |
379 | }; |
380 | |
381 | /* |
382 | * The in-memory structure corresponding to an XSLT Stylesheet. |
383 | * NOTE: most of the content is simply linked from the doc tree |
384 | * structure, no specific allocation is made. |
385 | */ |
386 | typedef struct _xsltStylesheet xsltStylesheet; |
387 | typedef xsltStylesheet *xsltStylesheetPtr; |
388 | |
389 | typedef struct _xsltTransformContext xsltTransformContext; |
390 | typedef xsltTransformContext *xsltTransformContextPtr; |
391 | |
392 | /** |
393 | * xsltElemPreComp: |
394 | * |
395 | * The in-memory structure corresponding to element precomputed data, |
396 | * designed to be extended by extension implementors. |
397 | */ |
398 | typedef struct _xsltElemPreComp xsltElemPreComp; |
399 | typedef xsltElemPreComp *xsltElemPreCompPtr; |
400 | |
401 | /** |
402 | * xsltTransformFunction: |
403 | * @ctxt: the XSLT transformation context |
404 | * @node: the input node |
405 | * @inst: the stylesheet node |
406 | * @comp: the compiled information from the stylesheet |
407 | * |
408 | * Signature of the function associated to elements part of the |
409 | * stylesheet language like xsl:if or xsl:apply-templates. |
410 | */ |
411 | typedef void (*xsltTransformFunction) (xsltTransformContextPtr ctxt, |
412 | xmlNodePtr node, |
413 | xmlNodePtr inst, |
414 | xsltElemPreCompPtr comp); |
415 | |
416 | /** |
417 | * xsltSortFunc: |
418 | * @ctxt: a transformation context |
419 | * @sorts: the node-set to sort |
420 | * @nbsorts: the number of sorts |
421 | * |
422 | * Signature of the function to use during sorting |
423 | */ |
424 | typedef void (*xsltSortFunc) (xsltTransformContextPtr ctxt, xmlNodePtr *sorts, |
425 | int nbsorts); |
426 | |
427 | typedef enum { |
428 | XSLT_FUNC_COPY=1, |
429 | XSLT_FUNC_SORT, |
430 | XSLT_FUNC_TEXT, |
431 | XSLT_FUNC_ELEMENT, |
432 | XSLT_FUNC_ATTRIBUTE, |
433 | , |
434 | XSLT_FUNC_PI, |
435 | XSLT_FUNC_COPYOF, |
436 | XSLT_FUNC_VALUEOF, |
437 | XSLT_FUNC_NUMBER, |
438 | XSLT_FUNC_APPLYIMPORTS, |
439 | XSLT_FUNC_CALLTEMPLATE, |
440 | XSLT_FUNC_APPLYTEMPLATES, |
441 | XSLT_FUNC_CHOOSE, |
442 | XSLT_FUNC_IF, |
443 | XSLT_FUNC_FOREACH, |
444 | XSLT_FUNC_DOCUMENT, |
445 | XSLT_FUNC_WITHPARAM, |
446 | XSLT_FUNC_PARAM, |
447 | XSLT_FUNC_VARIABLE, |
448 | XSLT_FUNC_WHEN, |
449 | XSLT_FUNC_EXTENSION |
450 | #ifdef XSLT_REFACTORED |
451 | , |
452 | XSLT_FUNC_OTHERWISE, |
453 | XSLT_FUNC_FALLBACK, |
454 | XSLT_FUNC_MESSAGE, |
455 | XSLT_FUNC_INCLUDE, |
456 | XSLT_FUNC_ATTRSET, |
457 | XSLT_FUNC_LITERAL_RESULT_ELEMENT, |
458 | XSLT_FUNC_UNKOWN_FORWARDS_COMPAT |
459 | #endif |
460 | } xsltStyleType; |
461 | |
462 | /** |
463 | * xsltElemPreCompDeallocator: |
464 | * @comp: the #xsltElemPreComp to free up |
465 | * |
466 | * Deallocates an #xsltElemPreComp structure. |
467 | */ |
468 | typedef void (*xsltElemPreCompDeallocator) (xsltElemPreCompPtr comp); |
469 | |
470 | /** |
471 | * xsltElemPreComp: |
472 | * |
473 | * The basic structure for compiled items of the AST of the XSLT processor. |
474 | * This structure is also intended to be extended by extension implementors. |
475 | * TODO: This is somehow not nice, since it has a "free" field, which |
476 | * derived stylesheet-structs do not have. |
477 | */ |
478 | struct _xsltElemPreComp { |
479 | xsltElemPreCompPtr next; /* next item in the global chained |
480 | list hold by xsltStylesheet. */ |
481 | xsltStyleType type; /* type of the element */ |
482 | xsltTransformFunction func; /* handling function */ |
483 | xmlNodePtr inst; /* the node in the stylesheet's tree |
484 | corresponding to this item */ |
485 | |
486 | /* end of common part */ |
487 | xsltElemPreCompDeallocator free; /* the deallocator */ |
488 | }; |
489 | |
490 | /** |
491 | * xsltStylePreComp: |
492 | * |
493 | * The abstract basic structure for items of the XSLT processor. |
494 | * This includes: |
495 | * 1) compiled forms of XSLT instructions (xsl:if, xsl:attribute, etc.) |
496 | * 2) compiled forms of literal result elements |
497 | * 3) compiled forms of extension elements |
498 | */ |
499 | typedef struct _xsltStylePreComp xsltStylePreComp; |
500 | typedef xsltStylePreComp *xsltStylePreCompPtr; |
501 | |
502 | #ifdef XSLT_REFACTORED |
503 | |
504 | /* |
505 | * Some pointer-list utility functions. |
506 | */ |
507 | XSLTPUBFUN xsltPointerListPtr XSLTCALL |
508 | xsltPointerListCreate (int initialSize); |
509 | XSLTPUBFUN void XSLTCALL |
510 | xsltPointerListFree (xsltPointerListPtr list); |
511 | XSLTPUBFUN void XSLTCALL |
512 | xsltPointerListClear (xsltPointerListPtr list); |
513 | XSLTPUBFUN int XSLTCALL |
514 | xsltPointerListAddSize (xsltPointerListPtr list, |
515 | void *item, |
516 | int initialSize); |
517 | |
518 | /************************************************************************ |
519 | * * |
520 | * Refactored structures * |
521 | * * |
522 | ************************************************************************/ |
523 | |
524 | typedef struct _xsltNsListContainer xsltNsListContainer; |
525 | typedef xsltNsListContainer *xsltNsListContainerPtr; |
526 | struct _xsltNsListContainer { |
527 | xmlNsPtr *list; |
528 | int totalNumber; |
529 | int xpathNumber; |
530 | }; |
531 | |
532 | /** |
533 | * XSLT_ITEM_COMPATIBILITY_FIELDS: |
534 | * |
535 | * Fields for API compatibility to the structure |
536 | * _xsltElemPreComp which is used for extension functions. |
537 | * Note that @next is used for storage; it does not reflect a next |
538 | * sibling in the tree. |
539 | * TODO: Evaluate if we really need such a compatibility. |
540 | */ |
541 | #define XSLT_ITEM_COMPATIBILITY_FIELDS \ |
542 | xsltElemPreCompPtr next;\ |
543 | xsltStyleType type;\ |
544 | xsltTransformFunction func;\ |
545 | xmlNodePtr inst; |
546 | |
547 | /** |
548 | * XSLT_ITEM_NAVIGATION_FIELDS: |
549 | * |
550 | * Currently empty. |
551 | * TODO: It is intended to hold navigational fields in the future. |
552 | */ |
553 | #define XSLT_ITEM_NAVIGATION_FIELDS |
554 | /* |
555 | xsltStylePreCompPtr parent;\ |
556 | xsltStylePreCompPtr children;\ |
557 | xsltStylePreCompPtr nextItem; |
558 | */ |
559 | |
560 | /** |
561 | * XSLT_ITEM_NSINSCOPE_FIELDS: |
562 | * |
563 | * The in-scope namespaces. |
564 | */ |
565 | #define XSLT_ITEM_NSINSCOPE_FIELDS xsltNsListContainerPtr inScopeNs; |
566 | |
567 | /** |
568 | * XSLT_ITEM_COMMON_FIELDS: |
569 | * |
570 | * Common fields used for all items. |
571 | */ |
572 | #define XSLT_ITEM_COMMON_FIELDS \ |
573 | XSLT_ITEM_COMPATIBILITY_FIELDS \ |
574 | XSLT_ITEM_NAVIGATION_FIELDS \ |
575 | XSLT_ITEM_NSINSCOPE_FIELDS |
576 | |
577 | /** |
578 | * _xsltStylePreComp: |
579 | * |
580 | * The abstract basic structure for items of the XSLT processor. |
581 | * This includes: |
582 | * 1) compiled forms of XSLT instructions (e.g. xsl:if, xsl:attribute, etc.) |
583 | * 2) compiled forms of literal result elements |
584 | * 3) various properties for XSLT instructions (e.g. xsl:when, |
585 | * xsl:with-param) |
586 | * |
587 | * REVISIT TODO: Keep this structure equal to the fields |
588 | * defined by XSLT_ITEM_COMMON_FIELDS |
589 | */ |
590 | struct _xsltStylePreComp { |
591 | xsltElemPreCompPtr next; /* next item in the global chained |
592 | list hold by xsltStylesheet */ |
593 | xsltStyleType type; /* type of the item */ |
594 | xsltTransformFunction func; /* handling function */ |
595 | xmlNodePtr inst; /* the node in the stylesheet's tree |
596 | corresponding to this item. */ |
597 | /* Currently no navigational fields. */ |
598 | xsltNsListContainerPtr inScopeNs; |
599 | }; |
600 | |
601 | /** |
602 | * xsltStyleBasicEmptyItem: |
603 | * |
604 | * Abstract structure only used as a short-cut for |
605 | * XSLT items with no extra fields. |
606 | * NOTE that it is intended that this structure looks the same as |
607 | * _xsltStylePreComp. |
608 | */ |
609 | typedef struct _xsltStyleBasicEmptyItem xsltStyleBasicEmptyItem; |
610 | typedef xsltStyleBasicEmptyItem *xsltStyleBasicEmptyItemPtr; |
611 | |
612 | struct _xsltStyleBasicEmptyItem { |
613 | XSLT_ITEM_COMMON_FIELDS |
614 | }; |
615 | |
616 | /** |
617 | * xsltStyleBasicExpressionItem: |
618 | * |
619 | * Abstract structure only used as a short-cut for |
620 | * XSLT items with just an expression. |
621 | */ |
622 | typedef struct _xsltStyleBasicExpressionItem xsltStyleBasicExpressionItem; |
623 | typedef xsltStyleBasicExpressionItem *xsltStyleBasicExpressionItemPtr; |
624 | |
625 | struct _xsltStyleBasicExpressionItem { |
626 | XSLT_ITEM_COMMON_FIELDS |
627 | |
628 | const xmlChar *select; /* TODO: Change this to "expression". */ |
629 | xmlXPathCompExprPtr comp; /* TODO: Change this to compExpr. */ |
630 | }; |
631 | |
632 | /************************************************************************ |
633 | * * |
634 | * XSLT-instructions/declarations * |
635 | * * |
636 | ************************************************************************/ |
637 | |
638 | /** |
639 | * xsltStyleItemElement: |
640 | * |
641 | * <!-- Category: instruction --> |
642 | * <xsl:element |
643 | * name = { qname } |
644 | * namespace = { uri-reference } |
645 | * use-attribute-sets = qnames> |
646 | * <!-- Content: template --> |
647 | * </xsl:element> |
648 | */ |
649 | typedef struct _xsltStyleItemElement xsltStyleItemElement; |
650 | typedef xsltStyleItemElement *xsltStyleItemElementPtr; |
651 | |
652 | struct _xsltStyleItemElement { |
653 | XSLT_ITEM_COMMON_FIELDS |
654 | |
655 | const xmlChar *use; |
656 | int has_use; |
657 | const xmlChar *name; |
658 | int has_name; |
659 | const xmlChar *ns; |
660 | const xmlChar *nsPrefix; |
661 | int has_ns; |
662 | }; |
663 | |
664 | /** |
665 | * xsltStyleItemAttribute: |
666 | * |
667 | * <!-- Category: instruction --> |
668 | * <xsl:attribute |
669 | * name = { qname } |
670 | * namespace = { uri-reference }> |
671 | * <!-- Content: template --> |
672 | * </xsl:attribute> |
673 | */ |
674 | typedef struct _xsltStyleItemAttribute xsltStyleItemAttribute; |
675 | typedef xsltStyleItemAttribute *xsltStyleItemAttributePtr; |
676 | |
677 | struct _xsltStyleItemAttribute { |
678 | XSLT_ITEM_COMMON_FIELDS |
679 | const xmlChar *name; |
680 | int has_name; |
681 | const xmlChar *ns; |
682 | const xmlChar *nsPrefix; |
683 | int has_ns; |
684 | }; |
685 | |
686 | /** |
687 | * xsltStyleItemText: |
688 | * |
689 | * <!-- Category: instruction --> |
690 | * <xsl:text |
691 | * disable-output-escaping = "yes" | "no"> |
692 | * <!-- Content: #PCDATA --> |
693 | * </xsl:text> |
694 | */ |
695 | typedef struct _xsltStyleItemText xsltStyleItemText; |
696 | typedef xsltStyleItemText *xsltStyleItemTextPtr; |
697 | |
698 | struct _xsltStyleItemText { |
699 | XSLT_ITEM_COMMON_FIELDS |
700 | int noescape; /* text */ |
701 | }; |
702 | |
703 | /** |
704 | * xsltStyleItemComment: |
705 | * |
706 | * <!-- Category: instruction --> |
707 | * <xsl:comment> |
708 | * <!-- Content: template --> |
709 | * </xsl:comment> |
710 | */ |
711 | typedef xsltStyleBasicEmptyItem xsltStyleItemComment; |
712 | typedef xsltStyleItemComment *xsltStyleItemCommentPtr; |
713 | |
714 | /** |
715 | * xsltStyleItemPI: |
716 | * |
717 | * <!-- Category: instruction --> |
718 | * <xsl:processing-instruction |
719 | * name = { ncname }> |
720 | * <!-- Content: template --> |
721 | * </xsl:processing-instruction> |
722 | */ |
723 | typedef struct _xsltStyleItemPI xsltStyleItemPI; |
724 | typedef xsltStyleItemPI *xsltStyleItemPIPtr; |
725 | |
726 | struct _xsltStyleItemPI { |
727 | XSLT_ITEM_COMMON_FIELDS |
728 | const xmlChar *name; |
729 | int has_name; |
730 | }; |
731 | |
732 | /** |
733 | * xsltStyleItemApplyImports: |
734 | * |
735 | * <!-- Category: instruction --> |
736 | * <xsl:apply-imports /> |
737 | */ |
738 | typedef xsltStyleBasicEmptyItem xsltStyleItemApplyImports; |
739 | typedef xsltStyleItemApplyImports *xsltStyleItemApplyImportsPtr; |
740 | |
741 | /** |
742 | * xsltStyleItemApplyTemplates: |
743 | * |
744 | * <!-- Category: instruction --> |
745 | * <xsl:apply-templates |
746 | * select = node-set-expression |
747 | * mode = qname> |
748 | * <!-- Content: (xsl:sort | xsl:with-param)* --> |
749 | * </xsl:apply-templates> |
750 | */ |
751 | typedef struct _xsltStyleItemApplyTemplates xsltStyleItemApplyTemplates; |
752 | typedef xsltStyleItemApplyTemplates *xsltStyleItemApplyTemplatesPtr; |
753 | |
754 | struct _xsltStyleItemApplyTemplates { |
755 | XSLT_ITEM_COMMON_FIELDS |
756 | |
757 | const xmlChar *mode; /* apply-templates */ |
758 | const xmlChar *modeURI; /* apply-templates */ |
759 | const xmlChar *select; /* sort, copy-of, value-of, apply-templates */ |
760 | xmlXPathCompExprPtr comp; /* a precompiled XPath expression */ |
761 | /* TODO: with-params */ |
762 | }; |
763 | |
764 | /** |
765 | * xsltStyleItemCallTemplate: |
766 | * |
767 | * <!-- Category: instruction --> |
768 | * <xsl:call-template |
769 | * name = qname> |
770 | * <!-- Content: xsl:with-param* --> |
771 | * </xsl:call-template> |
772 | */ |
773 | typedef struct _xsltStyleItemCallTemplate xsltStyleItemCallTemplate; |
774 | typedef xsltStyleItemCallTemplate *xsltStyleItemCallTemplatePtr; |
775 | |
776 | struct _xsltStyleItemCallTemplate { |
777 | XSLT_ITEM_COMMON_FIELDS |
778 | |
779 | xsltTemplatePtr templ; /* call-template */ |
780 | const xmlChar *name; /* element, attribute, pi */ |
781 | int has_name; /* element, attribute, pi */ |
782 | const xmlChar *ns; /* element */ |
783 | int has_ns; /* element */ |
784 | /* TODO: with-params */ |
785 | }; |
786 | |
787 | /** |
788 | * xsltStyleItemCopy: |
789 | * |
790 | * <!-- Category: instruction --> |
791 | * <xsl:copy |
792 | * use-attribute-sets = qnames> |
793 | * <!-- Content: template --> |
794 | * </xsl:copy> |
795 | */ |
796 | typedef struct _xsltStyleItemCopy xsltStyleItemCopy; |
797 | typedef xsltStyleItemCopy *xsltStyleItemCopyPtr; |
798 | |
799 | struct _xsltStyleItemCopy { |
800 | XSLT_ITEM_COMMON_FIELDS |
801 | const xmlChar *use; /* copy, element */ |
802 | int has_use; /* copy, element */ |
803 | }; |
804 | |
805 | /** |
806 | * xsltStyleItemIf: |
807 | * |
808 | * <!-- Category: instruction --> |
809 | * <xsl:if |
810 | * test = boolean-expression> |
811 | * <!-- Content: template --> |
812 | * </xsl:if> |
813 | */ |
814 | typedef struct _xsltStyleItemIf xsltStyleItemIf; |
815 | typedef xsltStyleItemIf *xsltStyleItemIfPtr; |
816 | |
817 | struct _xsltStyleItemIf { |
818 | XSLT_ITEM_COMMON_FIELDS |
819 | |
820 | const xmlChar *test; /* if */ |
821 | xmlXPathCompExprPtr comp; /* a precompiled XPath expression */ |
822 | }; |
823 | |
824 | |
825 | /** |
826 | * xsltStyleItemCopyOf: |
827 | * |
828 | * <!-- Category: instruction --> |
829 | * <xsl:copy-of |
830 | * select = expression /> |
831 | */ |
832 | typedef xsltStyleBasicExpressionItem xsltStyleItemCopyOf; |
833 | typedef xsltStyleItemCopyOf *xsltStyleItemCopyOfPtr; |
834 | |
835 | /** |
836 | * xsltStyleItemValueOf: |
837 | * |
838 | * <!-- Category: instruction --> |
839 | * <xsl:value-of |
840 | * select = string-expression |
841 | * disable-output-escaping = "yes" | "no" /> |
842 | */ |
843 | typedef struct _xsltStyleItemValueOf xsltStyleItemValueOf; |
844 | typedef xsltStyleItemValueOf *xsltStyleItemValueOfPtr; |
845 | |
846 | struct _xsltStyleItemValueOf { |
847 | XSLT_ITEM_COMMON_FIELDS |
848 | |
849 | const xmlChar *select; |
850 | xmlXPathCompExprPtr comp; /* a precompiled XPath expression */ |
851 | int noescape; |
852 | }; |
853 | |
854 | /** |
855 | * xsltStyleItemNumber: |
856 | * |
857 | * <!-- Category: instruction --> |
858 | * <xsl:number |
859 | * level = "single" | "multiple" | "any" |
860 | * count = pattern |
861 | * from = pattern |
862 | * value = number-expression |
863 | * format = { string } |
864 | * lang = { nmtoken } |
865 | * letter-value = { "alphabetic" | "traditional" } |
866 | * grouping-separator = { char } |
867 | * grouping-size = { number } /> |
868 | */ |
869 | typedef struct _xsltStyleItemNumber xsltStyleItemNumber; |
870 | typedef xsltStyleItemNumber *xsltStyleItemNumberPtr; |
871 | |
872 | struct _xsltStyleItemNumber { |
873 | XSLT_ITEM_COMMON_FIELDS |
874 | xsltNumberData numdata; /* number */ |
875 | }; |
876 | |
877 | /** |
878 | * xsltStyleItemChoose: |
879 | * |
880 | * <!-- Category: instruction --> |
881 | * <xsl:choose> |
882 | * <!-- Content: (xsl:when+, xsl:otherwise?) --> |
883 | * </xsl:choose> |
884 | */ |
885 | typedef xsltStyleBasicEmptyItem xsltStyleItemChoose; |
886 | typedef xsltStyleItemChoose *xsltStyleItemChoosePtr; |
887 | |
888 | /** |
889 | * xsltStyleItemFallback: |
890 | * |
891 | * <!-- Category: instruction --> |
892 | * <xsl:fallback> |
893 | * <!-- Content: template --> |
894 | * </xsl:fallback> |
895 | */ |
896 | typedef xsltStyleBasicEmptyItem xsltStyleItemFallback; |
897 | typedef xsltStyleItemFallback *xsltStyleItemFallbackPtr; |
898 | |
899 | /** |
900 | * xsltStyleItemForEach: |
901 | * |
902 | * <!-- Category: instruction --> |
903 | * <xsl:for-each |
904 | * select = node-set-expression> |
905 | * <!-- Content: (xsl:sort*, template) --> |
906 | * </xsl:for-each> |
907 | */ |
908 | typedef xsltStyleBasicExpressionItem xsltStyleItemForEach; |
909 | typedef xsltStyleItemForEach *xsltStyleItemForEachPtr; |
910 | |
911 | /** |
912 | * xsltStyleItemMessage: |
913 | * |
914 | * <!-- Category: instruction --> |
915 | * <xsl:message |
916 | * terminate = "yes" | "no"> |
917 | * <!-- Content: template --> |
918 | * </xsl:message> |
919 | */ |
920 | typedef struct _xsltStyleItemMessage xsltStyleItemMessage; |
921 | typedef xsltStyleItemMessage *xsltStyleItemMessagePtr; |
922 | |
923 | struct _xsltStyleItemMessage { |
924 | XSLT_ITEM_COMMON_FIELDS |
925 | int terminate; |
926 | }; |
927 | |
928 | /** |
929 | * xsltStyleItemDocument: |
930 | * |
931 | * NOTE: This is not an instruction of XSLT 1.0. |
932 | */ |
933 | typedef struct _xsltStyleItemDocument xsltStyleItemDocument; |
934 | typedef xsltStyleItemDocument *xsltStyleItemDocumentPtr; |
935 | |
936 | struct _xsltStyleItemDocument { |
937 | XSLT_ITEM_COMMON_FIELDS |
938 | int ver11; /* assigned: in xsltDocumentComp; |
939 | read: nowhere; |
940 | TODO: Check if we need. */ |
941 | const xmlChar *filename; /* document URL */ |
942 | int has_filename; |
943 | }; |
944 | |
945 | /************************************************************************ |
946 | * * |
947 | * Non-instructions (actually properties of instructions/declarations) * |
948 | * * |
949 | ************************************************************************/ |
950 | |
951 | /** |
952 | * xsltStyleBasicItemVariable: |
953 | * |
954 | * Basic struct for xsl:variable, xsl:param and xsl:with-param. |
955 | * It's currently important to have equal fields, since |
956 | * xsltParseStylesheetCallerParam() is used with xsl:with-param from |
957 | * the xslt side and with xsl:param from the exslt side (in |
958 | * exsltFuncFunctionFunction()). |
959 | * |
960 | * FUTURE NOTE: In XSLT 2.0 xsl:param, xsl:variable and xsl:with-param |
961 | * have additional different fields. |
962 | */ |
963 | typedef struct _xsltStyleBasicItemVariable xsltStyleBasicItemVariable; |
964 | typedef xsltStyleBasicItemVariable *xsltStyleBasicItemVariablePtr; |
965 | |
966 | struct _xsltStyleBasicItemVariable { |
967 | XSLT_ITEM_COMMON_FIELDS |
968 | |
969 | const xmlChar *select; |
970 | xmlXPathCompExprPtr comp; |
971 | |
972 | const xmlChar *name; |
973 | int has_name; |
974 | const xmlChar *ns; |
975 | int has_ns; |
976 | }; |
977 | |
978 | /** |
979 | * xsltStyleItemVariable: |
980 | * |
981 | * <!-- Category: top-level-element --> |
982 | * <xsl:param |
983 | * name = qname |
984 | * select = expression> |
985 | * <!-- Content: template --> |
986 | * </xsl:param> |
987 | */ |
988 | typedef xsltStyleBasicItemVariable xsltStyleItemVariable; |
989 | typedef xsltStyleItemVariable *xsltStyleItemVariablePtr; |
990 | |
991 | /** |
992 | * xsltStyleItemParam: |
993 | * |
994 | * <!-- Category: top-level-element --> |
995 | * <xsl:param |
996 | * name = qname |
997 | * select = expression> |
998 | * <!-- Content: template --> |
999 | * </xsl:param> |
1000 | */ |
1001 | typedef struct _xsltStyleItemParam xsltStyleItemParam; |
1002 | typedef xsltStyleItemParam *xsltStyleItemParamPtr; |
1003 | |
1004 | struct _xsltStyleItemParam { |
1005 | XSLT_ITEM_COMMON_FIELDS |
1006 | |
1007 | const xmlChar *select; |
1008 | xmlXPathCompExprPtr comp; |
1009 | |
1010 | const xmlChar *name; |
1011 | int has_name; |
1012 | const xmlChar *ns; |
1013 | int has_ns; |
1014 | }; |
1015 | |
1016 | /** |
1017 | * xsltStyleItemWithParam: |
1018 | * |
1019 | * <xsl:with-param |
1020 | * name = qname |
1021 | * select = expression> |
1022 | * <!-- Content: template --> |
1023 | * </xsl:with-param> |
1024 | */ |
1025 | typedef xsltStyleBasicItemVariable xsltStyleItemWithParam; |
1026 | typedef xsltStyleItemWithParam *xsltStyleItemWithParamPtr; |
1027 | |
1028 | /** |
1029 | * xsltStyleItemSort: |
1030 | * |
1031 | * Reflects the XSLT xsl:sort item. |
1032 | * Allowed parents: xsl:apply-templates, xsl:for-each |
1033 | * <xsl:sort |
1034 | * select = string-expression |
1035 | * lang = { nmtoken } |
1036 | * data-type = { "text" | "number" | qname-but-not-ncname } |
1037 | * order = { "ascending" | "descending" } |
1038 | * case-order = { "upper-first" | "lower-first" } /> |
1039 | */ |
1040 | typedef struct _xsltStyleItemSort xsltStyleItemSort; |
1041 | typedef xsltStyleItemSort *xsltStyleItemSortPtr; |
1042 | |
1043 | struct _xsltStyleItemSort { |
1044 | XSLT_ITEM_COMMON_FIELDS |
1045 | |
1046 | const xmlChar *stype; /* sort */ |
1047 | int has_stype; /* sort */ |
1048 | int number; /* sort */ |
1049 | const xmlChar *order; /* sort */ |
1050 | int has_order; /* sort */ |
1051 | int descending; /* sort */ |
1052 | const xmlChar *lang; /* sort */ |
1053 | int has_lang; /* sort */ |
1054 | xsltLocale locale; /* sort */ |
1055 | const xmlChar *case_order; /* sort */ |
1056 | int lower_first; /* sort */ |
1057 | |
1058 | const xmlChar *use; |
1059 | int has_use; |
1060 | |
1061 | const xmlChar *select; /* sort, copy-of, value-of, apply-templates */ |
1062 | |
1063 | xmlXPathCompExprPtr comp; /* a precompiled XPath expression */ |
1064 | }; |
1065 | |
1066 | |
1067 | /** |
1068 | * xsltStyleItemWhen: |
1069 | * |
1070 | * <xsl:when |
1071 | * test = boolean-expression> |
1072 | * <!-- Content: template --> |
1073 | * </xsl:when> |
1074 | * Allowed parent: xsl:choose |
1075 | */ |
1076 | typedef struct _xsltStyleItemWhen xsltStyleItemWhen; |
1077 | typedef xsltStyleItemWhen *xsltStyleItemWhenPtr; |
1078 | |
1079 | struct _xsltStyleItemWhen { |
1080 | XSLT_ITEM_COMMON_FIELDS |
1081 | |
1082 | const xmlChar *test; |
1083 | xmlXPathCompExprPtr comp; |
1084 | }; |
1085 | |
1086 | /** |
1087 | * xsltStyleItemOtherwise: |
1088 | * |
1089 | * Allowed parent: xsl:choose |
1090 | * <xsl:otherwise> |
1091 | * <!-- Content: template --> |
1092 | * </xsl:otherwise> |
1093 | */ |
1094 | typedef struct _xsltStyleItemOtherwise xsltStyleItemOtherwise; |
1095 | typedef xsltStyleItemOtherwise *xsltStyleItemOtherwisePtr; |
1096 | |
1097 | struct _xsltStyleItemOtherwise { |
1098 | XSLT_ITEM_COMMON_FIELDS |
1099 | }; |
1100 | |
1101 | typedef struct _xsltStyleItemInclude xsltStyleItemInclude; |
1102 | typedef xsltStyleItemInclude *xsltStyleItemIncludePtr; |
1103 | |
1104 | struct _xsltStyleItemInclude { |
1105 | XSLT_ITEM_COMMON_FIELDS |
1106 | xsltDocumentPtr include; |
1107 | }; |
1108 | |
1109 | /************************************************************************ |
1110 | * * |
1111 | * XSLT elements in forwards-compatible mode * |
1112 | * * |
1113 | ************************************************************************/ |
1114 | |
1115 | typedef struct _xsltStyleItemUknown xsltStyleItemUknown; |
1116 | typedef xsltStyleItemUknown *xsltStyleItemUknownPtr; |
1117 | struct _xsltStyleItemUknown { |
1118 | XSLT_ITEM_COMMON_FIELDS |
1119 | }; |
1120 | |
1121 | |
1122 | /************************************************************************ |
1123 | * * |
1124 | * Extension elements * |
1125 | * * |
1126 | ************************************************************************/ |
1127 | |
1128 | /* |
1129 | * xsltStyleItemExtElement: |
1130 | * |
1131 | * Reflects extension elements. |
1132 | * |
1133 | * NOTE: Due to the fact that the structure xsltElemPreComp is most |
1134 | * probably already heavily in use out there by users, so we cannot |
1135 | * easily change it, we'll create an intermediate structure which will |
1136 | * hold an xsltElemPreCompPtr. |
1137 | * BIG NOTE: The only problem I see here is that the user processes the |
1138 | * content of the stylesheet tree, possibly he'll lookup the node->psvi |
1139 | * fields in order to find subsequent extension functions. |
1140 | * In this case, the user's code will break, since the node->psvi |
1141 | * field will hold now the xsltStyleItemExtElementPtr and not |
1142 | * the xsltElemPreCompPtr. |
1143 | * However the place where the structure is anchored in the node-tree, |
1144 | * namely node->psvi, has beed already once been moved from node->_private |
1145 | * to node->psvi, so we have a precedent here, which, I think, should allow |
1146 | * us to change such semantics without headaches. |
1147 | */ |
1148 | typedef struct _xsltStyleItemExtElement xsltStyleItemExtElement; |
1149 | typedef xsltStyleItemExtElement *xsltStyleItemExtElementPtr; |
1150 | struct _xsltStyleItemExtElement { |
1151 | XSLT_ITEM_COMMON_FIELDS |
1152 | xsltElemPreCompPtr item; |
1153 | }; |
1154 | |
1155 | /************************************************************************ |
1156 | * * |
1157 | * Literal result elements * |
1158 | * * |
1159 | ************************************************************************/ |
1160 | |
1161 | typedef struct _xsltEffectiveNs xsltEffectiveNs; |
1162 | typedef xsltEffectiveNs *xsltEffectiveNsPtr; |
1163 | struct _xsltEffectiveNs { |
1164 | xsltEffectiveNsPtr nextInStore; /* storage next */ |
1165 | xsltEffectiveNsPtr next; /* next item in the list */ |
1166 | const xmlChar *prefix; |
1167 | const xmlChar *nsName; |
1168 | /* |
1169 | * Indicates if eclared on the literal result element; dunno if really |
1170 | * needed. |
1171 | */ |
1172 | int holdByElem; |
1173 | }; |
1174 | |
1175 | /* |
1176 | * Info for literal result elements. |
1177 | * This will be set on the elem->psvi field and will be |
1178 | * shared by literal result elements, which have the same |
1179 | * excluded result namespaces; i.e., this *won't* be created uniquely |
1180 | * for every literal result element. |
1181 | */ |
1182 | typedef struct _xsltStyleItemLRElementInfo xsltStyleItemLRElementInfo; |
1183 | typedef xsltStyleItemLRElementInfo *xsltStyleItemLRElementInfoPtr; |
1184 | struct _xsltStyleItemLRElementInfo { |
1185 | XSLT_ITEM_COMMON_FIELDS |
1186 | /* |
1187 | * @effectiveNs is the set of effective ns-nodes |
1188 | * on the literal result element, which will be added to the result |
1189 | * element if not already existing in the result tree. |
1190 | * This means that excluded namespaces (via exclude-result-prefixes, |
1191 | * extension-element-prefixes and the XSLT namespace) not added |
1192 | * to the set. |
1193 | * Namespace-aliasing was applied on the @effectiveNs. |
1194 | */ |
1195 | xsltEffectiveNsPtr effectiveNs; |
1196 | |
1197 | }; |
1198 | |
1199 | #ifdef XSLT_REFACTORED |
1200 | |
1201 | typedef struct _xsltNsAlias xsltNsAlias; |
1202 | typedef xsltNsAlias *xsltNsAliasPtr; |
1203 | struct _xsltNsAlias { |
1204 | xsltNsAliasPtr next; /* next in the list */ |
1205 | xmlNsPtr literalNs; |
1206 | xmlNsPtr targetNs; |
1207 | xmlDocPtr docOfTargetNs; |
1208 | }; |
1209 | #endif |
1210 | |
1211 | #ifdef XSLT_REFACTORED_XSLT_NSCOMP |
1212 | |
1213 | typedef struct _xsltNsMap xsltNsMap; |
1214 | typedef xsltNsMap *xsltNsMapPtr; |
1215 | struct _xsltNsMap { |
1216 | xsltNsMapPtr next; /* next in the list */ |
1217 | xmlDocPtr doc; |
1218 | xmlNodePtr elem; /* the element holding the ns-decl */ |
1219 | xmlNsPtr ns; /* the xmlNs structure holding the XML namespace name */ |
1220 | const xmlChar *origNsName; /* the original XML namespace name */ |
1221 | const xmlChar *newNsName; /* the mapped XML namespace name */ |
1222 | }; |
1223 | #endif |
1224 | |
1225 | /************************************************************************ |
1226 | * * |
1227 | * Compile-time structures for *internal* use only * |
1228 | * * |
1229 | ************************************************************************/ |
1230 | |
1231 | typedef struct _xsltPrincipalStylesheetData xsltPrincipalStylesheetData; |
1232 | typedef xsltPrincipalStylesheetData *xsltPrincipalStylesheetDataPtr; |
1233 | |
1234 | typedef struct _xsltNsList xsltNsList; |
1235 | typedef xsltNsList *xsltNsListPtr; |
1236 | struct _xsltNsList { |
1237 | xsltNsListPtr next; /* next in the list */ |
1238 | xmlNsPtr ns; |
1239 | }; |
1240 | |
1241 | /* |
1242 | * xsltVarInfo: |
1243 | * |
1244 | * Used at compilation time for parameters and variables. |
1245 | */ |
1246 | typedef struct _xsltVarInfo xsltVarInfo; |
1247 | typedef xsltVarInfo *xsltVarInfoPtr; |
1248 | struct _xsltVarInfo { |
1249 | xsltVarInfoPtr next; /* next in the list */ |
1250 | xsltVarInfoPtr prev; |
1251 | int depth; /* the depth in the tree */ |
1252 | const xmlChar *name; |
1253 | const xmlChar *nsName; |
1254 | }; |
1255 | |
1256 | /** |
1257 | * xsltCompilerNodeInfo: |
1258 | * |
1259 | * Per-node information during compile-time. |
1260 | */ |
1261 | typedef struct _xsltCompilerNodeInfo xsltCompilerNodeInfo; |
1262 | typedef xsltCompilerNodeInfo *xsltCompilerNodeInfoPtr; |
1263 | struct _xsltCompilerNodeInfo { |
1264 | xsltCompilerNodeInfoPtr next; |
1265 | xsltCompilerNodeInfoPtr prev; |
1266 | xmlNodePtr node; |
1267 | int depth; |
1268 | xsltTemplatePtr templ; /* The owning template */ |
1269 | int category; /* XSLT element, LR-element or |
1270 | extension element */ |
1271 | xsltStyleType type; |
1272 | xsltElemPreCompPtr item; /* The compiled information */ |
1273 | /* The current in-scope namespaces */ |
1274 | xsltNsListContainerPtr inScopeNs; |
1275 | /* The current excluded result namespaces */ |
1276 | xsltPointerListPtr exclResultNs; |
1277 | /* The current extension instruction namespaces */ |
1278 | xsltPointerListPtr extElemNs; |
1279 | |
1280 | /* The current info for literal result elements. */ |
1281 | xsltStyleItemLRElementInfoPtr litResElemInfo; |
1282 | /* |
1283 | * Set to 1 if in-scope namespaces changed, |
1284 | * or excluded result namespaces changed, |
1285 | * or extension element namespaces changed. |
1286 | * This will trigger creation of new infos |
1287 | * for literal result elements. |
1288 | */ |
1289 | int nsChanged; |
1290 | int preserveWhitespace; |
1291 | int stripWhitespace; |
1292 | int isRoot; /* whether this is the stylesheet's root node */ |
1293 | int forwardsCompat; /* whether forwards-compatible mode is enabled */ |
1294 | /* whether the content of an extension element was processed */ |
1295 | int extContentHandled; |
1296 | /* the type of the current child */ |
1297 | xsltStyleType curChildType; |
1298 | }; |
1299 | |
1300 | /** |
1301 | * XSLT_CCTXT: |
1302 | * |
1303 | * get pointer to compiler context |
1304 | */ |
1305 | #define XSLT_CCTXT(style) ((xsltCompilerCtxtPtr) style->compCtxt) |
1306 | |
1307 | typedef enum { |
1308 | XSLT_ERROR_SEVERITY_ERROR = 0, |
1309 | XSLT_ERROR_SEVERITY_WARNING |
1310 | } xsltErrorSeverityType; |
1311 | |
1312 | typedef struct _xsltCompilerCtxt xsltCompilerCtxt; |
1313 | typedef xsltCompilerCtxt *xsltCompilerCtxtPtr; |
1314 | struct _xsltCompilerCtxt { |
1315 | void *errorCtxt; /* user specific error context */ |
1316 | /* |
1317 | * used for error/warning reports; e.g. XSLT_ERROR_SEVERITY_WARNING */ |
1318 | xsltErrorSeverityType errSeverity; |
1319 | int warnings; /* TODO: number of warnings found at |
1320 | compilation */ |
1321 | int errors; /* TODO: number of errors found at |
1322 | compilation */ |
1323 | xmlDictPtr dict; |
1324 | xsltStylesheetPtr style; |
1325 | int simplified; /* whether this is a simplified stylesheet */ |
1326 | /* TODO: structured/unstructured error contexts. */ |
1327 | int depth; /* Current depth of processing */ |
1328 | |
1329 | xsltCompilerNodeInfoPtr inode; |
1330 | xsltCompilerNodeInfoPtr inodeList; |
1331 | xsltCompilerNodeInfoPtr inodeLast; |
1332 | xsltPointerListPtr tmpList; /* Used for various purposes */ |
1333 | /* |
1334 | * The XSLT version as specified by the stylesheet's root element. |
1335 | */ |
1336 | int isInclude; |
1337 | int hasForwardsCompat; /* whether forwards-compatible mode was used |
1338 | in a parsing episode */ |
1339 | int maxNodeInfos; /* TEMP TODO: just for the interest */ |
1340 | int maxLREs; /* TEMP TODO: just for the interest */ |
1341 | /* |
1342 | * In order to keep the old behaviour, applying strict rules of |
1343 | * the spec can be turned off. This has effect only on special |
1344 | * mechanisms like whitespace-stripping in the stylesheet. |
1345 | */ |
1346 | int strict; |
1347 | xsltPrincipalStylesheetDataPtr psData; |
1348 | #ifdef XSLT_REFACTORED_XPATHCOMP |
1349 | xmlXPathContextPtr xpathCtxt; |
1350 | #endif |
1351 | xsltStyleItemUknownPtr unknownItem; |
1352 | int hasNsAliases; /* Indicator if there was an xsl:namespace-alias. */ |
1353 | xsltNsAliasPtr nsAliases; |
1354 | xsltVarInfoPtr ivars; /* Storage of local in-scope variables/params. */ |
1355 | xsltVarInfoPtr ivar; /* topmost local variable/param. */ |
1356 | }; |
1357 | |
1358 | #else /* XSLT_REFACTORED */ |
1359 | /* |
1360 | * The old structures before refactoring. |
1361 | */ |
1362 | |
1363 | /** |
1364 | * _xsltStylePreComp: |
1365 | * |
1366 | * The in-memory structure corresponding to XSLT stylesheet constructs |
1367 | * precomputed data. |
1368 | */ |
1369 | struct _xsltStylePreComp { |
1370 | xsltElemPreCompPtr next; /* chained list */ |
1371 | xsltStyleType type; /* type of the element */ |
1372 | xsltTransformFunction func; /* handling function */ |
1373 | xmlNodePtr inst; /* the instruction */ |
1374 | |
1375 | /* |
1376 | * Pre computed values. |
1377 | */ |
1378 | |
1379 | const xmlChar *stype; /* sort */ |
1380 | int has_stype; /* sort */ |
1381 | int number; /* sort */ |
1382 | const xmlChar *order; /* sort */ |
1383 | int has_order; /* sort */ |
1384 | int descending; /* sort */ |
1385 | const xmlChar *lang; /* sort */ |
1386 | int has_lang; /* sort */ |
1387 | xsltLocale locale; /* sort */ |
1388 | const xmlChar *case_order; /* sort */ |
1389 | int lower_first; /* sort */ |
1390 | |
1391 | const xmlChar *use; /* copy, element */ |
1392 | int has_use; /* copy, element */ |
1393 | |
1394 | int noescape; /* text */ |
1395 | |
1396 | const xmlChar *name; /* element, attribute, pi */ |
1397 | int has_name; /* element, attribute, pi */ |
1398 | const xmlChar *ns; /* element */ |
1399 | int has_ns; /* element */ |
1400 | |
1401 | const xmlChar *mode; /* apply-templates */ |
1402 | const xmlChar *modeURI; /* apply-templates */ |
1403 | |
1404 | const xmlChar *test; /* if */ |
1405 | |
1406 | xsltTemplatePtr templ; /* call-template */ |
1407 | |
1408 | const xmlChar *select; /* sort, copy-of, value-of, apply-templates */ |
1409 | |
1410 | int ver11; /* document */ |
1411 | const xmlChar *filename; /* document URL */ |
1412 | int has_filename; /* document */ |
1413 | |
1414 | xsltNumberData numdata; /* number */ |
1415 | |
1416 | xmlXPathCompExprPtr comp; /* a precompiled XPath expression */ |
1417 | xmlNsPtr *nsList; /* the namespaces in scope */ |
1418 | int nsNr; /* the number of namespaces in scope */ |
1419 | }; |
1420 | |
1421 | #endif /* XSLT_REFACTORED */ |
1422 | |
1423 | |
1424 | /* |
1425 | * The in-memory structure corresponding to an XSLT Variable |
1426 | * or Param. |
1427 | */ |
1428 | typedef struct _xsltStackElem xsltStackElem; |
1429 | typedef xsltStackElem *xsltStackElemPtr; |
1430 | struct _xsltStackElem { |
1431 | struct _xsltStackElem *next;/* chained list */ |
1432 | xsltStylePreCompPtr comp; /* the compiled form */ |
1433 | int computed; /* was the evaluation done */ |
1434 | const xmlChar *name; /* the local part of the name QName */ |
1435 | const xmlChar *nameURI; /* the URI part of the name QName */ |
1436 | const xmlChar *select; /* the eval string */ |
1437 | xmlNodePtr tree; /* the sequence constructor if no eval |
1438 | string or the location */ |
1439 | xmlXPathObjectPtr value; /* The value if computed */ |
1440 | xmlDocPtr fragment; /* The Result Tree Fragments (needed for XSLT 1.0) |
1441 | which are bound to the variable's lifetime. */ |
1442 | int level; /* the depth in the tree; |
1443 | -1 if persistent (e.g. a given xsl:with-param) */ |
1444 | xsltTransformContextPtr context; /* The transformation context; needed to cache |
1445 | the variables */ |
1446 | int flags; |
1447 | }; |
1448 | |
1449 | #ifdef XSLT_REFACTORED |
1450 | |
1451 | struct _xsltPrincipalStylesheetData { |
1452 | /* |
1453 | * Namespace dictionary for ns-prefixes and ns-names: |
1454 | * TODO: Shared between stylesheets, and XPath mechanisms. |
1455 | * Not used yet. |
1456 | */ |
1457 | xmlDictPtr namespaceDict; |
1458 | /* |
1459 | * Global list of in-scope namespaces. |
1460 | */ |
1461 | xsltPointerListPtr inScopeNamespaces; |
1462 | /* |
1463 | * Global list of information for [xsl:]excluded-result-prefixes. |
1464 | */ |
1465 | xsltPointerListPtr exclResultNamespaces; |
1466 | /* |
1467 | * Global list of information for [xsl:]extension-element-prefixes. |
1468 | */ |
1469 | xsltPointerListPtr extElemNamespaces; |
1470 | xsltEffectiveNsPtr effectiveNs; |
1471 | #ifdef XSLT_REFACTORED_XSLT_NSCOMP |
1472 | /* |
1473 | * Namespace name map to get rid of string comparison of namespace names. |
1474 | */ |
1475 | xsltNsMapPtr nsMap; |
1476 | #endif |
1477 | }; |
1478 | |
1479 | |
1480 | #endif |
1481 | /* |
1482 | * Note that we added a @compCtxt field to anchor an stylesheet compilation |
1483 | * context, since, due to historical reasons, various compile-time function |
1484 | * take only the stylesheet as argument and not a compilation context. |
1485 | */ |
1486 | struct _xsltStylesheet { |
1487 | /* |
1488 | * The stylesheet import relation is kept as a tree. |
1489 | */ |
1490 | struct _xsltStylesheet *parent; |
1491 | struct _xsltStylesheet *next; |
1492 | struct _xsltStylesheet *imports; |
1493 | |
1494 | xsltDocumentPtr docList; /* the include document list */ |
1495 | |
1496 | /* |
1497 | * General data on the style sheet document. |
1498 | */ |
1499 | xmlDocPtr doc; /* the parsed XML stylesheet */ |
1500 | xmlHashTablePtr stripSpaces;/* the hash table of the strip-space and |
1501 | preserve space elements */ |
1502 | int stripAll; /* strip-space * (1) preserve-space * (-1) */ |
1503 | xmlHashTablePtr cdataSection;/* the hash table of the cdata-section */ |
1504 | |
1505 | /* |
1506 | * Global variable or parameters. |
1507 | */ |
1508 | xsltStackElemPtr variables; /* linked list of param and variables */ |
1509 | |
1510 | /* |
1511 | * Template descriptions. |
1512 | */ |
1513 | xsltTemplatePtr templates; /* the ordered list of templates */ |
1514 | void *templatesHash; /* hash table or wherever compiled templates |
1515 | information are stored */ |
1516 | void *rootMatch; /* template based on / */ |
1517 | void *keyMatch; /* template based on key() */ |
1518 | void *elemMatch; /* template based on * */ |
1519 | void *attrMatch; /* template based on @* */ |
1520 | void *parentMatch; /* template based on .. */ |
1521 | void *textMatch; /* template based on text() */ |
1522 | void *piMatch; /* template based on processing-instruction() */ |
1523 | void *; /* template based on comment() */ |
1524 | |
1525 | /* |
1526 | * Namespace aliases. |
1527 | * NOTE: Not used in the refactored code. |
1528 | */ |
1529 | xmlHashTablePtr nsAliases; /* the namespace alias hash tables */ |
1530 | |
1531 | /* |
1532 | * Attribute sets. |
1533 | */ |
1534 | xmlHashTablePtr attributeSets;/* the attribute sets hash tables */ |
1535 | |
1536 | /* |
1537 | * Namespaces. |
1538 | * TODO: Eliminate this. |
1539 | */ |
1540 | xmlHashTablePtr nsHash; /* the set of namespaces in use: |
1541 | ATTENTION: This is used for |
1542 | execution of XPath expressions; unfortunately |
1543 | it restricts the stylesheet to have distinct |
1544 | prefixes. |
1545 | TODO: We need to get rid of this. |
1546 | */ |
1547 | void *nsDefs; /* ATTENTION TODO: This is currently used to store |
1548 | xsltExtDefPtr (in extensions.c) and |
1549 | *not* xmlNsPtr. |
1550 | */ |
1551 | |
1552 | /* |
1553 | * Key definitions. |
1554 | */ |
1555 | void *keys; /* key definitions */ |
1556 | |
1557 | /* |
1558 | * Output related stuff. |
1559 | */ |
1560 | xmlChar *method; /* the output method */ |
1561 | xmlChar *methodURI; /* associated namespace if any */ |
1562 | xmlChar *version; /* version string */ |
1563 | xmlChar *encoding; /* encoding string */ |
1564 | int omitXmlDeclaration; /* omit-xml-declaration = "yes" | "no" */ |
1565 | |
1566 | /* |
1567 | * Number formatting. |
1568 | */ |
1569 | xsltDecimalFormatPtr decimalFormat; |
1570 | int standalone; /* standalone = "yes" | "no" */ |
1571 | xmlChar *doctypePublic; /* doctype-public string */ |
1572 | xmlChar *doctypeSystem; /* doctype-system string */ |
1573 | int indent; /* should output being indented */ |
1574 | xmlChar *mediaType; /* media-type string */ |
1575 | |
1576 | /* |
1577 | * Precomputed blocks. |
1578 | */ |
1579 | xsltElemPreCompPtr preComps;/* list of precomputed blocks */ |
1580 | int warnings; /* number of warnings found at compilation */ |
1581 | int errors; /* number of errors found at compilation */ |
1582 | |
1583 | xmlChar *exclPrefix; /* last excluded prefixes */ |
1584 | xmlChar **exclPrefixTab; /* array of excluded prefixes */ |
1585 | int exclPrefixNr; /* number of excluded prefixes in scope */ |
1586 | int exclPrefixMax; /* size of the array */ |
1587 | |
1588 | void *_private; /* user defined data */ |
1589 | |
1590 | /* |
1591 | * Extensions. |
1592 | */ |
1593 | xmlHashTablePtr extInfos; /* the extension data */ |
1594 | int ; /* the number of extras required */ |
1595 | |
1596 | /* |
1597 | * For keeping track of nested includes |
1598 | */ |
1599 | xsltDocumentPtr includes; /* points to last nested include */ |
1600 | |
1601 | /* |
1602 | * dictionary: shared between stylesheet, context and documents. |
1603 | */ |
1604 | xmlDictPtr dict; |
1605 | /* |
1606 | * precompiled attribute value templates. |
1607 | */ |
1608 | void *attVTs; |
1609 | /* |
1610 | * if namespace-alias has an alias for the default stylesheet prefix |
1611 | * NOTE: Not used in the refactored code. |
1612 | */ |
1613 | const xmlChar *defaultAlias; |
1614 | /* |
1615 | * bypass pre-processing (already done) (used in imports) |
1616 | */ |
1617 | int nopreproc; |
1618 | /* |
1619 | * all document text strings were internalized |
1620 | */ |
1621 | int internalized; |
1622 | /* |
1623 | * Literal Result Element as Stylesheet c.f. section 2.3 |
1624 | */ |
1625 | int literal_result; |
1626 | /* |
1627 | * The principal stylesheet |
1628 | */ |
1629 | xsltStylesheetPtr principal; |
1630 | #ifdef XSLT_REFACTORED |
1631 | /* |
1632 | * Compilation context used during compile-time. |
1633 | */ |
1634 | xsltCompilerCtxtPtr compCtxt; /* TODO: Change this to (void *). */ |
1635 | |
1636 | xsltPrincipalStylesheetDataPtr principalData; |
1637 | #endif |
1638 | /* |
1639 | * Forwards-compatible processing |
1640 | */ |
1641 | int forwards_compatible; |
1642 | |
1643 | xmlHashTablePtr namedTemplates; /* hash table of named templates */ |
1644 | }; |
1645 | |
1646 | typedef struct _xsltTransformCache xsltTransformCache; |
1647 | typedef xsltTransformCache *xsltTransformCachePtr; |
1648 | struct _xsltTransformCache { |
1649 | xmlDocPtr RVT; |
1650 | int nbRVT; |
1651 | xsltStackElemPtr stackItems; |
1652 | int nbStackItems; |
1653 | #ifdef XSLT_DEBUG_PROFILE_CACHE |
1654 | int dbgCachedRVTs; |
1655 | int dbgReusedRVTs; |
1656 | int dbgCachedVars; |
1657 | int dbgReusedVars; |
1658 | #endif |
1659 | }; |
1660 | |
1661 | /* |
1662 | * The in-memory structure corresponding to an XSLT Transformation. |
1663 | */ |
1664 | typedef enum { |
1665 | XSLT_OUTPUT_XML = 0, |
1666 | XSLT_OUTPUT_HTML, |
1667 | XSLT_OUTPUT_TEXT |
1668 | } xsltOutputType; |
1669 | |
1670 | typedef enum { |
1671 | XSLT_STATE_OK = 0, |
1672 | XSLT_STATE_ERROR, |
1673 | XSLT_STATE_STOPPED |
1674 | } xsltTransformState; |
1675 | |
1676 | struct _xsltTransformContext { |
1677 | xsltStylesheetPtr style; /* the stylesheet used */ |
1678 | xsltOutputType type; /* the type of output */ |
1679 | |
1680 | xsltTemplatePtr templ; /* the current template */ |
1681 | int templNr; /* Nb of templates in the stack */ |
1682 | int templMax; /* Size of the templtes stack */ |
1683 | xsltTemplatePtr *templTab; /* the template stack */ |
1684 | |
1685 | xsltStackElemPtr vars; /* the current variable list */ |
1686 | int varsNr; /* Nb of variable list in the stack */ |
1687 | int varsMax; /* Size of the variable list stack */ |
1688 | xsltStackElemPtr *varsTab; /* the variable list stack */ |
1689 | int varsBase; /* the var base for current templ */ |
1690 | |
1691 | /* |
1692 | * Extensions |
1693 | */ |
1694 | xmlHashTablePtr extFunctions; /* the extension functions */ |
1695 | xmlHashTablePtr extElements; /* the extension elements */ |
1696 | xmlHashTablePtr extInfos; /* the extension data */ |
1697 | |
1698 | const xmlChar *mode; /* the current mode */ |
1699 | const xmlChar *modeURI; /* the current mode URI */ |
1700 | |
1701 | xsltDocumentPtr docList; /* the document list */ |
1702 | |
1703 | xsltDocumentPtr document; /* the current source document; can be NULL if an RTF */ |
1704 | xmlNodePtr node; /* the current node being processed */ |
1705 | xmlNodeSetPtr nodeList; /* the current node list */ |
1706 | /* xmlNodePtr current; the node */ |
1707 | |
1708 | xmlDocPtr output; /* the resulting document */ |
1709 | xmlNodePtr insert; /* the insertion node */ |
1710 | |
1711 | xmlXPathContextPtr xpathCtxt; /* the XPath context */ |
1712 | xsltTransformState state; /* the current state */ |
1713 | |
1714 | /* |
1715 | * Global variables |
1716 | */ |
1717 | xmlHashTablePtr globalVars; /* the global variables and params */ |
1718 | |
1719 | xmlNodePtr inst; /* the instruction in the stylesheet */ |
1720 | |
1721 | int xinclude; /* should XInclude be processed */ |
1722 | |
1723 | const char * outputFile; /* the output URI if known */ |
1724 | |
1725 | int profile; /* is this run profiled */ |
1726 | long prof; /* the current profiled value */ |
1727 | int profNr; /* Nb of templates in the stack */ |
1728 | int profMax; /* Size of the templtaes stack */ |
1729 | long *profTab; /* the profile template stack */ |
1730 | |
1731 | void *_private; /* user defined data */ |
1732 | |
1733 | int ; /* the number of extras used */ |
1734 | int ; /* the number of extras allocated */ |
1735 | xsltRuntimeExtraPtr ; /* extra per runtime information */ |
1736 | |
1737 | xsltDocumentPtr styleList; /* the stylesheet docs list */ |
1738 | void * sec; /* the security preferences if any */ |
1739 | |
1740 | xmlGenericErrorFunc error; /* a specific error handler */ |
1741 | void * errctx; /* context for the error handler */ |
1742 | |
1743 | xsltSortFunc sortfunc; /* a ctxt specific sort routine */ |
1744 | |
1745 | /* |
1746 | * handling of temporary Result Value Tree |
1747 | * (XSLT 1.0 term: "Result Tree Fragment") |
1748 | */ |
1749 | xmlDocPtr tmpRVT; /* list of RVT without persistance */ |
1750 | xmlDocPtr persistRVT; /* list of persistant RVTs */ |
1751 | int ctxtflags; /* context processing flags */ |
1752 | |
1753 | /* |
1754 | * Speed optimization when coalescing text nodes |
1755 | */ |
1756 | const xmlChar *lasttext; /* last text node content */ |
1757 | int lasttsize; /* last text node size */ |
1758 | int lasttuse; /* last text node use */ |
1759 | /* |
1760 | * Per Context Debugging |
1761 | */ |
1762 | int debugStatus; /* the context level debug status */ |
1763 | unsigned long* traceCode; /* pointer to the variable holding the mask */ |
1764 | |
1765 | int parserOptions; /* parser options xmlParserOption */ |
1766 | |
1767 | /* |
1768 | * dictionary: shared between stylesheet, context and documents. |
1769 | */ |
1770 | xmlDictPtr dict; |
1771 | xmlDocPtr tmpDoc; /* Obsolete; not used in the library. */ |
1772 | /* |
1773 | * all document text strings are internalized |
1774 | */ |
1775 | int internalized; |
1776 | int nbKeys; |
1777 | int hasTemplKeyPatterns; |
1778 | xsltTemplatePtr currentTemplateRule; /* the Current Template Rule */ |
1779 | xmlNodePtr initialContextNode; |
1780 | xmlDocPtr initialContextDoc; |
1781 | xsltTransformCachePtr cache; |
1782 | void *contextVariable; /* the current variable item */ |
1783 | xmlDocPtr localRVT; /* list of local tree fragments; will be freed when |
1784 | the instruction which created the fragment |
1785 | exits */ |
1786 | xmlDocPtr localRVTBase; |
1787 | int keyInitLevel; /* Needed to catch recursive keys issues */ |
1788 | int funcLevel; /* Needed to catch recursive functions issues */ |
1789 | int maxTemplateDepth; |
1790 | int maxTemplateVars; |
1791 | |
1792 | unsigned long nextid;/* for generating stable ids */ |
1793 | }; |
1794 | |
1795 | /** |
1796 | * CHECK_STOPPED: |
1797 | * |
1798 | * Macro to check if the XSLT processing should be stopped. |
1799 | * Will return from the function. |
1800 | */ |
1801 | #define CHECK_STOPPED if (ctxt->state == XSLT_STATE_STOPPED) return; |
1802 | |
1803 | /** |
1804 | * CHECK_STOPPEDE: |
1805 | * |
1806 | * Macro to check if the XSLT processing should be stopped. |
1807 | * Will goto the error: label. |
1808 | */ |
1809 | #define CHECK_STOPPEDE if (ctxt->state == XSLT_STATE_STOPPED) goto error; |
1810 | |
1811 | /** |
1812 | * CHECK_STOPPED0: |
1813 | * |
1814 | * Macro to check if the XSLT processing should be stopped. |
1815 | * Will return from the function with a 0 value. |
1816 | */ |
1817 | #define CHECK_STOPPED0 if (ctxt->state == XSLT_STATE_STOPPED) return(0); |
1818 | |
1819 | /* |
1820 | * The macro XML_CAST_FPTR is a hack to avoid a gcc warning about |
1821 | * possible incompatibilities between function pointers and object |
1822 | * pointers. It is defined in libxml/hash.h within recent versions |
1823 | * of libxml2, but is put here for compatibility. |
1824 | */ |
1825 | #ifndef XML_CAST_FPTR |
1826 | /** |
1827 | * XML_CAST_FPTR: |
1828 | * @fptr: pointer to a function |
1829 | * |
1830 | * Macro to do a casting from an object pointer to a |
1831 | * function pointer without encountering a warning from |
1832 | * gcc |
1833 | * |
1834 | * #define XML_CAST_FPTR(fptr) (*(void **)(&fptr)) |
1835 | * This macro violated ISO C aliasing rules (gcc4 on s390 broke) |
1836 | * so it is disabled now |
1837 | */ |
1838 | |
1839 | #define XML_CAST_FPTR(fptr) fptr |
1840 | #endif |
1841 | /* |
1842 | * Functions associated to the internal types |
1843 | xsltDecimalFormatPtr xsltDecimalFormatGetByName(xsltStylesheetPtr sheet, |
1844 | xmlChar *name); |
1845 | */ |
1846 | XSLTPUBFUN xsltStylesheetPtr XSLTCALL |
1847 | xsltNewStylesheet (void); |
1848 | XSLTPUBFUN xsltStylesheetPtr XSLTCALL |
1849 | xsltParseStylesheetFile (const xmlChar* filename); |
1850 | XSLTPUBFUN void XSLTCALL |
1851 | xsltFreeStylesheet (xsltStylesheetPtr style); |
1852 | XSLTPUBFUN int XSLTCALL |
1853 | xsltIsBlank (xmlChar *str); |
1854 | XSLTPUBFUN void XSLTCALL |
1855 | xsltFreeStackElemList (xsltStackElemPtr elem); |
1856 | XSLTPUBFUN xsltDecimalFormatPtr XSLTCALL |
1857 | xsltDecimalFormatGetByName(xsltStylesheetPtr style, |
1858 | xmlChar *name); |
1859 | |
1860 | XSLTPUBFUN xsltStylesheetPtr XSLTCALL |
1861 | xsltParseStylesheetProcess(xsltStylesheetPtr ret, |
1862 | xmlDocPtr doc); |
1863 | XSLTPUBFUN void XSLTCALL |
1864 | xsltParseStylesheetOutput(xsltStylesheetPtr style, |
1865 | xmlNodePtr cur); |
1866 | XSLTPUBFUN xsltStylesheetPtr XSLTCALL |
1867 | xsltParseStylesheetDoc (xmlDocPtr doc); |
1868 | XSLTPUBFUN xsltStylesheetPtr XSLTCALL |
1869 | xsltParseStylesheetImportedDoc(xmlDocPtr doc, |
1870 | xsltStylesheetPtr style); |
1871 | XSLTPUBFUN xsltStylesheetPtr XSLTCALL |
1872 | xsltLoadStylesheetPI (xmlDocPtr doc); |
1873 | XSLTPUBFUN void XSLTCALL |
1874 | xsltNumberFormat (xsltTransformContextPtr ctxt, |
1875 | xsltNumberDataPtr data, |
1876 | xmlNodePtr node); |
1877 | XSLTPUBFUN xmlXPathError XSLTCALL |
1878 | xsltFormatNumberConversion(xsltDecimalFormatPtr self, |
1879 | xmlChar *format, |
1880 | double number, |
1881 | xmlChar **result); |
1882 | |
1883 | XSLTPUBFUN void XSLTCALL |
1884 | xsltParseTemplateContent(xsltStylesheetPtr style, |
1885 | xmlNodePtr templ); |
1886 | XSLTPUBFUN int XSLTCALL |
1887 | (xsltStylesheetPtr style); |
1888 | XSLTPUBFUN int XSLTCALL |
1889 | (xsltTransformContextPtr ctxt); |
1890 | /* |
1891 | * Extra functions for Result Value Trees |
1892 | */ |
1893 | XSLTPUBFUN xmlDocPtr XSLTCALL |
1894 | xsltCreateRVT (xsltTransformContextPtr ctxt); |
1895 | XSLTPUBFUN int XSLTCALL |
1896 | xsltRegisterTmpRVT (xsltTransformContextPtr ctxt, |
1897 | xmlDocPtr RVT); |
1898 | XSLTPUBFUN int XSLTCALL |
1899 | xsltRegisterLocalRVT (xsltTransformContextPtr ctxt, |
1900 | xmlDocPtr RVT); |
1901 | XSLTPUBFUN int XSLTCALL |
1902 | xsltRegisterPersistRVT (xsltTransformContextPtr ctxt, |
1903 | xmlDocPtr RVT); |
1904 | XSLTPUBFUN int XSLTCALL |
1905 | xsltExtensionInstructionResultRegister( |
1906 | xsltTransformContextPtr ctxt, |
1907 | xmlXPathObjectPtr obj); |
1908 | XSLTPUBFUN int XSLTCALL |
1909 | xsltExtensionInstructionResultFinalize( |
1910 | xsltTransformContextPtr ctxt); |
1911 | XSLTPUBFUN void XSLTCALL |
1912 | xsltFreeRVTs (xsltTransformContextPtr ctxt); |
1913 | XSLTPUBFUN void XSLTCALL |
1914 | xsltReleaseRVT (xsltTransformContextPtr ctxt, |
1915 | xmlDocPtr RVT); |
1916 | /* |
1917 | * Extra functions for Attribute Value Templates |
1918 | */ |
1919 | XSLTPUBFUN void XSLTCALL |
1920 | xsltCompileAttr (xsltStylesheetPtr style, |
1921 | xmlAttrPtr attr); |
1922 | XSLTPUBFUN xmlChar * XSLTCALL |
1923 | xsltEvalAVT (xsltTransformContextPtr ctxt, |
1924 | void *avt, |
1925 | xmlNodePtr node); |
1926 | XSLTPUBFUN void XSLTCALL |
1927 | xsltFreeAVTList (void *avt); |
1928 | |
1929 | /* |
1930 | * Extra function for successful xsltCleanupGlobals / xsltInit sequence. |
1931 | */ |
1932 | |
1933 | XSLTPUBFUN void XSLTCALL |
1934 | xsltUninit (void); |
1935 | |
1936 | /************************************************************************ |
1937 | * * |
1938 | * Compile-time functions for *internal* use only * |
1939 | * * |
1940 | ************************************************************************/ |
1941 | |
1942 | #ifdef XSLT_REFACTORED |
1943 | XSLTPUBFUN void XSLTCALL |
1944 | xsltParseSequenceConstructor( |
1945 | xsltCompilerCtxtPtr cctxt, |
1946 | xmlNodePtr start); |
1947 | XSLTPUBFUN int XSLTCALL |
1948 | xsltParseAnyXSLTElem (xsltCompilerCtxtPtr cctxt, |
1949 | xmlNodePtr elem); |
1950 | #ifdef XSLT_REFACTORED_XSLT_NSCOMP |
1951 | XSLTPUBFUN int XSLTCALL |
1952 | xsltRestoreDocumentNamespaces( |
1953 | xsltNsMapPtr ns, |
1954 | xmlDocPtr doc); |
1955 | #endif |
1956 | #endif /* XSLT_REFACTORED */ |
1957 | |
1958 | /************************************************************************ |
1959 | * * |
1960 | * Transformation-time functions for *internal* use only * |
1961 | * * |
1962 | ************************************************************************/ |
1963 | XSLTPUBFUN int XSLTCALL |
1964 | xsltInitCtxtKey (xsltTransformContextPtr ctxt, |
1965 | xsltDocumentPtr doc, |
1966 | xsltKeyDefPtr keyd); |
1967 | XSLTPUBFUN int XSLTCALL |
1968 | xsltInitAllDocKeys (xsltTransformContextPtr ctxt); |
1969 | #ifdef __cplusplus |
1970 | } |
1971 | #endif |
1972 | |
1973 | #endif /* __XML_XSLT_H__ */ |
1974 | |
1975 | |