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 */
302 * Data structure of decimal-format.
304 typedef struct _xsltDecimalFormat xsltDecimalFormat
;
305 typedef xsltDecimalFormat
*xsltDecimalFormatPtr
;
306 struct _xsltDecimalFormat
{
307 struct _xsltDecimalFormat
*next
; /* chained list */
309 /* Used for interpretation of pattern */
311 xmlChar
*patternSeparator
;
312 /* May appear in result */
315 xmlChar
*noNumber
; /* Not-a-number */
316 /* Used for interpretation of pattern and may appear in result */
317 xmlChar
*decimalPoint
;
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 hold 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 hold 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 xsltLocale locale
; /* sort */
1050 const xmlChar
*case_order
; /* sort */
1051 int lower_first
; /* sort */
1056 const xmlChar
*select
; /* sort, copy-of, value-of, apply-templates */
1058 xmlXPathCompExprPtr comp
; /* a precompiled XPath expression */
1063 * xsltStyleItemWhen:
1066 * test = boolean-expression>
1067 * <!-- Content: template -->
1069 * Allowed parent: xsl:choose
1071 typedef struct _xsltStyleItemWhen xsltStyleItemWhen
;
1072 typedef xsltStyleItemWhen
*xsltStyleItemWhenPtr
;
1074 struct _xsltStyleItemWhen
{
1075 XSLT_ITEM_COMMON_FIELDS
1077 const xmlChar
*test
;
1078 xmlXPathCompExprPtr comp
;
1082 * xsltStyleItemOtherwise:
1084 * Allowed parent: xsl:choose
1086 * <!-- Content: template -->
1089 typedef struct _xsltStyleItemOtherwise xsltStyleItemOtherwise
;
1090 typedef xsltStyleItemOtherwise
*xsltStyleItemOtherwisePtr
;
1092 struct _xsltStyleItemOtherwise
{
1093 XSLT_ITEM_COMMON_FIELDS
1096 typedef struct _xsltStyleItemInclude xsltStyleItemInclude
;
1097 typedef xsltStyleItemInclude
*xsltStyleItemIncludePtr
;
1099 struct _xsltStyleItemInclude
{
1100 XSLT_ITEM_COMMON_FIELDS
1101 xsltDocumentPtr include
;
1104 /************************************************************************
1106 * XSLT elements in forwards-compatible mode *
1108 ************************************************************************/
1110 typedef struct _xsltStyleItemUknown xsltStyleItemUknown
;
1111 typedef xsltStyleItemUknown
*xsltStyleItemUknownPtr
;
1112 struct _xsltStyleItemUknown
{
1113 XSLT_ITEM_COMMON_FIELDS
1117 /************************************************************************
1119 * Extension elements *
1121 ************************************************************************/
1124 * xsltStyleItemExtElement:
1126 * Reflects extension elements.
1128 * NOTE: Due to the fact that the structure xsltElemPreComp is most
1129 * probably already heavily in use out there by users, so we cannot
1130 * easily change it, we'll create an intermediate structure which will
1131 * hold an xsltElemPreCompPtr.
1132 * BIG NOTE: The only problem I see here is that the user processes the
1133 * content of the stylesheet tree, possibly he'll lookup the node->psvi
1134 * fields in order to find subsequent extension functions.
1135 * In this case, the user's code will break, since the node->psvi
1136 * field will hold now the xsltStyleItemExtElementPtr and not
1137 * the xsltElemPreCompPtr.
1138 * However the place where the structure is anchored in the node-tree,
1139 * namely node->psvi, has beed already once been moved from node->_private
1140 * to node->psvi, so we have a precedent here, which, I think, should allow
1141 * us to change such semantics without headaches.
1143 typedef struct _xsltStyleItemExtElement xsltStyleItemExtElement
;
1144 typedef xsltStyleItemExtElement
*xsltStyleItemExtElementPtr
;
1145 struct _xsltStyleItemExtElement
{
1146 XSLT_ITEM_COMMON_FIELDS
1147 xsltElemPreCompPtr item
;
1150 /************************************************************************
1152 * Literal result elements *
1154 ************************************************************************/
1156 typedef struct _xsltEffectiveNs xsltEffectiveNs
;
1157 typedef xsltEffectiveNs
*xsltEffectiveNsPtr
;
1158 struct _xsltEffectiveNs
{
1159 xsltEffectiveNsPtr nextInStore
; /* storage next */
1160 xsltEffectiveNsPtr next
; /* next item in the list */
1161 const xmlChar
*prefix
;
1162 const xmlChar
*nsName
;
1164 * Indicates if eclared on the literal result element; dunno if really
1171 * Info for literal result elements.
1172 * This will be set on the elem->psvi field and will be
1173 * shared by literal result elements, which have the same
1174 * excluded result namespaces; i.e., this *won't* be created uniquely
1175 * for every literal result element.
1177 typedef struct _xsltStyleItemLRElementInfo xsltStyleItemLRElementInfo
;
1178 typedef xsltStyleItemLRElementInfo
*xsltStyleItemLRElementInfoPtr
;
1179 struct _xsltStyleItemLRElementInfo
{
1180 XSLT_ITEM_COMMON_FIELDS
1182 * @effectiveNs is the set of effective ns-nodes
1183 * on the literal result element, which will be added to the result
1184 * element if not already existing in the result tree.
1185 * This means that excluded namespaces (via exclude-result-prefixes,
1186 * extension-element-prefixes and the XSLT namespace) not added
1188 * Namespace-aliasing was applied on the @effectiveNs.
1190 xsltEffectiveNsPtr effectiveNs
;
1194 #ifdef XSLT_REFACTORED
1196 typedef struct _xsltNsAlias xsltNsAlias
;
1197 typedef xsltNsAlias
*xsltNsAliasPtr
;
1198 struct _xsltNsAlias
{
1199 xsltNsAliasPtr next
; /* next in the list */
1202 xmlDocPtr docOfTargetNs
;
1206 #ifdef XSLT_REFACTORED_XSLT_NSCOMP
1208 typedef struct _xsltNsMap xsltNsMap
;
1209 typedef xsltNsMap
*xsltNsMapPtr
;
1211 xsltNsMapPtr next
; /* next in the list */
1213 xmlNodePtr elem
; /* the element holding the ns-decl */
1214 xmlNsPtr ns
; /* the xmlNs structure holding the XML namespace name */
1215 const xmlChar
*origNsName
; /* the original XML namespace name */
1216 const xmlChar
*newNsName
; /* the mapped XML namespace name */
1220 /************************************************************************
1222 * Compile-time structures for *internal* use only *
1224 ************************************************************************/
1226 typedef struct _xsltPrincipalStylesheetData xsltPrincipalStylesheetData
;
1227 typedef xsltPrincipalStylesheetData
*xsltPrincipalStylesheetDataPtr
;
1229 typedef struct _xsltNsList xsltNsList
;
1230 typedef xsltNsList
*xsltNsListPtr
;
1231 struct _xsltNsList
{
1232 xsltNsListPtr next
; /* next in the list */
1239 * Used at compilation time for parameters and variables.
1241 typedef struct _xsltVarInfo xsltVarInfo
;
1242 typedef xsltVarInfo
*xsltVarInfoPtr
;
1243 struct _xsltVarInfo
{
1244 xsltVarInfoPtr next
; /* next in the list */
1245 xsltVarInfoPtr prev
;
1246 int depth
; /* the depth in the tree */
1247 const xmlChar
*name
;
1248 const xmlChar
*nsName
;
1252 * xsltCompilerNodeInfo:
1254 * Per-node information during compile-time.
1256 typedef struct _xsltCompilerNodeInfo xsltCompilerNodeInfo
;
1257 typedef xsltCompilerNodeInfo
*xsltCompilerNodeInfoPtr
;
1258 struct _xsltCompilerNodeInfo
{
1259 xsltCompilerNodeInfoPtr next
;
1260 xsltCompilerNodeInfoPtr prev
;
1263 xsltTemplatePtr templ
; /* The owning template */
1264 int category
; /* XSLT element, LR-element or
1265 extension element */
1267 xsltElemPreCompPtr item
; /* The compiled information */
1268 /* The current in-scope namespaces */
1269 xsltNsListContainerPtr inScopeNs
;
1270 /* The current excluded result namespaces */
1271 xsltPointerListPtr exclResultNs
;
1272 /* The current extension instruction namespaces */
1273 xsltPointerListPtr extElemNs
;
1275 /* The current info for literal result elements. */
1276 xsltStyleItemLRElementInfoPtr litResElemInfo
;
1278 * Set to 1 if in-scope namespaces changed,
1279 * or excluded result namespaces changed,
1280 * or extension element namespaces changed.
1281 * This will trigger creation of new infos
1282 * for literal result elements.
1285 int preserveWhitespace
;
1286 int stripWhitespace
;
1287 int isRoot
; /* whether this is the stylesheet's root node */
1288 int forwardsCompat
; /* whether forwards-compatible mode is enabled */
1289 /* whether the content of an extension element was processed */
1290 int extContentHandled
;
1291 /* the type of the current child */
1292 xsltStyleType curChildType
;
1298 * get pointer to compiler context
1300 #define XSLT_CCTXT(style) ((xsltCompilerCtxtPtr) style->compCtxt)
1303 XSLT_ERROR_SEVERITY_ERROR
= 0,
1304 XSLT_ERROR_SEVERITY_WARNING
1305 } xsltErrorSeverityType
;
1307 typedef struct _xsltCompilerCtxt xsltCompilerCtxt
;
1308 typedef xsltCompilerCtxt
*xsltCompilerCtxtPtr
;
1309 struct _xsltCompilerCtxt
{
1310 void *errorCtxt
; /* user specific error context */
1312 * used for error/warning reports; e.g. XSLT_ERROR_SEVERITY_WARNING */
1313 xsltErrorSeverityType errSeverity
;
1314 int warnings
; /* TODO: number of warnings found at
1316 int errors
; /* TODO: number of errors found at
1319 xsltStylesheetPtr style
;
1320 int simplified
; /* whether this is a simplified stylesheet */
1321 /* TODO: structured/unstructured error contexts. */
1322 int depth
; /* Current depth of processing */
1324 xsltCompilerNodeInfoPtr inode
;
1325 xsltCompilerNodeInfoPtr inodeList
;
1326 xsltCompilerNodeInfoPtr inodeLast
;
1327 xsltPointerListPtr tmpList
; /* Used for various purposes */
1329 * The XSLT version as specified by the stylesheet's root element.
1332 int hasForwardsCompat
; /* whether forwards-compatible mode was used
1333 in a parsing episode */
1334 int maxNodeInfos
; /* TEMP TODO: just for the interest */
1335 int maxLREs
; /* TEMP TODO: just for the interest */
1337 * In order to keep the old behaviour, applying strict rules of
1338 * the spec can be turned off. This has effect only on special
1339 * mechanisms like whitespace-stripping in the stylesheet.
1342 xsltPrincipalStylesheetDataPtr psData
;
1343 #ifdef XSLT_REFACTORED_XPATHCOMP
1344 xmlXPathContextPtr xpathCtxt
;
1346 xsltStyleItemUknownPtr unknownItem
;
1347 int hasNsAliases
; /* Indicator if there was an xsl:namespace-alias. */
1348 xsltNsAliasPtr nsAliases
;
1349 xsltVarInfoPtr ivars
; /* Storage of local in-scope variables/params. */
1350 xsltVarInfoPtr ivar
; /* topmost local variable/param. */
1353 #else /* XSLT_REFACTORED */
1355 * The old structures before refactoring.
1359 * _xsltStylePreComp:
1361 * The in-memory structure corresponding to XSLT stylesheet constructs
1364 struct _xsltStylePreComp
{
1365 xsltElemPreCompPtr next
; /* chained list */
1366 xsltStyleType type
; /* type of the element */
1367 xsltTransformFunction func
; /* handling function */
1368 xmlNodePtr inst
; /* the instruction */
1371 * Pre computed values.
1374 const xmlChar
*stype
; /* sort */
1375 int has_stype
; /* sort */
1376 int number
; /* sort */
1377 const xmlChar
*order
; /* sort */
1378 int has_order
; /* sort */
1379 int descending
; /* sort */
1380 const xmlChar
*lang
; /* sort */
1381 int has_lang
; /* sort */
1382 xsltLocale locale
; /* sort */
1383 const xmlChar
*case_order
; /* sort */
1384 int lower_first
; /* sort */
1386 const xmlChar
*use
; /* copy, element */
1387 int has_use
; /* copy, element */
1389 int noescape
; /* text */
1391 const xmlChar
*name
; /* element, attribute, pi */
1392 int has_name
; /* element, attribute, pi */
1393 const xmlChar
*ns
; /* element */
1394 int has_ns
; /* element */
1396 const xmlChar
*mode
; /* apply-templates */
1397 const xmlChar
*modeURI
; /* apply-templates */
1399 const xmlChar
*test
; /* if */
1401 xsltTemplatePtr templ
; /* call-template */
1403 const xmlChar
*select
; /* sort, copy-of, value-of, apply-templates */
1405 int ver11
; /* document */
1406 const xmlChar
*filename
; /* document URL */
1407 int has_filename
; /* document */
1409 xsltNumberData numdata
; /* number */
1411 xmlXPathCompExprPtr comp
; /* a precompiled XPath expression */
1412 xmlNsPtr
*nsList
; /* the namespaces in scope */
1413 int nsNr
; /* the number of namespaces in scope */
1416 #endif /* XSLT_REFACTORED */
1420 * The in-memory structure corresponding to an XSLT Variable
1423 typedef struct _xsltStackElem xsltStackElem
;
1424 typedef xsltStackElem
*xsltStackElemPtr
;
1425 struct _xsltStackElem
{
1426 struct _xsltStackElem
*next
;/* chained list */
1427 xsltStylePreCompPtr comp
; /* the compiled form */
1428 int computed
; /* was the evaluation done */
1429 const xmlChar
*name
; /* the local part of the name QName */
1430 const xmlChar
*nameURI
; /* the URI part of the name QName */
1431 const xmlChar
*select
; /* the eval string */
1432 xmlNodePtr tree
; /* the sequence constructor if no eval
1433 string or the location */
1434 xmlXPathObjectPtr value
; /* The value if computed */
1435 xmlDocPtr fragment
; /* The Result Tree Fragments (needed for XSLT 1.0)
1436 which are bound to the variable's lifetime. */
1437 int level
; /* the depth in the tree;
1438 -1 if persistent (e.g. a given xsl:with-param) */
1439 xsltTransformContextPtr context
; /* The transformation context; needed to cache
1444 #ifdef XSLT_REFACTORED
1446 struct _xsltPrincipalStylesheetData
{
1448 * Namespace dictionary for ns-prefixes and ns-names:
1449 * TODO: Shared between stylesheets, and XPath mechanisms.
1452 xmlDictPtr namespaceDict
;
1454 * Global list of in-scope namespaces.
1456 xsltPointerListPtr inScopeNamespaces
;
1458 * Global list of information for [xsl:]excluded-result-prefixes.
1460 xsltPointerListPtr exclResultNamespaces
;
1462 * Global list of information for [xsl:]extension-element-prefixes.
1464 xsltPointerListPtr extElemNamespaces
;
1465 xsltEffectiveNsPtr effectiveNs
;
1466 #ifdef XSLT_REFACTORED_XSLT_NSCOMP
1468 * Namespace name map to get rid of string comparison of namespace names.
1477 * Note that we added a @compCtxt field to anchor an stylesheet compilation
1478 * context, since, due to historical reasons, various compile-time function
1479 * take only the stylesheet as argument and not a compilation context.
1481 struct _xsltStylesheet
{
1483 * The stylesheet import relation is kept as a tree.
1485 struct _xsltStylesheet
*parent
;
1486 struct _xsltStylesheet
*next
;
1487 struct _xsltStylesheet
*imports
;
1489 xsltDocumentPtr docList
; /* the include document list */
1492 * General data on the style sheet document.
1494 xmlDocPtr doc
; /* the parsed XML stylesheet */
1495 xmlHashTablePtr stripSpaces
;/* the hash table of the strip-space and
1496 preserve space elements */
1497 int stripAll
; /* strip-space * (1) preserve-space * (-1) */
1498 xmlHashTablePtr cdataSection
;/* the hash table of the cdata-section */
1501 * Global variable or parameters.
1503 xsltStackElemPtr variables
; /* linked list of param and variables */
1506 * Template descriptions.
1508 xsltTemplatePtr templates
; /* the ordered list of templates */
1509 void *templatesHash
; /* hash table or wherever compiled templates
1510 informations are stored */
1511 void *rootMatch
; /* template based on / */
1512 void *keyMatch
; /* template based on key() */
1513 void *elemMatch
; /* template based on * */
1514 void *attrMatch
; /* template based on @* */
1515 void *parentMatch
; /* template based on .. */
1516 void *textMatch
; /* template based on text() */
1517 void *piMatch
; /* template based on processing-instruction() */
1518 void *commentMatch
; /* template based on comment() */
1521 * Namespace aliases.
1522 * NOTE: Not used in the refactored code.
1524 xmlHashTablePtr nsAliases
; /* the namespace alias hash tables */
1529 xmlHashTablePtr attributeSets
;/* the attribute sets hash tables */
1533 * TODO: Eliminate this.
1535 xmlHashTablePtr nsHash
; /* the set of namespaces in use:
1536 ATTENTION: This is used for
1537 execution of XPath expressions; unfortunately
1538 it restricts the stylesheet to have distinct
1540 TODO: We need to get rid of this.
1542 void *nsDefs
; /* ATTENTION TODO: This is currently used to store
1543 xsltExtDefPtr (in extensions.c) and
1550 void *keys
; /* key definitions */
1553 * Output related stuff.
1555 xmlChar
*method
; /* the output method */
1556 xmlChar
*methodURI
; /* associated namespace if any */
1557 xmlChar
*version
; /* version string */
1558 xmlChar
*encoding
; /* encoding string */
1559 int omitXmlDeclaration
; /* omit-xml-declaration = "yes" | "no" */
1562 * Number formatting.
1564 xsltDecimalFormatPtr decimalFormat
;
1565 int standalone
; /* standalone = "yes" | "no" */
1566 xmlChar
*doctypePublic
; /* doctype-public string */
1567 xmlChar
*doctypeSystem
; /* doctype-system string */
1568 int indent
; /* should output being indented */
1569 xmlChar
*mediaType
; /* media-type string */
1572 * Precomputed blocks.
1574 xsltElemPreCompPtr preComps
;/* list of precomputed blocks */
1575 int warnings
; /* number of warnings found at compilation */
1576 int errors
; /* number of errors found at compilation */
1578 xmlChar
*exclPrefix
; /* last excluded prefixes */
1579 xmlChar
**exclPrefixTab
; /* array of excluded prefixes */
1580 int exclPrefixNr
; /* number of excluded prefixes in scope */
1581 int exclPrefixMax
; /* size of the array */
1583 void *_private
; /* user defined data */
1588 xmlHashTablePtr extInfos
; /* the extension data */
1589 int extrasNr
; /* the number of extras required */
1592 * For keeping track of nested includes
1594 xsltDocumentPtr includes
; /* points to last nested include */
1597 * dictionary: shared between stylesheet, context and documents.
1601 * precompiled attribute value templates.
1605 * if namespace-alias has an alias for the default stylesheet prefix
1606 * NOTE: Not used in the refactored code.
1608 const xmlChar
*defaultAlias
;
1610 * bypass pre-processing (already done) (used in imports)
1614 * all document text strings were internalized
1618 * Literal Result Element as Stylesheet c.f. section 2.3
1622 * The principal stylesheet
1624 xsltStylesheetPtr principal
;
1625 #ifdef XSLT_REFACTORED
1627 * Compilation context used during compile-time.
1629 xsltCompilerCtxtPtr compCtxt
; /* TODO: Change this to (void *). */
1631 xsltPrincipalStylesheetDataPtr principalData
;
1635 typedef struct _xsltTransformCache xsltTransformCache
;
1636 typedef xsltTransformCache
*xsltTransformCachePtr
;
1637 struct _xsltTransformCache
{
1640 xsltStackElemPtr stackItems
;
1642 #ifdef XSLT_DEBUG_PROFILE_CACHE
1651 * The in-memory structure corresponding to an XSLT Transformation.
1654 XSLT_OUTPUT_XML
= 0,
1663 } xsltTransformState
;
1665 struct _xsltTransformContext
{
1666 xsltStylesheetPtr style
; /* the stylesheet used */
1667 xsltOutputType type
; /* the type of output */
1669 xsltTemplatePtr templ
; /* the current template */
1670 int templNr
; /* Nb of templates in the stack */
1671 int templMax
; /* Size of the templtes stack */
1672 xsltTemplatePtr
*templTab
; /* the template stack */
1674 xsltStackElemPtr vars
; /* the current variable list */
1675 int varsNr
; /* Nb of variable list in the stack */
1676 int varsMax
; /* Size of the variable list stack */
1677 xsltStackElemPtr
*varsTab
; /* the variable list stack */
1678 int varsBase
; /* the var base for current templ */
1683 xmlHashTablePtr extFunctions
; /* the extension functions */
1684 xmlHashTablePtr extElements
; /* the extension elements */
1685 xmlHashTablePtr extInfos
; /* the extension data */
1687 const xmlChar
*mode
; /* the current mode */
1688 const xmlChar
*modeURI
; /* the current mode URI */
1690 xsltDocumentPtr docList
; /* the document list */
1692 xsltDocumentPtr document
; /* the current source document; can be NULL if an RTF */
1693 xmlNodePtr node
; /* the current node being processed */
1694 xmlNodeSetPtr nodeList
; /* the current node list */
1695 /* xmlNodePtr current; the node */
1697 xmlDocPtr output
; /* the resulting document */
1698 xmlNodePtr insert
; /* the insertion node */
1700 xmlXPathContextPtr xpathCtxt
; /* the XPath context */
1701 xsltTransformState state
; /* the current state */
1706 xmlHashTablePtr globalVars
; /* the global variables and params */
1708 xmlNodePtr inst
; /* the instruction in the stylesheet */
1710 int xinclude
; /* should XInclude be processed */
1712 const char * outputFile
; /* the output URI if known */
1714 int profile
; /* is this run profiled */
1715 long prof
; /* the current profiled value */
1716 int profNr
; /* Nb of templates in the stack */
1717 int profMax
; /* Size of the templtaes stack */
1718 long *profTab
; /* the profile template stack */
1720 void *_private
; /* user defined data */
1722 int extrasNr
; /* the number of extras used */
1723 int extrasMax
; /* the number of extras allocated */
1724 xsltRuntimeExtraPtr extras
; /* extra per runtime informations */
1726 xsltDocumentPtr styleList
; /* the stylesheet docs list */
1727 void * sec
; /* the security preferences if any */
1729 xmlGenericErrorFunc error
; /* a specific error handler */
1730 void * errctx
; /* context for the error handler */
1732 xsltSortFunc sortfunc
; /* a ctxt specific sort routine */
1735 * handling of temporary Result Value Tree
1736 * (XSLT 1.0 term: "Result Tree Fragment")
1738 xmlDocPtr tmpRVT
; /* list of RVT without persistance */
1739 xmlDocPtr persistRVT
; /* list of persistant RVTs */
1740 int ctxtflags
; /* context processing flags */
1743 * Speed optimization when coalescing text nodes
1745 const xmlChar
*lasttext
; /* last text node content */
1746 unsigned int lasttsize
; /* last text node size */
1747 unsigned int lasttuse
; /* last text node use */
1749 * Per Context Debugging
1751 int debugStatus
; /* the context level debug status */
1752 unsigned long* traceCode
; /* pointer to the variable holding the mask */
1754 int parserOptions
; /* parser options xmlParserOption */
1757 * dictionary: shared between stylesheet, context and documents.
1760 xmlDocPtr tmpDoc
; /* Obsolete; not used in the library. */
1762 * all document text strings are internalized
1766 int hasTemplKeyPatterns
;
1767 xsltTemplatePtr currentTemplateRule
; /* the Current Template Rule */
1768 xmlNodePtr initialContextNode
;
1769 xmlDocPtr initialContextDoc
;
1770 xsltTransformCachePtr cache
;
1771 void *contextVariable
; /* the current variable item */
1772 xmlDocPtr localRVT
; /* list of local tree fragments; will be freed when
1773 the instruction which created the fragment
1775 xmlDocPtr localRVTBase
;
1776 int keyInitLevel
; /* Needed to catch recursive keys issues */
1777 int funcLevel
; /* Needed to catch recursive functions issues */
1783 * Macro to check if the XSLT processing should be stopped.
1784 * Will return from the function.
1786 #define CHECK_STOPPED if (ctxt->state == XSLT_STATE_STOPPED) return;
1791 * Macro to check if the XSLT processing should be stopped.
1792 * Will goto the error: label.
1794 #define CHECK_STOPPEDE if (ctxt->state == XSLT_STATE_STOPPED) goto error;
1799 * Macro to check if the XSLT processing should be stopped.
1800 * Will return from the function with a 0 value.
1802 #define CHECK_STOPPED0 if (ctxt->state == XSLT_STATE_STOPPED) return(0);
1805 * The macro XML_CAST_FPTR is a hack to avoid a gcc warning about
1806 * possible incompatibilities between function pointers and object
1807 * pointers. It is defined in libxml/hash.h within recent versions
1808 * of libxml2, but is put here for compatibility.
1810 #ifndef XML_CAST_FPTR
1813 * @fptr: pointer to a function
1815 * Macro to do a casting from an object pointer to a
1816 * function pointer without encountering a warning from
1819 * #define XML_CAST_FPTR(fptr) (*(void **)(&fptr))
1820 * This macro violated ISO C aliasing rules (gcc4 on s390 broke)
1821 * so it is disabled now
1824 #define XML_CAST_FPTR(fptr) fptr
1827 * Functions associated to the internal types
1828 xsltDecimalFormatPtr xsltDecimalFormatGetByName(xsltStylesheetPtr sheet,
1831 XSLTPUBFUN xsltStylesheetPtr XSLTCALL
1832 xsltNewStylesheet (void);
1833 XSLTPUBFUN xsltStylesheetPtr XSLTCALL
1834 xsltParseStylesheetFile (const xmlChar
* filename
);
1835 XSLTPUBFUN
void XSLTCALL
1836 xsltFreeStylesheet (xsltStylesheetPtr style
);
1837 XSLTPUBFUN
int XSLTCALL
1838 xsltIsBlank (xmlChar
*str
);
1839 XSLTPUBFUN
void XSLTCALL
1840 xsltFreeStackElemList (xsltStackElemPtr elem
);
1841 XSLTPUBFUN xsltDecimalFormatPtr XSLTCALL
1842 xsltDecimalFormatGetByName(xsltStylesheetPtr style
,
1845 XSLTPUBFUN xsltStylesheetPtr XSLTCALL
1846 xsltParseStylesheetProcess(xsltStylesheetPtr ret
,
1848 XSLTPUBFUN
void XSLTCALL
1849 xsltParseStylesheetOutput(xsltStylesheetPtr style
,
1851 XSLTPUBFUN xsltStylesheetPtr XSLTCALL
1852 xsltParseStylesheetDoc (xmlDocPtr doc
);
1853 XSLTPUBFUN xsltStylesheetPtr XSLTCALL
1854 xsltParseStylesheetImportedDoc(xmlDocPtr doc
,
1855 xsltStylesheetPtr style
);
1856 XSLTPUBFUN xsltStylesheetPtr XSLTCALL
1857 xsltLoadStylesheetPI (xmlDocPtr doc
);
1858 XSLTPUBFUN
void XSLTCALL
1859 xsltNumberFormat (xsltTransformContextPtr ctxt
,
1860 xsltNumberDataPtr data
,
1862 XSLTPUBFUN xmlXPathError XSLTCALL
1863 xsltFormatNumberConversion(xsltDecimalFormatPtr self
,
1868 XSLTPUBFUN
void XSLTCALL
1869 xsltParseTemplateContent(xsltStylesheetPtr style
,
1871 XSLTPUBFUN
int XSLTCALL
1872 xsltAllocateExtra (xsltStylesheetPtr style
);
1873 XSLTPUBFUN
int XSLTCALL
1874 xsltAllocateExtraCtxt (xsltTransformContextPtr ctxt
);
1876 * Extra functions for Result Value Trees
1878 XSLTPUBFUN xmlDocPtr XSLTCALL
1879 xsltCreateRVT (xsltTransformContextPtr ctxt
);
1880 XSLTPUBFUN
int XSLTCALL
1881 xsltRegisterTmpRVT (xsltTransformContextPtr ctxt
,
1883 XSLTPUBFUN
int XSLTCALL
1884 xsltRegisterLocalRVT (xsltTransformContextPtr ctxt
,
1886 XSLTPUBFUN
int XSLTCALL
1887 xsltRegisterPersistRVT (xsltTransformContextPtr ctxt
,
1889 XSLTPUBFUN
int XSLTCALL
1890 xsltExtensionInstructionResultRegister(
1891 xsltTransformContextPtr ctxt
,
1892 xmlXPathObjectPtr obj
);
1893 XSLTPUBFUN
int XSLTCALL
1894 xsltExtensionInstructionResultFinalize(
1895 xsltTransformContextPtr ctxt
);
1896 XSLTPUBFUN
void XSLTCALL
1897 xsltFreeRVTs (xsltTransformContextPtr ctxt
);
1898 XSLTPUBFUN
void XSLTCALL
1899 xsltReleaseRVT (xsltTransformContextPtr ctxt
,
1901 XSLTPUBFUN
int XSLTCALL
1902 xsltTransStorageAdd (xsltTransformContextPtr ctxt
,
1905 XSLTPUBFUN
void * XSLTCALL
1906 xsltTransStorageRemove (xsltTransformContextPtr ctxt
,
1910 * Extra functions for Attribute Value Templates
1912 XSLTPUBFUN
void XSLTCALL
1913 xsltCompileAttr (xsltStylesheetPtr style
,
1915 XSLTPUBFUN xmlChar
* XSLTCALL
1916 xsltEvalAVT (xsltTransformContextPtr ctxt
,
1919 XSLTPUBFUN
void XSLTCALL
1920 xsltFreeAVTList (void *avt
);
1923 * Extra function for successful xsltCleanupGlobals / xsltInit sequence.
1926 XSLTPUBFUN
void XSLTCALL
1929 /************************************************************************
1931 * Compile-time functions for *internal* use only *
1933 ************************************************************************/
1935 #ifdef XSLT_REFACTORED
1936 XSLTPUBFUN
void XSLTCALL
1937 xsltParseSequenceConstructor(
1938 xsltCompilerCtxtPtr cctxt
,
1940 XSLTPUBFUN
int XSLTCALL
1941 xsltParseAnyXSLTElem (xsltCompilerCtxtPtr cctxt
,
1943 #ifdef XSLT_REFACTORED_XSLT_NSCOMP
1944 XSLTPUBFUN
int XSLTCALL
1945 xsltRestoreDocumentNamespaces(
1949 #endif /* XSLT_REFACTORED */
1951 /************************************************************************
1953 * Transformation-time functions for *internal* use only *
1955 ************************************************************************/
1956 XSLTPUBFUN
int XSLTCALL
1957 xsltInitCtxtKey (xsltTransformContextPtr ctxt
,
1958 xsltDocumentPtr doc
,
1959 xsltKeyDefPtr keyd
);
1960 XSLTPUBFUN
int XSLTCALL
1961 xsltInitAllDocKeys (xsltTransformContextPtr ctxt
);
1966 #endif /* __XML_XSLT_H__ */