xslt-processor 5.0.2 → 5.0.4
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 +6 -0
- package/dist/LICENSE +165 -0
- package/dist/README.md +513 -0
- package/{index.d.mts → dist/index.d.mts} +6 -0
- package/{index.d.ts → dist/index.d.ts} +6 -0
- package/{index.js → dist/index.js} +25 -12
- package/{index.js.map → dist/index.js.map} +1 -1
- package/{index.mjs → dist/index.mjs} +25 -12
- package/{index.mjs.map → dist/index.mjs.map} +1 -1
- package/{umd → dist/umd}/xslt-processor.global.js +5 -5
- package/{umd → dist/umd}/xslt-processor.global.js.map +1 -1
- package/package.json +12 -9
|
@@ -16212,23 +16212,36 @@ var Xslt = class {
|
|
|
16212
16212
|
errorMessage = errorMessage.slice(0, -2);
|
|
16213
16213
|
throw new Error(errorMessage);
|
|
16214
16214
|
}
|
|
16215
|
-
let keyContext;
|
|
16216
|
-
if (context.nodeList[context.position].nodeName === "#document") {
|
|
16217
|
-
keyContext = context.clone(context.nodeList[context.position].childNodes);
|
|
16218
|
-
} else {
|
|
16219
|
-
keyContext = context;
|
|
16220
|
-
}
|
|
16221
|
-
const nodes = this.xsltMatch(match, keyContext);
|
|
16222
16215
|
if (!(name in context.keys)) {
|
|
16223
16216
|
context.keys[name] = {};
|
|
16224
16217
|
}
|
|
16225
|
-
|
|
16226
|
-
|
|
16227
|
-
|
|
16228
|
-
|
|
16229
|
-
|
|
16218
|
+
const allNodes = this.collectAllDescendants(context.root);
|
|
16219
|
+
for (const node of allNodes) {
|
|
16220
|
+
if (nodeMatchesPattern(node, match, context, this.matchResolver, this.xPath)) {
|
|
16221
|
+
const nodeContext = context.clone([node]);
|
|
16222
|
+
const attribute = this.xPath.xPathEval(use, nodeContext);
|
|
16223
|
+
const attributeValue = attribute.stringValue();
|
|
16224
|
+
if (!(attributeValue in context.keys[name])) {
|
|
16225
|
+
context.keys[name][attributeValue] = new NodeSetValue([node]);
|
|
16226
|
+
} else {
|
|
16227
|
+
context.keys[name][attributeValue].nodeSetValue().push(node);
|
|
16228
|
+
}
|
|
16229
|
+
}
|
|
16230
16230
|
}
|
|
16231
16231
|
}
|
|
16232
|
+
/**
|
|
16233
|
+
* Returns all descendant nodes of the given node, depth-first.
|
|
16234
|
+
* @param node The root node to traverse from.
|
|
16235
|
+
* @returns All descendant nodes.
|
|
16236
|
+
*/
|
|
16237
|
+
collectAllDescendants(node) {
|
|
16238
|
+
const result = [];
|
|
16239
|
+
for (const child of node.childNodes || []) {
|
|
16240
|
+
result.push(child);
|
|
16241
|
+
result.push(...this.collectAllDescendants(child));
|
|
16242
|
+
}
|
|
16243
|
+
return result;
|
|
16244
|
+
}
|
|
16232
16245
|
/**
|
|
16233
16246
|
* Implements `xsl:message`.
|
|
16234
16247
|
* Outputs a message to the console. If terminate="yes", throws an error to stop processing.
|