xsltInternals.h 56 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983
  1. /*
  2. * Summary: internal data structures, constants and functions
  3. * Description: Internal data structures, constants and functions used
  4. * by the XSLT engine.
  5. * They are not part of the API or ABI, i.e. they can change
  6. * without prior notice, use carefully.
  7. *
  8. * Copy: See Copyright for the status of this software.
  9. *
  10. * Author: Daniel Veillard
  11. */
  12. #ifndef __XML_XSLT_INTERNALS_H__
  13. #define __XML_XSLT_INTERNALS_H__
  14. #include <libxml/tree.h>
  15. #include <libxml/hash.h>
  16. #include <libxml/xpath.h>
  17. #include <libxml/xmlerror.h>
  18. #include <libxml/dict.h>
  19. #include <libxml/xmlstring.h>
  20. #include <libxslt/xslt.h>
  21. #include "xsltexports.h"
  22. #include "xsltlocale.h"
  23. #include "numbersInternals.h"
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27. /* #define XSLT_DEBUG_PROFILE_CACHE */
  28. /**
  29. * XSLT_IS_TEXT_NODE:
  30. *
  31. * check if the argument is a text node
  32. */
  33. #define XSLT_IS_TEXT_NODE(n) ((n != NULL) && \
  34. (((n)->type == XML_TEXT_NODE) || \
  35. ((n)->type == XML_CDATA_SECTION_NODE)))
  36. /**
  37. * XSLT_MARK_RES_TREE_FRAG:
  38. *
  39. * internal macro to set up tree fragments
  40. */
  41. #define XSLT_MARK_RES_TREE_FRAG(n) \
  42. (n)->name = (char *) xmlStrdup(BAD_CAST " fake node libxslt");
  43. /**
  44. * XSLT_IS_RES_TREE_FRAG:
  45. *
  46. * internal macro to test tree fragments
  47. */
  48. #define XSLT_IS_RES_TREE_FRAG(n) \
  49. ((n != NULL) && ((n)->type == XML_DOCUMENT_NODE) && \
  50. ((n)->name != NULL) && ((n)->name[0] == ' '))
  51. /**
  52. * XSLT_REFACTORED_KEYCOMP:
  53. *
  54. * Internal define to enable on-demand xsl:key computation.
  55. * That's the only mode now but the define is kept for compatibility
  56. */
  57. #define XSLT_REFACTORED_KEYCOMP
  58. /**
  59. * XSLT_FAST_IF:
  60. *
  61. * Internal define to enable usage of xmlXPathCompiledEvalToBoolean()
  62. * for XSLT "tests"; e.g. in <xsl:if test="/foo/bar">
  63. */
  64. #define XSLT_FAST_IF
  65. /**
  66. * XSLT_REFACTORED:
  67. *
  68. * Internal define to enable the refactored parts of Libxslt.
  69. */
  70. /* #define XSLT_REFACTORED */
  71. /* ==================================================================== */
  72. /**
  73. * XSLT_REFACTORED_VARS:
  74. *
  75. * Internal define to enable the refactored variable part of libxslt
  76. */
  77. #define XSLT_REFACTORED_VARS
  78. #ifdef XSLT_REFACTORED
  79. extern const xmlChar *xsltXSLTAttrMarker;
  80. /* TODO: REMOVE: #define XSLT_REFACTORED_EXCLRESNS */
  81. /* TODO: REMOVE: #define XSLT_REFACTORED_NSALIAS */
  82. /**
  83. * XSLT_REFACTORED_XSLT_NSCOMP
  84. *
  85. * Internal define to enable the pointer-comparison of
  86. * namespaces of XSLT elements.
  87. */
  88. /* #define XSLT_REFACTORED_XSLT_NSCOMP */
  89. #ifdef XSLT_REFACTORED_XSLT_NSCOMP
  90. extern const xmlChar *xsltConstNamespaceNameXSLT;
  91. /**
  92. * IS_XSLT_ELEM_FAST:
  93. *
  94. * quick test to detect XSLT elements
  95. */
  96. #define IS_XSLT_ELEM_FAST(n) \
  97. (((n) != NULL) && ((n)->ns != NULL) && \
  98. ((n)->ns->href == xsltConstNamespaceNameXSLT))
  99. /**
  100. * IS_XSLT_ATTR_FAST:
  101. *
  102. * quick test to detect XSLT attributes
  103. */
  104. #define IS_XSLT_ATTR_FAST(a) \
  105. (((a) != NULL) && ((a)->ns != NULL) && \
  106. ((a)->ns->href == xsltConstNamespaceNameXSLT))
  107. /**
  108. * XSLT_HAS_INTERNAL_NSMAP:
  109. *
  110. * check for namespace mapping
  111. */
  112. #define XSLT_HAS_INTERNAL_NSMAP(s) \
  113. (((s) != NULL) && ((s)->principal) && \
  114. ((s)->principal->principalData) && \
  115. ((s)->principal->principalData->nsMap))
  116. /**
  117. * XSLT_GET_INTERNAL_NSMAP:
  118. *
  119. * get pointer to namespace map
  120. */
  121. #define XSLT_GET_INTERNAL_NSMAP(s) ((s)->principal->principalData->nsMap)
  122. #else /* XSLT_REFACTORED_XSLT_NSCOMP */
  123. /**
  124. * IS_XSLT_ELEM_FAST:
  125. *
  126. * quick check whether this is an xslt element
  127. */
  128. #define IS_XSLT_ELEM_FAST(n) \
  129. (((n) != NULL) && ((n)->ns != NULL) && \
  130. (xmlStrEqual((n)->ns->href, XSLT_NAMESPACE)))
  131. /**
  132. * IS_XSLT_ATTR_FAST:
  133. *
  134. * quick check for xslt namespace attribute
  135. */
  136. #define IS_XSLT_ATTR_FAST(a) \
  137. (((a) != NULL) && ((a)->ns != NULL) && \
  138. (xmlStrEqual((a)->ns->href, XSLT_NAMESPACE)))
  139. #endif /* XSLT_REFACTORED_XSLT_NSCOMP */
  140. /**
  141. * XSLT_REFACTORED_MANDATORY_VERSION:
  142. *
  143. * TODO: Currently disabled to surpress regression test failures, since
  144. * the old behaviour was that a missing version attribute
  145. * produced a only a warning and not an error, which was incerrect.
  146. * So the regression tests need to be fixed if this is enabled.
  147. */
  148. /* #define XSLT_REFACTORED_MANDATORY_VERSION */
  149. /**
  150. * xsltPointerList:
  151. *
  152. * Pointer-list for various purposes.
  153. */
  154. typedef struct _xsltPointerList xsltPointerList;
  155. typedef xsltPointerList *xsltPointerListPtr;
  156. struct _xsltPointerList {
  157. void **items;
  158. int number;
  159. int size;
  160. };
  161. #endif
  162. /**
  163. * XSLT_REFACTORED_PARSING:
  164. *
  165. * Internal define to enable the refactored parts of Libxslt
  166. * related to parsing.
  167. */
  168. /* #define XSLT_REFACTORED_PARSING */
  169. /**
  170. * XSLT_MAX_SORT:
  171. *
  172. * Max number of specified xsl:sort on an element.
  173. */
  174. #define XSLT_MAX_SORT 15
  175. /**
  176. * XSLT_PAT_NO_PRIORITY:
  177. *
  178. * Specific value for pattern without priority expressed.
  179. */
  180. #define XSLT_PAT_NO_PRIORITY -12345789
  181. /**
  182. * xsltRuntimeExtra:
  183. *
  184. * Extra information added to the transformation context.
  185. */
  186. typedef struct _xsltRuntimeExtra xsltRuntimeExtra;
  187. typedef xsltRuntimeExtra *xsltRuntimeExtraPtr;
  188. struct _xsltRuntimeExtra {
  189. void *info; /* pointer to the extra data */
  190. xmlFreeFunc deallocate; /* pointer to the deallocation routine */
  191. union { /* dual-purpose field */
  192. void *ptr; /* data not needing deallocation */
  193. int ival; /* integer value storage */
  194. } val;
  195. };
  196. /**
  197. * XSLT_RUNTIME_EXTRA_LST:
  198. * @ctxt: the transformation context
  199. * @nr: the index
  200. *
  201. * Macro used to access extra information stored in the context
  202. */
  203. #define XSLT_RUNTIME_EXTRA_LST(ctxt, nr) (ctxt)->extras[(nr)].info
  204. /**
  205. * XSLT_RUNTIME_EXTRA_FREE:
  206. * @ctxt: the transformation context
  207. * @nr: the index
  208. *
  209. * Macro used to free extra information stored in the context
  210. */
  211. #define XSLT_RUNTIME_EXTRA_FREE(ctxt, nr) (ctxt)->extras[(nr)].deallocate
  212. /**
  213. * XSLT_RUNTIME_EXTRA:
  214. * @ctxt: the transformation context
  215. * @nr: the index
  216. *
  217. * Macro used to define extra information stored in the context
  218. */
  219. #define XSLT_RUNTIME_EXTRA(ctxt, nr, typ) (ctxt)->extras[(nr)].val.typ
  220. /**
  221. * xsltTemplate:
  222. *
  223. * The in-memory structure corresponding to an XSLT Template.
  224. */
  225. typedef struct _xsltTemplate xsltTemplate;
  226. typedef xsltTemplate *xsltTemplatePtr;
  227. struct _xsltTemplate {
  228. struct _xsltTemplate *next;/* chained list sorted by priority */
  229. struct _xsltStylesheet *style;/* the containing stylesheet */
  230. xmlChar *match; /* the matching string */
  231. float priority; /* as given from the stylesheet, not computed */
  232. const xmlChar *name; /* the local part of the name QName */
  233. const xmlChar *nameURI; /* the URI part of the name QName */
  234. const xmlChar *mode;/* the local part of the mode QName */
  235. const xmlChar *modeURI;/* the URI part of the mode QName */
  236. xmlNodePtr content; /* the template replacement value */
  237. xmlNodePtr elem; /* the source element */
  238. /*
  239. * TODO: @inheritedNsNr and @inheritedNs won't be used in the
  240. * refactored code.
  241. */
  242. int inheritedNsNr; /* number of inherited namespaces */
  243. xmlNsPtr *inheritedNs;/* inherited non-excluded namespaces */
  244. /* Profiling information */
  245. int nbCalls; /* the number of time the template was called */
  246. unsigned long time; /* the time spent in this template */
  247. void *params; /* xsl:param instructions */
  248. int templNr; /* Nb of templates in the stack */
  249. int templMax; /* Size of the templtes stack */
  250. xsltTemplatePtr *templCalledTab; /* templates called */
  251. int *templCountTab; /* .. and how often */
  252. /* Conflict resolution */
  253. int position;
  254. };
  255. /**
  256. * xsltDecimalFormat:
  257. *
  258. * Data structure of decimal-format.
  259. */
  260. typedef struct _xsltDecimalFormat xsltDecimalFormat;
  261. typedef xsltDecimalFormat *xsltDecimalFormatPtr;
  262. struct _xsltDecimalFormat {
  263. struct _xsltDecimalFormat *next; /* chained list */
  264. xmlChar *name;
  265. /* Used for interpretation of pattern */
  266. xmlChar *digit;
  267. xmlChar *patternSeparator;
  268. /* May appear in result */
  269. xmlChar *minusSign;
  270. xmlChar *infinity;
  271. xmlChar *noNumber; /* Not-a-number */
  272. /* Used for interpretation of pattern and may appear in result */
  273. xmlChar *decimalPoint;
  274. xmlChar *grouping;
  275. xmlChar *percent;
  276. xmlChar *permille;
  277. xmlChar *zeroDigit;
  278. const xmlChar *nsUri;
  279. };
  280. /**
  281. * xsltDocument:
  282. *
  283. * Data structure associated to a parsed document.
  284. */
  285. typedef struct _xsltDocument xsltDocument;
  286. typedef xsltDocument *xsltDocumentPtr;
  287. struct _xsltDocument {
  288. struct _xsltDocument *next; /* documents are kept in a chained list */
  289. int main; /* is this the main document */
  290. xmlDocPtr doc; /* the parsed document */
  291. void *keys; /* key tables storage */
  292. struct _xsltDocument *includes; /* subsidiary includes */
  293. int preproc; /* pre-processing already done */
  294. int nbKeysComputed;
  295. };
  296. /**
  297. * xsltKeyDef:
  298. *
  299. * Representation of an xsl:key.
  300. */
  301. typedef struct _xsltKeyDef xsltKeyDef;
  302. typedef xsltKeyDef *xsltKeyDefPtr;
  303. struct _xsltKeyDef {
  304. struct _xsltKeyDef *next;
  305. xmlNodePtr inst;
  306. xmlChar *name;
  307. xmlChar *nameURI;
  308. xmlChar *match;
  309. xmlChar *use;
  310. xmlXPathCompExprPtr comp;
  311. xmlXPathCompExprPtr usecomp;
  312. xmlNsPtr *nsList; /* the namespaces in scope */
  313. int nsNr; /* the number of namespaces in scope */
  314. };
  315. /**
  316. * xsltKeyTable:
  317. *
  318. * Holds the computed keys for key definitions of the same QName.
  319. * Is owned by an xsltDocument.
  320. */
  321. typedef struct _xsltKeyTable xsltKeyTable;
  322. typedef xsltKeyTable *xsltKeyTablePtr;
  323. struct _xsltKeyTable {
  324. struct _xsltKeyTable *next;
  325. xmlChar *name;
  326. xmlChar *nameURI;
  327. xmlHashTablePtr keys;
  328. };
  329. /*
  330. * The in-memory structure corresponding to an XSLT Stylesheet.
  331. * NOTE: most of the content is simply linked from the doc tree
  332. * structure, no specific allocation is made.
  333. */
  334. typedef struct _xsltStylesheet xsltStylesheet;
  335. typedef xsltStylesheet *xsltStylesheetPtr;
  336. typedef struct _xsltTransformContext xsltTransformContext;
  337. typedef xsltTransformContext *xsltTransformContextPtr;
  338. /**
  339. * xsltElemPreComp:
  340. *
  341. * The in-memory structure corresponding to element precomputed data,
  342. * designed to be extended by extension implementors.
  343. */
  344. typedef struct _xsltElemPreComp xsltElemPreComp;
  345. typedef xsltElemPreComp *xsltElemPreCompPtr;
  346. /**
  347. * xsltTransformFunction:
  348. * @ctxt: the XSLT transformation context
  349. * @node: the input node
  350. * @inst: the stylesheet node
  351. * @comp: the compiled information from the stylesheet
  352. *
  353. * Signature of the function associated to elements part of the
  354. * stylesheet language like xsl:if or xsl:apply-templates.
  355. */
  356. typedef void (*xsltTransformFunction) (xsltTransformContextPtr ctxt,
  357. xmlNodePtr node,
  358. xmlNodePtr inst,
  359. xsltElemPreCompPtr comp);
  360. /**
  361. * xsltSortFunc:
  362. * @ctxt: a transformation context
  363. * @sorts: the node-set to sort
  364. * @nbsorts: the number of sorts
  365. *
  366. * Signature of the function to use during sorting
  367. */
  368. typedef void (*xsltSortFunc) (xsltTransformContextPtr ctxt, xmlNodePtr *sorts,
  369. int nbsorts);
  370. typedef enum {
  371. XSLT_FUNC_COPY=1,
  372. XSLT_FUNC_SORT,
  373. XSLT_FUNC_TEXT,
  374. XSLT_FUNC_ELEMENT,
  375. XSLT_FUNC_ATTRIBUTE,
  376. XSLT_FUNC_COMMENT,
  377. XSLT_FUNC_PI,
  378. XSLT_FUNC_COPYOF,
  379. XSLT_FUNC_VALUEOF,
  380. XSLT_FUNC_NUMBER,
  381. XSLT_FUNC_APPLYIMPORTS,
  382. XSLT_FUNC_CALLTEMPLATE,
  383. XSLT_FUNC_APPLYTEMPLATES,
  384. XSLT_FUNC_CHOOSE,
  385. XSLT_FUNC_IF,
  386. XSLT_FUNC_FOREACH,
  387. XSLT_FUNC_DOCUMENT,
  388. XSLT_FUNC_WITHPARAM,
  389. XSLT_FUNC_PARAM,
  390. XSLT_FUNC_VARIABLE,
  391. XSLT_FUNC_WHEN,
  392. XSLT_FUNC_EXTENSION
  393. #ifdef XSLT_REFACTORED
  394. ,
  395. XSLT_FUNC_OTHERWISE,
  396. XSLT_FUNC_FALLBACK,
  397. XSLT_FUNC_MESSAGE,
  398. XSLT_FUNC_INCLUDE,
  399. XSLT_FUNC_ATTRSET,
  400. XSLT_FUNC_LITERAL_RESULT_ELEMENT,
  401. XSLT_FUNC_UNKOWN_FORWARDS_COMPAT
  402. #endif
  403. } xsltStyleType;
  404. /**
  405. * xsltElemPreCompDeallocator:
  406. * @comp: the #xsltElemPreComp to free up
  407. *
  408. * Deallocates an #xsltElemPreComp structure.
  409. */
  410. typedef void (*xsltElemPreCompDeallocator) (xsltElemPreCompPtr comp);
  411. /**
  412. * xsltElemPreComp:
  413. *
  414. * The basic structure for compiled items of the AST of the XSLT processor.
  415. * This structure is also intended to be extended by extension implementors.
  416. * TODO: This is somehow not nice, since it has a "free" field, which
  417. * derived stylesheet-structs do not have.
  418. */
  419. struct _xsltElemPreComp {
  420. xsltElemPreCompPtr next; /* next item in the global chained
  421. list held by xsltStylesheet. */
  422. xsltStyleType type; /* type of the element */
  423. xsltTransformFunction func; /* handling function */
  424. xmlNodePtr inst; /* the node in the stylesheet's tree
  425. corresponding to this item */
  426. /* end of common part */
  427. xsltElemPreCompDeallocator free; /* the deallocator */
  428. };
  429. /**
  430. * xsltStylePreComp:
  431. *
  432. * The abstract basic structure for items of the XSLT processor.
  433. * This includes:
  434. * 1) compiled forms of XSLT instructions (xsl:if, xsl:attribute, etc.)
  435. * 2) compiled forms of literal result elements
  436. * 3) compiled forms of extension elements
  437. */
  438. typedef struct _xsltStylePreComp xsltStylePreComp;
  439. typedef xsltStylePreComp *xsltStylePreCompPtr;
  440. #ifdef XSLT_REFACTORED
  441. /*
  442. * Some pointer-list utility functions.
  443. */
  444. XSLTPUBFUN xsltPointerListPtr XSLTCALL
  445. xsltPointerListCreate (int initialSize);
  446. XSLTPUBFUN void XSLTCALL
  447. xsltPointerListFree (xsltPointerListPtr list);
  448. XSLTPUBFUN void XSLTCALL
  449. xsltPointerListClear (xsltPointerListPtr list);
  450. XSLTPUBFUN int XSLTCALL
  451. xsltPointerListAddSize (xsltPointerListPtr list,
  452. void *item,
  453. int initialSize);
  454. /************************************************************************
  455. * *
  456. * Refactored structures *
  457. * *
  458. ************************************************************************/
  459. typedef struct _xsltNsListContainer xsltNsListContainer;
  460. typedef xsltNsListContainer *xsltNsListContainerPtr;
  461. struct _xsltNsListContainer {
  462. xmlNsPtr *list;
  463. int totalNumber;
  464. int xpathNumber;
  465. };
  466. /**
  467. * XSLT_ITEM_COMPATIBILITY_FIELDS:
  468. *
  469. * Fields for API compatibility to the structure
  470. * _xsltElemPreComp which is used for extension functions.
  471. * Note that @next is used for storage; it does not reflect a next
  472. * sibling in the tree.
  473. * TODO: Evaluate if we really need such a compatibility.
  474. */
  475. #define XSLT_ITEM_COMPATIBILITY_FIELDS \
  476. xsltElemPreCompPtr next;\
  477. xsltStyleType type;\
  478. xsltTransformFunction func;\
  479. xmlNodePtr inst;
  480. /**
  481. * XSLT_ITEM_NAVIGATION_FIELDS:
  482. *
  483. * Currently empty.
  484. * TODO: It is intended to hold navigational fields in the future.
  485. */
  486. #define XSLT_ITEM_NAVIGATION_FIELDS
  487. /*
  488. xsltStylePreCompPtr parent;\
  489. xsltStylePreCompPtr children;\
  490. xsltStylePreCompPtr nextItem;
  491. */
  492. /**
  493. * XSLT_ITEM_NSINSCOPE_FIELDS:
  494. *
  495. * The in-scope namespaces.
  496. */
  497. #define XSLT_ITEM_NSINSCOPE_FIELDS xsltNsListContainerPtr inScopeNs;
  498. /**
  499. * XSLT_ITEM_COMMON_FIELDS:
  500. *
  501. * Common fields used for all items.
  502. */
  503. #define XSLT_ITEM_COMMON_FIELDS \
  504. XSLT_ITEM_COMPATIBILITY_FIELDS \
  505. XSLT_ITEM_NAVIGATION_FIELDS \
  506. XSLT_ITEM_NSINSCOPE_FIELDS
  507. /**
  508. * _xsltStylePreComp:
  509. *
  510. * The abstract basic structure for items of the XSLT processor.
  511. * This includes:
  512. * 1) compiled forms of XSLT instructions (e.g. xsl:if, xsl:attribute, etc.)
  513. * 2) compiled forms of literal result elements
  514. * 3) various properties for XSLT instructions (e.g. xsl:when,
  515. * xsl:with-param)
  516. *
  517. * REVISIT TODO: Keep this structure equal to the fields
  518. * defined by XSLT_ITEM_COMMON_FIELDS
  519. */
  520. struct _xsltStylePreComp {
  521. xsltElemPreCompPtr next; /* next item in the global chained
  522. list held by xsltStylesheet */
  523. xsltStyleType type; /* type of the item */
  524. xsltTransformFunction func; /* handling function */
  525. xmlNodePtr inst; /* the node in the stylesheet's tree
  526. corresponding to this item. */
  527. /* Currently no navigational fields. */
  528. xsltNsListContainerPtr inScopeNs;
  529. };
  530. /**
  531. * xsltStyleBasicEmptyItem:
  532. *
  533. * Abstract structure only used as a short-cut for
  534. * XSLT items with no extra fields.
  535. * NOTE that it is intended that this structure looks the same as
  536. * _xsltStylePreComp.
  537. */
  538. typedef struct _xsltStyleBasicEmptyItem xsltStyleBasicEmptyItem;
  539. typedef xsltStyleBasicEmptyItem *xsltStyleBasicEmptyItemPtr;
  540. struct _xsltStyleBasicEmptyItem {
  541. XSLT_ITEM_COMMON_FIELDS
  542. };
  543. /**
  544. * xsltStyleBasicExpressionItem:
  545. *
  546. * Abstract structure only used as a short-cut for
  547. * XSLT items with just an expression.
  548. */
  549. typedef struct _xsltStyleBasicExpressionItem xsltStyleBasicExpressionItem;
  550. typedef xsltStyleBasicExpressionItem *xsltStyleBasicExpressionItemPtr;
  551. struct _xsltStyleBasicExpressionItem {
  552. XSLT_ITEM_COMMON_FIELDS
  553. const xmlChar *select; /* TODO: Change this to "expression". */
  554. xmlXPathCompExprPtr comp; /* TODO: Change this to compExpr. */
  555. };
  556. /************************************************************************
  557. * *
  558. * XSLT-instructions/declarations *
  559. * *
  560. ************************************************************************/
  561. /**
  562. * xsltStyleItemElement:
  563. *
  564. * <!-- Category: instruction -->
  565. * <xsl:element
  566. * name = { qname }
  567. * namespace = { uri-reference }
  568. * use-attribute-sets = qnames>
  569. * <!-- Content: template -->
  570. * </xsl:element>
  571. */
  572. typedef struct _xsltStyleItemElement xsltStyleItemElement;
  573. typedef xsltStyleItemElement *xsltStyleItemElementPtr;
  574. struct _xsltStyleItemElement {
  575. XSLT_ITEM_COMMON_FIELDS
  576. const xmlChar *use;
  577. int has_use;
  578. const xmlChar *name;
  579. int has_name;
  580. const xmlChar *ns;
  581. const xmlChar *nsPrefix;
  582. int has_ns;
  583. };
  584. /**
  585. * xsltStyleItemAttribute:
  586. *
  587. * <!-- Category: instruction -->
  588. * <xsl:attribute
  589. * name = { qname }
  590. * namespace = { uri-reference }>
  591. * <!-- Content: template -->
  592. * </xsl:attribute>
  593. */
  594. typedef struct _xsltStyleItemAttribute xsltStyleItemAttribute;
  595. typedef xsltStyleItemAttribute *xsltStyleItemAttributePtr;
  596. struct _xsltStyleItemAttribute {
  597. XSLT_ITEM_COMMON_FIELDS
  598. const xmlChar *name;
  599. int has_name;
  600. const xmlChar *ns;
  601. const xmlChar *nsPrefix;
  602. int has_ns;
  603. };
  604. /**
  605. * xsltStyleItemText:
  606. *
  607. * <!-- Category: instruction -->
  608. * <xsl:text
  609. * disable-output-escaping = "yes" | "no">
  610. * <!-- Content: #PCDATA -->
  611. * </xsl:text>
  612. */
  613. typedef struct _xsltStyleItemText xsltStyleItemText;
  614. typedef xsltStyleItemText *xsltStyleItemTextPtr;
  615. struct _xsltStyleItemText {
  616. XSLT_ITEM_COMMON_FIELDS
  617. int noescape; /* text */
  618. };
  619. /**
  620. * xsltStyleItemComment:
  621. *
  622. * <!-- Category: instruction -->
  623. * <xsl:comment>
  624. * <!-- Content: template -->
  625. * </xsl:comment>
  626. */
  627. typedef xsltStyleBasicEmptyItem xsltStyleItemComment;
  628. typedef xsltStyleItemComment *xsltStyleItemCommentPtr;
  629. /**
  630. * xsltStyleItemPI:
  631. *
  632. * <!-- Category: instruction -->
  633. * <xsl:processing-instruction
  634. * name = { ncname }>
  635. * <!-- Content: template -->
  636. * </xsl:processing-instruction>
  637. */
  638. typedef struct _xsltStyleItemPI xsltStyleItemPI;
  639. typedef xsltStyleItemPI *xsltStyleItemPIPtr;
  640. struct _xsltStyleItemPI {
  641. XSLT_ITEM_COMMON_FIELDS
  642. const xmlChar *name;
  643. int has_name;
  644. };
  645. /**
  646. * xsltStyleItemApplyImports:
  647. *
  648. * <!-- Category: instruction -->
  649. * <xsl:apply-imports />
  650. */
  651. typedef xsltStyleBasicEmptyItem xsltStyleItemApplyImports;
  652. typedef xsltStyleItemApplyImports *xsltStyleItemApplyImportsPtr;
  653. /**
  654. * xsltStyleItemApplyTemplates:
  655. *
  656. * <!-- Category: instruction -->
  657. * <xsl:apply-templates
  658. * select = node-set-expression
  659. * mode = qname>
  660. * <!-- Content: (xsl:sort | xsl:with-param)* -->
  661. * </xsl:apply-templates>
  662. */
  663. typedef struct _xsltStyleItemApplyTemplates xsltStyleItemApplyTemplates;
  664. typedef xsltStyleItemApplyTemplates *xsltStyleItemApplyTemplatesPtr;
  665. struct _xsltStyleItemApplyTemplates {
  666. XSLT_ITEM_COMMON_FIELDS
  667. const xmlChar *mode; /* apply-templates */
  668. const xmlChar *modeURI; /* apply-templates */
  669. const xmlChar *select; /* sort, copy-of, value-of, apply-templates */
  670. xmlXPathCompExprPtr comp; /* a precompiled XPath expression */
  671. /* TODO: with-params */
  672. };
  673. /**
  674. * xsltStyleItemCallTemplate:
  675. *
  676. * <!-- Category: instruction -->
  677. * <xsl:call-template
  678. * name = qname>
  679. * <!-- Content: xsl:with-param* -->
  680. * </xsl:call-template>
  681. */
  682. typedef struct _xsltStyleItemCallTemplate xsltStyleItemCallTemplate;
  683. typedef xsltStyleItemCallTemplate *xsltStyleItemCallTemplatePtr;
  684. struct _xsltStyleItemCallTemplate {
  685. XSLT_ITEM_COMMON_FIELDS
  686. xsltTemplatePtr templ; /* call-template */
  687. const xmlChar *name; /* element, attribute, pi */
  688. int has_name; /* element, attribute, pi */
  689. const xmlChar *ns; /* element */
  690. int has_ns; /* element */
  691. /* TODO: with-params */
  692. };
  693. /**
  694. * xsltStyleItemCopy:
  695. *
  696. * <!-- Category: instruction -->
  697. * <xsl:copy
  698. * use-attribute-sets = qnames>
  699. * <!-- Content: template -->
  700. * </xsl:copy>
  701. */
  702. typedef struct _xsltStyleItemCopy xsltStyleItemCopy;
  703. typedef xsltStyleItemCopy *xsltStyleItemCopyPtr;
  704. struct _xsltStyleItemCopy {
  705. XSLT_ITEM_COMMON_FIELDS
  706. const xmlChar *use; /* copy, element */
  707. int has_use; /* copy, element */
  708. };
  709. /**
  710. * xsltStyleItemIf:
  711. *
  712. * <!-- Category: instruction -->
  713. * <xsl:if
  714. * test = boolean-expression>
  715. * <!-- Content: template -->
  716. * </xsl:if>
  717. */
  718. typedef struct _xsltStyleItemIf xsltStyleItemIf;
  719. typedef xsltStyleItemIf *xsltStyleItemIfPtr;
  720. struct _xsltStyleItemIf {
  721. XSLT_ITEM_COMMON_FIELDS
  722. const xmlChar *test; /* if */
  723. xmlXPathCompExprPtr comp; /* a precompiled XPath expression */
  724. };
  725. /**
  726. * xsltStyleItemCopyOf:
  727. *
  728. * <!-- Category: instruction -->
  729. * <xsl:copy-of
  730. * select = expression />
  731. */
  732. typedef xsltStyleBasicExpressionItem xsltStyleItemCopyOf;
  733. typedef xsltStyleItemCopyOf *xsltStyleItemCopyOfPtr;
  734. /**
  735. * xsltStyleItemValueOf:
  736. *
  737. * <!-- Category: instruction -->
  738. * <xsl:value-of
  739. * select = string-expression
  740. * disable-output-escaping = "yes" | "no" />
  741. */
  742. typedef struct _xsltStyleItemValueOf xsltStyleItemValueOf;
  743. typedef xsltStyleItemValueOf *xsltStyleItemValueOfPtr;
  744. struct _xsltStyleItemValueOf {
  745. XSLT_ITEM_COMMON_FIELDS
  746. const xmlChar *select;
  747. xmlXPathCompExprPtr comp; /* a precompiled XPath expression */
  748. int noescape;
  749. };
  750. /**
  751. * xsltStyleItemNumber:
  752. *
  753. * <!-- Category: instruction -->
  754. * <xsl:number
  755. * level = "single" | "multiple" | "any"
  756. * count = pattern
  757. * from = pattern
  758. * value = number-expression
  759. * format = { string }
  760. * lang = { nmtoken }
  761. * letter-value = { "alphabetic" | "traditional" }
  762. * grouping-separator = { char }
  763. * grouping-size = { number } />
  764. */
  765. typedef struct _xsltStyleItemNumber xsltStyleItemNumber;
  766. typedef xsltStyleItemNumber *xsltStyleItemNumberPtr;
  767. struct _xsltStyleItemNumber {
  768. XSLT_ITEM_COMMON_FIELDS
  769. xsltNumberData numdata; /* number */
  770. };
  771. /**
  772. * xsltStyleItemChoose:
  773. *
  774. * <!-- Category: instruction -->
  775. * <xsl:choose>
  776. * <!-- Content: (xsl:when+, xsl:otherwise?) -->
  777. * </xsl:choose>
  778. */
  779. typedef xsltStyleBasicEmptyItem xsltStyleItemChoose;
  780. typedef xsltStyleItemChoose *xsltStyleItemChoosePtr;
  781. /**
  782. * xsltStyleItemFallback:
  783. *
  784. * <!-- Category: instruction -->
  785. * <xsl:fallback>
  786. * <!-- Content: template -->
  787. * </xsl:fallback>
  788. */
  789. typedef xsltStyleBasicEmptyItem xsltStyleItemFallback;
  790. typedef xsltStyleItemFallback *xsltStyleItemFallbackPtr;
  791. /**
  792. * xsltStyleItemForEach:
  793. *
  794. * <!-- Category: instruction -->
  795. * <xsl:for-each
  796. * select = node-set-expression>
  797. * <!-- Content: (xsl:sort*, template) -->
  798. * </xsl:for-each>
  799. */
  800. typedef xsltStyleBasicExpressionItem xsltStyleItemForEach;
  801. typedef xsltStyleItemForEach *xsltStyleItemForEachPtr;
  802. /**
  803. * xsltStyleItemMessage:
  804. *
  805. * <!-- Category: instruction -->
  806. * <xsl:message
  807. * terminate = "yes" | "no">
  808. * <!-- Content: template -->
  809. * </xsl:message>
  810. */
  811. typedef struct _xsltStyleItemMessage xsltStyleItemMessage;
  812. typedef xsltStyleItemMessage *xsltStyleItemMessagePtr;
  813. struct _xsltStyleItemMessage {
  814. XSLT_ITEM_COMMON_FIELDS
  815. int terminate;
  816. };
  817. /**
  818. * xsltStyleItemDocument:
  819. *
  820. * NOTE: This is not an instruction of XSLT 1.0.
  821. */
  822. typedef struct _xsltStyleItemDocument xsltStyleItemDocument;
  823. typedef xsltStyleItemDocument *xsltStyleItemDocumentPtr;
  824. struct _xsltStyleItemDocument {
  825. XSLT_ITEM_COMMON_FIELDS
  826. int ver11; /* assigned: in xsltDocumentComp;
  827. read: nowhere;
  828. TODO: Check if we need. */
  829. const xmlChar *filename; /* document URL */
  830. int has_filename;
  831. };
  832. /************************************************************************
  833. * *
  834. * Non-instructions (actually properties of instructions/declarations) *
  835. * *
  836. ************************************************************************/
  837. /**
  838. * xsltStyleBasicItemVariable:
  839. *
  840. * Basic struct for xsl:variable, xsl:param and xsl:with-param.
  841. * It's currently important to have equal fields, since
  842. * xsltParseStylesheetCallerParam() is used with xsl:with-param from
  843. * the xslt side and with xsl:param from the exslt side (in
  844. * exsltFuncFunctionFunction()).
  845. *
  846. * FUTURE NOTE: In XSLT 2.0 xsl:param, xsl:variable and xsl:with-param
  847. * have additional different fields.
  848. */
  849. typedef struct _xsltStyleBasicItemVariable xsltStyleBasicItemVariable;
  850. typedef xsltStyleBasicItemVariable *xsltStyleBasicItemVariablePtr;
  851. struct _xsltStyleBasicItemVariable {
  852. XSLT_ITEM_COMMON_FIELDS
  853. const xmlChar *select;
  854. xmlXPathCompExprPtr comp;
  855. const xmlChar *name;
  856. int has_name;
  857. const xmlChar *ns;
  858. int has_ns;
  859. };
  860. /**
  861. * xsltStyleItemVariable:
  862. *
  863. * <!-- Category: top-level-element -->
  864. * <xsl:param
  865. * name = qname
  866. * select = expression>
  867. * <!-- Content: template -->
  868. * </xsl:param>
  869. */
  870. typedef xsltStyleBasicItemVariable xsltStyleItemVariable;
  871. typedef xsltStyleItemVariable *xsltStyleItemVariablePtr;
  872. /**
  873. * xsltStyleItemParam:
  874. *
  875. * <!-- Category: top-level-element -->
  876. * <xsl:param
  877. * name = qname
  878. * select = expression>
  879. * <!-- Content: template -->
  880. * </xsl:param>
  881. */
  882. typedef struct _xsltStyleItemParam xsltStyleItemParam;
  883. typedef xsltStyleItemParam *xsltStyleItemParamPtr;
  884. struct _xsltStyleItemParam {
  885. XSLT_ITEM_COMMON_FIELDS
  886. const xmlChar *select;
  887. xmlXPathCompExprPtr comp;
  888. const xmlChar *name;
  889. int has_name;
  890. const xmlChar *ns;
  891. int has_ns;
  892. };
  893. /**
  894. * xsltStyleItemWithParam:
  895. *
  896. * <xsl:with-param
  897. * name = qname
  898. * select = expression>
  899. * <!-- Content: template -->
  900. * </xsl:with-param>
  901. */
  902. typedef xsltStyleBasicItemVariable xsltStyleItemWithParam;
  903. typedef xsltStyleItemWithParam *xsltStyleItemWithParamPtr;
  904. /**
  905. * xsltStyleItemSort:
  906. *
  907. * Reflects the XSLT xsl:sort item.
  908. * Allowed parents: xsl:apply-templates, xsl:for-each
  909. * <xsl:sort
  910. * select = string-expression
  911. * lang = { nmtoken }
  912. * data-type = { "text" | "number" | qname-but-not-ncname }
  913. * order = { "ascending" | "descending" }
  914. * case-order = { "upper-first" | "lower-first" } />
  915. */
  916. typedef struct _xsltStyleItemSort xsltStyleItemSort;
  917. typedef xsltStyleItemSort *xsltStyleItemSortPtr;
  918. struct _xsltStyleItemSort {
  919. XSLT_ITEM_COMMON_FIELDS
  920. const xmlChar *stype; /* sort */
  921. int has_stype; /* sort */
  922. int number; /* sort */
  923. const xmlChar *order; /* sort */
  924. int has_order; /* sort */
  925. int descending; /* sort */
  926. const xmlChar *lang; /* sort */
  927. int has_lang; /* sort */
  928. xsltLocale locale; /* sort */
  929. const xmlChar *case_order; /* sort */
  930. int lower_first; /* sort */
  931. const xmlChar *use;
  932. int has_use;
  933. const xmlChar *select; /* sort, copy-of, value-of, apply-templates */
  934. xmlXPathCompExprPtr comp; /* a precompiled XPath expression */
  935. };
  936. /**
  937. * xsltStyleItemWhen:
  938. *
  939. * <xsl:when
  940. * test = boolean-expression>
  941. * <!-- Content: template -->
  942. * </xsl:when>
  943. * Allowed parent: xsl:choose
  944. */
  945. typedef struct _xsltStyleItemWhen xsltStyleItemWhen;
  946. typedef xsltStyleItemWhen *xsltStyleItemWhenPtr;
  947. struct _xsltStyleItemWhen {
  948. XSLT_ITEM_COMMON_FIELDS
  949. const xmlChar *test;
  950. xmlXPathCompExprPtr comp;
  951. };
  952. /**
  953. * xsltStyleItemOtherwise:
  954. *
  955. * Allowed parent: xsl:choose
  956. * <xsl:otherwise>
  957. * <!-- Content: template -->
  958. * </xsl:otherwise>
  959. */
  960. typedef struct _xsltStyleItemOtherwise xsltStyleItemOtherwise;
  961. typedef xsltStyleItemOtherwise *xsltStyleItemOtherwisePtr;
  962. struct _xsltStyleItemOtherwise {
  963. XSLT_ITEM_COMMON_FIELDS
  964. };
  965. typedef struct _xsltStyleItemInclude xsltStyleItemInclude;
  966. typedef xsltStyleItemInclude *xsltStyleItemIncludePtr;
  967. struct _xsltStyleItemInclude {
  968. XSLT_ITEM_COMMON_FIELDS
  969. xsltDocumentPtr include;
  970. };
  971. /************************************************************************
  972. * *
  973. * XSLT elements in forwards-compatible mode *
  974. * *
  975. ************************************************************************/
  976. typedef struct _xsltStyleItemUknown xsltStyleItemUknown;
  977. typedef xsltStyleItemUknown *xsltStyleItemUknownPtr;
  978. struct _xsltStyleItemUknown {
  979. XSLT_ITEM_COMMON_FIELDS
  980. };
  981. /************************************************************************
  982. * *
  983. * Extension elements *
  984. * *
  985. ************************************************************************/
  986. /*
  987. * xsltStyleItemExtElement:
  988. *
  989. * Reflects extension elements.
  990. *
  991. * NOTE: Due to the fact that the structure xsltElemPreComp is most
  992. * probably already heavily in use out there by users, so we cannot
  993. * easily change it, we'll create an intermediate structure which will
  994. * hold an xsltElemPreCompPtr.
  995. * BIG NOTE: The only problem I see here is that the user processes the
  996. * content of the stylesheet tree, possibly he'll lookup the node->psvi
  997. * fields in order to find subsequent extension functions.
  998. * In this case, the user's code will break, since the node->psvi
  999. * field will hold now the xsltStyleItemExtElementPtr and not
  1000. * the xsltElemPreCompPtr.
  1001. * However the place where the structure is anchored in the node-tree,
  1002. * namely node->psvi, has beed already once been moved from node->_private
  1003. * to node->psvi, so we have a precedent here, which, I think, should allow
  1004. * us to change such semantics without headaches.
  1005. */
  1006. typedef struct _xsltStyleItemExtElement xsltStyleItemExtElement;
  1007. typedef xsltStyleItemExtElement *xsltStyleItemExtElementPtr;
  1008. struct _xsltStyleItemExtElement {
  1009. XSLT_ITEM_COMMON_FIELDS
  1010. xsltElemPreCompPtr item;
  1011. };
  1012. /************************************************************************
  1013. * *
  1014. * Literal result elements *
  1015. * *
  1016. ************************************************************************/
  1017. typedef struct _xsltEffectiveNs xsltEffectiveNs;
  1018. typedef xsltEffectiveNs *xsltEffectiveNsPtr;
  1019. struct _xsltEffectiveNs {
  1020. xsltEffectiveNsPtr nextInStore; /* storage next */
  1021. xsltEffectiveNsPtr next; /* next item in the list */
  1022. const xmlChar *prefix;
  1023. const xmlChar *nsName;
  1024. /*
  1025. * Indicates if eclared on the literal result element; dunno if really
  1026. * needed.
  1027. */
  1028. int holdByElem;
  1029. };
  1030. /*
  1031. * Info for literal result elements.
  1032. * This will be set on the elem->psvi field and will be
  1033. * shared by literal result elements, which have the same
  1034. * excluded result namespaces; i.e., this *won't* be created uniquely
  1035. * for every literal result element.
  1036. */
  1037. typedef struct _xsltStyleItemLRElementInfo xsltStyleItemLRElementInfo;
  1038. typedef xsltStyleItemLRElementInfo *xsltStyleItemLRElementInfoPtr;
  1039. struct _xsltStyleItemLRElementInfo {
  1040. XSLT_ITEM_COMMON_FIELDS
  1041. /*
  1042. * @effectiveNs is the set of effective ns-nodes
  1043. * on the literal result element, which will be added to the result
  1044. * element if not already existing in the result tree.
  1045. * This means that excluded namespaces (via exclude-result-prefixes,
  1046. * extension-element-prefixes and the XSLT namespace) not added
  1047. * to the set.
  1048. * Namespace-aliasing was applied on the @effectiveNs.
  1049. */
  1050. xsltEffectiveNsPtr effectiveNs;
  1051. };
  1052. #ifdef XSLT_REFACTORED
  1053. typedef struct _xsltNsAlias xsltNsAlias;
  1054. typedef xsltNsAlias *xsltNsAliasPtr;
  1055. struct _xsltNsAlias {
  1056. xsltNsAliasPtr next; /* next in the list */
  1057. xmlNsPtr literalNs;
  1058. xmlNsPtr targetNs;
  1059. xmlDocPtr docOfTargetNs;
  1060. };
  1061. #endif
  1062. #ifdef XSLT_REFACTORED_XSLT_NSCOMP
  1063. typedef struct _xsltNsMap xsltNsMap;
  1064. typedef xsltNsMap *xsltNsMapPtr;
  1065. struct _xsltNsMap {
  1066. xsltNsMapPtr next; /* next in the list */
  1067. xmlDocPtr doc;
  1068. xmlNodePtr elem; /* the element holding the ns-decl */
  1069. xmlNsPtr ns; /* the xmlNs structure holding the XML namespace name */
  1070. const xmlChar *origNsName; /* the original XML namespace name */
  1071. const xmlChar *newNsName; /* the mapped XML namespace name */
  1072. };
  1073. #endif
  1074. /************************************************************************
  1075. * *
  1076. * Compile-time structures for *internal* use only *
  1077. * *
  1078. ************************************************************************/
  1079. typedef struct _xsltPrincipalStylesheetData xsltPrincipalStylesheetData;
  1080. typedef xsltPrincipalStylesheetData *xsltPrincipalStylesheetDataPtr;
  1081. typedef struct _xsltNsList xsltNsList;
  1082. typedef xsltNsList *xsltNsListPtr;
  1083. struct _xsltNsList {
  1084. xsltNsListPtr next; /* next in the list */
  1085. xmlNsPtr ns;
  1086. };
  1087. /*
  1088. * xsltVarInfo:
  1089. *
  1090. * Used at compilation time for parameters and variables.
  1091. */
  1092. typedef struct _xsltVarInfo xsltVarInfo;
  1093. typedef xsltVarInfo *xsltVarInfoPtr;
  1094. struct _xsltVarInfo {
  1095. xsltVarInfoPtr next; /* next in the list */
  1096. xsltVarInfoPtr prev;
  1097. int depth; /* the depth in the tree */
  1098. const xmlChar *name;
  1099. const xmlChar *nsName;
  1100. };
  1101. /**
  1102. * xsltCompilerNodeInfo:
  1103. *
  1104. * Per-node information during compile-time.
  1105. */
  1106. typedef struct _xsltCompilerNodeInfo xsltCompilerNodeInfo;
  1107. typedef xsltCompilerNodeInfo *xsltCompilerNodeInfoPtr;
  1108. struct _xsltCompilerNodeInfo {
  1109. xsltCompilerNodeInfoPtr next;
  1110. xsltCompilerNodeInfoPtr prev;
  1111. xmlNodePtr node;
  1112. int depth;
  1113. xsltTemplatePtr templ; /* The owning template */
  1114. int category; /* XSLT element, LR-element or
  1115. extension element */
  1116. xsltStyleType type;
  1117. xsltElemPreCompPtr item; /* The compiled information */
  1118. /* The current in-scope namespaces */
  1119. xsltNsListContainerPtr inScopeNs;
  1120. /* The current excluded result namespaces */
  1121. xsltPointerListPtr exclResultNs;
  1122. /* The current extension instruction namespaces */
  1123. xsltPointerListPtr extElemNs;
  1124. /* The current info for literal result elements. */
  1125. xsltStyleItemLRElementInfoPtr litResElemInfo;
  1126. /*
  1127. * Set to 1 if in-scope namespaces changed,
  1128. * or excluded result namespaces changed,
  1129. * or extension element namespaces changed.
  1130. * This will trigger creation of new infos
  1131. * for literal result elements.
  1132. */
  1133. int nsChanged;
  1134. int preserveWhitespace;
  1135. int stripWhitespace;
  1136. int isRoot; /* whether this is the stylesheet's root node */
  1137. int forwardsCompat; /* whether forwards-compatible mode is enabled */
  1138. /* whether the content of an extension element was processed */
  1139. int extContentHandled;
  1140. /* the type of the current child */
  1141. xsltStyleType curChildType;
  1142. };
  1143. /**
  1144. * XSLT_CCTXT:
  1145. *
  1146. * get pointer to compiler context
  1147. */
  1148. #define XSLT_CCTXT(style) ((xsltCompilerCtxtPtr) style->compCtxt)
  1149. typedef enum {
  1150. XSLT_ERROR_SEVERITY_ERROR = 0,
  1151. XSLT_ERROR_SEVERITY_WARNING
  1152. } xsltErrorSeverityType;
  1153. typedef struct _xsltCompilerCtxt xsltCompilerCtxt;
  1154. typedef xsltCompilerCtxt *xsltCompilerCtxtPtr;
  1155. struct _xsltCompilerCtxt {
  1156. void *errorCtxt; /* user specific error context */
  1157. /*
  1158. * used for error/warning reports; e.g. XSLT_ERROR_SEVERITY_WARNING */
  1159. xsltErrorSeverityType errSeverity;
  1160. int warnings; /* TODO: number of warnings found at
  1161. compilation */
  1162. int errors; /* TODO: number of errors found at
  1163. compilation */
  1164. xmlDictPtr dict;
  1165. xsltStylesheetPtr style;
  1166. int simplified; /* whether this is a simplified stylesheet */
  1167. /* TODO: structured/unstructured error contexts. */
  1168. int depth; /* Current depth of processing */
  1169. xsltCompilerNodeInfoPtr inode;
  1170. xsltCompilerNodeInfoPtr inodeList;
  1171. xsltCompilerNodeInfoPtr inodeLast;
  1172. xsltPointerListPtr tmpList; /* Used for various purposes */
  1173. /*
  1174. * The XSLT version as specified by the stylesheet's root element.
  1175. */
  1176. int isInclude;
  1177. int hasForwardsCompat; /* whether forwards-compatible mode was used
  1178. in a parsing episode */
  1179. int maxNodeInfos; /* TEMP TODO: just for the interest */
  1180. int maxLREs; /* TEMP TODO: just for the interest */
  1181. /*
  1182. * In order to keep the old behaviour, applying strict rules of
  1183. * the spec can be turned off. This has effect only on special
  1184. * mechanisms like whitespace-stripping in the stylesheet.
  1185. */
  1186. int strict;
  1187. xsltPrincipalStylesheetDataPtr psData;
  1188. xsltStyleItemUknownPtr unknownItem;
  1189. int hasNsAliases; /* Indicator if there was an xsl:namespace-alias. */
  1190. xsltNsAliasPtr nsAliases;
  1191. xsltVarInfoPtr ivars; /* Storage of local in-scope variables/params. */
  1192. xsltVarInfoPtr ivar; /* topmost local variable/param. */
  1193. };
  1194. #else /* XSLT_REFACTORED */
  1195. /*
  1196. * The old structures before refactoring.
  1197. */
  1198. /**
  1199. * _xsltStylePreComp:
  1200. *
  1201. * The in-memory structure corresponding to XSLT stylesheet constructs
  1202. * precomputed data.
  1203. */
  1204. struct _xsltStylePreComp {
  1205. xsltElemPreCompPtr next; /* chained list */
  1206. xsltStyleType type; /* type of the element */
  1207. xsltTransformFunction func; /* handling function */
  1208. xmlNodePtr inst; /* the instruction */
  1209. /*
  1210. * Pre computed values.
  1211. */
  1212. const xmlChar *stype; /* sort */
  1213. int has_stype; /* sort */
  1214. int number; /* sort */
  1215. const xmlChar *order; /* sort */
  1216. int has_order; /* sort */
  1217. int descending; /* sort */
  1218. const xmlChar *lang; /* sort */
  1219. int has_lang; /* sort */
  1220. xsltLocale locale; /* sort */
  1221. const xmlChar *case_order; /* sort */
  1222. int lower_first; /* sort */
  1223. const xmlChar *use; /* copy, element */
  1224. int has_use; /* copy, element */
  1225. int noescape; /* text */
  1226. const xmlChar *name; /* element, attribute, pi */
  1227. int has_name; /* element, attribute, pi */
  1228. const xmlChar *ns; /* element */
  1229. int has_ns; /* element */
  1230. const xmlChar *mode; /* apply-templates */
  1231. const xmlChar *modeURI; /* apply-templates */
  1232. const xmlChar *test; /* if */
  1233. xsltTemplatePtr templ; /* call-template */
  1234. const xmlChar *select; /* sort, copy-of, value-of, apply-templates */
  1235. int ver11; /* document */
  1236. const xmlChar *filename; /* document URL */
  1237. int has_filename; /* document */
  1238. xsltNumberData numdata; /* number */
  1239. xmlXPathCompExprPtr comp; /* a precompiled XPath expression */
  1240. xmlNsPtr *nsList; /* the namespaces in scope */
  1241. int nsNr; /* the number of namespaces in scope */
  1242. };
  1243. #endif /* XSLT_REFACTORED */
  1244. /*
  1245. * The in-memory structure corresponding to an XSLT Variable
  1246. * or Param.
  1247. */
  1248. typedef struct _xsltStackElem xsltStackElem;
  1249. typedef xsltStackElem *xsltStackElemPtr;
  1250. struct _xsltStackElem {
  1251. struct _xsltStackElem *next;/* chained list */
  1252. xsltStylePreCompPtr comp; /* the compiled form */
  1253. int computed; /* was the evaluation done */
  1254. const xmlChar *name; /* the local part of the name QName */
  1255. const xmlChar *nameURI; /* the URI part of the name QName */
  1256. const xmlChar *select; /* the eval string */
  1257. xmlNodePtr tree; /* the sequence constructor if no eval
  1258. string or the location */
  1259. xmlXPathObjectPtr value; /* The value if computed */
  1260. xmlDocPtr fragment; /* The Result Tree Fragments (needed for XSLT 1.0)
  1261. which are bound to the variable's lifetime. */
  1262. int level; /* the depth in the tree;
  1263. -1 if persistent (e.g. a given xsl:with-param) */
  1264. xsltTransformContextPtr context; /* The transformation context; needed to cache
  1265. the variables */
  1266. int flags;
  1267. };
  1268. #ifdef XSLT_REFACTORED
  1269. struct _xsltPrincipalStylesheetData {
  1270. /*
  1271. * Namespace dictionary for ns-prefixes and ns-names:
  1272. * TODO: Shared between stylesheets, and XPath mechanisms.
  1273. * Not used yet.
  1274. */
  1275. xmlDictPtr namespaceDict;
  1276. /*
  1277. * Global list of in-scope namespaces.
  1278. */
  1279. xsltPointerListPtr inScopeNamespaces;
  1280. /*
  1281. * Global list of information for [xsl:]excluded-result-prefixes.
  1282. */
  1283. xsltPointerListPtr exclResultNamespaces;
  1284. /*
  1285. * Global list of information for [xsl:]extension-element-prefixes.
  1286. */
  1287. xsltPointerListPtr extElemNamespaces;
  1288. xsltEffectiveNsPtr effectiveNs;
  1289. #ifdef XSLT_REFACTORED_XSLT_NSCOMP
  1290. /*
  1291. * Namespace name map to get rid of string comparison of namespace names.
  1292. */
  1293. xsltNsMapPtr nsMap;
  1294. #endif
  1295. };
  1296. #endif
  1297. /*
  1298. * Note that we added a @compCtxt field to anchor an stylesheet compilation
  1299. * context, since, due to historical reasons, various compile-time function
  1300. * take only the stylesheet as argument and not a compilation context.
  1301. */
  1302. struct _xsltStylesheet {
  1303. /*
  1304. * The stylesheet import relation is kept as a tree.
  1305. */
  1306. struct _xsltStylesheet *parent;
  1307. struct _xsltStylesheet *next;
  1308. struct _xsltStylesheet *imports;
  1309. xsltDocumentPtr docList; /* the include document list */
  1310. /*
  1311. * General data on the style sheet document.
  1312. */
  1313. xmlDocPtr doc; /* the parsed XML stylesheet */
  1314. xmlHashTablePtr stripSpaces;/* the hash table of the strip-space and
  1315. preserve space elements */
  1316. int stripAll; /* strip-space * (1) preserve-space * (-1) */
  1317. xmlHashTablePtr cdataSection;/* the hash table of the cdata-section */
  1318. /*
  1319. * Global variable or parameters.
  1320. */
  1321. xsltStackElemPtr variables; /* linked list of param and variables */
  1322. /*
  1323. * Template descriptions.
  1324. */
  1325. xsltTemplatePtr templates; /* the ordered list of templates */
  1326. xmlHashTablePtr templatesHash; /* hash table or wherever compiled
  1327. templates information is stored */
  1328. struct _xsltCompMatch *rootMatch; /* template based on / */
  1329. struct _xsltCompMatch *keyMatch; /* template based on key() */
  1330. struct _xsltCompMatch *elemMatch; /* template based on * */
  1331. struct _xsltCompMatch *attrMatch; /* template based on @* */
  1332. struct _xsltCompMatch *parentMatch; /* template based on .. */
  1333. struct _xsltCompMatch *textMatch; /* template based on text() */
  1334. struct _xsltCompMatch *piMatch; /* template based on
  1335. processing-instruction() */
  1336. struct _xsltCompMatch *commentMatch; /* template based on comment() */
  1337. /*
  1338. * Namespace aliases.
  1339. * NOTE: Not used in the refactored code.
  1340. */
  1341. xmlHashTablePtr nsAliases; /* the namespace alias hash tables */
  1342. /*
  1343. * Attribute sets.
  1344. */
  1345. xmlHashTablePtr attributeSets;/* the attribute sets hash tables */
  1346. /*
  1347. * Namespaces.
  1348. * TODO: Eliminate this.
  1349. */
  1350. xmlHashTablePtr nsHash; /* the set of namespaces in use:
  1351. ATTENTION: This is used for
  1352. execution of XPath expressions; unfortunately
  1353. it restricts the stylesheet to have distinct
  1354. prefixes.
  1355. TODO: We need to get rid of this.
  1356. */
  1357. void *nsDefs; /* ATTENTION TODO: This is currently used to store
  1358. xsltExtDefPtr (in extensions.c) and
  1359. *not* xmlNsPtr.
  1360. */
  1361. /*
  1362. * Key definitions.
  1363. */
  1364. void *keys; /* key definitions */
  1365. /*
  1366. * Output related stuff.
  1367. */
  1368. xmlChar *method; /* the output method */
  1369. xmlChar *methodURI; /* associated namespace if any */
  1370. xmlChar *version; /* version string */
  1371. xmlChar *encoding; /* encoding string */
  1372. int omitXmlDeclaration; /* omit-xml-declaration = "yes" | "no" */
  1373. /*
  1374. * Number formatting.
  1375. */
  1376. xsltDecimalFormatPtr decimalFormat;
  1377. int standalone; /* standalone = "yes" | "no" */
  1378. xmlChar *doctypePublic; /* doctype-public string */
  1379. xmlChar *doctypeSystem; /* doctype-system string */
  1380. int indent; /* should output being indented */
  1381. xmlChar *mediaType; /* media-type string */
  1382. /*
  1383. * Precomputed blocks.
  1384. */
  1385. xsltElemPreCompPtr preComps;/* list of precomputed blocks */
  1386. int warnings; /* number of warnings found at compilation */
  1387. int errors; /* number of errors found at compilation */
  1388. xmlChar *exclPrefix; /* last excluded prefixes */
  1389. xmlChar **exclPrefixTab; /* array of excluded prefixes */
  1390. int exclPrefixNr; /* number of excluded prefixes in scope */
  1391. int exclPrefixMax; /* size of the array */
  1392. void *_private; /* user defined data */
  1393. /*
  1394. * Extensions.
  1395. */
  1396. xmlHashTablePtr extInfos; /* the extension data */
  1397. int extrasNr; /* the number of extras required */
  1398. /*
  1399. * For keeping track of nested includes
  1400. */
  1401. xsltDocumentPtr includes; /* points to last nested include */
  1402. /*
  1403. * dictionary: shared between stylesheet, context and documents.
  1404. */
  1405. xmlDictPtr dict;
  1406. /*
  1407. * precompiled attribute value templates.
  1408. */
  1409. void *attVTs;
  1410. /*
  1411. * if namespace-alias has an alias for the default stylesheet prefix
  1412. * NOTE: Not used in the refactored code.
  1413. */
  1414. const xmlChar *defaultAlias;
  1415. /*
  1416. * bypass pre-processing (already done) (used in imports)
  1417. */
  1418. int nopreproc;
  1419. /*
  1420. * all document text strings were internalized
  1421. */
  1422. int internalized;
  1423. /*
  1424. * Literal Result Element as Stylesheet c.f. section 2.3
  1425. */
  1426. int literal_result;
  1427. /*
  1428. * The principal stylesheet
  1429. */
  1430. xsltStylesheetPtr principal;
  1431. #ifdef XSLT_REFACTORED
  1432. /*
  1433. * Compilation context used during compile-time.
  1434. */
  1435. xsltCompilerCtxtPtr compCtxt; /* TODO: Change this to (void *). */
  1436. xsltPrincipalStylesheetDataPtr principalData;
  1437. #endif
  1438. /*
  1439. * Forwards-compatible processing
  1440. */
  1441. int forwards_compatible;
  1442. xmlHashTablePtr namedTemplates; /* hash table of named templates */
  1443. xmlXPathContextPtr xpathCtxt;
  1444. };
  1445. typedef struct _xsltTransformCache xsltTransformCache;
  1446. typedef xsltTransformCache *xsltTransformCachePtr;
  1447. struct _xsltTransformCache {
  1448. xmlDocPtr RVT;
  1449. int nbRVT;
  1450. xsltStackElemPtr stackItems;
  1451. int nbStackItems;
  1452. #ifdef XSLT_DEBUG_PROFILE_CACHE
  1453. int dbgCachedRVTs;
  1454. int dbgReusedRVTs;
  1455. int dbgCachedVars;
  1456. int dbgReusedVars;
  1457. #endif
  1458. };
  1459. /*
  1460. * The in-memory structure corresponding to an XSLT Transformation.
  1461. */
  1462. typedef enum {
  1463. XSLT_OUTPUT_XML = 0,
  1464. XSLT_OUTPUT_HTML,
  1465. XSLT_OUTPUT_TEXT
  1466. } xsltOutputType;
  1467. typedef enum {
  1468. XSLT_STATE_OK = 0,
  1469. XSLT_STATE_ERROR,
  1470. XSLT_STATE_STOPPED
  1471. } xsltTransformState;
  1472. struct _xsltTransformContext {
  1473. xsltStylesheetPtr style; /* the stylesheet used */
  1474. xsltOutputType type; /* the type of output */
  1475. xsltTemplatePtr templ; /* the current template */
  1476. int templNr; /* Nb of templates in the stack */
  1477. int templMax; /* Size of the templtes stack */
  1478. xsltTemplatePtr *templTab; /* the template stack */
  1479. xsltStackElemPtr vars; /* the current variable list */
  1480. int varsNr; /* Nb of variable list in the stack */
  1481. int varsMax; /* Size of the variable list stack */
  1482. xsltStackElemPtr *varsTab; /* the variable list stack */
  1483. int varsBase; /* the var base for current templ */
  1484. /*
  1485. * Extensions
  1486. */
  1487. xmlHashTablePtr extFunctions; /* the extension functions */
  1488. xmlHashTablePtr extElements; /* the extension elements */
  1489. xmlHashTablePtr extInfos; /* the extension data */
  1490. const xmlChar *mode; /* the current mode */
  1491. const xmlChar *modeURI; /* the current mode URI */
  1492. xsltDocumentPtr docList; /* the document list */
  1493. xsltDocumentPtr document; /* the current source document; can be NULL if an RTF */
  1494. xmlNodePtr node; /* the current node being processed */
  1495. xmlNodeSetPtr nodeList; /* the current node list */
  1496. /* xmlNodePtr current; the node */
  1497. xmlDocPtr output; /* the resulting document */
  1498. xmlNodePtr insert; /* the insertion node */
  1499. xmlXPathContextPtr xpathCtxt; /* the XPath context */
  1500. xsltTransformState state; /* the current state */
  1501. /*
  1502. * Global variables
  1503. */
  1504. xmlHashTablePtr globalVars; /* the global variables and params */
  1505. xmlNodePtr inst; /* the instruction in the stylesheet */
  1506. int xinclude; /* should XInclude be processed */
  1507. const char * outputFile; /* the output URI if known */
  1508. int profile; /* is this run profiled */
  1509. long prof; /* the current profiled value */
  1510. int profNr; /* Nb of templates in the stack */
  1511. int profMax; /* Size of the templtaes stack */
  1512. long *profTab; /* the profile template stack */
  1513. void *_private; /* user defined data */
  1514. int extrasNr; /* the number of extras used */
  1515. int extrasMax; /* the number of extras allocated */
  1516. xsltRuntimeExtraPtr extras; /* extra per runtime information */
  1517. xsltDocumentPtr styleList; /* the stylesheet docs list */
  1518. void * sec; /* the security preferences if any */
  1519. xmlGenericErrorFunc error; /* a specific error handler */
  1520. void * errctx; /* context for the error handler */
  1521. xsltSortFunc sortfunc; /* a ctxt specific sort routine */
  1522. /*
  1523. * handling of temporary Result Value Tree
  1524. * (XSLT 1.0 term: "Result Tree Fragment")
  1525. */
  1526. xmlDocPtr tmpRVT; /* list of RVT without persistance */
  1527. xmlDocPtr persistRVT; /* list of persistant RVTs */
  1528. int ctxtflags; /* context processing flags */
  1529. /*
  1530. * Speed optimization when coalescing text nodes
  1531. */
  1532. const xmlChar *lasttext; /* last text node content */
  1533. int lasttsize; /* last text node size */
  1534. int lasttuse; /* last text node use */
  1535. /*
  1536. * Per Context Debugging
  1537. */
  1538. int debugStatus; /* the context level debug status */
  1539. unsigned long* traceCode; /* pointer to the variable holding the mask */
  1540. int parserOptions; /* parser options xmlParserOption */
  1541. /*
  1542. * dictionary: shared between stylesheet, context and documents.
  1543. */
  1544. xmlDictPtr dict;
  1545. xmlDocPtr tmpDoc; /* Obsolete; not used in the library. */
  1546. /*
  1547. * all document text strings are internalized
  1548. */
  1549. int internalized;
  1550. int nbKeys;
  1551. int hasTemplKeyPatterns;
  1552. xsltTemplatePtr currentTemplateRule; /* the Current Template Rule */
  1553. xmlNodePtr initialContextNode;
  1554. xmlDocPtr initialContextDoc;
  1555. xsltTransformCachePtr cache;
  1556. void *contextVariable; /* the current variable item */
  1557. xmlDocPtr localRVT; /* list of local tree fragments; will be freed when
  1558. the instruction which created the fragment
  1559. exits */
  1560. xmlDocPtr localRVTBase; /* Obsolete */
  1561. int keyInitLevel; /* Needed to catch recursive keys issues */
  1562. int depth; /* Needed to catch recursions */
  1563. int maxTemplateDepth;
  1564. int maxTemplateVars;
  1565. unsigned long opLimit;
  1566. unsigned long opCount;
  1567. };
  1568. /**
  1569. * CHECK_STOPPED:
  1570. *
  1571. * Macro to check if the XSLT processing should be stopped.
  1572. * Will return from the function.
  1573. */
  1574. #define CHECK_STOPPED if (ctxt->state == XSLT_STATE_STOPPED) return;
  1575. /**
  1576. * CHECK_STOPPEDE:
  1577. *
  1578. * Macro to check if the XSLT processing should be stopped.
  1579. * Will goto the error: label.
  1580. */
  1581. #define CHECK_STOPPEDE if (ctxt->state == XSLT_STATE_STOPPED) goto error;
  1582. /**
  1583. * CHECK_STOPPED0:
  1584. *
  1585. * Macro to check if the XSLT processing should be stopped.
  1586. * Will return from the function with a 0 value.
  1587. */
  1588. #define CHECK_STOPPED0 if (ctxt->state == XSLT_STATE_STOPPED) return(0);
  1589. /*
  1590. * The macro XML_CAST_FPTR is a hack to avoid a gcc warning about
  1591. * possible incompatibilities between function pointers and object
  1592. * pointers. It is defined in libxml/hash.h within recent versions
  1593. * of libxml2, but is put here for compatibility.
  1594. */
  1595. #ifndef XML_CAST_FPTR
  1596. /**
  1597. * XML_CAST_FPTR:
  1598. * @fptr: pointer to a function
  1599. *
  1600. * Macro to do a casting from an object pointer to a
  1601. * function pointer without encountering a warning from
  1602. * gcc
  1603. *
  1604. * #define XML_CAST_FPTR(fptr) (*(void **)(&fptr))
  1605. * This macro violated ISO C aliasing rules (gcc4 on s390 broke)
  1606. * so it is disabled now
  1607. */
  1608. #define XML_CAST_FPTR(fptr) fptr
  1609. #endif
  1610. /*
  1611. * Functions associated to the internal types
  1612. xsltDecimalFormatPtr xsltDecimalFormatGetByName(xsltStylesheetPtr sheet,
  1613. xmlChar *name);
  1614. */
  1615. XSLTPUBFUN xsltStylesheetPtr XSLTCALL
  1616. xsltNewStylesheet (void);
  1617. XSLTPUBFUN xsltStylesheetPtr XSLTCALL
  1618. xsltParseStylesheetFile (const xmlChar* filename);
  1619. XSLTPUBFUN void XSLTCALL
  1620. xsltFreeStylesheet (xsltStylesheetPtr style);
  1621. XSLTPUBFUN int XSLTCALL
  1622. xsltIsBlank (xmlChar *str);
  1623. XSLTPUBFUN void XSLTCALL
  1624. xsltFreeStackElemList (xsltStackElemPtr elem);
  1625. XSLTPUBFUN xsltDecimalFormatPtr XSLTCALL
  1626. xsltDecimalFormatGetByName(xsltStylesheetPtr style,
  1627. xmlChar *name);
  1628. XSLTPUBFUN xsltDecimalFormatPtr XSLTCALL
  1629. xsltDecimalFormatGetByQName(xsltStylesheetPtr style,
  1630. const xmlChar *nsUri,
  1631. const xmlChar *name);
  1632. XSLTPUBFUN xsltStylesheetPtr XSLTCALL
  1633. xsltParseStylesheetProcess(xsltStylesheetPtr ret,
  1634. xmlDocPtr doc);
  1635. XSLTPUBFUN void XSLTCALL
  1636. xsltParseStylesheetOutput(xsltStylesheetPtr style,
  1637. xmlNodePtr cur);
  1638. XSLTPUBFUN xsltStylesheetPtr XSLTCALL
  1639. xsltParseStylesheetDoc (xmlDocPtr doc);
  1640. XSLTPUBFUN xsltStylesheetPtr XSLTCALL
  1641. xsltParseStylesheetImportedDoc(xmlDocPtr doc,
  1642. xsltStylesheetPtr style);
  1643. XSLTPUBFUN int XSLTCALL
  1644. xsltParseStylesheetUser(xsltStylesheetPtr style,
  1645. xmlDocPtr doc);
  1646. XSLTPUBFUN xsltStylesheetPtr XSLTCALL
  1647. xsltLoadStylesheetPI (xmlDocPtr doc);
  1648. XSLTPUBFUN void XSLTCALL
  1649. xsltNumberFormat (xsltTransformContextPtr ctxt,
  1650. xsltNumberDataPtr data,
  1651. xmlNodePtr node);
  1652. XSLTPUBFUN xmlXPathError XSLTCALL
  1653. xsltFormatNumberConversion(xsltDecimalFormatPtr self,
  1654. xmlChar *format,
  1655. double number,
  1656. xmlChar **result);
  1657. XSLTPUBFUN void XSLTCALL
  1658. xsltParseTemplateContent(xsltStylesheetPtr style,
  1659. xmlNodePtr templ);
  1660. XSLTPUBFUN int XSLTCALL
  1661. xsltAllocateExtra (xsltStylesheetPtr style);
  1662. XSLTPUBFUN int XSLTCALL
  1663. xsltAllocateExtraCtxt (xsltTransformContextPtr ctxt);
  1664. /*
  1665. * Extra functions for Result Value Trees
  1666. */
  1667. XSLTPUBFUN xmlDocPtr XSLTCALL
  1668. xsltCreateRVT (xsltTransformContextPtr ctxt);
  1669. XSLTPUBFUN int XSLTCALL
  1670. xsltRegisterTmpRVT (xsltTransformContextPtr ctxt,
  1671. xmlDocPtr RVT);
  1672. XSLTPUBFUN int XSLTCALL
  1673. xsltRegisterLocalRVT (xsltTransformContextPtr ctxt,
  1674. xmlDocPtr RVT);
  1675. XSLTPUBFUN int XSLTCALL
  1676. xsltRegisterPersistRVT (xsltTransformContextPtr ctxt,
  1677. xmlDocPtr RVT);
  1678. XSLTPUBFUN int XSLTCALL
  1679. xsltExtensionInstructionResultRegister(
  1680. xsltTransformContextPtr ctxt,
  1681. xmlXPathObjectPtr obj);
  1682. XSLTPUBFUN int XSLTCALL
  1683. xsltExtensionInstructionResultFinalize(
  1684. xsltTransformContextPtr ctxt);
  1685. XSLTPUBFUN int XSLTCALL
  1686. xsltFlagRVTs(
  1687. xsltTransformContextPtr ctxt,
  1688. xmlXPathObjectPtr obj,
  1689. void *val);
  1690. XSLTPUBFUN void XSLTCALL
  1691. xsltFreeRVTs (xsltTransformContextPtr ctxt);
  1692. XSLTPUBFUN void XSLTCALL
  1693. xsltReleaseRVT (xsltTransformContextPtr ctxt,
  1694. xmlDocPtr RVT);
  1695. /*
  1696. * Extra functions for Attribute Value Templates
  1697. */
  1698. XSLTPUBFUN void XSLTCALL
  1699. xsltCompileAttr (xsltStylesheetPtr style,
  1700. xmlAttrPtr attr);
  1701. XSLTPUBFUN xmlChar * XSLTCALL
  1702. xsltEvalAVT (xsltTransformContextPtr ctxt,
  1703. void *avt,
  1704. xmlNodePtr node);
  1705. XSLTPUBFUN void XSLTCALL
  1706. xsltFreeAVTList (void *avt);
  1707. /*
  1708. * Extra function for successful xsltCleanupGlobals / xsltInit sequence.
  1709. */
  1710. XSLTPUBFUN void XSLTCALL
  1711. xsltUninit (void);
  1712. /************************************************************************
  1713. * *
  1714. * Compile-time functions for *internal* use only *
  1715. * *
  1716. ************************************************************************/
  1717. #ifdef XSLT_REFACTORED
  1718. XSLTPUBFUN void XSLTCALL
  1719. xsltParseSequenceConstructor(
  1720. xsltCompilerCtxtPtr cctxt,
  1721. xmlNodePtr start);
  1722. XSLTPUBFUN int XSLTCALL
  1723. xsltParseAnyXSLTElem (xsltCompilerCtxtPtr cctxt,
  1724. xmlNodePtr elem);
  1725. #ifdef XSLT_REFACTORED_XSLT_NSCOMP
  1726. XSLTPUBFUN int XSLTCALL
  1727. xsltRestoreDocumentNamespaces(
  1728. xsltNsMapPtr ns,
  1729. xmlDocPtr doc);
  1730. #endif
  1731. #endif /* XSLT_REFACTORED */
  1732. /************************************************************************
  1733. * *
  1734. * Transformation-time functions for *internal* use only *
  1735. * *
  1736. ************************************************************************/
  1737. XSLTPUBFUN int XSLTCALL
  1738. xsltInitCtxtKey (xsltTransformContextPtr ctxt,
  1739. xsltDocumentPtr doc,
  1740. xsltKeyDefPtr keyd);
  1741. XSLTPUBFUN int XSLTCALL
  1742. xsltInitAllDocKeys (xsltTransformContextPtr ctxt);
  1743. #ifdef __cplusplus
  1744. }
  1745. #endif
  1746. #endif /* __XML_XSLT_H__ */