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 */
107 #ifdef XSLT_REFACTORED_XSLT_NSCOMP
109 extern const xmlChar
*xsltConstNamespaceNameXSLT
;
114 * quick test to detect XSLT elements
116 #define IS_XSLT_ELEM_FAST(n) \
117 (((n) != NULL) && ((n)->ns != NULL) && \
118 ((n)->ns->href == xsltConstNamespaceNameXSLT))
123 * quick test to detect XSLT attributes
125 #define IS_XSLT_ATTR_FAST(a) \
126 (((a) != NULL) && ((a)->ns != NULL) && \
127 ((a)->ns->href == xsltConstNamespaceNameXSLT))
130 * XSLT_HAS_INTERNAL_NSMAP:
132 * check for namespace mapping
134 #define XSLT_HAS_INTERNAL_NSMAP(s) \
135 (((s) != NULL) && ((s)->principal) && \
136 ((s)->principal->principalData) && \
137 ((s)->principal->principalData->nsMap))
140 * XSLT_GET_INTERNAL_NSMAP:
142 * get pointer to namespace map
144 #define XSLT_GET_INTERNAL_NSMAP(s) ((s)->principal->principalData->nsMap)
146 #else /* XSLT_REFACTORED_XSLT_NSCOMP */
151 * quick check whether this is an xslt element
153 #define IS_XSLT_ELEM_FAST(n) \
154 (((n) != NULL) && ((n)->ns != NULL) && \
155 (xmlStrEqual((n)->ns->href, XSLT_NAMESPACE)))
160 * quick check for xslt namespace attribute
162 #define IS_XSLT_ATTR_FAST(a) \
163 (((a) != NULL) && ((a)->ns != NULL) && \
164 (xmlStrEqual((a)->ns->href, XSLT_NAMESPACE)))
167 #endif /* XSLT_REFACTORED_XSLT_NSCOMP */
171 * XSLT_REFACTORED_MANDATORY_VERSION:
173 * TODO: Currently disabled to surpress regression test failures, since
174 * the old behaviour was that a missing version attribute
175 * produced a only a warning and not an error, which was incerrect.
176 * So the regression tests need to be fixed if this is enabled.
178 /* #define XSLT_REFACTORED_MANDATORY_VERSION */
183 * Pointer-list for various purposes.
185 typedef struct _xsltPointerList xsltPointerList
;
186 typedef xsltPointerList
*xsltPointerListPtr
;
187 struct _xsltPointerList
{
196 * XSLT_REFACTORED_PARSING:
198 * Internal define to enable the refactored parts of Libxslt
199 * related to parsing.
201 /* #define XSLT_REFACTORED_PARSING */
206 * Max number of specified xsl:sort on an element.
208 #define XSLT_MAX_SORT 15
211 * XSLT_PAT_NO_PRIORITY:
213 * Specific value for pattern without priority expressed.
215 #define XSLT_PAT_NO_PRIORITY -12345789
220 * Extra information added to the transformation context.
222 typedef struct _xsltRuntimeExtra xsltRuntimeExtra
;
223 typedef xsltRuntimeExtra
*xsltRuntimeExtraPtr
;
224 struct _xsltRuntimeExtra
{
225 void *info
; /* pointer to the extra data */
226 xmlFreeFunc deallocate
; /* pointer to the deallocation routine */
227 union { /* dual-purpose field */
228 void *ptr
; /* data not needing deallocation */
229 int ival
; /* integer value storage */
234 * XSLT_RUNTIME_EXTRA_LST:
235 * @ctxt: the transformation context
238 * Macro used to access extra information stored in the context
240 #define XSLT_RUNTIME_EXTRA_LST(ctxt, nr) (ctxt)->extras[(nr)].info
242 * XSLT_RUNTIME_EXTRA_FREE:
243 * @ctxt: the transformation context
246 * Macro used to free extra information stored in the context
248 #define XSLT_RUNTIME_EXTRA_FREE(ctxt, nr) (ctxt)->extras[(nr)].deallocate
250 * XSLT_RUNTIME_EXTRA:
251 * @ctxt: the transformation context
254 * Macro used to define extra information stored in the context
256 #define XSLT_RUNTIME_EXTRA(ctxt, nr, typ) (ctxt)->extras[(nr)].val.typ
261 * The in-memory structure corresponding to an XSLT Template.
263 typedef struct _xsltTemplate xsltTemplate
;
264 typedef xsltTemplate
*xsltTemplatePtr
;
265 struct _xsltTemplate
{
266 struct _xsltTemplate
*next
;/* chained list sorted by priority */
267 struct _xsltStylesheet
*style
;/* the containing stylesheet */
268 xmlChar
*match
; /* the matching string */
269 float priority
; /* as given from the stylesheet, not computed */
270 const xmlChar
*name
; /* the local part of the name QName */
271 const xmlChar
*nameURI
; /* the URI part of the name QName */
272 const xmlChar
*mode
;/* the local part of the mode QName */
273 const xmlChar
*modeURI
;/* the URI part of the mode QName */
274 xmlNodePtr content
; /* the template replacement value */
275 xmlNodePtr elem
; /* the source element */
278 * TODO: @inheritedNsNr and @inheritedNs won't be used in the
281 int inheritedNsNr
; /* number of inherited namespaces */
282 xmlNsPtr
*inheritedNs
;/* inherited non-excluded namespaces */
284 /* Profiling information */
285 int nbCalls
; /* the number of time the template was called */
286 unsigned long time
; /* the time spent in this template */
287 void *params
; /* xsl:param instructions */
289 int templNr
; /* Nb of templates in the stack */
290 int templMax
; /* Size of the templtes stack */
291 xsltTemplatePtr
*templCalledTab
; /* templates called */
292 int *templCountTab
; /* .. and how often */
294 /* Conflict resolution */
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
;
321 const xmlChar
*nsUri
;
327 * Data structure associated to a parsed document.
329 typedef struct _xsltDocument xsltDocument
;
330 typedef xsltDocument
*xsltDocumentPtr
;
331 struct _xsltDocument
{
332 struct _xsltDocument
*next
; /* documents are kept in a chained list */
333 int main
; /* is this the main document */
334 xmlDocPtr doc
; /* the parsed document */
335 void *keys
; /* key tables storage */
336 struct _xsltDocument
*includes
; /* subsidiary includes */
337 int preproc
; /* pre-processing already done */
344 * Representation of an xsl:key.
346 typedef struct _xsltKeyDef xsltKeyDef
;
347 typedef xsltKeyDef
*xsltKeyDefPtr
;
349 struct _xsltKeyDef
*next
;
355 xmlXPathCompExprPtr comp
;
356 xmlXPathCompExprPtr usecomp
;
357 xmlNsPtr
*nsList
; /* the namespaces in scope */
358 int nsNr
; /* the number of namespaces in scope */
364 * Holds the computed keys for key definitions of the same QName.
365 * Is owned by an xsltDocument.
367 typedef struct _xsltKeyTable xsltKeyTable
;
368 typedef xsltKeyTable
*xsltKeyTablePtr
;
369 struct _xsltKeyTable
{
370 struct _xsltKeyTable
*next
;
373 xmlHashTablePtr keys
;
377 * The in-memory structure corresponding to an XSLT Stylesheet.
378 * NOTE: most of the content is simply linked from the doc tree
379 * structure, no specific allocation is made.
381 typedef struct _xsltStylesheet xsltStylesheet
;
382 typedef xsltStylesheet
*xsltStylesheetPtr
;
384 typedef struct _xsltTransformContext xsltTransformContext
;
385 typedef xsltTransformContext
*xsltTransformContextPtr
;
390 * The in-memory structure corresponding to element precomputed data,
391 * designed to be extended by extension implementors.
393 typedef struct _xsltElemPreComp xsltElemPreComp
;
394 typedef xsltElemPreComp
*xsltElemPreCompPtr
;
397 * xsltTransformFunction:
398 * @ctxt: the XSLT transformation context
399 * @node: the input node
400 * @inst: the stylesheet node
401 * @comp: the compiled information from the stylesheet
403 * Signature of the function associated to elements part of the
404 * stylesheet language like xsl:if or xsl:apply-templates.
406 typedef void (*xsltTransformFunction
) (xsltTransformContextPtr ctxt
,
409 xsltElemPreCompPtr comp
);
413 * @ctxt: a transformation context
414 * @sorts: the node-set to sort
415 * @nbsorts: the number of sorts
417 * Signature of the function to use during sorting
419 typedef void (*xsltSortFunc
) (xsltTransformContextPtr ctxt
, xmlNodePtr
*sorts
,
433 XSLT_FUNC_APPLYIMPORTS
,
434 XSLT_FUNC_CALLTEMPLATE
,
435 XSLT_FUNC_APPLYTEMPLATES
,
445 #ifdef XSLT_REFACTORED
452 XSLT_FUNC_LITERAL_RESULT_ELEMENT
,
453 XSLT_FUNC_UNKOWN_FORWARDS_COMPAT
458 * xsltElemPreCompDeallocator:
459 * @comp: the #xsltElemPreComp to free up
461 * Deallocates an #xsltElemPreComp structure.
463 typedef void (*xsltElemPreCompDeallocator
) (xsltElemPreCompPtr comp
);
468 * The basic structure for compiled items of the AST of the XSLT processor.
469 * This structure is also intended to be extended by extension implementors.
470 * TODO: This is somehow not nice, since it has a "free" field, which
471 * derived stylesheet-structs do not have.
473 struct _xsltElemPreComp
{
474 xsltElemPreCompPtr next
; /* next item in the global chained
475 list held by xsltStylesheet. */
476 xsltStyleType type
; /* type of the element */
477 xsltTransformFunction func
; /* handling function */
478 xmlNodePtr inst
; /* the node in the stylesheet's tree
479 corresponding to this item */
481 /* end of common part */
482 xsltElemPreCompDeallocator free
; /* the deallocator */
488 * The abstract basic structure for items of the XSLT processor.
490 * 1) compiled forms of XSLT instructions (xsl:if, xsl:attribute, etc.)
491 * 2) compiled forms of literal result elements
492 * 3) compiled forms of extension elements
494 typedef struct _xsltStylePreComp xsltStylePreComp
;
495 typedef xsltStylePreComp
*xsltStylePreCompPtr
;
497 #ifdef XSLT_REFACTORED
500 * Some pointer-list utility functions.
502 XSLTPUBFUN xsltPointerListPtr XSLTCALL
503 xsltPointerListCreate (int initialSize
);
504 XSLTPUBFUN
void XSLTCALL
505 xsltPointerListFree (xsltPointerListPtr list
);
506 XSLTPUBFUN
void XSLTCALL
507 xsltPointerListClear (xsltPointerListPtr list
);
508 XSLTPUBFUN
int XSLTCALL
509 xsltPointerListAddSize (xsltPointerListPtr list
,
513 /************************************************************************
515 * Refactored structures *
517 ************************************************************************/
519 typedef struct _xsltNsListContainer xsltNsListContainer
;
520 typedef xsltNsListContainer
*xsltNsListContainerPtr
;
521 struct _xsltNsListContainer
{
528 * XSLT_ITEM_COMPATIBILITY_FIELDS:
530 * Fields for API compatibility to the structure
531 * _xsltElemPreComp which is used for extension functions.
532 * Note that @next is used for storage; it does not reflect a next
533 * sibling in the tree.
534 * TODO: Evaluate if we really need such a compatibility.
536 #define XSLT_ITEM_COMPATIBILITY_FIELDS \
537 xsltElemPreCompPtr next;\
539 xsltTransformFunction func;\
543 * XSLT_ITEM_NAVIGATION_FIELDS:
546 * TODO: It is intended to hold navigational fields in the future.
548 #define XSLT_ITEM_NAVIGATION_FIELDS
550 xsltStylePreCompPtr parent;\
551 xsltStylePreCompPtr children;\
552 xsltStylePreCompPtr nextItem;
556 * XSLT_ITEM_NSINSCOPE_FIELDS:
558 * The in-scope namespaces.
560 #define XSLT_ITEM_NSINSCOPE_FIELDS xsltNsListContainerPtr inScopeNs;
563 * XSLT_ITEM_COMMON_FIELDS:
565 * Common fields used for all items.
567 #define XSLT_ITEM_COMMON_FIELDS \
568 XSLT_ITEM_COMPATIBILITY_FIELDS \
569 XSLT_ITEM_NAVIGATION_FIELDS \
570 XSLT_ITEM_NSINSCOPE_FIELDS
575 * The abstract basic structure for items of the XSLT processor.
577 * 1) compiled forms of XSLT instructions (e.g. xsl:if, xsl:attribute, etc.)
578 * 2) compiled forms of literal result elements
579 * 3) various properties for XSLT instructions (e.g. xsl:when,
582 * REVISIT TODO: Keep this structure equal to the fields
583 * defined by XSLT_ITEM_COMMON_FIELDS
585 struct _xsltStylePreComp
{
586 xsltElemPreCompPtr next
; /* next item in the global chained
587 list held by xsltStylesheet */
588 xsltStyleType type
; /* type of the item */
589 xsltTransformFunction func
; /* handling function */
590 xmlNodePtr inst
; /* the node in the stylesheet's tree
591 corresponding to this item. */
592 /* Currently no navigational fields. */
593 xsltNsListContainerPtr inScopeNs
;
597 * xsltStyleBasicEmptyItem:
599 * Abstract structure only used as a short-cut for
600 * XSLT items with no extra fields.
601 * NOTE that it is intended that this structure looks the same as
604 typedef struct _xsltStyleBasicEmptyItem xsltStyleBasicEmptyItem
;
605 typedef xsltStyleBasicEmptyItem
*xsltStyleBasicEmptyItemPtr
;
607 struct _xsltStyleBasicEmptyItem
{
608 XSLT_ITEM_COMMON_FIELDS
612 * xsltStyleBasicExpressionItem:
614 * Abstract structure only used as a short-cut for
615 * XSLT items with just an expression.
617 typedef struct _xsltStyleBasicExpressionItem xsltStyleBasicExpressionItem
;
618 typedef xsltStyleBasicExpressionItem
*xsltStyleBasicExpressionItemPtr
;
620 struct _xsltStyleBasicExpressionItem
{
621 XSLT_ITEM_COMMON_FIELDS
623 const xmlChar
*select
; /* TODO: Change this to "expression". */
624 xmlXPathCompExprPtr comp
; /* TODO: Change this to compExpr. */
627 /************************************************************************
629 * XSLT-instructions/declarations *
631 ************************************************************************/
634 * xsltStyleItemElement:
636 * <!-- Category: instruction -->
639 * namespace = { uri-reference }
640 * use-attribute-sets = qnames>
641 * <!-- Content: template -->
644 typedef struct _xsltStyleItemElement xsltStyleItemElement
;
645 typedef xsltStyleItemElement
*xsltStyleItemElementPtr
;
647 struct _xsltStyleItemElement
{
648 XSLT_ITEM_COMMON_FIELDS
655 const xmlChar
*nsPrefix
;
660 * xsltStyleItemAttribute:
662 * <!-- Category: instruction -->
665 * namespace = { uri-reference }>
666 * <!-- Content: template -->
669 typedef struct _xsltStyleItemAttribute xsltStyleItemAttribute
;
670 typedef xsltStyleItemAttribute
*xsltStyleItemAttributePtr
;
672 struct _xsltStyleItemAttribute
{
673 XSLT_ITEM_COMMON_FIELDS
677 const xmlChar
*nsPrefix
;
684 * <!-- Category: instruction -->
686 * disable-output-escaping = "yes" | "no">
687 * <!-- Content: #PCDATA -->
690 typedef struct _xsltStyleItemText xsltStyleItemText
;
691 typedef xsltStyleItemText
*xsltStyleItemTextPtr
;
693 struct _xsltStyleItemText
{
694 XSLT_ITEM_COMMON_FIELDS
695 int noescape
; /* text */
699 * xsltStyleItemComment:
701 * <!-- Category: instruction -->
703 * <!-- Content: template -->
706 typedef xsltStyleBasicEmptyItem xsltStyleItemComment
;
707 typedef xsltStyleItemComment
*xsltStyleItemCommentPtr
;
712 * <!-- Category: instruction -->
713 * <xsl:processing-instruction
715 * <!-- Content: template -->
716 * </xsl:processing-instruction>
718 typedef struct _xsltStyleItemPI xsltStyleItemPI
;
719 typedef xsltStyleItemPI
*xsltStyleItemPIPtr
;
721 struct _xsltStyleItemPI
{
722 XSLT_ITEM_COMMON_FIELDS
728 * xsltStyleItemApplyImports:
730 * <!-- Category: instruction -->
731 * <xsl:apply-imports />
733 typedef xsltStyleBasicEmptyItem xsltStyleItemApplyImports
;
734 typedef xsltStyleItemApplyImports
*xsltStyleItemApplyImportsPtr
;
737 * xsltStyleItemApplyTemplates:
739 * <!-- Category: instruction -->
740 * <xsl:apply-templates
741 * select = node-set-expression
743 * <!-- Content: (xsl:sort | xsl:with-param)* -->
744 * </xsl:apply-templates>
746 typedef struct _xsltStyleItemApplyTemplates xsltStyleItemApplyTemplates
;
747 typedef xsltStyleItemApplyTemplates
*xsltStyleItemApplyTemplatesPtr
;
749 struct _xsltStyleItemApplyTemplates
{
750 XSLT_ITEM_COMMON_FIELDS
752 const xmlChar
*mode
; /* apply-templates */
753 const xmlChar
*modeURI
; /* apply-templates */
754 const xmlChar
*select
; /* sort, copy-of, value-of, apply-templates */
755 xmlXPathCompExprPtr comp
; /* a precompiled XPath expression */
756 /* TODO: with-params */
760 * xsltStyleItemCallTemplate:
762 * <!-- Category: instruction -->
765 * <!-- Content: xsl:with-param* -->
766 * </xsl:call-template>
768 typedef struct _xsltStyleItemCallTemplate xsltStyleItemCallTemplate
;
769 typedef xsltStyleItemCallTemplate
*xsltStyleItemCallTemplatePtr
;
771 struct _xsltStyleItemCallTemplate
{
772 XSLT_ITEM_COMMON_FIELDS
774 xsltTemplatePtr templ
; /* call-template */
775 const xmlChar
*name
; /* element, attribute, pi */
776 int has_name
; /* element, attribute, pi */
777 const xmlChar
*ns
; /* element */
778 int has_ns
; /* element */
779 /* TODO: with-params */
785 * <!-- Category: instruction -->
787 * use-attribute-sets = qnames>
788 * <!-- Content: template -->
791 typedef struct _xsltStyleItemCopy xsltStyleItemCopy
;
792 typedef xsltStyleItemCopy
*xsltStyleItemCopyPtr
;
794 struct _xsltStyleItemCopy
{
795 XSLT_ITEM_COMMON_FIELDS
796 const xmlChar
*use
; /* copy, element */
797 int has_use
; /* copy, element */
803 * <!-- Category: instruction -->
805 * test = boolean-expression>
806 * <!-- Content: template -->
809 typedef struct _xsltStyleItemIf xsltStyleItemIf
;
810 typedef xsltStyleItemIf
*xsltStyleItemIfPtr
;
812 struct _xsltStyleItemIf
{
813 XSLT_ITEM_COMMON_FIELDS
815 const xmlChar
*test
; /* if */
816 xmlXPathCompExprPtr comp
; /* a precompiled XPath expression */
821 * xsltStyleItemCopyOf:
823 * <!-- Category: instruction -->
825 * select = expression />
827 typedef xsltStyleBasicExpressionItem xsltStyleItemCopyOf
;
828 typedef xsltStyleItemCopyOf
*xsltStyleItemCopyOfPtr
;
831 * xsltStyleItemValueOf:
833 * <!-- Category: instruction -->
835 * select = string-expression
836 * disable-output-escaping = "yes" | "no" />
838 typedef struct _xsltStyleItemValueOf xsltStyleItemValueOf
;
839 typedef xsltStyleItemValueOf
*xsltStyleItemValueOfPtr
;
841 struct _xsltStyleItemValueOf
{
842 XSLT_ITEM_COMMON_FIELDS
844 const xmlChar
*select
;
845 xmlXPathCompExprPtr comp
; /* a precompiled XPath expression */
850 * xsltStyleItemNumber:
852 * <!-- Category: instruction -->
854 * level = "single" | "multiple" | "any"
857 * value = number-expression
858 * format = { string }
860 * letter-value = { "alphabetic" | "traditional" }
861 * grouping-separator = { char }
862 * grouping-size = { number } />
864 typedef struct _xsltStyleItemNumber xsltStyleItemNumber
;
865 typedef xsltStyleItemNumber
*xsltStyleItemNumberPtr
;
867 struct _xsltStyleItemNumber
{
868 XSLT_ITEM_COMMON_FIELDS
869 xsltNumberData numdata
; /* number */
873 * xsltStyleItemChoose:
875 * <!-- Category: instruction -->
877 * <!-- Content: (xsl:when+, xsl:otherwise?) -->
880 typedef xsltStyleBasicEmptyItem xsltStyleItemChoose
;
881 typedef xsltStyleItemChoose
*xsltStyleItemChoosePtr
;
884 * xsltStyleItemFallback:
886 * <!-- Category: instruction -->
888 * <!-- Content: template -->
891 typedef xsltStyleBasicEmptyItem xsltStyleItemFallback
;
892 typedef xsltStyleItemFallback
*xsltStyleItemFallbackPtr
;
895 * xsltStyleItemForEach:
897 * <!-- Category: instruction -->
899 * select = node-set-expression>
900 * <!-- Content: (xsl:sort*, template) -->
903 typedef xsltStyleBasicExpressionItem xsltStyleItemForEach
;
904 typedef xsltStyleItemForEach
*xsltStyleItemForEachPtr
;
907 * xsltStyleItemMessage:
909 * <!-- Category: instruction -->
911 * terminate = "yes" | "no">
912 * <!-- Content: template -->
915 typedef struct _xsltStyleItemMessage xsltStyleItemMessage
;
916 typedef xsltStyleItemMessage
*xsltStyleItemMessagePtr
;
918 struct _xsltStyleItemMessage
{
919 XSLT_ITEM_COMMON_FIELDS
924 * xsltStyleItemDocument:
926 * NOTE: This is not an instruction of XSLT 1.0.
928 typedef struct _xsltStyleItemDocument xsltStyleItemDocument
;
929 typedef xsltStyleItemDocument
*xsltStyleItemDocumentPtr
;
931 struct _xsltStyleItemDocument
{
932 XSLT_ITEM_COMMON_FIELDS
933 int ver11
; /* assigned: in xsltDocumentComp;
935 TODO: Check if we need. */
936 const xmlChar
*filename
; /* document URL */
940 /************************************************************************
942 * Non-instructions (actually properties of instructions/declarations) *
944 ************************************************************************/
947 * xsltStyleBasicItemVariable:
949 * Basic struct for xsl:variable, xsl:param and xsl:with-param.
950 * It's currently important to have equal fields, since
951 * xsltParseStylesheetCallerParam() is used with xsl:with-param from
952 * the xslt side and with xsl:param from the exslt side (in
953 * exsltFuncFunctionFunction()).
955 * FUTURE NOTE: In XSLT 2.0 xsl:param, xsl:variable and xsl:with-param
956 * have additional different fields.
958 typedef struct _xsltStyleBasicItemVariable xsltStyleBasicItemVariable
;
959 typedef xsltStyleBasicItemVariable
*xsltStyleBasicItemVariablePtr
;
961 struct _xsltStyleBasicItemVariable
{
962 XSLT_ITEM_COMMON_FIELDS
964 const xmlChar
*select
;
965 xmlXPathCompExprPtr comp
;
974 * xsltStyleItemVariable:
976 * <!-- Category: top-level-element -->
979 * select = expression>
980 * <!-- Content: template -->
983 typedef xsltStyleBasicItemVariable xsltStyleItemVariable
;
984 typedef xsltStyleItemVariable
*xsltStyleItemVariablePtr
;
987 * xsltStyleItemParam:
989 * <!-- Category: top-level-element -->
992 * select = expression>
993 * <!-- Content: template -->
996 typedef struct _xsltStyleItemParam xsltStyleItemParam
;
997 typedef xsltStyleItemParam
*xsltStyleItemParamPtr
;
999 struct _xsltStyleItemParam
{
1000 XSLT_ITEM_COMMON_FIELDS
1002 const xmlChar
*select
;
1003 xmlXPathCompExprPtr comp
;
1005 const xmlChar
*name
;
1012 * xsltStyleItemWithParam:
1016 * select = expression>
1017 * <!-- Content: template -->
1020 typedef xsltStyleBasicItemVariable xsltStyleItemWithParam
;
1021 typedef xsltStyleItemWithParam
*xsltStyleItemWithParamPtr
;
1024 * xsltStyleItemSort:
1026 * Reflects the XSLT xsl:sort item.
1027 * Allowed parents: xsl:apply-templates, xsl:for-each
1029 * select = string-expression
1030 * lang = { nmtoken }
1031 * data-type = { "text" | "number" | qname-but-not-ncname }
1032 * order = { "ascending" | "descending" }
1033 * case-order = { "upper-first" | "lower-first" } />
1035 typedef struct _xsltStyleItemSort xsltStyleItemSort
;
1036 typedef xsltStyleItemSort
*xsltStyleItemSortPtr
;
1038 struct _xsltStyleItemSort
{
1039 XSLT_ITEM_COMMON_FIELDS
1041 const xmlChar
*stype
; /* sort */
1042 int has_stype
; /* sort */
1043 int number
; /* sort */
1044 const xmlChar
*order
; /* sort */
1045 int has_order
; /* sort */
1046 int descending
; /* sort */
1047 const xmlChar
*lang
; /* sort */
1048 int has_lang
; /* sort */
1049 const xmlChar
*case_order
; /* sort */
1050 int lower_first
; /* sort */
1055 const xmlChar
*select
; /* sort, copy-of, value-of, apply-templates */
1057 xmlXPathCompExprPtr comp
; /* a precompiled XPath expression */
1062 * xsltStyleItemWhen:
1065 * test = boolean-expression>
1066 * <!-- Content: template -->
1068 * Allowed parent: xsl:choose
1070 typedef struct _xsltStyleItemWhen xsltStyleItemWhen
;
1071 typedef xsltStyleItemWhen
*xsltStyleItemWhenPtr
;
1073 struct _xsltStyleItemWhen
{
1074 XSLT_ITEM_COMMON_FIELDS
1076 const xmlChar
*test
;
1077 xmlXPathCompExprPtr comp
;
1081 * xsltStyleItemOtherwise:
1083 * Allowed parent: xsl:choose
1085 * <!-- Content: template -->
1088 typedef struct _xsltStyleItemOtherwise xsltStyleItemOtherwise
;
1089 typedef xsltStyleItemOtherwise
*xsltStyleItemOtherwisePtr
;
1091 struct _xsltStyleItemOtherwise
{
1092 XSLT_ITEM_COMMON_FIELDS
1095 typedef struct _xsltStyleItemInclude xsltStyleItemInclude
;
1096 typedef xsltStyleItemInclude
*xsltStyleItemIncludePtr
;
1098 struct _xsltStyleItemInclude
{
1099 XSLT_ITEM_COMMON_FIELDS
1100 xsltDocumentPtr include
;
1103 /************************************************************************
1105 * XSLT elements in forwards-compatible mode *
1107 ************************************************************************/
1109 typedef struct _xsltStyleItemUknown xsltStyleItemUknown
;
1110 typedef xsltStyleItemUknown
*xsltStyleItemUknownPtr
;
1111 struct _xsltStyleItemUknown
{
1112 XSLT_ITEM_COMMON_FIELDS
1116 /************************************************************************
1118 * Extension elements *
1120 ************************************************************************/
1123 * xsltStyleItemExtElement:
1125 * Reflects extension elements.
1127 * NOTE: Due to the fact that the structure xsltElemPreComp is most
1128 * probably already heavily in use out there by users, so we cannot
1129 * easily change it, we'll create an intermediate structure which will
1130 * hold an xsltElemPreCompPtr.
1131 * BIG NOTE: The only problem I see here is that the user processes the
1132 * content of the stylesheet tree, possibly he'll lookup the node->psvi
1133 * fields in order to find subsequent extension functions.
1134 * In this case, the user's code will break, since the node->psvi
1135 * field will hold now the xsltStyleItemExtElementPtr and not
1136 * the xsltElemPreCompPtr.
1137 * However the place where the structure is anchored in the node-tree,
1138 * namely node->psvi, has beed already once been moved from node->_private
1139 * to node->psvi, so we have a precedent here, which, I think, should allow
1140 * us to change such semantics without headaches.
1142 typedef struct _xsltStyleItemExtElement xsltStyleItemExtElement
;
1143 typedef xsltStyleItemExtElement
*xsltStyleItemExtElementPtr
;
1144 struct _xsltStyleItemExtElement
{
1145 XSLT_ITEM_COMMON_FIELDS
1146 xsltElemPreCompPtr item
;
1149 /************************************************************************
1151 * Literal result elements *
1153 ************************************************************************/
1155 typedef struct _xsltEffectiveNs xsltEffectiveNs
;
1156 typedef xsltEffectiveNs
*xsltEffectiveNsPtr
;
1157 struct _xsltEffectiveNs
{
1158 xsltEffectiveNsPtr nextInStore
; /* storage next */
1159 xsltEffectiveNsPtr next
; /* next item in the list */
1160 const xmlChar
*prefix
;
1161 const xmlChar
*nsName
;
1163 * Indicates if eclared on the literal result element; dunno if really
1170 * Info for literal result elements.
1171 * This will be set on the elem->psvi field and will be
1172 * shared by literal result elements, which have the same
1173 * excluded result namespaces; i.e., this *won't* be created uniquely
1174 * for every literal result element.
1176 typedef struct _xsltStyleItemLRElementInfo xsltStyleItemLRElementInfo
;
1177 typedef xsltStyleItemLRElementInfo
*xsltStyleItemLRElementInfoPtr
;
1178 struct _xsltStyleItemLRElementInfo
{
1179 XSLT_ITEM_COMMON_FIELDS
1181 * @effectiveNs is the set of effective ns-nodes
1182 * on the literal result element, which will be added to the result
1183 * element if not already existing in the result tree.
1184 * This means that excluded namespaces (via exclude-result-prefixes,
1185 * extension-element-prefixes and the XSLT namespace) not added
1187 * Namespace-aliasing was applied on the @effectiveNs.
1189 xsltEffectiveNsPtr effectiveNs
;
1193 #ifdef XSLT_REFACTORED
1195 typedef struct _xsltNsAlias xsltNsAlias
;
1196 typedef xsltNsAlias
*xsltNsAliasPtr
;
1197 struct _xsltNsAlias
{
1198 xsltNsAliasPtr next
; /* next in the list */
1201 xmlDocPtr docOfTargetNs
;
1205 #ifdef XSLT_REFACTORED_XSLT_NSCOMP
1207 typedef struct _xsltNsMap xsltNsMap
;
1208 typedef xsltNsMap
*xsltNsMapPtr
;
1210 xsltNsMapPtr next
; /* next in the list */
1212 xmlNodePtr elem
; /* the element holding the ns-decl */
1213 xmlNsPtr ns
; /* the xmlNs structure holding the XML namespace name */
1214 const xmlChar
*origNsName
; /* the original XML namespace name */
1215 const xmlChar
*newNsName
; /* the mapped XML namespace name */
1219 /************************************************************************
1221 * Compile-time structures for *internal* use only *
1223 ************************************************************************/
1225 typedef struct _xsltPrincipalStylesheetData xsltPrincipalStylesheetData
;
1226 typedef xsltPrincipalStylesheetData
*xsltPrincipalStylesheetDataPtr
;
1228 typedef struct _xsltNsList xsltNsList
;
1229 typedef xsltNsList
*xsltNsListPtr
;
1230 struct _xsltNsList
{
1231 xsltNsListPtr next
; /* next in the list */
1238 * Used at compilation time for parameters and variables.
1240 typedef struct _xsltVarInfo xsltVarInfo
;
1241 typedef xsltVarInfo
*xsltVarInfoPtr
;
1242 struct _xsltVarInfo
{
1243 xsltVarInfoPtr next
; /* next in the list */
1244 xsltVarInfoPtr prev
;
1245 int depth
; /* the depth in the tree */
1246 const xmlChar
*name
;
1247 const xmlChar
*nsName
;
1251 * xsltCompilerNodeInfo:
1253 * Per-node information during compile-time.
1255 typedef struct _xsltCompilerNodeInfo xsltCompilerNodeInfo
;
1256 typedef xsltCompilerNodeInfo
*xsltCompilerNodeInfoPtr
;
1257 struct _xsltCompilerNodeInfo
{
1258 xsltCompilerNodeInfoPtr next
;
1259 xsltCompilerNodeInfoPtr prev
;
1262 xsltTemplatePtr templ
; /* The owning template */
1263 int category
; /* XSLT element, LR-element or
1264 extension element */
1266 xsltElemPreCompPtr item
; /* The compiled information */
1267 /* The current in-scope namespaces */
1268 xsltNsListContainerPtr inScopeNs
;
1269 /* The current excluded result namespaces */
1270 xsltPointerListPtr exclResultNs
;
1271 /* The current extension instruction namespaces */
1272 xsltPointerListPtr extElemNs
;
1274 /* The current info for literal result elements. */
1275 xsltStyleItemLRElementInfoPtr litResElemInfo
;
1277 * Set to 1 if in-scope namespaces changed,
1278 * or excluded result namespaces changed,
1279 * or extension element namespaces changed.
1280 * This will trigger creation of new infos
1281 * for literal result elements.
1284 int preserveWhitespace
;
1285 int stripWhitespace
;
1286 int isRoot
; /* whether this is the stylesheet's root node */
1287 int forwardsCompat
; /* whether forwards-compatible mode is enabled */
1288 /* whether the content of an extension element was processed */
1289 int extContentHandled
;
1290 /* the type of the current child */
1291 xsltStyleType curChildType
;
1297 * get pointer to compiler context
1299 #define XSLT_CCTXT(style) ((xsltCompilerCtxtPtr) style->compCtxt)
1302 XSLT_ERROR_SEVERITY_ERROR
= 0,
1303 XSLT_ERROR_SEVERITY_WARNING
1304 } xsltErrorSeverityType
;
1306 typedef struct _xsltCompilerCtxt xsltCompilerCtxt
;
1307 typedef xsltCompilerCtxt
*xsltCompilerCtxtPtr
;
1308 struct _xsltCompilerCtxt
{
1309 void *errorCtxt
; /* user specific error context */
1311 * used for error/warning reports; e.g. XSLT_ERROR_SEVERITY_WARNING */
1312 xsltErrorSeverityType errSeverity
;
1313 int warnings
; /* TODO: number of warnings found at
1315 int errors
; /* TODO: number of errors found at
1318 xsltStylesheetPtr style
;
1319 int simplified
; /* whether this is a simplified stylesheet */
1320 /* TODO: structured/unstructured error contexts. */
1321 int depth
; /* Current depth of processing */
1323 xsltCompilerNodeInfoPtr inode
;
1324 xsltCompilerNodeInfoPtr inodeList
;
1325 xsltCompilerNodeInfoPtr inodeLast
;
1326 xsltPointerListPtr tmpList
; /* Used for various purposes */
1328 * The XSLT version as specified by the stylesheet's root element.
1331 int hasForwardsCompat
; /* whether forwards-compatible mode was used
1332 in a parsing episode */
1333 int maxNodeInfos
; /* TEMP TODO: just for the interest */
1334 int maxLREs
; /* TEMP TODO: just for the interest */
1336 * In order to keep the old behaviour, applying strict rules of
1337 * the spec can be turned off. This has effect only on special
1338 * mechanisms like whitespace-stripping in the stylesheet.
1341 xsltPrincipalStylesheetDataPtr psData
;
1342 xsltStyleItemUknownPtr unknownItem
;
1343 int hasNsAliases
; /* Indicator if there was an xsl:namespace-alias. */
1344 xsltNsAliasPtr nsAliases
;
1345 xsltVarInfoPtr ivars
; /* Storage of local in-scope variables/params. */
1346 xsltVarInfoPtr ivar
; /* topmost local variable/param. */
1349 #else /* XSLT_REFACTORED */
1351 * The old structures before refactoring.
1355 * _xsltStylePreComp:
1357 * The in-memory structure corresponding to XSLT stylesheet constructs
1360 struct _xsltStylePreComp
{
1361 xsltElemPreCompPtr next
; /* chained list */
1362 xsltStyleType type
; /* type of the element */
1363 xsltTransformFunction func
; /* handling function */
1364 xmlNodePtr inst
; /* the instruction */
1367 * Pre computed values.
1370 const xmlChar
*stype
; /* sort */
1371 int has_stype
; /* sort */
1372 int number
; /* sort */
1373 const xmlChar
*order
; /* sort */
1374 int has_order
; /* sort */
1375 int descending
; /* sort */
1376 const xmlChar
*lang
; /* sort */
1377 int has_lang
; /* sort */
1378 const xmlChar
*case_order
; /* sort */
1379 int lower_first
; /* sort */
1381 const xmlChar
*use
; /* copy, element */
1382 int has_use
; /* copy, element */
1384 int noescape
; /* text */
1386 const xmlChar
*name
; /* element, attribute, pi */
1387 int has_name
; /* element, attribute, pi */
1388 const xmlChar
*ns
; /* element */
1389 int has_ns
; /* element */
1391 const xmlChar
*mode
; /* apply-templates */
1392 const xmlChar
*modeURI
; /* apply-templates */
1394 const xmlChar
*test
; /* if */
1396 xsltTemplatePtr templ
; /* call-template */
1398 const xmlChar
*select
; /* sort, copy-of, value-of, apply-templates */
1400 int ver11
; /* document */
1401 const xmlChar
*filename
; /* document URL */
1402 int has_filename
; /* document */
1404 xsltNumberData numdata
; /* number */
1406 xmlXPathCompExprPtr comp
; /* a precompiled XPath expression */
1407 xmlNsPtr
*nsList
; /* the namespaces in scope */
1408 int nsNr
; /* the number of namespaces in scope */
1411 #endif /* XSLT_REFACTORED */
1415 * The in-memory structure corresponding to an XSLT Variable
1418 typedef struct _xsltStackElem xsltStackElem
;
1419 typedef xsltStackElem
*xsltStackElemPtr
;
1420 struct _xsltStackElem
{
1421 struct _xsltStackElem
*next
;/* chained list */
1422 xsltStylePreCompPtr comp
; /* the compiled form */
1423 int computed
; /* was the evaluation done */
1424 const xmlChar
*name
; /* the local part of the name QName */
1425 const xmlChar
*nameURI
; /* the URI part of the name QName */
1426 const xmlChar
*select
; /* the eval string */
1427 xmlNodePtr tree
; /* the sequence constructor if no eval
1428 string or the location */
1429 xmlXPathObjectPtr value
; /* The value if computed */
1430 xmlDocPtr fragment
; /* The Result Tree Fragments (needed for XSLT 1.0)
1431 which are bound to the variable's lifetime. */
1432 int level
; /* the depth in the tree;
1433 -1 if persistent (e.g. a given xsl:with-param) */
1434 xsltTransformContextPtr context
; /* The transformation context; needed to cache
1439 #ifdef XSLT_REFACTORED
1441 struct _xsltPrincipalStylesheetData
{
1443 * Namespace dictionary for ns-prefixes and ns-names:
1444 * TODO: Shared between stylesheets, and XPath mechanisms.
1447 xmlDictPtr namespaceDict
;
1449 * Global list of in-scope namespaces.
1451 xsltPointerListPtr inScopeNamespaces
;
1453 * Global list of information for [xsl:]excluded-result-prefixes.
1455 xsltPointerListPtr exclResultNamespaces
;
1457 * Global list of information for [xsl:]extension-element-prefixes.
1459 xsltPointerListPtr extElemNamespaces
;
1460 xsltEffectiveNsPtr effectiveNs
;
1461 #ifdef XSLT_REFACTORED_XSLT_NSCOMP
1463 * Namespace name map to get rid of string comparison of namespace names.
1472 * Note that we added a @compCtxt field to anchor an stylesheet compilation
1473 * context, since, due to historical reasons, various compile-time function
1474 * take only the stylesheet as argument and not a compilation context.
1476 struct _xsltStylesheet
{
1478 * The stylesheet import relation is kept as a tree.
1480 struct _xsltStylesheet
*parent
;
1481 struct _xsltStylesheet
*next
;
1482 struct _xsltStylesheet
*imports
;
1484 xsltDocumentPtr docList
; /* the include document list */
1487 * General data on the style sheet document.
1489 xmlDocPtr doc
; /* the parsed XML stylesheet */
1490 xmlHashTablePtr stripSpaces
;/* the hash table of the strip-space and
1491 preserve space elements */
1492 int stripAll
; /* strip-space * (1) preserve-space * (-1) */
1493 xmlHashTablePtr cdataSection
;/* the hash table of the cdata-section */
1496 * Global variable or parameters.
1498 xsltStackElemPtr variables
; /* linked list of param and variables */
1501 * Template descriptions.
1503 xsltTemplatePtr templates
; /* the ordered list of templates */
1504 xmlHashTablePtr templatesHash
; /* hash table or wherever compiled
1505 templates information is stored */
1506 struct _xsltCompMatch
*rootMatch
; /* template based on / */
1507 struct _xsltCompMatch
*keyMatch
; /* template based on key() */
1508 struct _xsltCompMatch
*elemMatch
; /* template based on * */
1509 struct _xsltCompMatch
*attrMatch
; /* template based on @* */
1510 struct _xsltCompMatch
*parentMatch
; /* template based on .. */
1511 struct _xsltCompMatch
*textMatch
; /* template based on text() */
1512 struct _xsltCompMatch
*piMatch
; /* template based on
1513 processing-instruction() */
1514 struct _xsltCompMatch
*commentMatch
; /* template based on comment() */
1517 * Namespace aliases.
1518 * NOTE: Not used in the refactored code.
1520 xmlHashTablePtr nsAliases
; /* the namespace alias hash tables */
1525 xmlHashTablePtr attributeSets
;/* the attribute sets hash tables */
1529 * TODO: Eliminate this.
1531 xmlHashTablePtr nsHash
; /* the set of namespaces in use:
1532 ATTENTION: This is used for
1533 execution of XPath expressions; unfortunately
1534 it restricts the stylesheet to have distinct
1536 TODO: We need to get rid of this.
1538 void *nsDefs
; /* ATTENTION TODO: This is currently used to store
1539 xsltExtDefPtr (in extensions.c) and
1546 void *keys
; /* key definitions */
1549 * Output related stuff.
1551 xmlChar
*method
; /* the output method */
1552 xmlChar
*methodURI
; /* associated namespace if any */
1553 xmlChar
*version
; /* version string */
1554 xmlChar
*encoding
; /* encoding string */
1555 int omitXmlDeclaration
; /* omit-xml-declaration = "yes" | "no" */
1558 * Number formatting.
1560 xsltDecimalFormatPtr decimalFormat
;
1561 int standalone
; /* standalone = "yes" | "no" */
1562 xmlChar
*doctypePublic
; /* doctype-public string */
1563 xmlChar
*doctypeSystem
; /* doctype-system string */
1564 int indent
; /* should output being indented */
1565 xmlChar
*mediaType
; /* media-type string */
1568 * Precomputed blocks.
1570 xsltElemPreCompPtr preComps
;/* list of precomputed blocks */
1571 int warnings
; /* number of warnings found at compilation */
1572 int errors
; /* number of errors found at compilation */
1574 xmlChar
*exclPrefix
; /* last excluded prefixes */
1575 xmlChar
**exclPrefixTab
; /* array of excluded prefixes */
1576 int exclPrefixNr
; /* number of excluded prefixes in scope */
1577 int exclPrefixMax
; /* size of the array */
1579 void *_private
; /* user defined data */
1584 xmlHashTablePtr extInfos
; /* the extension data */
1585 int extrasNr
; /* the number of extras required */
1588 * For keeping track of nested includes
1590 xsltDocumentPtr includes
; /* points to last nested include */
1593 * dictionary: shared between stylesheet, context and documents.
1597 * precompiled attribute value templates.
1601 * if namespace-alias has an alias for the default stylesheet prefix
1602 * NOTE: Not used in the refactored code.
1604 const xmlChar
*defaultAlias
;
1606 * bypass pre-processing (already done) (used in imports)
1610 * all document text strings were internalized
1614 * Literal Result Element as Stylesheet c.f. section 2.3
1618 * The principal stylesheet
1620 xsltStylesheetPtr principal
;
1621 #ifdef XSLT_REFACTORED
1623 * Compilation context used during compile-time.
1625 xsltCompilerCtxtPtr compCtxt
; /* TODO: Change this to (void *). */
1627 xsltPrincipalStylesheetDataPtr principalData
;
1630 * Forwards-compatible processing
1632 int forwards_compatible
;
1634 xmlHashTablePtr namedTemplates
; /* hash table of named templates */
1636 xmlXPathContextPtr xpathCtxt
;
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,
1664 (*xsltNewLocaleFunc
)(const xmlChar
*lang
, int lowerFirst
);
1666 (*xsltFreeLocaleFunc
)(void *locale
);
1668 (*xsltGenSortKeyFunc
)(void *locale
, const xmlChar
*lang
);
1674 } xsltTransformState
;
1676 struct _xsltTransformContext
{
1677 xsltStylesheetPtr style
; /* the stylesheet used */
1678 xsltOutputType type
; /* the type of output */
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 */
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 */
1694 xmlHashTablePtr extFunctions
; /* the extension functions */
1695 xmlHashTablePtr extElements
; /* the extension elements */
1696 xmlHashTablePtr extInfos
; /* the extension data */
1698 const xmlChar
*mode
; /* the current mode */
1699 const xmlChar
*modeURI
; /* the current mode URI */
1701 xsltDocumentPtr docList
; /* the document list */
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 */
1708 xmlDocPtr output
; /* the resulting document */
1709 xmlNodePtr insert
; /* the insertion node */
1711 xmlXPathContextPtr xpathCtxt
; /* the XPath context */
1712 xsltTransformState state
; /* the current state */
1717 xmlHashTablePtr globalVars
; /* the global variables and params */
1719 xmlNodePtr inst
; /* the instruction in the stylesheet */
1721 int xinclude
; /* should XInclude be processed */
1723 const char * outputFile
; /* the output URI if known */
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 */
1731 void *_private
; /* user defined data */
1733 int extrasNr
; /* the number of extras used */
1734 int extrasMax
; /* the number of extras allocated */
1735 xsltRuntimeExtraPtr extras
; /* extra per runtime information */
1737 xsltDocumentPtr styleList
; /* the stylesheet docs list */
1738 void * sec
; /* the security preferences if any */
1740 xmlGenericErrorFunc error
; /* a specific error handler */
1741 void * errctx
; /* context for the error handler */
1743 xsltSortFunc sortfunc
; /* a ctxt specific sort routine */
1746 * handling of temporary Result Value Tree
1747 * (XSLT 1.0 term: "Result Tree Fragment")
1749 xmlDocPtr tmpRVT
; /* list of RVT without persistance */
1750 xmlDocPtr persistRVT
; /* list of persistant RVTs */
1751 int ctxtflags
; /* context processing flags */
1754 * Speed optimization when coalescing text nodes
1756 const xmlChar
*lasttext
; /* last text node content */
1757 int lasttsize
; /* last text node size */
1758 int lasttuse
; /* last text node use */
1760 * Per Context Debugging
1762 int debugStatus
; /* the context level debug status */
1763 unsigned long* traceCode
; /* pointer to the variable holding the mask */
1765 int parserOptions
; /* parser options xmlParserOption */
1768 * dictionary: shared between stylesheet, context and documents.
1771 xmlDocPtr tmpDoc
; /* Obsolete; not used in the library. */
1773 * all document text strings are internalized
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
1786 xmlDocPtr localRVTBase
; /* Obsolete */
1787 int keyInitLevel
; /* Needed to catch recursive keys issues */
1788 int depth
; /* Needed to catch recursions */
1789 int maxTemplateDepth
;
1790 int maxTemplateVars
;
1791 unsigned long opLimit
;
1792 unsigned long opCount
;
1794 unsigned long currentId
; /* For generate-id() */
1796 xsltNewLocaleFunc newLocale
;
1797 xsltFreeLocaleFunc freeLocale
;
1798 xsltGenSortKeyFunc genSortKey
;
1804 * Macro to check if the XSLT processing should be stopped.
1805 * Will return from the function.
1807 #define CHECK_STOPPED if (ctxt->state == XSLT_STATE_STOPPED) return;
1812 * Macro to check if the XSLT processing should be stopped.
1813 * Will goto the error: label.
1815 #define CHECK_STOPPEDE if (ctxt->state == XSLT_STATE_STOPPED) goto error;
1820 * Macro to check if the XSLT processing should be stopped.
1821 * Will return from the function with a 0 value.
1823 #define CHECK_STOPPED0 if (ctxt->state == XSLT_STATE_STOPPED) return(0);
1826 * The macro XML_CAST_FPTR is a hack to avoid a gcc warning about
1827 * possible incompatibilities between function pointers and object
1828 * pointers. It is defined in libxml/hash.h within recent versions
1829 * of libxml2, but is put here for compatibility.
1831 #ifndef XML_CAST_FPTR
1834 * @fptr: pointer to a function
1836 * Macro to do a casting from an object pointer to a
1837 * function pointer without encountering a warning from
1840 * #define XML_CAST_FPTR(fptr) (*(void **)(&fptr))
1841 * This macro violated ISO C aliasing rules (gcc4 on s390 broke)
1842 * so it is disabled now
1845 #define XML_CAST_FPTR(fptr) fptr
1848 * Functions associated to the internal types
1849 xsltDecimalFormatPtr xsltDecimalFormatGetByName(xsltStylesheetPtr sheet,
1852 XSLTPUBFUN xsltStylesheetPtr XSLTCALL
1853 xsltNewStylesheet (void);
1854 XSLTPUBFUN xsltStylesheetPtr XSLTCALL
1855 xsltParseStylesheetFile (const xmlChar
* filename
);
1856 XSLTPUBFUN
void XSLTCALL
1857 xsltFreeStylesheet (xsltStylesheetPtr style
);
1858 XSLTPUBFUN
int XSLTCALL
1859 xsltIsBlank (xmlChar
*str
);
1860 XSLTPUBFUN
void XSLTCALL
1861 xsltFreeStackElemList (xsltStackElemPtr elem
);
1862 XSLTPUBFUN xsltDecimalFormatPtr XSLTCALL
1863 xsltDecimalFormatGetByName(xsltStylesheetPtr style
,
1865 XSLTPUBFUN xsltDecimalFormatPtr XSLTCALL
1866 xsltDecimalFormatGetByQName(xsltStylesheetPtr style
,
1867 const xmlChar
*nsUri
,
1868 const xmlChar
*name
);
1870 XSLTPUBFUN xsltStylesheetPtr XSLTCALL
1871 xsltParseStylesheetProcess(xsltStylesheetPtr ret
,
1873 XSLTPUBFUN
void XSLTCALL
1874 xsltParseStylesheetOutput(xsltStylesheetPtr style
,
1876 XSLTPUBFUN xsltStylesheetPtr XSLTCALL
1877 xsltParseStylesheetDoc (xmlDocPtr doc
);
1878 XSLTPUBFUN xsltStylesheetPtr XSLTCALL
1879 xsltParseStylesheetImportedDoc(xmlDocPtr doc
,
1880 xsltStylesheetPtr style
);
1881 XSLTPUBFUN
int XSLTCALL
1882 xsltParseStylesheetUser(xsltStylesheetPtr style
,
1884 XSLTPUBFUN xsltStylesheetPtr XSLTCALL
1885 xsltLoadStylesheetPI (xmlDocPtr doc
);
1886 XSLTPUBFUN
void XSLTCALL
1887 xsltNumberFormat (xsltTransformContextPtr ctxt
,
1888 xsltNumberDataPtr data
,
1890 XSLTPUBFUN xmlXPathError XSLTCALL
1891 xsltFormatNumberConversion(xsltDecimalFormatPtr self
,
1896 XSLTPUBFUN
void XSLTCALL
1897 xsltParseTemplateContent(xsltStylesheetPtr style
,
1899 XSLTPUBFUN
int XSLTCALL
1900 xsltAllocateExtra (xsltStylesheetPtr style
);
1901 XSLTPUBFUN
int XSLTCALL
1902 xsltAllocateExtraCtxt (xsltTransformContextPtr ctxt
);
1904 * Extra functions for Result Value Trees
1906 XSLTPUBFUN xmlDocPtr XSLTCALL
1907 xsltCreateRVT (xsltTransformContextPtr ctxt
);
1908 XSLTPUBFUN
int XSLTCALL
1909 xsltRegisterTmpRVT (xsltTransformContextPtr ctxt
,
1911 XSLTPUBFUN
int XSLTCALL
1912 xsltRegisterLocalRVT (xsltTransformContextPtr ctxt
,
1914 XSLTPUBFUN
int XSLTCALL
1915 xsltRegisterPersistRVT (xsltTransformContextPtr ctxt
,
1917 XSLTPUBFUN
int XSLTCALL
1918 xsltExtensionInstructionResultRegister(
1919 xsltTransformContextPtr ctxt
,
1920 xmlXPathObjectPtr obj
);
1921 XSLTPUBFUN
int XSLTCALL
1922 xsltExtensionInstructionResultFinalize(
1923 xsltTransformContextPtr ctxt
);
1924 XSLTPUBFUN
int XSLTCALL
1926 xsltTransformContextPtr ctxt
,
1927 xmlXPathObjectPtr obj
,
1929 XSLTPUBFUN
void XSLTCALL
1930 xsltFreeRVTs (xsltTransformContextPtr ctxt
);
1931 XSLTPUBFUN
void XSLTCALL
1932 xsltReleaseRVT (xsltTransformContextPtr ctxt
,
1935 * Extra functions for Attribute Value Templates
1937 XSLTPUBFUN
void XSLTCALL
1938 xsltCompileAttr (xsltStylesheetPtr style
,
1940 XSLTPUBFUN xmlChar
* XSLTCALL
1941 xsltEvalAVT (xsltTransformContextPtr ctxt
,
1944 XSLTPUBFUN
void XSLTCALL
1945 xsltFreeAVTList (void *avt
);
1948 * Extra function for successful xsltCleanupGlobals / xsltInit sequence.
1951 XSLTPUBFUN
void XSLTCALL
1954 /************************************************************************
1956 * Compile-time functions for *internal* use only *
1958 ************************************************************************/
1960 #ifdef XSLT_REFACTORED
1961 XSLTPUBFUN
void XSLTCALL
1962 xsltParseSequenceConstructor(
1963 xsltCompilerCtxtPtr cctxt
,
1965 XSLTPUBFUN
int XSLTCALL
1966 xsltParseAnyXSLTElem (xsltCompilerCtxtPtr cctxt
,
1968 #ifdef XSLT_REFACTORED_XSLT_NSCOMP
1969 XSLTPUBFUN
int XSLTCALL
1970 xsltRestoreDocumentNamespaces(
1974 #endif /* XSLT_REFACTORED */
1976 /************************************************************************
1978 * Transformation-time functions for *internal* use only *
1980 ************************************************************************/
1981 XSLTPUBFUN
int XSLTCALL
1982 xsltInitCtxtKey (xsltTransformContextPtr ctxt
,
1983 xsltDocumentPtr doc
,
1984 xsltKeyDefPtr keyd
);
1985 XSLTPUBFUN
int XSLTCALL
1986 xsltInitAllDocKeys (xsltTransformContextPtr ctxt
);
1991 #endif /* __XML_XSLT_H__ */