xslt-processor 1.2.4 → 1.2.5
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/package.json +1 -1
- package/umd/{xslt → xpath}/expr-context.d.ts +1 -1
- package/umd/xpath/expressions/binary-expr.d.ts +1 -1
- package/umd/xpath/expressions/function-call-expr.d.ts +1 -1
- package/umd/xpath/expressions/location-expr.d.ts +1 -1
- package/umd/xpath/expressions/step-expr.d.ts +1 -1
- package/umd/xpath/functions/non-standard.d.ts +1 -1
- package/umd/xpath/functions/standard.d.ts +1 -1
- package/umd/xpath/index.d.ts +1 -1
- package/umd/xpath/match-resolver.d.ts +55 -0
- package/umd/xpath/node-tests/node-test-comment.d.ts +1 -1
- package/umd/xpath/node-tests/node-test-element-or-attribute.d.ts +1 -1
- package/umd/xpath/node-tests/node-test-name.d.ts +1 -1
- package/umd/xpath/node-tests/node-test-nc.d.ts +1 -1
- package/umd/xpath/node-tests/node-test-pi.d.ts +1 -1
- package/umd/xpath/node-tests/node-test-text.d.ts +1 -1
- package/umd/xpath/node-tests/node-test.d.ts +1 -1
- package/umd/xpath/xpath.d.ts +1 -1
- package/umd/xslt/xslt.d.ts +10 -20
- package/umd/xslt-processor.js +2 -2
- package/umd/xslt-processor.js.map +1 -1
- package/{xslt → xpath}/expr-context.d.ts +1 -1
- package/{xslt → xpath}/expr-context.js +5 -5
- package/xpath/expr-context.js.map +1 -0
- package/xpath/expressions/binary-expr.d.ts +1 -1
- package/xpath/expressions/function-call-expr.d.ts +1 -1
- package/xpath/expressions/location-expr.d.ts +1 -1
- package/xpath/expressions/step-expr.d.ts +1 -1
- package/xpath/functions/non-standard.d.ts +1 -1
- package/xpath/functions/standard.d.ts +1 -1
- package/xpath/index.d.ts +1 -1
- package/xpath/index.js +1 -1
- package/xpath/index.js.map +1 -1
- package/xpath/match-resolver.d.ts +55 -0
- package/xpath/match-resolver.js +137 -0
- package/xpath/match-resolver.js.map +1 -0
- package/xpath/node-tests/node-test-comment.d.ts +1 -1
- package/xpath/node-tests/node-test-element-or-attribute.d.ts +1 -1
- package/xpath/node-tests/node-test-name.d.ts +1 -1
- package/xpath/node-tests/node-test-nc.d.ts +1 -1
- package/xpath/node-tests/node-test-pi.d.ts +1 -1
- package/xpath/node-tests/node-test-text.d.ts +1 -1
- package/xpath/node-tests/node-test.d.ts +1 -1
- package/xpath/xpath.d.ts +1 -1
- package/xslt/xslt.d.ts +10 -20
- package/xslt/xslt.js +40 -102
- package/xslt/xslt.js.map +1 -1
- package/xslt/expr-context.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { XNode } from '../dom';
|
|
2
|
-
import { XsltDecimalFormatSettings } from '
|
|
2
|
+
import { XsltDecimalFormatSettings } from '../xslt/xslt-decimal-format-settings';
|
|
3
3
|
/** XPath expression evaluation context. An XPath context consists of a
|
|
4
4
|
* DOM node, a list of DOM nodes that contains this node, a number
|
|
5
5
|
* that represents the position of the single node in the list, and a
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExprContext } from "
|
|
1
|
+
import { ExprContext } from "../expr-context";
|
|
2
2
|
import { BooleanValue, NodeSetValue, NumberValue, StringValue } from "../values";
|
|
3
3
|
export declare function boolean(context: ExprContext): BooleanValue;
|
|
4
4
|
export declare function ceiling(context: ExprContext): NumberValue;
|
package/umd/xpath/index.d.ts
CHANGED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { XNode } from "../dom";
|
|
2
|
+
import { ExprContext } from "./expr-context";
|
|
3
|
+
import { Expression } from "./expressions/expression";
|
|
4
|
+
/**
|
|
5
|
+
* Class that resolves XPath expressions, returning nodes.
|
|
6
|
+
*/
|
|
7
|
+
export declare class MatchResolver {
|
|
8
|
+
/**
|
|
9
|
+
* This class entry point.
|
|
10
|
+
* @param expression The expression to be resolved.
|
|
11
|
+
* @param context The Expression Context
|
|
12
|
+
* @returns An array of nodes.
|
|
13
|
+
*/
|
|
14
|
+
expressionMatch(expression: Expression, context: ExprContext): XNode[];
|
|
15
|
+
/**
|
|
16
|
+
* Resolves a `LocationExpr`.
|
|
17
|
+
* @param expression The Location Expression.
|
|
18
|
+
* @param context The Expression Context.
|
|
19
|
+
* @returns Either the results of a relative resolution, or the results of an
|
|
20
|
+
* absolute resolution.
|
|
21
|
+
*/
|
|
22
|
+
private locationExpressionMatch;
|
|
23
|
+
/**
|
|
24
|
+
* Resolves a `UnionExpr`.
|
|
25
|
+
* @param expression The Union Expression.
|
|
26
|
+
* @param context The Expression Context.
|
|
27
|
+
* @returns The concatenated result of evaluating the both sides of the expression.
|
|
28
|
+
*/
|
|
29
|
+
private unionExpressionMatch;
|
|
30
|
+
/**
|
|
31
|
+
* Finds all the nodes through absolute XPath search, starting on
|
|
32
|
+
* the #document parent node.
|
|
33
|
+
* @param expression The Expression.
|
|
34
|
+
* @param context The Expression Context.
|
|
35
|
+
* @returns The list of found nodes.
|
|
36
|
+
*/
|
|
37
|
+
private absoluteXsltMatchByDocumentNode;
|
|
38
|
+
/**
|
|
39
|
+
* Finds all the nodes through absolute xPath search, starting with the
|
|
40
|
+
* first child of the #document node.
|
|
41
|
+
* @param expression The Expression.
|
|
42
|
+
* @param context The Expression Context.
|
|
43
|
+
* @returns The list of found nodes.
|
|
44
|
+
*/
|
|
45
|
+
private absoluteXsltMatch;
|
|
46
|
+
/**
|
|
47
|
+
* Tries to find relative nodes from the actual context position.
|
|
48
|
+
* If found nodes are already in the context, or if they are children of
|
|
49
|
+
* nodes in the context, they are returned.
|
|
50
|
+
* @param expression The expression used.
|
|
51
|
+
* @param context The Expression Context.
|
|
52
|
+
* @returns The list of found nodes.
|
|
53
|
+
*/
|
|
54
|
+
private relativeXsltMatch;
|
|
55
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExprContext } from "
|
|
1
|
+
import { ExprContext } from "../expr-context";
|
|
2
2
|
import { BooleanValue } from "../values/boolean-value";
|
|
3
3
|
import { NodeTest } from "./node-test";
|
|
4
4
|
export declare class NodeTestElementOrAttribute implements NodeTest {
|
package/umd/xpath/xpath.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExprContext } from '
|
|
1
|
+
import { ExprContext } from './expr-context';
|
|
2
2
|
import { BinaryExpr, FunctionCallExpr, LiteralExpr, LocationExpr, NumberExpr, PathExpr, PredicateExpr, StepExpr, TokenExpr, UnaryMinusExpr, UnionExpr, VariableExpr } from './expressions';
|
|
3
3
|
import { Expression } from './expressions/expression';
|
|
4
4
|
import { XPathTokenRule } from './xpath-token-rule';
|
package/umd/xslt/xslt.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { XDocument, XNode } from '../dom';
|
|
|
2
2
|
import { ExprContext, XPath } from '../xpath';
|
|
3
3
|
import { XsltOptions } from './xslt-options';
|
|
4
4
|
import { XsltDecimalFormatSettings } from './xslt-decimal-format-settings';
|
|
5
|
+
import { MatchResolver } from '../xpath/match-resolver';
|
|
5
6
|
/**
|
|
6
7
|
* The main class for XSL-T processing. The implementation is NOT
|
|
7
8
|
* complete; some xsl element are left out.
|
|
@@ -28,6 +29,7 @@ import { XsltDecimalFormatSettings } from './xslt-decimal-format-settings';
|
|
|
28
29
|
*/
|
|
29
30
|
export declare class Xslt {
|
|
30
31
|
xPath: XPath;
|
|
32
|
+
matchResolver: MatchResolver;
|
|
31
33
|
options: XsltOptions;
|
|
32
34
|
decimalFormatSettings: XsltDecimalFormatSettings;
|
|
33
35
|
outputDocument: XDocument;
|
|
@@ -79,7 +81,6 @@ export declare class Xslt {
|
|
|
79
81
|
* @param output The output.
|
|
80
82
|
*/
|
|
81
83
|
protected xsltForEach(context: ExprContext, template: XNode, output: XNode): void;
|
|
82
|
-
protected groupBy(xs: any, key: any): any;
|
|
83
84
|
/**
|
|
84
85
|
* Orders the current node list in the input context according to the
|
|
85
86
|
* sort order specified by xsl:sort child nodes of the current
|
|
@@ -119,6 +120,14 @@ export declare class Xslt {
|
|
|
119
120
|
* @param output The XML output.
|
|
120
121
|
*/
|
|
121
122
|
protected xsltChildNodes(context: ExprContext, template: XNode, output: XNode): void;
|
|
123
|
+
/**
|
|
124
|
+
* This logic is used in two different places:
|
|
125
|
+
* - `xsltPassThrough`, if the template asks this library to write a text node;
|
|
126
|
+
* - `xsltProcessContext`, `apply-templates` operation, when the current node is text.
|
|
127
|
+
* @param context The Expression Context.
|
|
128
|
+
* @param template The template, that contains the node value to be written.
|
|
129
|
+
*/
|
|
130
|
+
private commonLogicTextNode;
|
|
122
131
|
/**
|
|
123
132
|
* Passes template text to the output. The current template node does
|
|
124
133
|
* not specify an XSL-T operation and therefore is appended to the
|
|
@@ -159,25 +168,6 @@ export declare class Xslt {
|
|
|
159
168
|
* @returns {XNode[]} A list of the found nodes.
|
|
160
169
|
*/
|
|
161
170
|
protected xsltMatch(match: string, context: ExprContext, axis?: string): XNode[];
|
|
162
|
-
private xsltLocationExpressionMatch;
|
|
163
|
-
/**
|
|
164
|
-
* Finds all the nodes through absolute xPath search.
|
|
165
|
-
* Returns only nodes that match either the context position node,
|
|
166
|
-
* or an ancestor.
|
|
167
|
-
* @param expression The Expression.
|
|
168
|
-
* @param context The Expression Context.
|
|
169
|
-
* @returns The list of found nodes.
|
|
170
|
-
*/
|
|
171
|
-
private absoluteXsltMatch;
|
|
172
|
-
/**
|
|
173
|
-
* Tries to find relative nodes from the actual context position.
|
|
174
|
-
* If found nodes are already in the context, or if they are children of
|
|
175
|
-
* nodes in the context, they are returned.
|
|
176
|
-
* @param expression The expression used.
|
|
177
|
-
* @param context The Expression Context.
|
|
178
|
-
* @returns The list of found nodes.
|
|
179
|
-
*/
|
|
180
|
-
private relativeXsltMatch;
|
|
181
171
|
/**
|
|
182
172
|
* Sets parameters defined by xsl:with-param child nodes of the
|
|
183
173
|
* current template node, in the current input context. This happens
|