XSLT 1.0 · 2.0 · 3.0 · XPath 3.1 · EXSLT
Keep your XSLT running when browsers drop it
JavaScript implementation of XSLTProcessor for browser environments and Node.js CLI. This package provides a complete implementation of the W3C XSLTProcessor API that can be used as a drop-in replacement for the native browser implementation.
npm install @tradik/xslt-processor
XSLT 2.0 and 3.0: add @tradik/xslt3 and pass xsltVersion: "auto" (how)
Not sure what breaks? npx xslt-migrate-check . (what it finds) or check online, then migrate in five steps
Why now
Chrome and other browsers are removing native XSLT (Chrome's announcement):
- Chrome 143 (December 2025):
XSLTProcessorand<?xml-stylesheet type="text/xsl"?>are deprecated, with warnings in the console - Chrome 158 (17 November 2026): XSLT stops working in stable Chrome, except for sites in the origin trial and browsers under the enterprise policy
- Chrome 176 (17 August 2027): the origin trial and the enterprise policy end; XSLT is off everywhere
- Firefox and WebKit support the removal but have not announced dates
This library ensures your XSLT-based applications continue to work regardless of browser support.
Used bySchema Resume, Job Tailor and others: see References.
What you get
1:1 Native API Compatibility
Drop-in replacement for native
XSLTProcessorOne-line migration
import "@tradik/xslt-processor/polyfill"or a<script>tag keepsXSLTProcessorpages working, and the same tag inside an XML document keeps<?xml-stylesheet?>rendering;npx xslt-migrate-check .finds the pages that need it,--fixwrites the patch andxslt-migrate-testcompares the output with the browser's (wizard, how-to)XSLT 1.0
Every element and function of the W3C XSLT 1.0 Recommendation, with the few gaps listed under Known Deviations
XPath 1.0 Engine
Built-in XPath evaluator with all core functions
xsl:outputSerializationtransformToString()honors method, indent, doctype, CDATA sections anddisable-output-escapingZero Dependencies
The library has no runtime dependencies; only the
xsltcommand line tool needsjsdom(an optional peer dependency)Multiple Formats
ESM, CommonJS, and browser IIFE bundles
TypeScript Support
Includes TypeScript declarations
Find out what breaks
One command scans a project for the XSLT it runs in the browser: pages that call XSLTProcessor, XML documents rendered with <?xml-stylesheet?>, and the stylesheets themselves. Nothing leaves your machine.
npx xslt-migrate-check .
Found 5 XSLTProcessor usages in 2 files
Found 12 XSL stylesheets (10 × XSLT 1.0, 1 × XSLT 2.0, 1 × XSLT 3.0)
Found 3 XML documents rendered with <?xml-stylesheet?>
Chrome compatibility risk: HIGH
Suggested migration: @tradik/xslt-processor It ends with the one line that fixes each kind of page: a <script> tag for pages that use XSLTProcessor, and the same tag inside an XML document for <?xml-stylesheet?>. Add --fail-on high in a pipeline. The migration how-to walks through every step; the reference lists what it looks for.
Used by
Schema Resume
Its CV Editor renders résumés from XML with XSLT through @tradik/xslt-processor.
Job Tailor
UK service for ATS-friendly CVs and cover letters.
All references, with the specifications and test suites it is verified against
Install
npm install @tradik/xslt-processor
# or
yarn add @tradik/xslt-processor
pnpm add @tradik/xslt-processor
bun add @tradik/xslt-processor
Every change is installed and smoke-tested in CI with npm, Yarn 1, Yarn 4
(Plug'n'Play), pnpm and bun (npm run test:package-managers). The XSLT 2.0/3.0
engine installs the same way (yarn add @tradik/xslt3 and so on), and the
migration checker runs without installing: npx xslt-migrate-check .,
pnpm dlx xslt-migrate-check . or bunx xslt-migrate-check ..
The library itself has no dependencies. The xslt command line tool also
needs jsdom (an optional peer dependency, >=25), see CLI Usage.
Quick start: Browser via CDN (Recommended)
Use a CDN for the easiest browser integration - no build step required:
<!-- jsDelivr (recommended) -->
<script src="https://cdn.jsdelivr.net/npm/@tradik/xslt-processor@1/dist/xslt-processor.browser.min.js"></script>
<!-- or unpkg -->
<script src="https://unpkg.com/@tradik/xslt-processor@1/dist/xslt-processor.browser.min.js"></script>
<script>
// XSLTProcessor is the native one, or this polyfill when native XSLT is unavailable
const processor = new XSLTProcessor();
// Load and transform XML
const parser = new DOMParser();
const xslt = parser.parseFromString(xsltString, 'application/xml');
const xml = parser.parseFromString(xmlString, 'application/xml');
processor.importStylesheet(xslt);
const result = processor.transformToFragment(xml, document);
document.getElementById('output').appendChild(result);
</script>
The bundle defines the global XsltProcessorLib (all module exports)
and calls installGlobal(): window.XSLTProcessor is replaced only when the
browser has no working native implementation. To always use this
implementation, call XsltProcessorLib.installGlobal(true) or use
new XsltProcessorLib.XSLTProcessor().
CDN URLs:
| CDN | URL |
|---|---|
| jsDelivr | https://cdn.jsdelivr.net/npm/@tradik/xslt-processor@1/dist/xslt-processor.browser.min.js |
| unpkg | https://unpkg.com/@tradik/xslt-processor@1/dist/xslt-processor.browser.min.js |
Tip: Use
@1for the latest 1.x version, or an exact version such as@1.1.3for pinning.
ES modules, CommonJS, Node.js and the xslt command line tool are covered in Getting started.
Guides
- Getting started
- Install the package and run a first transformation.
- API Reference
- XSLTProcessor methods, parameters, xsl:output serialization, module exports, XsltEngine options, TypeScript
- Loaders
- xsl:import, xsl:include and the document() function
- Complete Example
- A product list transformed into an HTML table (browser and CLI)
- Command Line Tool
- xslt options, base directory, includes, input encodings
- Conformance
- W3C compliance tables, supported elements and functions, known deviations, test coverage
- Security Limits
- XPath and XSLT limits, prototype pollution protection, input validation
- Browser Compatibility
- Minimum browser versions, native XSLT removal timeline, feature detection
- XSLT 2.0 and 3.0
- @tradik/xslt3: one engine for XSLT 3.0 and 2.0 in a separate package; options, conformance and design
- Migration checker
- npx xslt-migrate-check .: finds XSLTProcessor usages, documents and stylesheets in a project, rates the Chrome risk and prints the one-line migration; --json and --fail-on for CI; online at xslt-processor.tradik.com/check
- Migration fixes
- npx xslt-migrate-check . --fix: the polyfill import, the script tags and the dependencies written as migration.patch for review (--write applies it); xslt-migrate-check/analyze runs the same analysis in a browser
- Migration test
- xslt-migrate-test: runs every XML + XSL pair on the browser's engine (Chromium) or libxslt and on this library, compares the output and reports the compatibility
- Benchmarks
- Every version side by side (1.1.3, 1.2.0, 1.3.0, @tradik/xslt3) in one chart and table; then the detailed runs: 1.1.3 vs 1.2.0 speed-up, time and peak memory per scenario, with charts, tables and npm run bench to reproduce; XPath 1.0 of this package vs XPath 3.1 of @tradik/xslt3 (npm run bench -- --suite xpath); the XSLT 1.0 engine vs @tradik/xslt3 on the same stylesheets, idiomatic 2.0/3.0 rewrites and 3.0-only scenarios (npm run bench -- --suite xslt)
- Development
- Setup, tests, Docker, Makefile, publishing to npm
- Style Guide
- Project colors with WCAG 2.2 contrast ratios