org.apache.ode.utils.xsl
Class XslTransformHandler

java.lang.Object
  extended by org.apache.ode.utils.xsl.XslTransformHandler

public class XslTransformHandler
extends java.lang.Object

Singleton wrapping the basic javax.xml.transform operations. The transformation is then delegated to a Transformer. Supports both XSL 1.0 and XSL 2.0 depending on the version attribute provided in the XSL stylesheet (see http://www.w3.org/TR/xslt20/#backwards - 3.8 Backwards-Compatible Processing).
The transform handler also implements a simple cache to avo??d multiple pre-compilation of the same XSL sheet.


Method Summary
 void cacheXSLSheet(java.net.URI baseUri, java.net.URI uri, java.lang.String body, javax.xml.transform.URIResolver resolver)
          Parses the provided stylesheet and stores it in cache only if it's not there already.
static XslTransformHandler getInstance()
          Singleton access.
 void parseXSLSheet(java.net.URI baseUri, java.net.URI uri, java.lang.String body, javax.xml.transform.URIResolver resolver)
          Always parses the provided stylesheet and stores it in cache from its URI.
 void setErrorListener(javax.xml.transform.ErrorListener l)
           
 void setTransformerFactory(javax.xml.transform.TransformerFactory transformerFactory)
          Sets the transformer factory for initialization.
 java.lang.Object transform(java.net.URI baseUri, java.net.URI uri, javax.xml.transform.Source source, java.util.Map<javax.xml.namespace.QName,java.lang.Object> parameters, javax.xml.transform.URIResolver resolver)
          Transforms a Source document to a result using the XSL stylesheet referenced by the provided URI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static XslTransformHandler getInstance()
Singleton access.

Returns:
single XslTransformHandler instance.

setTransformerFactory

public void setTransformerFactory(javax.xml.transform.TransformerFactory transformerFactory)
Sets the transformer factory for initialization.

Parameters:
transformerFactory -

parseXSLSheet

public void parseXSLSheet(java.net.URI baseUri,
                          java.net.URI uri,
                          java.lang.String body,
                          javax.xml.transform.URIResolver resolver)
Always parses the provided stylesheet and stores it in cache from its URI.

Parameters:
uri - referencing the stylesheet
body - of the XSL document
resolver - used to resolve includes and imports

cacheXSLSheet

public void cacheXSLSheet(java.net.URI baseUri,
                          java.net.URI uri,
                          java.lang.String body,
                          javax.xml.transform.URIResolver resolver)
Parses the provided stylesheet and stores it in cache only if it's not there already.

Parameters:
uri - referencing the stylesheet
body - of the XSL document
resolver - used to resolve includes and imports

transform

public java.lang.Object transform(java.net.URI baseUri,
                                  java.net.URI uri,
                                  javax.xml.transform.Source source,
                                  java.util.Map<javax.xml.namespace.QName,java.lang.Object> parameters,
                                  javax.xml.transform.URIResolver resolver)
Transforms a Source document to a result using the XSL stylesheet referenced by the provided URI. The stylesheet MUST have been parsed previously.

Parameters:
uri - referencing the stylesheet
source - XML document
parameters - passed to the stylesheet
resolver - used to resolve includes and imports

setErrorListener

public void setErrorListener(javax.xml.transform.ErrorListener l)