xslt-processor 3.3.0 → 3.4.0

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.
package/README.md CHANGED
@@ -17,12 +17,16 @@ _A JavaScript XSLT processor without native library dependencies._
17
17
 
18
18
  ## How to
19
19
 
20
- Install xslt-processor using [npm](https://docs.npmjs.com/about-npm) or [yarn](https://yarnpkg.com):
20
+ Install xslt-processor using [npm](https://docs.npmjs.com/about-npm), [ohpm](https://ohpm.openharmony.cn/#/en/home) or [yarn](https://yarnpkg.com):
21
21
 
22
22
  ```sh
23
23
  npm install xslt-processor
24
24
  ```
25
25
 
26
+ ```sh
27
+ ohpm install xslt-processor
28
+ ```
29
+
26
30
  ```sh
27
31
  yarn add xslt-processor
28
32
  ```
@@ -85,7 +89,7 @@ const xslt = new Xslt(options);
85
89
  - `cData` (`boolean`, default `true`): resolves CDATA elements in the output. Content under CDATA is resolved as text. This overrides `escape` for CDATA content.
86
90
  - `escape` (`boolean`, default `true`): replaces symbols like `<`, `>`, `&` and `"` by the corresponding [HTML/XML entities](https://www.tutorialspoint.com/xml/xml_character_entities.htm). Can be overridden by `disable-output-escaping`, that also does the opposite, unescaping `&gt;` and `&lt;` by `<` and `>`, respectively.
87
91
  - `selfClosingTags` (`boolean`, default `true`): Self-closes tags that don't have inner elements, if `true`. For instance, `<test></test>` becomes `<test />`.
88
- - `outputMethod` (`string`, default `xml`): Specifies the default output method. if `<xsl:output>` is declared in your XSLT file, this will be overridden.
92
+ - `outputMethod` (`string`, default `xml`): Specifies the default output method. if `<xsl:output>` is declared in your XSLT file, this will be overridden. Valid values: `xml`, `html`, `text`, `name`, `xhtml`.
89
93
  - `parameters` (`array`, default `[]`): external parameters that you want to use.
90
94
  - `name`: the parameter name;
91
95
  - `namespaceUri` (optional): the namespace;
@@ -123,6 +127,8 @@ const outXmlString = xslt.xsltProcess( // Not async.
123
127
 
124
128
  Version 3 received `<xsl:include>` which relies on Fetch API, which is asynchronous. Version 2 doesn't support `<xsl:include>`.
125
129
 
130
+ If using Node.js older than version v17.5.0, please use version 3.2.3, that uses `node-fetch` package. Versions 3.3.0 onward require at least Node.js version v17.5.0, since they use native `fetch()` function.
131
+
126
132
  #### Version 1
127
133
 
128
134
  Until version 1.2.8, use like the example below:
@@ -219,3 +225,4 @@ HTML per se is not strict XML. Because of that, starting on version 2.0.0, this
219
225
  - XSLT Specification: http://www.w3.org/TR/1999/REC-xslt-19991116
220
226
  - W3C DOM Level 3 Core Specification: http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/
221
227
  - ECMAScript Language Specification: http://www.ecma-international.org/publications/standards/Ecma-262.htm
228
+ - Arkts Language Specification: https://gitee.com/openharmony/arkcompiler_runtime_core/releases/download/ArkTS-spec-1.2.0-alpha-20250307/arktsspecification.pdf
@@ -2,5 +2,5 @@ export type XmlOutputOptions = {
2
2
  cData: boolean;
3
3
  escape: boolean;
4
4
  selfClosingTags: boolean;
5
- outputMethod: 'xml' | 'html' | 'text' | 'name';
5
+ outputMethod: 'xml' | 'html' | 'text' | 'name' | 'xhtml';
6
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xslt-processor",
3
- "version": "3.3.0",
3
+ "version": "3.4.0",
4
4
  "description": "A JavaScript XSLT Processor",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
@@ -48,6 +48,7 @@
48
48
  "@rollup/plugin-typescript": "^11.1.1",
49
49
  "@types/he": "^1.2.0",
50
50
  "@types/jest": "^29.5.12",
51
+ "@types/node": "^22.9.0",
51
52
  "@types/node-fetch": "^2.6.11",
52
53
  "@typescript-eslint/eslint-plugin": "^8.4.0",
53
54
  "@typescript-eslint/parser": "^8.4.0",
@@ -67,19 +68,10 @@
67
68
  "rollup-plugin-terser": "^4.0.3",
68
69
  "ts-jest": "^29.2.5",
69
70
  "ts-node": "^10.9.2",
70
- "typescript": "^5.5.4"
71
+ "typescript": "^5.9.2"
71
72
  },
72
73
  "dependencies": {
73
- "he": "^1.2.0",
74
- "node-fetch": "release-2.x"
75
- },
76
- "overrides": {
77
- "node-fetch@release-2.x": {
78
- "whatwg-url": "14.x"
79
- }
80
- },
81
- "resolutions": {
82
- "whatwg-url": "14.x"
74
+ "he": "^1.2.0"
83
75
  },
84
76
  "copyFiles": [
85
77
  {
@@ -2,5 +2,5 @@ export type XmlOutputOptions = {
2
2
  cData: boolean;
3
3
  escape: boolean;
4
4
  selfClosingTags: boolean;
5
- outputMethod: 'xml' | 'html' | 'text' | 'name';
5
+ outputMethod: 'xml' | 'html' | 'text' | 'name' | 'xhtml';
6
6
  };
@@ -34,7 +34,7 @@ export declare class Xslt {
34
34
  options: XsltOptions;
35
35
  decimalFormatSettings: XsltDecimalFormatSettings;
36
36
  outputDocument: XDocument;
37
- outputMethod: 'xml' | 'html' | 'text' | 'name';
37
+ outputMethod: 'xml' | 'html' | 'text' | 'name' | 'xhtml';
38
38
  outputOmitXmlDeclaration: string;
39
39
  version: string;
40
40
  firstTemplateRan: boolean;
@@ -265,5 +265,11 @@ export declare class Xslt {
265
265
  * @param template The template node.
266
266
  */
267
267
  protected xsltWithParam(context: ExprContext, template: XNode): Promise<void>;
268
+ /**
269
+ * Test if the given element is an XSLT element, optionally the one with the given name.
270
+ * @param {XNode} element The element.
271
+ * @param {string} opt_wantedName The name for comparison.
272
+ * @returns True, if element is an XSL node. False otherwise.
273
+ */
268
274
  protected isXsltElement(element: XNode, opt_wantedName?: string): boolean;
269
275
  }