xsltInternals.h 56 KB

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