@tradik/xslt-processor 1.0.1 → 1.0.3
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 +3 -3
- package/dist/xslt-processor.browser.js +3 -8
- package/dist/xslt-processor.browser.js.map +2 -2
- package/dist/xslt-processor.browser.min.js +1 -1
- package/dist/xslt-processor.browser.min.js.map +2 -2
- package/dist/xslt-processor.cjs +3 -8
- package/dist/xslt-processor.cjs.map +2 -2
- package/dist/xslt-processor.js +3 -8
- package/dist/xslt-processor.js.map +2 -2
- package/package.json +3 -3
- package/src/xslt/engine.js +8 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tradik/xslt-processor",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "JavaScript implementation of XSLTProcessor for browser environments and CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/xslt-processor.cjs",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"javascript"
|
|
48
48
|
],
|
|
49
49
|
"author": "tradik",
|
|
50
|
-
"license": "
|
|
50
|
+
"license": "BSD-3-Clause",
|
|
51
51
|
"repository": {
|
|
52
52
|
"type": "git",
|
|
53
53
|
"url": "git+https://github.com/spagu/XSLT-Processor.git"
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
},
|
|
58
58
|
"homepage": "https://github.com/spagu/XSLT-Processor#readme",
|
|
59
59
|
"engines": {
|
|
60
|
-
"node": ">=
|
|
60
|
+
"node": ">=18.0.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"eslint": "^9.0.0",
|
package/src/xslt/engine.js
CHANGED
|
@@ -588,10 +588,11 @@ export class XsltEngine {
|
|
|
588
588
|
throw new Error("No output document available");
|
|
589
589
|
}
|
|
590
590
|
|
|
591
|
-
// Create context
|
|
591
|
+
// Create context - use document node as initial context for "/" template matching
|
|
592
|
+
// XPath paths like "RootElement/child" expect to start from document node
|
|
592
593
|
const context = new XsltContext({
|
|
593
|
-
currentNode: sourceNode
|
|
594
|
-
currentNodeList: [sourceNode
|
|
594
|
+
currentNode: sourceNode,
|
|
595
|
+
currentNodeList: [sourceNode],
|
|
595
596
|
position: 1,
|
|
596
597
|
outputDocument: doc,
|
|
597
598
|
stylesheet: this.stylesheetDoc,
|
|
@@ -617,13 +618,10 @@ export class XsltEngine {
|
|
|
617
618
|
// Create result document fragment
|
|
618
619
|
const fragment = doc.createDocumentFragment();
|
|
619
620
|
|
|
620
|
-
// Apply templates to
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
context,
|
|
625
|
-
fragment,
|
|
626
|
-
);
|
|
621
|
+
// Apply templates to document node (not documentElement)
|
|
622
|
+
// This ensures "/" template has document as context, so paths like
|
|
623
|
+
// "RootElement/child" work correctly
|
|
624
|
+
this.applyTemplates([sourceNode], null, context, fragment);
|
|
627
625
|
|
|
628
626
|
return fragment;
|
|
629
627
|
}
|