Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/libxslt/xsltInternals.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002  * Summary: internal data structures, constants and functions
0003  * Description: Internal data structures, constants and functions used
0004  *              by the XSLT engine.
0005  *              They are not part of the API or ABI, i.e. they can change
0006  *              without prior notice, use carefully.
0007  *
0008  * Copy: See Copyright for the status of this software.
0009  *
0010  * Author: Daniel Veillard
0011  */
0012 
0013 #ifndef __XML_XSLT_INTERNALS_H__
0014 #define __XML_XSLT_INTERNALS_H__
0015 
0016 #include <libxml/tree.h>
0017 #include <libxml/hash.h>
0018 #include <libxml/xpath.h>
0019 #include <libxml/xmlerror.h>
0020 #include <libxml/dict.h>
0021 #include <libxml/xmlstring.h>
0022 #include <libxslt/xslt.h>
0023 #include "xsltexports.h"
0024 #include "numbersInternals.h"
0025 
0026 #ifdef __cplusplus
0027 extern "C" {
0028 #endif
0029 
0030 /* #define XSLT_DEBUG_PROFILE_CACHE */
0031 
0032 /**
0033  * XSLT_IS_TEXT_NODE:
0034  *
0035  * check if the argument is a text node
0036  */
0037 #define XSLT_IS_TEXT_NODE(n) ((n != NULL) && \
0038     (((n)->type == XML_TEXT_NODE) || \
0039      ((n)->type == XML_CDATA_SECTION_NODE)))
0040 
0041 
0042 /**
0043  * XSLT_MARK_RES_TREE_FRAG:
0044  *
0045  * internal macro to set up tree fragments
0046  */
0047 #define XSLT_MARK_RES_TREE_FRAG(n) \
0048     (n)->name = (char *) xmlStrdup(BAD_CAST " fake node libxslt");
0049 
0050 /**
0051  * XSLT_IS_RES_TREE_FRAG:
0052  *
0053  * internal macro to test tree fragments
0054  */
0055 #define XSLT_IS_RES_TREE_FRAG(n) \
0056     ((n != NULL) && ((n)->type == XML_DOCUMENT_NODE) && \
0057      ((n)->name != NULL) && ((n)->name[0] == ' '))
0058 
0059 /**
0060  * XSLT_REFACTORED_KEYCOMP:
0061  *
0062  * Internal define to enable on-demand xsl:key computation.
0063  * That's the only mode now but the define is kept for compatibility
0064  */
0065 #define XSLT_REFACTORED_KEYCOMP
0066 
0067 /**
0068  * XSLT_FAST_IF:
0069  *
0070  * Internal define to enable usage of xmlXPathCompiledEvalToBoolean()
0071  * for XSLT "tests"; e.g. in <xsl:if test="/foo/bar">
0072  */
0073 #define XSLT_FAST_IF
0074 
0075 /**
0076  * XSLT_REFACTORED:
0077  *
0078  * Internal define to enable the refactored parts of Libxslt.
0079  */
0080 /* #define XSLT_REFACTORED */
0081 /* ==================================================================== */
0082 
0083 /**
0084  * XSLT_REFACTORED_VARS:
0085  *
0086  * Internal define to enable the refactored variable part of libxslt
0087  */
0088 #define XSLT_REFACTORED_VARS
0089 
0090 #ifdef XSLT_REFACTORED
0091 
0092 extern const xmlChar *xsltXSLTAttrMarker;
0093 
0094 
0095 /* TODO: REMOVE: #define XSLT_REFACTORED_EXCLRESNS */
0096 
0097 /* TODO: REMOVE: #define XSLT_REFACTORED_NSALIAS */
0098 
0099 /**
0100  * XSLT_REFACTORED_XSLT_NSCOMP
0101  *
0102  * Internal define to enable the pointer-comparison of
0103  * namespaces of XSLT elements.
0104  */
0105 /* #define XSLT_REFACTORED_XSLT_NSCOMP */
0106 
0107 #ifdef XSLT_REFACTORED_XSLT_NSCOMP
0108 
0109 extern const xmlChar *xsltConstNamespaceNameXSLT;
0110 
0111 /**
0112  * IS_XSLT_ELEM_FAST:
0113  *
0114  * quick test to detect XSLT elements
0115  */
0116 #define IS_XSLT_ELEM_FAST(n) \
0117     (((n) != NULL) && ((n)->ns != NULL) && \
0118     ((n)->ns->href == xsltConstNamespaceNameXSLT))
0119 
0120 /**
0121  * IS_XSLT_ATTR_FAST:
0122  *
0123  * quick test to detect XSLT attributes
0124  */
0125 #define IS_XSLT_ATTR_FAST(a) \
0126     (((a) != NULL) && ((a)->ns != NULL) && \
0127     ((a)->ns->href == xsltConstNamespaceNameXSLT))
0128 
0129 /**
0130  * XSLT_HAS_INTERNAL_NSMAP:
0131  *
0132  * check for namespace mapping
0133  */
0134 #define XSLT_HAS_INTERNAL_NSMAP(s) \
0135     (((s) != NULL) && ((s)->principal) && \
0136      ((s)->principal->principalData) && \
0137      ((s)->principal->principalData->nsMap))
0138 
0139 /**
0140  * XSLT_GET_INTERNAL_NSMAP:
0141  *
0142  * get pointer to namespace map
0143  */
0144 #define XSLT_GET_INTERNAL_NSMAP(s) ((s)->principal->principalData->nsMap)
0145 
0146 #else /* XSLT_REFACTORED_XSLT_NSCOMP */
0147 
0148 /**
0149  * IS_XSLT_ELEM_FAST:
0150  *
0151  * quick check whether this is an xslt element
0152  */
0153 #define IS_XSLT_ELEM_FAST(n) \
0154     (((n) != NULL) && ((n)->ns != NULL) && \
0155      (xmlStrEqual((n)->ns->href, XSLT_NAMESPACE)))
0156 
0157 /**
0158  * IS_XSLT_ATTR_FAST:
0159  *
0160  * quick check for xslt namespace attribute
0161  */
0162 #define IS_XSLT_ATTR_FAST(a) \
0163     (((a) != NULL) && ((a)->ns != NULL) && \
0164      (xmlStrEqual((a)->ns->href, XSLT_NAMESPACE)))
0165 
0166 
0167 #endif /* XSLT_REFACTORED_XSLT_NSCOMP */
0168 
0169 
0170 /**
0171  * XSLT_REFACTORED_MANDATORY_VERSION:
0172  *
0173  * TODO: Currently disabled to surpress regression test failures, since
0174  *  the old behaviour was that a missing version attribute
0175  *  produced a only a warning and not an error, which was incerrect.
0176  *  So the regression tests need to be fixed if this is enabled.
0177  */
0178 /* #define XSLT_REFACTORED_MANDATORY_VERSION */
0179 
0180 /**
0181  * xsltPointerList:
0182  *
0183  * Pointer-list for various purposes.
0184  */
0185 typedef struct _xsltPointerList xsltPointerList;
0186 typedef xsltPointerList *xsltPointerListPtr;
0187 struct _xsltPointerList {
0188     void **items;
0189     int number;
0190     int size;
0191 };
0192 
0193 #endif
0194 
0195 /**
0196  * XSLT_REFACTORED_PARSING:
0197  *
0198  * Internal define to enable the refactored parts of Libxslt
0199  * related to parsing.
0200  */
0201 /* #define XSLT_REFACTORED_PARSING */
0202 
0203 /**
0204  * XSLT_MAX_SORT:
0205  *
0206  * Max number of specified xsl:sort on an element.
0207  */
0208 #define XSLT_MAX_SORT 15
0209 
0210 /**
0211  * XSLT_PAT_NO_PRIORITY:
0212  *
0213  * Specific value for pattern without priority expressed.
0214  */
0215 #define XSLT_PAT_NO_PRIORITY -12345789
0216 
0217 /**
0218  * xsltRuntimeExtra:
0219  *
0220  * Extra information added to the transformation context.
0221  */
0222 typedef struct _xsltRuntimeExtra xsltRuntimeExtra;
0223 typedef xsltRuntimeExtra *xsltRuntimeExtraPtr;
0224 struct _xsltRuntimeExtra {
0225     void       *info;       /* pointer to the extra data */
0226     xmlFreeFunc deallocate; /* pointer to the deallocation routine */
0227     union {         /* dual-purpose field */
0228         void   *ptr;        /* data not needing deallocation */
0229     int    ival;        /* integer value storage */
0230     } val;
0231 };
0232 
0233 /**
0234  * XSLT_RUNTIME_EXTRA_LST:
0235  * @ctxt: the transformation context
0236  * @nr: the index
0237  *
0238  * Macro used to access extra information stored in the context
0239  */
0240 #define XSLT_RUNTIME_EXTRA_LST(ctxt, nr) (ctxt)->extras[(nr)].info
0241 /**
0242  * XSLT_RUNTIME_EXTRA_FREE:
0243  * @ctxt: the transformation context
0244  * @nr: the index
0245  *
0246  * Macro used to free extra information stored in the context
0247  */
0248 #define XSLT_RUNTIME_EXTRA_FREE(ctxt, nr) (ctxt)->extras[(nr)].deallocate
0249 /**
0250  * XSLT_RUNTIME_EXTRA:
0251  * @ctxt: the transformation context
0252  * @nr: the index
0253  *
0254  * Macro used to define extra information stored in the context
0255  */
0256 #define XSLT_RUNTIME_EXTRA(ctxt, nr, typ) (ctxt)->extras[(nr)].val.typ
0257 
0258 /**
0259  * xsltTemplate:
0260  *
0261  * The in-memory structure corresponding to an XSLT Template.
0262  */
0263 typedef struct _xsltTemplate xsltTemplate;
0264 typedef xsltTemplate *xsltTemplatePtr;
0265 struct _xsltTemplate {
0266     struct _xsltTemplate *next;/* chained list sorted by priority */
0267     struct _xsltStylesheet *style;/* the containing stylesheet */
0268     xmlChar *match; /* the matching string */
0269     float priority; /* as given from the stylesheet, not computed */
0270     const xmlChar *name; /* the local part of the name QName */
0271     const xmlChar *nameURI; /* the URI part of the name QName */
0272     const xmlChar *mode;/* the local part of the mode QName */
0273     const xmlChar *modeURI;/* the URI part of the mode QName */
0274     xmlNodePtr content; /* the template replacement value */
0275     xmlNodePtr elem;    /* the source element */
0276 
0277     /*
0278     * TODO: @inheritedNsNr and @inheritedNs won't be used in the
0279     *  refactored code.
0280     */
0281     int inheritedNsNr;  /* number of inherited namespaces */
0282     xmlNsPtr *inheritedNs;/* inherited non-excluded namespaces */
0283 
0284     /* Profiling information */
0285     int nbCalls;        /* the number of time the template was called */
0286     unsigned long time; /* the time spent in this template */
0287     void *params;       /* xsl:param instructions */
0288 
0289     int              templNr;       /* Nb of templates in the stack */
0290     int              templMax;      /* Size of the templtes stack */
0291     xsltTemplatePtr *templCalledTab;    /* templates called */
0292     int             *templCountTab;  /* .. and how often */
0293 
0294     /* Conflict resolution */
0295     int position;
0296 };
0297 
0298 /**
0299  * xsltDecimalFormat:
0300  *
0301  * Data structure of decimal-format.
0302  */
0303 typedef struct _xsltDecimalFormat xsltDecimalFormat;
0304 typedef xsltDecimalFormat *xsltDecimalFormatPtr;
0305 struct _xsltDecimalFormat {
0306     struct _xsltDecimalFormat *next; /* chained list */
0307     xmlChar *name;
0308     /* Used for interpretation of pattern */
0309     xmlChar *digit;
0310     xmlChar *patternSeparator;
0311     /* May appear in result */
0312     xmlChar *minusSign;
0313     xmlChar *infinity;
0314     xmlChar *noNumber; /* Not-a-number */
0315     /* Used for interpretation of pattern and may appear in result */
0316     xmlChar *decimalPoint;
0317     xmlChar *grouping;
0318     xmlChar *percent;
0319     xmlChar *permille;
0320     xmlChar *zeroDigit;
0321     const xmlChar *nsUri;
0322 };
0323 
0324 /**
0325  * xsltDocument:
0326  *
0327  * Data structure associated to a parsed document.
0328  */
0329 typedef struct _xsltDocument xsltDocument;
0330 typedef xsltDocument *xsltDocumentPtr;
0331 struct _xsltDocument {
0332     struct _xsltDocument *next; /* documents are kept in a chained list */
0333     int main;           /* is this the main document */
0334     xmlDocPtr doc;      /* the parsed document */
0335     void *keys;         /* key tables storage */
0336     struct _xsltDocument *includes; /* subsidiary includes */
0337     int preproc;        /* pre-processing already done */
0338     int nbKeysComputed;
0339 };
0340 
0341 /**
0342  * xsltKeyDef:
0343  *
0344  * Representation of an xsl:key.
0345  */
0346 typedef struct _xsltKeyDef xsltKeyDef;
0347 typedef xsltKeyDef *xsltKeyDefPtr;
0348 struct _xsltKeyDef {
0349     struct _xsltKeyDef *next;
0350     xmlNodePtr inst;
0351     xmlChar *name;
0352     xmlChar *nameURI;
0353     xmlChar *match;
0354     xmlChar *use;
0355     xmlXPathCompExprPtr comp;
0356     xmlXPathCompExprPtr usecomp;
0357     xmlNsPtr *nsList;           /* the namespaces in scope */
0358     int nsNr;                   /* the number of namespaces in scope */
0359 };
0360 
0361 /**
0362  * xsltKeyTable:
0363  *
0364  * Holds the computed keys for key definitions of the same QName.
0365  * Is owned by an xsltDocument.
0366  */
0367 typedef struct _xsltKeyTable xsltKeyTable;
0368 typedef xsltKeyTable *xsltKeyTablePtr;
0369 struct _xsltKeyTable {
0370     struct _xsltKeyTable *next;
0371     xmlChar *name;
0372     xmlChar *nameURI;
0373     xmlHashTablePtr keys;
0374 };
0375 
0376 /*
0377  * The in-memory structure corresponding to an XSLT Stylesheet.
0378  * NOTE: most of the content is simply linked from the doc tree
0379  *       structure, no specific allocation is made.
0380  */
0381 typedef struct _xsltStylesheet xsltStylesheet;
0382 typedef xsltStylesheet *xsltStylesheetPtr;
0383 
0384 typedef struct _xsltTransformContext xsltTransformContext;
0385 typedef xsltTransformContext *xsltTransformContextPtr;
0386 
0387 /**
0388  * xsltElemPreComp:
0389  *
0390  * The in-memory structure corresponding to element precomputed data,
0391  * designed to be extended by extension implementors.
0392  */
0393 typedef struct _xsltElemPreComp xsltElemPreComp;
0394 typedef xsltElemPreComp *xsltElemPreCompPtr;
0395 
0396 /**
0397  * xsltTransformFunction:
0398  * @ctxt: the XSLT transformation context
0399  * @node: the input node
0400  * @inst: the stylesheet node
0401  * @comp: the compiled information from the stylesheet
0402  *
0403  * Signature of the function associated to elements part of the
0404  * stylesheet language like xsl:if or xsl:apply-templates.
0405  */
0406 typedef void (*xsltTransformFunction) (xsltTransformContextPtr ctxt,
0407                                    xmlNodePtr node,
0408                        xmlNodePtr inst,
0409                            xsltElemPreCompPtr comp);
0410 
0411 /**
0412  * xsltSortFunc:
0413  * @ctxt:    a transformation context
0414  * @sorts:   the node-set to sort
0415  * @nbsorts: the number of sorts
0416  *
0417  * Signature of the function to use during sorting
0418  */
0419 typedef void (*xsltSortFunc) (xsltTransformContextPtr ctxt, xmlNodePtr *sorts,
0420                   int nbsorts);
0421 
0422 typedef enum {
0423     XSLT_FUNC_COPY=1,
0424     XSLT_FUNC_SORT,
0425     XSLT_FUNC_TEXT,
0426     XSLT_FUNC_ELEMENT,
0427     XSLT_FUNC_ATTRIBUTE,
0428     XSLT_FUNC_COMMENT,
0429     XSLT_FUNC_PI,
0430     XSLT_FUNC_COPYOF,
0431     XSLT_FUNC_VALUEOF,
0432     XSLT_FUNC_NUMBER,
0433     XSLT_FUNC_APPLYIMPORTS,
0434     XSLT_FUNC_CALLTEMPLATE,
0435     XSLT_FUNC_APPLYTEMPLATES,
0436     XSLT_FUNC_CHOOSE,
0437     XSLT_FUNC_IF,
0438     XSLT_FUNC_FOREACH,
0439     XSLT_FUNC_DOCUMENT,
0440     XSLT_FUNC_WITHPARAM,
0441     XSLT_FUNC_PARAM,
0442     XSLT_FUNC_VARIABLE,
0443     XSLT_FUNC_WHEN,
0444     XSLT_FUNC_EXTENSION
0445 #ifdef XSLT_REFACTORED
0446     ,
0447     XSLT_FUNC_OTHERWISE,
0448     XSLT_FUNC_FALLBACK,
0449     XSLT_FUNC_MESSAGE,
0450     XSLT_FUNC_INCLUDE,
0451     XSLT_FUNC_ATTRSET,
0452     XSLT_FUNC_LITERAL_RESULT_ELEMENT,
0453     XSLT_FUNC_UNKOWN_FORWARDS_COMPAT
0454 #endif
0455 } xsltStyleType;
0456 
0457 /**
0458  * xsltElemPreCompDeallocator:
0459  * @comp:  the #xsltElemPreComp to free up
0460  *
0461  * Deallocates an #xsltElemPreComp structure.
0462  */
0463 typedef void (*xsltElemPreCompDeallocator) (xsltElemPreCompPtr comp);
0464 
0465 /**
0466  * xsltElemPreComp:
0467  *
0468  * The basic structure for compiled items of the AST of the XSLT processor.
0469  * This structure is also intended to be extended by extension implementors.
0470  * TODO: This is somehow not nice, since it has a "free" field, which
0471  *   derived stylesheet-structs do not have.
0472  */
0473 struct _xsltElemPreComp {
0474     xsltElemPreCompPtr next;        /* next item in the global chained
0475                        list held by xsltStylesheet. */
0476     xsltStyleType type;     /* type of the element */
0477     xsltTransformFunction func; /* handling function */
0478     xmlNodePtr inst;            /* the node in the stylesheet's tree
0479                        corresponding to this item */
0480 
0481     /* end of common part */
0482     xsltElemPreCompDeallocator free;    /* the deallocator */
0483 };
0484 
0485 /**
0486  * xsltStylePreComp:
0487  *
0488  * The abstract basic structure for items of the XSLT processor.
0489  * This includes:
0490  * 1) compiled forms of XSLT instructions (xsl:if, xsl:attribute, etc.)
0491  * 2) compiled forms of literal result elements
0492  * 3) compiled forms of extension elements
0493  */
0494 typedef struct _xsltStylePreComp xsltStylePreComp;
0495 typedef xsltStylePreComp *xsltStylePreCompPtr;
0496 
0497 #ifdef XSLT_REFACTORED
0498 
0499 /*
0500 * Some pointer-list utility functions.
0501 */
0502 XSLTPUBFUN xsltPointerListPtr XSLTCALL
0503         xsltPointerListCreate       (int initialSize);
0504 XSLTPUBFUN void XSLTCALL
0505         xsltPointerListFree     (xsltPointerListPtr list);
0506 XSLTPUBFUN void XSLTCALL
0507         xsltPointerListClear        (xsltPointerListPtr list);
0508 XSLTPUBFUN int XSLTCALL
0509         xsltPointerListAddSize      (xsltPointerListPtr list,
0510                          void *item,
0511                          int initialSize);
0512 
0513 /************************************************************************
0514  *                                  *
0515  * Refactored structures                                                *
0516  *                                  *
0517  ************************************************************************/
0518 
0519 typedef struct _xsltNsListContainer xsltNsListContainer;
0520 typedef xsltNsListContainer *xsltNsListContainerPtr;
0521 struct _xsltNsListContainer {
0522     xmlNsPtr *list;
0523     int totalNumber;
0524     int xpathNumber;
0525 };
0526 
0527 /**
0528  * XSLT_ITEM_COMPATIBILITY_FIELDS:
0529  *
0530  * Fields for API compatibility to the structure
0531  * _xsltElemPreComp which is used for extension functions.
0532  * Note that @next is used for storage; it does not reflect a next
0533  * sibling in the tree.
0534  * TODO: Evaluate if we really need such a compatibility.
0535  */
0536 #define XSLT_ITEM_COMPATIBILITY_FIELDS \
0537     xsltElemPreCompPtr next;\
0538     xsltStyleType type;\
0539     xsltTransformFunction func;\
0540     xmlNodePtr inst;
0541 
0542 /**
0543  * XSLT_ITEM_NAVIGATION_FIELDS:
0544  *
0545  * Currently empty.
0546  * TODO: It is intended to hold navigational fields in the future.
0547  */
0548 #define XSLT_ITEM_NAVIGATION_FIELDS
0549 /*
0550     xsltStylePreCompPtr parent;\
0551     xsltStylePreCompPtr children;\
0552     xsltStylePreCompPtr nextItem;
0553 */
0554 
0555 /**
0556  * XSLT_ITEM_NSINSCOPE_FIELDS:
0557  *
0558  * The in-scope namespaces.
0559  */
0560 #define XSLT_ITEM_NSINSCOPE_FIELDS xsltNsListContainerPtr inScopeNs;
0561 
0562 /**
0563  * XSLT_ITEM_COMMON_FIELDS:
0564  *
0565  * Common fields used for all items.
0566  */
0567 #define XSLT_ITEM_COMMON_FIELDS \
0568     XSLT_ITEM_COMPATIBILITY_FIELDS \
0569     XSLT_ITEM_NAVIGATION_FIELDS \
0570     XSLT_ITEM_NSINSCOPE_FIELDS
0571 
0572 /**
0573  * _xsltStylePreComp:
0574  *
0575  * The abstract basic structure for items of the XSLT processor.
0576  * This includes:
0577  * 1) compiled forms of XSLT instructions (e.g. xsl:if, xsl:attribute, etc.)
0578  * 2) compiled forms of literal result elements
0579  * 3) various properties for XSLT instructions (e.g. xsl:when,
0580  *    xsl:with-param)
0581  *
0582  * REVISIT TODO: Keep this structure equal to the fields
0583  *   defined by XSLT_ITEM_COMMON_FIELDS
0584  */
0585 struct _xsltStylePreComp {
0586     xsltElemPreCompPtr next;    /* next item in the global chained
0587                    list held by xsltStylesheet */
0588     xsltStyleType type;         /* type of the item */
0589     xsltTransformFunction func; /* handling function */
0590     xmlNodePtr inst;        /* the node in the stylesheet's tree
0591                    corresponding to this item. */
0592     /* Currently no navigational fields. */
0593     xsltNsListContainerPtr inScopeNs;
0594 };
0595 
0596 /**
0597  * xsltStyleBasicEmptyItem:
0598  *
0599  * Abstract structure only used as a short-cut for
0600  * XSLT items with no extra fields.
0601  * NOTE that it is intended that this structure looks the same as
0602  *  _xsltStylePreComp.
0603  */
0604 typedef struct _xsltStyleBasicEmptyItem xsltStyleBasicEmptyItem;
0605 typedef xsltStyleBasicEmptyItem *xsltStyleBasicEmptyItemPtr;
0606 
0607 struct _xsltStyleBasicEmptyItem {
0608     XSLT_ITEM_COMMON_FIELDS
0609 };
0610 
0611 /**
0612  * xsltStyleBasicExpressionItem:
0613  *
0614  * Abstract structure only used as a short-cut for
0615  * XSLT items with just an expression.
0616  */
0617 typedef struct _xsltStyleBasicExpressionItem xsltStyleBasicExpressionItem;
0618 typedef xsltStyleBasicExpressionItem *xsltStyleBasicExpressionItemPtr;
0619 
0620 struct _xsltStyleBasicExpressionItem {
0621     XSLT_ITEM_COMMON_FIELDS
0622 
0623     const xmlChar *select; /* TODO: Change this to "expression". */
0624     xmlXPathCompExprPtr comp; /* TODO: Change this to compExpr. */
0625 };
0626 
0627 /************************************************************************
0628  *                                  *
0629  * XSLT-instructions/declarations                                       *
0630  *                                  *
0631  ************************************************************************/
0632 
0633 /**
0634  * xsltStyleItemElement:
0635  *
0636  * <!-- Category: instruction -->
0637  * <xsl:element
0638  *  name = { qname }
0639  *  namespace = { uri-reference }
0640  *  use-attribute-sets = qnames>
0641  *  <!-- Content: template -->
0642  * </xsl:element>
0643  */
0644 typedef struct _xsltStyleItemElement xsltStyleItemElement;
0645 typedef xsltStyleItemElement *xsltStyleItemElementPtr;
0646 
0647 struct _xsltStyleItemElement {
0648     XSLT_ITEM_COMMON_FIELDS
0649 
0650     const xmlChar *use;
0651     int      has_use;
0652     const xmlChar *name;
0653     int      has_name;
0654     const xmlChar *ns;
0655     const xmlChar *nsPrefix;
0656     int      has_ns;
0657 };
0658 
0659 /**
0660  * xsltStyleItemAttribute:
0661  *
0662  * <!-- Category: instruction -->
0663  * <xsl:attribute
0664  *  name = { qname }
0665  *  namespace = { uri-reference }>
0666  *  <!-- Content: template -->
0667  * </xsl:attribute>
0668  */
0669 typedef struct _xsltStyleItemAttribute xsltStyleItemAttribute;
0670 typedef xsltStyleItemAttribute *xsltStyleItemAttributePtr;
0671 
0672 struct _xsltStyleItemAttribute {
0673     XSLT_ITEM_COMMON_FIELDS
0674     const xmlChar *name;
0675     int      has_name;
0676     const xmlChar *ns;
0677     const xmlChar *nsPrefix;
0678     int      has_ns;
0679 };
0680 
0681 /**
0682  * xsltStyleItemText:
0683  *
0684  * <!-- Category: instruction -->
0685  * <xsl:text
0686  *  disable-output-escaping = "yes" | "no">
0687  *  <!-- Content: #PCDATA -->
0688  * </xsl:text>
0689  */
0690 typedef struct _xsltStyleItemText xsltStyleItemText;
0691 typedef xsltStyleItemText *xsltStyleItemTextPtr;
0692 
0693 struct _xsltStyleItemText {
0694     XSLT_ITEM_COMMON_FIELDS
0695     int      noescape;      /* text */
0696 };
0697 
0698 /**
0699  * xsltStyleItemComment:
0700  *
0701  * <!-- Category: instruction -->
0702  *  <xsl:comment>
0703  *  <!-- Content: template -->
0704  * </xsl:comment>
0705  */
0706 typedef xsltStyleBasicEmptyItem xsltStyleItemComment;
0707 typedef xsltStyleItemComment *xsltStyleItemCommentPtr;
0708 
0709 /**
0710  * xsltStyleItemPI:
0711  *
0712  * <!-- Category: instruction -->
0713  *  <xsl:processing-instruction
0714  *  name = { ncname }>
0715  *  <!-- Content: template -->
0716  * </xsl:processing-instruction>
0717  */
0718 typedef struct _xsltStyleItemPI xsltStyleItemPI;
0719 typedef xsltStyleItemPI *xsltStyleItemPIPtr;
0720 
0721 struct _xsltStyleItemPI {
0722     XSLT_ITEM_COMMON_FIELDS
0723     const xmlChar *name;
0724     int      has_name;
0725 };
0726 
0727 /**
0728  * xsltStyleItemApplyImports:
0729  *
0730  * <!-- Category: instruction -->
0731  * <xsl:apply-imports />
0732  */
0733 typedef xsltStyleBasicEmptyItem xsltStyleItemApplyImports;
0734 typedef xsltStyleItemApplyImports *xsltStyleItemApplyImportsPtr;
0735 
0736 /**
0737  * xsltStyleItemApplyTemplates:
0738  *
0739  * <!-- Category: instruction -->
0740  *  <xsl:apply-templates
0741  *  select = node-set-expression
0742  *  mode = qname>
0743  *  <!-- Content: (xsl:sort | xsl:with-param)* -->
0744  * </xsl:apply-templates>
0745  */
0746 typedef struct _xsltStyleItemApplyTemplates xsltStyleItemApplyTemplates;
0747 typedef xsltStyleItemApplyTemplates *xsltStyleItemApplyTemplatesPtr;
0748 
0749 struct _xsltStyleItemApplyTemplates {
0750     XSLT_ITEM_COMMON_FIELDS
0751 
0752     const xmlChar *mode;    /* apply-templates */
0753     const xmlChar *modeURI; /* apply-templates */
0754     const xmlChar *select;  /* sort, copy-of, value-of, apply-templates */
0755     xmlXPathCompExprPtr comp;   /* a precompiled XPath expression */
0756     /* TODO: with-params */
0757 };
0758 
0759 /**
0760  * xsltStyleItemCallTemplate:
0761  *
0762  * <!-- Category: instruction -->
0763  *  <xsl:call-template
0764  *  name = qname>
0765  *  <!-- Content: xsl:with-param* -->
0766  * </xsl:call-template>
0767  */
0768 typedef struct _xsltStyleItemCallTemplate xsltStyleItemCallTemplate;
0769 typedef xsltStyleItemCallTemplate *xsltStyleItemCallTemplatePtr;
0770 
0771 struct _xsltStyleItemCallTemplate {
0772     XSLT_ITEM_COMMON_FIELDS
0773 
0774     xsltTemplatePtr templ;  /* call-template */
0775     const xmlChar *name;    /* element, attribute, pi */
0776     int      has_name;      /* element, attribute, pi */
0777     const xmlChar *ns;      /* element */
0778     int      has_ns;        /* element */
0779     /* TODO: with-params */
0780 };
0781 
0782 /**
0783  * xsltStyleItemCopy:
0784  *
0785  * <!-- Category: instruction -->
0786  * <xsl:copy
0787  *  use-attribute-sets = qnames>
0788  *  <!-- Content: template -->
0789  * </xsl:copy>
0790  */
0791 typedef struct _xsltStyleItemCopy xsltStyleItemCopy;
0792 typedef xsltStyleItemCopy *xsltStyleItemCopyPtr;
0793 
0794 struct _xsltStyleItemCopy {
0795    XSLT_ITEM_COMMON_FIELDS
0796     const xmlChar *use;     /* copy, element */
0797     int      has_use;       /* copy, element */
0798 };
0799 
0800 /**
0801  * xsltStyleItemIf:
0802  *
0803  * <!-- Category: instruction -->
0804  *  <xsl:if
0805  *  test = boolean-expression>
0806  *  <!-- Content: template -->
0807  * </xsl:if>
0808  */
0809 typedef struct _xsltStyleItemIf xsltStyleItemIf;
0810 typedef xsltStyleItemIf *xsltStyleItemIfPtr;
0811 
0812 struct _xsltStyleItemIf {
0813     XSLT_ITEM_COMMON_FIELDS
0814 
0815     const xmlChar *test;    /* if */
0816     xmlXPathCompExprPtr comp;   /* a precompiled XPath expression */
0817 };
0818 
0819 
0820 /**
0821  * xsltStyleItemCopyOf:
0822  *
0823  * <!-- Category: instruction -->
0824  * <xsl:copy-of
0825  *  select = expression />
0826  */
0827 typedef xsltStyleBasicExpressionItem xsltStyleItemCopyOf;
0828 typedef xsltStyleItemCopyOf *xsltStyleItemCopyOfPtr;
0829 
0830 /**
0831  * xsltStyleItemValueOf:
0832  *
0833  * <!-- Category: instruction -->
0834  * <xsl:value-of
0835  *  select = string-expression
0836  *  disable-output-escaping = "yes" | "no" />
0837  */
0838 typedef struct _xsltStyleItemValueOf xsltStyleItemValueOf;
0839 typedef xsltStyleItemValueOf *xsltStyleItemValueOfPtr;
0840 
0841 struct _xsltStyleItemValueOf {
0842     XSLT_ITEM_COMMON_FIELDS
0843 
0844     const xmlChar *select;
0845     xmlXPathCompExprPtr comp;   /* a precompiled XPath expression */
0846     int      noescape;
0847 };
0848 
0849 /**
0850  * xsltStyleItemNumber:
0851  *
0852  * <!-- Category: instruction -->
0853  *  <xsl:number
0854  *  level = "single" | "multiple" | "any"
0855  *  count = pattern
0856  *  from = pattern
0857  *  value = number-expression
0858  *  format = { string }
0859  *  lang = { nmtoken }
0860  *  letter-value = { "alphabetic" | "traditional" }
0861  *  grouping-separator = { char }
0862  *  grouping-size = { number } />
0863  */
0864 typedef struct _xsltStyleItemNumber xsltStyleItemNumber;
0865 typedef xsltStyleItemNumber *xsltStyleItemNumberPtr;
0866 
0867 struct _xsltStyleItemNumber {
0868     XSLT_ITEM_COMMON_FIELDS
0869     xsltNumberData numdata; /* number */
0870 };
0871 
0872 /**
0873  * xsltStyleItemChoose:
0874  *
0875  * <!-- Category: instruction -->
0876  *  <xsl:choose>
0877  *  <!-- Content: (xsl:when+, xsl:otherwise?) -->
0878  * </xsl:choose>
0879  */
0880 typedef xsltStyleBasicEmptyItem xsltStyleItemChoose;
0881 typedef xsltStyleItemChoose *xsltStyleItemChoosePtr;
0882 
0883 /**
0884  * xsltStyleItemFallback:
0885  *
0886  * <!-- Category: instruction -->
0887  *  <xsl:fallback>
0888  *  <!-- Content: template -->
0889  * </xsl:fallback>
0890  */
0891 typedef xsltStyleBasicEmptyItem xsltStyleItemFallback;
0892 typedef xsltStyleItemFallback *xsltStyleItemFallbackPtr;
0893 
0894 /**
0895  * xsltStyleItemForEach:
0896  *
0897  * <!-- Category: instruction -->
0898  * <xsl:for-each
0899  *   select = node-set-expression>
0900  *   <!-- Content: (xsl:sort*, template) -->
0901  * </xsl:for-each>
0902  */
0903 typedef xsltStyleBasicExpressionItem xsltStyleItemForEach;
0904 typedef xsltStyleItemForEach *xsltStyleItemForEachPtr;
0905 
0906 /**
0907  * xsltStyleItemMessage:
0908  *
0909  * <!-- Category: instruction -->
0910  * <xsl:message
0911  *   terminate = "yes" | "no">
0912  *   <!-- Content: template -->
0913  * </xsl:message>
0914  */
0915 typedef struct _xsltStyleItemMessage xsltStyleItemMessage;
0916 typedef xsltStyleItemMessage *xsltStyleItemMessagePtr;
0917 
0918 struct _xsltStyleItemMessage {
0919     XSLT_ITEM_COMMON_FIELDS
0920     int terminate;
0921 };
0922 
0923 /**
0924  * xsltStyleItemDocument:
0925  *
0926  * NOTE: This is not an instruction of XSLT 1.0.
0927  */
0928 typedef struct _xsltStyleItemDocument xsltStyleItemDocument;
0929 typedef xsltStyleItemDocument *xsltStyleItemDocumentPtr;
0930 
0931 struct _xsltStyleItemDocument {
0932     XSLT_ITEM_COMMON_FIELDS
0933     int      ver11;     /* assigned: in xsltDocumentComp;
0934                                   read: nowhere;
0935                                   TODO: Check if we need. */
0936     const xmlChar *filename;    /* document URL */
0937     int has_filename;
0938 };
0939 
0940 /************************************************************************
0941  *                                  *
0942  * Non-instructions (actually properties of instructions/declarations)  *
0943  *                                  *
0944  ************************************************************************/
0945 
0946 /**
0947  * xsltStyleBasicItemVariable:
0948  *
0949  * Basic struct for xsl:variable, xsl:param and xsl:with-param.
0950  * It's currently important to have equal fields, since
0951  * xsltParseStylesheetCallerParam() is used with xsl:with-param from
0952  * the xslt side and with xsl:param from the exslt side (in
0953  * exsltFuncFunctionFunction()).
0954  *
0955  * FUTURE NOTE: In XSLT 2.0 xsl:param, xsl:variable and xsl:with-param
0956  *   have additional different fields.
0957  */
0958 typedef struct _xsltStyleBasicItemVariable xsltStyleBasicItemVariable;
0959 typedef xsltStyleBasicItemVariable *xsltStyleBasicItemVariablePtr;
0960 
0961 struct _xsltStyleBasicItemVariable {
0962     XSLT_ITEM_COMMON_FIELDS
0963 
0964     const xmlChar *select;
0965     xmlXPathCompExprPtr comp;
0966 
0967     const xmlChar *name;
0968     int      has_name;
0969     const xmlChar *ns;
0970     int      has_ns;
0971 };
0972 
0973 /**
0974  * xsltStyleItemVariable:
0975  *
0976  * <!-- Category: top-level-element -->
0977  * <xsl:param
0978  *   name = qname
0979  *   select = expression>
0980  *   <!-- Content: template -->
0981  * </xsl:param>
0982  */
0983 typedef xsltStyleBasicItemVariable xsltStyleItemVariable;
0984 typedef xsltStyleItemVariable *xsltStyleItemVariablePtr;
0985 
0986 /**
0987  * xsltStyleItemParam:
0988  *
0989  * <!-- Category: top-level-element -->
0990  * <xsl:param
0991  *   name = qname
0992  *   select = expression>
0993  *   <!-- Content: template -->
0994  * </xsl:param>
0995  */
0996 typedef struct _xsltStyleItemParam xsltStyleItemParam;
0997 typedef xsltStyleItemParam *xsltStyleItemParamPtr;
0998 
0999 struct _xsltStyleItemParam {
1000     XSLT_ITEM_COMMON_FIELDS
1001 
1002     const xmlChar *select;
1003     xmlXPathCompExprPtr comp;
1004 
1005     const xmlChar *name;
1006     int      has_name;
1007     const xmlChar *ns;
1008     int      has_ns;
1009 };
1010 
1011 /**
1012  * xsltStyleItemWithParam:
1013  *
1014  * <xsl:with-param
1015  *  name = qname
1016  *  select = expression>
1017  *  <!-- Content: template -->
1018  * </xsl:with-param>
1019  */
1020 typedef xsltStyleBasicItemVariable xsltStyleItemWithParam;
1021 typedef xsltStyleItemWithParam *xsltStyleItemWithParamPtr;
1022 
1023 /**
1024  * xsltStyleItemSort:
1025  *
1026  * Reflects the XSLT xsl:sort item.
1027  * Allowed parents: xsl:apply-templates, xsl:for-each
1028  * <xsl:sort
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" } />
1034  */
1035 typedef struct _xsltStyleItemSort xsltStyleItemSort;
1036 typedef xsltStyleItemSort *xsltStyleItemSortPtr;
1037 
1038 struct _xsltStyleItemSort {
1039     XSLT_ITEM_COMMON_FIELDS
1040 
1041     const xmlChar *stype;       /* sort */
1042     int      has_stype;     /* sort */
1043     int      number;        /* sort */
1044     const xmlChar *order;   /* sort */
1045     int      has_order;     /* sort */
1046     int      descending;    /* sort */
1047     const xmlChar *lang;    /* sort */
1048     int      has_lang;      /* sort */
1049     const xmlChar *case_order;  /* sort */
1050     int      lower_first;   /* sort */
1051 
1052     const xmlChar *use;
1053     int      has_use;
1054 
1055     const xmlChar *select;  /* sort, copy-of, value-of, apply-templates */
1056 
1057     xmlXPathCompExprPtr comp;   /* a precompiled XPath expression */
1058 };
1059 
1060 
1061 /**
1062  * xsltStyleItemWhen:
1063  *
1064  * <xsl:when
1065  *   test = boolean-expression>
1066  *   <!-- Content: template -->
1067  * </xsl:when>
1068  * Allowed parent: xsl:choose
1069  */
1070 typedef struct _xsltStyleItemWhen xsltStyleItemWhen;
1071 typedef xsltStyleItemWhen *xsltStyleItemWhenPtr;
1072 
1073 struct _xsltStyleItemWhen {
1074     XSLT_ITEM_COMMON_FIELDS
1075 
1076     const xmlChar *test;
1077     xmlXPathCompExprPtr comp;
1078 };
1079 
1080 /**
1081  * xsltStyleItemOtherwise:
1082  *
1083  * Allowed parent: xsl:choose
1084  * <xsl:otherwise>
1085  *   <!-- Content: template -->
1086  * </xsl:otherwise>
1087  */
1088 typedef struct _xsltStyleItemOtherwise xsltStyleItemOtherwise;
1089 typedef xsltStyleItemOtherwise *xsltStyleItemOtherwisePtr;
1090 
1091 struct _xsltStyleItemOtherwise {
1092     XSLT_ITEM_COMMON_FIELDS
1093 };
1094 
1095 typedef struct _xsltStyleItemInclude xsltStyleItemInclude;
1096 typedef xsltStyleItemInclude *xsltStyleItemIncludePtr;
1097 
1098 struct _xsltStyleItemInclude {
1099     XSLT_ITEM_COMMON_FIELDS
1100     xsltDocumentPtr include;
1101 };
1102 
1103 /************************************************************************
1104  *                                  *
1105  *  XSLT elements in forwards-compatible mode                           *
1106  *                                  *
1107  ************************************************************************/
1108 
1109 typedef struct _xsltStyleItemUknown xsltStyleItemUknown;
1110 typedef xsltStyleItemUknown *xsltStyleItemUknownPtr;
1111 struct _xsltStyleItemUknown {
1112     XSLT_ITEM_COMMON_FIELDS
1113 };
1114 
1115 
1116 /************************************************************************
1117  *                                  *
1118  *  Extension elements                                                  *
1119  *                                  *
1120  ************************************************************************/
1121 
1122 /*
1123  * xsltStyleItemExtElement:
1124  *
1125  * Reflects extension elements.
1126  *
1127  * NOTE: Due to the fact that the structure xsltElemPreComp is most
1128  * probably already heavily in use out there by users, so we cannot
1129  * easily change it, we'll create an intermediate structure which will
1130  * hold an xsltElemPreCompPtr.
1131  * BIG NOTE: The only problem I see here is that the user processes the
1132  *  content of the stylesheet tree, possibly he'll lookup the node->psvi
1133  *  fields in order to find subsequent extension functions.
1134  *  In this case, the user's code will break, since the node->psvi
1135  *  field will hold now the xsltStyleItemExtElementPtr and not
1136  *  the xsltElemPreCompPtr.
1137  *  However the place where the structure is anchored in the node-tree,
1138  *  namely node->psvi, has beed already once been moved from node->_private
1139  *  to node->psvi, so we have a precedent here, which, I think, should allow
1140  *  us to change such semantics without headaches.
1141  */
1142 typedef struct _xsltStyleItemExtElement xsltStyleItemExtElement;
1143 typedef xsltStyleItemExtElement *xsltStyleItemExtElementPtr;
1144 struct _xsltStyleItemExtElement {
1145     XSLT_ITEM_COMMON_FIELDS
1146     xsltElemPreCompPtr item;
1147 };
1148 
1149 /************************************************************************
1150  *                                  *
1151  *  Literal result elements                                             *
1152  *                                  *
1153  ************************************************************************/
1154 
1155 typedef struct _xsltEffectiveNs xsltEffectiveNs;
1156 typedef xsltEffectiveNs *xsltEffectiveNsPtr;
1157 struct _xsltEffectiveNs {
1158     xsltEffectiveNsPtr nextInStore; /* storage next */
1159     xsltEffectiveNsPtr next; /* next item in the list */
1160     const xmlChar *prefix;
1161     const xmlChar *nsName;
1162     /*
1163     * Indicates if eclared on the literal result element; dunno if really
1164     * needed.
1165     */
1166     int holdByElem;
1167 };
1168 
1169 /*
1170  * Info for literal result elements.
1171  * This will be set on the elem->psvi field and will be
1172  * shared by literal result elements, which have the same
1173  * excluded result namespaces; i.e., this *won't* be created uniquely
1174  * for every literal result element.
1175  */
1176 typedef struct _xsltStyleItemLRElementInfo xsltStyleItemLRElementInfo;
1177 typedef xsltStyleItemLRElementInfo *xsltStyleItemLRElementInfoPtr;
1178 struct _xsltStyleItemLRElementInfo {
1179     XSLT_ITEM_COMMON_FIELDS
1180     /*
1181     * @effectiveNs is the set of effective ns-nodes
1182     *  on the literal result element, which will be added to the result
1183     *  element if not already existing in the result tree.
1184     *  This means that excluded namespaces (via exclude-result-prefixes,
1185     *  extension-element-prefixes and the XSLT namespace) not added
1186     *  to the set.
1187     *  Namespace-aliasing was applied on the @effectiveNs.
1188     */
1189     xsltEffectiveNsPtr effectiveNs;
1190 
1191 };
1192 
1193 #ifdef XSLT_REFACTORED
1194 
1195 typedef struct _xsltNsAlias xsltNsAlias;
1196 typedef xsltNsAlias *xsltNsAliasPtr;
1197 struct _xsltNsAlias {
1198     xsltNsAliasPtr next; /* next in the list */
1199     xmlNsPtr literalNs;
1200     xmlNsPtr targetNs;
1201     xmlDocPtr docOfTargetNs;
1202 };
1203 #endif
1204 
1205 #ifdef XSLT_REFACTORED_XSLT_NSCOMP
1206 
1207 typedef struct _xsltNsMap xsltNsMap;
1208 typedef xsltNsMap *xsltNsMapPtr;
1209 struct _xsltNsMap {
1210     xsltNsMapPtr next; /* next in the list */
1211     xmlDocPtr doc;
1212     xmlNodePtr elem; /* the element holding the ns-decl */
1213     xmlNsPtr ns; /* the xmlNs structure holding the XML namespace name */
1214     const xmlChar *origNsName; /* the original XML namespace name */
1215     const xmlChar *newNsName; /* the mapped XML namespace name */
1216 };
1217 #endif
1218 
1219 /************************************************************************
1220  *                                  *
1221  *  Compile-time structures for *internal* use only                     *
1222  *                                  *
1223  ************************************************************************/
1224 
1225 typedef struct _xsltPrincipalStylesheetData xsltPrincipalStylesheetData;
1226 typedef xsltPrincipalStylesheetData *xsltPrincipalStylesheetDataPtr;
1227 
1228 typedef struct _xsltNsList xsltNsList;
1229 typedef xsltNsList *xsltNsListPtr;
1230 struct _xsltNsList {
1231     xsltNsListPtr next; /* next in the list */
1232     xmlNsPtr ns;
1233 };
1234 
1235 /*
1236 * xsltVarInfo:
1237 *
1238 * Used at compilation time for parameters and variables.
1239 */
1240 typedef struct _xsltVarInfo xsltVarInfo;
1241 typedef xsltVarInfo *xsltVarInfoPtr;
1242 struct _xsltVarInfo {
1243     xsltVarInfoPtr next; /* next in the list */
1244     xsltVarInfoPtr prev;
1245     int depth; /* the depth in the tree */
1246     const xmlChar *name;
1247     const xmlChar *nsName;
1248 };
1249 
1250 /**
1251  * xsltCompilerNodeInfo:
1252  *
1253  * Per-node information during compile-time.
1254  */
1255 typedef struct _xsltCompilerNodeInfo xsltCompilerNodeInfo;
1256 typedef xsltCompilerNodeInfo *xsltCompilerNodeInfoPtr;
1257 struct _xsltCompilerNodeInfo {
1258     xsltCompilerNodeInfoPtr next;
1259     xsltCompilerNodeInfoPtr prev;
1260     xmlNodePtr node;
1261     int depth;
1262     xsltTemplatePtr templ;   /* The owning template */
1263     int category;        /* XSLT element, LR-element or
1264                                 extension element */
1265     xsltStyleType type;
1266     xsltElemPreCompPtr item; /* The compiled information */
1267     /* The current in-scope namespaces */
1268     xsltNsListContainerPtr inScopeNs;
1269     /* The current excluded result namespaces */
1270     xsltPointerListPtr exclResultNs;
1271     /* The current extension instruction namespaces */
1272     xsltPointerListPtr extElemNs;
1273 
1274     /* The current info for literal result elements. */
1275     xsltStyleItemLRElementInfoPtr litResElemInfo;
1276     /*
1277     * Set to 1 if in-scope namespaces changed,
1278     *  or excluded result namespaces changed,
1279     *  or extension element namespaces changed.
1280     * This will trigger creation of new infos
1281     *  for literal result elements.
1282     */
1283     int nsChanged;
1284     int preserveWhitespace;
1285     int stripWhitespace;
1286     int isRoot; /* whether this is the stylesheet's root node */
1287     int forwardsCompat; /* whether forwards-compatible mode is enabled */
1288     /* whether the content of an extension element was processed */
1289     int extContentHandled;
1290     /* the type of the current child */
1291     xsltStyleType curChildType;
1292 };
1293 
1294 /**
1295  * XSLT_CCTXT:
1296  *
1297  * get pointer to compiler context
1298  */
1299 #define XSLT_CCTXT(style) ((xsltCompilerCtxtPtr) style->compCtxt)
1300 
1301 typedef enum {
1302     XSLT_ERROR_SEVERITY_ERROR = 0,
1303     XSLT_ERROR_SEVERITY_WARNING
1304 } xsltErrorSeverityType;
1305 
1306 typedef struct _xsltCompilerCtxt xsltCompilerCtxt;
1307 typedef xsltCompilerCtxt *xsltCompilerCtxtPtr;
1308 struct _xsltCompilerCtxt {
1309     void *errorCtxt;            /* user specific error context */
1310     /*
1311     * used for error/warning reports; e.g. XSLT_ERROR_SEVERITY_WARNING */
1312     xsltErrorSeverityType errSeverity;
1313     int warnings;       /* TODO: number of warnings found at
1314                                    compilation */
1315     int errors;         /* TODO: number of errors found at
1316                                    compilation */
1317     xmlDictPtr dict;
1318     xsltStylesheetPtr style;
1319     int simplified; /* whether this is a simplified stylesheet */
1320     /* TODO: structured/unstructured error contexts. */
1321     int depth; /* Current depth of processing */
1322 
1323     xsltCompilerNodeInfoPtr inode;
1324     xsltCompilerNodeInfoPtr inodeList;
1325     xsltCompilerNodeInfoPtr inodeLast;
1326     xsltPointerListPtr tmpList; /* Used for various purposes */
1327     /*
1328     * The XSLT version as specified by the stylesheet's root element.
1329     */
1330     int isInclude;
1331     int hasForwardsCompat; /* whether forwards-compatible mode was used
1332                  in a parsing episode */
1333     int maxNodeInfos; /* TEMP TODO: just for the interest */
1334     int maxLREs;  /* TEMP TODO: just for the interest */
1335     /*
1336     * In order to keep the old behaviour, applying strict rules of
1337     * the spec can be turned off. This has effect only on special
1338     * mechanisms like whitespace-stripping in the stylesheet.
1339     */
1340     int strict;
1341     xsltPrincipalStylesheetDataPtr psData;
1342     xsltStyleItemUknownPtr unknownItem;
1343     int hasNsAliases; /* Indicator if there was an xsl:namespace-alias. */
1344     xsltNsAliasPtr nsAliases;
1345     xsltVarInfoPtr ivars; /* Storage of local in-scope variables/params. */
1346     xsltVarInfoPtr ivar; /* topmost local variable/param. */
1347 };
1348 
1349 #else /* XSLT_REFACTORED */
1350 /*
1351 * The old structures before refactoring.
1352 */
1353 
1354 /**
1355  * _xsltStylePreComp:
1356  *
1357  * The in-memory structure corresponding to XSLT stylesheet constructs
1358  * precomputed data.
1359  */
1360 struct _xsltStylePreComp {
1361     xsltElemPreCompPtr next;    /* chained list */
1362     xsltStyleType type;     /* type of the element */
1363     xsltTransformFunction func; /* handling function */
1364     xmlNodePtr inst;        /* the instruction */
1365 
1366     /*
1367      * Pre computed values.
1368      */
1369 
1370     const xmlChar *stype;       /* sort */
1371     int      has_stype;     /* sort */
1372     int      number;        /* sort */
1373     const xmlChar *order;   /* sort */
1374     int      has_order;     /* sort */
1375     int      descending;    /* sort */
1376     const xmlChar *lang;    /* sort */
1377     int      has_lang;      /* sort */
1378     const xmlChar *case_order;  /* sort */
1379     int      lower_first;   /* sort */
1380 
1381     const xmlChar *use;     /* copy, element */
1382     int      has_use;       /* copy, element */
1383 
1384     int      noescape;      /* text */
1385 
1386     const xmlChar *name;    /* element, attribute, pi */
1387     int      has_name;      /* element, attribute, pi */
1388     const xmlChar *ns;      /* element */
1389     int      has_ns;        /* element */
1390 
1391     const xmlChar *mode;    /* apply-templates */
1392     const xmlChar *modeURI; /* apply-templates */
1393 
1394     const xmlChar *test;    /* if */
1395 
1396     xsltTemplatePtr templ;  /* call-template */
1397 
1398     const xmlChar *select;  /* sort, copy-of, value-of, apply-templates */
1399 
1400     int      ver11;     /* document */
1401     const xmlChar *filename;    /* document URL */
1402     int      has_filename;  /* document */
1403 
1404     xsltNumberData numdata; /* number */
1405 
1406     xmlXPathCompExprPtr comp;   /* a precompiled XPath expression */
1407     xmlNsPtr *nsList;       /* the namespaces in scope */
1408     int nsNr;           /* the number of namespaces in scope */
1409 };
1410 
1411 #endif /* XSLT_REFACTORED */
1412 
1413 
1414 /*
1415  * The in-memory structure corresponding to an XSLT Variable
1416  * or Param.
1417  */
1418 typedef struct _xsltStackElem xsltStackElem;
1419 typedef xsltStackElem *xsltStackElemPtr;
1420 struct _xsltStackElem {
1421     struct _xsltStackElem *next;/* chained list */
1422     xsltStylePreCompPtr comp;   /* the compiled form */
1423     int computed;       /* was the evaluation done */
1424     const xmlChar *name;    /* the local part of the name QName */
1425     const xmlChar *nameURI; /* the URI part of the name QName */
1426     const xmlChar *select;  /* the eval string */
1427     xmlNodePtr tree;        /* the sequence constructor if no eval
1428                     string or the location */
1429     xmlXPathObjectPtr value;    /* The value if computed */
1430     xmlDocPtr fragment;     /* The Result Tree Fragments (needed for XSLT 1.0)
1431                    which are bound to the variable's lifetime. */
1432     int level;                  /* the depth in the tree;
1433                                    -1 if persistent (e.g. a given xsl:with-param) */
1434     xsltTransformContextPtr context; /* The transformation context; needed to cache
1435                                         the variables */
1436     int flags;
1437 };
1438 
1439 #ifdef XSLT_REFACTORED
1440 
1441 struct _xsltPrincipalStylesheetData {
1442     /*
1443     * Namespace dictionary for ns-prefixes and ns-names:
1444     * TODO: Shared between stylesheets, and XPath mechanisms.
1445     *   Not used yet.
1446     */
1447     xmlDictPtr namespaceDict;
1448     /*
1449     * Global list of in-scope namespaces.
1450     */
1451     xsltPointerListPtr inScopeNamespaces;
1452     /*
1453     * Global list of information for [xsl:]excluded-result-prefixes.
1454     */
1455     xsltPointerListPtr exclResultNamespaces;
1456     /*
1457     * Global list of information for [xsl:]extension-element-prefixes.
1458     */
1459     xsltPointerListPtr extElemNamespaces;
1460     xsltEffectiveNsPtr effectiveNs;
1461 #ifdef XSLT_REFACTORED_XSLT_NSCOMP
1462     /*
1463     * Namespace name map to get rid of string comparison of namespace names.
1464     */
1465     xsltNsMapPtr nsMap;
1466 #endif
1467 };
1468 
1469 
1470 #endif
1471 /*
1472  * Note that we added a @compCtxt field to anchor an stylesheet compilation
1473  * context, since, due to historical reasons, various compile-time function
1474  * take only the stylesheet as argument and not a compilation context.
1475  */
1476 struct _xsltStylesheet {
1477     /*
1478      * The stylesheet import relation is kept as a tree.
1479      */
1480     struct _xsltStylesheet *parent;
1481     struct _xsltStylesheet *next;
1482     struct _xsltStylesheet *imports;
1483 
1484     xsltDocumentPtr docList;        /* the include document list */
1485 
1486     /*
1487      * General data on the style sheet document.
1488      */
1489     xmlDocPtr doc;      /* the parsed XML stylesheet */
1490     xmlHashTablePtr stripSpaces;/* the hash table of the strip-space and
1491                    preserve space elements */
1492     int             stripAll;   /* strip-space * (1) preserve-space * (-1) */
1493     xmlHashTablePtr cdataSection;/* the hash table of the cdata-section */
1494 
1495     /*
1496      * Global variable or parameters.
1497      */
1498     xsltStackElemPtr variables; /* linked list of param and variables */
1499 
1500     /*
1501      * Template descriptions.
1502      */
1503     xsltTemplatePtr templates;           /* the ordered list of templates */
1504     xmlHashTablePtr templatesHash;       /* hash table or wherever compiled
1505                                             templates information is stored */
1506     struct _xsltCompMatch *rootMatch;    /* template based on / */
1507     struct _xsltCompMatch *keyMatch;     /* template based on key() */
1508     struct _xsltCompMatch *elemMatch;    /* template based on * */
1509     struct _xsltCompMatch *attrMatch;    /* template based on @* */
1510     struct _xsltCompMatch *parentMatch;  /* template based on .. */
1511     struct _xsltCompMatch *textMatch;    /* template based on text() */
1512     struct _xsltCompMatch *piMatch;      /* template based on
1513                                             processing-instruction() */
1514     struct _xsltCompMatch *commentMatch; /* template based on comment() */
1515 
1516     /*
1517      * Namespace aliases.
1518      * NOTE: Not used in the refactored code.
1519      */
1520     xmlHashTablePtr nsAliases;  /* the namespace alias hash tables */
1521 
1522     /*
1523      * Attribute sets.
1524      */
1525     xmlHashTablePtr attributeSets;/* the attribute sets hash tables */
1526 
1527     /*
1528      * Namespaces.
1529      * TODO: Eliminate this.
1530      */
1531     xmlHashTablePtr nsHash;     /* the set of namespaces in use:
1532                                    ATTENTION: This is used for
1533                                    execution of XPath expressions; unfortunately
1534                                    it restricts the stylesheet to have distinct
1535                                    prefixes.
1536                    TODO: We need to get rid of this.
1537                  */
1538     void           *nsDefs;     /* ATTENTION TODO: This is currently used to store
1539                    xsltExtDefPtr (in extensions.c) and
1540                                    *not* xmlNsPtr.
1541                  */
1542 
1543     /*
1544      * Key definitions.
1545      */
1546     void *keys;         /* key definitions */
1547 
1548     /*
1549      * Output related stuff.
1550      */
1551     xmlChar *method;        /* the output method */
1552     xmlChar *methodURI;     /* associated namespace if any */
1553     xmlChar *version;       /* version string */
1554     xmlChar *encoding;      /* encoding string */
1555     int omitXmlDeclaration;     /* omit-xml-declaration = "yes" | "no" */
1556 
1557     /*
1558      * Number formatting.
1559      */
1560     xsltDecimalFormatPtr decimalFormat;
1561     int standalone;             /* standalone = "yes" | "no" */
1562     xmlChar *doctypePublic;     /* doctype-public string */
1563     xmlChar *doctypeSystem;     /* doctype-system string */
1564     int indent;         /* should output being indented */
1565     xmlChar *mediaType;     /* media-type string */
1566 
1567     /*
1568      * Precomputed blocks.
1569      */
1570     xsltElemPreCompPtr preComps;/* list of precomputed blocks */
1571     int warnings;       /* number of warnings found at compilation */
1572     int errors;         /* number of errors found at compilation */
1573 
1574     xmlChar  *exclPrefix;   /* last excluded prefixes */
1575     xmlChar **exclPrefixTab;    /* array of excluded prefixes */
1576     int       exclPrefixNr; /* number of excluded prefixes in scope */
1577     int       exclPrefixMax;    /* size of the array */
1578 
1579     void     *_private;     /* user defined data */
1580 
1581     /*
1582      * Extensions.
1583      */
1584     xmlHashTablePtr extInfos;   /* the extension data */
1585     int         extrasNr;   /* the number of extras required */
1586 
1587     /*
1588      * For keeping track of nested includes
1589      */
1590     xsltDocumentPtr includes;   /* points to last nested include */
1591 
1592     /*
1593      * dictionary: shared between stylesheet, context and documents.
1594      */
1595     xmlDictPtr dict;
1596     /*
1597      * precompiled attribute value templates.
1598      */
1599     void *attVTs;
1600     /*
1601      * if namespace-alias has an alias for the default stylesheet prefix
1602      * NOTE: Not used in the refactored code.
1603      */
1604     const xmlChar *defaultAlias;
1605     /*
1606      * bypass pre-processing (already done) (used in imports)
1607      */
1608     int nopreproc;
1609     /*
1610      * all document text strings were internalized
1611      */
1612     int internalized;
1613     /*
1614      * Literal Result Element as Stylesheet c.f. section 2.3
1615      */
1616     int literal_result;
1617     /*
1618     * The principal stylesheet
1619     */
1620     xsltStylesheetPtr principal;
1621 #ifdef XSLT_REFACTORED
1622     /*
1623     * Compilation context used during compile-time.
1624     */
1625     xsltCompilerCtxtPtr compCtxt; /* TODO: Change this to (void *). */
1626 
1627     xsltPrincipalStylesheetDataPtr principalData;
1628 #endif
1629     /*
1630      * Forwards-compatible processing
1631      */
1632     int forwards_compatible;
1633 
1634     xmlHashTablePtr namedTemplates; /* hash table of named templates */
1635 
1636     xmlXPathContextPtr xpathCtxt;
1637 
1638     unsigned long opLimit;
1639     unsigned long opCount;
1640 };
1641 
1642 typedef struct _xsltTransformCache xsltTransformCache;
1643 typedef xsltTransformCache *xsltTransformCachePtr;
1644 struct _xsltTransformCache {
1645     xmlDocPtr RVT;
1646     int nbRVT;
1647     xsltStackElemPtr stackItems;
1648     int nbStackItems;
1649 #ifdef XSLT_DEBUG_PROFILE_CACHE
1650     int dbgCachedRVTs;
1651     int dbgReusedRVTs;
1652     int dbgCachedVars;
1653     int dbgReusedVars;
1654 #endif
1655 };
1656 
1657 /*
1658  * The in-memory structure corresponding to an XSLT Transformation.
1659  */
1660 typedef enum {
1661     XSLT_OUTPUT_XML = 0,
1662     XSLT_OUTPUT_HTML,
1663     XSLT_OUTPUT_TEXT
1664 } xsltOutputType;
1665 
1666 typedef void *
1667 (*xsltNewLocaleFunc)(const xmlChar *lang, int lowerFirst);
1668 typedef void
1669 (*xsltFreeLocaleFunc)(void *locale);
1670 typedef xmlChar *
1671 (*xsltGenSortKeyFunc)(void *locale, const xmlChar *lang);
1672 
1673 typedef enum {
1674     XSLT_STATE_OK = 0,
1675     XSLT_STATE_ERROR,
1676     XSLT_STATE_STOPPED
1677 } xsltTransformState;
1678 
1679 struct _xsltTransformContext {
1680     xsltStylesheetPtr style;        /* the stylesheet used */
1681     xsltOutputType type;        /* the type of output */
1682 
1683     xsltTemplatePtr  templ;     /* the current template */
1684     int              templNr;       /* Nb of templates in the stack */
1685     int              templMax;      /* Size of the templtes stack */
1686     xsltTemplatePtr *templTab;      /* the template stack */
1687 
1688     xsltStackElemPtr  vars;     /* the current variable list */
1689     int               varsNr;       /* Nb of variable list in the stack */
1690     int               varsMax;      /* Size of the variable list stack */
1691     xsltStackElemPtr *varsTab;      /* the variable list stack */
1692     int               varsBase;     /* the var base for current templ */
1693 
1694     /*
1695      * Extensions
1696      */
1697     xmlHashTablePtr   extFunctions; /* the extension functions */
1698     xmlHashTablePtr   extElements;  /* the extension elements */
1699     xmlHashTablePtr   extInfos;     /* the extension data */
1700 
1701     const xmlChar *mode;        /* the current mode */
1702     const xmlChar *modeURI;     /* the current mode URI */
1703 
1704     xsltDocumentPtr docList;        /* the document list */
1705 
1706     xsltDocumentPtr document;       /* the current source document; can be NULL if an RTF */
1707     xmlNodePtr node;            /* the current node being processed */
1708     xmlNodeSetPtr nodeList;     /* the current node list */
1709     /* xmlNodePtr current;          the node */
1710 
1711     xmlDocPtr output;           /* the resulting document */
1712     xmlNodePtr insert;          /* the insertion node */
1713 
1714     xmlXPathContextPtr xpathCtxt;   /* the XPath context */
1715     xsltTransformState state;       /* the current state */
1716 
1717     /*
1718      * Global variables
1719      */
1720     xmlHashTablePtr   globalVars;   /* the global variables and params */
1721 
1722     xmlNodePtr inst;            /* the instruction in the stylesheet */
1723 
1724     int xinclude;           /* should XInclude be processed */
1725 
1726     const char *      outputFile;   /* the output URI if known */
1727 
1728     int profile;                        /* is this run profiled */
1729     long             prof;      /* the current profiled value */
1730     int              profNr;        /* Nb of templates in the stack */
1731     int              profMax;       /* Size of the templtaes stack */
1732     long            *profTab;       /* the profile template stack */
1733 
1734     void            *_private;      /* user defined data */
1735 
1736     int              extrasNr;      /* the number of extras used */
1737     int              extrasMax;     /* the number of extras allocated */
1738     xsltRuntimeExtraPtr extras;     /* extra per runtime information */
1739 
1740     xsltDocumentPtr  styleList;     /* the stylesheet docs list */
1741     void                 * sec;     /* the security preferences if any */
1742 
1743     xmlGenericErrorFunc  error;     /* a specific error handler */
1744     void              * errctx;     /* context for the error handler */
1745 
1746     xsltSortFunc      sortfunc;     /* a ctxt specific sort routine */
1747 
1748     /*
1749      * handling of temporary Result Value Tree
1750      * (XSLT 1.0 term: "Result Tree Fragment")
1751      */
1752     xmlDocPtr       tmpRVT;     /* list of RVT without persistance */
1753     xmlDocPtr       persistRVT;     /* list of persistant RVTs */
1754     int             ctxtflags;          /* context processing flags */
1755 
1756     /*
1757      * Speed optimization when coalescing text nodes
1758      */
1759     const xmlChar  *lasttext;       /* last text node content */
1760     int             lasttsize;      /* last text node size */
1761     int             lasttuse;       /* last text node use */
1762     /*
1763      * Per Context Debugging
1764      */
1765     int debugStatus;            /* the context level debug status */
1766     unsigned long* traceCode;       /* pointer to the variable holding the mask */
1767 
1768     int parserOptions;          /* parser options xmlParserOption */
1769 
1770     /*
1771      * dictionary: shared between stylesheet, context and documents.
1772      */
1773     xmlDictPtr dict;
1774     xmlDocPtr       tmpDoc; /* Obsolete; not used in the library. */
1775     /*
1776      * all document text strings are internalized
1777      */
1778     int internalized;
1779     int nbKeys;
1780     int hasTemplKeyPatterns;
1781     xsltTemplatePtr currentTemplateRule; /* the Current Template Rule */
1782     xmlNodePtr initialContextNode;
1783     xmlDocPtr initialContextDoc;
1784     xsltTransformCachePtr cache;
1785     void *contextVariable; /* the current variable item */
1786     xmlDocPtr localRVT; /* list of local tree fragments; will be freed when
1787                the instruction which created the fragment
1788                            exits */
1789     xmlDocPtr localRVTBase; /* Obsolete */
1790     int keyInitLevel;   /* Needed to catch recursive keys issues */
1791     int depth;          /* Needed to catch recursions */
1792     int maxTemplateDepth;
1793     int maxTemplateVars;
1794     unsigned long opLimit;
1795     unsigned long opCount;
1796     int sourceDocDirty;
1797     unsigned long currentId; /* For generate-id() */
1798 
1799     xsltNewLocaleFunc newLocale;
1800     xsltFreeLocaleFunc freeLocale;
1801     xsltGenSortKeyFunc genSortKey;
1802 };
1803 
1804 /**
1805  * CHECK_STOPPED:
1806  *
1807  * Macro to check if the XSLT processing should be stopped.
1808  * Will return from the function.
1809  */
1810 #define CHECK_STOPPED if (ctxt->state == XSLT_STATE_STOPPED) return;
1811 
1812 /**
1813  * CHECK_STOPPEDE:
1814  *
1815  * Macro to check if the XSLT processing should be stopped.
1816  * Will goto the error: label.
1817  */
1818 #define CHECK_STOPPEDE if (ctxt->state == XSLT_STATE_STOPPED) goto error;
1819 
1820 /**
1821  * CHECK_STOPPED0:
1822  *
1823  * Macro to check if the XSLT processing should be stopped.
1824  * Will return from the function with a 0 value.
1825  */
1826 #define CHECK_STOPPED0 if (ctxt->state == XSLT_STATE_STOPPED) return(0);
1827 
1828 /*
1829  * The macro XML_CAST_FPTR is a hack to avoid a gcc warning about
1830  * possible incompatibilities between function pointers and object
1831  * pointers.  It is defined in libxml/hash.h within recent versions
1832  * of libxml2, but is put here for compatibility.
1833  */
1834 #ifndef XML_CAST_FPTR
1835 /**
1836  * XML_CAST_FPTR:
1837  * @fptr:  pointer to a function
1838  *
1839  * Macro to do a casting from an object pointer to a
1840  * function pointer without encountering a warning from
1841  * gcc
1842  *
1843  * #define XML_CAST_FPTR(fptr) (*(void **)(&fptr))
1844  * This macro violated ISO C aliasing rules (gcc4 on s390 broke)
1845  * so it is disabled now
1846  */
1847 
1848 #define XML_CAST_FPTR(fptr) fptr
1849 #endif
1850 /*
1851  * Functions associated to the internal types
1852 xsltDecimalFormatPtr    xsltDecimalFormatGetByName(xsltStylesheetPtr sheet,
1853                            xmlChar *name);
1854  */
1855 XSLTPUBFUN xsltStylesheetPtr XSLTCALL
1856             xsltNewStylesheet   (void);
1857 XSLTPUBFUN xsltStylesheetPtr XSLTCALL
1858             xsltParseStylesheetFile (const xmlChar* filename);
1859 XSLTPUBFUN void XSLTCALL
1860             xsltFreeStylesheet  (xsltStylesheetPtr style);
1861 XSLTPUBFUN int XSLTCALL
1862             xsltIsBlank     (xmlChar *str);
1863 XSLTPUBFUN void XSLTCALL
1864             xsltFreeStackElemList   (xsltStackElemPtr elem);
1865 XSLTPUBFUN xsltDecimalFormatPtr XSLTCALL
1866             xsltDecimalFormatGetByName(xsltStylesheetPtr style,
1867                          xmlChar *name);
1868 XSLTPUBFUN xsltDecimalFormatPtr XSLTCALL
1869             xsltDecimalFormatGetByQName(xsltStylesheetPtr style,
1870                          const xmlChar *nsUri,
1871                                                  const xmlChar *name);
1872 
1873 XSLTPUBFUN xsltStylesheetPtr XSLTCALL
1874             xsltParseStylesheetProcess(xsltStylesheetPtr ret,
1875                          xmlDocPtr doc);
1876 XSLTPUBFUN void XSLTCALL
1877             xsltParseStylesheetOutput(xsltStylesheetPtr style,
1878                          xmlNodePtr cur);
1879 XSLTPUBFUN xsltStylesheetPtr XSLTCALL
1880             xsltParseStylesheetDoc  (xmlDocPtr doc);
1881 XSLTPUBFUN xsltStylesheetPtr XSLTCALL
1882             xsltParseStylesheetImportedDoc(xmlDocPtr doc,
1883                         xsltStylesheetPtr style);
1884 XSLTPUBFUN int XSLTCALL
1885             xsltParseStylesheetUser(xsltStylesheetPtr style,
1886                         xmlDocPtr doc);
1887 XSLTPUBFUN xsltStylesheetPtr XSLTCALL
1888             xsltLoadStylesheetPI    (xmlDocPtr doc);
1889 XSLTPUBFUN void XSLTCALL
1890             xsltNumberFormat    (xsltTransformContextPtr ctxt,
1891                          xsltNumberDataPtr data,
1892                          xmlNodePtr node);
1893 XSLTPUBFUN xmlXPathError XSLTCALL
1894             xsltFormatNumberConversion(xsltDecimalFormatPtr self,
1895                          xmlChar *format,
1896                          double number,
1897                          xmlChar **result);
1898 
1899 XSLTPUBFUN void XSLTCALL
1900             xsltParseTemplateContent(xsltStylesheetPtr style,
1901                          xmlNodePtr templ);
1902 XSLTPUBFUN int XSLTCALL
1903             xsltAllocateExtra   (xsltStylesheetPtr style);
1904 XSLTPUBFUN int XSLTCALL
1905             xsltAllocateExtraCtxt   (xsltTransformContextPtr ctxt);
1906 /*
1907  * Extra functions for Result Value Trees
1908  */
1909 XSLTPUBFUN xmlDocPtr XSLTCALL
1910             xsltCreateRVT       (xsltTransformContextPtr ctxt);
1911 XSLTPUBFUN int XSLTCALL
1912             xsltRegisterTmpRVT  (xsltTransformContextPtr ctxt,
1913                          xmlDocPtr RVT);
1914 XSLTPUBFUN int XSLTCALL
1915             xsltRegisterLocalRVT    (xsltTransformContextPtr ctxt,
1916                          xmlDocPtr RVT);
1917 XSLTPUBFUN int XSLTCALL
1918             xsltRegisterPersistRVT  (xsltTransformContextPtr ctxt,
1919                          xmlDocPtr RVT);
1920 XSLTPUBFUN int XSLTCALL
1921             xsltExtensionInstructionResultRegister(
1922                          xsltTransformContextPtr ctxt,
1923                          xmlXPathObjectPtr obj);
1924 XSLTPUBFUN int XSLTCALL
1925             xsltExtensionInstructionResultFinalize(
1926                          xsltTransformContextPtr ctxt);
1927 XSLTPUBFUN int XSLTCALL
1928             xsltFlagRVTs(
1929                          xsltTransformContextPtr ctxt,
1930                          xmlXPathObjectPtr obj,
1931                          int val);
1932 XSLTPUBFUN void XSLTCALL
1933             xsltFreeRVTs        (xsltTransformContextPtr ctxt);
1934 XSLTPUBFUN void XSLTCALL
1935             xsltReleaseRVT      (xsltTransformContextPtr ctxt,
1936                          xmlDocPtr RVT);
1937 /*
1938  * Extra functions for Attribute Value Templates
1939  */
1940 XSLTPUBFUN void XSLTCALL
1941             xsltCompileAttr     (xsltStylesheetPtr style,
1942                          xmlAttrPtr attr);
1943 XSLTPUBFUN xmlChar * XSLTCALL
1944             xsltEvalAVT     (xsltTransformContextPtr ctxt,
1945                          void *avt,
1946                          xmlNodePtr node);
1947 XSLTPUBFUN void XSLTCALL
1948             xsltFreeAVTList     (void *avt);
1949 
1950 /*
1951  * Extra function for successful xsltCleanupGlobals / xsltInit sequence.
1952  */
1953 
1954 XSLTPUBFUN void XSLTCALL
1955             xsltUninit      (void);
1956 
1957 /************************************************************************
1958  *                                  *
1959  *  Compile-time functions for *internal* use only                      *
1960  *                                  *
1961  ************************************************************************/
1962 
1963 #ifdef XSLT_REFACTORED
1964 XSLTPUBFUN void XSLTCALL
1965             xsltParseSequenceConstructor(
1966                          xsltCompilerCtxtPtr cctxt,
1967                          xmlNodePtr start);
1968 XSLTPUBFUN int XSLTCALL
1969             xsltParseAnyXSLTElem    (xsltCompilerCtxtPtr cctxt,
1970                          xmlNodePtr elem);
1971 #ifdef XSLT_REFACTORED_XSLT_NSCOMP
1972 XSLTPUBFUN int XSLTCALL
1973             xsltRestoreDocumentNamespaces(
1974                          xsltNsMapPtr ns,
1975                          xmlDocPtr doc);
1976 #endif
1977 #endif /* XSLT_REFACTORED */
1978 
1979 /************************************************************************
1980  *                                  *
1981  *  Transformation-time functions for *internal* use only               *
1982  *                                  *
1983  ************************************************************************/
1984 XSLTPUBFUN int XSLTCALL
1985             xsltInitCtxtKey     (xsltTransformContextPtr ctxt,
1986                          xsltDocumentPtr doc,
1987                          xsltKeyDefPtr keyd);
1988 XSLTPUBFUN int XSLTCALL
1989             xsltInitAllDocKeys  (xsltTransformContextPtr ctxt);
1990 #ifdef __cplusplus
1991 }
1992 #endif
1993 
1994 #endif /* __XML_XSLT_H__ */
1995