You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1982 lines
56 KiB

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