org.optimizationservices.oscommon.util
Class XSLTUtil

java.lang.Object
  extended by org.optimizationservices.oscommon.util.XSLTUtil

public class XSLTUtil
extends java.lang.Object

The XSLTUtil class contains methods for performing common basic XSLT-related operations used by various classes in the Optimization Services (OS) framework.

Since:
OS1.0
Version:
1.0, 03/14/2004
Author:
Robert Fourer, Jun Ma, Kipp Martin

Constructor Summary
XSLTUtil()
           
 
Method Summary
static javax.xml.transform.Transformer createTransformerFromFile(java.lang.String xsltFileName)
          Create an xslt transformer from an xslt transformation file.
static javax.xml.transform.Transformer createTransformerFromString(java.lang.String xsltString)
          Create an xslt transformer from an xslt string.
static void main(java.lang.String[] args)
          main for test purposes.
static boolean transformFile(java.lang.String inputFileName, java.lang.String xsltFileName, java.lang.String outputFilename)
          Transform an xml file input to an xml file output according to an xslt transformation file.
static java.lang.String transformString(java.lang.String inputString, java.lang.String xsltString)
          Transform an xml string input and return an xml string output according to an xslt transformation string.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XSLTUtil

public XSLTUtil()
Method Detail

createTransformerFromFile

public static javax.xml.transform.Transformer createTransformerFromFile(java.lang.String xsltFileName)
Create an xslt transformer from an xslt transformation file.

Parameters:
xsltFileName - holds the xslt file that does the transformation from xml input to xml output.
Returns:
an xslt transformer from the xslt transformation file.

createTransformerFromString

public static javax.xml.transform.Transformer createTransformerFromString(java.lang.String xsltString)
Create an xslt transformer from an xslt string.

Parameters:
xsltString - holds the xslt string that does the transformation from xml input to xml output.
Returns:
an xslt transformer from the xslt transformation string.

transformFile

public static boolean transformFile(java.lang.String inputFileName,
                                    java.lang.String xsltFileName,
                                    java.lang.String outputFilename)
Transform an xml file input to an xml file output according to an xslt transformation file.

Parameters:
inputFileName - holds the name of the input xml file to be transformed.
xsltFileName - holds the xslt file that does the transformation from xml input to xml output.
outputFilename - holds the name of the output xml file to save the transformed result.
Returns:
whether the transformation is carried out succesfully or not.

transformString

public static java.lang.String transformString(java.lang.String inputString,
                                               java.lang.String xsltString)
Transform an xml string input and return an xml string output according to an xslt transformation string.

Parameters:
inputFileName - holds the name of the input xml file to be transformed.
xsltFileName - holds the xslt file that does the transformation from xml input to xml output.
Returns:

main

public static void main(java.lang.String[] args)
main for test purposes.

Parameters:
argv - command line arguments.