xslt-processor 3.0.1 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. package/constants.d.ts +12 -12
  2. package/constants.js +16 -16
  3. package/dom/functions.d.ts +14 -14
  4. package/dom/functions.js +56 -57
  5. package/dom/functions.js.map +1 -1
  6. package/dom/index.d.ts +6 -6
  7. package/dom/index.js +22 -22
  8. package/dom/util.d.ts +7 -7
  9. package/dom/util.js +42 -43
  10. package/dom/util.js.map +1 -1
  11. package/dom/xdocument.d.ts +16 -16
  12. package/dom/xdocument.js +73 -74
  13. package/dom/xdocument.js.map +1 -1
  14. package/dom/xml-functions.d.ts +58 -58
  15. package/dom/xml-functions.js +369 -370
  16. package/dom/xml-functions.js.map +1 -1
  17. package/dom/xml-output-options.d.ts +6 -6
  18. package/dom/xml-output-options.js +2 -2
  19. package/dom/xml-parser.d.ts +47 -47
  20. package/dom/xml-parser.js +307 -307
  21. package/dom/xml-parser.js.map +1 -1
  22. package/dom/xmltoken.d.ts +12 -12
  23. package/dom/xmltoken.js +101 -101
  24. package/dom/xnode.d.ts +73 -73
  25. package/dom/xnode.js +450 -450
  26. package/dom/xnode.js.map +1 -1
  27. package/index.d.ts +4 -4
  28. package/index.js +12 -12
  29. package/package.json +7 -7
  30. package/test-without-jest.d.ts +1 -0
  31. package/test-without-jest.js +63 -0
  32. package/test-without-jest.js.map +1 -0
  33. package/umd/constants.d.ts +12 -12
  34. package/umd/dom/functions.d.ts +14 -14
  35. package/umd/dom/index.d.ts +6 -6
  36. package/umd/dom/util.d.ts +7 -7
  37. package/umd/dom/xdocument.d.ts +16 -16
  38. package/umd/dom/xml-functions.d.ts +58 -58
  39. package/umd/dom/xml-output-options.d.ts +6 -6
  40. package/umd/dom/xml-parser.d.ts +47 -47
  41. package/umd/dom/xmltoken.d.ts +12 -12
  42. package/umd/dom/xnode.d.ts +73 -73
  43. package/umd/index.d.ts +4 -4
  44. package/umd/test-without-jest.d.ts +1 -0
  45. package/umd/xpath/common-function.d.ts +8 -8
  46. package/umd/xpath/expr-context.d.ts +111 -111
  47. package/umd/xpath/expressions/binary-expr.d.ts +11 -11
  48. package/umd/xpath/expressions/expression.d.ts +4 -4
  49. package/umd/xpath/expressions/filter-expr.d.ts +9 -9
  50. package/umd/xpath/expressions/function-call-expr.d.ts +12 -12
  51. package/umd/xpath/expressions/index.d.ts +13 -13
  52. package/umd/xpath/expressions/literal-expr.d.ts +7 -7
  53. package/umd/xpath/expressions/location-expr.d.ts +15 -15
  54. package/umd/xpath/expressions/number-expr.d.ts +7 -7
  55. package/umd/xpath/expressions/path-expr.d.ts +9 -9
  56. package/umd/xpath/expressions/predicate-expr.d.ts +8 -8
  57. package/umd/xpath/expressions/step-expr.d.ts +25 -25
  58. package/umd/xpath/expressions/token-expr.d.ts +7 -7
  59. package/umd/xpath/expressions/unary-minus-expr.d.ts +8 -8
  60. package/umd/xpath/expressions/union-expr.d.ts +9 -9
  61. package/umd/xpath/expressions/variable-expr.d.ts +7 -7
  62. package/umd/xpath/functions/index.d.ts +2 -2
  63. package/umd/xpath/functions/internal-functions.d.ts +2 -2
  64. package/umd/xpath/functions/non-standard.d.ts +12 -12
  65. package/umd/xpath/functions/standard-20.d.ts +5 -5
  66. package/umd/xpath/functions/standard.d.ts +40 -40
  67. package/umd/xpath/grammar-rule-candidate.d.ts +8 -8
  68. package/umd/xpath/index.d.ts +3 -3
  69. package/umd/xpath/match-resolver.d.ts +55 -55
  70. package/umd/xpath/node-tests/index.d.ts +8 -8
  71. package/umd/xpath/node-tests/node-test-any.d.ts +6 -6
  72. package/umd/xpath/node-tests/node-test-comment.d.ts +6 -6
  73. package/umd/xpath/node-tests/node-test-element-or-attribute.d.ts +6 -6
  74. package/umd/xpath/node-tests/node-test-name.d.ts +10 -10
  75. package/umd/xpath/node-tests/node-test-nc.d.ts +9 -9
  76. package/umd/xpath/node-tests/node-test-pi.d.ts +8 -8
  77. package/umd/xpath/node-tests/node-test-text.d.ts +6 -6
  78. package/umd/xpath/node-tests/node-test.d.ts +5 -5
  79. package/umd/xpath/tokens.d.ts +62 -62
  80. package/umd/xpath/values/boolean-value.d.ts +11 -11
  81. package/umd/xpath/values/index.d.ts +5 -5
  82. package/umd/xpath/values/node-set-value.d.ts +11 -11
  83. package/umd/xpath/values/node-value.d.ts +7 -7
  84. package/umd/xpath/values/number-value.d.ts +11 -11
  85. package/umd/xpath/values/string-value.d.ts +11 -11
  86. package/umd/xpath/xpath-grammar-rules.d.ts +68 -68
  87. package/umd/xpath/xpath-token-rule.d.ts +7 -7
  88. package/umd/xpath/xpath.d.ts +174 -174
  89. package/umd/xpathdebug.d.ts +2 -2
  90. package/umd/xslt/index.d.ts +3 -3
  91. package/umd/xslt/xslt-decimal-format-settings.d.ts +28 -28
  92. package/umd/xslt/xslt-options.d.ts +7 -7
  93. package/umd/xslt/xslt-parameter.d.ts +5 -5
  94. package/umd/xslt/xslt.d.ts +207 -207
  95. package/umd/xslt-processor.js +1 -15
  96. package/umd/xslt-processor.js.map +1 -1
  97. package/xpath/common-function.d.ts +8 -8
  98. package/xpath/common-function.js +31 -32
  99. package/xpath/common-function.js.map +1 -1
  100. package/xpath/expr-context.d.ts +111 -111
  101. package/xpath/expr-context.js +189 -189
  102. package/xpath/expr-context.js.map +1 -1
  103. package/xpath/expressions/binary-expr.d.ts +11 -11
  104. package/xpath/expressions/binary-expr.js +165 -165
  105. package/xpath/expressions/binary-expr.js.map +1 -1
  106. package/xpath/expressions/expression.d.ts +4 -4
  107. package/xpath/expressions/expression.js +9 -9
  108. package/xpath/expressions/filter-expr.d.ts +9 -9
  109. package/xpath/expressions/filter-expr.js +52 -52
  110. package/xpath/expressions/filter-expr.js.map +1 -1
  111. package/xpath/expressions/function-call-expr.d.ts +12 -12
  112. package/xpath/expressions/function-call-expr.js +95 -95
  113. package/xpath/expressions/function-call-expr.js.map +1 -1
  114. package/xpath/expressions/index.d.ts +13 -13
  115. package/xpath/expressions/index.js +29 -29
  116. package/xpath/expressions/literal-expr.d.ts +7 -7
  117. package/xpath/expressions/literal-expr.js +33 -33
  118. package/xpath/expressions/literal-expr.js.map +1 -1
  119. package/xpath/expressions/location-expr.d.ts +15 -15
  120. package/xpath/expressions/location-expr.js +98 -98
  121. package/xpath/expressions/location-expr.js.map +1 -1
  122. package/xpath/expressions/number-expr.d.ts +7 -7
  123. package/xpath/expressions/number-expr.js +33 -33
  124. package/xpath/expressions/number-expr.js.map +1 -1
  125. package/xpath/expressions/path-expr.d.ts +9 -9
  126. package/xpath/expressions/path-expr.js +51 -51
  127. package/xpath/expressions/path-expr.js.map +1 -1
  128. package/xpath/expressions/predicate-expr.d.ts +8 -8
  129. package/xpath/expressions/predicate-expr.js +40 -40
  130. package/xpath/expressions/predicate-expr.js.map +1 -1
  131. package/xpath/expressions/step-expr.d.ts +25 -25
  132. package/xpath/expressions/step-expr.js +280 -280
  133. package/xpath/expressions/step-expr.js.map +1 -1
  134. package/xpath/expressions/token-expr.d.ts +7 -7
  135. package/xpath/expressions/token-expr.js +33 -33
  136. package/xpath/expressions/token-expr.js.map +1 -1
  137. package/xpath/expressions/unary-minus-expr.d.ts +8 -8
  138. package/xpath/expressions/unary-minus-expr.js +33 -33
  139. package/xpath/expressions/unary-minus-expr.js.map +1 -1
  140. package/xpath/expressions/union-expr.d.ts +9 -9
  141. package/xpath/expressions/union-expr.js +50 -50
  142. package/xpath/expressions/union-expr.js.map +1 -1
  143. package/xpath/expressions/variable-expr.d.ts +7 -7
  144. package/xpath/expressions/variable-expr.js +32 -32
  145. package/xpath/expressions/variable-expr.js.map +1 -1
  146. package/xpath/functions/index.d.ts +2 -2
  147. package/xpath/functions/index.js +18 -18
  148. package/xpath/functions/internal-functions.d.ts +2 -2
  149. package/xpath/functions/internal-functions.js +21 -22
  150. package/xpath/functions/internal-functions.js.map +1 -1
  151. package/xpath/functions/non-standard.d.ts +12 -12
  152. package/xpath/functions/non-standard.js +44 -45
  153. package/xpath/functions/non-standard.js.map +1 -1
  154. package/xpath/functions/standard-20.d.ts +5 -5
  155. package/xpath/functions/standard-20.js +25 -26
  156. package/xpath/functions/standard-20.js.map +1 -1
  157. package/xpath/functions/standard.d.ts +40 -40
  158. package/xpath/functions/standard.js +441 -442
  159. package/xpath/functions/standard.js.map +1 -1
  160. package/xpath/grammar-rule-candidate.d.ts +8 -8
  161. package/xpath/grammar-rule-candidate.js +2 -2
  162. package/xpath/index.d.ts +3 -3
  163. package/xpath/index.js +19 -19
  164. package/xpath/match-resolver.d.ts +55 -55
  165. package/xpath/match-resolver.js +136 -136
  166. package/xpath/match-resolver.js.map +1 -1
  167. package/xpath/node-tests/index.d.ts +8 -8
  168. package/xpath/node-tests/index.js +17 -17
  169. package/xpath/node-tests/node-test-any.d.ts +6 -6
  170. package/xpath/node-tests/node-test-any.js +14 -14
  171. package/xpath/node-tests/node-test-comment.d.ts +6 -6
  172. package/xpath/node-tests/node-test-comment.js +14 -14
  173. package/xpath/node-tests/node-test-element-or-attribute.d.ts +6 -6
  174. package/xpath/node-tests/node-test-element-or-attribute.js +15 -15
  175. package/xpath/node-tests/node-test-name.d.ts +10 -10
  176. package/xpath/node-tests/node-test-name.js +38 -38
  177. package/xpath/node-tests/node-test-name.js.map +1 -1
  178. package/xpath/node-tests/node-test-nc.d.ts +9 -9
  179. package/xpath/node-tests/node-test-nc.js +16 -16
  180. package/xpath/node-tests/node-test-pi.d.ts +8 -8
  181. package/xpath/node-tests/node-test-pi.js +16 -16
  182. package/xpath/node-tests/node-test-text.d.ts +6 -6
  183. package/xpath/node-tests/node-test-text.js +14 -14
  184. package/xpath/node-tests/node-test.d.ts +5 -5
  185. package/xpath/node-tests/node-test.js +2 -2
  186. package/xpath/tokens.d.ts +62 -62
  187. package/xpath/tokens.js +300 -300
  188. package/xpath/values/boolean-value.d.ts +11 -11
  189. package/xpath/values/boolean-value.js +23 -23
  190. package/xpath/values/index.d.ts +5 -5
  191. package/xpath/values/index.js +46 -46
  192. package/xpath/values/node-set-value.d.ts +11 -11
  193. package/xpath/values/node-set-value.js +27 -27
  194. package/xpath/values/node-set-value.js.map +1 -1
  195. package/xpath/values/node-value.d.ts +7 -7
  196. package/xpath/values/node-value.js +2 -2
  197. package/xpath/values/number-value.d.ts +11 -11
  198. package/xpath/values/number-value.js +23 -23
  199. package/xpath/values/string-value.d.ts +11 -11
  200. package/xpath/values/string-value.js +23 -23
  201. package/xpath/xpath-grammar-rules.d.ts +68 -68
  202. package/xpath/xpath-grammar-rules.js +74 -74
  203. package/xpath/xpath-token-rule.d.ts +7 -7
  204. package/xpath/xpath-token-rule.js +2 -2
  205. package/xpath/xpath.d.ts +174 -174
  206. package/xpath/xpath.js +911 -911
  207. package/xpath/xpath.js.map +1 -1
  208. package/xpathdebug.d.ts +2 -2
  209. package/xpathdebug.js +187 -187
  210. package/xpathdebug.js.map +1 -1
  211. package/xslt/index.d.ts +3 -3
  212. package/xslt/index.js +19 -19
  213. package/xslt/xslt-decimal-format-settings.d.ts +28 -28
  214. package/xslt/xslt-decimal-format-settings.js +2 -2
  215. package/xslt/xslt-options.d.ts +7 -7
  216. package/xslt/xslt-options.js +2 -2
  217. package/xslt/xslt-parameter.d.ts +5 -5
  218. package/xslt/xslt-parameter.js +2 -2
  219. package/xslt/xslt.d.ts +207 -207
  220. package/xslt/xslt.js +1135 -1126
  221. package/xslt/xslt.js.map +1 -1
@@ -1,28 +1,28 @@
1
- /**
2
- * According to https://www.w3schools.com/xml/ref_xsl_el_decimal-format.asp:
3
- *
4
- * @property {string} name: Optional. Specifies a name for this format.
5
- * @property {string} decimalSeparator: Optional. Specifies the decimal point character. Default is ".".
6
- * @property {string} groupingSeparator: Optional. Specifies the thousands separator character. Default is ",".
7
- * @property {string} infinity: Optional. Specifies the string used to represent infinity. Default is "Infinity".
8
- * @property {string} minusSign: Optional. Specifies the character to represent negative numbers. Default is "-".
9
- * @property {string} naN: Optional. Specifies the string used when the value is not a number". Default is "NaN".
10
- * @property {string} percent: Optional. Specifies the percentage sign character. Default is "%".
11
- * @property {string} perMille: Optional. Specifies the per thousand sign character. Default is "‰".
12
- * @property {string} zeroDigit: Optional. Specifies the digit zero character. Default is "0".
13
- * @property {string} digit: Optional. Specifies the character used to indicate a place where a digit is required. Default is #.
14
- * @property {string} patternSeparator: Optional. Specifies the character used to separate positive and negative subpatterns in a format pattern. Default is ";".
15
- */
16
- export type XsltDecimalFormatSettings = {
17
- name?: string;
18
- decimalSeparator: string;
19
- groupingSeparator: string;
20
- infinity: string;
21
- minusSign: string;
22
- naN: string;
23
- percent: string;
24
- perMille: string;
25
- zeroDigit: string;
26
- digit: string;
27
- patternSeparator: string;
28
- };
1
+ /**
2
+ * According to https://www.w3schools.com/xml/ref_xsl_el_decimal-format.asp:
3
+ *
4
+ * @property {string} name: Optional. Specifies a name for this format.
5
+ * @property {string} decimalSeparator: Optional. Specifies the decimal point character. Default is ".".
6
+ * @property {string} groupingSeparator: Optional. Specifies the thousands separator character. Default is ",".
7
+ * @property {string} infinity: Optional. Specifies the string used to represent infinity. Default is "Infinity".
8
+ * @property {string} minusSign: Optional. Specifies the character to represent negative numbers. Default is "-".
9
+ * @property {string} naN: Optional. Specifies the string used when the value is not a number". Default is "NaN".
10
+ * @property {string} percent: Optional. Specifies the percentage sign character. Default is "%".
11
+ * @property {string} perMille: Optional. Specifies the per thousand sign character. Default is "‰".
12
+ * @property {string} zeroDigit: Optional. Specifies the digit zero character. Default is "0".
13
+ * @property {string} digit: Optional. Specifies the character used to indicate a place where a digit is required. Default is #.
14
+ * @property {string} patternSeparator: Optional. Specifies the character used to separate positive and negative subpatterns in a format pattern. Default is ";".
15
+ */
16
+ export type XsltDecimalFormatSettings = {
17
+ name?: string;
18
+ decimalSeparator: string;
19
+ groupingSeparator: string;
20
+ infinity: string;
21
+ minusSign: string;
22
+ naN: string;
23
+ percent: string;
24
+ perMille: string;
25
+ zeroDigit: string;
26
+ digit: string;
27
+ patternSeparator: string;
28
+ };
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=xslt-decimal-format-settings.js.map
@@ -1,7 +1,7 @@
1
- import { XsltParameter } from "./xslt-parameter";
2
- export type XsltOptions = {
3
- cData: boolean;
4
- escape: boolean;
5
- selfClosingTags: boolean;
6
- parameters?: XsltParameter[];
7
- };
1
+ import { XsltParameter } from "./xslt-parameter";
2
+ export type XsltOptions = {
3
+ cData: boolean;
4
+ escape: boolean;
5
+ selfClosingTags: boolean;
6
+ parameters?: XsltParameter[];
7
+ };
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=xslt-options.js.map
@@ -1,5 +1,5 @@
1
- export type XsltParameter = {
2
- name: string;
3
- namespaceUri?: string;
4
- value: any;
5
- };
1
+ export type XsltParameter = {
2
+ name: string;
3
+ namespaceUri?: string;
4
+ value: any;
5
+ };
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=xslt-parameter.js.map
package/xslt/xslt.d.ts CHANGED
@@ -1,207 +1,207 @@
1
- import { XDocument, XNode, XmlParser } from '../dom';
2
- import { ExprContext, XPath } from '../xpath';
3
- import { XsltOptions } from './xslt-options';
4
- import { XsltDecimalFormatSettings } from './xslt-decimal-format-settings';
5
- import { MatchResolver } from '../xpath/match-resolver';
6
- /**
7
- * The main class for XSL-T processing. The implementation is NOT
8
- * complete; some xsl element are left out.
9
- *
10
- * References:
11
- *
12
- * [XSLT] XSL-T Specification
13
- * <http://www.w3.org/TR/1999/REC-xslt-19991116>.
14
- *
15
- * [ECMA] ECMAScript Language Specification
16
- * <http://www.ecma-international.org/publications/standards/Ecma-262.htm>.
17
- *
18
- * The XSL processor API has one entry point, the function
19
- * xsltProcessContext(). It receives as arguments the starting point in the
20
- * input document as an XPath expression context, the DOM root node of
21
- * the XSL-T stylesheet, and a DOM node that receives the output.
22
- *
23
- * NOTE: Actually, XSL-T processing according to the specification is
24
- * defined as operation on text documents, not as operation on DOM
25
- * trees. So, strictly speaking, this implementation is not an XSL-T
26
- * processor, but the processing engine that needs to be complemented
27
- * by an XML parser and serializer in order to be complete. Those two
28
- * are found in the `dom` folder.
29
- */
30
- export declare class Xslt {
31
- xPath: XPath;
32
- xmlParser: XmlParser;
33
- matchResolver: MatchResolver;
34
- options: XsltOptions;
35
- decimalFormatSettings: XsltDecimalFormatSettings;
36
- outputDocument: XDocument;
37
- outputMethod: 'xml' | 'html' | 'text' | 'name';
38
- outputOmitXmlDeclaration: string;
39
- version: string;
40
- constructor(options?: Partial<XsltOptions>);
41
- /**
42
- * The exported entry point of the XSL-T processor.
43
- * @param xmlDoc The input document root, as DOM node.
44
- * @param stylesheet The stylesheet document root, as DOM node.
45
- * @returns the processed document, as XML text in a string.
46
- */
47
- xsltProcess(xmlDoc: XDocument, stylesheet: XDocument): Promise<string>;
48
- /**
49
- * The main entry point of the XSL-T processor, as explained on the top of the file.
50
- * @param context The input document root, as XPath `ExprContext`.
51
- * @param template The stylesheet document root, as DOM node.
52
- * @param output If set, the output where the transformation should occur.
53
- */
54
- protected xsltProcessContext(context: ExprContext, template: XNode, output?: XNode): Promise<void>;
55
- /**
56
- * Implements `xsl:apply-templates`.
57
- * @param context The Expression Context.
58
- * @param template The template.
59
- * @param output The output. Only used if there's no corresponding output node already defined.
60
- * @protected
61
- */
62
- protected xsltApplyTemplates(context: ExprContext, template: XNode, output?: XNode): Promise<void>;
63
- /**
64
- * Implements `xsl:attribute`.
65
- * @param context The Expression Context.
66
- * @param template The template.
67
- * @param output The output. Only used if there's no corresponding output node already defined.
68
- * @protected
69
- */
70
- protected xsltAttribute(context: ExprContext, template: XNode, output?: XNode): Promise<void>;
71
- /**
72
- * Implements `xsl:choose`, its child nodes `xsl:when`, and
73
- * `xsl:otherwise`.
74
- * @param context The Expression Context.
75
- * @param template The template.
76
- * @param output The output. Only used if there's no corresponding output node already defined.
77
- */
78
- protected xsltChoose(context: ExprContext, template: XNode, output: XNode): Promise<void>;
79
- /**
80
- * Implements `xsl:copy` for all node types.
81
- * @param {XNode} destination the node being copied to, part of output document.
82
- * @param {XNode} source the node being copied, part in input document.
83
- * @returns {XNode|null} If an element node was created, the element node. Otherwise, null.
84
- */
85
- protected xsltCopy(destination: XNode, source: XNode): XNode;
86
- /**
87
- * Implements `xsl:copy-of` for node-set values of the select
88
- * expression. Recurses down the source node tree, which is part of
89
- * the input document.
90
- * @param {XNode} destination the node being copied to, part of output document.
91
- * @param {XNode} source the node being copied, part in input document.
92
- */
93
- protected xsltCopyOf(destination: XNode, source: XNode): void;
94
- /**
95
- * Implements `xsl:for-each`.
96
- * @param context The Expression Context.
97
- * @param template The template.
98
- * @param output The output.
99
- */
100
- protected xsltForEach(context: ExprContext, template: XNode, output: XNode): Promise<void>;
101
- /**
102
- * Implements `xsl:include`.
103
- * @param context The Expression Context.
104
- * @param template The template.
105
- * @param output The output.
106
- */
107
- protected xsltInclude(context: ExprContext, template: XNode, output: XNode): Promise<void>;
108
- /**
109
- * Orders the current node list in the input context according to the
110
- * sort order specified by xsl:sort child nodes of the current
111
- * template node. This happens before the operation specified by the
112
- * current template node is executed.
113
- * @param context The expression context.
114
- * @param template The template node.
115
- * @todo case-order is not implemented.
116
- */
117
- protected xsltSort(context: ExprContext, template: XNode): void;
118
- /**
119
- * Implements `<xsl:stylesheet>` and `<xsl:transform>`, and its corresponding
120
- * validations.
121
- * @param template The `<xsl:stylesheet>` or `<xsl:transform>` node.
122
- * @param context The Expression Context.
123
- * @param output The output XML.
124
- */
125
- protected xsltTransformOrStylesheet(template: XNode, context: ExprContext, output: XNode): Promise<void>;
126
- /**
127
- * Evaluates a variable or parameter and set it in the current input
128
- * context. Implements `xsl:variable`, `xsl:param`, and `xsl:with-param`.
129
- *
130
- * @param context The expression context.
131
- * @param template The template node.
132
- * @param override flag that defines if the value computed here
133
- * overrides the one already in the input context if that is the
134
- * case. I.e. decides if this is a default value or a local
135
- * value. `xsl:variable` and `xsl:with-param` override; `xsl:param` doesn't.
136
- */
137
- protected xsltVariable(context: ExprContext, template: XNode, override: boolean): Promise<void>;
138
- /**
139
- * Traverses the template node tree. Calls the main processing
140
- * function with the current input context for every child node of the
141
- * current template node.
142
- * @param context Normally the Expression Context.
143
- * @param template The XSL-T definition.
144
- * @param output If set, the output where the transformation should occur.
145
- */
146
- protected xsltChildNodes(context: ExprContext, template: XNode, output?: XNode): Promise<void>;
147
- /**
148
- * This logic is used in two different places:
149
- * - `xsltPassThrough`, if the template asks this library to write a text node;
150
- * - `xsltProcessContext`, `apply-templates` operation, when the current node is text.
151
- * @param context The Expression Context.
152
- * @param template The template, that contains the node value to be written.
153
- * @param output The output.
154
- */
155
- private commonLogicTextNode;
156
- /**
157
- * Passes template text to the output. The current template node does
158
- * not specify an XSL-T operation and therefore is appended to the
159
- * output with all its attributes. Then continues traversing the
160
- * template node tree.
161
- * @param context The Expression Context.
162
- * @param template The XSLT stylesheet or transformation.
163
- * @param output The output.
164
- */
165
- protected xsltPassThrough(context: ExprContext, template: XNode, output: XNode): Promise<void>;
166
- /**
167
- * Determines if a text node in the XSLT template document is to be
168
- * stripped according to XSLT whitespace stripping rules.
169
- * @see [XSLT], section 3.4.
170
- * @param template The XSLT template.
171
- * @returns TODO
172
- * @todo Whitespace stripping on the input document is
173
- * currently not implemented.
174
- */
175
- protected xsltPassText(template: XNode): boolean;
176
- protected findAttributeInContext(attributeName: string, context: ExprContext): XNode;
177
- /**
178
- * Evaluates an XSL-T attribute value template. Attribute value
179
- * templates are attributes on XSL-T elements that contain XPath
180
- * expressions in braces {}. The XSL-T expressions are evaluated in
181
- * the current input context.
182
- * @param value TODO
183
- * @param context TODO
184
- * @returns TODO
185
- */
186
- protected xsltAttributeValue(value: any, context: ExprContext): any;
187
- /**
188
- * Evaluates an XPath expression in the current input context as a
189
- * match.
190
- * @see [XSLT] section 5.2, paragraph 1
191
- * @param match TODO
192
- * @param context The Expression Context.
193
- * @param axis The XPath axis. Used when the match does not start with the parent.
194
- * @returns {XNode[]} A list of the found nodes.
195
- */
196
- protected xsltMatch(match: string, context: ExprContext, axis?: string): XNode[];
197
- /**
198
- * Sets parameters defined by xsl:with-param child nodes of the
199
- * current template node, in the current input context. This happens
200
- * before the operation specified by the current template node is
201
- * executed.
202
- * @param context The Expression Context.
203
- * @param template The template node.
204
- */
205
- protected xsltWithParam(context: ExprContext, template: XNode): Promise<void>;
206
- protected isXsltElement(element: any, opt_wantedName?: string): boolean;
207
- }
1
+ import { XDocument, XNode, XmlParser } from '../dom';
2
+ import { ExprContext, XPath } from '../xpath';
3
+ import { XsltOptions } from './xslt-options';
4
+ import { XsltDecimalFormatSettings } from './xslt-decimal-format-settings';
5
+ import { MatchResolver } from '../xpath/match-resolver';
6
+ /**
7
+ * The main class for XSL-T processing. The implementation is NOT
8
+ * complete; some xsl element are left out.
9
+ *
10
+ * References:
11
+ *
12
+ * [XSLT] XSL-T Specification
13
+ * <http://www.w3.org/TR/1999/REC-xslt-19991116>.
14
+ *
15
+ * [ECMA] ECMAScript Language Specification
16
+ * <http://www.ecma-international.org/publications/standards/Ecma-262.htm>.
17
+ *
18
+ * The XSL processor API has one entry point, the function
19
+ * xsltProcessContext(). It receives as arguments the starting point in the
20
+ * input document as an XPath expression context, the DOM root node of
21
+ * the XSL-T stylesheet, and a DOM node that receives the output.
22
+ *
23
+ * NOTE: Actually, XSL-T processing according to the specification is
24
+ * defined as operation on text documents, not as operation on DOM
25
+ * trees. So, strictly speaking, this implementation is not an XSL-T
26
+ * processor, but the processing engine that needs to be complemented
27
+ * by an XML parser and serializer in order to be complete. Those two
28
+ * are found in the `dom` folder.
29
+ */
30
+ export declare class Xslt {
31
+ xPath: XPath;
32
+ xmlParser: XmlParser;
33
+ matchResolver: MatchResolver;
34
+ options: XsltOptions;
35
+ decimalFormatSettings: XsltDecimalFormatSettings;
36
+ outputDocument: XDocument;
37
+ outputMethod: 'xml' | 'html' | 'text' | 'name';
38
+ outputOmitXmlDeclaration: string;
39
+ version: string;
40
+ constructor(options?: Partial<XsltOptions>);
41
+ /**
42
+ * The exported entry point of the XSL-T processor.
43
+ * @param xmlDoc The input document root, as DOM node.
44
+ * @param stylesheet The stylesheet document root, as DOM node.
45
+ * @returns the processed document, as XML text in a string.
46
+ */
47
+ xsltProcess(xmlDoc: XDocument, stylesheet: XDocument): Promise<string>;
48
+ /**
49
+ * The main entry point of the XSL-T processor, as explained on the top of the file.
50
+ * @param context The input document root, as XPath `ExprContext`.
51
+ * @param template The stylesheet document root, as DOM node.
52
+ * @param output If set, the output where the transformation should occur.
53
+ */
54
+ protected xsltProcessContext(context: ExprContext, template: XNode, output?: XNode): Promise<void>;
55
+ /**
56
+ * Implements `xsl:apply-templates`.
57
+ * @param context The Expression Context.
58
+ * @param template The template.
59
+ * @param output The output. Only used if there's no corresponding output node already defined.
60
+ * @protected
61
+ */
62
+ protected xsltApplyTemplates(context: ExprContext, template: XNode, output?: XNode): Promise<void>;
63
+ /**
64
+ * Implements `xsl:attribute`.
65
+ * @param context The Expression Context.
66
+ * @param template The template.
67
+ * @param output The output. Only used if there's no corresponding output node already defined.
68
+ * @protected
69
+ */
70
+ protected xsltAttribute(context: ExprContext, template: XNode, output?: XNode): Promise<void>;
71
+ /**
72
+ * Implements `xsl:choose`, its child nodes `xsl:when`, and
73
+ * `xsl:otherwise`.
74
+ * @param context The Expression Context.
75
+ * @param template The template.
76
+ * @param output The output. Only used if there's no corresponding output node already defined.
77
+ */
78
+ protected xsltChoose(context: ExprContext, template: XNode, output?: XNode): Promise<void>;
79
+ /**
80
+ * Implements `xsl:copy` for all node types.
81
+ * @param {XNode} destination the node being copied to, part of output document.
82
+ * @param {XNode} source the node being copied, part in input document.
83
+ * @returns {XNode|null} If an element node was created, the element node. Otherwise, null.
84
+ */
85
+ protected xsltCopy(destination: XNode, source: XNode): XNode;
86
+ /**
87
+ * Implements `xsl:copy-of` for node-set values of the select
88
+ * expression. Recurses down the source node tree, which is part of
89
+ * the input document.
90
+ * @param {XNode} destination the node being copied to, part of output document.
91
+ * @param {XNode} source the node being copied, part in input document.
92
+ */
93
+ protected xsltCopyOf(destination: XNode, source: XNode): void;
94
+ /**
95
+ * Implements `xsl:for-each`.
96
+ * @param context The Expression Context.
97
+ * @param template The template.
98
+ * @param output The output.
99
+ */
100
+ protected xsltForEach(context: ExprContext, template: XNode, output: XNode): Promise<void>;
101
+ /**
102
+ * Implements `xsl:include`.
103
+ * @param context The Expression Context.
104
+ * @param template The template.
105
+ * @param output The output.
106
+ */
107
+ protected xsltInclude(context: ExprContext, template: XNode, output: XNode): Promise<void>;
108
+ /**
109
+ * Orders the current node list in the input context according to the
110
+ * sort order specified by xsl:sort child nodes of the current
111
+ * template node. This happens before the operation specified by the
112
+ * current template node is executed.
113
+ * @param context The expression context.
114
+ * @param template The template node.
115
+ * @todo case-order is not implemented.
116
+ */
117
+ protected xsltSort(context: ExprContext, template: XNode): void;
118
+ /**
119
+ * Implements `<xsl:stylesheet>` and `<xsl:transform>`, and its corresponding
120
+ * validations.
121
+ * @param template The `<xsl:stylesheet>` or `<xsl:transform>` node.
122
+ * @param context The Expression Context.
123
+ * @param output The output XML.
124
+ */
125
+ protected xsltTransformOrStylesheet(template: XNode, context: ExprContext, output: XNode): Promise<void>;
126
+ /**
127
+ * Evaluates a variable or parameter and set it in the current input
128
+ * context. Implements `xsl:variable`, `xsl:param`, and `xsl:with-param`.
129
+ *
130
+ * @param context The expression context.
131
+ * @param template The template node.
132
+ * @param override flag that defines if the value computed here
133
+ * overrides the one already in the input context if that is the
134
+ * case. I.e. decides if this is a default value or a local
135
+ * value. `xsl:variable` and `xsl:with-param` override; `xsl:param` doesn't.
136
+ */
137
+ protected xsltVariable(context: ExprContext, template: XNode, override: boolean): Promise<void>;
138
+ /**
139
+ * Traverses the template node tree. Calls the main processing
140
+ * function with the current input context for every child node of the
141
+ * current template node.
142
+ * @param context Normally the Expression Context.
143
+ * @param template The XSL-T definition.
144
+ * @param output If set, the output where the transformation should occur.
145
+ */
146
+ protected xsltChildNodes(context: ExprContext, template: XNode, output?: XNode): Promise<void>;
147
+ /**
148
+ * This logic is used in two different places:
149
+ * - `xsltPassThrough`, if the template asks this library to write a text node;
150
+ * - `xsltProcessContext`, `apply-templates` operation, when the current node is text.
151
+ * @param context The Expression Context.
152
+ * @param template The template, that contains the node value to be written.
153
+ * @param output The output.
154
+ */
155
+ private commonLogicTextNode;
156
+ /**
157
+ * Passes template text to the output. The current template node does
158
+ * not specify an XSL-T operation and therefore is appended to the
159
+ * output with all its attributes. Then continues traversing the
160
+ * template node tree.
161
+ * @param context The Expression Context.
162
+ * @param template The XSLT stylesheet or transformation.
163
+ * @param output The output.
164
+ */
165
+ protected xsltPassThrough(context: ExprContext, template: XNode, output: XNode): Promise<void>;
166
+ /**
167
+ * Determines if a text node in the XSLT template document is to be
168
+ * stripped according to XSLT whitespace stripping rules.
169
+ * @see [XSLT], section 3.4.
170
+ * @param template The XSLT template.
171
+ * @returns TODO
172
+ * @todo Whitespace stripping on the input document is
173
+ * currently not implemented.
174
+ */
175
+ protected xsltPassText(template: XNode): boolean;
176
+ protected findAttributeInContext(attributeName: string, context: ExprContext): XNode;
177
+ /**
178
+ * Evaluates an XSL-T attribute value template. Attribute value
179
+ * templates are attributes on XSL-T elements that contain XPath
180
+ * expressions in braces {}. The XSL-T expressions are evaluated in
181
+ * the current input context.
182
+ * @param value TODO
183
+ * @param context TODO
184
+ * @returns TODO
185
+ */
186
+ protected xsltAttributeValue(value: any, context: ExprContext): any;
187
+ /**
188
+ * Evaluates an XPath expression in the current input context as a
189
+ * match.
190
+ * @see [XSLT] section 5.2, paragraph 1
191
+ * @param match TODO
192
+ * @param context The Expression Context.
193
+ * @param axis The XPath axis. Used when the match does not start with the parent.
194
+ * @returns {XNode[]} A list of the found nodes.
195
+ */
196
+ protected xsltMatch(match: string, context: ExprContext, axis?: string): XNode[];
197
+ /**
198
+ * Sets parameters defined by xsl:with-param child nodes of the
199
+ * current template node, in the current input context. This happens
200
+ * before the operation specified by the current template node is
201
+ * executed.
202
+ * @param context The Expression Context.
203
+ * @param template The template node.
204
+ */
205
+ protected xsltWithParam(context: ExprContext, template: XNode): Promise<void>;
206
+ protected isXsltElement(element: any, opt_wantedName?: string): boolean;
207
+ }