@tradik/xslt-processor 1.0.0 → 1.0.1
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 +36 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -35,9 +35,43 @@ npm install @tradik/xslt-processor
|
|
|
35
35
|
|
|
36
36
|
## Usage
|
|
37
37
|
|
|
38
|
-
### Browser (
|
|
38
|
+
### Browser via CDN (Recommended)
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
Use a CDN for the easiest browser integration - no build step required:
|
|
41
|
+
|
|
42
|
+
```html
|
|
43
|
+
<!-- jsDelivr (recommended) -->
|
|
44
|
+
<script src="https://cdn.jsdelivr.net/npm/@tradik/xslt-processor@1/dist/xslt-processor.browser.min.js"></script>
|
|
45
|
+
|
|
46
|
+
<!-- or unpkg -->
|
|
47
|
+
<script src="https://unpkg.com/@tradik/xslt-processor@1/dist/xslt-processor.browser.min.js"></script>
|
|
48
|
+
|
|
49
|
+
<script>
|
|
50
|
+
// XSLTProcessor is now available globally
|
|
51
|
+
const processor = new XSLTProcessor();
|
|
52
|
+
|
|
53
|
+
// Load and transform XML
|
|
54
|
+
const parser = new DOMParser();
|
|
55
|
+
const xslt = parser.parseFromString(xsltString, 'application/xml');
|
|
56
|
+
const xml = parser.parseFromString(xmlString, 'application/xml');
|
|
57
|
+
|
|
58
|
+
processor.importStylesheet(xslt);
|
|
59
|
+
const result = processor.transformToFragment(xml, document);
|
|
60
|
+
document.getElementById('output').appendChild(result);
|
|
61
|
+
</script>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**CDN URLs:**
|
|
65
|
+
| CDN | URL |
|
|
66
|
+
|-----|-----|
|
|
67
|
+
| jsDelivr | `https://cdn.jsdelivr.net/npm/@tradik/xslt-processor@1/dist/xslt-processor.browser.min.js` |
|
|
68
|
+
| unpkg | `https://unpkg.com/@tradik/xslt-processor@1/dist/xslt-processor.browser.min.js` |
|
|
69
|
+
|
|
70
|
+
> **Tip:** Use `@1` for latest 1.x version, or `@1.0.0` for exact version pinning.
|
|
71
|
+
|
|
72
|
+
### Browser (Local Install)
|
|
73
|
+
|
|
74
|
+
If you prefer local installation:
|
|
41
75
|
|
|
42
76
|
```html
|
|
43
77
|
<script src="node_modules/@tradik/xslt-processor/dist/xslt-processor.browser.min.js"></script>
|