xslt-processor 1.1.2 → 1.1.4
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 +15 -2
- package/dom/index.d.ts +1 -0
- package/dom/index.js +1 -0
- package/dom/index.js.map +1 -1
- package/dom/xml-functions.d.ts +4 -3
- package/dom/xml-functions.js +18 -16
- package/dom/xml-functions.js.map +1 -1
- package/dom/xml-output-options.d.ts +4 -0
- package/dom/xml-output-options.js +3 -0
- package/dom/xml-output-options.js.map +1 -0
- package/index.d.ts +1 -1
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/umd/dom/index.d.ts +1 -0
- package/umd/dom/xml-functions.d.ts +4 -3
- package/umd/dom/xml-output-options.d.ts +4 -0
- package/umd/index.d.ts +1 -1
- package/umd/xpath/expr-context.d.ts +2 -2
- package/umd/xslt/index.d.ts +3 -0
- package/umd/xslt/xslt-options.d.ts +5 -0
- package/umd/xslt/xslt-parameter.d.ts +5 -0
- package/umd/{xslt.d.ts → xslt/xslt.d.ts} +25 -17
- package/umd/xslt-processor.js +1 -1
- package/umd/xslt-processor.js.map +1 -1
- package/xpath/expr-context.d.ts +2 -2
- package/xpath/expr-context.js +2 -4
- package/xpath/expr-context.js.map +1 -1
- package/xslt/index.d.ts +3 -0
- package/xslt/index.js +20 -0
- package/xslt/index.js.map +1 -0
- package/xslt/xslt-options.d.ts +5 -0
- package/xslt/xslt-options.js +3 -0
- package/xslt/xslt-options.js.map +1 -0
- package/xslt/xslt-parameter.d.ts +5 -0
- package/xslt/xslt-parameter.js +3 -0
- package/xslt/xslt-parameter.js.map +1 -0
- package/{xslt.d.ts → xslt/xslt.d.ts} +25 -17
- package/{xslt.js → xslt/xslt.js} +65 -50
- package/xslt/xslt.js.map +1 -0
- package/xslt.js.map +0 -1
package/README.md
CHANGED
|
@@ -59,15 +59,28 @@ const xPath = new XPath();
|
|
|
59
59
|
|
|
60
60
|
If you write pre-2015 JS code, make adjustments as needed.
|
|
61
61
|
|
|
62
|
+
### `Xslt` class options
|
|
63
|
+
|
|
64
|
+
You can pass an `options` object to `Xslt` class:
|
|
65
|
+
|
|
66
|
+
```js
|
|
67
|
+
const options = {
|
|
68
|
+
escape: false
|
|
69
|
+
};
|
|
70
|
+
const xslt = new Xslt(options);
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
- `escape` (`boolean`, default `true`): replaces symbols like `<`, `>`, `&` and `"` by the corresponding [XML entities](https://www.tutorialspoint.com/xml/xml_character_entities.htm).
|
|
74
|
+
|
|
62
75
|
### Direct use in browsers
|
|
63
76
|
|
|
64
77
|
You can simply add a tag like this:
|
|
65
78
|
|
|
66
79
|
```html
|
|
67
|
-
<script type="application/javascript" src="https://www.unpkg.com/xslt-processor@1.1.
|
|
80
|
+
<script type="application/javascript" src="https://www.unpkg.com/xslt-processor@1.1.2/umd/xslt-processor.js"></script>
|
|
68
81
|
```
|
|
69
82
|
|
|
70
|
-
All the exports will live under `globalThis.XsltProcessor`.
|
|
83
|
+
All the exports will live under `globalThis.XsltProcessor`. [See a usage example here](https://github.com/DesignLiquido/xslt-processor/blob/main/interactive-tests/xslt.html).
|
|
71
84
|
|
|
72
85
|
### Breaking Changes
|
|
73
86
|
|
package/dom/index.d.ts
CHANGED
package/dom/index.js
CHANGED
|
@@ -17,5 +17,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./functions"), exports);
|
|
18
18
|
__exportStar(require("./xdocument"), exports);
|
|
19
19
|
__exportStar(require("./xml-functions"), exports);
|
|
20
|
+
__exportStar(require("./xml-output-options"), exports);
|
|
20
21
|
__exportStar(require("./xnode"), exports);
|
|
21
22
|
//# sourceMappingURL=index.js.map
|
package/dom/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/dom/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,8CAA4B;AAC5B,kDAAgC;AAChC,0CAAwB"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/dom/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,8CAA4B;AAC5B,kDAAgC;AAChC,uDAAqC;AACrC,0CAAwB"}
|
package/dom/xml-functions.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { XNode } from './xnode';
|
|
2
2
|
import { XDocument } from './xdocument';
|
|
3
|
+
import { XmlOutputOptions } from './xml-output-options';
|
|
3
4
|
export declare function xmlValue(node: any, disallowBrowserSpecificOptimization?: boolean): any;
|
|
4
5
|
export declare function xmlValue2(node: any, disallowBrowserSpecificOptimization?: boolean): any;
|
|
5
6
|
/**
|
|
@@ -11,11 +12,11 @@ export declare function xmlValue2(node: any, disallowBrowserSpecificOptimization
|
|
|
11
12
|
export declare function xmlText(node: XNode, opt_cdata?: boolean): string;
|
|
12
13
|
/**
|
|
13
14
|
* Returns the representation of a node as XML text.
|
|
14
|
-
* @param node The starting node.
|
|
15
|
-
* @param
|
|
15
|
+
* @param {XNode} node The starting node.
|
|
16
|
+
* @param {XmlOutputOptions} options XML output options.
|
|
16
17
|
* @returns The XML string.
|
|
17
18
|
*/
|
|
18
|
-
export declare function xmlTransformedText(node: XNode,
|
|
19
|
+
export declare function xmlTransformedText(node: XNode, options?: XmlOutputOptions): string;
|
|
19
20
|
/**
|
|
20
21
|
* Escape XML special markup chracters: tag delimiter < > and entity
|
|
21
22
|
* reference start delimiter &. The escaped string can be used in XML
|
package/dom/xml-functions.js
CHANGED
|
@@ -144,32 +144,35 @@ function xmlTextRecursive(node, buf, cdata) {
|
|
|
144
144
|
}
|
|
145
145
|
/**
|
|
146
146
|
* Returns the representation of a node as XML text.
|
|
147
|
-
* @param node The starting node.
|
|
148
|
-
* @param
|
|
147
|
+
* @param {XNode} node The starting node.
|
|
148
|
+
* @param {XmlOutputOptions} options XML output options.
|
|
149
149
|
* @returns The XML string.
|
|
150
150
|
*/
|
|
151
|
-
function xmlTransformedText(node,
|
|
152
|
-
if (
|
|
151
|
+
function xmlTransformedText(node, options) {
|
|
152
|
+
if (options === void 0) { options = {
|
|
153
|
+
cData: false,
|
|
154
|
+
escape: true
|
|
155
|
+
}; }
|
|
153
156
|
var buffer = [];
|
|
154
|
-
xmlTransformedTextRecursive(node, buffer,
|
|
157
|
+
xmlTransformedTextRecursive(node, buffer, options);
|
|
155
158
|
return buffer.join('');
|
|
156
159
|
}
|
|
157
160
|
exports.xmlTransformedText = xmlTransformedText;
|
|
158
|
-
function xmlTransformedTextRecursive(node, buffer,
|
|
161
|
+
function xmlTransformedTextRecursive(node, buffer, options) {
|
|
159
162
|
if (node.printed)
|
|
160
163
|
return;
|
|
161
164
|
var nodeType = node.transformedNodeType || node.nodeType;
|
|
162
165
|
var nodeValue = node.transformedNodeValue || node.nodeValue;
|
|
163
166
|
if (nodeType == constants_1.DOM_TEXT_NODE) {
|
|
164
167
|
if (node.transformedNodeValue && node.transformedNodeValue.trim() !== '') {
|
|
165
|
-
var finalText = node.escape ?
|
|
168
|
+
var finalText = node.escape && options.escape ?
|
|
166
169
|
xmlEscapeText(node.transformedNodeValue) :
|
|
167
170
|
node.transformedNodeValue;
|
|
168
171
|
buffer.push(finalText);
|
|
169
172
|
}
|
|
170
173
|
}
|
|
171
174
|
else if (nodeType == constants_1.DOM_CDATA_SECTION_NODE) {
|
|
172
|
-
if (
|
|
175
|
+
if (options.cData) {
|
|
173
176
|
buffer.push(nodeValue);
|
|
174
177
|
}
|
|
175
178
|
else {
|
|
@@ -184,17 +187,16 @@ function xmlTransformedTextRecursive(node, buffer, cdata) {
|
|
|
184
187
|
// had transformations, children should be present at output.
|
|
185
188
|
// This is called here "muted logic".
|
|
186
189
|
if (node.transformedNodeName !== null && node.transformedNodeName !== undefined) {
|
|
187
|
-
xmlElementLogicTrivial(node, buffer,
|
|
190
|
+
xmlElementLogicTrivial(node, buffer, options);
|
|
188
191
|
}
|
|
189
192
|
else {
|
|
190
|
-
xmlElementLogicMuted(node, buffer,
|
|
193
|
+
xmlElementLogicMuted(node, buffer, options);
|
|
191
194
|
}
|
|
192
195
|
}
|
|
193
196
|
else if (nodeType == constants_1.DOM_DOCUMENT_NODE || nodeType == constants_1.DOM_DOCUMENT_FRAGMENT_NODE) {
|
|
194
197
|
var childNodes = node.transformedChildNodes.concat(node.childNodes);
|
|
195
|
-
// const childNodes = node.transformedChildNodes.length > 0 ? node.transformedChildNodes : node.childNodes;
|
|
196
198
|
for (var i = 0; i < childNodes.length; ++i) {
|
|
197
|
-
xmlTransformedTextRecursive(childNodes[i], buffer,
|
|
199
|
+
xmlTransformedTextRecursive(childNodes[i], buffer, options);
|
|
198
200
|
}
|
|
199
201
|
}
|
|
200
202
|
node.printed = true;
|
|
@@ -205,7 +207,7 @@ function xmlTransformedTextRecursive(node, buffer, cdata) {
|
|
|
205
207
|
* @param buffer The XML buffer.
|
|
206
208
|
* @param cdata If using CDATA configuration.
|
|
207
209
|
*/
|
|
208
|
-
function xmlElementLogicTrivial(node, buffer,
|
|
210
|
+
function xmlElementLogicTrivial(node, buffer, options) {
|
|
209
211
|
buffer.push("<".concat(xmlFullNodeName(node)));
|
|
210
212
|
var attributes = node.transformedAttributes || node.attributes;
|
|
211
213
|
for (var i = 0; i < attributes.length; ++i) {
|
|
@@ -226,7 +228,7 @@ function xmlElementLogicTrivial(node, buffer, cdata) {
|
|
|
226
228
|
else {
|
|
227
229
|
buffer.push('>');
|
|
228
230
|
for (var i = 0; i < childNodes.length; ++i) {
|
|
229
|
-
xmlTransformedTextRecursive(childNodes[i], buffer,
|
|
231
|
+
xmlTransformedTextRecursive(childNodes[i], buffer, options);
|
|
230
232
|
}
|
|
231
233
|
buffer.push("</".concat(xmlFullNodeName(node), ">"));
|
|
232
234
|
}
|
|
@@ -239,10 +241,10 @@ function xmlElementLogicTrivial(node, buffer, cdata) {
|
|
|
239
241
|
* @param buffer The XML buffer.
|
|
240
242
|
* @param cdata If using CDATA configuration.
|
|
241
243
|
*/
|
|
242
|
-
function xmlElementLogicMuted(node, buffer,
|
|
244
|
+
function xmlElementLogicMuted(node, buffer, options) {
|
|
243
245
|
var childNodes = node.transformedChildNodes.length > 0 ? node.transformedChildNodes : node.childNodes;
|
|
244
246
|
for (var i = 0; i < childNodes.length; ++i) {
|
|
245
|
-
xmlTransformedTextRecursive(childNodes[i], buffer,
|
|
247
|
+
xmlTransformedTextRecursive(childNodes[i], buffer, options);
|
|
246
248
|
}
|
|
247
249
|
}
|
|
248
250
|
function xmlFullNodeName(node) {
|
package/dom/xml-functions.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xml-functions.js","sourceRoot":"","sources":["../../src/dom/xml-functions.ts"],"names":[],"mappings":";;;;;;AAAA,0CAAoB;AAEpB,0CAQsB;AACtB,yCAAmD;
|
|
1
|
+
{"version":3,"file":"xml-functions.js","sourceRoot":"","sources":["../../src/dom/xml-functions.ts"],"names":[],"mappings":";;;;;;AAAA,0CAAoB;AAEpB,0CAQsB;AACtB,yCAAmD;AAKnD,oEAAoE;AACpE,sEAAsE;AACtE,2EAA2E;AAC3E,8EAA8E;AAC9E,SAAgB,QAAQ,CAAC,IAAS,EAAE,mCAAoD;IAApD,oDAAA,EAAA,2CAAoD;IACpF,IAAI,CAAC,IAAI,EAAE;QACP,OAAO,EAAE,CAAC;KACb;IAED,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,IAAI,IAAI,CAAC,QAAQ,IAAI,yBAAa,IAAI,IAAI,CAAC,QAAQ,IAAI,kCAAsB,EAAE;QAC3E,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC;KACzB;SAAM,IAAI,IAAI,CAAC,QAAQ,IAAI,8BAAkB,EAAE;QAC5C,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC;KACzB;SAAM,IACH,IAAI,CAAC,QAAQ,IAAI,4BAAgB;QACjC,IAAI,CAAC,QAAQ,IAAI,6BAAiB;QAClC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;;GASG;AACH,SAAgB,eAAe,CAAC,IAAW,EAAE,IAAY;IACrD,kEAAkE;IAClE,oEAAoE;IACpE,eAAe;IACf,IAAM,KAAK,GAAG,IAAA,gCAAoB,EAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC/C,IAAI,KAAK,EAAE;QACP,OAAO,YAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;KAC3B;IAED,OAAO,KAAK,CAAC;AACjB,CAAC;AAVD,0CAUC;AAED;;;;;;;GAOG;AACH,SAAgB,gBAAgB,CAAC,IAAW;IACxC,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,SAAS,EAAE;QACrC,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;KACxD;IAED,IAAI,IAAI,CAAC,QAAQ,KAAK,6BAAiB,EAAE;QACrC,OAAO,IAAiB,CAAC;KAC5B;IAED,OAAO,gBAAgB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;AAChD,CAAC;AAVD,4CAUC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xml-output-options.js","sourceRoot":"","sources":["../../src/dom/xml-output-options.ts"],"names":[],"mappings":""}
|
package/index.d.ts
CHANGED
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,iCAAgC;AAAvB,8FAAA,KAAK,OAAA;AACd,+
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,iCAAgC;AAAvB,8FAAA,KAAK,OAAA;AACd,+BAA2C;AAAlC,4FAAA,IAAI,OAAA;AACb,6BAAgD;AAAvC,+FAAA,QAAQ,OAAA;AAAE,oGAAA,aAAa,OAAA;AAChC,iCAAsC;AAA7B,oGAAA,WAAW,OAAA"}
|
package/package.json
CHANGED
package/umd/dom/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { XNode } from './xnode';
|
|
2
2
|
import { XDocument } from './xdocument';
|
|
3
|
+
import { XmlOutputOptions } from './xml-output-options';
|
|
3
4
|
export declare function xmlValue(node: any, disallowBrowserSpecificOptimization?: boolean): any;
|
|
4
5
|
export declare function xmlValue2(node: any, disallowBrowserSpecificOptimization?: boolean): any;
|
|
5
6
|
/**
|
|
@@ -11,11 +12,11 @@ export declare function xmlValue2(node: any, disallowBrowserSpecificOptimization
|
|
|
11
12
|
export declare function xmlText(node: XNode, opt_cdata?: boolean): string;
|
|
12
13
|
/**
|
|
13
14
|
* Returns the representation of a node as XML text.
|
|
14
|
-
* @param node The starting node.
|
|
15
|
-
* @param
|
|
15
|
+
* @param {XNode} node The starting node.
|
|
16
|
+
* @param {XmlOutputOptions} options XML output options.
|
|
16
17
|
* @returns The XML string.
|
|
17
18
|
*/
|
|
18
|
-
export declare function xmlTransformedText(node: XNode,
|
|
19
|
+
export declare function xmlTransformedText(node: XNode, options?: XmlOutputOptions): string;
|
|
19
20
|
/**
|
|
20
21
|
* Escape XML special markup chracters: tag delimiter < > and entity
|
|
21
22
|
* reference start delimiter &. The escaped string can be used in XML
|
package/umd/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { XNode } from
|
|
1
|
+
import { XNode } from '../dom';
|
|
2
2
|
export declare class ExprContext {
|
|
3
3
|
position: number;
|
|
4
4
|
nodelist: XNode[];
|
|
@@ -12,7 +12,7 @@ export declare class ExprContext {
|
|
|
12
12
|
constructor(nodelist: any[], opt_position?: number, opt_parent?: any, opt_caseInsensitive?: any, opt_ignoreAttributesWithoutValue?: any, opt_returnOnFirstMatch?: any, opt_ignoreNonElementNodesForNTA?: any);
|
|
13
13
|
clone(opt_nodelist?: any[], opt_position?: any): ExprContext;
|
|
14
14
|
setVariable(name?: any, value?: any): void;
|
|
15
|
-
getVariable(name:
|
|
15
|
+
getVariable(name: string): any;
|
|
16
16
|
setNode(position: number): void;
|
|
17
17
|
contextSize(): number;
|
|
18
18
|
isCaseInsensitive(): any;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { XDocument, XNode } from '
|
|
2
|
-
import { ExprContext, XPath } from '
|
|
1
|
+
import { XDocument, XNode } from '../dom';
|
|
2
|
+
import { ExprContext, XPath } from '../xpath';
|
|
3
|
+
import { XsltOptions } from './xslt-options';
|
|
4
|
+
import { XsltParameter } from './xslt-parameter';
|
|
3
5
|
/**
|
|
4
6
|
* The main class for XSL-T processing. The implementation is NOT
|
|
5
7
|
* complete; some xsl element are left out.
|
|
@@ -26,9 +28,10 @@ import { ExprContext, XPath } from './xpath';
|
|
|
26
28
|
*/
|
|
27
29
|
export declare class Xslt {
|
|
28
30
|
xPath: XPath;
|
|
31
|
+
options: XsltOptions;
|
|
29
32
|
outputMethod: string;
|
|
30
33
|
outputOmitXmlDeclaration: string;
|
|
31
|
-
constructor();
|
|
34
|
+
constructor(options?: XsltOptions);
|
|
32
35
|
/**
|
|
33
36
|
* The exported entry point of the XSL-T processor.
|
|
34
37
|
* @param xmlDoc The input document root, as DOM node.
|
|
@@ -36,7 +39,7 @@ export declare class Xslt {
|
|
|
36
39
|
* @param parameters Additional parameters to be set as variables.
|
|
37
40
|
* @returns the processed document, as XML text in a string.
|
|
38
41
|
*/
|
|
39
|
-
xsltProcess(xmlDoc: XDocument, stylesheet: XDocument, parameters?:
|
|
42
|
+
xsltProcess(xmlDoc: XDocument, stylesheet: XDocument, parameters?: XsltParameter[]): string;
|
|
40
43
|
/**
|
|
41
44
|
* The main entry point of the XSL-T processor, as explained on the top of the file.
|
|
42
45
|
* @param context The input document root, as XPath ExprContext.
|
|
@@ -44,9 +47,7 @@ export declare class Xslt {
|
|
|
44
47
|
* @param output the root of the generated output, as DOM node.
|
|
45
48
|
* @param _parameters Extra parameters.
|
|
46
49
|
*/
|
|
47
|
-
protected xsltProcessContext(context: ExprContext, template: XNode, output: XNode, _parameters
|
|
48
|
-
[key: string]: any;
|
|
49
|
-
}): void;
|
|
50
|
+
protected xsltProcessContext(context: ExprContext, template: XNode, output: XNode, _parameters: XsltParameter[]): void;
|
|
50
51
|
/**
|
|
51
52
|
* Implements `xsl:copy` for all node types.
|
|
52
53
|
* @param {XNode} destination the node being copied to, part of output document
|
|
@@ -74,17 +75,24 @@ export declare class Xslt {
|
|
|
74
75
|
* @param override flag that defines if the value computed here
|
|
75
76
|
* overrides the one already in the input context if that is the
|
|
76
77
|
* case. I.e. decides if this is a default value or a local
|
|
77
|
-
* value. xsl:variable and xsl:with-param override; xsl:param doesn't.
|
|
78
|
+
* value. `xsl:variable` and `xsl:with-param` override; `xsl:param` doesn't.
|
|
78
79
|
*/
|
|
79
|
-
protected xsltVariable(input: ExprContext, template: any, override: boolean): void;
|
|
80
|
-
|
|
80
|
+
protected xsltVariable(input: ExprContext, template: any, override: boolean, _parameters: XsltParameter[]): void;
|
|
81
|
+
/**
|
|
82
|
+
* Implements xsl:choose and its child nodes xsl:when and
|
|
83
|
+
* xsl:otherwise.
|
|
84
|
+
* @param input The Expression Context.
|
|
85
|
+
* @param template The template.
|
|
86
|
+
* @param output The output.
|
|
87
|
+
*/
|
|
88
|
+
protected xsltChoose(input: ExprContext, template: any, output: any, _parameters: XsltParameter[]): void;
|
|
81
89
|
/**
|
|
82
90
|
* Implements `xsl:for-each`.
|
|
83
|
-
* @param
|
|
84
|
-
* @param template
|
|
85
|
-
* @param output
|
|
91
|
+
* @param input The Expression Context.
|
|
92
|
+
* @param template The template.
|
|
93
|
+
* @param output The output.
|
|
86
94
|
*/
|
|
87
|
-
protected xsltForEach(context: ExprContext, template: XNode, output: XNode): void;
|
|
95
|
+
protected xsltForEach(context: ExprContext, template: XNode, output: XNode, _parameters: XsltParameter[]): void;
|
|
88
96
|
protected groupBy(xs: any, key: any): any;
|
|
89
97
|
/**
|
|
90
98
|
* Traverses the template node tree. Calls the main processing
|
|
@@ -94,7 +102,7 @@ export declare class Xslt {
|
|
|
94
102
|
* @param template The XSL-T definition.
|
|
95
103
|
* @param output The XML output.
|
|
96
104
|
*/
|
|
97
|
-
protected xsltChildNodes(context: ExprContext, template: any, output: XNode): void;
|
|
105
|
+
protected xsltChildNodes(context: ExprContext, template: any, output: XNode, _parameters: XsltParameter[]): void;
|
|
98
106
|
/**
|
|
99
107
|
* Passes template text to the output. The current template node does
|
|
100
108
|
* not specify an XSL-T operation and therefore is appended to the
|
|
@@ -105,7 +113,7 @@ export declare class Xslt {
|
|
|
105
113
|
* @param output The output.
|
|
106
114
|
* @param outputDocument The output document, if the case.
|
|
107
115
|
*/
|
|
108
|
-
protected xsltPassThrough(context: ExprContext, template: any, output: XNode, outputDocument: XDocument): void;
|
|
116
|
+
protected xsltPassThrough(context: ExprContext, template: any, output: XNode, outputDocument: XDocument, _parameters?: XsltParameter[]): void;
|
|
109
117
|
/**
|
|
110
118
|
* Determines if a text node in the XSLT template document is to be
|
|
111
119
|
* stripped according to XSLT whitespace stripping rules.
|
|
@@ -153,7 +161,7 @@ export declare class Xslt {
|
|
|
153
161
|
* @param input TODO
|
|
154
162
|
* @param template TODO
|
|
155
163
|
*/
|
|
156
|
-
protected xsltWithParam(input:
|
|
164
|
+
protected xsltWithParam(input: ExprContext, template: any, _parameters: XsltParameter[]): void;
|
|
157
165
|
private absoluteXsltMatch;
|
|
158
166
|
private relativeXsltMatch;
|
|
159
167
|
protected isXsltElement(element: any, opt_wantedName?: string): boolean;
|