<?xml version="1.0"?>
<?xml-stylesheet href="http://xslt.fourthought.com/api.xslt" type="text/xsl"?>
<tech:ApiSpec title="4XSLT Processor"
  xmlns:tech="http://namespaces.fourthought.com/technical"
  xmlns:dc= "http://purl.org/dc/elements/1.1"
  xmlns="http://docbook.org/docbook/xml/4.0/namespace"
>

<dc:Title>4XSLT API</dc:Title>
<dc:Subject>4XSLT</dc:Subject>
<dc:Subject>XSLT</dc:Subject>
<dc:Subject>API</dc:Subject>
<dc:Description>Application Programmiung Interface for 4XSLT</dc:Description>


<sect1><title>The Processor</title>

<para>
    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.
</para>

<para>
  Please see the <ulink url="4xslt-command-line.html">4XSLT command line documentation</ulink>
  for command line help
</para>

<tech:Module>
  <tech:Name>xml.xslt</tech:Name>

  <tech:Class>
  <tech:Name>Processor</tech:Name>

  <tech:Method>
  <tech:Name>__init__</tech:Name>
  <tech:Desc>Create a new Processor instance</tech:Desc>
  <tech:Arg><tech:Name>reader</tech:Name><tech:Type>Instance supporting the interface of xml.dom.ext.reader.Reader</tech:Type><tech:Desc>The reader class that will be used by the processor to generate source document DOM from serialized XML.</tech:Desc></tech:Arg>
  </tech:Method>

  <tech:Method>
  <tech:Name>registerExtensionModules</tech:Name>
  <tech:Desc>Adds a module containing extension functions/elements to the list of available extensions</tech:Desc>
  <tech:Arg><tech:Name>moduleList</tech:Name><tech:Type>List of python module names</tech:Type><tech:Desc>The module names to be searched for extension elements and functions</tech:Desc></tech:Arg>
  </tech:Method>

  <tech:Method>
  <tech:Name>setStylesheetReader</tech:Name>
  <tech:Desc>Set the instance of the StylesheetReader class used when a stylesheet is loaded.</tech:Desc>
  <tech:Arg><tech:Name>styInst</tech:Name><tech:Type>A python instance that supports the interface of Ft.Xslt.StylesheetReader.StylesheetReader.</tech:Type><tech:Desc>The instance used to read in stylesheets.</tech:Desc></tech:Arg>
  </tech:Method>

  <tech:Method>
  <tech:Name>setDocumentReader</tech:Name>
  <tech:Desc>Set the instance of the Reader class used when a XML document is loaded.</tech:Desc>
  <tech:Arg><tech:Name>docInst</tech:Name><tech:Type>Instance supporting the interface of xml.dom.ext.reader.Reader</tech:Type><tech:Desc>The instance used to read in documents.</tech:Desc></tech:Arg>
  </tech:Method>

  <tech:Method>
  <tech:Name>appendStylesheetStream</tech:Name>
  <tech:Desc>Adds a new stylesheet from a file-like object to the processor</tech:Desc>
  <tech:Arg><tech:Name>stream</tech:Name><tech:Type>file-like object</tech:Type><tech:Desc>Read an XSLT stylesheet from the stream and append it to the list of stylesheets used by the processor.</tech:Desc></tech:Arg>
  <tech:Exception><tech:Type>xml.xslt.XsltException</tech:Type><tech:Desc></tech:Desc></tech:Exception>
  <tech:Exception><tech:Type>xml.sax.SAXParseException</tech:Type><tech:Desc></tech:Desc></tech:Exception>
  <tech:Exception><tech:Type>xml.sax.SAXException</tech:Type><tech:Desc></tech:Desc></tech:Exception>
  </tech:Method>

  <tech:Method>
  <tech:Name>appendStylesheetUri</tech:Name>
  <tech:Desc>Adds a new stylesheet from an URI to the processor</tech:Desc>
  <tech:Arg><tech:Name>styleSheetUri</tech:Name><tech:Type>string</tech:Type><tech:Desc>Retrieve text from the URL as an XSLT stylesheet and append it to the list of stylesheets used by the processor.</tech:Desc></tech:Arg>
  <tech:Exception><tech:Type>xml.xslt.XsltException</tech:Type><tech:Desc></tech:Desc></tech:Exception>
  <tech:Exception><tech:Type>xml.sax.SAXParseException</tech:Type><tech:Desc></tech:Desc></tech:Exception>
  <tech:Exception><tech:Type>xml.sax.SAXException</tech:Type><tech:Desc></tech:Desc></tech:Exception>
  </tech:Method>

  <tech:Method>
  <tech:Name>appendStylesheetNode</tech:Name>
  <tech:Desc>Adds a new stylesheet to the proceesor from an existing DOM tree</tech:Desc>
  <tech:Arg><tech:Name>styleSheetNode</tech:Name><tech:Type>xml.dom.Node</tech:Type><tech:Desc>Process the DOM node as a stylesheet and append to the list of stylesheets used by the processor.</tech:Desc></tech:Arg>
  <tech:Arg><tech:Default>""</tech:Default><tech:Name>baseUri</tech:Name><tech:Type>string</tech:Type><tech:Desc>The baseUri used to resolve relative URI's in the stylesheet.</tech:Desc></tech:Arg>
  <tech:Exception><tech:Type>xml.xslt.XsltException</tech:Type><tech:Desc></tech:Desc></tech:Exception>
  <tech:Exception><tech:Type>xml.sax.SAXParseException</tech:Type><tech:Desc></tech:Desc></tech:Exception>
  <tech:Exception><tech:Type>xml.sax.SAXException</tech:Type><tech:Desc></tech:Desc></tech:Exception>
  </tech:Method>

  <tech:Method>
  <tech:Name>appendStylesheetString</tech:Name>
  <tech:Desc>Adds a new stylesheet from a string to the processor</tech:Desc>
  <tech:Arg><tech:Name>styleSheetString</tech:Name><tech:Type>string</tech:Type><tech:Desc>Parse the string as an XSLT stylesheet and append it to the list of stylesheets used by the processor.</tech:Desc></tech:Arg>
  <tech:Arg><tech:Default>""</tech:Default><tech:Name>baseUri</tech:Name><tech:Type>string</tech:Type><tech:Desc>The baseUri used to resolve relative URI's in the stylesheet.</tech:Desc></tech:Arg>
  <tech:Exception><tech:Type>xml.xslt.XsltException</tech:Type><tech:Desc></tech:Desc></tech:Exception>
  <tech:Exception><tech:Type>xml.sax.SAXParseException</tech:Type><tech:Desc></tech:Desc></tech:Exception>
  <tech:Exception><tech:Type>xml.sax.SAXException</tech:Type><tech:Desc></tech:Desc></tech:Exception>
  </tech:Method>

  <tech:Method>
  <tech:Name>runStream</tech:Name>
  <tech:Desc>Parses the document read from a file-like object and processes with current stylesheets</tech:Desc>
  <tech:Arg><tech:Name>stream</tech:Name><tech:Type>string</tech:Type><tech:Desc>Text to run through the registered stylesheets.</tech:Desc></tech:Arg>
  <tech:Arg><tech:Name>ignorePis</tech:Name><tech:Default>0</tech:Default><tech:Type>integer</tech:Type><tech:Desc>If 0, append any stylesheet processing instructions (PIs) embedded int he XML to the processor's stylesheets, otherwise ignore such PIs.</tech:Desc></tech:Arg>
  <tech:Arg><tech:Name>topLevelParams</tech:Name><tech:Default>None</tech:Default><tech:Type>dictionary</tech:Type><tech:Desc>Maps tuples in the form (namespace-uri, local-name) representing top-level parameters defined in one of the registered stylesheet to an overriding value.</tech:Desc></tech:Arg>
  <tech:Arg><tech:Name>writer</tech:Name><tech:Default>None</tech:Default><tech:Type>Class that follows the protocol of xml.xslt.TextWriter.TextWriter, which is the default if None is given.</tech:Type><tech:Desc>The output handler to be used</tech:Desc></tech:Arg>
  <tech:Arg><tech:Name>baseUri</tech:Name><tech:Default>""</tech:Default><tech:Type>string</tech:Type><tech:Desc>The base URI of the given XML source (default is '')</tech:Desc></tech:Arg>
  <tech:Arg><tech:Name>outputStream</tech:Name><tech:Default>None</tech:Default><tech:Type>Python FileObject interface</tech:Type><tech:Desc>The stream to send output too.  If None, the appropriate writer sets a default.</tech:Desc></tech:Arg>
  <tech:Return><tech:Type>python object</tech:Type><tech:Desc>The return value is determined by the writer object used for output</tech:Desc></tech:Return>
  <tech:Exception><tech:Type>xml.xslt.XsltException</tech:Type><tech:Desc></tech:Desc></tech:Exception>
  <tech:Exception><tech:Type>xml.sax.SAXParseException</tech:Type><tech:Desc></tech:Desc></tech:Exception>
  <tech:Exception><tech:Type>xml.sax.SAXException</tech:Type><tech:Desc></tech:Desc></tech:Exception>
  </tech:Method>

  <tech:Method>
  <tech:Name>runUri</tech:Name>
  <tech:Desc>Processes the document specified by the URI with the current stylesheets</tech:Desc>
  <tech:Arg><tech:Name>uri</tech:Name><tech:Type>string</tech:Type><tech:Desc>Retrieve text from the URI, and run it through the registered stylesheets.</tech:Desc></tech:Arg>
  <tech:Arg><tech:Default>0</tech:Default><tech:Name>ignorePis</tech:Name><tech:Type>integer</tech:Type><tech:Desc>If 0, append any stylesheet processing instructions (PIs) embedded int he XML to the processor's stylesheets, otherwise ignore such PIs.</tech:Desc></tech:Arg>
  <tech:Arg><tech:Default>None</tech:Default><tech:Name>topLevelParams</tech:Name><tech:Type>dictionary</tech:Type><tech:Desc>Maps tuples in the form (namespace-uri, local-name) representing top-level parameters defined in one of the registered stylesheet to an overriding value.</tech:Desc></tech:Arg>
  <tech:Arg><tech:Name>writer</tech:Name><tech:Default>None</tech:Default><tech:Type>Class that follows the protocol of xml.xslt.TextWriter.TextWriter, which is the default</tech:Type><tech:Desc>The output handler to be used</tech:Desc></tech:Arg>
  <tech:Arg><tech:Name>outputStream</tech:Name><tech:Default>None</tech:Default><tech:Type>Python FileObject interface</tech:Type><tech:Desc>The stream to send output too.  If None, sys.stdout is used.</tech:Desc></tech:Arg>
  <tech:Return><tech:Type>python object</tech:Type><tech:Desc>The return value is determined by the writer object used for output</tech:Desc></tech:Return>
  <tech:Exception><tech:Type>xml.xslt.XsltException</tech:Type><tech:Desc></tech:Desc></tech:Exception>
  <tech:Exception><tech:Type>xml.sax.SAXParseException</tech:Type><tech:Desc></tech:Desc></tech:Exception>
  <tech:Exception><tech:Type>xml.sax.SAXException</tech:Type><tech:Desc></tech:Desc></tech:Exception>
  </tech:Method>

  <tech:Method>
  <tech:Name>runString</tech:Name>
  <tech:Desc>Parses the document given in the string and processes with current stylesheets</tech:Desc>
  <tech:Arg><tech:Name>xmlString</tech:Name><tech:Type>string</tech:Type><tech:Desc>Text to run through the registered stylesheets.</tech:Desc></tech:Arg>
  <tech:Arg><tech:Name>ignorePis</tech:Name><tech:Default>0</tech:Default><tech:Type>integer</tech:Type><tech:Desc>If 0, append any stylesheet processing instructions (PIs) embedded int he XML to the processor's stylesheets, otherwise ignore such PIs.</tech:Desc></tech:Arg>
  <tech:Arg><tech:Name>topLevelParams</tech:Name><tech:Default>None</tech:Default><tech:Type>dictionary</tech:Type><tech:Desc>Maps tuples in the form (namespace-uri, local-name) representing top-level parameters defined in one of the registered stylesheet to an overriding value.</tech:Desc></tech:Arg>
  <tech:Arg><tech:Name>writer</tech:Name><tech:Default>None</tech:Default><tech:Type>Class that follows the protocol of xml.xslt.TextWriter.TextWriter, which is the default if None is given.</tech:Type><tech:Desc>The output handler to be used</tech:Desc></tech:Arg>
  <tech:Arg><tech:Name>baseUri</tech:Name><tech:Default>""</tech:Default><tech:Type>string</tech:Type><tech:Desc>The base URI of the given XML source (default is '')</tech:Desc></tech:Arg>
  <tech:Arg><tech:Name>outputStream</tech:Name><tech:Default>None</tech:Default><tech:Type>Python FileObject interface</tech:Type><tech:Desc>The stream to send output too.  If None, the appropriate writer sets a default.</tech:Desc></tech:Arg>
  <tech:Return><tech:Type>python object</tech:Type><tech:Desc>The return value is determined by the writer object used for output</tech:Desc></tech:Return>
  <tech:Exception><tech:Type>xml.xslt.XsltException</tech:Type><tech:Desc></tech:Desc></tech:Exception>
  <tech:Exception><tech:Type>xml.sax.SAXParseException</tech:Type><tech:Desc></tech:Desc></tech:Exception>
  <tech:Exception><tech:Type>xml.sax.SAXException</tech:Type><tech:Desc></tech:Desc></tech:Exception>
  </tech:Method>

  <tech:Method>
  <tech:Name>runNode</tech:Name>
  <tech:Desc>Processes the DOM tree with the current stylesheets</tech:Desc>
  <tech:Arg><tech:Name>node</tech:Name><tech:Type>xml.dom.Node</tech:Type><tech:Desc>XML source DOM node to be run through the registered stylesheets.</tech:Desc></tech:Arg>
  <tech:Arg><tech:Name>ignorePis</tech:Name><tech:Default>0</tech:Default><tech:Type>integer</tech:Type><tech:Desc>If 0, append any stylesheet processing instructions (PIs) embedded int he XML to the processor's stylesheets, otherwise ignore such PIs.  (default is 0)</tech:Desc></tech:Arg>
  <tech:Arg><tech:Name>topLevelParams</tech:Name><tech:Default>None</tech:Default><tech:Type>dictionary</tech:Type><tech:Desc>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)</tech:Desc></tech:Arg>
  <tech:Arg><tech:Name>writer</tech:Name><tech:Default>None</tech:Default><tech:Type>Class that follows the protocol of xml.xslt.TextWriter.TextWriter, which is the default</tech:Type><tech:Desc>The output handler to be used</tech:Desc></tech:Arg>
  <tech:Arg><tech:Name>baseUri</tech:Name><tech:Default>''</tech:Default><tech:Type>string</tech:Type><tech:Desc>The base URI of the given XML source (default is '')</tech:Desc></tech:Arg>
  <tech:Arg><tech:Name>outputStream</tech:Name><tech:Default>None</tech:Default><tech:Type>Python FileObject interface</tech:Type><tech:Desc>The stream to send output too.  If None, the appropriate writer sets a default.</tech:Desc></tech:Arg>
  <tech:Return><tech:Type>python object</tech:Type><tech:Desc>The return value is determined by the writer object used for output</tech:Desc></tech:Return>
  <tech:Exception><tech:Type>xml.xslt.XsltException</tech:Type><tech:Desc></tech:Desc></tech:Exception>
  <tech:Exception><tech:Type>xml.sax.SAXParseException</tech:Type><tech:Desc></tech:Desc></tech:Exception>
  <tech:Exception><tech:Type>xml.sax.SAXException</tech:Type><tech:Desc></tech:Desc></tech:Exception>
  </tech:Method>

<!--
  <tech:Method>
  <tech:Name></tech:Name>
  <tech:Desc></tech:Desc>
  <tech:Arg><tech:Name></tech:Name><tech:Type></tech:Type><tech:Desc></tech:Desc></tech:Arg>
  </tech:Method>
-->

  </tech:Class>


  <tech:Class>
    <tech:Name>XsltContext</tech:Name>
    <tech:BaseClass>xml.xpath.Context</tech:BaseClass>
    <tech:Desc>Represents the context used for XPattern processing at any given point</tech:Desc>
    <tech:Attribute><tech:Name>currentNode</tech:Name><tech:Type>Python DOM binding node object</tech:Type><tech:Desc>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.</tech:Desc></tech:Attribute>
    <tech:Attribute><tech:Name>stylesheet</tech:Name><tech:Type>xml.xslt.Stylesheet.StylesheetElement</tech:Type><tech:Desc>The stylesheet that the current template matched.</tech:Desc></tech:Attribute>
    <tech:Attribute><tech:Name>mode</tech:Name><tech:Type>string</tech:Type><tech:Desc>The mode that the current template matched with.</tech:Desc></tech:Attribute>
    <tech:Attribute><tech:Name>documents</tech:Name><tech:Type>Python dictionary with keys of uri, and values of DOM documents.</tech:Type><tech:Desc>Maps URIs to documents (for the document function)</tech:Desc></tech:Attribute>
    <tech:Attribute><tech:Name>rtfs</tech:Name><tech:Type>Python list of DOM nodes</tech:Type><tech:Desc>A list of all of the result tree fragements made.  These are stored so ReleaseNode can be called on them when processing is done.</tech:Desc></tech:Attribute>

    <tech:Method init="yes">
    <tech:Name>__init__</tech:Name>
    <tech:Arg><tech:Name>node</tech:Name><tech:Type>Python DOM binding node object</tech:Type><tech:Desc>The context node, as used for computing XPath expressions</tech:Desc></tech:Arg>
    <tech:Arg><tech:Name>position</tech:Name><tech:Type>positive integer</tech:Type><tech:Desc>The context node's position in the context node list, as returned by the XPath position() function</tech:Desc></tech:Arg>
    <tech:Arg><tech:Name>size</tech:Name><tech:Type>positive integer</tech:Type><tech:Desc>The size of the context node list</tech:Desc></tech:Arg>
    <tech:Arg><tech:Name>currentNode</tech:Name><tech:Default>None</tech:Default><tech:Type>Python DOM binding node object</tech:Type><tech:Desc>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.</tech:Desc></tech:Arg>
    <tech:Arg><tech:Name>varBindings</tech:Name><tech:Default>None</tech:Default><tech:Type>dictionary with keys a tuple of two strings and value a string, integer, BooleanType or node set (list of nodes)</tech:Type><tech:Desc>Maps variable and parameters by expanded name to the value of the variable.  Defaults to an empty dictionary.</tech:Desc></tech:Arg>
    <tech:Arg><tech:Name>processorNss</tech:Name><tech:Default>None</tech:Default><tech:Type>dictionary with string key and value</tech:Type><tech:Desc>provides expansion from namespace prefixes to uris for expanded names in name tests, variable names, etc.  Defaults to an empty dictionary.</tech:Desc></tech:Arg>
    <tech:Arg><tech:Name>stylesheet</tech:Name><tech:Default>None</tech:Default><tech:Type>xml.xslt.Stylesheet.StylesheetElement</tech:Type><tech:Desc>The stylesheet that the current template matched.</tech:Desc></tech:Arg>
    <tech:Arg><tech:Name>mode</tech:Name><tech:Default>None</tech:Default><tech:Type>string</tech:Type><tech:Desc>The mode that the current template matched with.</tech:Desc></tech:Arg>
      <tech:exception></tech:exception>
    </tech:Method>

    <tech:Method >
    <tech:Name>reclaim</tech:Name>
    <tech:Desc>Release all objects with circular references on the context, documents and RTFs.  Not necessary in Python 2.x.</tech:Desc>
    </tech:Method>
  </tech:Class>

</tech:Module>


</sect1>

</tech:ApiSpec>

