Command
The Command object is used exclusively by the Saxon object's run function. It's designed to be used as a JavaScript literal object and effectively wraps the Saxon-CE API with a set of properties so you can run an XSLT transform on an HTML page in a more declarative way.
If you need to include a namespace in an XSLT parameter name, use the Clark
notation: {uri}local
- for example
{http://saxonica.com/units}mass-kg
In the properties listed below, only stylesheet
(shown in
italics) is mandatory, but either initialTemplate
or
source
must also be set, to ensure that the stylesheet has an entry
point.
Properties
Property |
Type |
Description |
errorHandler |
Function |
The callback function for handling processing errors. |
initialMode |
String |
The initial mode for the transform |
initialTemplate |
String |
The initial template for the transform |
logLevel |
String |
Sets the error and event logging threshold. |
method |
String |
The transform method to use [Default: updateHTMLDocument] |
parameters |
Map:Name→Value |
XSLT parameters are set from the matching values of properties of the parameters object. |
source |
String|Document |
The XML document source for the transform |
stylesheet |
String|Document |
Sets the stylesheet for the transform |
success |
Function |
The success callback function - called after a transform. |
Notes
An example of how the literal Command
object can be used with
the Saxon run
method is shown below. This sample also shows how to use
the onSaxonLoad
function to ensure the Saxon-CE library loads fully
before any JavaScript API calls are made on the library.