Saxonica: XSLT and XQuery Processing: XSLT20Processor

XSLT20Processor

The XSLT20Processor object provides the various functions used to perform an XSLT 2.0 transform. This section describes all the available functions, but the following (along with the object constructor) are probably going to be used most often:

1. Configure:

setParameter

setInitialTemplate

setMode

2. Transform:

updateHTMLDocument

transformToDocument

transformToFragment

When using the API on page-load, you should ensure Saxon-CE is loaded first by including your code within the global onSaxonLoad function. This function is called as soon as the HTML page has loaded and Saxon-CE has been initialized.

XSLT20Processor instances are created using the newXSLT20Processor factory method of the static Saxon object (which also provides a set of XML utility functions along with functions for controlling error logging).

Functions

Function

Description

clearParameters()

Removes all parameters set for the XSLT20Processor instance.

getInitialMode()

Gets the initial mode set for the XSLT transform.

getInitialTemplate()

Gets the name set for the XSLT transform initial template

getParameter(namespace, name)

Gets the value of the named XSLT transform parameter.

getResultDocument(uri)

Returns a result document created by the xsl:result-document instruction

getResultDocuments()

Returns any array of result document URIs that were output by the previous XSLT transform.

getSuccess()

Returns the callback function set by setSuccess

importStylesheet(uri)

Sets the stylesheet to be used for an XSLT transform

removeParameter(name)

Removes the named parameter.

reset()

Resets the XSLT20Processor object to its original state.

setBaseOutputURI(uri)

Set the base URI for resolving output URIs from an XSLT transform

setInitialMode(name)

Sets the name for the initial mode to be called for the XSLT transform

setInitialTemplate(name)

Sets the name for the initial template to be called for the XSLT transform

setParameter(namespace, name, value)

Sets named parameters for the XSLT transform

setSuccess(callback)

Following a transform, a callback is made to this function

transformToDocument(source)

Returns the result of an XSLT transform as a Document object.

transformToFragment(source, ownerDocument)

Returns the result of an XSLT transform as a DocumentFragment object.

transformToHTMLFragment(source, ownerDocument)

Returns the result of an XSLT transform as one or more HTML DocumentFragment objects.

updateHTMLDocument(source, target)

Initiates an XSLT transform on an existing HTML document.

Next