xsltInternals.h 56 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967
  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. /**
  90. * XSLT_REFACTORED_XPATHCOMP:
  91. *
  92. * Internal define to enable the optimization of the
  93. * compilation of XPath expressions.
  94. */
  95. #define XSLT_REFACTORED_XPATHCOMP
  96. #ifdef XSLT_REFACTORED_XSLT_NSCOMP
  97. extern const xmlChar *xsltConstNamespaceNameXSLT;
  98. /**
  99. * IS_XSLT_ELEM_FAST:
  100. *
  101. * quick test to detect XSLT elements
  102. */
  103. #define IS_XSLT_ELEM_FAST(n) \
  104. (((n) != NULL) && ((n)->ns != NULL) && \
  105. ((n)->ns->href == xsltConstNamespaceNameXSLT))
  106. /**
  107. * IS_XSLT_ATTR_FAST:
  108. *
  109. * quick test to detect XSLT attributes
  110. */
  111. #define IS_XSLT_ATTR_FAST(a) \
  112. (((a) != NULL) && ((a)->ns != NULL) && \
  113. ((a)->ns->href == xsltConstNamespaceNameXSLT))
  114. /**
  115. * XSLT_HAS_INTERNAL_NSMAP:
  116. *
  117. * check for namespace mapping
  118. */
  119. #define XSLT_HAS_INTERNAL_NSMAP(s) \
  120. (((s) != NULL) && ((s)->principal) && \
  121. ((s)->principal->principalData) && \
  122. ((s)->principal->principalData->nsMap))
  123. /**
  124. * XSLT_GET_INTERNAL_NSMAP:
  125. *
  126. * get pointer to namespace map
  127. */
  128. #define XSLT_GET_INTERNAL_NSMAP(s) ((s)->principal->principalData->nsMap)
  129. #else /* XSLT_REFACTORED_XSLT_NSCOMP */
  130. /**
  131. * IS_XSLT_ELEM_FAST:
  132. *
  133. * quick check whether this is an xslt element
  134. */
  135. #define IS_XSLT_ELEM_FAST(n) \
  136. (((n) != NULL) && ((n)->ns != NULL) && \
  137. (xmlStrEqual((n)->ns->href, XSLT_NAMESPACE)))
  138. /**
  139. * IS_XSLT_ATTR_FAST:
  140. *
  141. * quick check for xslt namespace attribute
  142. */
  143. #define IS_XSLT_ATTR_FAST(a) \
  144. (((a) != NULL) && ((a)->ns != NULL) && \
  145. (xmlStrEqual((a)->ns->href, XSLT_NAMESPACE)))
  146. #endif /* XSLT_REFACTORED_XSLT_NSCOMP */
  147. /**
  148. * XSLT_REFACTORED_MANDATORY_VERSION:
  149. *
  150. * TODO: Currently disabled to surpress regression test failures, since
  151. * the old behaviour was that a missing version attribute
  152. * produced a only a warning and not an error, which was incerrect.
  153. * So the regression tests need to be fixed if this is enabled.
  154. */
  155. /* #define XSLT_REFACTORED_MANDATORY_VERSION */
  156. /**
  157. * xsltPointerList:
  158. *
  159. * Pointer-list for various purposes.
  160. */
  161. typedef struct _xsltPointerList xsltPointerList;
  162. typedef xsltPointerList *xsltPointerListPtr;
  163. struct _xsltPointerList {
  164. void **items;
  165. int number;
  166. int size;
  167. };
  168. #endif
  169. /**
  170. * XSLT_REFACTORED_PARSING:
  171. *
  172. * Internal define to enable the refactored parts of Libxslt
  173. * related to parsing.
  174. */
  175. /* #define XSLT_REFACTORED_PARSING */
  176. /**
  177. * XSLT_MAX_SORT:
  178. *
  179. * Max number of specified xsl:sort on an element.
  180. */
  181. #define XSLT_MAX_SORT 15
  182. /**
  183. * XSLT_PAT_NO_PRIORITY:
  184. *
  185. * Specific value for pattern without priority expressed.
  186. */
  187. #define XSLT_PAT_NO_PRIORITY -12345789
  188. /**
  189. * xsltRuntimeExtra:
  190. *
  191. * Extra information added to the transformation context.
  192. */
  193. typedef struct _xsltRuntimeExtra xsltRuntimeExtra;
  194. typedef xsltRuntimeExtra *xsltRuntimeExtraPtr;
  195. struct _xsltRuntimeExtra {
  196. void *info; /* pointer to the extra data */
  197. xmlFreeFunc deallocate; /* pointer to the deallocation routine */
  198. union { /* dual-purpose field */
  199. void *ptr; /* data not needing deallocation */
  200. int ival; /* integer value storage */
  201. } val;
  202. };
  203. /**
  204. * XSLT_RUNTIME_EXTRA_LST:
  205. * @ctxt: the transformation context
  206. * @nr: the index
  207. *
  208. * Macro used to access extra information stored in the context
  209. */
  210. #define XSLT_RUNTIME_EXTRA_LST(ctxt, nr) (ctxt)->extras[(nr)].info
  211. /**
  212. * XSLT_RUNTIME_EXTRA_FREE:
  213. * @ctxt: the transformation context
  214. * @nr: the index
  215. *
  216. * Macro used to free extra information stored in the context
  217. */
  218. #define XSLT_RUNTIME_EXTRA_FREE(ctxt, nr) (ctxt)->extras[(nr)].deallocate
  219. /**
  220. * XSLT_RUNTIME_EXTRA:
  221. * @ctxt: the transformation context
  222. * @nr: the index
  223. *
  224. * Macro used to define extra information stored in the context
  225. */
  226. #define XSLT_RUNTIME_EXTRA(ctxt, nr, typ) (ctxt)->extras[(nr)].val.typ
  227. /**
  228. * xsltTemplate:
  229. *
  230. * The in-memory structure corresponding to an XSLT Template.
  231. */
  232. typedef struct _xsltTemplate xsltTemplate;
  233. typedef xsltTemplate *xsltTemplatePtr;
  234. struct _xsltTemplate {
  235. struct _xsltTemplate *next;/* chained list sorted by priority */
  236. struct _xsltStylesheet *style;/* the containing stylesheet */
  237. xmlChar *match; /* the matching string */
  238. float priority; /* as given from the stylesheet, not computed */
  239. const xmlChar *name; /* the local part of the name QName */
  240. const xmlChar *nameURI; /* the URI part of the name QName */
  241. const xmlChar *mode;/* the local part of the mode QName */
  242. const xmlChar *modeURI;/* the URI part of the mode QName */
  243. xmlNodePtr content; /* the template replacement value */
  244. xmlNodePtr elem; /* the source element */
  245. /*
  246. * TODO: @inheritedNsNr and @inheritedNs won't be used in the
  247. * refactored code.
  248. */
  249. int inheritedNsNr; /* number of inherited namespaces */
  250. xmlNsPtr *inheritedNs;/* inherited non-excluded namespaces */
  251. /* Profiling informations */
  252. int nbCalls; /* the number of time the template was called */
  253. unsigned long time; /* the time spent in this template */
  254. void *params; /* xsl:param instructions */
  255. };
  256. /**
  257. * xsltDecimalFormat:
  258. *
  259. * Data structure of decimal-format.
  260. */
  261. typedef struct _xsltDecimalFormat xsltDecimalFormat;
  262. typedef xsltDecimalFormat *xsltDecimalFormatPtr;
  263. struct _xsltDecimalFormat {
  264. struct _xsltDecimalFormat *next; /* chained list */
  265. xmlChar *name;
  266. /* Used for interpretation of pattern */
  267. xmlChar *digit;
  268. xmlChar *patternSeparator;
  269. /* May appear in result */
  270. xmlChar *minusSign;
  271. xmlChar *infinity;
  272. xmlChar *noNumber; /* Not-a-number */
  273. /* Used for interpretation of pattern and may appear in result */
  274. xmlChar *decimalPoint;
  275. xmlChar *grouping;
  276. xmlChar *percent;
  277. xmlChar *permille;
  278. xmlChar *zeroDigit;
  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 hold 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 hold 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. #ifdef XSLT_REFACTORED_XPATHCOMP
  1189. xmlXPathContextPtr xpathCtxt;
  1190. #endif
  1191. xsltStyleItemUknownPtr unknownItem;
  1192. int hasNsAliases; /* Indicator if there was an xsl:namespace-alias. */
  1193. xsltNsAliasPtr nsAliases;
  1194. xsltVarInfoPtr ivars; /* Storage of local in-scope variables/params. */
  1195. xsltVarInfoPtr ivar; /* topmost local variable/param. */
  1196. };
  1197. #else /* XSLT_REFACTORED */
  1198. /*
  1199. * The old structures before refactoring.
  1200. */
  1201. /**
  1202. * _xsltStylePreComp:
  1203. *
  1204. * The in-memory structure corresponding to XSLT stylesheet constructs
  1205. * precomputed data.
  1206. */
  1207. struct _xsltStylePreComp {
  1208. xsltElemPreCompPtr next; /* chained list */
  1209. xsltStyleType type; /* type of the element */
  1210. xsltTransformFunction func; /* handling function */
  1211. xmlNodePtr inst; /* the instruction */
  1212. /*
  1213. * Pre computed values.
  1214. */
  1215. const xmlChar *stype; /* sort */
  1216. int has_stype; /* sort */
  1217. int number; /* sort */
  1218. const xmlChar *order; /* sort */
  1219. int has_order; /* sort */
  1220. int descending; /* sort */
  1221. const xmlChar *lang; /* sort */
  1222. int has_lang; /* sort */
  1223. xsltLocale locale; /* sort */
  1224. const xmlChar *case_order; /* sort */
  1225. int lower_first; /* sort */
  1226. const xmlChar *use; /* copy, element */
  1227. int has_use; /* copy, element */
  1228. int noescape; /* text */
  1229. const xmlChar *name; /* element, attribute, pi */
  1230. int has_name; /* element, attribute, pi */
  1231. const xmlChar *ns; /* element */
  1232. int has_ns; /* element */
  1233. const xmlChar *mode; /* apply-templates */
  1234. const xmlChar *modeURI; /* apply-templates */
  1235. const xmlChar *test; /* if */
  1236. xsltTemplatePtr templ; /* call-template */
  1237. const xmlChar *select; /* sort, copy-of, value-of, apply-templates */
  1238. int ver11; /* document */
  1239. const xmlChar *filename; /* document URL */
  1240. int has_filename; /* document */
  1241. xsltNumberData numdata; /* number */
  1242. xmlXPathCompExprPtr comp; /* a precompiled XPath expression */
  1243. xmlNsPtr *nsList; /* the namespaces in scope */
  1244. int nsNr; /* the number of namespaces in scope */
  1245. };
  1246. #endif /* XSLT_REFACTORED */
  1247. /*
  1248. * The in-memory structure corresponding to an XSLT Variable
  1249. * or Param.
  1250. */
  1251. typedef struct _xsltStackElem xsltStackElem;
  1252. typedef xsltStackElem *xsltStackElemPtr;
  1253. struct _xsltStackElem {
  1254. struct _xsltStackElem *next;/* chained list */
  1255. xsltStylePreCompPtr comp; /* the compiled form */
  1256. int computed; /* was the evaluation done */
  1257. const xmlChar *name; /* the local part of the name QName */
  1258. const xmlChar *nameURI; /* the URI part of the name QName */
  1259. const xmlChar *select; /* the eval string */
  1260. xmlNodePtr tree; /* the sequence constructor if no eval
  1261. string or the location */
  1262. xmlXPathObjectPtr value; /* The value if computed */
  1263. xmlDocPtr fragment; /* The Result Tree Fragments (needed for XSLT 1.0)
  1264. which are bound to the variable's lifetime. */
  1265. int level; /* the depth in the tree;
  1266. -1 if persistent (e.g. a given xsl:with-param) */
  1267. xsltTransformContextPtr context; /* The transformation context; needed to cache
  1268. the variables */
  1269. int flags;
  1270. };
  1271. #ifdef XSLT_REFACTORED
  1272. struct _xsltPrincipalStylesheetData {
  1273. /*
  1274. * Namespace dictionary for ns-prefixes and ns-names:
  1275. * TODO: Shared between stylesheets, and XPath mechanisms.
  1276. * Not used yet.
  1277. */
  1278. xmlDictPtr namespaceDict;
  1279. /*
  1280. * Global list of in-scope namespaces.
  1281. */
  1282. xsltPointerListPtr inScopeNamespaces;
  1283. /*
  1284. * Global list of information for [xsl:]excluded-result-prefixes.
  1285. */
  1286. xsltPointerListPtr exclResultNamespaces;
  1287. /*
  1288. * Global list of information for [xsl:]extension-element-prefixes.
  1289. */
  1290. xsltPointerListPtr extElemNamespaces;
  1291. xsltEffectiveNsPtr effectiveNs;
  1292. #ifdef XSLT_REFACTORED_XSLT_NSCOMP
  1293. /*
  1294. * Namespace name map to get rid of string comparison of namespace names.
  1295. */
  1296. xsltNsMapPtr nsMap;
  1297. #endif
  1298. };
  1299. #endif
  1300. /*
  1301. * Note that we added a @compCtxt field to anchor an stylesheet compilation
  1302. * context, since, due to historical reasons, various compile-time function
  1303. * take only the stylesheet as argument and not a compilation context.
  1304. */
  1305. struct _xsltStylesheet {
  1306. /*
  1307. * The stylesheet import relation is kept as a tree.
  1308. */
  1309. struct _xsltStylesheet *parent;
  1310. struct _xsltStylesheet *next;
  1311. struct _xsltStylesheet *imports;
  1312. xsltDocumentPtr docList; /* the include document list */
  1313. /*
  1314. * General data on the style sheet document.
  1315. */
  1316. xmlDocPtr doc; /* the parsed XML stylesheet */
  1317. xmlHashTablePtr stripSpaces;/* the hash table of the strip-space and
  1318. preserve space elements */
  1319. int stripAll; /* strip-space * (1) preserve-space * (-1) */
  1320. xmlHashTablePtr cdataSection;/* the hash table of the cdata-section */
  1321. /*
  1322. * Global variable or parameters.
  1323. */
  1324. xsltStackElemPtr variables; /* linked list of param and variables */
  1325. /*
  1326. * Template descriptions.
  1327. */
  1328. xsltTemplatePtr templates; /* the ordered list of templates */
  1329. void *templatesHash; /* hash table or wherever compiled templates
  1330. informations are stored */
  1331. void *rootMatch; /* template based on / */
  1332. void *keyMatch; /* template based on key() */
  1333. void *elemMatch; /* template based on * */
  1334. void *attrMatch; /* template based on @* */
  1335. void *parentMatch; /* template based on .. */
  1336. void *textMatch; /* template based on text() */
  1337. void *piMatch; /* template based on processing-instruction() */
  1338. void *commentMatch; /* template based on comment() */
  1339. /*
  1340. * Namespace aliases.
  1341. * NOTE: Not used in the refactored code.
  1342. */
  1343. xmlHashTablePtr nsAliases; /* the namespace alias hash tables */
  1344. /*
  1345. * Attribute sets.
  1346. */
  1347. xmlHashTablePtr attributeSets;/* the attribute sets hash tables */
  1348. /*
  1349. * Namespaces.
  1350. * TODO: Eliminate this.
  1351. */
  1352. xmlHashTablePtr nsHash; /* the set of namespaces in use:
  1353. ATTENTION: This is used for
  1354. execution of XPath expressions; unfortunately
  1355. it restricts the stylesheet to have distinct
  1356. prefixes.
  1357. TODO: We need to get rid of this.
  1358. */
  1359. void *nsDefs; /* ATTENTION TODO: This is currently used to store
  1360. xsltExtDefPtr (in extensions.c) and
  1361. *not* xmlNsPtr.
  1362. */
  1363. /*
  1364. * Key definitions.
  1365. */
  1366. void *keys; /* key definitions */
  1367. /*
  1368. * Output related stuff.
  1369. */
  1370. xmlChar *method; /* the output method */
  1371. xmlChar *methodURI; /* associated namespace if any */
  1372. xmlChar *version; /* version string */
  1373. xmlChar *encoding; /* encoding string */
  1374. int omitXmlDeclaration; /* omit-xml-declaration = "yes" | "no" */
  1375. /*
  1376. * Number formatting.
  1377. */
  1378. xsltDecimalFormatPtr decimalFormat;
  1379. int standalone; /* standalone = "yes" | "no" */
  1380. xmlChar *doctypePublic; /* doctype-public string */
  1381. xmlChar *doctypeSystem; /* doctype-system string */
  1382. int indent; /* should output being indented */
  1383. xmlChar *mediaType; /* media-type string */
  1384. /*
  1385. * Precomputed blocks.
  1386. */
  1387. xsltElemPreCompPtr preComps;/* list of precomputed blocks */
  1388. int warnings; /* number of warnings found at compilation */
  1389. int errors; /* number of errors found at compilation */
  1390. xmlChar *exclPrefix; /* last excluded prefixes */
  1391. xmlChar **exclPrefixTab; /* array of excluded prefixes */
  1392. int exclPrefixNr; /* number of excluded prefixes in scope */
  1393. int exclPrefixMax; /* size of the array */
  1394. void *_private; /* user defined data */
  1395. /*
  1396. * Extensions.
  1397. */
  1398. xmlHashTablePtr extInfos; /* the extension data */
  1399. int extrasNr; /* the number of extras required */
  1400. /*
  1401. * For keeping track of nested includes
  1402. */
  1403. xsltDocumentPtr includes; /* points to last nested include */
  1404. /*
  1405. * dictionary: shared between stylesheet, context and documents.
  1406. */
  1407. xmlDictPtr dict;
  1408. /*
  1409. * precompiled attribute value templates.
  1410. */
  1411. void *attVTs;
  1412. /*
  1413. * if namespace-alias has an alias for the default stylesheet prefix
  1414. * NOTE: Not used in the refactored code.
  1415. */
  1416. const xmlChar *defaultAlias;
  1417. /*
  1418. * bypass pre-processing (already done) (used in imports)
  1419. */
  1420. int nopreproc;
  1421. /*
  1422. * all document text strings were internalized
  1423. */
  1424. int internalized;
  1425. /*
  1426. * Literal Result Element as Stylesheet c.f. section 2.3
  1427. */
  1428. int literal_result;
  1429. /*
  1430. * The principal stylesheet
  1431. */
  1432. xsltStylesheetPtr principal;
  1433. #ifdef XSLT_REFACTORED
  1434. /*
  1435. * Compilation context used during compile-time.
  1436. */
  1437. xsltCompilerCtxtPtr compCtxt; /* TODO: Change this to (void *). */
  1438. xsltPrincipalStylesheetDataPtr principalData;
  1439. #endif
  1440. };
  1441. typedef struct _xsltTransformCache xsltTransformCache;
  1442. typedef xsltTransformCache *xsltTransformCachePtr;
  1443. struct _xsltTransformCache {
  1444. xmlDocPtr RVT;
  1445. int nbRVT;
  1446. xsltStackElemPtr stackItems;
  1447. int nbStackItems;
  1448. #ifdef XSLT_DEBUG_PROFILE_CACHE
  1449. int dbgCachedRVTs;
  1450. int dbgReusedRVTs;
  1451. int dbgCachedVars;
  1452. int dbgReusedVars;
  1453. #endif
  1454. };
  1455. /*
  1456. * The in-memory structure corresponding to an XSLT Transformation.
  1457. */
  1458. typedef enum {
  1459. XSLT_OUTPUT_XML = 0,
  1460. XSLT_OUTPUT_HTML,
  1461. XSLT_OUTPUT_TEXT
  1462. } xsltOutputType;
  1463. typedef enum {
  1464. XSLT_STATE_OK = 0,
  1465. XSLT_STATE_ERROR,
  1466. XSLT_STATE_STOPPED
  1467. } xsltTransformState;
  1468. struct _xsltTransformContext {
  1469. xsltStylesheetPtr style; /* the stylesheet used */
  1470. xsltOutputType type; /* the type of output */
  1471. xsltTemplatePtr templ; /* the current template */
  1472. int templNr; /* Nb of templates in the stack */
  1473. int templMax; /* Size of the templtes stack */
  1474. xsltTemplatePtr *templTab; /* the template stack */
  1475. xsltStackElemPtr vars; /* the current variable list */
  1476. int varsNr; /* Nb of variable list in the stack */
  1477. int varsMax; /* Size of the variable list stack */
  1478. xsltStackElemPtr *varsTab; /* the variable list stack */
  1479. int varsBase; /* the var base for current templ */
  1480. /*
  1481. * Extensions
  1482. */
  1483. xmlHashTablePtr extFunctions; /* the extension functions */
  1484. xmlHashTablePtr extElements; /* the extension elements */
  1485. xmlHashTablePtr extInfos; /* the extension data */
  1486. const xmlChar *mode; /* the current mode */
  1487. const xmlChar *modeURI; /* the current mode URI */
  1488. xsltDocumentPtr docList; /* the document list */
  1489. xsltDocumentPtr document; /* the current source document; can be NULL if an RTF */
  1490. xmlNodePtr node; /* the current node being processed */
  1491. xmlNodeSetPtr nodeList; /* the current node list */
  1492. /* xmlNodePtr current; the node */
  1493. xmlDocPtr output; /* the resulting document */
  1494. xmlNodePtr insert; /* the insertion node */
  1495. xmlXPathContextPtr xpathCtxt; /* the XPath context */
  1496. xsltTransformState state; /* the current state */
  1497. /*
  1498. * Global variables
  1499. */
  1500. xmlHashTablePtr globalVars; /* the global variables and params */
  1501. xmlNodePtr inst; /* the instruction in the stylesheet */
  1502. int xinclude; /* should XInclude be processed */
  1503. const char * outputFile; /* the output URI if known */
  1504. int profile; /* is this run profiled */
  1505. long prof; /* the current profiled value */
  1506. int profNr; /* Nb of templates in the stack */
  1507. int profMax; /* Size of the templtaes stack */
  1508. long *profTab; /* the profile template stack */
  1509. void *_private; /* user defined data */
  1510. int extrasNr; /* the number of extras used */
  1511. int extrasMax; /* the number of extras allocated */
  1512. xsltRuntimeExtraPtr extras; /* extra per runtime informations */
  1513. xsltDocumentPtr styleList; /* the stylesheet docs list */
  1514. void * sec; /* the security preferences if any */
  1515. xmlGenericErrorFunc error; /* a specific error handler */
  1516. void * errctx; /* context for the error handler */
  1517. xsltSortFunc sortfunc; /* a ctxt specific sort routine */
  1518. /*
  1519. * handling of temporary Result Value Tree
  1520. * (XSLT 1.0 term: "Result Tree Fragment")
  1521. */
  1522. xmlDocPtr tmpRVT; /* list of RVT without persistance */
  1523. xmlDocPtr persistRVT; /* list of persistant RVTs */
  1524. int ctxtflags; /* context processing flags */
  1525. /*
  1526. * Speed optimization when coalescing text nodes
  1527. */
  1528. const xmlChar *lasttext; /* last text node content */
  1529. unsigned int lasttsize; /* last text node size */
  1530. unsigned int lasttuse; /* last text node use */
  1531. /*
  1532. * Per Context Debugging
  1533. */
  1534. int debugStatus; /* the context level debug status */
  1535. unsigned long* traceCode; /* pointer to the variable holding the mask */
  1536. int parserOptions; /* parser options xmlParserOption */
  1537. /*
  1538. * dictionary: shared between stylesheet, context and documents.
  1539. */
  1540. xmlDictPtr dict;
  1541. xmlDocPtr tmpDoc; /* Obsolete; not used in the library. */
  1542. /*
  1543. * all document text strings are internalized
  1544. */
  1545. int internalized;
  1546. int nbKeys;
  1547. int hasTemplKeyPatterns;
  1548. xsltTemplatePtr currentTemplateRule; /* the Current Template Rule */
  1549. xmlNodePtr initialContextNode;
  1550. xmlDocPtr initialContextDoc;
  1551. xsltTransformCachePtr cache;
  1552. void *contextVariable; /* the current variable item */
  1553. xmlDocPtr localRVT; /* list of local tree fragments; will be freed when
  1554. the instruction which created the fragment
  1555. exits */
  1556. xmlDocPtr localRVTBase;
  1557. int keyInitLevel; /* Needed to catch recursive keys issues */
  1558. int funcLevel; /* Needed to catch recursive functions issues */
  1559. };
  1560. /**
  1561. * CHECK_STOPPED:
  1562. *
  1563. * Macro to check if the XSLT processing should be stopped.
  1564. * Will return from the function.
  1565. */
  1566. #define CHECK_STOPPED if (ctxt->state == XSLT_STATE_STOPPED) return;
  1567. /**
  1568. * CHECK_STOPPEDE:
  1569. *
  1570. * Macro to check if the XSLT processing should be stopped.
  1571. * Will goto the error: label.
  1572. */
  1573. #define CHECK_STOPPEDE if (ctxt->state == XSLT_STATE_STOPPED) goto error;
  1574. /**
  1575. * CHECK_STOPPED0:
  1576. *
  1577. * Macro to check if the XSLT processing should be stopped.
  1578. * Will return from the function with a 0 value.
  1579. */
  1580. #define CHECK_STOPPED0 if (ctxt->state == XSLT_STATE_STOPPED) return(0);
  1581. /*
  1582. * The macro XML_CAST_FPTR is a hack to avoid a gcc warning about
  1583. * possible incompatibilities between function pointers and object
  1584. * pointers. It is defined in libxml/hash.h within recent versions
  1585. * of libxml2, but is put here for compatibility.
  1586. */
  1587. #ifndef XML_CAST_FPTR
  1588. /**
  1589. * XML_CAST_FPTR:
  1590. * @fptr: pointer to a function
  1591. *
  1592. * Macro to do a casting from an object pointer to a
  1593. * function pointer without encountering a warning from
  1594. * gcc
  1595. *
  1596. * #define XML_CAST_FPTR(fptr) (*(void **)(&fptr))
  1597. * This macro violated ISO C aliasing rules (gcc4 on s390 broke)
  1598. * so it is disabled now
  1599. */
  1600. #define XML_CAST_FPTR(fptr) fptr
  1601. #endif
  1602. /*
  1603. * Functions associated to the internal types
  1604. xsltDecimalFormatPtr xsltDecimalFormatGetByName(xsltStylesheetPtr sheet,
  1605. xmlChar *name);
  1606. */
  1607. XSLTPUBFUN xsltStylesheetPtr XSLTCALL
  1608. xsltNewStylesheet (void);
  1609. XSLTPUBFUN xsltStylesheetPtr XSLTCALL
  1610. xsltParseStylesheetFile (const xmlChar* filename);
  1611. XSLTPUBFUN void XSLTCALL
  1612. xsltFreeStylesheet (xsltStylesheetPtr style);
  1613. XSLTPUBFUN int XSLTCALL
  1614. xsltIsBlank (xmlChar *str);
  1615. XSLTPUBFUN void XSLTCALL
  1616. xsltFreeStackElemList (xsltStackElemPtr elem);
  1617. XSLTPUBFUN xsltDecimalFormatPtr XSLTCALL
  1618. xsltDecimalFormatGetByName(xsltStylesheetPtr style,
  1619. xmlChar *name);
  1620. XSLTPUBFUN xsltStylesheetPtr XSLTCALL
  1621. xsltParseStylesheetProcess(xsltStylesheetPtr ret,
  1622. xmlDocPtr doc);
  1623. XSLTPUBFUN void XSLTCALL
  1624. xsltParseStylesheetOutput(xsltStylesheetPtr style,
  1625. xmlNodePtr cur);
  1626. XSLTPUBFUN xsltStylesheetPtr XSLTCALL
  1627. xsltParseStylesheetDoc (xmlDocPtr doc);
  1628. XSLTPUBFUN xsltStylesheetPtr XSLTCALL
  1629. xsltParseStylesheetImportedDoc(xmlDocPtr doc,
  1630. xsltStylesheetPtr style);
  1631. XSLTPUBFUN xsltStylesheetPtr XSLTCALL
  1632. xsltLoadStylesheetPI (xmlDocPtr doc);
  1633. XSLTPUBFUN void XSLTCALL
  1634. xsltNumberFormat (xsltTransformContextPtr ctxt,
  1635. xsltNumberDataPtr data,
  1636. xmlNodePtr node);
  1637. XSLTPUBFUN xmlXPathError XSLTCALL
  1638. xsltFormatNumberConversion(xsltDecimalFormatPtr self,
  1639. xmlChar *format,
  1640. double number,
  1641. xmlChar **result);
  1642. XSLTPUBFUN void XSLTCALL
  1643. xsltParseTemplateContent(xsltStylesheetPtr style,
  1644. xmlNodePtr templ);
  1645. XSLTPUBFUN int XSLTCALL
  1646. xsltAllocateExtra (xsltStylesheetPtr style);
  1647. XSLTPUBFUN int XSLTCALL
  1648. xsltAllocateExtraCtxt (xsltTransformContextPtr ctxt);
  1649. /*
  1650. * Extra functions for Result Value Trees
  1651. */
  1652. XSLTPUBFUN xmlDocPtr XSLTCALL
  1653. xsltCreateRVT (xsltTransformContextPtr ctxt);
  1654. XSLTPUBFUN int XSLTCALL
  1655. xsltRegisterTmpRVT (xsltTransformContextPtr ctxt,
  1656. xmlDocPtr RVT);
  1657. XSLTPUBFUN int XSLTCALL
  1658. xsltRegisterLocalRVT (xsltTransformContextPtr ctxt,
  1659. xmlDocPtr RVT);
  1660. XSLTPUBFUN int XSLTCALL
  1661. xsltRegisterPersistRVT (xsltTransformContextPtr ctxt,
  1662. xmlDocPtr RVT);
  1663. XSLTPUBFUN int XSLTCALL
  1664. xsltExtensionInstructionResultRegister(
  1665. xsltTransformContextPtr ctxt,
  1666. xmlXPathObjectPtr obj);
  1667. XSLTPUBFUN int XSLTCALL
  1668. xsltExtensionInstructionResultFinalize(
  1669. xsltTransformContextPtr ctxt);
  1670. XSLTPUBFUN void XSLTCALL
  1671. xsltFreeRVTs (xsltTransformContextPtr ctxt);
  1672. XSLTPUBFUN void XSLTCALL
  1673. xsltReleaseRVT (xsltTransformContextPtr ctxt,
  1674. xmlDocPtr RVT);
  1675. XSLTPUBFUN int XSLTCALL
  1676. xsltTransStorageAdd (xsltTransformContextPtr ctxt,
  1677. void *id,
  1678. void *data);
  1679. XSLTPUBFUN void * XSLTCALL
  1680. xsltTransStorageRemove (xsltTransformContextPtr ctxt,
  1681. void *id);
  1682. /*
  1683. * Extra functions for Attribute Value Templates
  1684. */
  1685. XSLTPUBFUN void XSLTCALL
  1686. xsltCompileAttr (xsltStylesheetPtr style,
  1687. xmlAttrPtr attr);
  1688. XSLTPUBFUN xmlChar * XSLTCALL
  1689. xsltEvalAVT (xsltTransformContextPtr ctxt,
  1690. void *avt,
  1691. xmlNodePtr node);
  1692. XSLTPUBFUN void XSLTCALL
  1693. xsltFreeAVTList (void *avt);
  1694. /*
  1695. * Extra function for successful xsltCleanupGlobals / xsltInit sequence.
  1696. */
  1697. XSLTPUBFUN void XSLTCALL
  1698. xsltUninit (void);
  1699. /************************************************************************
  1700. * *
  1701. * Compile-time functions for *internal* use only *
  1702. * *
  1703. ************************************************************************/
  1704. #ifdef XSLT_REFACTORED
  1705. XSLTPUBFUN void XSLTCALL
  1706. xsltParseSequenceConstructor(
  1707. xsltCompilerCtxtPtr cctxt,
  1708. xmlNodePtr start);
  1709. XSLTPUBFUN int XSLTCALL
  1710. xsltParseAnyXSLTElem (xsltCompilerCtxtPtr cctxt,
  1711. xmlNodePtr elem);
  1712. #ifdef XSLT_REFACTORED_XSLT_NSCOMP
  1713. XSLTPUBFUN int XSLTCALL
  1714. xsltRestoreDocumentNamespaces(
  1715. xsltNsMapPtr ns,
  1716. xmlDocPtr doc);
  1717. #endif
  1718. #endif /* XSLT_REFACTORED */
  1719. /************************************************************************
  1720. * *
  1721. * Transformation-time functions for *internal* use only *
  1722. * *
  1723. ************************************************************************/
  1724. XSLTPUBFUN int XSLTCALL
  1725. xsltInitCtxtKey (xsltTransformContextPtr ctxt,
  1726. xsltDocumentPtr doc,
  1727. xsltKeyDefPtr keyd);
  1728. XSLTPUBFUN int XSLTCALL
  1729. xsltInitAllDocKeys (xsltTransformContextPtr ctxt);
  1730. #ifdef __cplusplus
  1731. }
  1732. #endif
  1733. #endif /* __XML_XSLT_H__ */