xslt-processor 5.0.1 → 5.0.2
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/index.d.mts +18 -17
- package/index.d.ts +18 -17
- package/index.js +28 -13
- package/index.js.map +1 -1
- package/index.mjs +28 -13
- package/index.mjs.map +1 -1
- package/package.json +1 -1
- package/umd/xslt-processor.global.js +2 -2
- package/umd/xslt-processor.global.js.map +1 -1
package/index.mjs
CHANGED
|
@@ -6450,8 +6450,15 @@ var init_function_call_expression = __esm({
|
|
|
6450
6450
|
return !!value;
|
|
6451
6451
|
}
|
|
6452
6452
|
toNumber(args, context) {
|
|
6453
|
+
const toNumberFromString = (text) => {
|
|
6454
|
+
const trimmed = text.trim();
|
|
6455
|
+
if (trimmed.length === 0) {
|
|
6456
|
+
return NaN;
|
|
6457
|
+
}
|
|
6458
|
+
return Number(trimmed);
|
|
6459
|
+
};
|
|
6453
6460
|
if (args.length === 0) {
|
|
6454
|
-
return
|
|
6461
|
+
return toNumberFromString(this.stringValue([], context));
|
|
6455
6462
|
}
|
|
6456
6463
|
const value = args[0];
|
|
6457
6464
|
if (typeof value === "object" && value !== null && "numberValue" in value && typeof value.numberValue === "function") {
|
|
@@ -6461,7 +6468,10 @@ var init_function_call_expression = __esm({
|
|
|
6461
6468
|
if (value.length === 0) return NaN;
|
|
6462
6469
|
const firstNode = value[0];
|
|
6463
6470
|
const stringValue = this.getNodeStringValue(firstNode);
|
|
6464
|
-
return
|
|
6471
|
+
return toNumberFromString(stringValue);
|
|
6472
|
+
}
|
|
6473
|
+
if (typeof value === "string") {
|
|
6474
|
+
return toNumberFromString(value);
|
|
6465
6475
|
}
|
|
6466
6476
|
return Number(value);
|
|
6467
6477
|
}
|
|
@@ -11619,7 +11629,11 @@ var StringValue = class {
|
|
|
11619
11629
|
return this.value.length > 0;
|
|
11620
11630
|
}
|
|
11621
11631
|
numberValue() {
|
|
11622
|
-
|
|
11632
|
+
const text = String(this.value).trim();
|
|
11633
|
+
if (text.length === 0) {
|
|
11634
|
+
return NaN;
|
|
11635
|
+
}
|
|
11636
|
+
return Number(text);
|
|
11623
11637
|
}
|
|
11624
11638
|
nodeSetValue() {
|
|
11625
11639
|
throw this;
|
|
@@ -12418,13 +12432,14 @@ var ExprContext = class _ExprContext {
|
|
|
12418
12432
|
*
|
|
12419
12433
|
* Notice that position starts at 0 at the outside interface;
|
|
12420
12434
|
* inside XPath expressions this shows up as position()=1.
|
|
12421
|
-
* @param nodeList
|
|
12422
|
-
* @param
|
|
12423
|
-
* @param
|
|
12424
|
-
* @param
|
|
12425
|
-
* @param
|
|
12426
|
-
* @param
|
|
12427
|
-
* @param
|
|
12435
|
+
* @param nodeList The list of nodes that contains the current node. This is needed to implement the position() and last() functions, and to evaluate predicates.
|
|
12436
|
+
* @param xsltVersion The XSLT version in use, which may affect certain function behaviors (e.g. 1.0 vs 2.0).
|
|
12437
|
+
* @param opt_position The position of the current node in the nodeList. Defaults to 0.
|
|
12438
|
+
* @param opt_parent The parent expression context, used for variable scoping. Defaults to null.
|
|
12439
|
+
* @param opt_caseInsensitive Whether node name tests should be case insensitive. Defaults to false.
|
|
12440
|
+
* @param opt_ignoreAttributesWithoutValue Whether to ignore attributes that have no value (e.g. <input disabled>) when evaluating XPath expressions. Defaults to false.
|
|
12441
|
+
* @param opt_returnOnFirstMatch Whether XPath evaluation should return as soon as the first match is found. Defaults to false.
|
|
12442
|
+
* @param opt_ignoreNonElementNodesForNTA Whether to ignore non-element nodes when evaluating the "node()" any node test. Defaults to false.
|
|
12428
12443
|
*/
|
|
12429
12444
|
constructor(nodeList, xsltVersion = "1.0", opt_position, opt_decimalFormatSettings, opt_variables, opt_knownNamespaces, opt_parent, opt_caseInsensitive, opt_ignoreAttributesWithoutValue, opt_returnOnFirstMatch, opt_ignoreNonElementNodesForNTA, opt_warningsCallback) {
|
|
12430
12445
|
this.nodeList = nodeList;
|
|
@@ -12466,9 +12481,9 @@ var ExprContext = class _ExprContext {
|
|
|
12466
12481
|
* parent. If passed as argument to clone(), the new context has a
|
|
12467
12482
|
* different node, position, or node set. What is not passed is
|
|
12468
12483
|
* inherited from the cloned context.
|
|
12469
|
-
* @param opt_nodeList
|
|
12470
|
-
* @param opt_position
|
|
12471
|
-
* @returns
|
|
12484
|
+
* @param opt_nodeList The node list for the new context. If not provided, the new context inherits the node list of the current context.
|
|
12485
|
+
* @param opt_position The position for the new context. If not provided, the new context inherits the position of the current context.
|
|
12486
|
+
* @returns A new ExprContext instance with the specified node list and position, and the current context as its parent.
|
|
12472
12487
|
*/
|
|
12473
12488
|
clone(opt_nodeList, opt_position) {
|
|
12474
12489
|
return new _ExprContext(
|