Eneboo - Documentación para desarrolladores
|
00001 /* 00002 * Summary: internal data structures, constants and functions 00003 * Description: Internal data structures, constants and functions used 00004 * by the XSLT engine. 00005 * They are not part of the API or ABI, i.e. they can change 00006 * without prior notice, use carefully. 00007 * 00008 * Copy: See Copyright for the status of this software. 00009 * 00010 * Author: Daniel Veillard 00011 */ 00012 00013 #ifndef __XML_XSLT_INTERNALS_H__ 00014 #define __XML_XSLT_INTERNALS_H__ 00015 00016 #include <libxml/tree.h> 00017 #include <libxml/hash.h> 00018 #include <libxml/xpath.h> 00019 #include <libxml/xmlerror.h> 00020 #include <libxml/dict.h> 00021 #include <libxml/xmlstring.h> 00022 #include <libxslt/xslt.h> 00023 #include "xsltexports.h" 00024 #include "xsltlocale.h" 00025 #include "numbersInternals.h" 00026 00027 #ifdef __cplusplus 00028 extern "C" { 00029 #endif 00030 00031 /* #define XSLT_DEBUG_PROFILE_CACHE */ 00032 00038 #define XSLT_IS_TEXT_NODE(n) ((n != NULL) && \ 00039 (((n)->type == XML_TEXT_NODE) || \ 00040 ((n)->type == XML_CDATA_SECTION_NODE))) 00041 00042 00048 #define XSLT_MARK_RES_TREE_FRAG(n) \ 00049 (n)->name = (char *) xmlStrdup(BAD_CAST " fake node libxslt"); 00050 00056 #define XSLT_IS_RES_TREE_FRAG(n) \ 00057 ((n != NULL) && ((n)->type == XML_DOCUMENT_NODE) && \ 00058 ((n)->name != NULL) && ((n)->name[0] == ' ')) 00059 00066 #define XSLT_REFACTORED_KEYCOMP 00067 00074 #define XSLT_FAST_IF 00075 00081 /* #define XSLT_REFACTORED */ 00082 /* ==================================================================== */ 00083 00089 #define XSLT_REFACTORED_VARS 00090 00091 #ifdef XSLT_REFACTORED 00092 00093 extern const xmlChar *xsltXSLTAttrMarker; 00094 00095 00096 /* TODO: REMOVE: #define XSLT_REFACTORED_EXCLRESNS */ 00097 00098 /* TODO: REMOVE: #define XSLT_REFACTORED_NSALIAS */ 00099 00106 /* #define XSLT_REFACTORED_XSLT_NSCOMP */ 00107 00114 #define XSLT_REFACTORED_XPATHCOMP 00115 00116 #ifdef XSLT_REFACTORED_XSLT_NSCOMP 00117 00118 extern const xmlChar *xsltConstNamespaceNameXSLT; 00119 00125 #define IS_XSLT_ELEM_FAST(n) \ 00126 (((n) != NULL) && ((n)->ns != NULL) && \ 00127 ((n)->ns->href == xsltConstNamespaceNameXSLT)) 00128 00134 #define IS_XSLT_ATTR_FAST(a) \ 00135 (((a) != NULL) && ((a)->ns != NULL) && \ 00136 ((a)->ns->href == xsltConstNamespaceNameXSLT)) 00137 00143 #define XSLT_HAS_INTERNAL_NSMAP(s) \ 00144 (((s) != NULL) && ((s)->principal) && \ 00145 ((s)->principal->principalData) && \ 00146 ((s)->principal->principalData->nsMap)) 00147 00153 #define XSLT_GET_INTERNAL_NSMAP(s) ((s)->principal->principalData->nsMap) 00154 00155 #else /* XSLT_REFACTORED_XSLT_NSCOMP */ 00156 00162 #define IS_XSLT_ELEM_FAST(n) \ 00163 (((n) != NULL) && ((n)->ns != NULL) && \ 00164 (xmlStrEqual((n)->ns->href, XSLT_NAMESPACE))) 00165 00171 #define IS_XSLT_ATTR_FAST(a) \ 00172 (((a) != NULL) && ((a)->ns != NULL) && \ 00173 (xmlStrEqual((a)->ns->href, XSLT_NAMESPACE))) 00174 00175 00176 #endif /* XSLT_REFACTORED_XSLT_NSCOMP */ 00177 00178 00187 /* #define XSLT_REFACTORED_MANDATORY_VERSION */ 00188 00194 typedef struct _xsltPointerList xsltPointerList; 00195 typedef xsltPointerList *xsltPointerListPtr; 00196 struct _xsltPointerList { 00197 void **items; 00198 int number; 00199 int size; 00200 }; 00201 00202 #endif 00203 00210 /* #define XSLT_REFACTORED_PARSING */ 00211 00217 #define XSLT_MAX_SORT 15 00218 00224 #define XSLT_PAT_NO_PRIORITY -12345789 00225 00231 typedef struct _xsltRuntimeExtra xsltRuntimeExtra; 00232 typedef xsltRuntimeExtra *xsltRuntimeExtraPtr; 00233 struct _xsltRuntimeExtra { 00234 void *info; /* pointer to the extra data */ 00235 xmlFreeFunc deallocate; /* pointer to the deallocation routine */ 00236 union { /* dual-purpose field */ 00237 void *ptr; /* data not needing deallocation */ 00238 int ival; /* integer value storage */ 00239 } val; 00240 }; 00241 00249 #define XSLT_RUNTIME_EXTRA_LST(ctxt, nr) (ctxt)->extras[(nr)].info 00250 00257 #define XSLT_RUNTIME_EXTRA_FREE(ctxt, nr) (ctxt)->extras[(nr)].deallocate 00258 00265 #define XSLT_RUNTIME_EXTRA(ctxt, nr, typ) (ctxt)->extras[(nr)].val.typ 00266 00272 typedef struct _xsltTemplate xsltTemplate; 00273 typedef xsltTemplate *xsltTemplatePtr; 00274 struct _xsltTemplate { 00275 struct _xsltTemplate *next;/* chained list sorted by priority */ 00276 struct _xsltStylesheet *style;/* the containing stylesheet */ 00277 xmlChar *match; /* the matching string */ 00278 float priority; /* as given from the stylesheet, not computed */ 00279 const xmlChar *name; /* the local part of the name QName */ 00280 const xmlChar *nameURI; /* the URI part of the name QName */ 00281 const xmlChar *mode;/* the local part of the mode QName */ 00282 const xmlChar *modeURI;/* the URI part of the mode QName */ 00283 xmlNodePtr content; /* the template replacement value */ 00284 xmlNodePtr elem; /* the source element */ 00285 00286 /* 00287 * TODO: @inheritedNsNr and @inheritedNs won't be used in the 00288 * refactored code. 00289 */ 00290 int inheritedNsNr; /* number of inherited namespaces */ 00291 xmlNsPtr *inheritedNs;/* inherited non-excluded namespaces */ 00292 00293 /* Profiling informations */ 00294 int nbCalls; /* the number of time the template was called */ 00295 unsigned long time; /* the time spent in this template */ 00296 void *params; /* xsl:param instructions */ 00297 00298 int templNr; /* Nb of templates in the stack */ 00299 int templMax; /* Size of the templtes stack */ 00300 xsltTemplatePtr *templCalledTab; /* templates called */ 00301 int *templCountTab; /* .. and how often */ 00302 }; 00303 00309 typedef struct _xsltDecimalFormat xsltDecimalFormat; 00310 typedef xsltDecimalFormat *xsltDecimalFormatPtr; 00311 struct _xsltDecimalFormat { 00312 struct _xsltDecimalFormat *next; /* chained list */ 00313 xmlChar *name; 00314 /* Used for interpretation of pattern */ 00315 xmlChar *digit; 00316 xmlChar *patternSeparator; 00317 /* May appear in result */ 00318 xmlChar *minusSign; 00319 xmlChar *infinity; 00320 xmlChar *noNumber; /* Not-a-number */ 00321 /* Used for interpretation of pattern and may appear in result */ 00322 xmlChar *decimalPoint; 00323 xmlChar *grouping; 00324 xmlChar *percent; 00325 xmlChar *permille; 00326 xmlChar *zeroDigit; 00327 }; 00328 00334 typedef struct _xsltDocument xsltDocument; 00335 typedef xsltDocument *xsltDocumentPtr; 00336 struct _xsltDocument { 00337 struct _xsltDocument *next; /* documents are kept in a chained list */ 00338 int main; /* is this the main document */ 00339 xmlDocPtr doc; /* the parsed document */ 00340 void *keys; /* key tables storage */ 00341 struct _xsltDocument *includes; /* subsidiary includes */ 00342 int preproc; /* pre-processing already done */ 00343 int nbKeysComputed; 00344 }; 00345 00351 typedef struct _xsltKeyDef xsltKeyDef; 00352 typedef xsltKeyDef *xsltKeyDefPtr; 00353 struct _xsltKeyDef { 00354 struct _xsltKeyDef *next; 00355 xmlNodePtr inst; 00356 xmlChar *name; 00357 xmlChar *nameURI; 00358 xmlChar *match; 00359 xmlChar *use; 00360 xmlXPathCompExprPtr comp; 00361 xmlXPathCompExprPtr usecomp; 00362 xmlNsPtr *nsList; /* the namespaces in scope */ 00363 int nsNr; /* the number of namespaces in scope */ 00364 }; 00365 00372 typedef struct _xsltKeyTable xsltKeyTable; 00373 typedef xsltKeyTable *xsltKeyTablePtr; 00374 struct _xsltKeyTable { 00375 struct _xsltKeyTable *next; 00376 xmlChar *name; 00377 xmlChar *nameURI; 00378 xmlHashTablePtr keys; 00379 }; 00380 00381 /* 00382 * The in-memory structure corresponding to an XSLT Stylesheet. 00383 * NOTE: most of the content is simply linked from the doc tree 00384 * structure, no specific allocation is made. 00385 */ 00386 typedef struct _xsltStylesheet xsltStylesheet; 00387 typedef xsltStylesheet *xsltStylesheetPtr; 00388 00389 typedef struct _xsltTransformContext xsltTransformContext; 00390 typedef xsltTransformContext *xsltTransformContextPtr; 00391 00398 typedef struct _xsltElemPreComp xsltElemPreComp; 00399 typedef xsltElemPreComp *xsltElemPreCompPtr; 00400 00411 typedef void (*xsltTransformFunction) (xsltTransformContextPtr ctxt, 00412 xmlNodePtr node, 00413 xmlNodePtr inst, 00414 xsltElemPreCompPtr comp); 00415 00424 typedef void (*xsltSortFunc) (xsltTransformContextPtr ctxt, xmlNodePtr *sorts, 00425 int nbsorts); 00426 00427 typedef enum { 00428 XSLT_FUNC_COPY=1, 00429 XSLT_FUNC_SORT, 00430 XSLT_FUNC_TEXT, 00431 XSLT_FUNC_ELEMENT, 00432 XSLT_FUNC_ATTRIBUTE, 00433 XSLT_FUNC_COMMENT, 00434 XSLT_FUNC_PI, 00435 XSLT_FUNC_COPYOF, 00436 XSLT_FUNC_VALUEOF, 00437 XSLT_FUNC_NUMBER, 00438 XSLT_FUNC_APPLYIMPORTS, 00439 XSLT_FUNC_CALLTEMPLATE, 00440 XSLT_FUNC_APPLYTEMPLATES, 00441 XSLT_FUNC_CHOOSE, 00442 XSLT_FUNC_IF, 00443 XSLT_FUNC_FOREACH, 00444 XSLT_FUNC_DOCUMENT, 00445 XSLT_FUNC_WITHPARAM, 00446 XSLT_FUNC_PARAM, 00447 XSLT_FUNC_VARIABLE, 00448 XSLT_FUNC_WHEN, 00449 XSLT_FUNC_EXTENSION 00450 #ifdef XSLT_REFACTORED 00451 , 00452 XSLT_FUNC_OTHERWISE, 00453 XSLT_FUNC_FALLBACK, 00454 XSLT_FUNC_MESSAGE, 00455 XSLT_FUNC_INCLUDE, 00456 XSLT_FUNC_ATTRSET, 00457 XSLT_FUNC_LITERAL_RESULT_ELEMENT, 00458 XSLT_FUNC_UNKOWN_FORWARDS_COMPAT 00459 #endif 00460 } xsltStyleType; 00461 00468 typedef void (*xsltElemPreCompDeallocator) (xsltElemPreCompPtr comp); 00469 00478 struct _xsltElemPreComp { 00479 xsltElemPreCompPtr next; /* next item in the global chained 00480 list hold by xsltStylesheet. */ 00481 xsltStyleType type; /* type of the element */ 00482 xsltTransformFunction func; /* handling function */ 00483 xmlNodePtr inst; /* the node in the stylesheet's tree 00484 corresponding to this item */ 00485 00486 /* end of common part */ 00487 xsltElemPreCompDeallocator free; /* the deallocator */ 00488 }; 00489 00499 typedef struct _xsltStylePreComp xsltStylePreComp; 00500 typedef xsltStylePreComp *xsltStylePreCompPtr; 00501 00502 #ifdef XSLT_REFACTORED 00503 00504 /* 00505 * Some pointer-list utility functions. 00506 */ 00507 XSLTPUBFUN xsltPointerListPtr XSLTCALL 00508 xsltPointerListCreate (int initialSize); 00509 XSLTPUBFUN void XSLTCALL 00510 xsltPointerListFree (xsltPointerListPtr list); 00511 XSLTPUBFUN void XSLTCALL 00512 xsltPointerListClear (xsltPointerListPtr list); 00513 XSLTPUBFUN int XSLTCALL 00514 xsltPointerListAddSize (xsltPointerListPtr list, 00515 void *item, 00516 int initialSize); 00517 00518 /************************************************************************ 00519 * * 00520 * Refactored structures * 00521 * * 00522 ************************************************************************/ 00523 00524 typedef struct _xsltNsListContainer xsltNsListContainer; 00525 typedef xsltNsListContainer *xsltNsListContainerPtr; 00526 struct _xsltNsListContainer { 00527 xmlNsPtr *list; 00528 int totalNumber; 00529 int xpathNumber; 00530 }; 00531 00541 #define XSLT_ITEM_COMPATIBILITY_FIELDS \ 00542 xsltElemPreCompPtr next;\ 00543 xsltStyleType type;\ 00544 xsltTransformFunction func;\ 00545 xmlNodePtr inst; 00546 00553 #define XSLT_ITEM_NAVIGATION_FIELDS 00554 /* 00555 xsltStylePreCompPtr parent;\ 00556 xsltStylePreCompPtr children;\ 00557 xsltStylePreCompPtr nextItem; 00558 */ 00559 00565 #define XSLT_ITEM_NSINSCOPE_FIELDS xsltNsListContainerPtr inScopeNs; 00566 00572 #define XSLT_ITEM_COMMON_FIELDS \ 00573 XSLT_ITEM_COMPATIBILITY_FIELDS \ 00574 XSLT_ITEM_NAVIGATION_FIELDS \ 00575 XSLT_ITEM_NSINSCOPE_FIELDS 00576 00590 struct _xsltStylePreComp { 00591 xsltElemPreCompPtr next; /* next item in the global chained 00592 list hold by xsltStylesheet */ 00593 xsltStyleType type; /* type of the item */ 00594 xsltTransformFunction func; /* handling function */ 00595 xmlNodePtr inst; /* the node in the stylesheet's tree 00596 corresponding to this item. */ 00597 /* Currently no navigational fields. */ 00598 xsltNsListContainerPtr inScopeNs; 00599 }; 00600 00609 typedef struct _xsltStyleBasicEmptyItem xsltStyleBasicEmptyItem; 00610 typedef xsltStyleBasicEmptyItem *xsltStyleBasicEmptyItemPtr; 00611 00612 struct _xsltStyleBasicEmptyItem { 00613 XSLT_ITEM_COMMON_FIELDS 00614 }; 00615 00622 typedef struct _xsltStyleBasicExpressionItem xsltStyleBasicExpressionItem; 00623 typedef xsltStyleBasicExpressionItem *xsltStyleBasicExpressionItemPtr; 00624 00625 struct _xsltStyleBasicExpressionItem { 00626 XSLT_ITEM_COMMON_FIELDS 00627 00628 const xmlChar *select; /* TODO: Change this to "expression". */ 00629 xmlXPathCompExprPtr comp; /* TODO: Change this to compExpr. */ 00630 }; 00631 00632 /************************************************************************ 00633 * * 00634 * XSLT-instructions/declarations * 00635 * * 00636 ************************************************************************/ 00637 00649 typedef struct _xsltStyleItemElement xsltStyleItemElement; 00650 typedef xsltStyleItemElement *xsltStyleItemElementPtr; 00651 00652 struct _xsltStyleItemElement { 00653 XSLT_ITEM_COMMON_FIELDS 00654 00655 const xmlChar *use; 00656 int has_use; 00657 const xmlChar *name; 00658 int has_name; 00659 const xmlChar *ns; 00660 const xmlChar *nsPrefix; 00661 int has_ns; 00662 }; 00663 00674 typedef struct _xsltStyleItemAttribute xsltStyleItemAttribute; 00675 typedef xsltStyleItemAttribute *xsltStyleItemAttributePtr; 00676 00677 struct _xsltStyleItemAttribute { 00678 XSLT_ITEM_COMMON_FIELDS 00679 const xmlChar *name; 00680 int has_name; 00681 const xmlChar *ns; 00682 const xmlChar *nsPrefix; 00683 int has_ns; 00684 }; 00685 00695 typedef struct _xsltStyleItemText xsltStyleItemText; 00696 typedef xsltStyleItemText *xsltStyleItemTextPtr; 00697 00698 struct _xsltStyleItemText { 00699 XSLT_ITEM_COMMON_FIELDS 00700 int noescape; /* text */ 00701 }; 00702 00711 typedef xsltStyleBasicEmptyItem xsltStyleItemComment; 00712 typedef xsltStyleItemComment *xsltStyleItemCommentPtr; 00713 00723 typedef struct _xsltStyleItemPI xsltStyleItemPI; 00724 typedef xsltStyleItemPI *xsltStyleItemPIPtr; 00725 00726 struct _xsltStyleItemPI { 00727 XSLT_ITEM_COMMON_FIELDS 00728 const xmlChar *name; 00729 int has_name; 00730 }; 00731 00738 typedef xsltStyleBasicEmptyItem xsltStyleItemApplyImports; 00739 typedef xsltStyleItemApplyImports *xsltStyleItemApplyImportsPtr; 00740 00751 typedef struct _xsltStyleItemApplyTemplates xsltStyleItemApplyTemplates; 00752 typedef xsltStyleItemApplyTemplates *xsltStyleItemApplyTemplatesPtr; 00753 00754 struct _xsltStyleItemApplyTemplates { 00755 XSLT_ITEM_COMMON_FIELDS 00756 00757 const xmlChar *mode; /* apply-templates */ 00758 const xmlChar *modeURI; /* apply-templates */ 00759 const xmlChar *select; /* sort, copy-of, value-of, apply-templates */ 00760 xmlXPathCompExprPtr comp; /* a precompiled XPath expression */ 00761 /* TODO: with-params */ 00762 }; 00763 00773 typedef struct _xsltStyleItemCallTemplate xsltStyleItemCallTemplate; 00774 typedef xsltStyleItemCallTemplate *xsltStyleItemCallTemplatePtr; 00775 00776 struct _xsltStyleItemCallTemplate { 00777 XSLT_ITEM_COMMON_FIELDS 00778 00779 xsltTemplatePtr templ; /* call-template */ 00780 const xmlChar *name; /* element, attribute, pi */ 00781 int has_name; /* element, attribute, pi */ 00782 const xmlChar *ns; /* element */ 00783 int has_ns; /* element */ 00784 /* TODO: with-params */ 00785 }; 00786 00796 typedef struct _xsltStyleItemCopy xsltStyleItemCopy; 00797 typedef xsltStyleItemCopy *xsltStyleItemCopyPtr; 00798 00799 struct _xsltStyleItemCopy { 00800 XSLT_ITEM_COMMON_FIELDS 00801 const xmlChar *use; /* copy, element */ 00802 int has_use; /* copy, element */ 00803 }; 00804 00814 typedef struct _xsltStyleItemIf xsltStyleItemIf; 00815 typedef xsltStyleItemIf *xsltStyleItemIfPtr; 00816 00817 struct _xsltStyleItemIf { 00818 XSLT_ITEM_COMMON_FIELDS 00819 00820 const xmlChar *test; /* if */ 00821 xmlXPathCompExprPtr comp; /* a precompiled XPath expression */ 00822 }; 00823 00824 00832 typedef xsltStyleBasicExpressionItem xsltStyleItemCopyOf; 00833 typedef xsltStyleItemCopyOf *xsltStyleItemCopyOfPtr; 00834 00843 typedef struct _xsltStyleItemValueOf xsltStyleItemValueOf; 00844 typedef xsltStyleItemValueOf *xsltStyleItemValueOfPtr; 00845 00846 struct _xsltStyleItemValueOf { 00847 XSLT_ITEM_COMMON_FIELDS 00848 00849 const xmlChar *select; 00850 xmlXPathCompExprPtr comp; /* a precompiled XPath expression */ 00851 int noescape; 00852 }; 00853 00869 typedef struct _xsltStyleItemNumber xsltStyleItemNumber; 00870 typedef xsltStyleItemNumber *xsltStyleItemNumberPtr; 00871 00872 struct _xsltStyleItemNumber { 00873 XSLT_ITEM_COMMON_FIELDS 00874 xsltNumberData numdata; /* number */ 00875 }; 00876 00885 typedef xsltStyleBasicEmptyItem xsltStyleItemChoose; 00886 typedef xsltStyleItemChoose *xsltStyleItemChoosePtr; 00887 00896 typedef xsltStyleBasicEmptyItem xsltStyleItemFallback; 00897 typedef xsltStyleItemFallback *xsltStyleItemFallbackPtr; 00898 00908 typedef xsltStyleBasicExpressionItem xsltStyleItemForEach; 00909 typedef xsltStyleItemForEach *xsltStyleItemForEachPtr; 00910 00920 typedef struct _xsltStyleItemMessage xsltStyleItemMessage; 00921 typedef xsltStyleItemMessage *xsltStyleItemMessagePtr; 00922 00923 struct _xsltStyleItemMessage { 00924 XSLT_ITEM_COMMON_FIELDS 00925 int terminate; 00926 }; 00927 00933 typedef struct _xsltStyleItemDocument xsltStyleItemDocument; 00934 typedef xsltStyleItemDocument *xsltStyleItemDocumentPtr; 00935 00936 struct _xsltStyleItemDocument { 00937 XSLT_ITEM_COMMON_FIELDS 00938 int ver11; /* assigned: in xsltDocumentComp; 00939 read: nowhere; 00940 TODO: Check if we need. */ 00941 const xmlChar *filename; /* document URL */ 00942 int has_filename; 00943 }; 00944 00945 /************************************************************************ 00946 * * 00947 * Non-instructions (actually properties of instructions/declarations) * 00948 * * 00949 ************************************************************************/ 00950 00963 typedef struct _xsltStyleBasicItemVariable xsltStyleBasicItemVariable; 00964 typedef xsltStyleBasicItemVariable *xsltStyleBasicItemVariablePtr; 00965 00966 struct _xsltStyleBasicItemVariable { 00967 XSLT_ITEM_COMMON_FIELDS 00968 00969 const xmlChar *select; 00970 xmlXPathCompExprPtr comp; 00971 00972 const xmlChar *name; 00973 int has_name; 00974 const xmlChar *ns; 00975 int has_ns; 00976 }; 00977 00988 typedef xsltStyleBasicItemVariable xsltStyleItemVariable; 00989 typedef xsltStyleItemVariable *xsltStyleItemVariablePtr; 00990 01001 typedef struct _xsltStyleItemParam xsltStyleItemParam; 01002 typedef xsltStyleItemParam *xsltStyleItemParamPtr; 01003 01004 struct _xsltStyleItemParam { 01005 XSLT_ITEM_COMMON_FIELDS 01006 01007 const xmlChar *select; 01008 xmlXPathCompExprPtr comp; 01009 01010 const xmlChar *name; 01011 int has_name; 01012 const xmlChar *ns; 01013 int has_ns; 01014 }; 01015 01025 typedef xsltStyleBasicItemVariable xsltStyleItemWithParam; 01026 typedef xsltStyleItemWithParam *xsltStyleItemWithParamPtr; 01027 01040 typedef struct _xsltStyleItemSort xsltStyleItemSort; 01041 typedef xsltStyleItemSort *xsltStyleItemSortPtr; 01042 01043 struct _xsltStyleItemSort { 01044 XSLT_ITEM_COMMON_FIELDS 01045 01046 const xmlChar *stype; /* sort */ 01047 int has_stype; /* sort */ 01048 int number; /* sort */ 01049 const xmlChar *order; /* sort */ 01050 int has_order; /* sort */ 01051 int descending; /* sort */ 01052 const xmlChar *lang; /* sort */ 01053 int has_lang; /* sort */ 01054 xsltLocale locale; /* sort */ 01055 const xmlChar *case_order; /* sort */ 01056 int lower_first; /* sort */ 01057 01058 const xmlChar *use; 01059 int has_use; 01060 01061 const xmlChar *select; /* sort, copy-of, value-of, apply-templates */ 01062 01063 xmlXPathCompExprPtr comp; /* a precompiled XPath expression */ 01064 }; 01065 01066 01076 typedef struct _xsltStyleItemWhen xsltStyleItemWhen; 01077 typedef xsltStyleItemWhen *xsltStyleItemWhenPtr; 01078 01079 struct _xsltStyleItemWhen { 01080 XSLT_ITEM_COMMON_FIELDS 01081 01082 const xmlChar *test; 01083 xmlXPathCompExprPtr comp; 01084 }; 01085 01094 typedef struct _xsltStyleItemOtherwise xsltStyleItemOtherwise; 01095 typedef xsltStyleItemOtherwise *xsltStyleItemOtherwisePtr; 01096 01097 struct _xsltStyleItemOtherwise { 01098 XSLT_ITEM_COMMON_FIELDS 01099 }; 01100 01101 typedef struct _xsltStyleItemInclude xsltStyleItemInclude; 01102 typedef xsltStyleItemInclude *xsltStyleItemIncludePtr; 01103 01104 struct _xsltStyleItemInclude { 01105 XSLT_ITEM_COMMON_FIELDS 01106 xsltDocumentPtr include; 01107 }; 01108 01109 /************************************************************************ 01110 * * 01111 * XSLT elements in forwards-compatible mode * 01112 * * 01113 ************************************************************************/ 01114 01115 typedef struct _xsltStyleItemUknown xsltStyleItemUknown; 01116 typedef xsltStyleItemUknown *xsltStyleItemUknownPtr; 01117 struct _xsltStyleItemUknown { 01118 XSLT_ITEM_COMMON_FIELDS 01119 }; 01120 01121 01122 /************************************************************************ 01123 * * 01124 * Extension elements * 01125 * * 01126 ************************************************************************/ 01127 01128 /* 01129 * xsltStyleItemExtElement: 01130 * 01131 * Reflects extension elements. 01132 * 01133 * NOTE: Due to the fact that the structure xsltElemPreComp is most 01134 * probably already heavily in use out there by users, so we cannot 01135 * easily change it, we'll create an intermediate structure which will 01136 * hold an xsltElemPreCompPtr. 01137 * BIG NOTE: The only problem I see here is that the user processes the 01138 * content of the stylesheet tree, possibly he'll lookup the node->psvi 01139 * fields in order to find subsequent extension functions. 01140 * In this case, the user's code will break, since the node->psvi 01141 * field will hold now the xsltStyleItemExtElementPtr and not 01142 * the xsltElemPreCompPtr. 01143 * However the place where the structure is anchored in the node-tree, 01144 * namely node->psvi, has beed already once been moved from node->_private 01145 * to node->psvi, so we have a precedent here, which, I think, should allow 01146 * us to change such semantics without headaches. 01147 */ 01148 typedef struct _xsltStyleItemExtElement xsltStyleItemExtElement; 01149 typedef xsltStyleItemExtElement *xsltStyleItemExtElementPtr; 01150 struct _xsltStyleItemExtElement { 01151 XSLT_ITEM_COMMON_FIELDS 01152 xsltElemPreCompPtr item; 01153 }; 01154 01155 /************************************************************************ 01156 * * 01157 * Literal result elements * 01158 * * 01159 ************************************************************************/ 01160 01161 typedef struct _xsltEffectiveNs xsltEffectiveNs; 01162 typedef xsltEffectiveNs *xsltEffectiveNsPtr; 01163 struct _xsltEffectiveNs { 01164 xsltEffectiveNsPtr nextInStore; /* storage next */ 01165 xsltEffectiveNsPtr next; /* next item in the list */ 01166 const xmlChar *prefix; 01167 const xmlChar *nsName; 01168 /* 01169 * Indicates if eclared on the literal result element; dunno if really 01170 * needed. 01171 */ 01172 int holdByElem; 01173 }; 01174 01175 /* 01176 * Info for literal result elements. 01177 * This will be set on the elem->psvi field and will be 01178 * shared by literal result elements, which have the same 01179 * excluded result namespaces; i.e., this *won't* be created uniquely 01180 * for every literal result element. 01181 */ 01182 typedef struct _xsltStyleItemLRElementInfo xsltStyleItemLRElementInfo; 01183 typedef xsltStyleItemLRElementInfo *xsltStyleItemLRElementInfoPtr; 01184 struct _xsltStyleItemLRElementInfo { 01185 XSLT_ITEM_COMMON_FIELDS 01186 /* 01187 * @effectiveNs is the set of effective ns-nodes 01188 * on the literal result element, which will be added to the result 01189 * element if not already existing in the result tree. 01190 * This means that excluded namespaces (via exclude-result-prefixes, 01191 * extension-element-prefixes and the XSLT namespace) not added 01192 * to the set. 01193 * Namespace-aliasing was applied on the @effectiveNs. 01194 */ 01195 xsltEffectiveNsPtr effectiveNs; 01196 01197 }; 01198 01199 #ifdef XSLT_REFACTORED 01200 01201 typedef struct _xsltNsAlias xsltNsAlias; 01202 typedef xsltNsAlias *xsltNsAliasPtr; 01203 struct _xsltNsAlias { 01204 xsltNsAliasPtr next; /* next in the list */ 01205 xmlNsPtr literalNs; 01206 xmlNsPtr targetNs; 01207 xmlDocPtr docOfTargetNs; 01208 }; 01209 #endif 01210 01211 #ifdef XSLT_REFACTORED_XSLT_NSCOMP 01212 01213 typedef struct _xsltNsMap xsltNsMap; 01214 typedef xsltNsMap *xsltNsMapPtr; 01215 struct _xsltNsMap { 01216 xsltNsMapPtr next; /* next in the list */ 01217 xmlDocPtr doc; 01218 xmlNodePtr elem; /* the element holding the ns-decl */ 01219 xmlNsPtr ns; /* the xmlNs structure holding the XML namespace name */ 01220 const xmlChar *origNsName; /* the original XML namespace name */ 01221 const xmlChar *newNsName; /* the mapped XML namespace name */ 01222 }; 01223 #endif 01224 01225 /************************************************************************ 01226 * * 01227 * Compile-time structures for *internal* use only * 01228 * * 01229 ************************************************************************/ 01230 01231 typedef struct _xsltPrincipalStylesheetData xsltPrincipalStylesheetData; 01232 typedef xsltPrincipalStylesheetData *xsltPrincipalStylesheetDataPtr; 01233 01234 typedef struct _xsltNsList xsltNsList; 01235 typedef xsltNsList *xsltNsListPtr; 01236 struct _xsltNsList { 01237 xsltNsListPtr next; /* next in the list */ 01238 xmlNsPtr ns; 01239 }; 01240 01241 /* 01242 * xsltVarInfo: 01243 * 01244 * Used at compilation time for parameters and variables. 01245 */ 01246 typedef struct _xsltVarInfo xsltVarInfo; 01247 typedef xsltVarInfo *xsltVarInfoPtr; 01248 struct _xsltVarInfo { 01249 xsltVarInfoPtr next; /* next in the list */ 01250 xsltVarInfoPtr prev; 01251 int depth; /* the depth in the tree */ 01252 const xmlChar *name; 01253 const xmlChar *nsName; 01254 }; 01255 01261 typedef struct _xsltCompilerNodeInfo xsltCompilerNodeInfo; 01262 typedef xsltCompilerNodeInfo *xsltCompilerNodeInfoPtr; 01263 struct _xsltCompilerNodeInfo { 01264 xsltCompilerNodeInfoPtr next; 01265 xsltCompilerNodeInfoPtr prev; 01266 xmlNodePtr node; 01267 int depth; 01268 xsltTemplatePtr templ; /* The owning template */ 01269 int category; /* XSLT element, LR-element or 01270 extension element */ 01271 xsltStyleType type; 01272 xsltElemPreCompPtr item; /* The compiled information */ 01273 /* The current in-scope namespaces */ 01274 xsltNsListContainerPtr inScopeNs; 01275 /* The current excluded result namespaces */ 01276 xsltPointerListPtr exclResultNs; 01277 /* The current extension instruction namespaces */ 01278 xsltPointerListPtr extElemNs; 01279 01280 /* The current info for literal result elements. */ 01281 xsltStyleItemLRElementInfoPtr litResElemInfo; 01282 /* 01283 * Set to 1 if in-scope namespaces changed, 01284 * or excluded result namespaces changed, 01285 * or extension element namespaces changed. 01286 * This will trigger creation of new infos 01287 * for literal result elements. 01288 */ 01289 int nsChanged; 01290 int preserveWhitespace; 01291 int stripWhitespace; 01292 int isRoot; /* whether this is the stylesheet's root node */ 01293 int forwardsCompat; /* whether forwards-compatible mode is enabled */ 01294 /* whether the content of an extension element was processed */ 01295 int extContentHandled; 01296 /* the type of the current child */ 01297 xsltStyleType curChildType; 01298 }; 01299 01305 #define XSLT_CCTXT(style) ((xsltCompilerCtxtPtr) style->compCtxt) 01306 01307 typedef enum { 01308 XSLT_ERROR_SEVERITY_ERROR = 0, 01309 XSLT_ERROR_SEVERITY_WARNING 01310 } xsltErrorSeverityType; 01311 01312 typedef struct _xsltCompilerCtxt xsltCompilerCtxt; 01313 typedef xsltCompilerCtxt *xsltCompilerCtxtPtr; 01314 struct _xsltCompilerCtxt { 01315 void *errorCtxt; /* user specific error context */ 01316 /* 01317 * used for error/warning reports; e.g. XSLT_ERROR_SEVERITY_WARNING */ 01318 xsltErrorSeverityType errSeverity; 01319 int warnings; /* TODO: number of warnings found at 01320 compilation */ 01321 int errors; /* TODO: number of errors found at 01322 compilation */ 01323 xmlDictPtr dict; 01324 xsltStylesheetPtr style; 01325 int simplified; /* whether this is a simplified stylesheet */ 01326 /* TODO: structured/unstructured error contexts. */ 01327 int depth; /* Current depth of processing */ 01328 01329 xsltCompilerNodeInfoPtr inode; 01330 xsltCompilerNodeInfoPtr inodeList; 01331 xsltCompilerNodeInfoPtr inodeLast; 01332 xsltPointerListPtr tmpList; /* Used for various purposes */ 01333 /* 01334 * The XSLT version as specified by the stylesheet's root element. 01335 */ 01336 int isInclude; 01337 int hasForwardsCompat; /* whether forwards-compatible mode was used 01338 in a parsing episode */ 01339 int maxNodeInfos; /* TEMP TODO: just for the interest */ 01340 int maxLREs; /* TEMP TODO: just for the interest */ 01341 /* 01342 * In order to keep the old behaviour, applying strict rules of 01343 * the spec can be turned off. This has effect only on special 01344 * mechanisms like whitespace-stripping in the stylesheet. 01345 */ 01346 int strict; 01347 xsltPrincipalStylesheetDataPtr psData; 01348 #ifdef XSLT_REFACTORED_XPATHCOMP 01349 xmlXPathContextPtr xpathCtxt; 01350 #endif 01351 xsltStyleItemUknownPtr unknownItem; 01352 int hasNsAliases; /* Indicator if there was an xsl:namespace-alias. */ 01353 xsltNsAliasPtr nsAliases; 01354 xsltVarInfoPtr ivars; /* Storage of local in-scope variables/params. */ 01355 xsltVarInfoPtr ivar; /* topmost local variable/param. */ 01356 }; 01357 01358 #else /* XSLT_REFACTORED */ 01359 /* 01360 * The old structures before refactoring. 01361 */ 01362 01369 struct _xsltStylePreComp { 01370 xsltElemPreCompPtr next; /* chained list */ 01371 xsltStyleType type; /* type of the element */ 01372 xsltTransformFunction func; /* handling function */ 01373 xmlNodePtr inst; /* the instruction */ 01374 01375 /* 01376 * Pre computed values. 01377 */ 01378 01379 const xmlChar *stype; /* sort */ 01380 int has_stype; /* sort */ 01381 int number; /* sort */ 01382 const xmlChar *order; /* sort */ 01383 int has_order; /* sort */ 01384 int descending; /* sort */ 01385 const xmlChar *lang; /* sort */ 01386 int has_lang; /* sort */ 01387 xsltLocale locale; /* sort */ 01388 const xmlChar *case_order; /* sort */ 01389 int lower_first; /* sort */ 01390 01391 const xmlChar *use; /* copy, element */ 01392 int has_use; /* copy, element */ 01393 01394 int noescape; /* text */ 01395 01396 const xmlChar *name; /* element, attribute, pi */ 01397 int has_name; /* element, attribute, pi */ 01398 const xmlChar *ns; /* element */ 01399 int has_ns; /* element */ 01400 01401 const xmlChar *mode; /* apply-templates */ 01402 const xmlChar *modeURI; /* apply-templates */ 01403 01404 const xmlChar *test; /* if */ 01405 01406 xsltTemplatePtr templ; /* call-template */ 01407 01408 const xmlChar *select; /* sort, copy-of, value-of, apply-templates */ 01409 01410 int ver11; /* document */ 01411 const xmlChar *filename; /* document URL */ 01412 int has_filename; /* document */ 01413 01414 xsltNumberData numdata; /* number */ 01415 01416 xmlXPathCompExprPtr comp; /* a precompiled XPath expression */ 01417 xmlNsPtr *nsList; /* the namespaces in scope */ 01418 int nsNr; /* the number of namespaces in scope */ 01419 }; 01420 01421 #endif /* XSLT_REFACTORED */ 01422 01423 01424 /* 01425 * The in-memory structure corresponding to an XSLT Variable 01426 * or Param. 01427 */ 01428 typedef struct _xsltStackElem xsltStackElem; 01429 typedef xsltStackElem *xsltStackElemPtr; 01430 struct _xsltStackElem { 01431 struct _xsltStackElem *next;/* chained list */ 01432 xsltStylePreCompPtr comp; /* the compiled form */ 01433 int computed; /* was the evaluation done */ 01434 const xmlChar *name; /* the local part of the name QName */ 01435 const xmlChar *nameURI; /* the URI part of the name QName */ 01436 const xmlChar *select; /* the eval string */ 01437 xmlNodePtr tree; /* the sequence constructor if no eval 01438 string or the location */ 01439 xmlXPathObjectPtr value; /* The value if computed */ 01440 xmlDocPtr fragment; /* The Result Tree Fragments (needed for XSLT 1.0) 01441 which are bound to the variable's lifetime. */ 01442 int level; /* the depth in the tree; 01443 -1 if persistent (e.g. a given xsl:with-param) */ 01444 xsltTransformContextPtr context; /* The transformation context; needed to cache 01445 the variables */ 01446 int flags; 01447 }; 01448 01449 #ifdef XSLT_REFACTORED 01450 01451 struct _xsltPrincipalStylesheetData { 01452 /* 01453 * Namespace dictionary for ns-prefixes and ns-names: 01454 * TODO: Shared between stylesheets, and XPath mechanisms. 01455 * Not used yet. 01456 */ 01457 xmlDictPtr namespaceDict; 01458 /* 01459 * Global list of in-scope namespaces. 01460 */ 01461 xsltPointerListPtr inScopeNamespaces; 01462 /* 01463 * Global list of information for [xsl:]excluded-result-prefixes. 01464 */ 01465 xsltPointerListPtr exclResultNamespaces; 01466 /* 01467 * Global list of information for [xsl:]extension-element-prefixes. 01468 */ 01469 xsltPointerListPtr extElemNamespaces; 01470 xsltEffectiveNsPtr effectiveNs; 01471 #ifdef XSLT_REFACTORED_XSLT_NSCOMP 01472 /* 01473 * Namespace name map to get rid of string comparison of namespace names. 01474 */ 01475 xsltNsMapPtr nsMap; 01476 #endif 01477 }; 01478 01479 01480 #endif 01481 /* 01482 * Note that we added a @compCtxt field to anchor an stylesheet compilation 01483 * context, since, due to historical reasons, various compile-time function 01484 * take only the stylesheet as argument and not a compilation context. 01485 */ 01486 struct _xsltStylesheet { 01487 /* 01488 * The stylesheet import relation is kept as a tree. 01489 */ 01490 struct _xsltStylesheet *parent; 01491 struct _xsltStylesheet *next; 01492 struct _xsltStylesheet *imports; 01493 01494 xsltDocumentPtr docList; /* the include document list */ 01495 01496 /* 01497 * General data on the style sheet document. 01498 */ 01499 xmlDocPtr doc; /* the parsed XML stylesheet */ 01500 xmlHashTablePtr stripSpaces;/* the hash table of the strip-space and 01501 preserve space elements */ 01502 int stripAll; /* strip-space * (1) preserve-space * (-1) */ 01503 xmlHashTablePtr cdataSection;/* the hash table of the cdata-section */ 01504 01505 /* 01506 * Global variable or parameters. 01507 */ 01508 xsltStackElemPtr variables; /* linked list of param and variables */ 01509 01510 /* 01511 * Template descriptions. 01512 */ 01513 xsltTemplatePtr templates; /* the ordered list of templates */ 01514 void *templatesHash; /* hash table or wherever compiled templates 01515 informations are stored */ 01516 void *rootMatch; /* template based on / */ 01517 void *keyMatch; /* template based on key() */ 01518 void *elemMatch; /* template based on * */ 01519 void *attrMatch; /* template based on @* */ 01520 void *parentMatch; /* template based on .. */ 01521 void *textMatch; /* template based on text() */ 01522 void *piMatch; /* template based on processing-instruction() */ 01523 void *commentMatch; /* template based on comment() */ 01524 01525 /* 01526 * Namespace aliases. 01527 * NOTE: Not used in the refactored code. 01528 */ 01529 xmlHashTablePtr nsAliases; /* the namespace alias hash tables */ 01530 01531 /* 01532 * Attribute sets. 01533 */ 01534 xmlHashTablePtr attributeSets;/* the attribute sets hash tables */ 01535 01536 /* 01537 * Namespaces. 01538 * TODO: Eliminate this. 01539 */ 01540 xmlHashTablePtr nsHash; /* the set of namespaces in use: 01541 ATTENTION: This is used for 01542 execution of XPath expressions; unfortunately 01543 it restricts the stylesheet to have distinct 01544 prefixes. 01545 TODO: We need to get rid of this. 01546 */ 01547 void *nsDefs; /* ATTENTION TODO: This is currently used to store 01548 xsltExtDefPtr (in extensions.c) and 01549 *not* xmlNsPtr. 01550 */ 01551 01552 /* 01553 * Key definitions. 01554 */ 01555 void *keys; /* key definitions */ 01556 01557 /* 01558 * Output related stuff. 01559 */ 01560 xmlChar *method; /* the output method */ 01561 xmlChar *methodURI; /* associated namespace if any */ 01562 xmlChar *version; /* version string */ 01563 xmlChar *encoding; /* encoding string */ 01564 int omitXmlDeclaration; /* omit-xml-declaration = "yes" | "no" */ 01565 01566 /* 01567 * Number formatting. 01568 */ 01569 xsltDecimalFormatPtr decimalFormat; 01570 int standalone; /* standalone = "yes" | "no" */ 01571 xmlChar *doctypePublic; /* doctype-public string */ 01572 xmlChar *doctypeSystem; /* doctype-system string */ 01573 int indent; /* should output being indented */ 01574 xmlChar *mediaType; /* media-type string */ 01575 01576 /* 01577 * Precomputed blocks. 01578 */ 01579 xsltElemPreCompPtr preComps;/* list of precomputed blocks */ 01580 int warnings; /* number of warnings found at compilation */ 01581 int errors; /* number of errors found at compilation */ 01582 01583 xmlChar *exclPrefix; /* last excluded prefixes */ 01584 xmlChar **exclPrefixTab; /* array of excluded prefixes */ 01585 int exclPrefixNr; /* number of excluded prefixes in scope */ 01586 int exclPrefixMax; /* size of the array */ 01587 01588 void *_private; /* user defined data */ 01589 01590 /* 01591 * Extensions. 01592 */ 01593 xmlHashTablePtr extInfos; /* the extension data */ 01594 int extrasNr; /* the number of extras required */ 01595 01596 /* 01597 * For keeping track of nested includes 01598 */ 01599 xsltDocumentPtr includes; /* points to last nested include */ 01600 01601 /* 01602 * dictionary: shared between stylesheet, context and documents. 01603 */ 01604 xmlDictPtr dict; 01605 /* 01606 * precompiled attribute value templates. 01607 */ 01608 void *attVTs; 01609 /* 01610 * if namespace-alias has an alias for the default stylesheet prefix 01611 * NOTE: Not used in the refactored code. 01612 */ 01613 const xmlChar *defaultAlias; 01614 /* 01615 * bypass pre-processing (already done) (used in imports) 01616 */ 01617 int nopreproc; 01618 /* 01619 * all document text strings were internalized 01620 */ 01621 int internalized; 01622 /* 01623 * Literal Result Element as Stylesheet c.f. section 2.3 01624 */ 01625 int literal_result; 01626 /* 01627 * The principal stylesheet 01628 */ 01629 xsltStylesheetPtr principal; 01630 #ifdef XSLT_REFACTORED 01631 /* 01632 * Compilation context used during compile-time. 01633 */ 01634 xsltCompilerCtxtPtr compCtxt; /* TODO: Change this to (void *). */ 01635 01636 xsltPrincipalStylesheetDataPtr principalData; 01637 #endif 01638 }; 01639 01640 typedef struct _xsltTransformCache xsltTransformCache; 01641 typedef xsltTransformCache *xsltTransformCachePtr; 01642 struct _xsltTransformCache { 01643 xmlDocPtr RVT; 01644 int nbRVT; 01645 xsltStackElemPtr stackItems; 01646 int nbStackItems; 01647 #ifdef XSLT_DEBUG_PROFILE_CACHE 01648 int dbgCachedRVTs; 01649 int dbgReusedRVTs; 01650 int dbgCachedVars; 01651 int dbgReusedVars; 01652 #endif 01653 }; 01654 01655 /* 01656 * The in-memory structure corresponding to an XSLT Transformation. 01657 */ 01658 typedef enum { 01659 XSLT_OUTPUT_XML = 0, 01660 XSLT_OUTPUT_HTML, 01661 XSLT_OUTPUT_TEXT 01662 } xsltOutputType; 01663 01664 typedef enum { 01665 XSLT_STATE_OK = 0, 01666 XSLT_STATE_ERROR, 01667 XSLT_STATE_STOPPED 01668 } xsltTransformState; 01669 01670 struct _xsltTransformContext { 01671 xsltStylesheetPtr style; /* the stylesheet used */ 01672 xsltOutputType type; /* the type of output */ 01673 01674 xsltTemplatePtr templ; /* the current template */ 01675 int templNr; /* Nb of templates in the stack */ 01676 int templMax; /* Size of the templtes stack */ 01677 xsltTemplatePtr *templTab; /* the template stack */ 01678 01679 xsltStackElemPtr vars; /* the current variable list */ 01680 int varsNr; /* Nb of variable list in the stack */ 01681 int varsMax; /* Size of the variable list stack */ 01682 xsltStackElemPtr *varsTab; /* the variable list stack */ 01683 int varsBase; /* the var base for current templ */ 01684 01685 /* 01686 * Extensions 01687 */ 01688 xmlHashTablePtr extFunctions; /* the extension functions */ 01689 xmlHashTablePtr extElements; /* the extension elements */ 01690 xmlHashTablePtr extInfos; /* the extension data */ 01691 01692 const xmlChar *mode; /* the current mode */ 01693 const xmlChar *modeURI; /* the current mode URI */ 01694 01695 xsltDocumentPtr docList; /* the document list */ 01696 01697 xsltDocumentPtr document; /* the current source document; can be NULL if an RTF */ 01698 xmlNodePtr node; /* the current node being processed */ 01699 xmlNodeSetPtr nodeList; /* the current node list */ 01700 /* xmlNodePtr current; the node */ 01701 01702 xmlDocPtr output; /* the resulting document */ 01703 xmlNodePtr insert; /* the insertion node */ 01704 01705 xmlXPathContextPtr xpathCtxt; /* the XPath context */ 01706 xsltTransformState state; /* the current state */ 01707 01708 /* 01709 * Global variables 01710 */ 01711 xmlHashTablePtr globalVars; /* the global variables and params */ 01712 01713 xmlNodePtr inst; /* the instruction in the stylesheet */ 01714 01715 int xinclude; /* should XInclude be processed */ 01716 01717 const char * outputFile; /* the output URI if known */ 01718 01719 int profile; /* is this run profiled */ 01720 long prof; /* the current profiled value */ 01721 int profNr; /* Nb of templates in the stack */ 01722 int profMax; /* Size of the templtaes stack */ 01723 long *profTab; /* the profile template stack */ 01724 01725 void *_private; /* user defined data */ 01726 01727 int extrasNr; /* the number of extras used */ 01728 int extrasMax; /* the number of extras allocated */ 01729 xsltRuntimeExtraPtr extras; /* extra per runtime informations */ 01730 01731 xsltDocumentPtr styleList; /* the stylesheet docs list */ 01732 void * sec; /* the security preferences if any */ 01733 01734 xmlGenericErrorFunc error; /* a specific error handler */ 01735 void * errctx; /* context for the error handler */ 01736 01737 xsltSortFunc sortfunc; /* a ctxt specific sort routine */ 01738 01739 /* 01740 * handling of temporary Result Value Tree 01741 * (XSLT 1.0 term: "Result Tree Fragment") 01742 */ 01743 xmlDocPtr tmpRVT; /* list of RVT without persistance */ 01744 xmlDocPtr persistRVT; /* list of persistant RVTs */ 01745 int ctxtflags; /* context processing flags */ 01746 01747 /* 01748 * Speed optimization when coalescing text nodes 01749 */ 01750 const xmlChar *lasttext; /* last text node content */ 01751 unsigned int lasttsize; /* last text node size */ 01752 unsigned int lasttuse; /* last text node use */ 01753 /* 01754 * Per Context Debugging 01755 */ 01756 int debugStatus; /* the context level debug status */ 01757 unsigned long* traceCode; /* pointer to the variable holding the mask */ 01758 01759 int parserOptions; /* parser options xmlParserOption */ 01760 01761 /* 01762 * dictionary: shared between stylesheet, context and documents. 01763 */ 01764 xmlDictPtr dict; 01765 xmlDocPtr tmpDoc; /* Obsolete; not used in the library. */ 01766 /* 01767 * all document text strings are internalized 01768 */ 01769 int internalized; 01770 int nbKeys; 01771 int hasTemplKeyPatterns; 01772 xsltTemplatePtr currentTemplateRule; /* the Current Template Rule */ 01773 xmlNodePtr initialContextNode; 01774 xmlDocPtr initialContextDoc; 01775 xsltTransformCachePtr cache; 01776 void *contextVariable; /* the current variable item */ 01777 xmlDocPtr localRVT; /* list of local tree fragments; will be freed when 01778 the instruction which created the fragment 01779 exits */ 01780 xmlDocPtr localRVTBase; 01781 int keyInitLevel; /* Needed to catch recursive keys issues */ 01782 int funcLevel; /* Needed to catch recursive functions issues */ 01783 }; 01784 01791 #define CHECK_STOPPED if (ctxt->state == XSLT_STATE_STOPPED) return; 01792 01799 #define CHECK_STOPPEDE if (ctxt->state == XSLT_STATE_STOPPED) goto error; 01800 01807 #define CHECK_STOPPED0 if (ctxt->state == XSLT_STATE_STOPPED) return(0); 01808 01809 /* 01810 * The macro XML_CAST_FPTR is a hack to avoid a gcc warning about 01811 * possible incompatibilities between function pointers and object 01812 * pointers. It is defined in libxml/hash.h within recent versions 01813 * of libxml2, but is put here for compatibility. 01814 */ 01815 #ifndef XML_CAST_FPTR 01816 01829 #define XML_CAST_FPTR(fptr) fptr 01830 #endif 01831 /* 01832 * Functions associated to the internal types 01833 xsltDecimalFormatPtr xsltDecimalFormatGetByName(xsltStylesheetPtr sheet, 01834 xmlChar *name); 01835 */ 01836 XSLTPUBFUN xsltStylesheetPtr XSLTCALL 01837 xsltNewStylesheet (void); 01838 XSLTPUBFUN xsltStylesheetPtr XSLTCALL 01839 xsltParseStylesheetFile (const xmlChar* filename); 01840 XSLTPUBFUN void XSLTCALL 01841 xsltFreeStylesheet (xsltStylesheetPtr style); 01842 XSLTPUBFUN int XSLTCALL 01843 xsltIsBlank (xmlChar *str); 01844 XSLTPUBFUN void XSLTCALL 01845 xsltFreeStackElemList (xsltStackElemPtr elem); 01846 XSLTPUBFUN xsltDecimalFormatPtr XSLTCALL 01847 xsltDecimalFormatGetByName(xsltStylesheetPtr style, 01848 xmlChar *name); 01849 01850 XSLTPUBFUN xsltStylesheetPtr XSLTCALL 01851 xsltParseStylesheetProcess(xsltStylesheetPtr ret, 01852 xmlDocPtr doc); 01853 XSLTPUBFUN void XSLTCALL 01854 xsltParseStylesheetOutput(xsltStylesheetPtr style, 01855 xmlNodePtr cur); 01856 XSLTPUBFUN xsltStylesheetPtr XSLTCALL 01857 xsltParseStylesheetDoc (xmlDocPtr doc); 01858 XSLTPUBFUN xsltStylesheetPtr XSLTCALL 01859 xsltParseStylesheetImportedDoc(xmlDocPtr doc, 01860 xsltStylesheetPtr style); 01861 XSLTPUBFUN xsltStylesheetPtr XSLTCALL 01862 xsltLoadStylesheetPI (xmlDocPtr doc); 01863 XSLTPUBFUN void XSLTCALL 01864 xsltNumberFormat (xsltTransformContextPtr ctxt, 01865 xsltNumberDataPtr data, 01866 xmlNodePtr node); 01867 XSLTPUBFUN xmlXPathError XSLTCALL 01868 xsltFormatNumberConversion(xsltDecimalFormatPtr self, 01869 xmlChar *format, 01870 double number, 01871 xmlChar **result); 01872 01873 XSLTPUBFUN void XSLTCALL 01874 xsltParseTemplateContent(xsltStylesheetPtr style, 01875 xmlNodePtr templ); 01876 XSLTPUBFUN int XSLTCALL 01877 xsltAllocateExtra (xsltStylesheetPtr style); 01878 XSLTPUBFUN int XSLTCALL 01879 xsltAllocateExtraCtxt (xsltTransformContextPtr ctxt); 01880 /* 01881 * Extra functions for Result Value Trees 01882 */ 01883 XSLTPUBFUN xmlDocPtr XSLTCALL 01884 xsltCreateRVT (xsltTransformContextPtr ctxt); 01885 XSLTPUBFUN int XSLTCALL 01886 xsltRegisterTmpRVT (xsltTransformContextPtr ctxt, 01887 xmlDocPtr RVT); 01888 XSLTPUBFUN int XSLTCALL 01889 xsltRegisterLocalRVT (xsltTransformContextPtr ctxt, 01890 xmlDocPtr RVT); 01891 XSLTPUBFUN int XSLTCALL 01892 xsltRegisterPersistRVT (xsltTransformContextPtr ctxt, 01893 xmlDocPtr RVT); 01894 XSLTPUBFUN int XSLTCALL 01895 xsltExtensionInstructionResultRegister( 01896 xsltTransformContextPtr ctxt, 01897 xmlXPathObjectPtr obj); 01898 XSLTPUBFUN int XSLTCALL 01899 xsltExtensionInstructionResultFinalize( 01900 xsltTransformContextPtr ctxt); 01901 XSLTPUBFUN void XSLTCALL 01902 xsltFreeRVTs (xsltTransformContextPtr ctxt); 01903 XSLTPUBFUN void XSLTCALL 01904 xsltReleaseRVT (xsltTransformContextPtr ctxt, 01905 xmlDocPtr RVT); 01906 XSLTPUBFUN int XSLTCALL 01907 xsltTransStorageAdd (xsltTransformContextPtr ctxt, 01908 void *id, 01909 void *data); 01910 XSLTPUBFUN void * XSLTCALL 01911 xsltTransStorageRemove (xsltTransformContextPtr ctxt, 01912 void *id); 01913 01914 /* 01915 * Extra functions for Attribute Value Templates 01916 */ 01917 XSLTPUBFUN void XSLTCALL 01918 xsltCompileAttr (xsltStylesheetPtr style, 01919 xmlAttrPtr attr); 01920 XSLTPUBFUN xmlChar * XSLTCALL 01921 xsltEvalAVT (xsltTransformContextPtr ctxt, 01922 void *avt, 01923 xmlNodePtr node); 01924 XSLTPUBFUN void XSLTCALL 01925 xsltFreeAVTList (void *avt); 01926 01927 /* 01928 * Extra function for successful xsltCleanupGlobals / xsltInit sequence. 01929 */ 01930 01931 XSLTPUBFUN void XSLTCALL 01932 xsltUninit (void); 01933 01934 /************************************************************************ 01935 * * 01936 * Compile-time functions for *internal* use only * 01937 * * 01938 ************************************************************************/ 01939 01940 #ifdef XSLT_REFACTORED 01941 XSLTPUBFUN void XSLTCALL 01942 xsltParseSequenceConstructor( 01943 xsltCompilerCtxtPtr cctxt, 01944 xmlNodePtr start); 01945 XSLTPUBFUN int XSLTCALL 01946 xsltParseAnyXSLTElem (xsltCompilerCtxtPtr cctxt, 01947 xmlNodePtr elem); 01948 #ifdef XSLT_REFACTORED_XSLT_NSCOMP 01949 XSLTPUBFUN int XSLTCALL 01950 xsltRestoreDocumentNamespaces( 01951 xsltNsMapPtr ns, 01952 xmlDocPtr doc); 01953 #endif 01954 #endif /* XSLT_REFACTORED */ 01955 01956 /************************************************************************ 01957 * * 01958 * Transformation-time functions for *internal* use only * 01959 * * 01960 ************************************************************************/ 01961 XSLTPUBFUN int XSLTCALL 01962 xsltInitCtxtKey (xsltTransformContextPtr ctxt, 01963 xsltDocumentPtr doc, 01964 xsltKeyDefPtr keyd); 01965 XSLTPUBFUN int XSLTCALL 01966 xsltInitAllDocKeys (xsltTransformContextPtr ctxt); 01967 #ifdef __cplusplus 01968 } 01969 #endif 01970 01971 #endif /* __XML_XSLT_H__ */ 01972