XSLT
An XSLTProcessor applies an XSLT stylesheet transformation to an XML document to produce a new XML document as output. It has methods to load the XSLT stylesheet, to manipulate <xsl:param> parameter values, and to apply the transformation to documents.
Browser support
| Feature | Desktop | Mobile | ||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Safari | Chrome Android | Safari iOS | |
| 1 | 12 | 1 | 3.1 | 18 | 2 | |
| The clearParameters() method of the XSLTProcessor interface removes all parameters () and their values from the stylesheet imported in the processor. The XSLTProcessor will then use the default values specified in the XSLT stylesheet. | 1 | 12 | 1 | 3.1 | 18 | 2 |
| The getParameter() method of the XSLTProcessor interface returns the value of a parameter () from the stylesheet imported in the processor. | 1 | 12 | 1 | 3.1 | 18 | 2 |
| The importStylesheet() method of the XSLTProcessor interface imports an XSLT stylesheet for the processor. | 1 | 12 | 1 | 3.1 | 18 | 2 |
| The removeParameter() method of the XSLTProcessor interface removes the parameter () and its value from the stylesheet imported in the processor. | 1 | 12 | 1 | 3.1 | 18 | 2 |
| The reset() method of the XSLTProcessor interface removes all parameters () and the XSLT stylesheet from the processor. The XSLTProcessor will then be in its original state when it was created. | 1 | 12 | 1 | 3.1 | 18 | 2 |
| The setParameter() method of the XSLTProcessor interface sets the value of a parameter () in the stylesheet imported in the processor. | 1 | 12 | 1 | 3.1 | 18 | 2 |
| The transformToDocument() method of the XSLTProcessor interface transforms the provided Node source to a Document using the XSLT stylesheet associated with XSLTProcessor. | 1 | 12 | 1 | 3.1 | 18 | 2 |
| The transformToFragment() method of the XSLTProcessor interface transforms a provided Node source to a DocumentFragment using the XSLT stylesheet associated with the XSLTProcessor. | 1 | 12 | 1 | 3.1 | 18 | 2 |
| The XSLTProcessor() constructor creates a new XSLTProcessor object instance. | 1 | 12 | 1 | 3.1 | 18 | 2 |
- This feature was removed in a later browser version (147)
- This feature was removed in a later browser version (147)
- This feature was removed in a later browser version (147)
- This feature was removed in a later browser version (147)
- This feature was removed in a later browser version (147)
- Chrome only supports string values.
- Edge only supports string values.
- Safari only supports string values.
- This feature was removed in a later browser version (147)
- Chrome Android only supports string values.
- Safari on iOS only supports string values.
- This feature was removed in a later browser version (147)
- This feature was removed in a later browser version (147)
- This feature was removed in a later browser version (147)
- This feature was removed in a later browser version (147)
- This feature was removed in a later browser version (147)
- This feature was removed in a later browser version (147)
- This feature was removed in a later browser version (147)
- Chrome only supports string values.
- Edge only supports string values.
- Safari only supports string values.
- This feature was removed in a later browser version (147)
- Chrome Android only supports string values.
- Safari on iOS only supports string values.
- This feature was removed in a later browser version (147)
- Chrome returns `null` if an error occurs.
- Edge returns `null` if an error occurs.
- Firefox throws an exception if an error occurs.
- Safari returns `null` if an error occurs.
- This feature was removed in a later browser version (147)
- Chrome Android returns `null` if an error occurs.
- Safari on iOS returns `null` if an error occurs.
- This feature was removed in a later browser version (147)
- Chrome returns `null` if an error occurs.
- Edge returns `null` if an error occurs.
- Firefox throws an exception if an error occurs.
- Safari returns `null` if an error occurs.
- This feature was removed in a later browser version (147)
- Chrome Android returns `null` if an error occurs.
- Safari on iOS returns `null` if an error occurs.
- This feature was removed in a later browser version (147)
- This feature was removed in a later browser version (147)
Use cases
-
Using XSLT
An XSLTProcessor applies an XSLT stylesheet transformation to an XML document to
Cautions
- May not be supported in older browsers.
Implementation notes
- Some APIs require a secure context (HTTPS) or user activation. Check the requirements before use.