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