org.wamblee.xml
Class XslTransformer

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

public class XslTransformer
extends java.lang.Object

XSL transformer for simplified usage of XSL transformations.

Author:
Erik Brakkee

Constructor Summary
XslTransformer()
          Constructs the XSLT processor.
XslTransformer(javax.xml.transform.URIResolver aResolver)
          Constructs the URL resolver.
 
Method Summary
 javax.xml.transform.Source resolve(java.lang.String aXslt)
          Resolves an XSLT based on URI.
 java.lang.String textTransform(byte[] aDocument, javax.xml.transform.Source aXslt)
          Transforms a document to a text output.
 org.w3c.dom.Document transform(byte[] aDocument, javax.xml.transform.Source aXslt)
          Transforms a document using XSLT.
 org.w3c.dom.Document transform(org.w3c.dom.Document aDocument, javax.xml.transform.Source aXslt)
          Transforms a DOM document into another DOM document using a given XSLT transformation.
 void transform(javax.xml.transform.Source aSource, javax.xml.transform.Result aResult, javax.xml.transform.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(javax.xml.transform.URIResolver aResolver)
Constructs the URL resolver.

Parameters:
aResolver - URI resolver to use.

XslTransformer

public XslTransformer()
Constructs the XSLT processor.

Method Detail

resolve

public javax.xml.transform.Source resolve(java.lang.String aXslt)
                                   throws javax.xml.transform.TransformerException
Resolves an XSLT based on URI.

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

transform

public org.w3c.dom.Document transform(org.w3c.dom.Document aDocument,
                                      javax.xml.transform.Source aXslt)
                               throws java.io.IOException,
                                      javax.xml.transform.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:
java.io.IOException - In case of problems reading resources.
javax.xml.transform.TransformerException - In case transformation fails.

transform

public org.w3c.dom.Document transform(byte[] aDocument,
                                      javax.xml.transform.Source aXslt)
                               throws java.io.IOException,
                                      javax.xml.transform.TransformerException
Transforms a document using XSLT.

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

textTransform

public java.lang.String textTransform(byte[] aDocument,
                                      javax.xml.transform.Source aXslt)
                               throws java.io.IOException,
                                      javax.xml.transform.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:
java.io.IOException
javax.xml.transform.TransformerException

transform

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

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


Copyright © 2010. All Rights Reserved.