Class XSLTUtilities

java.lang.Object
wt.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:
  • Constructor Details

    • 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
  • Method Details

    • 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