xslt-processor 1.1.5 → 1.2.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 +3 -1
- package/dom/functions.d.ts +11 -5
- package/dom/functions.js +11 -6
- package/dom/functions.js.map +1 -1
- package/dom/util.d.ts +2 -21
- package/dom/util.js +3 -111
- package/dom/util.js.map +1 -1
- package/dom/xdocument.d.ts +9 -9
- package/dom/xdocument.js.map +1 -1
- package/dom/xml-functions.d.ts +3 -3
- package/dom/xml-functions.js +41 -25
- package/dom/xml-functions.js.map +1 -1
- package/dom/xml-output-options.d.ts +1 -0
- package/dom/xnode.d.ts +8 -4
- package/dom/xnode.js +30 -11
- package/dom/xnode.js.map +1 -1
- package/package.json +1 -1
- package/umd/dom/functions.d.ts +11 -5
- package/umd/dom/util.d.ts +2 -21
- package/umd/dom/xdocument.d.ts +9 -9
- package/umd/dom/xml-functions.d.ts +3 -3
- package/umd/dom/xml-output-options.d.ts +1 -0
- package/umd/dom/xnode.d.ts +8 -4
- package/umd/xpath/common-function.d.ts +8 -0
- package/umd/xpath/expr-context.d.ts +79 -6
- package/umd/xpath/expressions/function-call-expr.d.ts +3 -41
- package/umd/xpath/expressions/location-expr.d.ts +2 -1
- package/umd/xpath/expressions/step-expr.d.ts +16 -6
- package/umd/xpath/expressions/union-expr.d.ts +4 -4
- package/umd/xpath/functions/index.d.ts +2 -0
- package/umd/xpath/functions/internal-functions.d.ts +2 -0
- package/umd/xpath/functions/non-standard.d.ts +12 -0
- package/umd/xpath/functions/standard.d.ts +33 -0
- package/umd/xpath/tokens.d.ts +2 -1
- package/umd/xpath/xpath.d.ts +27 -12
- package/umd/xslt/xslt-options.d.ts +1 -0
- package/umd/xslt/xslt.d.ts +32 -18
- package/umd/xslt-processor.js +2 -2
- package/umd/xslt-processor.js.map +1 -1
- package/xpath/common-function.d.ts +8 -0
- package/xpath/common-function.js +33 -0
- package/xpath/common-function.js.map +1 -0
- package/xpath/expr-context.d.ts +79 -6
- package/xpath/expr-context.js +82 -59
- package/xpath/expr-context.js.map +1 -1
- package/xpath/expressions/filter-expr.js +1 -1
- package/xpath/expressions/filter-expr.js.map +1 -1
- package/xpath/expressions/function-call-expr.d.ts +3 -41
- package/xpath/expressions/function-call-expr.js +42 -346
- package/xpath/expressions/function-call-expr.js.map +1 -1
- package/xpath/expressions/location-expr.d.ts +2 -1
- package/xpath/expressions/location-expr.js +9 -9
- package/xpath/expressions/location-expr.js.map +1 -1
- package/xpath/expressions/path-expr.js +2 -2
- package/xpath/expressions/path-expr.js.map +1 -1
- package/xpath/expressions/step-expr.d.ts +16 -6
- package/xpath/expressions/step-expr.js +184 -113
- package/xpath/expressions/step-expr.js.map +1 -1
- package/xpath/expressions/union-expr.d.ts +4 -4
- package/xpath/expressions/union-expr.js +3 -3
- package/xpath/expressions/union-expr.js.map +1 -1
- package/xpath/functions/index.d.ts +2 -0
- package/xpath/functions/index.js +19 -0
- package/xpath/functions/index.js.map +1 -0
- package/xpath/functions/internal-functions.d.ts +2 -0
- package/xpath/functions/internal-functions.js +23 -0
- package/xpath/functions/internal-functions.js.map +1 -0
- package/xpath/functions/non-standard.d.ts +12 -0
- package/xpath/functions/non-standard.js +46 -0
- package/xpath/functions/non-standard.js.map +1 -0
- package/xpath/functions/standard.d.ts +33 -0
- package/xpath/functions/standard.js +345 -0
- package/xpath/functions/standard.js.map +1 -0
- package/xpath/node-test-element-or-attribute.js +1 -1
- package/xpath/node-test-name.js +1 -1
- package/xpath/tokens.d.ts +2 -1
- package/xpath/tokens.js +19 -17
- package/xpath/tokens.js.map +1 -1
- package/xpath/values/index.js +32 -0
- package/xpath/values/index.js.map +1 -1
- package/xpath/values/string-value.js +0 -32
- package/xpath/values/string-value.js.map +1 -1
- package/xpath/xpath.d.ts +27 -12
- package/xpath/xpath.js +96 -75
- package/xpath/xpath.js.map +1 -1
- package/xpathdebug.js +4 -4
- package/xslt/xslt-options.d.ts +1 -0
- package/xslt/xslt.d.ts +32 -18
- package/xslt/xslt.js +232 -171
- package/xslt/xslt.js.map +1 -1
package/umd/xpath/xpath.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ExprContext } from './expr-context';
|
|
2
2
|
import { BinaryExpr, FunctionCallExpr, LiteralExpr, LocationExpr, NumberExpr, PathExpr, PredicateExpr, StepExpr, TokenExpr, UnaryMinusExpr, UnionExpr, VariableExpr } from './expressions';
|
|
3
|
+
import { Expression } from './expressions/expression';
|
|
3
4
|
import { NodeTestAny } from './node-test-any';
|
|
4
5
|
import { NodeTestComment } from './node-test-comment';
|
|
5
6
|
import { NodeTestElementOrAttribute } from './node-test-element-or-attribute';
|
|
@@ -19,6 +20,12 @@ export declare class XPath {
|
|
|
19
20
|
}[] | ((rel: any, slash: any, step: any) => any))[] | (number | {
|
|
20
21
|
label: string;
|
|
21
22
|
key: any;
|
|
23
|
+
} | {
|
|
24
|
+
label: string;
|
|
25
|
+
key: any;
|
|
26
|
+
}[] | ((nodeTest: any, axis?: string) => StepExpr))[] | (number | {
|
|
27
|
+
label: string;
|
|
28
|
+
key: any;
|
|
22
29
|
} | {
|
|
23
30
|
label: string;
|
|
24
31
|
}[] | ((name: any, pareno: any, arg1: any, args: any) => FunctionCallExpr))[] | (number | {
|
|
@@ -45,9 +52,9 @@ export declare class XPath {
|
|
|
45
52
|
makeLocationExpr7(rel: any, dslash: any, step: any): any;
|
|
46
53
|
makeStepExpr1(dot: any): StepExpr;
|
|
47
54
|
makeStepExpr2(ddot: any): StepExpr;
|
|
48
|
-
makeStepExpr3(axisname: any, axis: any,
|
|
49
|
-
makeStepExpr4(at: any,
|
|
50
|
-
makeStepExpr5(
|
|
55
|
+
makeStepExpr3(axisname: any, axis: any, nodeTest: any): StepExpr;
|
|
56
|
+
makeStepExpr4(at: any, nodeTest: any): StepExpr;
|
|
57
|
+
makeStepExpr5(nodeTest: any, axis?: string): StepExpr;
|
|
51
58
|
makeStepExpr6(step: any, predicate: any): any;
|
|
52
59
|
makeAbbrevStep(abbrev: any): StepExpr;
|
|
53
60
|
makeNodeTestExpr1(): NodeTestElementOrAttribute;
|
|
@@ -69,37 +76,45 @@ export declare class XPath {
|
|
|
69
76
|
makeLiteralExpr(token: any): LiteralExpr;
|
|
70
77
|
makeNumberExpr(token: any): NumberExpr;
|
|
71
78
|
makeVariableReference(dollar: any, name: any): VariableExpr;
|
|
72
|
-
|
|
79
|
+
/**
|
|
80
|
+
* Used before parsing for optimization of common simple cases. See
|
|
81
|
+
* the begin of xPathParse() for which they are.
|
|
82
|
+
* @param expression The XPath expression.
|
|
83
|
+
* @param axis The axis, if required. Default is 'child'.
|
|
84
|
+
* @returns An `Expression` object.
|
|
85
|
+
*/
|
|
86
|
+
makeSimpleExpr(expression: string, axis?: string): Expression;
|
|
73
87
|
makeSimpleExpr2(expr: any): LocationExpr;
|
|
74
88
|
stackToString(stack: any[]): string;
|
|
75
89
|
xPathCacheLookup(expr: any): any;
|
|
76
|
-
xPathCollectDescendants(
|
|
77
|
-
xPathCollectDescendantsReverse(
|
|
90
|
+
xPathCollectDescendants(nodeList: any, node: any, opt_tagName?: any): void;
|
|
91
|
+
xPathCollectDescendantsReverse(nodeList: any, node: any): void;
|
|
78
92
|
xPathEval(select: string, context: ExprContext): any;
|
|
79
93
|
/**
|
|
80
94
|
* DGF - extract a tag name suitable for getElementsByTagName
|
|
81
95
|
*
|
|
82
|
-
* @param
|
|
96
|
+
* @param nodeTest the node test
|
|
83
97
|
* @param ignoreNonElementNodesForNTA if true, the node list returned when
|
|
84
98
|
* evaluating "node()" will not contain
|
|
85
99
|
* non-element nodes. This can boost
|
|
86
100
|
* performance. This is false by default.
|
|
87
101
|
*/
|
|
88
|
-
xPathExtractTagNameFromNodeTest(
|
|
102
|
+
xPathExtractTagNameFromNodeTest(nodeTest: any, ignoreNonElementNodesForNTA: any): string;
|
|
89
103
|
xPathMatchStack(stack: any, pattern: any): any;
|
|
90
104
|
/**
|
|
91
105
|
* The entry point for the parser.
|
|
92
|
-
* @param
|
|
106
|
+
* @param expression a string that contains an XPath expression.
|
|
107
|
+
* @param axis The XPath axis. Used when the match does not start with the parent.
|
|
93
108
|
* @param xPathLog TODO
|
|
94
109
|
* @returns an expression object that can be evaluated with an
|
|
95
110
|
* expression context.
|
|
96
111
|
*/
|
|
97
|
-
xPathParse(
|
|
112
|
+
xPathParse(expression: string, axis?: string, xPathLog?: (message: string) => void): any;
|
|
98
113
|
xPathParseInit(xPathLog: Function): void;
|
|
99
|
-
xPathReduce(stack: any, ahead: any, xpathLog?: (message: string) => void): any;
|
|
114
|
+
xPathReduce(stack: any, ahead: any, axis?: string, xpathLog?: (message: string) => void): any;
|
|
100
115
|
xPathSort(context: ExprContext, sort: any[]): void;
|
|
101
116
|
xPathSortByKey(v1: any, v2: any): number;
|
|
102
|
-
xPathStep(nodes: any[], steps: any[], step: any, input: any,
|
|
117
|
+
xPathStep(nodes: any[], steps: any[], step: any, input: any, context: ExprContext): void;
|
|
103
118
|
xPathGrammarPrecedence(frame: any): number;
|
|
104
119
|
xPathTokenPrecedence(tag: any): any;
|
|
105
120
|
}
|
package/umd/xslt/xslt.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { XDocument, XNode } from '../dom';
|
|
2
2
|
import { ExprContext, XPath } from '../xpath';
|
|
3
3
|
import { XsltOptions } from './xslt-options';
|
|
4
|
-
import { XsltParameter } from './xslt-parameter';
|
|
5
4
|
/**
|
|
6
5
|
* The main class for XSL-T processing. The implementation is NOT
|
|
7
6
|
* complete; some xsl element are left out.
|
|
@@ -29,25 +28,24 @@ import { XsltParameter } from './xslt-parameter';
|
|
|
29
28
|
export declare class Xslt {
|
|
30
29
|
xPath: XPath;
|
|
31
30
|
options: XsltOptions;
|
|
31
|
+
outputDocument: XDocument;
|
|
32
32
|
outputMethod: string;
|
|
33
33
|
outputOmitXmlDeclaration: string;
|
|
34
|
-
constructor(options?: XsltOptions);
|
|
34
|
+
constructor(options?: Partial<XsltOptions>);
|
|
35
35
|
/**
|
|
36
36
|
* The exported entry point of the XSL-T processor.
|
|
37
37
|
* @param xmlDoc The input document root, as DOM node.
|
|
38
38
|
* @param stylesheet The stylesheet document root, as DOM node.
|
|
39
|
-
* @param parameters Additional parameters to be set as variables.
|
|
40
39
|
* @returns the processed document, as XML text in a string.
|
|
41
40
|
*/
|
|
42
|
-
xsltProcess(xmlDoc: XDocument, stylesheet: XDocument
|
|
41
|
+
xsltProcess(xmlDoc: XDocument, stylesheet: XDocument): string;
|
|
43
42
|
/**
|
|
44
43
|
* The main entry point of the XSL-T processor, as explained on the top of the file.
|
|
45
44
|
* @param context The input document root, as XPath ExprContext.
|
|
46
45
|
* @param template The stylesheet document root, as DOM node.
|
|
47
46
|
* @param output the root of the generated output, as DOM node.
|
|
48
|
-
* @param _parameters Extra parameters.
|
|
49
47
|
*/
|
|
50
|
-
protected xsltProcessContext(context: ExprContext, template: XNode, output: XNode
|
|
48
|
+
protected xsltProcessContext(context: ExprContext, template: XNode, output: XNode): void;
|
|
51
49
|
/**
|
|
52
50
|
* Implements `xsl:copy` for all node types.
|
|
53
51
|
* @param {XNode} destination the node being copied to, part of output document
|
|
@@ -77,7 +75,7 @@ export declare class Xslt {
|
|
|
77
75
|
* case. I.e. decides if this is a default value or a local
|
|
78
76
|
* value. `xsl:variable` and `xsl:with-param` override; `xsl:param` doesn't.
|
|
79
77
|
*/
|
|
80
|
-
protected xsltVariable(input: ExprContext, template: any, override: boolean
|
|
78
|
+
protected xsltVariable(input: ExprContext, template: any, override: boolean): void;
|
|
81
79
|
/**
|
|
82
80
|
* Implements xsl:choose and its child nodes xsl:when and
|
|
83
81
|
* xsl:otherwise.
|
|
@@ -85,14 +83,14 @@ export declare class Xslt {
|
|
|
85
83
|
* @param template The template.
|
|
86
84
|
* @param output The output.
|
|
87
85
|
*/
|
|
88
|
-
protected xsltChoose(input: ExprContext, template: any, output: any
|
|
86
|
+
protected xsltChoose(input: ExprContext, template: any, output: any): void;
|
|
89
87
|
/**
|
|
90
88
|
* Implements `xsl:for-each`.
|
|
91
89
|
* @param input The Expression Context.
|
|
92
90
|
* @param template The template.
|
|
93
91
|
* @param output The output.
|
|
94
92
|
*/
|
|
95
|
-
protected xsltForEach(context: ExprContext, template: XNode, output: XNode
|
|
93
|
+
protected xsltForEach(context: ExprContext, template: XNode, output: XNode): void;
|
|
96
94
|
protected groupBy(xs: any, key: any): any;
|
|
97
95
|
/**
|
|
98
96
|
* Traverses the template node tree. Calls the main processing
|
|
@@ -102,7 +100,7 @@ export declare class Xslt {
|
|
|
102
100
|
* @param template The XSL-T definition.
|
|
103
101
|
* @param output The XML output.
|
|
104
102
|
*/
|
|
105
|
-
protected xsltChildNodes(context: ExprContext, template:
|
|
103
|
+
protected xsltChildNodes(context: ExprContext, template: XNode, output: XNode): void;
|
|
106
104
|
/**
|
|
107
105
|
* Passes template text to the output. The current template node does
|
|
108
106
|
* not specify an XSL-T operation and therefore is appended to the
|
|
@@ -111,9 +109,8 @@ export declare class Xslt {
|
|
|
111
109
|
* @param context The Expression Context.
|
|
112
110
|
* @param template The XSLT stylesheet or transformation.
|
|
113
111
|
* @param output The output.
|
|
114
|
-
* @param outputDocument The output document, if the case.
|
|
115
112
|
*/
|
|
116
|
-
protected xsltPassThrough(context: ExprContext, template:
|
|
113
|
+
protected xsltPassThrough(context: ExprContext, template: XNode, output: XNode): void;
|
|
117
114
|
/**
|
|
118
115
|
* Determines if a text node in the XSLT template document is to be
|
|
119
116
|
* stripped according to XSLT whitespace stripping rules.
|
|
@@ -148,11 +145,30 @@ export declare class Xslt {
|
|
|
148
145
|
* match.
|
|
149
146
|
* @see [XSLT] section 5.2, paragraph 1
|
|
150
147
|
* @param match TODO
|
|
151
|
-
* @param context
|
|
152
|
-
* @
|
|
148
|
+
* @param context The Expression Context.
|
|
149
|
+
* @param axis The XPath axis. Used when the match does not start with the parent.
|
|
150
|
+
* @returns {XNode[]} A list of the found nodes.
|
|
153
151
|
*/
|
|
154
|
-
protected xsltMatch(match: string, context: ExprContext):
|
|
152
|
+
protected xsltMatch(match: string, context: ExprContext, axis?: string): XNode[];
|
|
155
153
|
private xsltLocationExpressionMatch;
|
|
154
|
+
/**
|
|
155
|
+
* Finds all the nodes through absolute xPath search.
|
|
156
|
+
* Returns only nodes that match either the context position node,
|
|
157
|
+
* or an ancestor.
|
|
158
|
+
* @param expression The Expression.
|
|
159
|
+
* @param context The Expression Context.
|
|
160
|
+
* @returns The list of found nodes.
|
|
161
|
+
*/
|
|
162
|
+
private absoluteXsltMatch;
|
|
163
|
+
/**
|
|
164
|
+
* Tries to find relative nodes from the actual context position.
|
|
165
|
+
* If found nodes are already in the context, or if they are children of
|
|
166
|
+
* nodes in the context, they are returned.
|
|
167
|
+
* @param expression The expression used.
|
|
168
|
+
* @param context The Expression Context.
|
|
169
|
+
* @returns The list of found nodes.
|
|
170
|
+
*/
|
|
171
|
+
private relativeXsltMatch;
|
|
156
172
|
/**
|
|
157
173
|
* Sets parameters defined by xsl:with-param child nodes of the
|
|
158
174
|
* current template node, in the current input context. This happens
|
|
@@ -161,8 +177,6 @@ export declare class Xslt {
|
|
|
161
177
|
* @param input TODO
|
|
162
178
|
* @param template TODO
|
|
163
179
|
*/
|
|
164
|
-
protected xsltWithParam(input: ExprContext, template: any
|
|
165
|
-
private absoluteXsltMatch;
|
|
166
|
-
private relativeXsltMatch;
|
|
180
|
+
protected xsltWithParam(input: ExprContext, template: any): void;
|
|
167
181
|
protected isXsltElement(element: any, opt_wantedName?: string): boolean;
|
|
168
182
|
}
|