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 "xsltlocale.h"
25 #include "numbersInternals.h"
31 /* #define XSLT_DEBUG_PROFILE_CACHE */
36 * check if the argument is a text node
38 #define XSLT_IS_TEXT_NODE(n) ((n != NULL) && \
39 (((n)->type == XML_TEXT_NODE) || \
40 ((n)->type == XML_CDATA_SECTION_NODE)))
44 * XSLT_MARK_RES_TREE_FRAG:
46 * internal macro to set up tree fragments
48 #define XSLT_MARK_RES_TREE_FRAG(n) \
49 (n)->name = (char *) xmlStrdup(BAD_CAST " fake node libxslt");
52 * XSLT_IS_RES_TREE_FRAG:
54 * internal macro to test tree fragments
56 #define XSLT_IS_RES_TREE_FRAG(n) \
57 ((n != NULL) && ((n)->type == XML_DOCUMENT_NODE) && \
58 ((n)->name != NULL) && ((n)->name[0] == ' '))
61 * XSLT_REFACTORED_KEYCOMP:
63 * Internal define to enable on-demand xsl:key computation.
64 * That's the only mode now but the define is kept for compatibility
66 #define XSLT_REFACTORED_KEYCOMP
71 * Internal define to enable usage of xmlXPathCompiledEvalToBoolean()
72 * for XSLT "tests"; e.g. in <xsl:if test="/foo/bar">
79 * Internal define to enable the refactored parts of Libxslt.
81 /* #define XSLT_REFACTORED */
82 /* ==================================================================== */
85 * XSLT_REFACTORED_VARS:
87 * Internal define to enable the refactored variable part of libxslt
89 #define XSLT_REFACTORED_VARS
91 #ifdef XSLT_REFACTORED
93 extern const xmlChar
*xsltXSLTAttrMarker
;
96 /* TODO: REMOVE: #define XSLT_REFACTORED_EXCLRESNS */
98 /* TODO: REMOVE: #define XSLT_REFACTORED_NSALIAS */
101 * XSLT_REFACTORED_XSLT_NSCOMP
103 * Internal define to enable the pointer-comparison of
104 * namespaces of XSLT elements.
106 /* #define XSLT_REFACTORED_XSLT_NSCOMP */
109 * XSLT_REFACTORED_XPATHCOMP:
111 * Internal define to enable the optimization of the
112 * compilation of XPath expressions.
114 #define XSLT_REFACTORED_XPATHCOMP
116 #ifdef XSLT_REFACTORED_XSLT_NSCOMP
118 extern const xmlChar
*xsltConstNamespaceNameXSLT
;
123 * quick test to detect XSLT elements
125 #define IS_XSLT_ELEM_FAST(n) \
126 (((n) != NULL) && ((n)->ns != NULL) && \
127 ((n)->ns->href == xsltConstNamespaceNameXSLT))
132 * quick test to detect XSLT attributes
134 #define IS_XSLT_ATTR_FAST(a) \
135 (((a) != NULL) && ((a)->ns != NULL) && \
136 ((a)->ns->href == xsltConstNamespaceNameXSLT))
139 * XSLT_HAS_INTERNAL_NSMAP:
141 * check for namespace mapping
143 #define XSLT_HAS_INTERNAL_NSMAP(s) \
144 (((s) != NULL) && ((s)->principal) && \
145 ((s)->principal->principalData) && \
146 ((s)->principal->principalData->nsMap))
149 * XSLT_GET_INTERNAL_NSMAP:
151 * get pointer to namespace map
153 #define XSLT_GET_INTERNAL_NSMAP(s) ((s)->principal->principalData->nsMap)
155 #else /* XSLT_REFACTORED_XSLT_NSCOMP */
160 * quick check whether this is an xslt element
162 #define IS_XSLT_ELEM_FAST(n) \
163 (((n) != NULL) && ((n)->ns != NULL) && \
164 (xmlStrEqual((n)->ns->href, XSLT_NAMESPACE)))
169 * quick check for xslt namespace attribute
171 #define IS_XSLT_ATTR_FAST(a) \
172 (((a) != NULL) && ((a)->ns != NULL) && \
173 (xmlStrEqual((a)->ns->href, XSLT_NAMESPACE)))
176 #endif /* XSLT_REFACTORED_XSLT_NSCOMP */
180 * XSLT_REFACTORED_MANDATORY_VERSION:
182 * TODO: Currently disabled to surpress regression test failures, since
183 * the old behaviour was that a missing version attribute
184 * produced a only a warning and not an error, which was incerrect.
185 * So the regression tests need to be fixed if this is enabled.
187 /* #define XSLT_REFACTORED_MANDATORY_VERSION */
192 * Pointer-list for various purposes.
194 typedef struct _xsltPointerList xsltPointerList
;
195 typedef xsltPointerList
*xsltPointerListPtr
;
196 struct _xsltPointerList
{
205 * XSLT_REFACTORED_PARSING:
207 * Internal define to enable the refactored parts of Libxslt
208 * related to parsing.
210 /* #define XSLT_REFACTORED_PARSING */
215 * Max number of specified xsl:sort on an element.
217 #define XSLT_MAX_SORT 15
220 * XSLT_PAT_NO_PRIORITY:
222 * Specific value for pattern without priority expressed.
224 #define XSLT_PAT_NO_PRIORITY -12345789
229 * Extra information added to the transformation context.
231 typedef struct _xsltRuntimeExtra xsltRuntimeExtra
;
232 typedef xsltRuntimeExtra
*xsltRuntimeExtraPtr
;
233 struct _xsltRuntimeExtra
{
234 void *info
; /* pointer to the extra data */
235 xmlFreeFunc deallocate
; /* pointer to the deallocation routine */
236 union { /* dual-purpose field */
237 void *ptr
; /* data not needing deallocation */
238 int ival
; /* integer value storage */
243 * XSLT_RUNTIME_EXTRA_LST:
244 * @ctxt: the transformation context
247 * Macro used to access extra information stored in the context
249 #define XSLT_RUNTIME_EXTRA_LST(ctxt, nr) (ctxt)->extras[(nr)].info
251 * XSLT_RUNTIME_EXTRA_FREE:
252 * @ctxt: the transformation context
255 * Macro used to free extra information stored in the context
257 #define XSLT_RUNTIME_EXTRA_FREE(ctxt, nr) (ctxt)->extras[(nr)].deallocate
259 * XSLT_RUNTIME_EXTRA:
260 * @ctxt: the transformation context
263 * Macro used to define extra information stored in the context
265 #define XSLT_RUNTIME_EXTRA(ctxt, nr, typ) (ctxt)->extras[(nr)].val.typ
270 * The in-memory structure corresponding to an XSLT Template.
272 typedef struct _xsltTemplate xsltTemplate
;
273 typedef xsltTemplate
*xsltTemplatePtr
;
274 struct _xsltTemplate
{
275 struct _xsltTemplate
*next
;/* chained list sorted by priority */
276 struct _xsltStylesheet
*style
;/* the containing stylesheet */
277 xmlChar
*match
; /* the matching string */
278 float priority
; /* as given from the stylesheet, not computed */
279 const xmlChar
*name
; /* the local part of the name QName */
280 const xmlChar
*nameURI
; /* the URI part of the name QName */
281 const xmlChar
*mode
;/* the local part of the mode QName */
282 const xmlChar
*modeURI
;/* the URI part of the mode QName */
283 xmlNodePtr content
; /* the template replacement value */
284 xmlNodePtr elem
; /* the source element */
287 * TODO: @inheritedNsNr and @inheritedNs won't be used in the
290 int inheritedNsNr
; /* number of inherited namespaces */
291 xmlNsPtr
*inheritedNs
;/* inherited non-excluded namespaces */
293 /* Profiling informations */
294 int nbCalls
; /* the number of time the template was called */
295 unsigned long time
; /* the time spent in this template */
296 void *params
; /* xsl:param instructions */
298 int templNr
; /* Nb of templates in the stack */
299 int templMax
; /* Size of the templtes stack */
300 xsltTemplatePtr
*templCalledTab
; /* templates called */
301 int *templCountTab
; /* .. and how often */
307 * Data structure of decimal-format.
309 typedef struct _xsltDecimalFormat xsltDecimalFormat
;
310 typedef xsltDecimalFormat
*xsltDecimalFormatPtr
;
311 struct _xsltDecimalFormat
{
312 struct _xsltDecimalFormat
*next
; /* chained list */
314 /* Used for interpretation of pattern */
316 xmlChar
*patternSeparator
;
317 /* May appear in result */
320 xmlChar
*noNumber
; /* Not-a-number */
321 /* Used for interpretation of pattern and may appear in result */
322 xmlChar
*decimalPoint
;
327 const xmlChar
*nsUri
;
333 * Data structure associated to a parsed document.
335 typedef struct _xsltDocument xsltDocument
;
336 typedef xsltDocument
*xsltDocumentPtr
;
337 struct _xsltDocument
{
338 struct _xsltDocument
*next
; /* documents are kept in a chained list */
339 int main
; /* is this the main document */
340 xmlDocPtr doc
; /* the parsed document */
341 void *keys
; /* key tables storage */
342 struct _xsltDocument
*includes
; /* subsidiary includes */
343 int preproc
; /* pre-processing already done */
350 * Representation of an xsl:key.
352 typedef struct _xsltKeyDef xsltKeyDef
;
353 typedef xsltKeyDef
*xsltKeyDefPtr
;
355 struct _xsltKeyDef
*next
;
361 xmlXPathCompExprPtr comp
;
362 xmlXPathCompExprPtr usecomp
;
363 xmlNsPtr
*nsList
; /* the namespaces in scope */
364 int nsNr
; /* the number of namespaces in scope */
370 * Holds the computed keys for key definitions of the same QName.
371 * Is owned by an xsltDocument.
373 typedef struct _xsltKeyTable xsltKeyTable
;
374 typedef xsltKeyTable
*xsltKeyTablePtr
;
375 struct _xsltKeyTable
{
376 struct _xsltKeyTable
*next
;
379 xmlHashTablePtr keys
;
383 * The in-memory structure corresponding to an XSLT Stylesheet.
384 * NOTE: most of the content is simply linked from the doc tree
385 * structure, no specific allocation is made.
387 typedef struct _xsltStylesheet xsltStylesheet
;
388 typedef xsltStylesheet
*xsltStylesheetPtr
;
390 typedef struct _xsltTransformContext xsltTransformContext
;
391 typedef xsltTransformContext
*xsltTransformContextPtr
;
396 * The in-memory structure corresponding to element precomputed data,
397 * designed to be extended by extension implementors.
399 typedef struct _xsltElemPreComp xsltElemPreComp
;
400 typedef xsltElemPreComp
*xsltElemPreCompPtr
;
403 * xsltTransformFunction:
404 * @ctxt: the XSLT transformation context
405 * @node: the input node
406 * @inst: the stylesheet node
407 * @comp: the compiled information from the stylesheet
409 * Signature of the function associated to elements part of the
410 * stylesheet language like xsl:if or xsl:apply-templates.
412 typedef void (*xsltTransformFunction
) (xsltTransformContextPtr ctxt
,
415 xsltElemPreCompPtr comp
);
419 * @ctxt: a transformation context
420 * @sorts: the node-set to sort
421 * @nbsorts: the number of sorts
423 * Signature of the function to use during sorting
425 typedef void (*xsltSortFunc
) (xsltTransformContextPtr ctxt
, xmlNodePtr
*sorts
,
439 XSLT_FUNC_APPLYIMPORTS
,
440 XSLT_FUNC_CALLTEMPLATE
,
441 XSLT_FUNC_APPLYTEMPLATES
,
451 #ifdef XSLT_REFACTORED
458 XSLT_FUNC_LITERAL_RESULT_ELEMENT
,
459 XSLT_FUNC_UNKOWN_FORWARDS_COMPAT
464 * xsltElemPreCompDeallocator:
465 * @comp: the #xsltElemPreComp to free up
467 * Deallocates an #xsltElemPreComp structure.
469 typedef void (*xsltElemPreCompDeallocator
) (xsltElemPreCompPtr comp
);
474 * The basic structure for compiled items of the AST of the XSLT processor.
475 * This structure is also intended to be extended by extension implementors.
476 * TODO: This is somehow not nice, since it has a "free" field, which
477 * derived stylesheet-structs do not have.
479 struct _xsltElemPreComp
{
480 xsltElemPreCompPtr next
; /* next item in the global chained
481 list hold by xsltStylesheet. */
482 xsltStyleType type
; /* type of the element */
483 xsltTransformFunction func
; /* handling function */
484 xmlNodePtr inst
; /* the node in the stylesheet's tree
485 corresponding to this item */
487 /* end of common part */
488 xsltElemPreCompDeallocator free
; /* the deallocator */
494 * The abstract basic structure for items of the XSLT processor.
496 * 1) compiled forms of XSLT instructions (xsl:if, xsl:attribute, etc.)
497 * 2) compiled forms of literal result elements
498 * 3) compiled forms of extension elements
500 typedef struct _xsltStylePreComp xsltStylePreComp
;
501 typedef xsltStylePreComp
*xsltStylePreCompPtr
;
503 #ifdef XSLT_REFACTORED
506 * Some pointer-list utility functions.
508 XSLTPUBFUN xsltPointerListPtr XSLTCALL
509 xsltPointerListCreate (int initialSize
);
510 XSLTPUBFUN
void XSLTCALL
511 xsltPointerListFree (xsltPointerListPtr list
);
512 XSLTPUBFUN
void XSLTCALL
513 xsltPointerListClear (xsltPointerListPtr list
);
514 XSLTPUBFUN
int XSLTCALL
515 xsltPointerListAddSize (xsltPointerListPtr list
,
519 /************************************************************************
521 * Refactored structures *
523 ************************************************************************/
525 typedef struct _xsltNsListContainer xsltNsListContainer
;
526 typedef xsltNsListContainer
*xsltNsListContainerPtr
;
527 struct _xsltNsListContainer
{
534 * XSLT_ITEM_COMPATIBILITY_FIELDS:
536 * Fields for API compatibility to the structure
537 * _xsltElemPreComp which is used for extension functions.
538 * Note that @next is used for storage; it does not reflect a next
539 * sibling in the tree.
540 * TODO: Evaluate if we really need such a compatibility.
542 #define XSLT_ITEM_COMPATIBILITY_FIELDS \
543 xsltElemPreCompPtr next;\
545 xsltTransformFunction func;\
549 * XSLT_ITEM_NAVIGATION_FIELDS:
552 * TODO: It is intended to hold navigational fields in the future.
554 #define XSLT_ITEM_NAVIGATION_FIELDS
556 xsltStylePreCompPtr parent;\
557 xsltStylePreCompPtr children;\
558 xsltStylePreCompPtr nextItem;
562 * XSLT_ITEM_NSINSCOPE_FIELDS:
564 * The in-scope namespaces.
566 #define XSLT_ITEM_NSINSCOPE_FIELDS xsltNsListContainerPtr inScopeNs;
569 * XSLT_ITEM_COMMON_FIELDS:
571 * Common fields used for all items.
573 #define XSLT_ITEM_COMMON_FIELDS \
574 XSLT_ITEM_COMPATIBILITY_FIELDS \
575 XSLT_ITEM_NAVIGATION_FIELDS \
576 XSLT_ITEM_NSINSCOPE_FIELDS
581 * The abstract basic structure for items of the XSLT processor.
583 * 1) compiled forms of XSLT instructions (e.g. xsl:if, xsl:attribute, etc.)
584 * 2) compiled forms of literal result elements
585 * 3) various properties for XSLT instructions (e.g. xsl:when,
588 * REVISIT TODO: Keep this structure equal to the fields
589 * defined by XSLT_ITEM_COMMON_FIELDS
591 struct _xsltStylePreComp
{
592 xsltElemPreCompPtr next
; /* next item in the global chained
593 list hold by xsltStylesheet */
594 xsltStyleType type
; /* type of the item */
595 xsltTransformFunction func
; /* handling function */
596 xmlNodePtr inst
; /* the node in the stylesheet's tree
597 corresponding to this item. */
598 /* Currently no navigational fields. */
599 xsltNsListContainerPtr inScopeNs
;
603 * xsltStyleBasicEmptyItem:
605 * Abstract structure only used as a short-cut for
606 * XSLT items with no extra fields.
607 * NOTE that it is intended that this structure looks the same as
610 typedef struct _xsltStyleBasicEmptyItem xsltStyleBasicEmptyItem
;
611 typedef xsltStyleBasicEmptyItem
*xsltStyleBasicEmptyItemPtr
;
613 struct _xsltStyleBasicEmptyItem
{
614 XSLT_ITEM_COMMON_FIELDS
618 * xsltStyleBasicExpressionItem:
620 * Abstract structure only used as a short-cut for
621 * XSLT items with just an expression.
623 typedef struct _xsltStyleBasicExpressionItem xsltStyleBasicExpressionItem
;
624 typedef xsltStyleBasicExpressionItem
*xsltStyleBasicExpressionItemPtr
;
626 struct _xsltStyleBasicExpressionItem
{
627 XSLT_ITEM_COMMON_FIELDS
629 const xmlChar
*select
; /* TODO: Change this to "expression". */
630 xmlXPathCompExprPtr comp
; /* TODO: Change this to compExpr. */
633 /************************************************************************
635 * XSLT-instructions/declarations *
637 ************************************************************************/
640 * xsltStyleItemElement:
642 * <!-- Category: instruction -->
645 * namespace = { uri-reference }
646 * use-attribute-sets = qnames>
647 * <!-- Content: template -->
650 typedef struct _xsltStyleItemElement xsltStyleItemElement
;
651 typedef xsltStyleItemElement
*xsltStyleItemElementPtr
;
653 struct _xsltStyleItemElement
{
654 XSLT_ITEM_COMMON_FIELDS
661 const xmlChar
*nsPrefix
;
666 * xsltStyleItemAttribute:
668 * <!-- Category: instruction -->
671 * namespace = { uri-reference }>
672 * <!-- Content: template -->
675 typedef struct _xsltStyleItemAttribute xsltStyleItemAttribute
;
676 typedef xsltStyleItemAttribute
*xsltStyleItemAttributePtr
;
678 struct _xsltStyleItemAttribute
{
679 XSLT_ITEM_COMMON_FIELDS
683 const xmlChar
*nsPrefix
;
690 * <!-- Category: instruction -->
692 * disable-output-escaping = "yes" | "no">
693 * <!-- Content: #PCDATA -->
696 typedef struct _xsltStyleItemText xsltStyleItemText
;
697 typedef xsltStyleItemText
*xsltStyleItemTextPtr
;
699 struct _xsltStyleItemText
{
700 XSLT_ITEM_COMMON_FIELDS
701 int noescape
; /* text */
705 * xsltStyleItemComment:
707 * <!-- Category: instruction -->
709 * <!-- Content: template -->
712 typedef xsltStyleBasicEmptyItem xsltStyleItemComment
;
713 typedef xsltStyleItemComment
*xsltStyleItemCommentPtr
;
718 * <!-- Category: instruction -->
719 * <xsl:processing-instruction
721 * <!-- Content: template -->
722 * </xsl:processing-instruction>
724 typedef struct _xsltStyleItemPI xsltStyleItemPI
;
725 typedef xsltStyleItemPI
*xsltStyleItemPIPtr
;
727 struct _xsltStyleItemPI
{
728 XSLT_ITEM_COMMON_FIELDS
734 * xsltStyleItemApplyImports:
736 * <!-- Category: instruction -->
737 * <xsl:apply-imports />
739 typedef xsltStyleBasicEmptyItem xsltStyleItemApplyImports
;
740 typedef xsltStyleItemApplyImports
*xsltStyleItemApplyImportsPtr
;
743 * xsltStyleItemApplyTemplates:
745 * <!-- Category: instruction -->
746 * <xsl:apply-templates
747 * select = node-set-expression
749 * <!-- Content: (xsl:sort | xsl:with-param)* -->
750 * </xsl:apply-templates>
752 typedef struct _xsltStyleItemApplyTemplates xsltStyleItemApplyTemplates
;
753 typedef xsltStyleItemApplyTemplates
*xsltStyleItemApplyTemplatesPtr
;
755 struct _xsltStyleItemApplyTemplates
{
756 XSLT_ITEM_COMMON_FIELDS
758 const xmlChar
*mode
; /* apply-templates */
759 const xmlChar
*modeURI
; /* apply-templates */
760 const xmlChar
*select
; /* sort, copy-of, value-of, apply-templates */
761 xmlXPathCompExprPtr comp
; /* a precompiled XPath expression */
762 /* TODO: with-params */
766 * xsltStyleItemCallTemplate:
768 * <!-- Category: instruction -->
771 * <!-- Content: xsl:with-param* -->
772 * </xsl:call-template>
774 typedef struct _xsltStyleItemCallTemplate xsltStyleItemCallTemplate
;
775 typedef xsltStyleItemCallTemplate
*xsltStyleItemCallTemplatePtr
;
777 struct _xsltStyleItemCallTemplate
{
778 XSLT_ITEM_COMMON_FIELDS
780 xsltTemplatePtr templ
; /* call-template */
781 const xmlChar
*name
; /* element, attribute, pi */
782 int has_name
; /* element, attribute, pi */
783 const xmlChar
*ns
; /* element */
784 int has_ns
; /* element */
785 /* TODO: with-params */
791 * <!-- Category: instruction -->
793 * use-attribute-sets = qnames>
794 * <!-- Content: template -->
797 typedef struct _xsltStyleItemCopy xsltStyleItemCopy
;
798 typedef xsltStyleItemCopy
*xsltStyleItemCopyPtr
;
800 struct _xsltStyleItemCopy
{
801 XSLT_ITEM_COMMON_FIELDS
802 const xmlChar
*use
; /* copy, element */
803 int has_use
; /* copy, element */
809 * <!-- Category: instruction -->
811 * test = boolean-expression>
812 * <!-- Content: template -->
815 typedef struct _xsltStyleItemIf xsltStyleItemIf
;
816 typedef xsltStyleItemIf
*xsltStyleItemIfPtr
;
818 struct _xsltStyleItemIf
{
819 XSLT_ITEM_COMMON_FIELDS
821 const xmlChar
*test
; /* if */
822 xmlXPathCompExprPtr comp
; /* a precompiled XPath expression */
827 * xsltStyleItemCopyOf:
829 * <!-- Category: instruction -->
831 * select = expression />
833 typedef xsltStyleBasicExpressionItem xsltStyleItemCopyOf
;
834 typedef xsltStyleItemCopyOf
*xsltStyleItemCopyOfPtr
;
837 * xsltStyleItemValueOf:
839 * <!-- Category: instruction -->
841 * select = string-expression
842 * disable-output-escaping = "yes" | "no" />
844 typedef struct _xsltStyleItemValueOf xsltStyleItemValueOf
;
845 typedef xsltStyleItemValueOf
*xsltStyleItemValueOfPtr
;
847 struct _xsltStyleItemValueOf
{
848 XSLT_ITEM_COMMON_FIELDS
850 const xmlChar
*select
;
851 xmlXPathCompExprPtr comp
; /* a precompiled XPath expression */
856 * xsltStyleItemNumber:
858 * <!-- Category: instruction -->
860 * level = "single" | "multiple" | "any"
863 * value = number-expression
864 * format = { string }
866 * letter-value = { "alphabetic" | "traditional" }
867 * grouping-separator = { char }
868 * grouping-size = { number } />
870 typedef struct _xsltStyleItemNumber xsltStyleItemNumber
;
871 typedef xsltStyleItemNumber
*xsltStyleItemNumberPtr
;
873 struct _xsltStyleItemNumber
{
874 XSLT_ITEM_COMMON_FIELDS
875 xsltNumberData numdata
; /* number */
879 * xsltStyleItemChoose:
881 * <!-- Category: instruction -->
883 * <!-- Content: (xsl:when+, xsl:otherwise?) -->
886 typedef xsltStyleBasicEmptyItem xsltStyleItemChoose
;
887 typedef xsltStyleItemChoose
*xsltStyleItemChoosePtr
;
890 * xsltStyleItemFallback:
892 * <!-- Category: instruction -->
894 * <!-- Content: template -->
897 typedef xsltStyleBasicEmptyItem xsltStyleItemFallback
;
898 typedef xsltStyleItemFallback
*xsltStyleItemFallbackPtr
;
901 * xsltStyleItemForEach:
903 * <!-- Category: instruction -->
905 * select = node-set-expression>
906 * <!-- Content: (xsl:sort*, template) -->
909 typedef xsltStyleBasicExpressionItem xsltStyleItemForEach
;
910 typedef xsltStyleItemForEach
*xsltStyleItemForEachPtr
;
913 * xsltStyleItemMessage:
915 * <!-- Category: instruction -->
917 * terminate = "yes" | "no">
918 * <!-- Content: template -->
921 typedef struct _xsltStyleItemMessage xsltStyleItemMessage
;
922 typedef xsltStyleItemMessage
*xsltStyleItemMessagePtr
;
924 struct _xsltStyleItemMessage
{
925 XSLT_ITEM_COMMON_FIELDS
930 * xsltStyleItemDocument:
932 * NOTE: This is not an instruction of XSLT 1.0.
934 typedef struct _xsltStyleItemDocument xsltStyleItemDocument
;
935 typedef xsltStyleItemDocument
*xsltStyleItemDocumentPtr
;
937 struct _xsltStyleItemDocument
{
938 XSLT_ITEM_COMMON_FIELDS
939 int ver11
; /* assigned: in xsltDocumentComp;
941 TODO: Check if we need. */
942 const xmlChar
*filename
; /* document URL */
946 /************************************************************************
948 * Non-instructions (actually properties of instructions/declarations) *
950 ************************************************************************/
953 * xsltStyleBasicItemVariable:
955 * Basic struct for xsl:variable, xsl:param and xsl:with-param.
956 * It's currently important to have equal fields, since
957 * xsltParseStylesheetCallerParam() is used with xsl:with-param from
958 * the xslt side and with xsl:param from the exslt side (in
959 * exsltFuncFunctionFunction()).
961 * FUTURE NOTE: In XSLT 2.0 xsl:param, xsl:variable and xsl:with-param
962 * have additional different fields.
964 typedef struct _xsltStyleBasicItemVariable xsltStyleBasicItemVariable
;
965 typedef xsltStyleBasicItemVariable
*xsltStyleBasicItemVariablePtr
;
967 struct _xsltStyleBasicItemVariable
{
968 XSLT_ITEM_COMMON_FIELDS
970 const xmlChar
*select
;
971 xmlXPathCompExprPtr comp
;
980 * xsltStyleItemVariable:
982 * <!-- Category: top-level-element -->
985 * select = expression>
986 * <!-- Content: template -->
989 typedef xsltStyleBasicItemVariable xsltStyleItemVariable
;
990 typedef xsltStyleItemVariable
*xsltStyleItemVariablePtr
;
993 * xsltStyleItemParam:
995 * <!-- Category: top-level-element -->
998 * select = expression>
999 * <!-- Content: template -->
1002 typedef struct _xsltStyleItemParam xsltStyleItemParam
;
1003 typedef xsltStyleItemParam
*xsltStyleItemParamPtr
;
1005 struct _xsltStyleItemParam
{
1006 XSLT_ITEM_COMMON_FIELDS
1008 const xmlChar
*select
;
1009 xmlXPathCompExprPtr comp
;
1011 const xmlChar
*name
;
1018 * xsltStyleItemWithParam:
1022 * select = expression>
1023 * <!-- Content: template -->
1026 typedef xsltStyleBasicItemVariable xsltStyleItemWithParam
;
1027 typedef xsltStyleItemWithParam
*xsltStyleItemWithParamPtr
;
1030 * xsltStyleItemSort:
1032 * Reflects the XSLT xsl:sort item.
1033 * Allowed parents: xsl:apply-templates, xsl:for-each
1035 * select = string-expression
1036 * lang = { nmtoken }
1037 * data-type = { "text" | "number" | qname-but-not-ncname }
1038 * order = { "ascending" | "descending" }
1039 * case-order = { "upper-first" | "lower-first" } />
1041 typedef struct _xsltStyleItemSort xsltStyleItemSort
;
1042 typedef xsltStyleItemSort
*xsltStyleItemSortPtr
;
1044 struct _xsltStyleItemSort
{
1045 XSLT_ITEM_COMMON_FIELDS
1047 const xmlChar
*stype
; /* sort */
1048 int has_stype
; /* sort */
1049 int number
; /* sort */
1050 const xmlChar
*order
; /* sort */
1051 int has_order
; /* sort */
1052 int descending
; /* sort */
1053 const xmlChar
*lang
; /* sort */
1054 int has_lang
; /* sort */
1055 xsltLocale locale
; /* sort */
1056 const xmlChar
*case_order
; /* sort */
1057 int lower_first
; /* sort */
1062 const xmlChar
*select
; /* sort, copy-of, value-of, apply-templates */
1064 xmlXPathCompExprPtr comp
; /* a precompiled XPath expression */
1069 * xsltStyleItemWhen:
1072 * test = boolean-expression>
1073 * <!-- Content: template -->
1075 * Allowed parent: xsl:choose
1077 typedef struct _xsltStyleItemWhen xsltStyleItemWhen
;
1078 typedef xsltStyleItemWhen
*xsltStyleItemWhenPtr
;
1080 struct _xsltStyleItemWhen
{
1081 XSLT_ITEM_COMMON_FIELDS
1083 const xmlChar
*test
;
1084 xmlXPathCompExprPtr comp
;
1088 * xsltStyleItemOtherwise:
1090 * Allowed parent: xsl:choose
1092 * <!-- Content: template -->
1095 typedef struct _xsltStyleItemOtherwise xsltStyleItemOtherwise
;
1096 typedef xsltStyleItemOtherwise
*xsltStyleItemOtherwisePtr
;
1098 struct _xsltStyleItemOtherwise
{
1099 XSLT_ITEM_COMMON_FIELDS
1102 typedef struct _xsltStyleItemInclude xsltStyleItemInclude
;
1103 typedef xsltStyleItemInclude
*xsltStyleItemIncludePtr
;
1105 struct _xsltStyleItemInclude
{
1106 XSLT_ITEM_COMMON_FIELDS
1107 xsltDocumentPtr include
;
1110 /************************************************************************
1112 * XSLT elements in forwards-compatible mode *
1114 ************************************************************************/
1116 typedef struct _xsltStyleItemUknown xsltStyleItemUknown
;
1117 typedef xsltStyleItemUknown
*xsltStyleItemUknownPtr
;
1118 struct _xsltStyleItemUknown
{
1119 XSLT_ITEM_COMMON_FIELDS
1123 /************************************************************************
1125 * Extension elements *
1127 ************************************************************************/
1130 * xsltStyleItemExtElement:
1132 * Reflects extension elements.
1134 * NOTE: Due to the fact that the structure xsltElemPreComp is most
1135 * probably already heavily in use out there by users, so we cannot
1136 * easily change it, we'll create an intermediate structure which will
1137 * hold an xsltElemPreCompPtr.
1138 * BIG NOTE: The only problem I see here is that the user processes the
1139 * content of the stylesheet tree, possibly he'll lookup the node->psvi
1140 * fields in order to find subsequent extension functions.
1141 * In this case, the user's code will break, since the node->psvi
1142 * field will hold now the xsltStyleItemExtElementPtr and not
1143 * the xsltElemPreCompPtr.
1144 * However the place where the structure is anchored in the node-tree,
1145 * namely node->psvi, has beed already once been moved from node->_private
1146 * to node->psvi, so we have a precedent here, which, I think, should allow
1147 * us to change such semantics without headaches.
1149 typedef struct _xsltStyleItemExtElement xsltStyleItemExtElement
;
1150 typedef xsltStyleItemExtElement
*xsltStyleItemExtElementPtr
;
1151 struct _xsltStyleItemExtElement
{
1152 XSLT_ITEM_COMMON_FIELDS
1153 xsltElemPreCompPtr item
;
1156 /************************************************************************
1158 * Literal result elements *
1160 ************************************************************************/
1162 typedef struct _xsltEffectiveNs xsltEffectiveNs
;
1163 typedef xsltEffectiveNs
*xsltEffectiveNsPtr
;
1164 struct _xsltEffectiveNs
{
1165 xsltEffectiveNsPtr nextInStore
; /* storage next */
1166 xsltEffectiveNsPtr next
; /* next item in the list */
1167 const xmlChar
*prefix
;
1168 const xmlChar
*nsName
;
1170 * Indicates if eclared on the literal result element; dunno if really
1177 * Info for literal result elements.
1178 * This will be set on the elem->psvi field and will be
1179 * shared by literal result elements, which have the same
1180 * excluded result namespaces; i.e., this *won't* be created uniquely
1181 * for every literal result element.
1183 typedef struct _xsltStyleItemLRElementInfo xsltStyleItemLRElementInfo
;
1184 typedef xsltStyleItemLRElementInfo
*xsltStyleItemLRElementInfoPtr
;
1185 struct _xsltStyleItemLRElementInfo
{
1186 XSLT_ITEM_COMMON_FIELDS
1188 * @effectiveNs is the set of effective ns-nodes
1189 * on the literal result element, which will be added to the result
1190 * element if not already existing in the result tree.
1191 * This means that excluded namespaces (via exclude-result-prefixes,
1192 * extension-element-prefixes and the XSLT namespace) not added
1194 * Namespace-aliasing was applied on the @effectiveNs.
1196 xsltEffectiveNsPtr effectiveNs
;
1200 #ifdef XSLT_REFACTORED
1202 typedef struct _xsltNsAlias xsltNsAlias
;
1203 typedef xsltNsAlias
*xsltNsAliasPtr
;
1204 struct _xsltNsAlias
{
1205 xsltNsAliasPtr next
; /* next in the list */
1208 xmlDocPtr docOfTargetNs
;
1212 #ifdef XSLT_REFACTORED_XSLT_NSCOMP
1214 typedef struct _xsltNsMap xsltNsMap
;
1215 typedef xsltNsMap
*xsltNsMapPtr
;
1217 xsltNsMapPtr next
; /* next in the list */
1219 xmlNodePtr elem
; /* the element holding the ns-decl */
1220 xmlNsPtr ns
; /* the xmlNs structure holding the XML namespace name */
1221 const xmlChar
*origNsName
; /* the original XML namespace name */
1222 const xmlChar
*newNsName
; /* the mapped XML namespace name */
1226 /************************************************************************
1228 * Compile-time structures for *internal* use only *
1230 ************************************************************************/
1232 typedef struct _xsltPrincipalStylesheetData xsltPrincipalStylesheetData
;
1233 typedef xsltPrincipalStylesheetData
*xsltPrincipalStylesheetDataPtr
;
1235 typedef struct _xsltNsList xsltNsList
;
1236 typedef xsltNsList
*xsltNsListPtr
;
1237 struct _xsltNsList
{
1238 xsltNsListPtr next
; /* next in the list */
1245 * Used at compilation time for parameters and variables.
1247 typedef struct _xsltVarInfo xsltVarInfo
;
1248 typedef xsltVarInfo
*xsltVarInfoPtr
;
1249 struct _xsltVarInfo
{
1250 xsltVarInfoPtr next
; /* next in the list */
1251 xsltVarInfoPtr prev
;
1252 int depth
; /* the depth in the tree */
1253 const xmlChar
*name
;
1254 const xmlChar
*nsName
;
1258 * xsltCompilerNodeInfo:
1260 * Per-node information during compile-time.
1262 typedef struct _xsltCompilerNodeInfo xsltCompilerNodeInfo
;
1263 typedef xsltCompilerNodeInfo
*xsltCompilerNodeInfoPtr
;
1264 struct _xsltCompilerNodeInfo
{
1265 xsltCompilerNodeInfoPtr next
;
1266 xsltCompilerNodeInfoPtr prev
;
1269 xsltTemplatePtr templ
; /* The owning template */
1270 int category
; /* XSLT element, LR-element or
1271 extension element */
1273 xsltElemPreCompPtr item
; /* The compiled information */
1274 /* The current in-scope namespaces */
1275 xsltNsListContainerPtr inScopeNs
;
1276 /* The current excluded result namespaces */
1277 xsltPointerListPtr exclResultNs
;
1278 /* The current extension instruction namespaces */
1279 xsltPointerListPtr extElemNs
;
1281 /* The current info for literal result elements. */
1282 xsltStyleItemLRElementInfoPtr litResElemInfo
;
1284 * Set to 1 if in-scope namespaces changed,
1285 * or excluded result namespaces changed,
1286 * or extension element namespaces changed.
1287 * This will trigger creation of new infos
1288 * for literal result elements.
1291 int preserveWhitespace
;
1292 int stripWhitespace
;
1293 int isRoot
; /* whether this is the stylesheet's root node */
1294 int forwardsCompat
; /* whether forwards-compatible mode is enabled */
1295 /* whether the content of an extension element was processed */
1296 int extContentHandled
;
1297 /* the type of the current child */
1298 xsltStyleType curChildType
;
1304 * get pointer to compiler context
1306 #define XSLT_CCTXT(style) ((xsltCompilerCtxtPtr) style->compCtxt)
1309 XSLT_ERROR_SEVERITY_ERROR
= 0,
1310 XSLT_ERROR_SEVERITY_WARNING
1311 } xsltErrorSeverityType
;
1313 typedef struct _xsltCompilerCtxt xsltCompilerCtxt
;
1314 typedef xsltCompilerCtxt
*xsltCompilerCtxtPtr
;
1315 struct _xsltCompilerCtxt
{
1316 void *errorCtxt
; /* user specific error context */
1318 * used for error/warning reports; e.g. XSLT_ERROR_SEVERITY_WARNING */
1319 xsltErrorSeverityType errSeverity
;
1320 int warnings
; /* TODO: number of warnings found at
1322 int errors
; /* TODO: number of errors found at
1325 xsltStylesheetPtr style
;
1326 int simplified
; /* whether this is a simplified stylesheet */
1327 /* TODO: structured/unstructured error contexts. */
1328 int depth
; /* Current depth of processing */
1330 xsltCompilerNodeInfoPtr inode
;
1331 xsltCompilerNodeInfoPtr inodeList
;
1332 xsltCompilerNodeInfoPtr inodeLast
;
1333 xsltPointerListPtr tmpList
; /* Used for various purposes */
1335 * The XSLT version as specified by the stylesheet's root element.
1338 int hasForwardsCompat
; /* whether forwards-compatible mode was used
1339 in a parsing episode */
1340 int maxNodeInfos
; /* TEMP TODO: just for the interest */
1341 int maxLREs
; /* TEMP TODO: just for the interest */
1343 * In order to keep the old behaviour, applying strict rules of
1344 * the spec can be turned off. This has effect only on special
1345 * mechanisms like whitespace-stripping in the stylesheet.
1348 xsltPrincipalStylesheetDataPtr psData
;
1349 #ifdef XSLT_REFACTORED_XPATHCOMP
1350 xmlXPathContextPtr xpathCtxt
;
1352 xsltStyleItemUknownPtr unknownItem
;
1353 int hasNsAliases
; /* Indicator if there was an xsl:namespace-alias. */
1354 xsltNsAliasPtr nsAliases
;
1355 xsltVarInfoPtr ivars
; /* Storage of local in-scope variables/params. */
1356 xsltVarInfoPtr ivar
; /* topmost local variable/param. */
1359 #else /* XSLT_REFACTORED */
1361 * The old structures before refactoring.
1365 * _xsltStylePreComp:
1367 * The in-memory structure corresponding to XSLT stylesheet constructs
1370 struct _xsltStylePreComp
{
1371 xsltElemPreCompPtr next
; /* chained list */
1372 xsltStyleType type
; /* type of the element */
1373 xsltTransformFunction func
; /* handling function */
1374 xmlNodePtr inst
; /* the instruction */
1377 * Pre computed values.
1380 const xmlChar
*stype
; /* sort */
1381 int has_stype
; /* sort */
1382 int number
; /* sort */
1383 const xmlChar
*order
; /* sort */
1384 int has_order
; /* sort */
1385 int descending
; /* sort */
1386 const xmlChar
*lang
; /* sort */
1387 int has_lang
; /* sort */
1388 xsltLocale locale
; /* sort */
1389 const xmlChar
*case_order
; /* sort */
1390 int lower_first
; /* sort */
1392 const xmlChar
*use
; /* copy, element */
1393 int has_use
; /* copy, element */
1395 int noescape
; /* text */
1397 const xmlChar
*name
; /* element, attribute, pi */
1398 int has_name
; /* element, attribute, pi */
1399 const xmlChar
*ns
; /* element */
1400 int has_ns
; /* element */
1402 const xmlChar
*mode
; /* apply-templates */
1403 const xmlChar
*modeURI
; /* apply-templates */
1405 const xmlChar
*test
; /* if */
1407 xsltTemplatePtr templ
; /* call-template */
1409 const xmlChar
*select
; /* sort, copy-of, value-of, apply-templates */
1411 int ver11
; /* document */
1412 const xmlChar
*filename
; /* document URL */
1413 int has_filename
; /* document */
1415 xsltNumberData numdata
; /* number */
1417 xmlXPathCompExprPtr comp
; /* a precompiled XPath expression */
1418 xmlNsPtr
*nsList
; /* the namespaces in scope */
1419 int nsNr
; /* the number of namespaces in scope */
1422 #endif /* XSLT_REFACTORED */
1426 * The in-memory structure corresponding to an XSLT Variable
1429 typedef struct _xsltStackElem xsltStackElem
;
1430 typedef xsltStackElem
*xsltStackElemPtr
;
1431 struct _xsltStackElem
{
1432 struct _xsltStackElem
*next
;/* chained list */
1433 xsltStylePreCompPtr comp
; /* the compiled form */
1434 int computed
; /* was the evaluation done */
1435 const xmlChar
*name
; /* the local part of the name QName */
1436 const xmlChar
*nameURI
; /* the URI part of the name QName */
1437 const xmlChar
*select
; /* the eval string */
1438 xmlNodePtr tree
; /* the sequence constructor if no eval
1439 string or the location */
1440 xmlXPathObjectPtr value
; /* The value if computed */
1441 xmlDocPtr fragment
; /* The Result Tree Fragments (needed for XSLT 1.0)
1442 which are bound to the variable's lifetime. */
1443 int level
; /* the depth in the tree;
1444 -1 if persistent (e.g. a given xsl:with-param) */
1445 xsltTransformContextPtr context
; /* The transformation context; needed to cache
1450 #ifdef XSLT_REFACTORED
1452 struct _xsltPrincipalStylesheetData
{
1454 * Namespace dictionary for ns-prefixes and ns-names:
1455 * TODO: Shared between stylesheets, and XPath mechanisms.
1458 xmlDictPtr namespaceDict
;
1460 * Global list of in-scope namespaces.
1462 xsltPointerListPtr inScopeNamespaces
;
1464 * Global list of information for [xsl:]excluded-result-prefixes.
1466 xsltPointerListPtr exclResultNamespaces
;
1468 * Global list of information for [xsl:]extension-element-prefixes.
1470 xsltPointerListPtr extElemNamespaces
;
1471 xsltEffectiveNsPtr effectiveNs
;
1472 #ifdef XSLT_REFACTORED_XSLT_NSCOMP
1474 * Namespace name map to get rid of string comparison of namespace names.
1483 * Note that we added a @compCtxt field to anchor an stylesheet compilation
1484 * context, since, due to historical reasons, various compile-time function
1485 * take only the stylesheet as argument and not a compilation context.
1487 struct _xsltStylesheet
{
1489 * The stylesheet import relation is kept as a tree.
1491 struct _xsltStylesheet
*parent
;
1492 struct _xsltStylesheet
*next
;
1493 struct _xsltStylesheet
*imports
;
1495 xsltDocumentPtr docList
; /* the include document list */
1498 * General data on the style sheet document.
1500 xmlDocPtr doc
; /* the parsed XML stylesheet */
1501 xmlHashTablePtr stripSpaces
;/* the hash table of the strip-space and
1502 preserve space elements */
1503 int stripAll
; /* strip-space * (1) preserve-space * (-1) */
1504 xmlHashTablePtr cdataSection
;/* the hash table of the cdata-section */
1507 * Global variable or parameters.
1509 xsltStackElemPtr variables
; /* linked list of param and variables */
1512 * Template descriptions.
1514 xsltTemplatePtr templates
; /* the ordered list of templates */
1515 void *templatesHash
; /* hash table or wherever compiled templates
1516 informations are stored */
1517 void *rootMatch
; /* template based on / */
1518 void *keyMatch
; /* template based on key() */
1519 void *elemMatch
; /* template based on * */
1520 void *attrMatch
; /* template based on @* */
1521 void *parentMatch
; /* template based on .. */
1522 void *textMatch
; /* template based on text() */
1523 void *piMatch
; /* template based on processing-instruction() */
1524 void *commentMatch
; /* template based on comment() */
1527 * Namespace aliases.
1528 * NOTE: Not used in the refactored code.
1530 xmlHashTablePtr nsAliases
; /* the namespace alias hash tables */
1535 xmlHashTablePtr attributeSets
;/* the attribute sets hash tables */
1539 * TODO: Eliminate this.
1541 xmlHashTablePtr nsHash
; /* the set of namespaces in use:
1542 ATTENTION: This is used for
1543 execution of XPath expressions; unfortunately
1544 it restricts the stylesheet to have distinct
1546 TODO: We need to get rid of this.
1548 void *nsDefs
; /* ATTENTION TODO: This is currently used to store
1549 xsltExtDefPtr (in extensions.c) and
1556 void *keys
; /* key definitions */
1559 * Output related stuff.
1561 xmlChar
*method
; /* the output method */
1562 xmlChar
*methodURI
; /* associated namespace if any */
1563 xmlChar
*version
; /* version string */
1564 xmlChar
*encoding
; /* encoding string */
1565 int omitXmlDeclaration
; /* omit-xml-declaration = "yes" | "no" */
1568 * Number formatting.
1570 xsltDecimalFormatPtr decimalFormat
;
1571 int standalone
; /* standalone = "yes" | "no" */
1572 xmlChar
*doctypePublic
; /* doctype-public string */
1573 xmlChar
*doctypeSystem
; /* doctype-system string */
1574 int indent
; /* should output being indented */
1575 xmlChar
*mediaType
; /* media-type string */
1578 * Precomputed blocks.
1580 xsltElemPreCompPtr preComps
;/* list of precomputed blocks */
1581 int warnings
; /* number of warnings found at compilation */
1582 int errors
; /* number of errors found at compilation */
1584 xmlChar
*exclPrefix
; /* last excluded prefixes */
1585 xmlChar
**exclPrefixTab
; /* array of excluded prefixes */
1586 int exclPrefixNr
; /* number of excluded prefixes in scope */
1587 int exclPrefixMax
; /* size of the array */
1589 void *_private
; /* user defined data */
1594 xmlHashTablePtr extInfos
; /* the extension data */
1595 int extrasNr
; /* the number of extras required */
1598 * For keeping track of nested includes
1600 xsltDocumentPtr includes
; /* points to last nested include */
1603 * dictionary: shared between stylesheet, context and documents.
1607 * precompiled attribute value templates.
1611 * if namespace-alias has an alias for the default stylesheet prefix
1612 * NOTE: Not used in the refactored code.
1614 const xmlChar
*defaultAlias
;
1616 * bypass pre-processing (already done) (used in imports)
1620 * all document text strings were internalized
1624 * Literal Result Element as Stylesheet c.f. section 2.3
1628 * The principal stylesheet
1630 xsltStylesheetPtr principal
;
1631 #ifdef XSLT_REFACTORED
1633 * Compilation context used during compile-time.
1635 xsltCompilerCtxtPtr compCtxt
; /* TODO: Change this to (void *). */
1637 xsltPrincipalStylesheetDataPtr principalData
;
1640 * Forwards-compatible processing
1642 int forwards_compatible
;
1644 xmlHashTablePtr namedTemplates
; /* hash table of named templates */
1647 typedef struct _xsltTransformCache xsltTransformCache
;
1648 typedef xsltTransformCache
*xsltTransformCachePtr
;
1649 struct _xsltTransformCache
{
1652 xsltStackElemPtr stackItems
;
1654 #ifdef XSLT_DEBUG_PROFILE_CACHE
1663 * The in-memory structure corresponding to an XSLT Transformation.
1666 XSLT_OUTPUT_XML
= 0,
1675 } xsltTransformState
;
1677 struct _xsltTransformContext
{
1678 xsltStylesheetPtr style
; /* the stylesheet used */
1679 xsltOutputType type
; /* the type of output */
1681 xsltTemplatePtr templ
; /* the current template */
1682 int templNr
; /* Nb of templates in the stack */
1683 int templMax
; /* Size of the templtes stack */
1684 xsltTemplatePtr
*templTab
; /* the template stack */
1686 xsltStackElemPtr vars
; /* the current variable list */
1687 int varsNr
; /* Nb of variable list in the stack */
1688 int varsMax
; /* Size of the variable list stack */
1689 xsltStackElemPtr
*varsTab
; /* the variable list stack */
1690 int varsBase
; /* the var base for current templ */
1695 xmlHashTablePtr extFunctions
; /* the extension functions */
1696 xmlHashTablePtr extElements
; /* the extension elements */
1697 xmlHashTablePtr extInfos
; /* the extension data */
1699 const xmlChar
*mode
; /* the current mode */
1700 const xmlChar
*modeURI
; /* the current mode URI */
1702 xsltDocumentPtr docList
; /* the document list */
1704 xsltDocumentPtr document
; /* the current source document; can be NULL if an RTF */
1705 xmlNodePtr node
; /* the current node being processed */
1706 xmlNodeSetPtr nodeList
; /* the current node list */
1707 /* xmlNodePtr current; the node */
1709 xmlDocPtr output
; /* the resulting document */
1710 xmlNodePtr insert
; /* the insertion node */
1712 xmlXPathContextPtr xpathCtxt
; /* the XPath context */
1713 xsltTransformState state
; /* the current state */
1718 xmlHashTablePtr globalVars
; /* the global variables and params */
1720 xmlNodePtr inst
; /* the instruction in the stylesheet */
1722 int xinclude
; /* should XInclude be processed */
1724 const char * outputFile
; /* the output URI if known */
1726 int profile
; /* is this run profiled */
1727 long prof
; /* the current profiled value */
1728 int profNr
; /* Nb of templates in the stack */
1729 int profMax
; /* Size of the templtaes stack */
1730 long *profTab
; /* the profile template stack */
1732 void *_private
; /* user defined data */
1734 int extrasNr
; /* the number of extras used */
1735 int extrasMax
; /* the number of extras allocated */
1736 xsltRuntimeExtraPtr extras
; /* extra per runtime informations */
1738 xsltDocumentPtr styleList
; /* the stylesheet docs list */
1739 void * sec
; /* the security preferences if any */
1741 xmlGenericErrorFunc error
; /* a specific error handler */
1742 void * errctx
; /* context for the error handler */
1744 xsltSortFunc sortfunc
; /* a ctxt specific sort routine */
1747 * handling of temporary Result Value Tree
1748 * (XSLT 1.0 term: "Result Tree Fragment")
1750 xmlDocPtr tmpRVT
; /* list of RVT without persistance */
1751 xmlDocPtr persistRVT
; /* list of persistant RVTs */
1752 int ctxtflags
; /* context processing flags */
1755 * Speed optimization when coalescing text nodes
1757 const xmlChar
*lasttext
; /* last text node content */
1758 int lasttsize
; /* last text node size */
1759 int lasttuse
; /* last text node use */
1761 * Per Context Debugging
1763 int debugStatus
; /* the context level debug status */
1764 unsigned long* traceCode
; /* pointer to the variable holding the mask */
1766 int parserOptions
; /* parser options xmlParserOption */
1769 * dictionary: shared between stylesheet, context and documents.
1772 xmlDocPtr tmpDoc
; /* Obsolete; not used in the library. */
1774 * all document text strings are internalized
1778 int hasTemplKeyPatterns
;
1779 xsltTemplatePtr currentTemplateRule
; /* the Current Template Rule */
1780 xmlNodePtr initialContextNode
;
1781 xmlDocPtr initialContextDoc
;
1782 xsltTransformCachePtr cache
;
1783 void *contextVariable
; /* the current variable item */
1784 xmlDocPtr localRVT
; /* list of local tree fragments; will be freed when
1785 the instruction which created the fragment
1787 xmlDocPtr localRVTBase
; /* Obsolete */
1788 int keyInitLevel
; /* Needed to catch recursive keys issues */
1789 int depth
; /* Needed to catch recursions */
1790 int maxTemplateDepth
;
1791 int maxTemplateVars
;
1797 * Macro to check if the XSLT processing should be stopped.
1798 * Will return from the function.
1800 #define CHECK_STOPPED if (ctxt->state == XSLT_STATE_STOPPED) return;
1805 * Macro to check if the XSLT processing should be stopped.
1806 * Will goto the error: label.
1808 #define CHECK_STOPPEDE if (ctxt->state == XSLT_STATE_STOPPED) goto error;
1813 * Macro to check if the XSLT processing should be stopped.
1814 * Will return from the function with a 0 value.
1816 #define CHECK_STOPPED0 if (ctxt->state == XSLT_STATE_STOPPED) return(0);
1819 * The macro XML_CAST_FPTR is a hack to avoid a gcc warning about
1820 * possible incompatibilities between function pointers and object
1821 * pointers. It is defined in libxml/hash.h within recent versions
1822 * of libxml2, but is put here for compatibility.
1824 #ifndef XML_CAST_FPTR
1827 * @fptr: pointer to a function
1829 * Macro to do a casting from an object pointer to a
1830 * function pointer without encountering a warning from
1833 * #define XML_CAST_FPTR(fptr) (*(void **)(&fptr))
1834 * This macro violated ISO C aliasing rules (gcc4 on s390 broke)
1835 * so it is disabled now
1838 #define XML_CAST_FPTR(fptr) fptr
1841 * Functions associated to the internal types
1842 xsltDecimalFormatPtr xsltDecimalFormatGetByName(xsltStylesheetPtr sheet,
1845 XSLTPUBFUN xsltStylesheetPtr XSLTCALL
1846 xsltNewStylesheet (void);
1847 XSLTPUBFUN xsltStylesheetPtr XSLTCALL
1848 xsltParseStylesheetFile (const xmlChar
* filename
);
1849 XSLTPUBFUN
void XSLTCALL
1850 xsltFreeStylesheet (xsltStylesheetPtr style
);
1851 XSLTPUBFUN
int XSLTCALL
1852 xsltIsBlank (xmlChar
*str
);
1853 XSLTPUBFUN
void XSLTCALL
1854 xsltFreeStackElemList (xsltStackElemPtr elem
);
1855 XSLTPUBFUN xsltDecimalFormatPtr XSLTCALL
1856 xsltDecimalFormatGetByName(xsltStylesheetPtr style
,
1858 XSLTPUBFUN xsltDecimalFormatPtr XSLTCALL
1859 xsltDecimalFormatGetByQName(xsltStylesheetPtr style
,
1860 const xmlChar
*nsUri
,
1861 const xmlChar
*name
);
1863 XSLTPUBFUN xsltStylesheetPtr XSLTCALL
1864 xsltParseStylesheetProcess(xsltStylesheetPtr ret
,
1866 XSLTPUBFUN
void XSLTCALL
1867 xsltParseStylesheetOutput(xsltStylesheetPtr style
,
1869 XSLTPUBFUN xsltStylesheetPtr XSLTCALL
1870 xsltParseStylesheetDoc (xmlDocPtr doc
);
1871 XSLTPUBFUN xsltStylesheetPtr XSLTCALL
1872 xsltParseStylesheetImportedDoc(xmlDocPtr doc
,
1873 xsltStylesheetPtr style
);
1874 XSLTPUBFUN xsltStylesheetPtr XSLTCALL
1875 xsltLoadStylesheetPI (xmlDocPtr doc
);
1876 XSLTPUBFUN
void XSLTCALL
1877 xsltNumberFormat (xsltTransformContextPtr ctxt
,
1878 xsltNumberDataPtr data
,
1880 XSLTPUBFUN xmlXPathError XSLTCALL
1881 xsltFormatNumberConversion(xsltDecimalFormatPtr self
,
1886 XSLTPUBFUN
void XSLTCALL
1887 xsltParseTemplateContent(xsltStylesheetPtr style
,
1889 XSLTPUBFUN
int XSLTCALL
1890 xsltAllocateExtra (xsltStylesheetPtr style
);
1891 XSLTPUBFUN
int XSLTCALL
1892 xsltAllocateExtraCtxt (xsltTransformContextPtr ctxt
);
1894 * Extra functions for Result Value Trees
1896 XSLTPUBFUN xmlDocPtr XSLTCALL
1897 xsltCreateRVT (xsltTransformContextPtr ctxt
);
1898 XSLTPUBFUN
int XSLTCALL
1899 xsltRegisterTmpRVT (xsltTransformContextPtr ctxt
,
1901 XSLTPUBFUN
int XSLTCALL
1902 xsltRegisterLocalRVT (xsltTransformContextPtr ctxt
,
1904 XSLTPUBFUN
int XSLTCALL
1905 xsltRegisterPersistRVT (xsltTransformContextPtr ctxt
,
1907 XSLTPUBFUN
int XSLTCALL
1908 xsltExtensionInstructionResultRegister(
1909 xsltTransformContextPtr ctxt
,
1910 xmlXPathObjectPtr obj
);
1911 XSLTPUBFUN
int XSLTCALL
1912 xsltExtensionInstructionResultFinalize(
1913 xsltTransformContextPtr ctxt
);
1914 XSLTPUBFUN
int XSLTCALL
1916 xsltTransformContextPtr ctxt
,
1917 xmlXPathObjectPtr obj
,
1919 XSLTPUBFUN
void XSLTCALL
1920 xsltFreeRVTs (xsltTransformContextPtr ctxt
);
1921 XSLTPUBFUN
void XSLTCALL
1922 xsltReleaseRVT (xsltTransformContextPtr ctxt
,
1925 * Extra functions for Attribute Value Templates
1927 XSLTPUBFUN
void XSLTCALL
1928 xsltCompileAttr (xsltStylesheetPtr style
,
1930 XSLTPUBFUN xmlChar
* XSLTCALL
1931 xsltEvalAVT (xsltTransformContextPtr ctxt
,
1934 XSLTPUBFUN
void XSLTCALL
1935 xsltFreeAVTList (void *avt
);
1938 * Extra function for successful xsltCleanupGlobals / xsltInit sequence.
1941 XSLTPUBFUN
void XSLTCALL
1944 /************************************************************************
1946 * Compile-time functions for *internal* use only *
1948 ************************************************************************/
1950 #ifdef XSLT_REFACTORED
1951 XSLTPUBFUN
void XSLTCALL
1952 xsltParseSequenceConstructor(
1953 xsltCompilerCtxtPtr cctxt
,
1955 XSLTPUBFUN
int XSLTCALL
1956 xsltParseAnyXSLTElem (xsltCompilerCtxtPtr cctxt
,
1958 #ifdef XSLT_REFACTORED_XSLT_NSCOMP
1959 XSLTPUBFUN
int XSLTCALL
1960 xsltRestoreDocumentNamespaces(
1964 #endif /* XSLT_REFACTORED */
1966 /************************************************************************
1968 * Transformation-time functions for *internal* use only *
1970 ************************************************************************/
1971 XSLTPUBFUN
int XSLTCALL
1972 xsltInitCtxtKey (xsltTransformContextPtr ctxt
,
1973 xsltDocumentPtr doc
,
1974 xsltKeyDefPtr keyd
);
1975 XSLTPUBFUN
int XSLTCALL
1976 xsltInitAllDocKeys (xsltTransformContextPtr ctxt
);
1981 #endif /* __XML_XSLT_H__ */