xsltInternals.h 56 KB

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