coderef

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

DesktopChrome
1+Supportedsince Dec 11, 2008
Current: 155
Edge
12+Supportedsince Jul 29, 2015
Current: 154
Firefox
1+Supportedsince Nov 9, 2004
Current: 157
Safari
1–3Not supported
3.1+Supportedsince Mar 18, 2008
Current: 27
MobileChrome Android
18+Supportedsince Jun 27, 2012
Current: 155
Firefox Android
4+Supportedsince Mar 29, 2011
Current: 157
Safari iOS
1–1Not supported
2+Supportedsince Jul 11, 2008
Current: 27

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

JS · check before using
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-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
XSLTProcessor11213.11842
XSLTProcessor.XSLTProcessor11213.11842
XSLTProcessor.clearParameters11213.11842
XSLTProcessor.getParameter11213.11842
XSLTProcessor.importStylesheet11213.11842
XSLTProcessor.removeParameter11213.11842
XSLTProcessor.reset11213.11842
XSLTProcessor.setParameter11213.11842
XSLTProcessor.transformToDocument11213.11842
XSLTProcessor.transformToFragment11213.11842