XSLTLimited availability
The XSLTProcessor API transforms XML documents into new XML or HTML documents, using XSLT stylesheets. You can use XSLT to convert data between different XML schemas or to convert XML data into web pages or PDF documents. Also known as Extensible Stylesheet Language Transformations.
Not yet supported in all major browsers — check the table and provide a fallback.
Discouraged: XSLT is a candidate for removal from browsers because browser implementations are highly susceptible to memory safety vulnerabilities.
Browser support
How to use
Support is still inconsistent across browsers. Use feature detection and test carefully.
Example
Full syntax and examples are on MDN: XSLTProcessor.
Feature detection
if ("XSLTProcessor" in globalThis) {
// XSLTProcessor is available
} else {
// load a polyfill or use a fallback
}Sub-features
Support for each part of the feature (10). The overall table above shows when the whole feature works.
| Sub-feature | Chrome | Edge | Firefox | Safari | Chrome Android | Firefox Android | Safari iOS |
|---|---|---|---|---|---|---|---|
| XSLTProcessor | 1 | 12 | 1 | 3.1 | 18 | 4 | 2 |
| XSLTProcessor.XSLTProcessor | 1 | 12 | 1 | 3.1 | 18 | 4 | 2 |
| XSLTProcessor.clearParameters | 1 | 12 | 1 | 3.1 | 18 | 4 | 2 |
| XSLTProcessor.getParameter | 1 | 12 | 1 | 3.1 | 18 | 4 | 2 |
| XSLTProcessor.importStylesheet | 1 | 12 | 1 | 3.1 | 18 | 4 | 2 |
| XSLTProcessor.removeParameter | 1 | 12 | 1 | 3.1 | 18 | 4 | 2 |
| XSLTProcessor.reset | 1 | 12 | 1 | 3.1 | 18 | 4 | 2 |
| XSLTProcessor.setParameter | 1 | 12 | 1 | 3.1 | 18 | 4 | 2 |
| XSLTProcessor.transformToDocument | 1 | 12 | 1 | 3.1 | 18 | 4 | 2 |
| XSLTProcessor.transformToFragment | 1 | 12 | 1 | 3.1 | 18 | 4 | 2 |