The transformToDocument() method of the XSLTProcessor interface transforms the provided Node source to a Document using the XSLT stylesheet associated with XSLTProcessor.
The transformToDocument() method of the XSLTProcessor interface transforms the provided Node source to a Document using the XSLT stylesheet associated with XSLTProcessor.
js
transformToDocument(source)
A Document. The actual interface depends on the output method of the stylesheet:
| Output method | Result interface | 
|---|---|
html |  HTMLDocument |  
xml |  XMLDocument |  
text |  
XMLDocument with a single root element <transformiix:result> with the text as a child |  
| Specification | 
|---|
| DOM Standard  # dom-xsltprocessor-transformtodocument  | 
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
transformToDocument | 
1Chrome returnsnull if an error occurs. | 
12Edge returnsnull if an error occurs. | 
1Firefox throws an exception if an error occurs. | 
No | ≤12.1["Opera 12.1 and earlier throws an exception if an error occurs.", "Opera 15 and later returnsnull if an error occurs."] | 
3.1Safari returnsnull if an error occurs. | 
3WebView returnsnull if an error occurs. | 
18Chrome returnsnull if an error occurs. | 
4Firefox throws an exception if an error occurs. | 
≤12.1["Opera Android 12.1 and earlier throws an exception if an error occurs.", "Opera Android 14 and later returnsnull if an error occurs."] | 
2Safari returnsnull if an error occurs. | 
1.0Samsung Internet returnsnull if an error occurs. | 
    © 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
    https://developer.mozilla.org/en-US/docs/Web/API/XSLTProcessor/transformToDocument