wt.util.xml.xslt
Class XSLTUtilities

java.lang.Object
  extended bywt.util.xml.xslt.XSLTUtilities

public class XSLTUtilities
extends Object

A convenience class which provides methods for easy transformation of XML sources via XSLT. Note that instances of this class, like that of XMLSourceFactory should not be used by multiple threads concurrently i.e., should not be assumed to be thread-safe.

Supported API: true

Extendable: false

See Also:
XSLTransform, XMLSourceFactory

Field Summary
private static String CLASSNAME
           
private  XMLSourceFactory factory
           
private static String RESOURCE
           
 
Constructor Summary
XSLTUtilities()
          Create an new instance using the default XMLSourceFactory implementation provided with Windchill.
XSLTUtilities(SAXParserFactory saxParserFactory, DocumentBuilderFactory documentBuilderFactory, TransformerFactory transformerFactory)
          Create an new instance supplying JAXP factory instances to create an XMLSourceFactory instance provided with Windchill.
XSLTUtilities(XMLSourceFactory factory)
          Create an new instance using a specific instance of XMLSourceFactory.
 
Method Summary
 void transform(XMLSource xmlSource, URL[] urls, OutputStream output, Hashtable inputParameters)
          Transforms the given XML document using one or more stylesheets.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

factory

private XMLSourceFactory factory
Constructor Detail

XSLTUtilities

public XSLTUtilities(XMLSourceFactory factory)
Create an new instance using a specific instance of XMLSourceFactory.

Supported API: true

Parameters:
factory -

XSLTUtilities

public XSLTUtilities()
Create an new instance using the default XMLSourceFactory implementation provided with Windchill.

Supported API: true


XSLTUtilities

public XSLTUtilities(SAXParserFactory saxParserFactory,
                     DocumentBuilderFactory documentBuilderFactory,
                     TransformerFactory transformerFactory)
Create an new instance supplying JAXP factory instances to create an XMLSourceFactory instance provided with Windchill.

Supported API: false

Parameters:
saxParserFactory -
documentBuilderFactory -
transformerFactory -
Method Detail

transform

public void transform(XMLSource xmlSource,
                      URL[] urls,
                      OutputStream output,
                      Hashtable inputParameters)
               throws SAXException,
                      IOException
Transforms the given XML document using one or more stylesheets.

Example Usage

Using the default implementation, transform http://localhost/test.xml with the XSLT stylesheet http://localhost/test.xsl and save the resulting document in c:/out/test.html.

   OutputStream out = new FileOutputStream("C:/out/test.html");
    URL[] urls = { new URL("http://localhost/test.xsl") };
    XMLSource theSource = factory.newURLSource( new URL ("http://localhost/test.xml")
 );

    XSLTUtilities xu = new XSLTUtilities();
    xu.transform(theSource, urls, out, null);
 


Supported API: true

Parameters:
xmlSource - The XML source. It may be Stream, URL, Reader, DOM, or SAX input.
urls - An array of URL's of stylesheets to be applied in succession.
output - Where the result of the transformation is written
inputParameters - Hashtable of input parameters that can be used from the stylesheets.
Throws:
SAXException - if the XML or XSLT cannot be parsed
IOException - if there is an IOException reading the XML or XSLT or when writing to the output stream