org.apache.cocoon.sax.util
Class TransformationUtils

java.lang.Object
  extended by org.apache.cocoon.sax.util.TransformationUtils

public final class TransformationUtils
extends Object

This class contains utility methods to transform an XML string by using XSLT. It hides all the details of the Java TRaX API by using SAX pipeline components that are linked to each other. This means that the SAX events stream through the pipeline and are serialized at the end. NOTE: Exception handling needs to be discussed and will probably change.


Method Summary
static void transform(String xmlString, Map<String,Object> xsltParameters, Properties outputProperties, OutputStream outputStream, URL... xsltUrls)
          Transform an XML string and write the result into an OutputStream.
static String transform(String xmlString, Map<String,Object> xsltParameters, Properties outputProperties, URL... xsltUrls)
          Transform an XML string by using XSLT.
static String transform(String xmlString, Map<String,Object> xsltParameters, URL... xsltUrls)
          Transform an XML string by using XSLT.
static void transform(String xmlString, OutputStream outputStream, Map<String,Object> xsltParameters, URL... xsltURLs)
          Transform an XML string by using XSLT and write the result into an OutputStream.
static void transform(String xmlString, OutputStream outputStream, Properties outputProperties, URL... xsltURLs)
          Transform an XML string by using XSLT and write the result into an OutputStream.
static void transform(String xmlString, OutputStream outputStream, URL... xsltURLs)
          Transform an XML string by using XSLT and write the result into an OutputStream.
static String transform(String xmlString, Properties outputProperties, URL... xsltUrls)
          Transform an XML string by using XSLT.
static String transform(String xmlString, URL... xsltUrls)
          Transform an XML string by using XSLT.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

transform

public static String transform(String xmlString,
                               URL... xsltUrls)
                        throws Exception
Transform an XML string by using XSLT.

Parameters:
xmlString - The String to be transformed.
xsltUrls - The URLs of all XSLT stylesheets that are used in the order they are passed to transform the passed XML string.
Returns:
The transformed result as String.
Throws:
Exception

transform

public static String transform(String xmlString,
                               Map<String,Object> xsltParameters,
                               URL... xsltUrls)
                        throws Exception
Transform an XML string by using XSLT. This method also allows passing parameters to the stylesheets.

Parameters:
xmlString - The String to be transformed.
xsltParameters - Parameters that are available in all XSLT stylesheets.
xsltUrls - The URLs of all XSLT stylesheets that are used in the order they are passed to transform the passed XML string.
Returns:
The transformed result as String.
Throws:
Exception

transform

public static String transform(String xmlString,
                               Properties outputProperties,
                               URL... xsltUrls)
                        throws Exception
Transform an XML string by using XSLT. This method allows defining the output properties.

Parameters:
xmlString - The String to be transformed.
outputProperties - XML output properties. See "http://www.w3.org/TR/xslt#output".
xsltUrls - The URLs of all XSLT stylesheets that are used in the order they are passed to transform the passed XML string.
Returns:
The transformed result as String.
Throws:
Exception

transform

public static String transform(String xmlString,
                               Map<String,Object> xsltParameters,
                               Properties outputProperties,
                               URL... xsltUrls)
                        throws Exception
Transform an XML string by using XSLT. This method allows defining the output properties and also allows passing parameters to the stylesheets.

Parameters:
xmlString - The String to be transformed.
xsltParameters - Parameters that are available in all XSLT stylesheets.
outputProperties - XML output properties. See "http://www.w3.org/TR/xslt#output".
xsltUrls - The URLs of all XSLT stylesheets that are used in the order they are passed to transform the passed XML string.
Returns:
The transformed result as String.
Throws:
Exception

transform

public static void transform(String xmlString,
                             OutputStream outputStream,
                             URL... xsltURLs)
                      throws Exception
Transform an XML string by using XSLT and write the result into an OutputStream.

Parameters:
xmlString - The String to be transformed.
outputStream - The result is written into this OutputStream.
xsltURLs - The URLs of all XSLT stylesheets that are used in the order they are passed to transform the passed XML string.
Throws:
Exception

transform

public static void transform(String xmlString,
                             OutputStream outputStream,
                             Map<String,Object> xsltParameters,
                             URL... xsltURLs)
                      throws Exception
Transform an XML string by using XSLT and write the result into an OutputStream. This method also allows passing parameters to the stylesheets.

Parameters:
xmlString - The String to be transformed.
outputStream - The result is written into this OutputStream.
xsltParameters - Parameters that are available in all XSLT stylesheets.
xsltURLs - The URLs of all XSLT stylesheets that are used in the order they are passed to transform the passed XML string.
Throws:
Exception

transform

public static void transform(String xmlString,
                             OutputStream outputStream,
                             Properties outputProperties,
                             URL... xsltURLs)
                      throws Exception
Transform an XML string by using XSLT and write the result into an OutputStream. This method allows defining the output properties.

Parameters:
xmlString - The String to be transformed.
outputStream - The result is written into this OutputStream.
outputProperties - XML output properties. See "http://www.w3.org/TR/xslt#output".
xsltURLs - The URLs of all XSLT stylesheets that are used in the order they are passed to transform the passed XML string.
Throws:
Exception

transform

public static void transform(String xmlString,
                             Map<String,Object> xsltParameters,
                             Properties outputProperties,
                             OutputStream outputStream,
                             URL... xsltUrls)
                      throws Exception
Transform an XML string and write the result into an OutputStream.

Parameters:
xmlString - The String to be transformed.
xsltParameters - Parameters that are available in all XSLT stylesheets.
outputProperties - XML output properties. See "http://www.w3.org/TR/xslt#output".
outputStream - The result is written into this OutputStream.
xsltUrls - The URLs of all XSLT stylesheets that are used in the order they are passed to transform the passed XML string.
Throws:
Exception


Copyright © 2008-2012 The Apache Software Foundation. All Rights Reserved.