xslt-processor 5.0.9 → 5.0.11
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/dist/index.js +29 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +29 -21
- package/dist/index.mjs.map +1 -1
- package/dist/umd/xslt-processor.global.js +6 -6
- package/dist/umd/xslt-processor.global.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9084,13 +9084,9 @@ var XPathBaseParser = class {
|
|
|
9084
9084
|
return expr;
|
|
9085
9085
|
}
|
|
9086
9086
|
parsePrimaryExpr() {
|
|
9087
|
-
var _a, _b
|
|
9087
|
+
var _a, _b;
|
|
9088
9088
|
if (this.match("DOLLAR")) {
|
|
9089
|
-
const
|
|
9090
|
-
if (!next || !this.isNcNameToken(next.type)) {
|
|
9091
|
-
throw grammarViolation(`Expected variable name after $. Got: ${(_a = next == null ? void 0 : next.lexeme) != null ? _a : "EOF"}`);
|
|
9092
|
-
}
|
|
9093
|
-
const name = this.advance().lexeme;
|
|
9089
|
+
const name = this.parseVariableReferenceName();
|
|
9094
9090
|
return new XPathVariableReference(name);
|
|
9095
9091
|
}
|
|
9096
9092
|
if (this.match("OPEN_PAREN")) {
|
|
@@ -9114,7 +9110,7 @@ var XPathBaseParser = class {
|
|
|
9114
9110
|
return this.parseFunctionCall();
|
|
9115
9111
|
}
|
|
9116
9112
|
throw grammarViolation(
|
|
9117
|
-
`Unexpected token in primary expression: ${(
|
|
9113
|
+
`Unexpected token in primary expression: ${(_b = (_a = this.peek()) == null ? void 0 : _a.lexeme) != null ? _b : "EOF"}`
|
|
9118
9114
|
);
|
|
9119
9115
|
}
|
|
9120
9116
|
parseFunctionCall() {
|
|
@@ -9186,8 +9182,29 @@ var XPathBaseParser = class {
|
|
|
9186
9182
|
isFunctionNameToken(type) {
|
|
9187
9183
|
return type === "IDENTIFIER" || type === "FUNCTION" || type === "OPERATOR" || type === "LOCATION" || type === "EQNAME";
|
|
9188
9184
|
}
|
|
9185
|
+
parseVariableReferenceName() {
|
|
9186
|
+
var _a, _b;
|
|
9187
|
+
if (this.check("EQNAME")) {
|
|
9188
|
+
return this.advance().lexeme;
|
|
9189
|
+
}
|
|
9190
|
+
const next = this.peek();
|
|
9191
|
+
if (!next || !this.isNcNameToken(next.type)) {
|
|
9192
|
+
throw grammarViolation(`Expected variable name after $. Got: ${(_a = next == null ? void 0 : next.lexeme) != null ? _a : "EOF"}`);
|
|
9193
|
+
}
|
|
9194
|
+
let name = this.advance().lexeme;
|
|
9195
|
+
if (this.match("COLON")) {
|
|
9196
|
+
const local = this.peek();
|
|
9197
|
+
if (!local || !this.isNcNameToken(local.type)) {
|
|
9198
|
+
throw grammarViolation(
|
|
9199
|
+
`Expected local name after namespace prefix in variable reference. Got: ${(_b = local == null ? void 0 : local.lexeme) != null ? _b : "EOF"}`
|
|
9200
|
+
);
|
|
9201
|
+
}
|
|
9202
|
+
name = `${name}:${this.advance().lexeme}`;
|
|
9203
|
+
}
|
|
9204
|
+
return name;
|
|
9205
|
+
}
|
|
9189
9206
|
isNcNameToken(type) {
|
|
9190
|
-
return type === "IDENTIFIER" || type === "FUNCTION" || type === "OPERATOR" || type === "LOCATION" || type === "NODE_TYPE";
|
|
9207
|
+
return type === "IDENTIFIER" || type === "FUNCTION" || type === "OPERATOR" || type === "LOCATION" || type === "NODE_TYPE" || type === "RESERVED_WORD";
|
|
9191
9208
|
}
|
|
9192
9209
|
parseNameOrWildcard() {
|
|
9193
9210
|
let name = "";
|
|
@@ -9298,16 +9315,12 @@ var XPath20Parser = class extends XPathBaseParser {
|
|
|
9298
9315
|
return left;
|
|
9299
9316
|
}
|
|
9300
9317
|
parsePrimaryExpr() {
|
|
9301
|
-
var _a, _b;
|
|
9302
9318
|
if (this.check("RESERVED_WORD") && this.peek().lexeme === "if") {
|
|
9303
9319
|
return this.parseIfExpr();
|
|
9304
9320
|
}
|
|
9305
9321
|
if (this.check("DOLLAR")) {
|
|
9306
9322
|
this.advance();
|
|
9307
|
-
|
|
9308
|
-
throw new Error(`Expected variable name after $. Got: ${(_b = (_a = this.peek()) == null ? void 0 : _a.lexeme) != null ? _b : "EOF"}`);
|
|
9309
|
-
}
|
|
9310
|
-
const name = this.advance().lexeme;
|
|
9323
|
+
const name = this.parseVariableReferenceName();
|
|
9311
9324
|
return new XPathVariableReference(name);
|
|
9312
9325
|
}
|
|
9313
9326
|
return super.parsePrimaryExpr();
|
|
@@ -9684,7 +9697,7 @@ var XPath30Parser = class extends XPath20Parser {
|
|
|
9684
9697
|
let args = [];
|
|
9685
9698
|
if (this.check("DOLLAR")) {
|
|
9686
9699
|
this.advance();
|
|
9687
|
-
const varName = this.
|
|
9700
|
+
const varName = this.parseVariableReferenceName();
|
|
9688
9701
|
funcExpr = new XPathVariableReference(varName);
|
|
9689
9702
|
this.consume(
|
|
9690
9703
|
"OPEN_PAREN",
|
|
@@ -9752,8 +9765,7 @@ var XPath30Parser = class extends XPath20Parser {
|
|
|
9752
9765
|
return this.parseStringTemplateFromLexeme(template);
|
|
9753
9766
|
}
|
|
9754
9767
|
if (this.match("DOLLAR")) {
|
|
9755
|
-
|
|
9756
|
-
return new XPathVariableReference(nameToken.lexeme);
|
|
9768
|
+
return new XPathVariableReference(this.parseVariableReferenceName());
|
|
9757
9769
|
}
|
|
9758
9770
|
if (this.checkReservedWordInternal("function")) {
|
|
9759
9771
|
return this.parseInlineFunction();
|
|
@@ -15236,10 +15248,6 @@ var Xslt = class {
|
|
|
15236
15248
|
}
|
|
15237
15249
|
const sortContext = context.clone(nodes);
|
|
15238
15250
|
this.xsltSort(sortContext, template);
|
|
15239
|
-
const nodesWithParent = sortContext.nodeList.filter((n) => n.parentNode !== null && n.parentNode !== void 0);
|
|
15240
|
-
if (nodesWithParent.length <= 0) {
|
|
15241
|
-
throw new Error("Nodes with no parents defined.");
|
|
15242
|
-
}
|
|
15243
15251
|
for (let i = 0; i < sortContext.contextSize(); ++i) {
|
|
15244
15252
|
yield this.xsltChildNodesExcludingConditional(
|
|
15245
15253
|
sortContext.clone(sortContext.nodeList, i),
|
|
@@ -15502,7 +15510,7 @@ var Xslt = class {
|
|
|
15502
15510
|
);
|
|
15503
15511
|
if (onCompletionElements.length > 0) {
|
|
15504
15512
|
const onCompletion = onCompletionElements[0];
|
|
15505
|
-
const completionContext = context.clone(
|
|
15513
|
+
const completionContext = context.clone();
|
|
15506
15514
|
for (const accName in accumulators) {
|
|
15507
15515
|
completionContext.variables[accName] = accumulators[accName];
|
|
15508
15516
|
}
|