Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-15 09:44:22

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