XSLTProcessor

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.

Constructor

XSLTProcessor()

Create a new XSLTProcessor.

Instance methods

XSLTProcessor.importStylesheet()

Imports the XSLT stylesheet. If the given node is a document node, you can pass in a full XSL Transform or a literal result element transform; otherwise, it must be an <xsl:stylesheet> or <xsl:transform> element.

XSLTProcessor.transformToFragment()

Transforms the node source by applying the stylesheet imported using the XSLTProcessor.importStylesheet() function. The owner document of the resulting document fragment is the owner node.

XSLTProcessor.transformToDocument()

Transforms the node source applying the stylesheet given importing using the XSLTProcessor.importStylesheet() function.

The resultant object depends on the output method of the stylesheet:

Output method Result type
html HTMLDocument
xml XMLDocument
text XMLDocument with a single root element <transformiix:result> with the text as a child
XSLTProcessor.setParameter()

Sets a parameter in the XSLT stylesheet that was imported. (Sets the value of an <xsl:param>.) A null value for namespaceURI is treated the same as an empty string.

XSLTProcessor.getParameter()

Gets the value of a parameter from the XSLT stylesheet. A null value for namespaceURI is treated the same as an empty string.

XSLTProcessor.removeParameter()

Removes the parameter if it was previously set. This will make the XSLTProcessor use the default value for the parameter as specified in the stylesheet. A null value for namespaceURI is treated the same as an empty string.

XSLTProcessor.clearParameters()

Removes all set parameters from the XSLTProcessor. The XSLTProcessor will then use the defaults specified in the XSLT stylesheet.

XSLTProcessor.reset()

Removes all parameters and stylesheets from the XSLTProcessor.

Instance properties

This are no properties for this interface.

Examples

Specifications

Specification
DOM Standard
# interface-xsltprocessor

Browser compatibility

BCD tables only load in the browser

See also