@tradik/xslt-processor 1.0.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/LICENSE +29 -0
- package/LICENSE.md +28 -0
- package/README.md +634 -0
- package/bin/xslt.js +208 -0
- package/dist/xslt-processor.browser.js +3302 -0
- package/dist/xslt-processor.browser.js.map +7 -0
- package/dist/xslt-processor.browser.min.js +6 -0
- package/dist/xslt-processor.browser.min.js.map +7 -0
- package/dist/xslt-processor.cjs +3311 -0
- package/dist/xslt-processor.cjs.map +7 -0
- package/dist/xslt-processor.d.ts +211 -0
- package/dist/xslt-processor.js +3271 -0
- package/dist/xslt-processor.js.map +7 -0
- package/package.json +68 -0
- package/src/XSLTProcessor.js +368 -0
- package/src/XSLTProcessor.test.js +930 -0
- package/src/index.js +66 -0
- package/src/xpath/evaluator.js +1012 -0
- package/src/xpath/evaluator.test.js +1852 -0
- package/src/xpath/index.js +67 -0
- package/src/xpath/parser.js +595 -0
- package/src/xpath/tokenizer.js +383 -0
- package/src/xpath/tokenizer.test.js +224 -0
- package/src/xslt/engine.js +1812 -0
- package/src/xslt/engine.test.js +3130 -0
- package/src/xslt/index.js +6 -0
package/src/index.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* xslt-processor
|
|
3
|
+
*
|
|
4
|
+
* JavaScript implementation of XSLTProcessor for browser environments.
|
|
5
|
+
*
|
|
6
|
+
* This package provides a JavaScript implementation of the W3C XSLTProcessor API
|
|
7
|
+
* that can be used as a drop-in replacement for the native browser implementation.
|
|
8
|
+
*
|
|
9
|
+
* Specifications implemented:
|
|
10
|
+
* - XPath 1.0: http://www.w3.org/TR/1999/REC-xpath-19991116
|
|
11
|
+
* - XSLT 1.0: http://www.w3.org/TR/1999/REC-xslt-19991116
|
|
12
|
+
* - DOM Level 3: http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* // ESM import
|
|
16
|
+
* import { XSLTProcessor, installGlobal } from 'xslt-processor';
|
|
17
|
+
*
|
|
18
|
+
* // Install as global replacement
|
|
19
|
+
* installGlobal();
|
|
20
|
+
*
|
|
21
|
+
* // Or use directly
|
|
22
|
+
* const processor = new XSLTProcessor();
|
|
23
|
+
* processor.importStylesheet(xsltDoc);
|
|
24
|
+
* const result = processor.transformToFragment(xmlDoc, document);
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
// Main XSLTProcessor class
|
|
28
|
+
export {
|
|
29
|
+
XSLTProcessor,
|
|
30
|
+
isNativeXSLTSupported,
|
|
31
|
+
installGlobal,
|
|
32
|
+
default as default,
|
|
33
|
+
} from "./XSLTProcessor.js";
|
|
34
|
+
|
|
35
|
+
// XPath module (for advanced users)
|
|
36
|
+
export {
|
|
37
|
+
evaluate as evaluateXPath,
|
|
38
|
+
select as selectXPath,
|
|
39
|
+
selectFirst as selectFirstXPath,
|
|
40
|
+
XPathEvaluator,
|
|
41
|
+
XPathContext,
|
|
42
|
+
XPathResultType,
|
|
43
|
+
parse as parseXPath,
|
|
44
|
+
} from "./xpath/index.js";
|
|
45
|
+
|
|
46
|
+
// XSLT engine (for advanced users)
|
|
47
|
+
export { XsltEngine, XsltContext } from "./xslt/index.js";
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Version information
|
|
51
|
+
*/
|
|
52
|
+
export const VERSION = "1.0.0";
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Check if we're running in a browser environment
|
|
56
|
+
*/
|
|
57
|
+
export const isBrowser =
|
|
58
|
+
typeof window !== "undefined" && typeof document !== "undefined";
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Check if we're running in Node.js
|
|
62
|
+
*/
|
|
63
|
+
export const isNode =
|
|
64
|
+
typeof process !== "undefined" &&
|
|
65
|
+
process.versions != null &&
|
|
66
|
+
process.versions.node != null;
|