org.wamblee.xml
Class XslTransformer

java.lang.Object
  extended by org.wamblee.xml.XslTransformer

public class XslTransformer
extends Object

XSL transformer for simplified usage of XSL transformations.

Author:
Erik Brakkee

Constructor Summary
XslTransformer()
          Constructs the XSLT processor.
XslTransformer(URIResolver aResolver)
          Constructs the URL resolver.
 
Method Summary
 Source resolve(String aXslt)
          Resolves an XSLT based on URI.
 String textTransform(byte[] aDocument, Source aXslt)
          Transforms a document to a text output.
 Document transform(byte[] aDocument, Source aXslt)
          Transforms a document using XSLT.
 Document transform(Document aDocument, Source aXslt)
          Transforms a DOM document into another DOM document using a given XSLT transformation.
 void transform(Source aSource, Result aResult, Source aXslt)
          Transforms a document using XSLT.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XslTransformer

public XslTransformer(URIResolver aResolver)
Constructs the URL resolver.

Parameters:
aResolver - URI resolver to use.

XslTransformer

public XslTransformer()
Constructs the XSLT processor.

Method Detail

resolve

public Source resolve(String aXslt)
               throws TransformerException
Resolves an XSLT based on URI.

Parameters:
aXslt - XSLT to resolve,
Returns:
Source for the XSLT
Throws:
TransformerException - In case the XSLT cannot be found.

transform

public Document transform(Document aDocument,
                          Source aXslt)
                   throws IOException,
                          TransformerException
Transforms a DOM document into another DOM document using a given XSLT transformation.

Parameters:
aDocument - Document to transform.
aXslt - XSLT to use.
Returns:
Transformed document.
Throws:
IOException - In case of problems reading resources.
TransformerException - In case transformation fails.

transform

public Document transform(byte[] aDocument,
                          Source aXslt)
                   throws IOException,
                          TransformerException
Transforms a document using XSLT.

Parameters:
aDocument - Document to transform.
aXslt - XSLT to use.
Returns:
Transformed document.
Throws:
IOException - In case of problems reading resources.
TransformerException - In case transformation fails.

textTransform

public String textTransform(byte[] aDocument,
                            Source aXslt)
                     throws IOException,
                            TransformerException
Transforms a document to a text output. This supports XSLT transformations that result in text documents.

Parameters:
aDocument - Document to transform.
aXslt - XSL transformation.
Returns:
Transformed document.
Throws:
IOException
TransformerException

transform

public void transform(Source aSource,
                      Result aResult,
                      Source aXslt)
               throws IOException,
                      TransformerException
Transforms a document using XSLT.

Parameters:
aSource - Document to transform.
aResult - Result of the transformation.
aXslt - XSLT to use.
Throws:
IOException - In case of problems reading resources.
TransformerException - In case transformation fails.


Copyright © 2011. All Rights Reserved.