xslt-processor 1.1.6 → 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/dom/functions.d.ts +5 -5
- package/dom/functions.js +4 -3
- 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.js +3 -2
- package/dom/xml-functions.js.map +1 -1
- 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 +5 -5
- package/umd/dom/util.d.ts +2 -21
- package/umd/dom/xdocument.d.ts +9 -9
- 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.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.d.ts +32 -18
- package/xslt/xslt.js +230 -170
- package/xslt/xslt.js.map +1 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function copyArray(dst: any[], src: any[]): void;
|
|
2
|
+
/**
|
|
3
|
+
* This is an optimization for copying attribute lists in IE. IE includes many
|
|
4
|
+
* extraneous properties in its DOM attribute lists, which take require
|
|
5
|
+
* significant extra processing when evaluating attribute steps. With this
|
|
6
|
+
* function, we ignore any such attributes that has an empty string value.
|
|
7
|
+
*/
|
|
8
|
+
export declare function copyArrayIgnoringAttributesWithoutValue(dst: any, src: any): void;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.copyArrayIgnoringAttributesWithoutValue = exports.copyArray = void 0;
|
|
4
|
+
// Shallow-copies an array to the end of another array
|
|
5
|
+
// Basically Array.concat, but works with other non-array collections
|
|
6
|
+
function copyArray(dst, src) {
|
|
7
|
+
if (!src)
|
|
8
|
+
return;
|
|
9
|
+
var dstLength = dst.length;
|
|
10
|
+
for (var i = src.length - 1; i >= 0; --i) {
|
|
11
|
+
dst[i + dstLength] = src[i];
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.copyArray = copyArray;
|
|
15
|
+
/**
|
|
16
|
+
* This is an optimization for copying attribute lists in IE. IE includes many
|
|
17
|
+
* extraneous properties in its DOM attribute lists, which take require
|
|
18
|
+
* significant extra processing when evaluating attribute steps. With this
|
|
19
|
+
* function, we ignore any such attributes that has an empty string value.
|
|
20
|
+
*/
|
|
21
|
+
function copyArrayIgnoringAttributesWithoutValue(dst, src) {
|
|
22
|
+
if (!src)
|
|
23
|
+
return;
|
|
24
|
+
for (var i = src.length - 1; i >= 0; --i) {
|
|
25
|
+
// this test will pass so long as the attribute has a non-empty string
|
|
26
|
+
// value, even if that value is "false", "0", "undefined", etc.
|
|
27
|
+
if (src[i].nodeValue) {
|
|
28
|
+
dst.push(src[i]);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.copyArrayIgnoringAttributesWithoutValue = copyArrayIgnoringAttributesWithoutValue;
|
|
33
|
+
//# sourceMappingURL=common-function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common-function.js","sourceRoot":"","sources":["../../src/xpath/common-function.ts"],"names":[],"mappings":";;;AAAA,sDAAsD;AACtD,qEAAqE;AACrE,SAAgB,SAAS,CAAC,GAAU,EAAE,GAAU;IAC5C,IAAI,CAAC,GAAG;QAAE,OAAO;IACjB,IAAM,SAAS,GAAG,GAAG,CAAC,MAAM,CAAC;IAC7B,KAAK,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE;QACtC,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;KAC/B;AACL,CAAC;AAND,8BAMC;AAED;;;;;GAKG;AACH,SAAgB,uCAAuC,CAAC,GAAG,EAAE,GAAG;IAC5D,IAAI,CAAC,GAAG;QAAE,OAAO;IACjB,KAAK,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE;QACtC,sEAAsE;QACtE,+DAA+D;QAC/D,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE;YAClB,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;SACpB;KACJ;AACL,CAAC;AATD,0FASC"}
|
package/xpath/expr-context.d.ts
CHANGED
|
@@ -1,16 +1,89 @@
|
|
|
1
1
|
import { XNode } from '../dom';
|
|
2
|
+
/** XPath expression evaluation context. An XPath context consists of a
|
|
3
|
+
* DOM node, a list of DOM nodes that contains this node, a number
|
|
4
|
+
* that represents the position of the single node in the list, and a
|
|
5
|
+
* current set of variable bindings. (See XPath spec.)
|
|
6
|
+
*
|
|
7
|
+
* setVariable(name, expr) -- binds given XPath expression to the
|
|
8
|
+
* name.
|
|
9
|
+
*
|
|
10
|
+
* getVariable(name) -- what the name says.
|
|
11
|
+
*
|
|
12
|
+
* setNode(position) -- sets the context to the node at the given
|
|
13
|
+
* position. Needed to implement scoping rules for variables in
|
|
14
|
+
* XPath. (A variable is visible to all subsequent siblings, not
|
|
15
|
+
* only to its children.)
|
|
16
|
+
*
|
|
17
|
+
* set/isCaseInsensitive -- specifies whether node name tests should
|
|
18
|
+
* be case sensitive. If you're executing xpaths against a regular
|
|
19
|
+
* HTML DOM, you probably don't want case-sensitivity, because
|
|
20
|
+
* browsers tend to disagree about whether elements & attributes
|
|
21
|
+
* should be upper/lower case. If you're running xpaths in an
|
|
22
|
+
* XSLT instance, you probably DO want case sensitivity, as per the
|
|
23
|
+
* XSL spec.
|
|
24
|
+
*
|
|
25
|
+
* set/isReturnOnFirstMatch -- whether XPath evaluation should quit as soon
|
|
26
|
+
* as a result is found. This is an optimization that might make sense if you
|
|
27
|
+
* only care about the first result.
|
|
28
|
+
*
|
|
29
|
+
* set/isIgnoreNonElementNodesForNTA -- whether to ignore non-element nodes
|
|
30
|
+
* when evaluating the "node()" any node test. While technically this is
|
|
31
|
+
* contrary to the XPath spec, practically it can enhance performance
|
|
32
|
+
* significantly, and makes sense if you a) use "node()" when you mean "*",
|
|
33
|
+
* and b) use "//" when you mean "/descendant::* /".
|
|
34
|
+
*/
|
|
2
35
|
export declare class ExprContext {
|
|
3
36
|
position: number;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
37
|
+
nodeList: XNode[];
|
|
38
|
+
outputPosition: number;
|
|
39
|
+
outputNodeList: XNode[];
|
|
40
|
+
outputDepth: number;
|
|
41
|
+
variables: {
|
|
42
|
+
[name: string]: any;
|
|
43
|
+
};
|
|
7
44
|
caseInsensitive: any;
|
|
8
45
|
ignoreAttributesWithoutValue: any;
|
|
9
46
|
returnOnFirstMatch: any;
|
|
10
47
|
ignoreNonElementNodesForNTA: any;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
48
|
+
parent: ExprContext;
|
|
49
|
+
root: XNode;
|
|
50
|
+
inApplyTemplates: boolean;
|
|
51
|
+
baseTemplateMatched: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Constructor -- gets the node, its position, the node set it
|
|
54
|
+
* belongs to, and a parent context as arguments. The parent context
|
|
55
|
+
* is used to implement scoping rules for variables: if a variable
|
|
56
|
+
* is not found in the current context, it is looked for in the
|
|
57
|
+
* parent context, recursively. Except for node, all arguments have
|
|
58
|
+
* default values: default position is 0, default node set is the
|
|
59
|
+
* set that contains only the node, and the default parent is null.
|
|
60
|
+
*
|
|
61
|
+
* Notice that position starts at 0 at the outside interface;
|
|
62
|
+
* inside XPath expressions this shows up as position()=1.
|
|
63
|
+
* @param nodeList TODO
|
|
64
|
+
* @param outputNodeList TODO
|
|
65
|
+
* @param opt_position TODO
|
|
66
|
+
* @param opt_outputPosition TODO
|
|
67
|
+
* @param opt_parent TODO
|
|
68
|
+
* @param opt_caseInsensitive TODO
|
|
69
|
+
* @param opt_ignoreAttributesWithoutValue TODO
|
|
70
|
+
* @param opt_returnOnFirstMatch TODO
|
|
71
|
+
* @param opt_ignoreNonElementNodesForNTA TODO
|
|
72
|
+
*/
|
|
73
|
+
constructor(nodeList: XNode[], outputNodeList: XNode[], opt_position?: number, opt_outputPosition?: number, opt_outputDepth?: number, opt_parent?: ExprContext, opt_caseInsensitive?: any, opt_ignoreAttributesWithoutValue?: any, opt_returnOnFirstMatch?: any, opt_ignoreNonElementNodesForNTA?: any);
|
|
74
|
+
/**
|
|
75
|
+
* clone() -- creates a new context with the current context as
|
|
76
|
+
* parent. If passed as argument to clone(), the new context has a
|
|
77
|
+
* different node, position, or node set. What is not passed is
|
|
78
|
+
* inherited from the cloned context.
|
|
79
|
+
* @param opt_nodeList TODO
|
|
80
|
+
* @param opt_outputNodeList TODO
|
|
81
|
+
* @param opt_position TODO
|
|
82
|
+
* @param opt_outputPosition TODO
|
|
83
|
+
* @returns TODO
|
|
84
|
+
*/
|
|
85
|
+
clone(opt_nodeList?: XNode[], opt_outputNodeList?: XNode[], opt_position?: number, opt_outputPosition?: number): ExprContext;
|
|
86
|
+
cloneByOutput(opt_outputNodeList?: XNode[], opt_outputPosition?: number, opt_outputDepth?: number): ExprContext;
|
|
14
87
|
setVariable(name?: any, value?: any): void;
|
|
15
88
|
getVariable(name: string): any;
|
|
16
89
|
setNode(position: number): void;
|
package/xpath/expr-context.js
CHANGED
|
@@ -1,54 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// XPath expression evaluation context. An XPath context consists of a
|
|
3
|
-
// DOM node, a list of DOM nodes that contains this node, a number
|
|
4
|
-
// that represents the position of the single node in the list, and a
|
|
5
|
-
// current set of variable bindings. (See XPath spec.)
|
|
6
|
-
//
|
|
7
|
-
// The interface of the expression context:
|
|
8
|
-
//
|
|
9
|
-
// Constructor -- gets the node, its position, the node set it
|
|
10
|
-
// belongs to, and a parent context as arguments. The parent context
|
|
11
|
-
// is used to implement scoping rules for variables: if a variable
|
|
12
|
-
// is not found in the current context, it is looked for in the
|
|
13
|
-
// parent context, recursively. Except for node, all arguments have
|
|
14
|
-
// default values: default position is 0, default node set is the
|
|
15
|
-
// set that contains only the node, and the default parent is null.
|
|
16
|
-
//
|
|
17
|
-
// Notice that position starts at 0 at the outside interface;
|
|
18
|
-
// inside XPath expressions this shows up as position()=1.
|
|
19
|
-
//
|
|
20
|
-
// clone() -- creates a new context with the current context as
|
|
21
|
-
// parent. If passed as argument to clone(), the new context has a
|
|
22
|
-
// different node, position, or node set. What is not passed is
|
|
23
|
-
// inherited from the cloned context.
|
|
24
|
-
//
|
|
25
|
-
// setVariable(name, expr) -- binds given XPath expression to the
|
|
26
|
-
// name.
|
|
27
|
-
//
|
|
28
|
-
// getVariable(name) -- what the name says.
|
|
29
|
-
//
|
|
30
|
-
// setNode(position) -- sets the context to the node at the given
|
|
31
|
-
// position. Needed to implement scoping rules for variables in
|
|
32
|
-
// XPath. (A variable is visible to all subsequent siblings, not
|
|
33
|
-
// only to its children.)
|
|
34
|
-
//
|
|
35
|
-
// set/isCaseInsensitive -- specifies whether node name tests should
|
|
36
|
-
// be case sensitive. If you're executing xpaths against a regular
|
|
37
|
-
// HTML DOM, you probably don't want case-sensitivity, because
|
|
38
|
-
// browsers tend to disagree about whether elements & attributes
|
|
39
|
-
// should be upper/lower case. If you're running xpaths in an
|
|
40
|
-
// XSLT instance, you probably DO want case sensitivity, as per the
|
|
41
|
-
// XSL spec.
|
|
42
|
-
//
|
|
43
|
-
// set/isReturnOnFirstMatch -- whether XPath evaluation should quit as soon
|
|
44
|
-
// as a result is found. This is an optimization that might make sense if you
|
|
45
|
-
// only care about the first result.
|
|
46
|
-
//
|
|
47
|
-
// set/isIgnoreNonElementNodesForNTA -- whether to ignore non-element nodes
|
|
48
|
-
// when evaluating the "node()" any node test. While technically this is
|
|
49
|
-
// contrary to the XPath spec, practically it can enhance performance
|
|
50
|
-
// significantly, and makes sense if you a) use "node()" when you mean "*",
|
|
51
|
-
// and b) use "//" when you mean "/descendant::*/".
|
|
52
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
3
|
exports.ExprContext = void 0;
|
|
54
4
|
var constants_1 = require("../constants");
|
|
@@ -57,32 +7,105 @@ var node_set_value_1 = require("./values/node-set-value");
|
|
|
57
7
|
var number_value_1 = require("./values/number-value");
|
|
58
8
|
var string_value_1 = require("./values/string-value");
|
|
59
9
|
var tokens_1 = require("./tokens");
|
|
10
|
+
/** XPath expression evaluation context. An XPath context consists of a
|
|
11
|
+
* DOM node, a list of DOM nodes that contains this node, a number
|
|
12
|
+
* that represents the position of the single node in the list, and a
|
|
13
|
+
* current set of variable bindings. (See XPath spec.)
|
|
14
|
+
*
|
|
15
|
+
* setVariable(name, expr) -- binds given XPath expression to the
|
|
16
|
+
* name.
|
|
17
|
+
*
|
|
18
|
+
* getVariable(name) -- what the name says.
|
|
19
|
+
*
|
|
20
|
+
* setNode(position) -- sets the context to the node at the given
|
|
21
|
+
* position. Needed to implement scoping rules for variables in
|
|
22
|
+
* XPath. (A variable is visible to all subsequent siblings, not
|
|
23
|
+
* only to its children.)
|
|
24
|
+
*
|
|
25
|
+
* set/isCaseInsensitive -- specifies whether node name tests should
|
|
26
|
+
* be case sensitive. If you're executing xpaths against a regular
|
|
27
|
+
* HTML DOM, you probably don't want case-sensitivity, because
|
|
28
|
+
* browsers tend to disagree about whether elements & attributes
|
|
29
|
+
* should be upper/lower case. If you're running xpaths in an
|
|
30
|
+
* XSLT instance, you probably DO want case sensitivity, as per the
|
|
31
|
+
* XSL spec.
|
|
32
|
+
*
|
|
33
|
+
* set/isReturnOnFirstMatch -- whether XPath evaluation should quit as soon
|
|
34
|
+
* as a result is found. This is an optimization that might make sense if you
|
|
35
|
+
* only care about the first result.
|
|
36
|
+
*
|
|
37
|
+
* set/isIgnoreNonElementNodesForNTA -- whether to ignore non-element nodes
|
|
38
|
+
* when evaluating the "node()" any node test. While technically this is
|
|
39
|
+
* contrary to the XPath spec, practically it can enhance performance
|
|
40
|
+
* significantly, and makes sense if you a) use "node()" when you mean "*",
|
|
41
|
+
* and b) use "//" when you mean "/descendant::* /".
|
|
42
|
+
*/
|
|
60
43
|
var ExprContext = /** @class */ (function () {
|
|
61
|
-
|
|
62
|
-
|
|
44
|
+
/**
|
|
45
|
+
* Constructor -- gets the node, its position, the node set it
|
|
46
|
+
* belongs to, and a parent context as arguments. The parent context
|
|
47
|
+
* is used to implement scoping rules for variables: if a variable
|
|
48
|
+
* is not found in the current context, it is looked for in the
|
|
49
|
+
* parent context, recursively. Except for node, all arguments have
|
|
50
|
+
* default values: default position is 0, default node set is the
|
|
51
|
+
* set that contains only the node, and the default parent is null.
|
|
52
|
+
*
|
|
53
|
+
* Notice that position starts at 0 at the outside interface;
|
|
54
|
+
* inside XPath expressions this shows up as position()=1.
|
|
55
|
+
* @param nodeList TODO
|
|
56
|
+
* @param outputNodeList TODO
|
|
57
|
+
* @param opt_position TODO
|
|
58
|
+
* @param opt_outputPosition TODO
|
|
59
|
+
* @param opt_parent TODO
|
|
60
|
+
* @param opt_caseInsensitive TODO
|
|
61
|
+
* @param opt_ignoreAttributesWithoutValue TODO
|
|
62
|
+
* @param opt_returnOnFirstMatch TODO
|
|
63
|
+
* @param opt_ignoreNonElementNodesForNTA TODO
|
|
64
|
+
*/
|
|
65
|
+
function ExprContext(nodeList, outputNodeList, opt_position, opt_outputPosition, opt_outputDepth, opt_parent, opt_caseInsensitive, opt_ignoreAttributesWithoutValue, opt_returnOnFirstMatch, opt_ignoreNonElementNodesForNTA) {
|
|
66
|
+
this.nodeList = nodeList;
|
|
67
|
+
this.outputNodeList = outputNodeList;
|
|
63
68
|
this.position = opt_position || 0;
|
|
69
|
+
this.outputPosition = opt_outputPosition || 0;
|
|
64
70
|
this.variables = {};
|
|
65
71
|
this.parent = opt_parent || null;
|
|
66
72
|
this.caseInsensitive = opt_caseInsensitive || false;
|
|
67
73
|
this.ignoreAttributesWithoutValue = opt_ignoreAttributesWithoutValue || false;
|
|
68
74
|
this.returnOnFirstMatch = opt_returnOnFirstMatch || false;
|
|
69
75
|
this.ignoreNonElementNodesForNTA = opt_ignoreNonElementNodesForNTA || false;
|
|
76
|
+
this.inApplyTemplates = false;
|
|
77
|
+
this.baseTemplateMatched = false;
|
|
78
|
+
this.outputDepth = opt_outputDepth || 0;
|
|
70
79
|
if (opt_parent) {
|
|
71
80
|
this.root = opt_parent.root;
|
|
72
81
|
}
|
|
73
|
-
else if (this.
|
|
82
|
+
else if (this.nodeList[this.position].nodeType == constants_1.DOM_DOCUMENT_NODE) {
|
|
74
83
|
// NOTE(mesch): DOM Spec stipulates that the ownerDocument of a
|
|
75
84
|
// document is null. Our root, however is the document that we are
|
|
76
85
|
// processing, so the initial context is created from its document
|
|
77
|
-
// node, which case we must handle here
|
|
78
|
-
this.root = this.
|
|
86
|
+
// node, which case we must handle here explicitly.
|
|
87
|
+
this.root = this.nodeList[this.position];
|
|
79
88
|
}
|
|
80
89
|
else {
|
|
81
|
-
this.root = this.
|
|
90
|
+
this.root = this.nodeList[this.position].ownerDocument;
|
|
82
91
|
}
|
|
83
92
|
}
|
|
84
|
-
|
|
85
|
-
|
|
93
|
+
/**
|
|
94
|
+
* clone() -- creates a new context with the current context as
|
|
95
|
+
* parent. If passed as argument to clone(), the new context has a
|
|
96
|
+
* different node, position, or node set. What is not passed is
|
|
97
|
+
* inherited from the cloned context.
|
|
98
|
+
* @param opt_nodeList TODO
|
|
99
|
+
* @param opt_outputNodeList TODO
|
|
100
|
+
* @param opt_position TODO
|
|
101
|
+
* @param opt_outputPosition TODO
|
|
102
|
+
* @returns TODO
|
|
103
|
+
*/
|
|
104
|
+
ExprContext.prototype.clone = function (opt_nodeList, opt_outputNodeList, opt_position, opt_outputPosition) {
|
|
105
|
+
return new ExprContext(opt_nodeList || this.nodeList, opt_outputNodeList || this.outputNodeList, typeof opt_position !== 'undefined' ? opt_position : this.position, typeof opt_outputPosition !== 'undefined' ? opt_outputPosition : this.outputPosition, this.outputDepth, this, this.caseInsensitive, this.ignoreAttributesWithoutValue, this.returnOnFirstMatch, this.ignoreNonElementNodesForNTA);
|
|
106
|
+
};
|
|
107
|
+
ExprContext.prototype.cloneByOutput = function (opt_outputNodeList, opt_outputPosition, opt_outputDepth) {
|
|
108
|
+
return new ExprContext(this.nodeList, opt_outputNodeList || this.outputNodeList, this.position, typeof opt_outputPosition !== 'undefined' ? opt_outputPosition : this.outputPosition, typeof opt_outputDepth !== 'undefined' ? opt_outputDepth : this.outputDepth, this, this.caseInsensitive, this.ignoreAttributesWithoutValue, this.returnOnFirstMatch, this.ignoreNonElementNodesForNTA);
|
|
86
109
|
};
|
|
87
110
|
ExprContext.prototype.setVariable = function (name, value) {
|
|
88
111
|
if (value instanceof string_value_1.StringValue ||
|
|
@@ -119,7 +142,7 @@ var ExprContext = /** @class */ (function () {
|
|
|
119
142
|
this.position = position;
|
|
120
143
|
};
|
|
121
144
|
ExprContext.prototype.contextSize = function () {
|
|
122
|
-
return this.
|
|
145
|
+
return this.nodeList.length;
|
|
123
146
|
};
|
|
124
147
|
ExprContext.prototype.isCaseInsensitive = function () {
|
|
125
148
|
return this.caseInsensitive;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expr-context.js","sourceRoot":"","sources":["../../src/xpath/expr-context.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"expr-context.js","sourceRoot":"","sources":["../../src/xpath/expr-context.ts"],"names":[],"mappings":";;;AAAA,0CAAiD;AACjD,wDAAsD;AACtD,0DAAuD;AACvD,sDAAoD;AACpD,sDAAoD;AACpD,mCAAsC;AAGtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH;IAoBI;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,qBACI,QAAiB,EACjB,cAAuB,EACvB,YAAqB,EACrB,kBAA2B,EAC3B,eAAwB,EACxB,UAAwB,EACxB,mBAAyB,EACzB,gCAAsC,EACtC,sBAA4B,EAC5B,+BAAqC;QAErC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,QAAQ,GAAG,YAAY,IAAI,CAAC,CAAC;QAClC,IAAI,CAAC,cAAc,GAAG,kBAAkB,IAAI,CAAC,CAAC;QAC9C,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACpB,IAAI,CAAC,MAAM,GAAG,UAAU,IAAI,IAAI,CAAC;QACjC,IAAI,CAAC,eAAe,GAAG,mBAAmB,IAAI,KAAK,CAAC;QACpD,IAAI,CAAC,4BAA4B,GAAG,gCAAgC,IAAI,KAAK,CAAC;QAC9E,IAAI,CAAC,kBAAkB,GAAG,sBAAsB,IAAI,KAAK,CAAC;QAC1D,IAAI,CAAC,2BAA2B,GAAG,+BAA+B,IAAI,KAAK,CAAC;QAC5E,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC;QAC9B,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAC;QACjC,IAAI,CAAC,WAAW,GAAG,eAAe,IAAI,CAAC,CAAC;QAExC,IAAI,UAAU,EAAE;YACZ,IAAI,C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AAC,WAAW,CAAC,IAAI,CAAC,CAAC;SACxC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,6BAAO,GAAP,UAAQ,QAAgB;QACpB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC7B,CAAC;IAED,iCAAW,GAAX;QACI,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;IAChC,CAAC;IAED,uCAAiB,GAAjB;QACI,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IAED,wCAAkB,GAAlB,UAAmB,eAAe;QAC9B,OAAO,CAAC,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC,CAAC;IACpD,CAAC;IAED,oDAA8B,GAA9B;QACI,OAAO,IAAI,CAAC,4BAA4B,CAAC;IAC7C,CAAC;IAED,qDAA+B,GAA/B,UAAgC,MAAM;QAClC,OAAO,CAAC,IAAI,CAAC,4BAA4B,GAAG,MAAM,CAAC,CAAC;IACxD,CAAC;IAED,0CAAoB,GAApB;QACI,OAAO,IAAI,CAAC,kBAAkB,CAAC;IACnC,CAAC;IAED,2CAAqB,GAArB,UAAsB,kBAAkB;QACpC,OAAO,CAAC,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC,CAAC;IAC1D,CAAC;IAED,mDAA6B,GAA7B;QACI,OAAO,IAAI,CAAC,2BAA2B,CAAC;IAC5C,CAAC;IAED,oDAA8B,GAA9B,UAA+B,2BAA2B;QACtD,OAAO,CAAC,IAAI,CAAC,2BAA2B,GAAG,2BAA2B,CAAC,CAAC;IAC5E,CAAC;IACL,kBAAC;AAAD,CAAC,AAlMD,IAkMC;AAlMY,kCAAW"}
|
|
@@ -40,7 +40,7 @@ var FilterExpr = /** @class */ (function (_super) {
|
|
|
40
40
|
nodes = [];
|
|
41
41
|
for (var j = 0; j < nodes0.length; ++j) {
|
|
42
42
|
var n = nodes0[j];
|
|
43
|
-
if (this.predicate[i].evaluate(ctx.clone(nodes0, j)).booleanValue()) {
|
|
43
|
+
if (this.predicate[i].evaluate(ctx.clone(nodes0, undefined, j)).booleanValue()) {
|
|
44
44
|
nodes.push(n);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter-expr.js","sourceRoot":"","sources":["../../../src/xpath/expressions/filter-expr.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AACA,2DAAwD;AACxD,2CAA0C;AAE1C;IAAgC,8BAAU;IAItC,oBAAY,IAAS,EAAE,SAAc;QAArC,YACI,iBAAO,SAGV;QAFG,KAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,KAAI,CAAC,SAAS,GAAG,SAAS,CAAC;;IAC/B,CAAC;IAED,6BAAQ,GAAR,UAAS,GAAgB;QACrB,oEAAoE;QACpE,qEAAqE;QACrE,wEAAwE;QACxE,aAAa;QACb,IAAM,IAAI,GAAG,GAAG,CAAC,kBAAkB,CAAC;QACpC,GAAG,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC;QACjC,IAAI,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,CAAC;QACnD,GAAG,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC;QAEhC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE;YAC5C,IAAM,MAAM,GAAG,KAAK,CAAC;YACrB,KAAK,GAAG,EAAE,CAAC;YACX,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE;gBACpC,IAAM,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;gBACpB,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,YAA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IAAI,6BAAY,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC;IACL,iBAAC;AAAD,CAAC,AAjCD,CAAgC,uBAAU,GAiCzC;AAjCY,gCAAU"}
|
|
@@ -1,50 +1,12 @@
|
|
|
1
1
|
import { ExprContext } from '../expr-context';
|
|
2
|
-
import { BooleanValue } from '../values/boolean-value';
|
|
3
|
-
import { NodeSetValue } from '../values/node-set-value';
|
|
4
|
-
import { NumberValue } from '../values/number-value';
|
|
5
|
-
import { StringValue } from '../values/string-value';
|
|
6
2
|
import { Expression } from './expression';
|
|
7
3
|
export declare class FunctionCallExpr extends Expression {
|
|
8
4
|
name: any;
|
|
9
5
|
args: any[];
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
last(ctx: ExprContext): NumberValue;
|
|
13
|
-
position(ctx: ExprContext): NumberValue;
|
|
14
|
-
count(ctx: ExprContext): NumberValue;
|
|
15
|
-
'generate-id'(_ctx: ExprContext): StringValue;
|
|
16
|
-
id(ctx: ExprContext): NodeSetValue;
|
|
17
|
-
'xml-to-json'(ctx: ExprContext): StringValue;
|
|
18
|
-
'local-name'(context: ExprContext): StringValue;
|
|
19
|
-
'namespace-uri'(ctx: ExprContext): StringValue;
|
|
20
|
-
name(ctx: ExprContext): StringValue;
|
|
21
|
-
string(ctx: ExprContext): StringValue;
|
|
22
|
-
concat(ctx: ExprContext): StringValue;
|
|
23
|
-
'starts-with'(ctx: ExprContext): BooleanValue;
|
|
24
|
-
'ends-with'(ctx: ExprContext): BooleanValue;
|
|
25
|
-
contains(ctx: ExprContext): BooleanValue;
|
|
26
|
-
'substring-before'(ctx: ExprContext): StringValue;
|
|
27
|
-
'substring-after'(ctx: ExprContext): StringValue;
|
|
28
|
-
substring(ctx: ExprContext): StringValue;
|
|
29
|
-
'string-length'(ctx: ExprContext): NumberValue;
|
|
30
|
-
'normalize-space'(ctx: ExprContext): StringValue;
|
|
31
|
-
translate(ctx: ExprContext): StringValue;
|
|
32
|
-
matches(ctx: ExprContext): BooleanValue;
|
|
33
|
-
boolean(ctx: ExprContext): BooleanValue;
|
|
34
|
-
not(ctx: ExprContext): BooleanValue;
|
|
35
|
-
true(): BooleanValue;
|
|
36
|
-
false(): BooleanValue;
|
|
37
|
-
lang(ctx: ExprContext): BooleanValue;
|
|
38
|
-
number(ctx: ExprContext): NumberValue;
|
|
39
|
-
sum(ctx: ExprContext): NumberValue;
|
|
40
|
-
floor(ctx: ExprContext): NumberValue;
|
|
41
|
-
ceiling(ctx: ExprContext): NumberValue;
|
|
42
|
-
round(ctx: ExprContext): NumberValue;
|
|
43
|
-
'ext-join'(ctx: ExprContext): StringValue;
|
|
44
|
-
'ext-if'(ctx: ExprContext): any;
|
|
45
|
-
'ext-cardinal'(ctx: ExprContext): NodeSetValue;
|
|
6
|
+
xPathFunctions: {
|
|
7
|
+
[key: string]: Function;
|
|
46
8
|
};
|
|
47
9
|
constructor(name: any);
|
|
48
10
|
appendArg(arg: any): void;
|
|
49
|
-
evaluate(
|
|
11
|
+
evaluate(context: ExprContext): any;
|
|
50
12
|
}
|