org.ibisph.xslt
Class Transformation

java.lang.Object
  extended by org.ibisph.xslt.Transformation

public class Transformation
extends java.lang.Object

Spring type bean that provides XML/XSLT transformations. This class would normally be a static abstract but in the Spring world it is left as a normal class which spring will instantiate only once.

Author:
Garth Braithwaite, STG

Field Summary
protected  TransformerFactory transformerFactory
           
 
Constructor Summary
Transformation()
          Default constructor which uses the base, non caching standard IBIS IBIS TransformerFactory which defaults to JAXP.
Transformation(TransformerFactory transformerFactory)
          Constructor which allows other JAPX TransformerFactorys to be used.
 
Method Summary
 void setTransformerFactory(TransformerFactory transformerFactory)
          Sets specified XSLT Transformation Engine.
 void transform(java.lang.String xsltSystemID, org.dom4j.Document document, java.util.Map parameters, java.io.OutputStream outputStream)
          Overloaded method that performs an XSLT/XML document transformation.
 void transform(java.lang.String xsltSystemID, java.lang.Object xml, java.util.Map parameters, java.io.OutputStream outputStream)
          Overloaded method that calls the appropriate XSLT/XML transformation method.
 void transform(java.lang.String xsltSystemID, javax.xml.transform.Source xmlSource, java.util.Map parameters, java.io.OutputStream outputStream)
          Actual method that performs the XSLT/XML transformation.
 void transform(java.lang.String xsltSystemID, javax.xml.transform.Source xmlSource, java.util.Map parameters, javax.xml.transform.Result result)
          Main XSLT/XML transformation worker method.
 void transform(java.lang.String xsltSystemID, java.lang.String xmlSystemID, java.util.Map parameters, java.io.OutputStream outputStream)
          Overloaded method that performs an XSLT/XML SystemID transformation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

transformerFactory

protected TransformerFactory transformerFactory
Constructor Detail

Transformation

public Transformation()
Default constructor which uses the base, non caching standard IBIS IBIS TransformerFactory which defaults to JAXP.


Transformation

public Transformation(TransformerFactory transformerFactory)
Constructor which allows other JAPX TransformerFactorys to be used.

Parameters:
transformerFactory - IBIS XSLT TransformerFactory to be used.
Method Detail

setTransformerFactory

public void setTransformerFactory(TransformerFactory transformerFactory)
Sets specified XSLT Transformation Engine. This allows for Saxon or any other XSLT engine to be used in an environment that already has an endorsed JVM or Application Server XSLT engine (typically Xalan). This can also be accomplished via setting a system property or changing the jars inside the JVM or App Server's endorsed directory. The down side to the latter is that ALL applications will then be forced to use that XSLT engine.

Parameters:
transformerFactory - IBIS XSLT TransformerFactory to be used.

transform

public void transform(java.lang.String xsltSystemID,
                      java.lang.Object xml,
                      java.util.Map parameters,
                      java.io.OutputStream outputStream)
               throws javax.xml.transform.TransformerException,
                      java.io.IOException
Overloaded method that calls the appropriate XSLT/XML transformation method.

Parameters:
xsltSystemID - System ID String for the XSLT to be used for the transformation.
xml - Either XML Document or XML System ID to be transformed.
parameters - Optional name value pair map values to be passed to the XSLT.
outputStream - Output stream where the resulting transformation is sent.
Throws:
javax.xml.transform.TransformerException
java.io.IOException

transform

public void transform(java.lang.String xsltSystemID,
                      java.lang.String xmlSystemID,
                      java.util.Map parameters,
                      java.io.OutputStream outputStream)
               throws javax.xml.transform.TransformerException,
                      java.io.IOException
Overloaded method that performs an XSLT/XML SystemID transformation.

Parameters:
xsltSystemID - System ID String for the XSLT to be used for the transformation.
xmlSystemID - System ID of the XML document file to be transformed.
parameters - Optional name value pair map values to be passed to the XSLT.
outputStream - Output stream where the resulting transformation is sent.
Throws:
javax.xml.transform.TransformerException
java.io.IOException

transform

public void transform(java.lang.String xsltSystemID,
                      org.dom4j.Document document,
                      java.util.Map parameters,
                      java.io.OutputStream outputStream)
               throws javax.xml.transform.TransformerException,
                      java.io.IOException
Overloaded method that performs an XSLT/XML document transformation.

Parameters:
xsltSystemID - System ID String for the XSLT to be used for the transformation.
document - XML Document to be transformed.
parameters - Optional name value pair map values to be passed to the XSLT.
outputStream - Output stream where the resulting transformation is sent.
Throws:
javax.xml.transform.TransformerException
java.io.IOException

transform

public void transform(java.lang.String xsltSystemID,
                      javax.xml.transform.Source xmlSource,
                      java.util.Map parameters,
                      java.io.OutputStream outputStream)
               throws javax.xml.transform.TransformerException,
                      java.io.IOException
Actual method that performs the XSLT/XML transformation. The calling object needs to trap exceptions and close the outputstream as needed.

Parameters:
xsltSystemID - System ID String for the XSLT to be used for the transformation.
xmlSource - XML Source to be transformed (based on either an XML file or an XML document).
parameters - Optional name value pair map values to be passed to the XSLT.
outputStream - Output stream where the resulting transformation is sent.
Throws:
javax.xml.transform.TransformerException
java.io.IOException

transform

public void transform(java.lang.String xsltSystemID,
                      javax.xml.transform.Source xmlSource,
                      java.util.Map parameters,
                      javax.xml.transform.Result result)
               throws javax.xml.transform.TransformerException,
                      java.io.FileNotFoundException
Main XSLT/XML transformation worker method. This is the method that actually does the transformation - calls the Stylesheet factory and does the transformation. It is called by the other transform methods after they have created the standard objects and returns to them a result which then use to stream back to the outputstream.

Parameters:
xsltSystemID - System ID String for the XSLT to be used for the transformation.
xmlSource - XML Source object to be transformed.
parameters - Optional name value pair map values to be passed to the XSLT.
result - Transformation Result that receives the transformation.
Throws:
javax.xml.transform.TransformerException
java.io.FileNotFoundException