JavaScript API
The JavaScript API for Saxon-CE is loaded using a standard HTML
script
element:
When using this API, it's important to ensure the Saxon-CE library is loaded
first. The global onSaxonLoad
callback function is provided to
facilitate this during an HTML page load. Saxon-CE will make a call to this once it
has loaded.
The API is centred around two principal objects:
XSLT20Processor
XSLT20Processor is modeled on the JavaScript XSLTProcessor API as implemented by Opera, Mozilla, Safari and Chrome browsers (Sarissa provides a wrapper compatible with Internet Explorer). It provides a set of methods used to initiate XSLT transforms on XML or direct XSLT-based HTML updates. This standard API has been extended to: (a) access functionality new to XSLT 2.0, (b) provide extra features specific to HTML processing, and (c) support asynchronous processing.
Saxon
The Saxon object provides a factory
method for instantiating XSLT20Processor
and a run
function for invoking transforms more declaratively by using a JavaScript literal
object to describe the transform. It also includes a small set of utility functions
for managing XML resources and controlling the logging of messages from
XSLT20Processor
object instances.
Links to all JavaScript API Sections: