Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > DoxygenxsltInternals.h
Go to the documentation of this file.
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 "numbersInternals.h" 00025 00026 #ifdef __cplusplus 00027 extern "C" { 00028 #endif 00029 00030 /* #define XSLT_DEBUG_PROFILE_CACHE */ 00031 00037 #define XSLT_IS_TEXT_NODE(n) ((n != NULL) && \ 00038 (((n)->type == XML_TEXT_NODE) || \ 00039 ((n)->type == XML_CDATA_SECTION_NODE))) 00040 00041 00047 #define XSLT_MARK_RES_TREE_FRAG(n) \ 00048 (n)->name = (char *) xmlStrdup(BAD_CAST " fake node libxslt"); 00049 00055 #define XSLT_IS_RES_TREE_FRAG(n) \ 00056 ((n != NULL) && ((n)->type == XML_DOCUMENT_NODE) && \ 00057 ((n)->name != NULL) && ((n)->name[0] == ' ')) 00058 00065 #define XSLT_REFACTORED_KEYCOMP 00066 00073 #define XSLT_FAST_IF 00074 00080 /* #define XSLT_REFACTORED */ 00081 /* ==================================================================== */ 00082 00088 #define XSLT_REFACTORED_VARS 00089 00090 #ifdef XSLT_REFACTORED 00091 00092 extern const xmlChar *xsltXSLTAttrMarker; 00093 00094 00095 /* TODO: REMOVE: #define XSLT_REFACTORED_EXCLRESNS */ 00096 00097 /* TODO: REMOVE: #define XSLT_REFACTORED_NSALIAS */ 00098 00105 /* #define XSLT_REFACTORED_XSLT_NSCOMP */ 00106 00113 #define XSLT_REFACTORED_XPATHCOMP 00114 00115 #ifdef XSLT_REFACTORED_XSLT_NSCOMP 00116 00117 extern const xmlChar *xsltConstNamespaceNameXSLT; 00118 00124 #define IS_XSLT_ELEM_FAST(n) \ 00125 (((n) != NULL) && ((n)->ns != NULL) && \ 00126 ((n)->ns->href == xsltConstNamespaceNameXSLT)) 00127 00133 #define IS_XSLT_ATTR_FAST(a) \ 00134 (((a) != NULL) && ((a)->ns != NULL) && \ 00135 ((a)->ns->href == xsltConstNamespaceNameXSLT)) 00136 00142 #define XSLT_HAS_INTERNAL_NSMAP(s) \ 00143 (((s) != NULL) && ((s)->principal) && \ 00144 ((s)->principal->principalData) && \ 00145 ((s)->principal->principalData->nsMap)) 00146 00152 #define XSLT_GET_INTERNAL_NSMAP(s) ((s)->principal->principalData->nsMap) 00153 00154 #else /* XSLT_REFACTORED_XSLT_NSCOMP */ 00155 00161 #define IS_XSLT_ELEM_FAST(n) \ 00162 (((n) != NULL) && ((n)->ns != NULL) && \ 00163 (xmlStrEqual((n)->ns->href, XSLT_NAMESPACE))) 00164 00170 #define IS_XSLT_ATTR_FAST(a) \ 00171 (((a) != NULL) && ((a)->ns != NULL) && \ 00172 (xmlStrEqual((a)->ns->href, XSLT_NAMESPACE))) 00173 00174 00175 #endif /* XSLT_REFACTORED_XSLT_NSCOMP */ 00176 00177 00186 /* #define XSLT_REFACTORED_MANDATORY_VERSION */ 00187 00193 typedef struct _xsltPointerList xsltPointerList; 00194 typedef xsltPointerList *xsltPointerListPtr; 00195 struct _xsltPointerList { 00196 void **items; 00197 int number; 00198 int size; 00199 }; 00200 00201 #endif 00202 00209 /* #define XSLT_REFACTORED_PARSING */ 00210 00216 #define XSLT_MAX_SORT 15 00217 00223 #define XSLT_PAT_NO_PRIORITY -12345789 00224 00230 typedef struct _xsltRuntimeExtra xsltRuntimeExtra; 00231 typedef xsltRuntimeExtra *xsltRuntimeExtraPtr; 00232 struct _xsltRuntimeExtra { 00233 void *info; /* pointer to the extra data */ 00234 xmlFreeFunc deallocate; /* pointer to the deallocation routine */ 00235 union { /* dual-purpose field */ 00236 void *ptr; /* data not needing deallocation */ 00237 int ival; /* integer value storage */ 00238 } val; 00239 }; 00240 00248 #define XSLT_RUNTIME_EXTRA_LST(ctxt, nr) (ctxt)->extras[(nr)].info 00249 00256 #define XSLT_RUNTIME_EXTRA_FREE(ctxt, nr) (ctxt)->extras[(nr)].deallocate 00257 00264 #define XSLT_RUNTIME_EXTRA(ctxt, nr, typ) (ctxt)->extras[(nr)].val.typ 00265 00271 typedef struct _xsltTemplate xsltTemplate; 00272 typedef xsltTemplate *xsltTemplatePtr; 00273 struct _xsltTemplate { 00274 struct _xsltTemplate *next;/* chained list sorted by priority */ 00275 struct _xsltStylesheet *style;/* the containing stylesheet */ 00276 xmlChar *match; /* the matching string */ 00277 float priority; /* as given from the stylesheet, not computed */ 00278 const xmlChar *name; /* the local part of the name QName */ 00279 const xmlChar *nameURI; /* the URI part of the name QName */ 00280 const xmlChar *mode;/* the local part of the mode QName */ 00281 const xmlChar *modeURI;/* the URI part of the mode QName */ 00282 xmlNodePtr content; /* the template replacement value */ 00283 xmlNodePtr elem; /* the source element */ 00284 00285 /* 00286 * TODO: @inheritedNsNr and @inheritedNs won't be used in the 00287 * refactored code. 00288 */ 00289 int inheritedNsNr; /* number of inherited namespaces */ 00290 xmlNsPtr *inheritedNs;/* inherited non-excluded namespaces */ 00291 00292 /* Profiling informations */ 00293 int nbCalls; /* the number of time the template was called */ 00294 unsigned long time; /* the time spent in this template */ 00295 void *params; /* xsl:param instructions */ 00296 }; 00297 00303 typedef struct _xsltDecimalFormat xsltDecimalFormat; 00304 typedef xsltDecimalFormat *xsltDecimalFormatPtr; 00305 struct _xsltDecimalFormat { 00306 struct _xsltDecimalFormat *next; /* chained list */ 00307 xmlChar *name; 00308 /* Used for interpretation of pattern */ 00309 xmlChar *digit; 00310 xmlChar *patternSeparator; 00311 /* May appear in result */ 00312 xmlChar *minusSign; 00313 xmlChar *infinity; 00314 xmlChar *noNumber; /* Not-a-number */ 00315 /* Used for interpretation of pattern and may appear in result */ 00316 xmlChar *decimalPoint; 00317 xmlChar *grouping; 00318 xmlChar *percent; 00319 xmlChar *permille; 00320 xmlChar *zeroDigit; 00321 }; 00322 00328 typedef struct _xsltDocument xsltDocument; 00329 typedef xsltDocument *xsltDocumentPtr; 00330 struct _xsltDocument { 00331 struct _xsltDocument *next; /* documents are kept in a chained list */ 00332 int main; /* is this the main document */ 00333 xmlDocPtr doc; /* the parsed document */ 00334 void *keys; /* key tables storage */ 00335 struct _xsltDocument *includes; /* subsidiary includes */ 00336 int preproc; /* pre-processing already done */ 00337 int nbKeysComputed; 00338 }; 00339 00345 typedef struct _xsltKeyDef xsltKeyDef; 00346 typedef xsltKeyDef *xsltKeyDefPtr; 00347 struct _xsltKeyDef { 00348 struct _xsltKeyDef *next; 00349 xmlNodePtr inst; 00350 xmlChar *name; 00351 xmlChar *nameURI; 00352 xmlChar *match; 00353 xmlChar *use; 00354 xmlXPathCompExprPtr comp; 00355 xmlXPathCompExprPtr usecomp; 00356 xmlNsPtr *nsList; /* the namespaces in scope */ 00357 int nsNr; /* the number of namespaces in scope */ 00358 }; 00359 00366 typedef struct _xsltKeyTable xsltKeyTable; 00367 typedef xsltKeyTable *xsltKeyTablePtr; 00368 struct _xsltKeyTable { 00369 struct _xsltKeyTable *next; 00370 xmlChar *name; 00371 xmlChar *nameURI; 00372 xmlHashTablePtr keys; 00373 }; 00374 00375 /* 00376 * The in-memory structure corresponding to an XSLT Stylesheet. 00377 * NOTE: most of the content is simply linked from the doc tree 00378 * structure, no specific allocation is made. 00379 */ 00380 typedef struct _xsltStylesheet xsltStylesheet; 00381 typedef xsltStylesheet *xsltStylesheetPtr; 00382 00383 typedef struct _xsltTransformContext xsltTransformContext; 00384 typedef xsltTransformContext *xsltTransformContextPtr; 00385 00392 typedef struct _xsltElemPreComp xsltElemPreComp; 00393 typedef xsltElemPreComp *xsltElemPreCompPtr; 00394 00405 typedef void (*xsltTransformFunction) (xsltTransformContextPtr ctxt, 00406 xmlNodePtr node, 00407 xmlNodePtr inst, 00408 xsltElemPreCompPtr comp); 00409 00418 typedef void (*xsltSortFunc) (xsltTransformContextPtr ctxt, xmlNodePtr *sorts, 00419 int nbsorts); 00420 00421 typedef enum { 00422 XSLT_FUNC_COPY=1, 00423 XSLT_FUNC_SORT, 00424 XSLT_FUNC_TEXT, 00425 XSLT_FUNC_ELEMENT, 00426 XSLT_FUNC_ATTRIBUTE, 00427 XSLT_FUNC_COMMENT, 00428 XSLT_FUNC_PI, 00429 XSLT_FUNC_COPYOF, 00430 XSLT_FUNC_VALUEOF, 00431 XSLT_FUNC_NUMBER, 00432 XSLT_FUNC_APPLYIMPORTS, 00433 XSLT_FUNC_CALLTEMPLATE, 00434 XSLT_FUNC_APPLYTEMPLATES, 00435 XSLT_FUNC_CHOOSE, 00436 XSLT_FUNC_IF, 00437 XSLT_FUNC_FOREACH, 00438 XSLT_FUNC_DOCUMENT, 00439 XSLT_FUNC_WITHPARAM, 00440 XSLT_FUNC_PARAM, 00441 XSLT_FUNC_VARIABLE, 00442 XSLT_FUNC_WHEN, 00443 XSLT_FUNC_EXTENSION 00444 #ifdef XSLT_REFACTORED 00445 , 00446 XSLT_FUNC_OTHERWISE, 00447 XSLT_FUNC_FALLBACK, 00448 XSLT_FUNC_MESSAGE, 00449 XSLT_FUNC_INCLUDE, 00450 XSLT_FUNC_ATTRSET, 00451 XSLT_FUNC_LITERAL_RESULT_ELEMENT, 00452 XSLT_FUNC_UNKOWN_FORWARDS_COMPAT 00453 #endif 00454 } xsltStyleType; 00455 00462 typedef void (*xsltElemPreCompDeallocator) (xsltElemPreCompPtr comp); 00463 00472 struct _xsltElemPreComp { 00473 xsltElemPreCompPtr next; /* next item in the global chained 00474 list hold by xsltStylesheet. */ 00475 xsltStyleType type; /* type of the element */ 00476 xsltTransformFunction func; /* handling function */ 00477 xmlNodePtr inst; /* the node in the stylesheet's tree 00478 corresponding to this item */ 00479 00480 /* end of common part */ 00481 xsltElemPreCompDeallocator free; /* the deallocator */ 00482 }; 00483 00493 typedef struct _xsltStylePreComp xsltStylePreComp; 00494 typedef xsltStylePreComp *xsltStylePreCompPtr; 00495 00496 #ifdef XSLT_REFACTORED 00497 00498 /* 00499 * Some pointer-list utility functions. 00500 */ 00501 XSLTPUBFUN xsltPointerListPtr XSLTCALL 00502 xsltPointerListCreate (int initialSize); 00503 XSLTPUBFUN void XSLTCALL 00504 xsltPointerListFree (xsltPointerListPtr list); 00505 XSLTPUBFUN void XSLTCALL 00506 xsltPointerListClear (xsltPointerListPtr list); 00507 XSLTPUBFUN int XSLTCALL 00508 xsltPointerListAddSize (xsltPointerListPtr list, 00509 void *item, 00510 int initialSize); 00511 00512 /************************************************************************ 00513 * * 00514 * Refactored structures * 00515 * * 00516 ************************************************************************/ 00517 00518 typedef struct _xsltNsListContainer xsltNsListContainer; 00519 typedef xsltNsListContainer *xsltNsListContainerPtr; 00520 struct _xsltNsListContainer { 00521 xmlNsPtr *list; 00522 int totalNumber; 00523 int xpathNumber; 00524 }; 00525 00535 #define XSLT_ITEM_COMPATIBILITY_FIELDS \ 00536 xsltElemPreCompPtr next;\ 00537 xsltStyleType type;\ 00538 xsltTransformFunction func;\ 00539 xmlNodePtr inst; 00540 00547 #define XSLT_ITEM_NAVIGATION_FIELDS 00548 /* 00549 xsltStylePreCompPtr parent;\ 00550 xsltStylePreCompPtr children;\ 00551 xsltStylePreCompPtr nextItem; 00552 */ 00553 00559 #define XSLT_ITEM_NSINSCOPE_FIELDS xsltNsListContainerPtr inScopeNs; 00560 00566 #define XSLT_ITEM_COMMON_FIELDS \ 00567 XSLT_ITEM_COMPATIBILITY_FIELDS \ 00568 XSLT_ITEM_NAVIGATION_FIELDS \ 00569 XSLT_ITEM_NSINSCOPE_FIELDS 00570 00584 struct _xsltStylePreComp { 00585 xsltElemPreCompPtr next; /* next item in the global chained 00586 list hold by xsltStylesheet */ 00587 xsltStyleType type; /* type of the item */ 00588 xsltTransformFunction func; /* handling function */ 00589 xmlNodePtr inst; /* the node in the stylesheet's tree 00590 corresponding to this item. */ 00591 /* Currently no navigational fields. */ 00592 xsltNsListContainerPtr inScopeNs; 00593 }; 00594 00603 typedef struct _xsltStyleBasicEmptyItem xsltStyleBasicEmptyItem; 00604 typedef xsltStyleBasicEmptyItem *xsltStyleBasicEmptyItemPtr; 00605 00606 struct _xsltStyleBasicEmptyItem { 00607 XSLT_ITEM_COMMON_FIELDS 00608 }; 00609 00616 typedef struct _xsltStyleBasicExpressionItem xsltStyleBasicExpressionItem; 00617 typedef xsltStyleBasicExpressionItem *xsltStyleBasicExpressionItemPtr; 00618 00619 struct _xsltStyleBasicExpressionItem { 00620 XSLT_ITEM_COMMON_FIELDS 00621 00622 const xmlChar *select; /* TODO: Change this to "expression". */ 00623 xmlXPathCompExprPtr comp; /* TODO: Change this to compExpr. */ 00624 }; 00625 00626 /************************************************************************ 00627 * * 00628 * XSLT-instructions/declarations * 00629 * * 00630 ************************************************************************/ 00631 00643 typedef struct _xsltStyleItemElement xsltStyleItemElement; 00644 typedef xsltStyleItemElement *xsltStyleItemElementPtr; 00645 00646 struct _xsltStyleItemElement { 00647 XSLT_ITEM_COMMON_FIELDS 00648 00649 const xmlChar *use; 00650 int has_use; 00651 const xmlChar *name; 00652 int has_name; 00653 const xmlChar *ns; 00654 const xmlChar *nsPrefix; 00655 int has_ns; 00656 }; 00657 00668 typedef struct _xsltStyleItemAttribute xsltStyleItemAttribute; 00669 typedef xsltStyleItemAttribute *xsltStyleItemAttributePtr; 00670 00671 struct _xsltStyleItemAttribute { 00672 XSLT_ITEM_COMMON_FIELDS 00673 const xmlChar *name; 00674 int has_name; 00675 const xmlChar *ns; 00676 const xmlChar *nsPrefix; 00677 int has_ns; 00678 }; 00679 00689 typedef struct _xsltStyleItemText xsltStyleItemText; 00690 typedef xsltStyleItemText *xsltStyleItemTextPtr; 00691 00692 struct _xsltStyleItemText { 00693 XSLT_ITEM_COMMON_FIELDS 00694 int noescape; /* text */ 00695 }; 00696 00705 typedef xsltStyleBasicEmptyItem xsltStyleItemComment; 00706 typedef xsltStyleItemComment *xsltStyleItemCommentPtr; 00707 00717 typedef struct _xsltStyleItemPI xsltStyleItemPI; 00718 typedef xsltStyleItemPI *xsltStyleItemPIPtr; 00719 00720 struct _xsltStyleItemPI { 00721 XSLT_ITEM_COMMON_FIELDS 00722 const xmlChar *name; 00723 int has_name; 00724 }; 00725 00732 typedef xsltStyleBasicEmptyItem xsltStyleItemApplyImports; 00733 typedef xsltStyleItemApplyImports *xsltStyleItemApplyImportsPtr; 00734 00745 typedef struct _xsltStyleItemApplyTemplates xsltStyleItemApplyTemplates; 00746 typedef xsltStyleItemApplyTemplates *xsltStyleItemApplyTemplatesPtr; 00747 00748 struct _xsltStyleItemApplyTemplates { 00749 XSLT_ITEM_COMMON_FIELDS 00750 00751 const xmlChar *mode; /* apply-templates */ 00752 const xmlChar *modeURI; /* apply-templates */ 00753 const xmlChar *select; /* sort, copy-of, value-of, apply-templates */ 00754 xmlXPathCompExprPtr comp; /* a precompiled XPath expression */ 00755 /* TODO: with-params */ 00756 }; 00757 00767 typedef struct _xsltStyleItemCallTemplate xsltStyleItemCallTemplate; 00768 typedef xsltStyleItemCallTemplate *xsltStyleItemCallTemplatePtr; 00769 00770 struct _xsltStyleItemCallTemplate { 00771 XSLT_ITEM_COMMON_FIELDS 00772 00773 xsltTemplatePtr templ; /* call-template */ 00774 const xmlChar *name; /* element, attribute, pi */ 00775 int has_name; /* element, attribute, pi */ 00776 const xmlChar *ns; /* element */ 00777 int has_ns; /* element */ 00778 /* TODO: with-params */ 00779 }; 00780 00790 typedef struct _xsltStyleItemCopy xsltStyleItemCopy; 00791 typedef xsltStyleItemCopy *xsltStyleItemCopyPtr; 00792 00793 struct _xsltStyleItemCopy { 00794 XSLT_ITEM_COMMON_FIELDS 00795 const xmlChar *use; /* copy, element */ 00796 int has_use; /* copy, element */ 00797 }; 00798 00808 typedef struct _xsltStyleItemIf xsltStyleItemIf; 00809 typedef xsltStyleItemIf *xsltStyleItemIfPtr; 00810 00811 struct _xsltStyleItemIf { 00812 XSLT_ITEM_COMMON_FIELDS 00813 00814 const xmlChar *test; /* if */ 00815 xmlXPathCompExprPtr comp; /* a precompiled XPath expression */ 00816 }; 00817 00818 00826 typedef xsltStyleBasicExpressionItem xsltStyleItemCopyOf; 00827 typedef xsltStyleItemCopyOf *xsltStyleItemCopyOfPtr; 00828 00837 typedef struct _xsltStyleItemValueOf xsltStyleItemValueOf; 00838 typedef xsltStyleItemValueOf *xsltStyleItemValueOfPtr; 00839 00840 struct _xsltStyleItemValueOf { 00841 XSLT_ITEM_COMMON_FIELDS 00842 00843 const xmlChar *select; 00844 xmlXPathCompExprPtr comp; /* a precompiled XPath expression */ 00845 int noescape; 00846 }; 00847 00863 typedef struct _xsltStyleItemNumber xsltStyleItemNumber; 00864 typedef xsltStyleItemNumber *xsltStyleItemNumberPtr; 00865 00866 struct _xsltStyleItemNumber { 00867 XSLT_ITEM_COMMON_FIELDS 00868 xsltNumberData numdata; /* number */ 00869 }; 00870 00879 typedef xsltStyleBasicEmptyItem xsltStyleItemChoose; 00880 typedef xsltStyleItemChoose *xsltStyleItemChoosePtr; 00881 00890 typedef xsltStyleBasicEmptyItem xsltStyleItemFallback; 00891 typedef xsltStyleItemFallback *xsltStyleItemFallbackPtr; 00892 00902 typedef xsltStyleBasicExpressionItem xsltStyleItemForEach; 00903 typedef xsltStyleItemForEach *xsltStyleItemForEachPtr; 00904 00914 typedef struct _xsltStyleItemMessage xsltStyleItemMessage; 00915 typedef xsltStyleItemMessage *xsltStyleItemMessagePtr; 00916 00917 struct _xsltStyleItemMessage { 00918 XSLT_ITEM_COMMON_FIELDS 00919 int terminate; 00920 }; 00921 00927 typedef struct _xsltStyleItemDocument xsltStyleItemDocument; 00928 typedef xsltStyleItemDocument *xsltStyleItemDocumentPtr; 00929 00930 struct _xsltStyleItemDocument { 00931 XSLT_ITEM_COMMON_FIELDS 00932 int ver11; /* assigned: in xsltDocumentComp; 00933 read: nowhere; 00934 TODO: Check if we need. */ 00935 const xmlChar *filename; /* document URL */ 00936 int has_filename; 00937 }; 00938 00939 /************************************************************************ 00940 * * 00941 * Non-instructions (actually properties of instructions/declarations) * 00942 * * 00943 ************************************************************************/ 00944 00957 typedef struct _xsltStyleBasicItemVariable xsltStyleBasicItemVariable; 00958 typedef xsltStyleBasicItemVariable *xsltStyleBasicItemVariablePtr; 00959 00960 struct _xsltStyleBasicItemVariable { 00961 XSLT_ITEM_COMMON_FIELDS 00962 00963 const xmlChar *select; 00964 xmlXPathCompExprPtr comp; 00965 00966 const xmlChar *name; 00967 int has_name; 00968 const xmlChar *ns; 00969 int has_ns; 00970 }; 00971 00982 typedef xsltStyleBasicItemVariable xsltStyleItemVariable; 00983 typedef xsltStyleItemVariable *xsltStyleItemVariablePtr; 00984 00995 typedef struct _xsltStyleItemParam xsltStyleItemParam; 00996 typedef xsltStyleItemParam *xsltStyleItemParamPtr; 00997 00998 struct _xsltStyleItemParam { 00999 XSLT_ITEM_COMMON_FIELDS 01000 01001 const xmlChar *select; 01002 xmlXPathCompExprPtr comp; 01003 01004 const xmlChar *name; 01005 int has_name; 01006 const xmlChar *ns; 01007 int has_ns; 01008 }; 01009 01019 typedef xsltStyleBasicItemVariable xsltStyleItemWithParam; 01020 typedef xsltStyleItemWithParam *xsltStyleItemWithParamPtr; 01021 01034 typedef struct _xsltStyleItemSort xsltStyleItemSort; 01035 typedef xsltStyleItemSort *xsltStyleItemSortPtr; 01036 01037 struct _xsltStyleItemSort { 01038 XSLT_ITEM_COMMON_FIELDS 01039 01040 const xmlChar *stype; /* sort */ 01041 int has_stype; /* sort */ 01042 int number; /* sort */ 01043 const xmlChar *order; /* sort */ 01044 int has_order; /* sort */ 01045 int descending; /* sort */ 01046 const xmlChar *lang; /* sort */ 01047 int has_lang; /* sort */ 01048 const xmlChar *case_order; /* sort */ 01049 int lower_first; /* sort */ 01050 01051 const xmlChar *use; 01052 int has_use; 01053 01054 const xmlChar *select; /* sort, copy-of, value-of, apply-templates */ 01055 01056 xmlXPathCompExprPtr comp; /* a precompiled XPath expression */ 01057 }; 01058 01059 01069 typedef struct _xsltStyleItemWhen xsltStyleItemWhen; 01070 typedef xsltStyleItemWhen *xsltStyleItemWhenPtr; 01071 01072 struct _xsltStyleItemWhen { 01073 XSLT_ITEM_COMMON_FIELDS 01074 01075 const xmlChar *test; 01076 xmlXPathCompExprPtr comp; 01077 }; 01078 01087 typedef struct _xsltStyleItemOtherwise xsltStyleItemOtherwise; 01088 typedef xsltStyleItemOtherwise *xsltStyleItemOtherwisePtr; 01089 01090 struct _xsltStyleItemOtherwise { 01091 XSLT_ITEM_COMMON_FIELDS 01092 }; 01093 01094 typedef struct _xsltStyleItemInclude xsltStyleItemInclude; 01095 typedef xsltStyleItemInclude *xsltStyleItemIncludePtr; 01096 01097 struct _xsltStyleItemInclude { 01098 XSLT_ITEM_COMMON_FIELDS 01099 xsltDocumentPtr include; 01100 }; 01101 01102 /************************************************************************ 01103 * * 01104 * XSLT elements in forwards-compatible mode * 01105 * * 01106 ************************************************************************/ 01107 01108 typedef struct _xsltStyleItemUknown xsltStyleItemUknown; 01109 typedef xsltStyleItemUknown *xsltStyleItemUknownPtr; 01110 struct _xsltStyleItemUknown { 01111 XSLT_ITEM_COMMON_FIELDS 01112 }; 01113 01114 01115 /************************************************************************ 01116 * * 01117 * Extension elements * 01118 * * 01119 ************************************************************************/ 01120 01121 /* 01122 * xsltStyleItemExtElement: 01123 * 01124 * Reflects extension elements. 01125 * 01126 * NOTE: Due to the fact that the structure xsltElemPreComp is most 01127 * probably already heavily in use out there by users, so we cannot 01128 * easily change it, we'll create an intermediate structure which will 01129 * hold an xsltElemPreCompPtr. 01130 * BIG NOTE: The only problem I see here is that the user processes the 01131 * content of the stylesheet tree, possibly he'll lookup the node->psvi 01132 * fields in order to find subsequent extension functions. 01133 * In this case, the user's code will break, since the node->psvi 01134 * field will hold now the xsltStyleItemExtElementPtr and not 01135 * the xsltElemPreCompPtr. 01136 * However the place where the structure is anchored in the node-tree, 01137 * namely node->psvi, has beed already once been moved from node->_private 01138 * to node->psvi, so we have a precedent here, which, I think, should allow 01139 * us to change such semantics without headaches. 01140 */ 01141 typedef struct _xsltStyleItemExtElement xsltStyleItemExtElement; 01142 typedef xsltStyleItemExtElement *xsltStyleItemExtElementPtr; 01143 struct _xsltStyleItemExtElement { 01144 XSLT_ITEM_COMMON_FIELDS 01145 xsltElemPreCompPtr item; 01146 }; 01147 01148 /************************************************************************ 01149 * * 01150 * Literal result elements * 01151 * * 01152 ************************************************************************/ 01153 01154 typedef struct _xsltEffectiveNs xsltEffectiveNs; 01155 typedef xsltEffectiveNs *xsltEffectiveNsPtr; 01156 struct _xsltEffectiveNs { 01157 xsltEffectiveNsPtr nextInStore; /* storage next */ 01158 xsltEffectiveNsPtr next; /* next item in the list */ 01159 const xmlChar *prefix; 01160 const xmlChar *nsName; 01161 /* 01162 * Indicates if eclared on the literal result element; dunno if really 01163 * needed. 01164 */ 01165 int holdByElem; 01166 }; 01167 01168 /* 01169 * Info for literal result elements. 01170 * This will be set on the elem->psvi field and will be 01171 * shared by literal result elements, which have the same 01172 * excluded result namespaces; i.e., this *won't* be created uniquely 01173 * for every literal result element. 01174 */ 01175 typedef struct _xsltStyleItemLRElementInfo xsltStyleItemLRElementInfo; 01176 typedef xsltStyleItemLRElementInfo *xsltStyleItemLRElementInfoPtr; 01177 struct _xsltStyleItemLRElementInfo { 01178 XSLT_ITEM_COMMON_FIELDS 01179 /* 01180 * @effectiveNs is the set of effective ns-nodes 01181 * on the literal result element, which will be added to the result 01182 * element if not already existing in the result tree. 01183 * This means that excluded namespaces (via exclude-result-prefixes, 01184 * extension-element-prefixes and the XSLT namespace) not added 01185 * to the set. 01186 * Namespace-aliasing was applied on the @effectiveNs. 01187 */ 01188 xsltEffectiveNsPtr effectiveNs; 01189 01190 }; 01191 01192 #ifdef XSLT_REFACTORED 01193 01194 typedef struct _xsltNsAlias xsltNsAlias; 01195 typedef xsltNsAlias *xsltNsAliasPtr; 01196 struct _xsltNsAlias { 01197 xsltNsAliasPtr next; /* next in the list */ 01198 xmlNsPtr literalNs; 01199 xmlNsPtr targetNs; 01200 xmlDocPtr docOfTargetNs; 01201 }; 01202 #endif 01203 01204 #ifdef XSLT_REFACTORED_XSLT_NSCOMP 01205 01206 typedef struct _xsltNsMap xsltNsMap; 01207 typedef xsltNsMap *xsltNsMapPtr; 01208 struct _xsltNsMap { 01209 xsltNsMapPtr next; /* next in the list */ 01210 xmlDocPtr doc; 01211 xmlNodePtr elem; /* the element holding the ns-decl */ 01212 xmlNsPtr ns; /* the xmlNs structure holding the XML namespace name */ 01213 const xmlChar *origNsName; /* the original XML namespace name */ 01214 const xmlChar *newNsName; /* the mapped XML namespace name */ 01215 }; 01216 #endif 01217 01218 /************************************************************************ 01219 * * 01220 * Compile-time structures for *internal* use only * 01221 * * 01222 ************************************************************************/ 01223 01224 typedef struct _xsltPrincipalStylesheetData xsltPrincipalStylesheetData; 01225 typedef xsltPrincipalStylesheetData *xsltPrincipalStylesheetDataPtr; 01226 01227 typedef struct _xsltNsList xsltNsList; 01228 typedef xsltNsList *xsltNsListPtr; 01229 struct _xsltNsList { 01230 xsltNsListPtr next; /* next in the list */ 01231 xmlNsPtr ns; 01232 }; 01233 01234 /* 01235 * xsltVarInfo: 01236 * 01237 * Used at compilation time for parameters and variables. 01238 */ 01239 typedef struct _xsltVarInfo xsltVarInfo; 01240 typedef xsltVarInfo *xsltVarInfoPtr; 01241 struct _xsltVarInfo { 01242 xsltVarInfoPtr next; /* next in the list */ 01243 xsltVarInfoPtr prev; 01244 int depth; /* the depth in the tree */ 01245 const xmlChar *name; 01246 const xmlChar *nsName; 01247 }; 01248 01249 #define XSLT_ELEMENT_CATEGORY_XSLT 0 01250 #define XSLT_ELEMENT_CATEGORY_EXTENSION 1 01251 #define XSLT_ELEMENT_CATEGORY_LRE 2 01252 01258 typedef struct _xsltCompilerNodeInfo xsltCompilerNodeInfo; 01259 typedef xsltCompilerNodeInfo *xsltCompilerNodeInfoPtr; 01260 struct _xsltCompilerNodeInfo { 01261 xsltCompilerNodeInfoPtr next; 01262 xsltCompilerNodeInfoPtr prev; 01263 xmlNodePtr node; 01264 int depth; 01265 xsltTemplatePtr templ; /* The owning template */ 01266 int category; /* XSLT element, LR-element or 01267 extension element */ 01268 xsltStyleType type; 01269 xsltElemPreCompPtr item; /* The compiled information */ 01270 /* The current in-scope namespaces */ 01271 xsltNsListContainerPtr inScopeNs; 01272 /* The current excluded result namespaces */ 01273 xsltPointerListPtr exclResultNs; 01274 /* The current extension instruction namespaces */ 01275 xsltPointerListPtr extElemNs; 01276 01277 /* The current info for literal result elements. */ 01278 xsltStyleItemLRElementInfoPtr litResElemInfo; 01279 /* 01280 * Set to 1 if in-scope namespaces changed, 01281 * or excluded result namespaces changed, 01282 * or extension element namespaces changed. 01283 * This will trigger creation of new infos 01284 * for literal result elements. 01285 */ 01286 int nsChanged; 01287 int preserveWhitespace; 01288 int stripWhitespace; 01289 int isRoot; /* whether this is the stylesheet's root node */ 01290 int forwardsCompat; /* whether forwards-compatible mode is enabled */ 01291 /* whether the content of an extension element was processed */ 01292 int extContentHandled; 01293 /* the type of the current child */ 01294 xsltStyleType curChildType; 01295 }; 01296 01302 #define XSLT_CCTXT(style) ((xsltCompilerCtxtPtr) style->compCtxt) 01303 01304 typedef enum { 01305 XSLT_ERROR_SEVERITY_ERROR = 0, 01306 XSLT_ERROR_SEVERITY_WARNING 01307 } xsltErrorSeverityType; 01308 01309 typedef struct _xsltCompilerCtxt xsltCompilerCtxt; 01310 typedef xsltCompilerCtxt *xsltCompilerCtxtPtr; 01311 struct _xsltCompilerCtxt { 01312 void *errorCtxt; /* user specific error context */ 01313 /* 01314 * used for error/warning reports; e.g. XSLT_ERROR_SEVERITY_WARNING */ 01315 xsltErrorSeverityType errSeverity; 01316 int warnings; /* TODO: number of warnings found at 01317 compilation */ 01318 int errors; /* TODO: number of errors found at 01319 compilation */ 01320 xmlDictPtr dict; 01321 xsltStylesheetPtr style; 01322 int simplified; /* whether this is a simplified stylesheet */ 01323 /* TODO: structured/unstructured error contexts. */ 01324 int depth; /* Current depth of processing */ 01325 01326 xsltCompilerNodeInfoPtr inode; 01327 xsltCompilerNodeInfoPtr inodeList; 01328 xsltCompilerNodeInfoPtr inodeLast; 01329 xsltPointerListPtr tmpList; /* Used for various purposes */ 01330 /* 01331 * The XSLT version as specified by the stylesheet's root element. 01332 */ 01333 int isInclude; 01334 int hasForwardsCompat; /* whether forwards-compatible mode was used 01335 in a parsing episode */ 01336 int maxNodeInfos; /* TEMP TODO: just for the interest */ 01337 int maxLREs; /* TEMP TODO: just for the interest */ 01338 /* 01339 * In order to keep the old behaviour, applying strict rules of 01340 * the spec can be turned off. This has effect only on special 01341 * mechanisms like whitespace-stripping in the stylesheet. 01342 */ 01343 int strict; 01344 xsltPrincipalStylesheetDataPtr psData; 01345 #ifdef XSLT_REFACTORED_XPATHCOMP 01346 xmlXPathContextPtr xpathCtxt; 01347 #endif 01348 xsltStyleItemUknownPtr unknownItem; 01349 int hasNsAliases; /* Indicator if there was an xsl:namespace-alias. */ 01350 xsltNsAliasPtr nsAliases; 01351 xsltVarInfoPtr ivars; /* Storage of local in-scope variables/params. */ 01352 xsltVarInfoPtr ivar; /* topmost local variable/param. */ 01353 }; 01354 01355 #else /* XSLT_REFACTORED */ 01356 /* 01357 * The old structures before refactoring. 01358 */ 01359 01366 struct _xsltStylePreComp { 01367 xsltElemPreCompPtr next; /* chained list */ 01368 xsltStyleType type; /* type of the element */ 01369 xsltTransformFunction func; /* handling function */ 01370 xmlNodePtr inst; /* the instruction */ 01371 01372 /* 01373 * Pre computed values. 01374 */ 01375 01376 const xmlChar *stype; /* sort */ 01377 int has_stype; /* sort */ 01378 int number; /* sort */ 01379 const xmlChar *order; /* sort */ 01380 int has_order; /* sort */ 01381 int descending; /* sort */ 01382 const xmlChar *lang; /* sort */ 01383 int has_lang; /* sort */ 01384 const xmlChar *case_order; /* sort */ 01385 int lower_first; /* sort */ 01386 01387 const xmlChar *use; /* copy, element */ 01388 int has_use; /* copy, element */ 01389 01390 int noescape; /* text */ 01391 01392 const xmlChar *name; /* element, attribute, pi */ 01393 int has_name; /* element, attribute, pi */ 01394 const xmlChar *ns; /* element */ 01395 int has_ns; /* element */ 01396 01397 const xmlChar *mode; /* apply-templates */ 01398 const xmlChar *modeURI; /* apply-templates */ 01399 01400 const xmlChar *test; /* if */ 01401 01402 xsltTemplatePtr templ; /* call-template */ 01403 01404 const xmlChar *select; /* sort, copy-of, value-of, apply-templates */ 01405 01406 int ver11; /* document */ 01407 const xmlChar *filename; /* document URL */ 01408 int has_filename; /* document */ 01409 01410 xsltNumberData numdata; /* number */ 01411 01412 xmlXPathCompExprPtr comp; /* a precompiled XPath expression */ 01413 xmlNsPtr *nsList; /* the namespaces in scope */ 01414 int nsNr; /* the number of namespaces in scope */ 01415 }; 01416 01417 #endif /* XSLT_REFACTORED */ 01418 01419 01420 #define XSLT_VAR_GLOBAL 1<<0 01421 #define XSLT_VAR_IN_SELECT 1<<1 01422 #define XSLT_TCTXT_VARIABLE(c) ((xsltStackElemPtr) (c)->contextVariable) 01423 /* 01424 * The in-memory structure corresponding to an XSLT Variable 01425 * or Param. 01426 */ 01427 typedef struct _xsltStackElem xsltStackElem; 01428 typedef xsltStackElem *xsltStackElemPtr; 01429 struct _xsltStackElem { 01430 struct _xsltStackElem *next;/* chained list */ 01431 xsltStylePreCompPtr comp; /* the compiled form */ 01432 int computed; /* was the evaluation done */ 01433 const xmlChar *name; /* the local part of the name QName */ 01434 const xmlChar *nameURI; /* the URI part of the name QName */ 01435 const xmlChar *select; /* the eval string */ 01436 xmlNodePtr tree; /* the sequence constructor if no eval 01437 string or the location */ 01438 xmlXPathObjectPtr value; /* The value if computed */ 01439 xmlDocPtr fragment; /* The Result Tree Fragments (needed for XSLT 1.0) 01440 which are bound to the variable's lifetime. */ 01441 int level; /* the depth in the tree; 01442 -1 if persistent (e.g. a given xsl:with-param) */ 01443 xsltTransformContextPtr context; /* The transformation context; needed to cache 01444 the variables */ 01445 int flags; 01446 }; 01447 01448 #ifdef XSLT_REFACTORED 01449 01450 struct _xsltPrincipalStylesheetData { 01451 /* 01452 * Namespace dictionary for ns-prefixes and ns-names: 01453 * TODO: Shared between stylesheets, and XPath mechanisms. 01454 * Not used yet. 01455 */ 01456 xmlDictPtr namespaceDict; 01457 /* 01458 * Global list of in-scope namespaces. 01459 */ 01460 xsltPointerListPtr inScopeNamespaces; 01461 /* 01462 * Global list of information for [xsl:]excluded-result-prefixes. 01463 */ 01464 xsltPointerListPtr exclResultNamespaces; 01465 /* 01466 * Global list of information for [xsl:]extension-element-prefixes. 01467 */ 01468 xsltPointerListPtr extElemNamespaces; 01469 xsltEffectiveNsPtr effectiveNs; 01470 #ifdef XSLT_REFACTORED_XSLT_NSCOMP 01471 /* 01472 * Namespace name map to get rid of string comparison of namespace names. 01473 */ 01474 xsltNsMapPtr nsMap; 01475 #endif 01476 }; 01477 01478 01479 #endif 01480 /* 01481 * Note that we added a @compCtxt field to anchor an stylesheet compilation 01482 * context, since, due to historical reasons, various compile-time function 01483 * take only the stylesheet as argument and not a compilation context. 01484 */ 01485 struct _xsltStylesheet { 01486 /* 01487 * The stylesheet import relation is kept as a tree. 01488 */ 01489 struct _xsltStylesheet *parent; 01490 struct _xsltStylesheet *next; 01491 struct _xsltStylesheet *imports; 01492 01493 xsltDocumentPtr docList; /* the include document list */ 01494 01495 /* 01496 * General data on the style sheet document. 01497 */ 01498 xmlDocPtr doc; /* the parsed XML stylesheet */ 01499 xmlHashTablePtr stripSpaces;/* the hash table of the strip-space and 01500 preserve space elements */ 01501 int stripAll; /* strip-space * (1) preserve-space * (-1) */ 01502 xmlHashTablePtr cdataSection;/* the hash table of the cdata-section */ 01503 01504 /* 01505 * Global variable or parameters. 01506 */ 01507 xsltStackElemPtr variables; /* linked list of param and variables */ 01508 01509 /* 01510 * Template descriptions. 01511 */ 01512 xsltTemplatePtr templates; /* the ordered list of templates */ 01513 void *templatesHash; /* hash table or wherever compiled templates 01514 informations are stored */ 01515 void *rootMatch; /* template based on / */ 01516 void *keyMatch; /* template based on key() */ 01517 void *elemMatch; /* template based on * */ 01518 void *attrMatch; /* template based on @* */ 01519 void *parentMatch; /* template based on .. */ 01520 void *textMatch; /* template based on text() */ 01521 void *piMatch; /* template based on processing-instruction() */ 01522 void *commentMatch; /* template based on comment() */ 01523 01524 /* 01525 * Namespace aliases. 01526 * NOTE: Not used in the refactored code. 01527 */ 01528 xmlHashTablePtr nsAliases; /* the namespace alias hash tables */ 01529 01530 /* 01531 * Attribute sets. 01532 */ 01533 xmlHashTablePtr attributeSets;/* the attribute sets hash tables */ 01534 01535 /* 01536 * Namespaces. 01537 * TODO: Eliminate this. 01538 */ 01539 xmlHashTablePtr nsHash; /* the set of namespaces in use: 01540 ATTENTION: This is used for 01541 execution of XPath expressions; unfortunately 01542 it restricts the stylesheet to have distinct 01543 prefixes. 01544 TODO: We need to get rid of this. 01545 */ 01546 void *nsDefs; /* ATTENTION TODO: This is currently used to store 01547 xsltExtDefPtr (in extensions.c) and 01548 *not* xmlNsPtr. 01549 */ 01550 01551 /* 01552 * Key definitions. 01553 */ 01554 void *keys; /* key definitions */ 01555 01556 /* 01557 * Output related stuff. 01558 */ 01559 xmlChar *method; /* the output method */ 01560 xmlChar *methodURI; /* associated namespace if any */ 01561 xmlChar *version; /* version string */ 01562 xmlChar *encoding; /* encoding string */ 01563 int omitXmlDeclaration; /* omit-xml-declaration = "yes" | "no" */ 01564 01565 /* 01566 * Number formatting. 01567 */ 01568 xsltDecimalFormatPtr decimalFormat; 01569 int standalone; /* standalone = "yes" | "no" */ 01570 xmlChar *doctypePublic; /* doctype-public string */ 01571 xmlChar *doctypeSystem; /* doctype-system string */ 01572 int indent; /* should output being indented */ 01573 xmlChar *mediaType; /* media-type string */ 01574 01575 /* 01576 * Precomputed blocks. 01577 */ 01578 xsltElemPreCompPtr preComps;/* list of precomputed blocks */ 01579 int warnings; /* number of warnings found at compilation */ 01580 int errors; /* number of errors found at compilation */ 01581 01582 xmlChar *exclPrefix; /* last excluded prefixes */ 01583 xmlChar **exclPrefixTab; /* array of excluded prefixes */ 01584 int exclPrefixNr; /* number of excluded prefixes in scope */ 01585 int exclPrefixMax; /* size of the array */ 01586 01587 void *_private; /* user defined data */ 01588 01589 /* 01590 * Extensions. 01591 */ 01592 xmlHashTablePtr extInfos; /* the extension data */ 01593 int extrasNr; /* the number of extras required */ 01594 01595 /* 01596 * For keeping track of nested includes 01597 */ 01598 xsltDocumentPtr includes; /* points to last nested include */ 01599 01600 /* 01601 * dictionary: shared between stylesheet, context and documents. 01602 */ 01603 xmlDictPtr dict; 01604 /* 01605 * precompiled attribute value templates. 01606 */ 01607 void *attVTs; 01608 /* 01609 * if namespace-alias has an alias for the default stylesheet prefix 01610 * NOTE: Not used in the refactored code. 01611 */ 01612 const xmlChar *defaultAlias; 01613 /* 01614 * bypass pre-processing (already done) (used in imports) 01615 */ 01616 int nopreproc; 01617 /* 01618 * all document text strings were internalized 01619 */ 01620 int internalized; 01621 /* 01622 * Literal Result Element as Stylesheet c.f. section 2.3 01623 */ 01624 int literal_result; 01625 /* 01626 * The principal stylesheet 01627 */ 01628 xsltStylesheetPtr principal; 01629 #ifdef XSLT_REFACTORED 01630 /* 01631 * Compilation context used during compile-time. 01632 */ 01633 xsltCompilerCtxtPtr compCtxt; /* TODO: Change this to (void *). */ 01634 01635 xsltPrincipalStylesheetDataPtr principalData; 01636 #endif 01637 }; 01638 01639 typedef struct _xsltTransformCache xsltTransformCache; 01640 typedef xsltTransformCache *xsltTransformCachePtr; 01641 struct _xsltTransformCache { 01642 xmlDocPtr RVT; 01643 int nbRVT; 01644 xsltStackElemPtr stackItems; 01645 int nbStackItems; 01646 #ifdef XSLT_DEBUG_PROFILE_CACHE 01647 int dbgCachedRVTs; 01648 int dbgReusedRVTs; 01649 int dbgCachedVars; 01650 int dbgReusedVars; 01651 #endif 01652 }; 01653 01654 /* 01655 * The in-memory structure corresponding to an XSLT Transformation. 01656 */ 01657 typedef enum { 01658 XSLT_OUTPUT_XML = 0, 01659 XSLT_OUTPUT_HTML, 01660 XSLT_OUTPUT_TEXT 01661 } xsltOutputType; 01662 01663 typedef enum { 01664 XSLT_STATE_OK = 0, 01665 XSLT_STATE_ERROR, 01666 XSLT_STATE_STOPPED 01667 } xsltTransformState; 01668 01669 struct _xsltTransformContext { 01670 xsltStylesheetPtr style; /* the stylesheet used */ 01671 xsltOutputType type; /* the type of output */ 01672 01673 xsltTemplatePtr templ; /* the current template */ 01674 int templNr; /* Nb of templates in the stack */ 01675 int templMax; /* Size of the templtes stack */ 01676 xsltTemplatePtr *templTab; /* the template stack */ 01677 01678 xsltStackElemPtr vars; /* the current variable list */ 01679 int varsNr; /* Nb of variable list in the stack */ 01680 int varsMax; /* Size of the variable list stack */ 01681 xsltStackElemPtr *varsTab; /* the variable list stack */ 01682 int varsBase; /* the var base for current templ */ 01683 01684 /* 01685 * Extensions 01686 */ 01687 xmlHashTablePtr extFunctions; /* the extension functions */ 01688 xmlHashTablePtr extElements; /* the extension elements */ 01689 xmlHashTablePtr extInfos; /* the extension data */ 01690 01691 const xmlChar *mode; /* the current mode */ 01692 const xmlChar *modeURI; /* the current mode URI */ 01693 01694 xsltDocumentPtr docList; /* the document list */ 01695 01696 xsltDocumentPtr document; /* the current source document; can be NULL if an RTF */ 01697 xmlNodePtr node; /* the current node being processed */ 01698 xmlNodeSetPtr nodeList; /* the current node list */ 01699 /* xmlNodePtr current; the node */ 01700 01701 xmlDocPtr output; /* the resulting document */ 01702 xmlNodePtr insert; /* the insertion node */ 01703 01704 xmlXPathContextPtr xpathCtxt; /* the XPath context */ 01705 xsltTransformState state; /* the current state */ 01706 01707 /* 01708 * Global variables 01709 */ 01710 xmlHashTablePtr globalVars; /* the global variables and params */ 01711 01712 xmlNodePtr inst; /* the instruction in the stylesheet */ 01713 01714 int xinclude; /* should XInclude be processed */ 01715 01716 const char * outputFile; /* the output URI if known */ 01717 01718 int profile; /* is this run profiled */ 01719 long prof; /* the current profiled value */ 01720 int profNr; /* Nb of templates in the stack */ 01721 int profMax; /* Size of the templtaes stack */ 01722 long *profTab; /* the profile template stack */ 01723 01724 void *_private; /* user defined data */ 01725 01726 int extrasNr; /* the number of extras used */ 01727 int extrasMax; /* the number of extras allocated */ 01728 xsltRuntimeExtraPtr extras; /* extra per runtime informations */ 01729 01730 xsltDocumentPtr styleList; /* the stylesheet docs list */ 01731 void * sec; /* the security preferences if any */ 01732 01733 xmlGenericErrorFunc error; /* a specific error handler */ 01734 void * errctx; /* context for the error handler */ 01735 01736 xsltSortFunc sortfunc; /* a ctxt specific sort routine */ 01737 01738 /* 01739 * handling of temporary Result Value Tree 01740 * (XSLT 1.0 term: "Result Tree Fragment") 01741 */ 01742 xmlDocPtr tmpRVT; /* list of RVT without persistance */ 01743 xmlDocPtr persistRVT; /* list of persistant RVTs */ 01744 int ctxtflags; /* context processing flags */ 01745 01746 /* 01747 * Speed optimization when coalescing text nodes 01748 */ 01749 const xmlChar *lasttext; /* last text node content */ 01750 unsigned int lasttsize; /* last text node size */ 01751 unsigned int lasttuse; /* last text node use */ 01752 /* 01753 * Per Context Debugging 01754 */ 01755 int debugStatus; /* the context level debug status */ 01756 unsigned long* traceCode; /* pointer to the variable holding the mask */ 01757 01758 int parserOptions; /* parser options xmlParserOption */ 01759 01760 /* 01761 * dictionary: shared between stylesheet, context and documents. 01762 */ 01763 xmlDictPtr dict; 01764 xmlDocPtr tmpDoc; /* Obsolete; not used in the library. */ 01765 /* 01766 * all document text strings are internalized 01767 */ 01768 int internalized; 01769 int nbKeys; 01770 int hasTemplKeyPatterns; 01771 xsltTemplatePtr currentTemplateRule; /* the Current Template Rule */ 01772 xmlNodePtr initialContextNode; 01773 xmlDocPtr initialContextDoc; 01774 xsltTransformCachePtr cache; 01775 void *contextVariable; /* the current variable item */ 01776 xmlDocPtr localRVT; /* list of local tree fragments; will be freed when 01777 the instruction which created the fragment 01778 exits */ 01779 xmlDocPtr localRVTBase; 01780 int keyInitLevel; /* Needed to catch recursive keys issues */ 01781 }; 01782 01789 #define CHECK_STOPPED if (ctxt->state == XSLT_STATE_STOPPED) return; 01790 01797 #define CHECK_STOPPEDE if (ctxt->state == XSLT_STATE_STOPPED) goto error; 01798 01805 #define CHECK_STOPPED0 if (ctxt->state == XSLT_STATE_STOPPED) return(0); 01806 01807 /* 01808 * The macro XML_CAST_FPTR is a hack to avoid a gcc warning about 01809 * possible incompatibilities between function pointers and object 01810 * pointers. It is defined in libxml/hash.h within recent versions 01811 * of libxml2, but is put here for compatibility. 01812 */ 01813 #ifndef XML_CAST_FPTR 01814 01827 #define XML_CAST_FPTR(fptr) fptr 01828 #endif 01829 /* 01830 * Functions associated to the internal types 01831 xsltDecimalFormatPtr xsltDecimalFormatGetByName(xsltStylesheetPtr sheet, 01832 xmlChar *name); 01833 */ 01834 XSLTPUBFUN xsltStylesheetPtr XSLTCALL 01835 xsltNewStylesheet (void); 01836 XSLTPUBFUN xsltStylesheetPtr XSLTCALL 01837 xsltParseStylesheetFile (const xmlChar* filename); 01838 XSLTPUBFUN void XSLTCALL 01839 xsltFreeStylesheet (xsltStylesheetPtr style); 01840 XSLTPUBFUN int XSLTCALL 01841 xsltIsBlank (xmlChar *str); 01842 XSLTPUBFUN void XSLTCALL 01843 xsltFreeStackElemList (xsltStackElemPtr elem); 01844 XSLTPUBFUN xsltDecimalFormatPtr XSLTCALL 01845 xsltDecimalFormatGetByName(xsltStylesheetPtr style, 01846 xmlChar *name); 01847 01848 XSLTPUBFUN xsltStylesheetPtr XSLTCALL 01849 xsltParseStylesheetProcess(xsltStylesheetPtr ret, 01850 xmlDocPtr doc); 01851 XSLTPUBFUN void XSLTCALL 01852 xsltParseStylesheetOutput(xsltStylesheetPtr style, 01853 xmlNodePtr cur); 01854 XSLTPUBFUN xsltStylesheetPtr XSLTCALL 01855 xsltParseStylesheetDoc (xmlDocPtr doc); 01856 XSLTPUBFUN xsltStylesheetPtr XSLTCALL 01857 xsltParseStylesheetImportedDoc(xmlDocPtr doc, 01858 xsltStylesheetPtr style); 01859 XSLTPUBFUN xsltStylesheetPtr XSLTCALL 01860 xsltLoadStylesheetPI (xmlDocPtr doc); 01861 XSLTPUBFUN void XSLTCALL 01862 xsltNumberFormat (xsltTransformContextPtr ctxt, 01863 xsltNumberDataPtr data, 01864 xmlNodePtr node); 01865 XSLTPUBFUN xmlXPathError XSLTCALL 01866 xsltFormatNumberConversion(xsltDecimalFormatPtr self, 01867 xmlChar *format, 01868 double number, 01869 xmlChar **result); 01870 01871 XSLTPUBFUN void XSLTCALL 01872 xsltParseTemplateContent(xsltStylesheetPtr style, 01873 xmlNodePtr templ); 01874 XSLTPUBFUN int XSLTCALL 01875 xsltAllocateExtra (xsltStylesheetPtr style); 01876 XSLTPUBFUN int XSLTCALL 01877 xsltAllocateExtraCtxt (xsltTransformContextPtr ctxt); 01878 /* 01879 * Extra functions for Result Value Trees 01880 */ 01881 XSLTPUBFUN xmlDocPtr XSLTCALL 01882 xsltCreateRVT (xsltTransformContextPtr ctxt); 01883 XSLTPUBFUN int XSLTCALL 01884 xsltRegisterTmpRVT (xsltTransformContextPtr ctxt, 01885 xmlDocPtr RVT); 01886 XSLTPUBFUN int XSLTCALL 01887 xsltRegisterLocalRVT (xsltTransformContextPtr ctxt, 01888 xmlDocPtr RVT); 01889 XSLTPUBFUN int XSLTCALL 01890 xsltRegisterPersistRVT (xsltTransformContextPtr ctxt, 01891 xmlDocPtr RVT); 01892 XSLTPUBFUN int XSLTCALL 01893 xsltExtensionInstructionResultRegister( 01894 xsltTransformContextPtr ctxt, 01895 xmlXPathObjectPtr obj); 01896 XSLTPUBFUN int XSLTCALL 01897 xsltExtensionInstructionResultFinalize( 01898 xsltTransformContextPtr ctxt); 01899 XSLTPUBFUN void XSLTCALL 01900 xsltFreeRVTs (xsltTransformContextPtr ctxt); 01901 XSLTPUBFUN void XSLTCALL 01902 xsltReleaseRVT (xsltTransformContextPtr ctxt, 01903 xmlDocPtr RVT); 01904 XSLTPUBFUN int XSLTCALL 01905 xsltTransStorageAdd (xsltTransformContextPtr ctxt, 01906 void *id, 01907 void *data); 01908 XSLTPUBFUN void * XSLTCALL 01909 xsltTransStorageRemove (xsltTransformContextPtr ctxt, 01910 void *id); 01911 01912 /* 01913 * Extra functions for Attribute Value Templates 01914 */ 01915 XSLTPUBFUN void XSLTCALL 01916 xsltCompileAttr (xsltStylesheetPtr style, 01917 xmlAttrPtr attr); 01918 XSLTPUBFUN xmlChar * XSLTCALL 01919 xsltEvalAVT (xsltTransformContextPtr ctxt, 01920 void *avt, 01921 xmlNodePtr node); 01922 XSLTPUBFUN void XSLTCALL 01923 xsltFreeAVTList (void *avt); 01924 01925 /* 01926 * Extra function for successful xsltCleanupGlobals / xsltInit sequence. 01927 */ 01928 01929 XSLTPUBFUN void XSLTCALL 01930 xsltUninit (void); 01931 01932 /************************************************************************ 01933 * * 01934 * Compile-time functions for *internal* use only * 01935 * * 01936 ************************************************************************/ 01937 01938 #ifdef XSLT_REFACTORED 01939 XSLTPUBFUN void XSLTCALL 01940 xsltParseSequenceConstructor( 01941 xsltCompilerCtxtPtr cctxt, 01942 xmlNodePtr start); 01943 XSLTPUBFUN int XSLTCALL 01944 xsltParseAnyXSLTElem (xsltCompilerCtxtPtr cctxt, 01945 xmlNodePtr elem); 01946 #ifdef XSLT_REFACTORED_XSLT_NSCOMP 01947 XSLTPUBFUN int XSLTCALL 01948 xsltRestoreDocumentNamespaces( 01949 xsltNsMapPtr ns, 01950 xmlDocPtr doc); 01951 #endif 01952 #endif /* XSLT_REFACTORED */ 01953 01954 /************************************************************************ 01955 * * 01956 * Transformation-time functions for *internal* use only * 01957 * * 01958 ************************************************************************/ 01959 XSLTPUBFUN int XSLTCALL 01960 xsltInitCtxtKey (xsltTransformContextPtr ctxt, 01961 xsltDocumentPtr doc, 01962 xsltKeyDefPtr keyd); 01963 XSLTPUBFUN int XSLTCALL 01964 xsltInitAllDocKeys (xsltTransformContextPtr ctxt); 01965 #ifdef __cplusplus 01966 } 01967 #endif 01968 01969 #endif /* __XML_XSLT_H__ */ 01970 Generated on Fri May 25 2012 04:17:49 for ReactOS by
1.7.6.1
|