2 * Summary: internal data structures, constants and functions
3 * Description: Internal data structures, constants and functions used
5 * They are not part of the API or ABI, i.e. they can change
6 * without prior notice, use carefully.
8 * Copy: See Copyright for the status of this software.
10 * Author: Daniel Veillard
13 #ifndef __XML_XSLT_INTERNALS_H__
14 #define __XML_XSLT_INTERNALS_H__
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 "numbersInternals.h"
30 /* #define XSLT_DEBUG_PROFILE_CACHE */
35 * check if the argument is a text node
37 #define XSLT_IS_TEXT_NODE(n) ((n != NULL) && \
38 (((n)->type == XML_TEXT_NODE) || \
39 ((n)->type == XML_CDATA_SECTION_NODE)))
43 * XSLT_MARK_RES_TREE_FRAG:
45 * internal macro to set up tree fragments
47 #define XSLT_MARK_RES_TREE_FRAG(n) \
48 (n)->name = (char *) xmlStrdup(BAD_CAST " fake node libxslt");
51 * XSLT_IS_RES_TREE_FRAG:
53 * internal macro to test tree fragments
55 #define XSLT_IS_RES_TREE_FRAG(n) \
56 ((n != NULL) && ((n)->type == XML_DOCUMENT_NODE) && \
57 ((n)->name != NULL) && ((n)->name[0] == ' '))
60 * XSLT_REFACTORED_KEYCOMP:
62 * Internal define to enable on-demand xsl:key computation.
63 * That's the only mode now but the define is kept for compatibility
65 #define XSLT_REFACTORED_KEYCOMP
70 * Internal define to enable usage of xmlXPathCompiledEvalToBoolean()
71 * for XSLT "tests"; e.g. in <xsl:if test="/foo/bar">
78 * Internal define to enable the refactored parts of Libxslt.
80 /* #define XSLT_REFACTORED */
81 /* ==================================================================== */
84 * XSLT_REFACTORED_VARS:
86 * Internal define to enable the refactored variable part of libxslt
88 #define XSLT_REFACTORED_VARS
90 #ifdef XSLT_REFACTORED
92 extern const xmlChar
*xsltXSLTAttrMarker
;
95 /* TODO: REMOVE: #define XSLT_REFACTORED_EXCLRESNS */
97 /* TODO: REMOVE: #define XSLT_REFACTORED_NSALIAS */
100 * XSLT_REFACTORED_XSLT_NSCOMP
102 * Internal define to enable the pointer-comparison of
103 * namespaces of XSLT elements.
105 /* #define XSLT_REFACTORED_XSLT_NSCOMP */
108 * XSLT_REFACTORED_XPATHCOMP:
110 * Internal define to enable the optimization of the
111 * compilation of XPath expressions.
113 #define XSLT_REFACTORED_XPATHCOMP
115 #ifdef XSLT_REFACTORED_XSLT_NSCOMP
117 extern const xmlChar
*xsltConstNamespaceNameXSLT
;
122 * quick test to detect XSLT elements
124 #define IS_XSLT_ELEM_FAST(n) \
125 (((n) != NULL) && ((n)->ns != NULL) && \
126 ((n)->ns->href == xsltConstNamespaceNameXSLT))
131 * quick test to detect XSLT attributes
133 #define IS_XSLT_ATTR_FAST(a) \
134 (((a) != NULL) && ((a)->ns != NULL) && \
135 ((a)->ns->href == xsltConstNamespaceNameXSLT))
138 * XSLT_HAS_INTERNAL_NSMAP:
140 * check for namespace mapping
142 #define XSLT_HAS_INTERNAL_NSMAP(s) \
143 (((s) != NULL) && ((s)->principal) && \
144 ((s)->principal->principalData) && \
145 ((s)->principal->principalData->nsMap))
148 * XSLT_GET_INTERNAL_NSMAP:
150 * get pointer to namespace map
152 #define XSLT_GET_INTERNAL_NSMAP(s) ((s)->principal->principalData->nsMap)
154 #else /* XSLT_REFACTORED_XSLT_NSCOMP */
159 * quick check whether this is an xslt element
161 #define IS_XSLT_ELEM_FAST(n) \
162 (((n) != NULL) && ((n)->ns != NULL) && \
163 (xmlStrEqual((n)->ns->href, XSLT_NAMESPACE)))
168 * quick check for xslt namespace attribute
170 #define IS_XSLT_ATTR_FAST(a) \
171 (((a) != NULL) && ((a)->ns != NULL) && \
172 (xmlStrEqual((a)->ns->href, XSLT_NAMESPACE)))
175 #endif /* XSLT_REFACTORED_XSLT_NSCOMP */
179 * XSLT_REFACTORED_MANDATORY_VERSION:
181 * TODO: Currently disabled to surpress regression test failures, since
182 * the old behaviour was that a missing version attribute
183 * produced a only a warning and not an error, which was incerrect.
184 * So the regression tests need to be fixed if this is enabled.
186 /* #define XSLT_REFACTORED_MANDATORY_VERSION */
191 * Pointer-list for various purposes.
193 typedef struct _xsltPointerList xsltPointerList
;
194 typedef xsltPointerList
*xsltPointerListPtr
;
195 struct _xsltPointerList
{
204 * XSLT_REFACTORED_PARSING:
206 * Internal define to enable the refactored parts of Libxslt
207 * related to parsing.
209 /* #define XSLT_REFACTORED_PARSING */
214 * Max number of specified xsl:sort on an element.
216 #define XSLT_MAX_SORT 15
219 * XSLT_PAT_NO_PRIORITY:
221 * Specific value for pattern without priority expressed.
223 #define XSLT_PAT_NO_PRIORITY -12345789
228 * Extra information added to the transformation context.
230 typedef struct _xsltRuntimeExtra xsltRuntimeExtra
;
231 typedef xsltRuntimeExtra
*xsltRuntimeExtraPtr
;
232 struct _xsltRuntimeExtra
{
233 void *info
; /* pointer to the extra data */
234 xmlFreeFunc deallocate
; /* pointer to the deallocation routine */
235 union { /* dual-purpose field */
236 void *ptr
; /* data not needing deallocation */
237 int ival
; /* integer value storage */
242 * XSLT_RUNTIME_EXTRA_LST:
243 * @ctxt: the transformation context
246 * Macro used to access extra information stored in the context
248 #define XSLT_RUNTIME_EXTRA_LST(ctxt, nr) (ctxt)->extras[(nr)].info
250 * XSLT_RUNTIME_EXTRA_FREE:
251 * @ctxt: the transformation context
254 * Macro used to free extra information stored in the context
256 #define XSLT_RUNTIME_EXTRA_FREE(ctxt, nr) (ctxt)->extras[(nr)].deallocate
258 * XSLT_RUNTIME_EXTRA:
259 * @ctxt: the transformation context
262 * Macro used to define extra information stored in the context
264 #define XSLT_RUNTIME_EXTRA(ctxt, nr, typ) (ctxt)->extras[(nr)].val.typ
269 * The in-memory structure corresponding to an XSLT Template.
271 typedef struct _xsltTemplate xsltTemplate
;
272 typedef xsltTemplate
*xsltTemplatePtr
;
273 struct _xsltTemplate
{
274 struct _xsltTemplate
*next
;/* chained list sorted by priority */
275 struct _xsltStylesheet
*style
;/* the containing stylesheet */
276 xmlChar
*match
; /* the matching string */
277 float priority
; /* as given from the stylesheet, not computed */
278 const xmlChar
*name
; /* the local part of the name QName */
279 const xmlChar
*nameURI
; /* the URI part of the name QName */
280 const xmlChar
*mode
;/* the local part of the mode QName */
281 const xmlChar
*modeURI
;/* the URI part of the mode QName */
282 xmlNodePtr content
; /* the template replacement value */
283 xmlNodePtr elem
; /* the source element */
286 * TODO: @inheritedNsNr and @inheritedNs won't be used in the
289 int inheritedNsNr
; /* number of inherited namespaces */
290 xmlNsPtr
*inheritedNs
;/* inherited non-excluded namespaces */
292 /* Profiling informations */
293 int nbCalls
; /* the number of time the template was called */
294 unsigned long time
; /* the time spent in this template */
295 void *params
; /* xsl:param instructions */
301 * Data structure of decimal-format.
303 typedef struct _xsltDecimalFormat xsltDecimalFormat
;
304 typedef xsltDecimalFormat
*xsltDecimalFormatPtr
;
305 struct _xsltDecimalFormat
{
306 struct _xsltDecimalFormat
*next
; /* chained list */
308 /* Used for interpretation of pattern */
310 xmlChar
*patternSeparator
;
311 /* May appear in result */
314 xmlChar
*noNumber
; /* Not-a-number */
315 /* Used for interpretation of pattern and may appear in result */
316 xmlChar
*decimalPoint
;
326 * Data structure associated to a parsed document.
328 typedef struct _xsltDocument xsltDocument
;
329 typedef xsltDocument
*xsltDocumentPtr
;
330 struct _xsltDocument
{
331 struct _xsltDocument
*next
; /* documents are kept in a chained list */
332 int main
; /* is this the main document */
333 xmlDocPtr doc
; /* the parsed document */
334 void *keys
; /* key tables storage */
335 struct _xsltDocument
*includes
; /* subsidiary includes */
336 int preproc
; /* pre-processing already done */
343 * Representation of an xsl:key.
345 typedef struct _xsltKeyDef xsltKeyDef
;
346 typedef xsltKeyDef
*xsltKeyDefPtr
;
348 struct _xsltKeyDef
*next
;
354 xmlXPathCompExprPtr comp
;
355 xmlXPathCompExprPtr usecomp
;
356 xmlNsPtr
*nsList
; /* the namespaces in scope */
357 int nsNr
; /* the number of namespaces in scope */
363 * Holds the computed keys for key definitions of the same QName.
364 * Is owned by an xsltDocument.
366 typedef struct _xsltKeyTable xsltKeyTable
;
367 typedef xsltKeyTable
*xsltKeyTablePtr
;
368 struct _xsltKeyTable
{
369 struct _xsltKeyTable
*next
;
372 xmlHashTablePtr keys
;
376 * The in-memory structure corresponding to an XSLT Stylesheet.
377 * NOTE: most of the content is simply linked from the doc tree
378 * structure, no specific allocation is made.
380 typedef struct _xsltStylesheet xsltStylesheet
;
381 typedef xsltStylesheet
*xsltStylesheetPtr
;
383 typedef struct _xsltTransformContext xsltTransformContext
;
384 typedef xsltTransformContext
*xsltTransformContextPtr
;
389 * The in-memory structure corresponding to element precomputed data,
390 * designed to be extended by extension implementors.
392 typedef struct _xsltElemPreComp xsltElemPreComp
;
393 typedef xsltElemPreComp
*xsltElemPreCompPtr
;
396 * xsltTransformFunction:
397 * @ctxt: the XSLT transformation context
398 * @node: the input node
399 * @inst: the stylesheet node
400 * @comp: the compiled information from the stylesheet
402 * Signature of the function associated to elements part of the
403 * stylesheet language like xsl:if or xsl:apply-templates.
405 typedef void (*xsltTransformFunction
) (xsltTransformContextPtr ctxt
,
408 xsltElemPreCompPtr comp
);
412 * @ctxt: a transformation context
413 * @sorts: the node-set to sort
414 * @nbsorts: the number of sorts
416 * Signature of the function to use during sorting
418 typedef void (*xsltSortFunc
) (xsltTransformContextPtr ctxt
, xmlNodePtr
*sorts
,
432 XSLT_FUNC_APPLYIMPORTS
,
433 XSLT_FUNC_CALLTEMPLATE
,
434 XSLT_FUNC_APPLYTEMPLATES
,
444 #ifdef XSLT_REFACTORED
451 XSLT_FUNC_LITERAL_RESULT_ELEMENT
,
452 XSLT_FUNC_UNKOWN_FORWARDS_COMPAT
457 * xsltElemPreCompDeallocator:
458 * @comp: the #xsltElemPreComp to free up
460 * Deallocates an #xsltElemPreComp structure.
462 typedef void (*xsltElemPreCompDeallocator
) (xsltElemPreCompPtr comp
);
467 * The basic structure for compiled items of the AST of the XSLT processor.
468 * This structure is also intended to be extended by extension implementors.
469 * TODO: This is somehow not nice, since it has a "free" field, which
470 * derived stylesheet-structs do not have.
472 struct _xsltElemPreComp
{
473 xsltElemPreCompPtr next
; /* next item in the global chained
474 list hold by xsltStylesheet. */
475 xsltStyleType type
; /* type of the element */
476 xsltTransformFunction func
; /* handling function */
477 xmlNodePtr inst
; /* the node in the stylesheet's tree
478 corresponding to this item */
480 /* end of common part */
481 xsltElemPreCompDeallocator free
; /* the deallocator */
487 * The abstract basic structure for items of the XSLT processor.
489 * 1) compiled forms of XSLT instructions (xsl:if, xsl:attribute, etc.)
490 * 2) compiled forms of literal result elements
491 * 3) compiled forms of extension elements
493 typedef struct _xsltStylePreComp xsltStylePreComp
;
494 typedef xsltStylePreComp
*xsltStylePreCompPtr
;
496 #ifdef XSLT_REFACTORED
499 * Some pointer-list utility functions.
501 XSLTPUBFUN xsltPointerListPtr XSLTCALL
502 xsltPointerListCreate (int initialSize
);
503 XSLTPUBFUN
void XSLTCALL
504 xsltPointerListFree (xsltPointerListPtr list
);
505 XSLTPUBFUN
void XSLTCALL
506 xsltPointerListClear (xsltPointerListPtr list
);
507 XSLTPUBFUN
int XSLTCALL
508 xsltPointerListAddSize (xsltPointerListPtr list
,
512 /************************************************************************
514 * Refactored structures *
516 ************************************************************************/
518 typedef struct _xsltNsListContainer xsltNsListContainer
;
519 typedef xsltNsListContainer
*xsltNsListContainerPtr
;
520 struct _xsltNsListContainer
{
527 * XSLT_ITEM_COMPATIBILITY_FIELDS:
529 * Fields for API compatibility to the structure
530 * _xsltElemPreComp which is used for extension functions.
531 * Note that @next is used for storage; it does not reflect a next
532 * sibling in the tree.
533 * TODO: Evaluate if we really need such a compatibility.
535 #define XSLT_ITEM_COMPATIBILITY_FIELDS \
536 xsltElemPreCompPtr next;\
538 xsltTransformFunction func;\
542 * XSLT_ITEM_NAVIGATION_FIELDS:
545 * TODO: It is intended to hold navigational fields in the future.
547 #define XSLT_ITEM_NAVIGATION_FIELDS
549 xsltStylePreCompPtr parent;\
550 xsltStylePreCompPtr children;\
551 xsltStylePreCompPtr nextItem;
555 * XSLT_ITEM_NSINSCOPE_FIELDS:
557 * The in-scope namespaces.
559 #define XSLT_ITEM_NSINSCOPE_FIELDS xsltNsListContainerPtr inScopeNs;
562 * XSLT_ITEM_COMMON_FIELDS:
564 * Common fields used for all items.
566 #define XSLT_ITEM_COMMON_FIELDS \
567 XSLT_ITEM_COMPATIBILITY_FIELDS \
568 XSLT_ITEM_NAVIGATION_FIELDS \
569 XSLT_ITEM_NSINSCOPE_FIELDS
574 * The abstract basic structure for items of the XSLT processor.
576 * 1) compiled forms of XSLT instructions (e.g. xsl:if, xsl:attribute, etc.)
577 * 2) compiled forms of literal result elements
578 * 3) various properties for XSLT instructions (e.g. xsl:when,
581 * REVISIT TODO: Keep this structure equal to the fields
582 * defined by XSLT_ITEM_COMMON_FIELDS
584 struct _xsltStylePreComp
{
585 xsltElemPreCompPtr next
; /* next item in the global chained
586 list hold by xsltStylesheet */
587 xsltStyleType type
; /* type of the item */
588 xsltTransformFunction func
; /* handling function */
589 xmlNodePtr inst
; /* the node in the stylesheet's tree
590 corresponding to this item. */
591 /* Currently no navigational fields. */
592 xsltNsListContainerPtr inScopeNs
;
596 * xsltStyleBasicEmptyItem:
598 * Abstract structure only used as a short-cut for
599 * XSLT items with no extra fields.
600 * NOTE that it is intended that this structure looks the same as
603 typedef struct _xsltStyleBasicEmptyItem xsltStyleBasicEmptyItem
;
604 typedef xsltStyleBasicEmptyItem
*xsltStyleBasicEmptyItemPtr
;
606 struct _xsltStyleBasicEmptyItem
{
607 XSLT_ITEM_COMMON_FIELDS
611 * xsltStyleBasicExpressionItem:
613 * Abstract structure only used as a short-cut for
614 * XSLT items with just an expression.
616 typedef struct _xsltStyleBasicExpressionItem xsltStyleBasicExpressionItem
;
617 typedef xsltStyleBasicExpressionItem
*xsltStyleBasicExpressionItemPtr
;
619 struct _xsltStyleBasicExpressionItem
{
620 XSLT_ITEM_COMMON_FIELDS
622 const xmlChar
*select
; /* TODO: Change this to "expression". */
623 xmlXPathCompExprPtr comp
; /* TODO: Change this to compExpr. */
626 /************************************************************************
628 * XSLT-instructions/declarations *
630 ************************************************************************/
633 * xsltStyleItemElement:
635 * <!-- Category: instruction -->
638 * namespace = { uri-reference }
639 * use-attribute-sets = qnames>
640 * <!-- Content: template -->
643 typedef struct _xsltStyleItemElement xsltStyleItemElement
;
644 typedef xsltStyleItemElement
*xsltStyleItemElementPtr
;
646 struct _xsltStyleItemElement
{
647 XSLT_ITEM_COMMON_FIELDS
654 const xmlChar
*nsPrefix
;
659 * xsltStyleItemAttribute:
661 * <!-- Category: instruction -->
664 * namespace = { uri-reference }>
665 * <!-- Content: template -->
668 typedef struct _xsltStyleItemAttribute xsltStyleItemAttribute
;
669 typedef xsltStyleItemAttribute
*xsltStyleItemAttributePtr
;
671 struct _xsltStyleItemAttribute
{
672 XSLT_ITEM_COMMON_FIELDS
676 const xmlChar
*nsPrefix
;
683 * <!-- Category: instruction -->
685 * disable-output-escaping = "yes" | "no">
686 * <!-- Content: #PCDATA -->
689 typedef struct _xsltStyleItemText xsltStyleItemText
;
690 typedef xsltStyleItemText
*xsltStyleItemTextPtr
;
692 struct _xsltStyleItemText
{
693 XSLT_ITEM_COMMON_FIELDS
694 int noescape
; /* text */
698 * xsltStyleItemComment:
700 * <!-- Category: instruction -->
702 * <!-- Content: template -->
705 typedef xsltStyleBasicEmptyItem xsltStyleItemComment
;
706 typedef xsltStyleItemComment
*xsltStyleItemCommentPtr
;
711 * <!-- Category: instruction -->
712 * <xsl:processing-instruction
714 * <!-- Content: template -->
715 * </xsl:processing-instruction>
717 typedef struct _xsltStyleItemPI xsltStyleItemPI
;
718 typedef xsltStyleItemPI
*xsltStyleItemPIPtr
;
720 struct _xsltStyleItemPI
{
721 XSLT_ITEM_COMMON_FIELDS
727 * xsltStyleItemApplyImports:
729 * <!-- Category: instruction -->
730 * <xsl:apply-imports />
732 typedef xsltStyleBasicEmptyItem xsltStyleItemApplyImports
;
733 typedef xsltStyleItemApplyImports
*xsltStyleItemApplyImportsPtr
;
736 * xsltStyleItemApplyTemplates:
738 * <!-- Category: instruction -->
739 * <xsl:apply-templates
740 * select = node-set-expression
742 * <!-- Content: (xsl:sort | xsl:with-param)* -->
743 * </xsl:apply-templates>
745 typedef struct _xsltStyleItemApplyTemplates xsltStyleItemApplyTemplates
;
746 typedef xsltStyleItemApplyTemplates
*xsltStyleItemApplyTemplatesPtr
;
748 struct _xsltStyleItemApplyTemplates
{
749 XSLT_ITEM_COMMON_FIELDS
751 const xmlChar
*mode
; /* apply-templates */
752 const xmlChar
*modeURI
; /* apply-templates */
753 const xmlChar
*select
; /* sort, copy-of, value-of, apply-templates */
754 xmlXPathCompExprPtr comp
; /* a precompiled XPath expression */
755 /* TODO: with-params */
759 * xsltStyleItemCallTemplate:
761 * <!-- Category: instruction -->
764 * <!-- Content: xsl:with-param* -->
765 * </xsl:call-template>
767 typedef struct _xsltStyleItemCallTemplate xsltStyleItemCallTemplate
;
768 typedef xsltStyleItemCallTemplate
*xsltStyleItemCallTemplatePtr
;
770 struct _xsltStyleItemCallTemplate
{
771 XSLT_ITEM_COMMON_FIELDS
773 xsltTemplatePtr templ
; /* call-template */
774 const xmlChar
*name
; /* element, attribute, pi */
775 int has_name
; /* element, attribute, pi */
776 const xmlChar
*ns
; /* element */
777 int has_ns
; /* element */
778 /* TODO: with-params */
784 * <!-- Category: instruction -->
786 * use-attribute-sets = qnames>
787 * <!-- Content: template -->
790 typedef struct _xsltStyleItemCopy xsltStyleItemCopy
;
791 typedef xsltStyleItemCopy
*xsltStyleItemCopyPtr
;
793 struct _xsltStyleItemCopy
{
794 XSLT_ITEM_COMMON_FIELDS
795 const xmlChar
*use
; /* copy, element */
796 int has_use
; /* copy, element */
802 * <!-- Category: instruction -->
804 * test = boolean-expression>
805 * <!-- Content: template -->
808 typedef struct _xsltStyleItemIf xsltStyleItemIf
;
809 typedef xsltStyleItemIf
*xsltStyleItemIfPtr
;
811 struct _xsltStyleItemIf
{
812 XSLT_ITEM_COMMON_FIELDS
814 const xmlChar
*test
; /* if */
815 xmlXPathCompExprPtr comp
; /* a precompiled XPath expression */
820 * xsltStyleItemCopyOf:
822 * <!-- Category: instruction -->
824 * select = expression />
826 typedef xsltStyleBasicExpressionItem xsltStyleItemCopyOf
;
827 typedef xsltStyleItemCopyOf
*xsltStyleItemCopyOfPtr
;
830 * xsltStyleItemValueOf:
832 * <!-- Category: instruction -->
834 * select = string-expression
835 * disable-output-escaping = "yes" | "no" />
837 typedef struct _xsltStyleItemValueOf xsltStyleItemValueOf
;
838 typedef xsltStyleItemValueOf
*xsltStyleItemValueOfPtr
;
840 struct _xsltStyleItemValueOf
{
841 XSLT_ITEM_COMMON_FIELDS
843 const xmlChar
*select
;
844 xmlXPathCompExprPtr comp
; /* a precompiled XPath expression */
849 * xsltStyleItemNumber:
851 * <!-- Category: instruction -->
853 * level = "single" | "multiple" | "any"
856 * value = number-expression
857 * format = { string }
859 * letter-value = { "alphabetic" | "traditional" }
860 * grouping-separator = { char }
861 * grouping-size = { number } />
863 typedef struct _xsltStyleItemNumber xsltStyleItemNumber
;
864 typedef xsltStyleItemNumber
*xsltStyleItemNumberPtr
;
866 struct _xsltStyleItemNumber
{
867 XSLT_ITEM_COMMON_FIELDS
868 xsltNumberData numdata
; /* number */
872 * xsltStyleItemChoose:
874 * <!-- Category: instruction -->
876 * <!-- Content: (xsl:when+, xsl:otherwise?) -->
879 typedef xsltStyleBasicEmptyItem xsltStyleItemChoose
;
880 typedef xsltStyleItemChoose
*xsltStyleItemChoosePtr
;
883 * xsltStyleItemFallback:
885 * <!-- Category: instruction -->
887 * <!-- Content: template -->
890 typedef xsltStyleBasicEmptyItem xsltStyleItemFallback
;
891 typedef xsltStyleItemFallback
*xsltStyleItemFallbackPtr
;
894 * xsltStyleItemForEach:
896 * <!-- Category: instruction -->
898 * select = node-set-expression>
899 * <!-- Content: (xsl:sort*, template) -->
902 typedef xsltStyleBasicExpressionItem xsltStyleItemForEach
;
903 typedef xsltStyleItemForEach
*xsltStyleItemForEachPtr
;
906 * xsltStyleItemMessage:
908 * <!-- Category: instruction -->
910 * terminate = "yes" | "no">
911 * <!-- Content: template -->
914 typedef struct _xsltStyleItemMessage xsltStyleItemMessage
;
915 typedef xsltStyleItemMessage
*xsltStyleItemMessagePtr
;
917 struct _xsltStyleItemMessage
{
918 XSLT_ITEM_COMMON_FIELDS
923 * xsltStyleItemDocument:
925 * NOTE: This is not an instruction of XSLT 1.0.
927 typedef struct _xsltStyleItemDocument xsltStyleItemDocument
;
928 typedef xsltStyleItemDocument
*xsltStyleItemDocumentPtr
;
930 struct _xsltStyleItemDocument
{
931 XSLT_ITEM_COMMON_FIELDS
932 int ver11
; /* assigned: in xsltDocumentComp;
934 TODO: Check if we need. */
935 const xmlChar
*filename
; /* document URL */
939 /************************************************************************
941 * Non-instructions (actually properties of instructions/declarations) *
943 ************************************************************************/
946 * xsltStyleBasicItemVariable:
948 * Basic struct for xsl:variable, xsl:param and xsl:with-param.
949 * It's currently important to have equal fields, since
950 * xsltParseStylesheetCallerParam() is used with xsl:with-param from
951 * the xslt side and with xsl:param from the exslt side (in
952 * exsltFuncFunctionFunction()).
954 * FUTURE NOTE: In XSLT 2.0 xsl:param, xsl:variable and xsl:with-param
955 * have additional different fields.
957 typedef struct _xsltStyleBasicItemVariable xsltStyleBasicItemVariable
;
958 typedef xsltStyleBasicItemVariable
*xsltStyleBasicItemVariablePtr
;
960 struct _xsltStyleBasicItemVariable
{
961 XSLT_ITEM_COMMON_FIELDS
963 const xmlChar
*select
;
964 xmlXPathCompExprPtr comp
;
973 * xsltStyleItemVariable:
975 * <!-- Category: top-level-element -->
978 * select = expression>
979 * <!-- Content: template -->
982 typedef xsltStyleBasicItemVariable xsltStyleItemVariable
;
983 typedef xsltStyleItemVariable
*xsltStyleItemVariablePtr
;
986 * xsltStyleItemParam:
988 * <!-- Category: top-level-element -->
991 * select = expression>
992 * <!-- Content: template -->
995 typedef struct _xsltStyleItemParam xsltStyleItemParam
;
996 typedef xsltStyleItemParam
*xsltStyleItemParamPtr
;
998 struct _xsltStyleItemParam
{
999 XSLT_ITEM_COMMON_FIELDS
1001 const xmlChar
*select
;
1002 xmlXPathCompExprPtr comp
;
1004 const xmlChar
*name
;
1011 * xsltStyleItemWithParam:
1015 * select = expression>
1016 * <!-- Content: template -->
1019 typedef xsltStyleBasicItemVariable xsltStyleItemWithParam
;
1020 typedef xsltStyleItemWithParam
*xsltStyleItemWithParamPtr
;
1023 * xsltStyleItemSort:
1025 * Reflects the XSLT xsl:sort item.
1026 * Allowed parents: xsl:apply-templates, xsl:for-each
1028 * select = string-expression
1029 * lang = { nmtoken }
1030 * data-type = { "text" | "number" | qname-but-not-ncname }
1031 * order = { "ascending" | "descending" }
1032 * case-order = { "upper-first" | "lower-first" } />
1034 typedef struct _xsltStyleItemSort xsltStyleItemSort
;
1035 typedef xsltStyleItemSort
*xsltStyleItemSortPtr
;
1037 struct _xsltStyleItemSort
{
1038 XSLT_ITEM_COMMON_FIELDS
1040 const xmlChar
*stype
; /* sort */
1041 int has_stype
; /* sort */
1042 int number
; /* sort */
1043 const xmlChar
*order
; /* sort */
1044 int has_order
; /* sort */
1045 int descending
; /* sort */
1046 const xmlChar
*lang
; /* sort */
1047 int has_lang
; /* sort */
1048 const xmlChar
*case_order
; /* sort */
1049 int lower_first
; /* sort */
1054 const xmlChar
*select
; /* sort, copy-of, value-of, apply-templates */
1056 xmlXPathCompExprPtr comp
; /* a precompiled XPath expression */
1061 * xsltStyleItemWhen:
1064 * test = boolean-expression>
1065 * <!-- Content: template -->
1067 * Allowed parent: xsl:choose
1069 typedef struct _xsltStyleItemWhen xsltStyleItemWhen
;
1070 typedef xsltStyleItemWhen
*xsltStyleItemWhenPtr
;
1072 struct _xsltStyleItemWhen
{
1073 XSLT_ITEM_COMMON_FIELDS
1075 const xmlChar
*test
;
1076 xmlXPathCompExprPtr comp
;
1080 * xsltStyleItemOtherwise:
1082 * Allowed parent: xsl:choose
1084 * <!-- Content: template -->
1087 typedef struct _xsltStyleItemOtherwise xsltStyleItemOtherwise
;
1088 typedef xsltStyleItemOtherwise
*xsltStyleItemOtherwisePtr
;
1090 struct _xsltStyleItemOtherwise
{
1091 XSLT_ITEM_COMMON_FIELDS
1094 typedef struct _xsltStyleItemInclude xsltStyleItemInclude
;
1095 typedef xsltStyleItemInclude
*xsltStyleItemIncludePtr
;
1097 struct _xsltStyleItemInclude
{
1098 XSLT_ITEM_COMMON_FIELDS
1099 xsltDocumentPtr include
;
1102 /************************************************************************
1104 * XSLT elements in forwards-compatible mode *
1106 ************************************************************************/
1108 typedef struct _xsltStyleItemUknown xsltStyleItemUknown
;
1109 typedef xsltStyleItemUknown
*xsltStyleItemUknownPtr
;
1110 struct _xsltStyleItemUknown
{
1111 XSLT_ITEM_COMMON_FIELDS
1115 /************************************************************************
1117 * Extension elements *
1119 ************************************************************************/
1122 * xsltStyleItemExtElement:
1124 * Reflects extension elements.
1126 * NOTE: Due to the fact that the structure xsltElemPreComp is most
1127 * probably already heavily in use out there by users, so we cannot
1128 * easily change it, we'll create an intermediate structure which will
1129 * hold an xsltElemPreCompPtr.
1130 * BIG NOTE: The only problem I see here is that the user processes the
1131 * content of the stylesheet tree, possibly he'll lookup the node->psvi
1132 * fields in order to find subsequent extension functions.
1133 * In this case, the user's code will break, since the node->psvi
1134 * field will hold now the xsltStyleItemExtElementPtr and not
1135 * the xsltElemPreCompPtr.
1136 * However the place where the structure is anchored in the node-tree,
1137 * namely node->psvi, has beed already once been moved from node->_private
1138 * to node->psvi, so we have a precedent here, which, I think, should allow
1139 * us to change such semantics without headaches.
1141 typedef struct _xsltStyleItemExtElement xsltStyleItemExtElement
;
1142 typedef xsltStyleItemExtElement
*xsltStyleItemExtElementPtr
;
1143 struct _xsltStyleItemExtElement
{
1144 XSLT_ITEM_COMMON_FIELDS
1145 xsltElemPreCompPtr item
;
1148 /************************************************************************
1150 * Literal result elements *
1152 ************************************************************************/
1154 typedef struct _xsltEffectiveNs xsltEffectiveNs
;
1155 typedef xsltEffectiveNs
*xsltEffectiveNsPtr
;
1156 struct _xsltEffectiveNs
{
1157 xsltEffectiveNsPtr nextInStore
; /* storage next */
1158 xsltEffectiveNsPtr next
; /* next item in the list */
1159 const xmlChar
*prefix
;
1160 const xmlChar
*nsName
;
1162 * Indicates if eclared on the literal result element; dunno if really
1169 * Info for literal result elements.
1170 * This will be set on the elem->psvi field and will be
1171 * shared by literal result elements, which have the same
1172 * excluded result namespaces; i.e., this *won't* be created uniquely
1173 * for every literal result element.
1175 typedef struct _xsltStyleItemLRElementInfo xsltStyleItemLRElementInfo
;
1176 typedef xsltStyleItemLRElementInfo
*xsltStyleItemLRElementInfoPtr
;
1177 struct _xsltStyleItemLRElementInfo
{
1178 XSLT_ITEM_COMMON_FIELDS
1180 * @effectiveNs is the set of effective ns-nodes
1181 * on the literal result element, which will be added to the result
1182 * element if not already existing in the result tree.
1183 * This means that excluded namespaces (via exclude-result-prefixes,
1184 * extension-element-prefixes and the XSLT namespace) not added
1186 * Namespace-aliasing was applied on the @effectiveNs.
1188 xsltEffectiveNsPtr effectiveNs
;
1192 #ifdef XSLT_REFACTORED
1194 typedef struct _xsltNsAlias xsltNsAlias
;
1195 typedef xsltNsAlias
*xsltNsAliasPtr
;
1196 struct _xsltNsAlias
{
1197 xsltNsAliasPtr next
; /* next in the list */
1200 xmlDocPtr docOfTargetNs
;
1204 #ifdef XSLT_REFACTORED_XSLT_NSCOMP
1206 typedef struct _xsltNsMap xsltNsMap
;
1207 typedef xsltNsMap
*xsltNsMapPtr
;
1209 xsltNsMapPtr next
; /* next in the list */
1211 xmlNodePtr elem
; /* the element holding the ns-decl */
1212 xmlNsPtr ns
; /* the xmlNs structure holding the XML namespace name */
1213 const xmlChar
*origNsName
; /* the original XML namespace name */
1214 const xmlChar
*newNsName
; /* the mapped XML namespace name */
1218 /************************************************************************
1220 * Compile-time structures for *internal* use only *
1222 ************************************************************************/
1224 typedef struct _xsltPrincipalStylesheetData xsltPrincipalStylesheetData
;
1225 typedef xsltPrincipalStylesheetData
*xsltPrincipalStylesheetDataPtr
;
1227 typedef struct _xsltNsList xsltNsList
;
1228 typedef xsltNsList
*xsltNsListPtr
;
1229 struct _xsltNsList
{
1230 xsltNsListPtr next
; /* next in the list */
1237 * Used at compilation time for parameters and variables.
1239 typedef struct _xsltVarInfo xsltVarInfo
;
1240 typedef xsltVarInfo
*xsltVarInfoPtr
;
1241 struct _xsltVarInfo
{
1242 xsltVarInfoPtr next
; /* next in the list */
1243 xsltVarInfoPtr prev
;
1244 int depth
; /* the depth in the tree */
1245 const xmlChar
*name
;
1246 const xmlChar
*nsName
;
1249 #define XSLT_ELEMENT_CATEGORY_XSLT 0
1250 #define XSLT_ELEMENT_CATEGORY_EXTENSION 1
1251 #define XSLT_ELEMENT_CATEGORY_LRE 2
1254 * xsltCompilerNodeInfo:
1256 * Per-node information during compile-time.
1258 typedef struct _xsltCompilerNodeInfo xsltCompilerNodeInfo
;
1259 typedef xsltCompilerNodeInfo
*xsltCompilerNodeInfoPtr
;
1260 struct _xsltCompilerNodeInfo
{
1261 xsltCompilerNodeInfoPtr next
;
1262 xsltCompilerNodeInfoPtr prev
;
1265 xsltTemplatePtr templ
; /* The owning template */
1266 int category
; /* XSLT element, LR-element or
1267 extension element */
1269 xsltElemPreCompPtr item
; /* The compiled information */
1270 /* The current in-scope namespaces */
1271 xsltNsListContainerPtr inScopeNs
;
1272 /* The current excluded result namespaces */
1273 xsltPointerListPtr exclResultNs
;
1274 /* The current extension instruction namespaces */
1275 xsltPointerListPtr extElemNs
;
1277 /* The current info for literal result elements. */
1278 xsltStyleItemLRElementInfoPtr litResElemInfo
;
1280 * Set to 1 if in-scope namespaces changed,
1281 * or excluded result namespaces changed,
1282 * or extension element namespaces changed.
1283 * This will trigger creation of new infos
1284 * for literal result elements.
1287 int preserveWhitespace
;
1288 int stripWhitespace
;
1289 int isRoot
; /* whether this is the stylesheet's root node */
1290 int forwardsCompat
; /* whether forwards-compatible mode is enabled */
1291 /* whether the content of an extension element was processed */
1292 int extContentHandled
;
1293 /* the type of the current child */
1294 xsltStyleType curChildType
;
1300 * get pointer to compiler context
1302 #define XSLT_CCTXT(style) ((xsltCompilerCtxtPtr) style->compCtxt)
1305 XSLT_ERROR_SEVERITY_ERROR
= 0,
1306 XSLT_ERROR_SEVERITY_WARNING
1307 } xsltErrorSeverityType
;
1309 typedef struct _xsltCompilerCtxt xsltCompilerCtxt
;
1310 typedef xsltCompilerCtxt
*xsltCompilerCtxtPtr
;
1311 struct _xsltCompilerCtxt
{
1312 void *errorCtxt
; /* user specific error context */
1314 * used for error/warning reports; e.g. XSLT_ERROR_SEVERITY_WARNING */
1315 xsltErrorSeverityType errSeverity
;
1316 int warnings
; /* TODO: number of warnings found at
1318 int errors
; /* TODO: number of errors found at
1321 xsltStylesheetPtr style
;
1322 int simplified
; /* whether this is a simplified stylesheet */
1323 /* TODO: structured/unstructured error contexts. */
1324 int depth
; /* Current depth of processing */
1326 xsltCompilerNodeInfoPtr inode
;
1327 xsltCompilerNodeInfoPtr inodeList
;
1328 xsltCompilerNodeInfoPtr inodeLast
;
1329 xsltPointerListPtr tmpList
; /* Used for various purposes */
1331 * The XSLT version as specified by the stylesheet's root element.
1334 int hasForwardsCompat
; /* whether forwards-compatible mode was used
1335 in a parsing episode */
1336 int maxNodeInfos
; /* TEMP TODO: just for the interest */
1337 int maxLREs
; /* TEMP TODO: just for the interest */
1339 * In order to keep the old behaviour, applying strict rules of
1340 * the spec can be turned off. This has effect only on special
1341 * mechanisms like whitespace-stripping in the stylesheet.
1344 xsltPrincipalStylesheetDataPtr psData
;
1345 #ifdef XSLT_REFACTORED_XPATHCOMP
1346 xmlXPathContextPtr xpathCtxt
;
1348 xsltStyleItemUknownPtr unknownItem
;
1349 int hasNsAliases
; /* Indicator if there was an xsl:namespace-alias. */
1350 xsltNsAliasPtr nsAliases
;
1351 xsltVarInfoPtr ivars
; /* Storage of local in-scope variables/params. */
1352 xsltVarInfoPtr ivar
; /* topmost local variable/param. */
1355 #else /* XSLT_REFACTORED */
1357 * The old structures before refactoring.
1361 * _xsltStylePreComp:
1363 * The in-memory structure corresponding to XSLT stylesheet constructs
1366 struct _xsltStylePreComp
{
1367 xsltElemPreCompPtr next
; /* chained list */
1368 xsltStyleType type
; /* type of the element */
1369 xsltTransformFunction func
; /* handling function */
1370 xmlNodePtr inst
; /* the instruction */
1373 * Pre computed values.
1376 const xmlChar
*stype
; /* sort */
1377 int has_stype
; /* sort */
1378 int number
; /* sort */
1379 const xmlChar
*order
; /* sort */
1380 int has_order
; /* sort */
1381 int descending
; /* sort */
1382 const xmlChar
*lang
; /* sort */
1383 int has_lang
; /* sort */
1384 const xmlChar
*case_order
; /* sort */
1385 int lower_first
; /* sort */
1387 const xmlChar
*use
; /* copy, element */
1388 int has_use
; /* copy, element */
1390 int noescape
; /* text */
1392 const xmlChar
*name
; /* element, attribute, pi */
1393 int has_name
; /* element, attribute, pi */
1394 const xmlChar
*ns
; /* element */
1395 int has_ns
; /* element */
1397 const xmlChar
*mode
; /* apply-templates */
1398 const xmlChar
*modeURI
; /* apply-templates */
1400 const xmlChar
*test
; /* if */
1402 xsltTemplatePtr templ
; /* call-template */
1404 const xmlChar
*select
; /* sort, copy-of, value-of, apply-templates */
1406 int ver11
; /* document */
1407 const xmlChar
*filename
; /* document URL */
1408 int has_filename
; /* document */
1410 xsltNumberData numdata
; /* number */
1412 xmlXPathCompExprPtr comp
; /* a precompiled XPath expression */
1413 xmlNsPtr
*nsList
; /* the namespaces in scope */
1414 int nsNr
; /* the number of namespaces in scope */
1417 #endif /* XSLT_REFACTORED */
1420 #define XSLT_VAR_GLOBAL 1<<0
1421 #define XSLT_VAR_IN_SELECT 1<<1
1422 #define XSLT_TCTXT_VARIABLE(c) ((xsltStackElemPtr) (c)->contextVariable)
1424 * The in-memory structure corresponding to an XSLT Variable
1427 typedef struct _xsltStackElem xsltStackElem
;
1428 typedef xsltStackElem
*xsltStackElemPtr
;
1429 struct _xsltStackElem
{
1430 struct _xsltStackElem
*next
;/* chained list */
1431 xsltStylePreCompPtr comp
; /* the compiled form */
1432 int computed
; /* was the evaluation done */
1433 const xmlChar
*name
; /* the local part of the name QName */
1434 const xmlChar
*nameURI
; /* the URI part of the name QName */
1435 const xmlChar
*select
; /* the eval string */
1436 xmlNodePtr tree
; /* the sequence constructor if no eval
1437 string or the location */
1438 xmlXPathObjectPtr value
; /* The value if computed */
1439 xmlDocPtr fragment
; /* The Result Tree Fragments (needed for XSLT 1.0)
1440 which are bound to the variable's lifetime. */
1441 int level
; /* the depth in the tree;
1442 -1 if persistent (e.g. a given xsl:with-param) */
1443 xsltTransformContextPtr context
; /* The transformation context; needed to cache
1448 #ifdef XSLT_REFACTORED
1450 struct _xsltPrincipalStylesheetData
{
1452 * Namespace dictionary for ns-prefixes and ns-names:
1453 * TODO: Shared between stylesheets, and XPath mechanisms.
1456 xmlDictPtr namespaceDict
;
1458 * Global list of in-scope namespaces.
1460 xsltPointerListPtr inScopeNamespaces
;
1462 * Global list of information for [xsl:]excluded-result-prefixes.
1464 xsltPointerListPtr exclResultNamespaces
;
1466 * Global list of information for [xsl:]extension-element-prefixes.
1468 xsltPointerListPtr extElemNamespaces
;
1469 xsltEffectiveNsPtr effectiveNs
;
1470 #ifdef XSLT_REFACTORED_XSLT_NSCOMP
1472 * Namespace name map to get rid of string comparison of namespace names.
1481 * Note that we added a @compCtxt field to anchor an stylesheet compilation
1482 * context, since, due to historical reasons, various compile-time function
1483 * take only the stylesheet as argument and not a compilation context.
1485 struct _xsltStylesheet
{
1487 * The stylesheet import relation is kept as a tree.
1489 struct _xsltStylesheet
*parent
;
1490 struct _xsltStylesheet
*next
;
1491 struct _xsltStylesheet
*imports
;
1493 xsltDocumentPtr docList
; /* the include document list */
1496 * General data on the style sheet document.
1498 xmlDocPtr doc
; /* the parsed XML stylesheet */
1499 xmlHashTablePtr stripSpaces
;/* the hash table of the strip-space and
1500 preserve space elements */
1501 int stripAll
; /* strip-space * (1) preserve-space * (-1) */
1502 xmlHashTablePtr cdataSection
;/* the hash table of the cdata-section */
1505 * Global variable or parameters.
1507 xsltStackElemPtr variables
; /* linked list of param and variables */
1510 * Template descriptions.
1512 xsltTemplatePtr templates
; /* the ordered list of templates */
1513 void *templatesHash
; /* hash table or wherever compiled templates
1514 informations are stored */
1515 void *rootMatch
; /* template based on / */
1516 void *keyMatch
; /* template based on key() */
1517 void *elemMatch
; /* template based on * */
1518 void *attrMatch
; /* template based on @* */
1519 void *parentMatch
; /* template based on .. */
1520 void *textMatch
; /* template based on text() */
1521 void *piMatch
; /* template based on processing-instruction() */
1522 void *commentMatch
; /* template based on comment() */
1525 * Namespace aliases.
1526 * NOTE: Not used in the refactored code.
1528 xmlHashTablePtr nsAliases
; /* the namespace alias hash tables */
1533 xmlHashTablePtr attributeSets
;/* the attribute sets hash tables */
1537 * TODO: Eliminate this.
1539 xmlHashTablePtr nsHash
; /* the set of namespaces in use:
1540 ATTENTION: This is used for
1541 execution of XPath expressions; unfortunately
1542 it restricts the stylesheet to have distinct
1544 TODO: We need to get rid of this.
1546 void *nsDefs
; /* ATTENTION TODO: This is currently used to store
1547 xsltExtDefPtr (in extensions.c) and
1554 void *keys
; /* key definitions */
1557 * Output related stuff.
1559 xmlChar
*method
; /* the output method */
1560 xmlChar
*methodURI
; /* associated namespace if any */
1561 xmlChar
*version
; /* version string */
1562 xmlChar
*encoding
; /* encoding string */
1563 int omitXmlDeclaration
; /* omit-xml-declaration = "yes" | "no" */
1566 * Number formatting.
1568 xsltDecimalFormatPtr decimalFormat
;
1569 int standalone
; /* standalone = "yes" | "no" */
1570 xmlChar
*doctypePublic
; /* doctype-public string */
1571 xmlChar
*doctypeSystem
; /* doctype-system string */
1572 int indent
; /* should output being indented */
1573 xmlChar
*mediaType
; /* media-type string */
1576 * Precomputed blocks.
1578 xsltElemPreCompPtr preComps
;/* list of precomputed blocks */
1579 int warnings
; /* number of warnings found at compilation */
1580 int errors
; /* number of errors found at compilation */
1582 xmlChar
*exclPrefix
; /* last excluded prefixes */
1583 xmlChar
**exclPrefixTab
; /* array of excluded prefixes */
1584 int exclPrefixNr
; /* number of excluded prefixes in scope */
1585 int exclPrefixMax
; /* size of the array */
1587 void *_private
; /* user defined data */
1592 xmlHashTablePtr extInfos
; /* the extension data */
1593 int extrasNr
; /* the number of extras required */
1596 * For keeping track of nested includes
1598 xsltDocumentPtr includes
; /* points to last nested include */
1601 * dictionary: shared between stylesheet, context and documents.
1605 * precompiled attribute value templates.
1609 * if namespace-alias has an alias for the default stylesheet prefix
1610 * NOTE: Not used in the refactored code.
1612 const xmlChar
*defaultAlias
;
1614 * bypass pre-processing (already done) (used in imports)
1618 * all document text strings were internalized
1622 * Literal Result Element as Stylesheet c.f. section 2.3
1626 * The principal stylesheet
1628 xsltStylesheetPtr principal
;
1629 #ifdef XSLT_REFACTORED
1631 * Compilation context used during compile-time.
1633 xsltCompilerCtxtPtr compCtxt
; /* TODO: Change this to (void *). */
1635 xsltPrincipalStylesheetDataPtr principalData
;
1639 typedef struct _xsltTransformCache xsltTransformCache
;
1640 typedef xsltTransformCache
*xsltTransformCachePtr
;
1641 struct _xsltTransformCache
{
1644 xsltStackElemPtr stackItems
;
1646 #ifdef XSLT_DEBUG_PROFILE_CACHE
1655 * The in-memory structure corresponding to an XSLT Transformation.
1658 XSLT_OUTPUT_XML
= 0,
1667 } xsltTransformState
;
1669 struct _xsltTransformContext
{
1670 xsltStylesheetPtr style
; /* the stylesheet used */
1671 xsltOutputType type
; /* the type of output */
1673 xsltTemplatePtr templ
; /* the current template */
1674 int templNr
; /* Nb of templates in the stack */
1675 int templMax
; /* Size of the templtes stack */
1676 xsltTemplatePtr
*templTab
; /* the template stack */
1678 xsltStackElemPtr vars
; /* the current variable list */
1679 int varsNr
; /* Nb of variable list in the stack */
1680 int varsMax
; /* Size of the variable list stack */
1681 xsltStackElemPtr
*varsTab
; /* the variable list stack */
1682 int varsBase
; /* the var base for current templ */
1687 xmlHashTablePtr extFunctions
; /* the extension functions */
1688 xmlHashTablePtr extElements
; /* the extension elements */
1689 xmlHashTablePtr extInfos
; /* the extension data */
1691 const xmlChar
*mode
; /* the current mode */
1692 const xmlChar
*modeURI
; /* the current mode URI */
1694 xsltDocumentPtr docList
; /* the document list */
1696 xsltDocumentPtr document
; /* the current source document; can be NULL if an RTF */
1697 xmlNodePtr node
; /* the current node being processed */
1698 xmlNodeSetPtr nodeList
; /* the current node list */
1699 /* xmlNodePtr current; the node */
1701 xmlDocPtr output
; /* the resulting document */
1702 xmlNodePtr insert
; /* the insertion node */
1704 xmlXPathContextPtr xpathCtxt
; /* the XPath context */
1705 xsltTransformState state
; /* the current state */
1710 xmlHashTablePtr globalVars
; /* the global variables and params */
1712 xmlNodePtr inst
; /* the instruction in the stylesheet */
1714 int xinclude
; /* should XInclude be processed */
1716 const char * outputFile
; /* the output URI if known */
1718 int profile
; /* is this run profiled */
1719 long prof
; /* the current profiled value */
1720 int profNr
; /* Nb of templates in the stack */
1721 int profMax
; /* Size of the templtaes stack */
1722 long *profTab
; /* the profile template stack */
1724 void *_private
; /* user defined data */
1726 int extrasNr
; /* the number of extras used */
1727 int extrasMax
; /* the number of extras allocated */
1728 xsltRuntimeExtraPtr extras
; /* extra per runtime informations */
1730 xsltDocumentPtr styleList
; /* the stylesheet docs list */
1731 void * sec
; /* the security preferences if any */
1733 xmlGenericErrorFunc error
; /* a specific error handler */
1734 void * errctx
; /* context for the error handler */
1736 xsltSortFunc sortfunc
; /* a ctxt specific sort routine */
1739 * handling of temporary Result Value Tree
1740 * (XSLT 1.0 term: "Result Tree Fragment")
1742 xmlDocPtr tmpRVT
; /* list of RVT without persistance */
1743 xmlDocPtr persistRVT
; /* list of persistant RVTs */
1744 int ctxtflags
; /* context processing flags */
1747 * Speed optimization when coalescing text nodes
1749 const xmlChar
*lasttext
; /* last text node content */
1750 unsigned int lasttsize
; /* last text node size */
1751 unsigned int lasttuse
; /* last text node use */
1753 * Per Context Debugging
1755 int debugStatus
; /* the context level debug status */
1756 unsigned long* traceCode
; /* pointer to the variable holding the mask */
1758 int parserOptions
; /* parser options xmlParserOption */
1761 * dictionary: shared between stylesheet, context and documents.
1764 xmlDocPtr tmpDoc
; /* Obsolete; not used in the library. */
1766 * all document text strings are internalized
1770 int hasTemplKeyPatterns
;
1771 xsltTemplatePtr currentTemplateRule
; /* the Current Template Rule */
1772 xmlNodePtr initialContextNode
;
1773 xmlDocPtr initialContextDoc
;
1774 xsltTransformCachePtr cache
;
1775 void *contextVariable
; /* the current variable item */
1776 xmlDocPtr localRVT
; /* list of local tree fragments; will be freed when
1777 the instruction which created the fragment
1779 xmlDocPtr localRVTBase
;
1780 int keyInitLevel
; /* Needed to catch recursive keys issues */
1786 * Macro to check if the XSLT processing should be stopped.
1787 * Will return from the function.
1789 #define CHECK_STOPPED if (ctxt->state == XSLT_STATE_STOPPED) return;
1794 * Macro to check if the XSLT processing should be stopped.
1795 * Will goto the error: label.
1797 #define CHECK_STOPPEDE if (ctxt->state == XSLT_STATE_STOPPED) goto error;
1802 * Macro to check if the XSLT processing should be stopped.
1803 * Will return from the function with a 0 value.
1805 #define CHECK_STOPPED0 if (ctxt->state == XSLT_STATE_STOPPED) return(0);
1808 * The macro XML_CAST_FPTR is a hack to avoid a gcc warning about
1809 * possible incompatibilities between function pointers and object
1810 * pointers. It is defined in libxml/hash.h within recent versions
1811 * of libxml2, but is put here for compatibility.
1813 #ifndef XML_CAST_FPTR
1816 * @fptr: pointer to a function
1818 * Macro to do a casting from an object pointer to a
1819 * function pointer without encountering a warning from
1822 * #define XML_CAST_FPTR(fptr) (*(void **)(&fptr))
1823 * This macro violated ISO C aliasing rules (gcc4 on s390 broke)
1824 * so it is disabled now
1827 #define XML_CAST_FPTR(fptr) fptr
1830 * Functions associated to the internal types
1831 xsltDecimalFormatPtr xsltDecimalFormatGetByName(xsltStylesheetPtr sheet,
1834 XSLTPUBFUN xsltStylesheetPtr XSLTCALL
1835 xsltNewStylesheet (void);
1836 XSLTPUBFUN xsltStylesheetPtr XSLTCALL
1837 xsltParseStylesheetFile (const xmlChar
* filename
);
1838 XSLTPUBFUN
void XSLTCALL
1839 xsltFreeStylesheet (xsltStylesheetPtr style
);
1840 XSLTPUBFUN
int XSLTCALL
1841 xsltIsBlank (xmlChar
*str
);
1842 XSLTPUBFUN
void XSLTCALL
1843 xsltFreeStackElemList (xsltStackElemPtr elem
);
1844 XSLTPUBFUN xsltDecimalFormatPtr XSLTCALL
1845 xsltDecimalFormatGetByName(xsltStylesheetPtr style
,
1848 XSLTPUBFUN xsltStylesheetPtr XSLTCALL
1849 xsltParseStylesheetProcess(xsltStylesheetPtr ret
,
1851 XSLTPUBFUN
void XSLTCALL
1852 xsltParseStylesheetOutput(xsltStylesheetPtr style
,
1854 XSLTPUBFUN xsltStylesheetPtr XSLTCALL
1855 xsltParseStylesheetDoc (xmlDocPtr doc
);
1856 XSLTPUBFUN xsltStylesheetPtr XSLTCALL
1857 xsltParseStylesheetImportedDoc(xmlDocPtr doc
,
1858 xsltStylesheetPtr style
);
1859 XSLTPUBFUN xsltStylesheetPtr XSLTCALL
1860 xsltLoadStylesheetPI (xmlDocPtr doc
);
1861 XSLTPUBFUN
void XSLTCALL
1862 xsltNumberFormat (xsltTransformContextPtr ctxt
,
1863 xsltNumberDataPtr data
,
1865 XSLTPUBFUN xmlXPathError XSLTCALL
1866 xsltFormatNumberConversion(xsltDecimalFormatPtr self
,
1871 XSLTPUBFUN
void XSLTCALL
1872 xsltParseTemplateContent(xsltStylesheetPtr style
,
1874 XSLTPUBFUN
int XSLTCALL
1875 xsltAllocateExtra (xsltStylesheetPtr style
);
1876 XSLTPUBFUN
int XSLTCALL
1877 xsltAllocateExtraCtxt (xsltTransformContextPtr ctxt
);
1879 * Extra functions for Result Value Trees
1881 XSLTPUBFUN xmlDocPtr XSLTCALL
1882 xsltCreateRVT (xsltTransformContextPtr ctxt
);
1883 XSLTPUBFUN
int XSLTCALL
1884 xsltRegisterTmpRVT (xsltTransformContextPtr ctxt
,
1886 XSLTPUBFUN
int XSLTCALL
1887 xsltRegisterLocalRVT (xsltTransformContextPtr ctxt
,
1889 XSLTPUBFUN
int XSLTCALL
1890 xsltRegisterPersistRVT (xsltTransformContextPtr ctxt
,
1892 XSLTPUBFUN
int XSLTCALL
1893 xsltExtensionInstructionResultRegister(
1894 xsltTransformContextPtr ctxt
,
1895 xmlXPathObjectPtr obj
);
1896 XSLTPUBFUN
int XSLTCALL
1897 xsltExtensionInstructionResultFinalize(
1898 xsltTransformContextPtr ctxt
);
1899 XSLTPUBFUN
void XSLTCALL
1900 xsltFreeRVTs (xsltTransformContextPtr ctxt
);
1901 XSLTPUBFUN
void XSLTCALL
1902 xsltReleaseRVT (xsltTransformContextPtr ctxt
,
1904 XSLTPUBFUN
int XSLTCALL
1905 xsltTransStorageAdd (xsltTransformContextPtr ctxt
,
1908 XSLTPUBFUN
void * XSLTCALL
1909 xsltTransStorageRemove (xsltTransformContextPtr ctxt
,
1913 * Extra functions for Attribute Value Templates
1915 XSLTPUBFUN
void XSLTCALL
1916 xsltCompileAttr (xsltStylesheetPtr style
,
1918 XSLTPUBFUN xmlChar
* XSLTCALL
1919 xsltEvalAVT (xsltTransformContextPtr ctxt
,
1922 XSLTPUBFUN
void XSLTCALL
1923 xsltFreeAVTList (void *avt
);
1926 * Extra function for successful xsltCleanupGlobals / xsltInit sequence.
1929 XSLTPUBFUN
void XSLTCALL
1932 /************************************************************************
1934 * Compile-time functions for *internal* use only *
1936 ************************************************************************/
1938 #ifdef XSLT_REFACTORED
1939 XSLTPUBFUN
void XSLTCALL
1940 xsltParseSequenceConstructor(
1941 xsltCompilerCtxtPtr cctxt
,
1943 XSLTPUBFUN
int XSLTCALL
1944 xsltParseAnyXSLTElem (xsltCompilerCtxtPtr cctxt
,
1946 #ifdef XSLT_REFACTORED_XSLT_NSCOMP
1947 XSLTPUBFUN
int XSLTCALL
1948 xsltRestoreDocumentNamespaces(
1952 #endif /* XSLT_REFACTORED */
1954 /************************************************************************
1956 * Transformation-time functions for *internal* use only *
1958 ************************************************************************/
1959 XSLTPUBFUN
int XSLTCALL
1960 xsltInitCtxtKey (xsltTransformContextPtr ctxt
,
1961 xsltDocumentPtr doc
,
1962 xsltKeyDefPtr keyd
);
1963 XSLTPUBFUN
int XSLTCALL
1964 xsltInitAllDocKeys (xsltTransformContextPtr ctxt
);
1969 #endif /* __XML_XSLT_H__ */