4XSLT Processor

# 4XSLT API

4XSLT
XSLT
API
Application Programmiung Interface for 4XSLT

# The Processor

4XSLT can be used from the command line as described in the README, but if you want to embed or extend 4XSLT, you will typically use the Processor class directly.

Please see the 4XSLT command line documentation for command line help

xml.xslt
Processor
__init__
Create a new Processor instance
reader
Instance supporting the interface of xml.dom.ext.reader.Reader The reader class that will be used by the processor to generate source document DOM from serialized XML.
registerExtensionModules
Adds a module containing extension functions/elements to the list of available extensions
moduleList
List of python module names The module names to be searched for extension elements and functions
setStylesheetReader
Set the instance of the StylesheetReader class used when a stylesheet is loaded.
styInst
A python instance that supports the interface of Ft.Xslt.StylesheetReader.StylesheetReader. The instance used to read in stylesheets.
setDocumentReader
Set the instance of the Reader class used when a XML document is loaded.
docInst
Instance supporting the interface of xml.dom.ext.reader.Reader The instance used to read in documents.
appendStylesheetStream
Adds a new stylesheet from a file-like object to the processor
stream
file-like object Read an XSLT stylesheet from the stream and append it to the list of stylesheets used by the processor.
xml.xslt.XsltException
xml.sax.SAXParseException
xml.sax.SAXException
appendStylesheetUri
Adds a new stylesheet from an URI to the processor
styleSheetUri
string Retrieve text from the URL as an XSLT stylesheet and append it to the list of stylesheets used by the processor.
xml.xslt.XsltException
xml.sax.SAXParseException
xml.sax.SAXException
appendStylesheetNode
Adds a new stylesheet to the proceesor from an existing DOM tree
styleSheetNode
xml.dom.Node Process the DOM node as a stylesheet and append to the list of stylesheets used by the processor.
""
baseUri
string The baseUri used to resolve relative URI's in the stylesheet.
xml.xslt.XsltException
xml.sax.SAXParseException
xml.sax.SAXException
appendStylesheetString
Adds a new stylesheet from a string to the processor
styleSheetString
string Parse the string as an XSLT stylesheet and append it to the list of stylesheets used by the processor.
""
baseUri
string The baseUri used to resolve relative URI's in the stylesheet.
xml.xslt.XsltException
xml.sax.SAXParseException
xml.sax.SAXException
runStream
Parses the document read from a file-like object and processes with current stylesheets
stream
string Text to run through the registered stylesheets.
ignorePis
0
integer If 0, append any stylesheet processing instructions (PIs) embedded int he XML to the processor's stylesheets, otherwise ignore such PIs.
topLevelParams
None
dictionary Maps tuples in the form (namespace-uri, local-name) representing top-level parameters defined in one of the registered stylesheet to an overriding value.
writer
None
Class that follows the protocol of xml.xslt.TextWriter.TextWriter, which is the default if None is given. The output handler to be used
baseUri
""
string The base URI of the given XML source (default is '')
outputStream
None
Python FileObject interface The stream to send output too. If None, the appropriate writer sets a default.
python object The return value is determined by the writer object used for output
xml.xslt.XsltException
xml.sax.SAXParseException
xml.sax.SAXException
runUri
Processes the document specified by the URI with the current stylesheets
uri
string Retrieve text from the URI, and run it through the registered stylesheets.
0
ignorePis
integer If 0, append any stylesheet processing instructions (PIs) embedded int he XML to the processor's stylesheets, otherwise ignore such PIs.
None
topLevelParams
dictionary Maps tuples in the form (namespace-uri, local-name) representing top-level parameters defined in one of the registered stylesheet to an overriding value.
writer
None
Class that follows the protocol of xml.xslt.TextWriter.TextWriter, which is the default The output handler to be used
outputStream
None
Python FileObject interface The stream to send output too. If None, sys.stdout is used.
python object The return value is determined by the writer object used for output
xml.xslt.XsltException
xml.sax.SAXParseException
xml.sax.SAXException
runString
Parses the document given in the string and processes with current stylesheets
xmlString
string Text to run through the registered stylesheets.
ignorePis
0
integer If 0, append any stylesheet processing instructions (PIs) embedded int he XML to the processor's stylesheets, otherwise ignore such PIs.
topLevelParams
None
dictionary Maps tuples in the form (namespace-uri, local-name) representing top-level parameters defined in one of the registered stylesheet to an overriding value.
writer
None
Class that follows the protocol of xml.xslt.TextWriter.TextWriter, which is the default if None is given. The output handler to be used
baseUri
""
string The base URI of the given XML source (default is '')
outputStream
None
Python FileObject interface The stream to send output too. If None, the appropriate writer sets a default.
python object The return value is determined by the writer object used for output
xml.xslt.XsltException
xml.sax.SAXParseException
xml.sax.SAXException
runNode
Processes the DOM tree with the current stylesheets
node
xml.dom.Node XML source DOM node to be run through the registered stylesheets.
ignorePis
0
integer If 0, append any stylesheet processing instructions (PIs) embedded int he XML to the processor's stylesheets, otherwise ignore such PIs. (default is 0)
topLevelParams
None
dictionary Maps tuples in the form (namespace-uri, local-name) representing top-level parameters defined in one of the registered stylesheet to an overriding value. (Defaults to the empty dictionary)
writer
None
Class that follows the protocol of xml.xslt.TextWriter.TextWriter, which is the default The output handler to be used
baseUri
''
string The base URI of the given XML source (default is '')
outputStream
None
Python FileObject interface The stream to send output too. If None, the appropriate writer sets a default.
python object The return value is determined by the writer object used for output
xml.xslt.XsltException
xml.sax.SAXParseException
xml.sax.SAXException
XsltContext
xml.xpath.Context
Represents the context used for XPattern processing at any given point
currentNode
Python DOM binding node object The current node in the XPattern expression. This node is returned as the result of the "current()" function. This is the node that was the context node at the beginning of the XPattern evaluation.
stylesheet
xml.xslt.Stylesheet.StylesheetElement The stylesheet that the current template matched.
mode
string The mode that the current template matched with.
documents
Python dictionary with keys of uri, and values of DOM documents. Maps URIs to documents (for the document function)
rtfs
Python list of DOM nodes A list of all of the result tree fragements made. These are stored so ReleaseNode can be called on them when processing is done.
__init__
node
Python DOM binding node object The context node, as used for computing XPath expressions
position
positive integer The context node's position in the context node list, as returned by the XPath position() function
size
positive integer The size of the context node list
currentNode
None
Python DOM binding node object The current node in the XPattern expression. This node is returned as the result of the "current()" function. This is the node that was the context node at the beginning of the XPattern evaluation.
varBindings
None
dictionary with keys a tuple of two strings and value a string, integer, BooleanType or node set (list of nodes) Maps variable and parameters by expanded name to the value of the variable. Defaults to an empty dictionary.
processorNss
None
dictionary with string key and value provides expansion from namespace prefixes to uris for expanded names in name tests, variable names, etc. Defaults to an empty dictionary.
stylesheet
None
xml.xslt.Stylesheet.StylesheetElement The stylesheet that the current template matched.
mode
None
string The mode that the current template matched with.
reclaim
Release all objects with circular references on the context, documents and RTFs. Not necessary in Python 2.x.