org.activemath.xsl
Class SaxonProcessor

java.lang.Object
  extended by org.activemath.xsl.Processor
      extended by org.activemath.xsl.JaxpProcessor
          extended by org.activemath.xsl.SaxonProcessor
All Implemented Interfaces:
Stylesheets

public class SaxonProcessor
extends JaxpProcessor

Class SaxonProcessor

A class for centrally processing the stylesheet transformations. This class uses the saxon stylesheets processor, including the URI resolving facilities.

These allow imports of stylesheets to be all relative to a single base URI.

Version:
1.0

Field Summary
 
Fields inherited from class org.activemath.xsl.JaxpProcessor
importedStylesheets, log, preparedTemplates, timestamps
 
Fields inherited from class org.activemath.xsl.Processor
baseURI, hasGeneratedSymbolImports, thisLogCat
 
Constructor Summary
SaxonProcessor()
          Constructor set baseURI to the Manager's one
SaxonProcessor(String base)
          Constructor
 
Method Summary
protected  TransformerFactory getTransformerFactory()
          get a instance of TransformerFactory
static void main(String[] args)
          method for testing parameters: first: URI of the stylesheet to use second:URI of the document to transform [third]:base URI for the Stylesheet (optional) If the third parameter is not set use the Manager's URI
 void transform(org.jdom.Document document, OutputStream outStream, String stylesheet, Hashtable params)
          transform a JDOM document by the given Stylesheet
 void transform(org.jdom.Document document, Result result, String stylesheet, Hashtable params)
          transform a JDOM document by the given Stylesheet
 void transform(org.jdom.Document document, Writer writer, String stylesheet, Hashtable params)
          transform a JDOM document by the given Stylesheet
 org.jdom.Document transform2Jdom(org.jdom.Document document, String stylesheet, Hashtable params)
          transform a jdom document by the given Stylesheet Be aware that the resulting document has to be XML code to output a JDOOM document
 
Methods inherited from class org.activemath.xsl.JaxpProcessor
calcImports0, loadTemplate, loadTemplateAsync, transform, transform
 
Methods inherited from class org.activemath.xsl.Processor
getBaseURI, setBaseURI, setBaseURI
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SaxonProcessor

public SaxonProcessor()
               throws MalformedURLException
Constructor

set baseURI to the Manager's one

Throws:
MalformedURLException - if the Manager's baseURI is not a valid URL

SaxonProcessor

public SaxonProcessor(String base)
               throws MalformedURLException
Constructor

Parameters:
base - the base URI of the stylesheets to use
Throws:
MalformedURLException - if the baseURI is not a valid URL
Method Detail

getTransformerFactory

protected TransformerFactory getTransformerFactory()
get a instance of TransformerFactory

Overrides:
getTransformerFactory in class JaxpProcessor
Returns:
an instance of TransformerFactory

transform2Jdom

public org.jdom.Document transform2Jdom(org.jdom.Document document,
                                        String stylesheet,
                                        Hashtable params)
                                 throws TransformerException
transform a jdom document by the given Stylesheet

Be aware that the resulting document has to be XML code to output a JDOOM document

Overrides:
transform2Jdom in class JaxpProcessor
Parameters:
document - the jdom document to transform
stylesheet - the URI of the stylesheet used for transformation
params - the parameters used during transformation (as Hashtable) - may be null
Returns:
transformed jdom document
Throws:
TransformerException - if the transformation fails

transform

public void transform(org.jdom.Document document,
                      Result result,
                      String stylesheet,
                      Hashtable params)
               throws TransformerException
transform a JDOM document by the given Stylesheet

Specified by:
transform in interface Stylesheets
Overrides:
transform in class JaxpProcessor
Parameters:
document - the JDOM document to transform
result - the Result of the transformation (that means: the transformed document)
stylesheet - the URI of the stylesheet used for transformation
params - the parameters used during transformation (as Hashtable) - may be null
Throws:
TransformerException - if the transformation fails

transform

public void transform(org.jdom.Document document,
                      OutputStream outStream,
                      String stylesheet,
                      Hashtable params)
               throws TransformerException
transform a JDOM document by the given Stylesheet

Specified by:
transform in interface Stylesheets
Overrides:
transform in class JaxpProcessor
Parameters:
document - the JDOM document to transform
outStream - the resultingOutputStream of the transformation
stylesheet - the URI of the stylesheet used for transformation
params - the parameters used during transformation (as Hashtable) - may be null
Throws:
TransformerException - if the transformation fails

transform

public void transform(org.jdom.Document document,
                      Writer writer,
                      String stylesheet,
                      Hashtable params)
               throws TransformerException
transform a JDOM document by the given Stylesheet

Specified by:
transform in interface Stylesheets
Overrides:
transform in class JaxpProcessor
Parameters:
document - the JDOM document to transform
outStream - the resultingWriter of the transformation
stylesheet - the URI of the stylesheet used for transformation
params - the parameters used during transformation (as Hashtable) - may be null
Throws:
TransformerException - if the transformation fails

main

public static void main(String[] args)
                 throws Exception
method for testing

parameters:

If the third parameter is not set use the Manager's URI

Throws:
Exception