org.mmbase.util
Class XSLTransformer

java.lang.Object
  extended byorg.mmbase.util.XSLTransformer

public class XSLTransformer
extends Object

Make XSL Transformations

Version:
$Id: XSLTransformer.java,v 1.31 2005/08/16 15:22:08 michiel Exp $
Author:
Case Roole, cjr@dds.nl, Michiel Meeuwissen
Warning: Will be moved to:
org.mmbase.util.xml
Core Class
(?) Not specific to MMBase, but used by build files for generation of documentation.

Constructor Summary
XSLTransformer()
          Deprecated. All methods are static.
 
Method Summary
static Result getResult(String[] argv)
           
static void main(String[] argv)
          Invocation of the class from the commandline for testing/building
static void transform(File xmlDir, File xslFile, File resultDir, boolean recurse, Map params, boolean considerDir)
          Can be used to transform a directory of XML-files.
static void transform(File xmlFile, File xslFile, Result result, Map params, boolean considerDir)
          Perfoms XSL Transformation on XML-file which is parsed MMBase specificly (useing MMBasse EntityResolver and Errorhandler).
static void transform(Source xml, File xslFile, Result result, Map params)
          This is the base function which calls the actual XSL transformations.
static void transform(Source xml, File xslFile, Result result, Map params, boolean considerDir)
          This is the base function which calls the actual XSL transformations.
static void transform(Source xml, URL xslFile, Result result, Map params)
           
static void transform(Source xml, URL xslFile, Result result, Map params, boolean considerDir)
           
static String transform(String xmlPath, String xslPath)
          Transform an XML document using a certain XSL document.
static String transform(String xmlPath, String xslPath, boolean cutXML)
          Transform an XML document using a certain XSL document, on MMBase specic way (error handling, entitity resolving, uri resolving, logging), and write it to string, which optionally can be 'cut'.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XSLTransformer

public XSLTransformer()
Deprecated. All methods are static.

Empty constructor

Method Detail

transform

public static String transform(String xmlPath,
                               String xslPath)
Transform an XML document using a certain XSL document.

Parameters:
xmlPath - Path to XML file
xslPath - Path to XSL file
Returns:
String with converted XML document

transform

public static String transform(String xmlPath,
                               String xslPath,
                               boolean cutXML)
Transform an XML document using a certain XSL document, on MMBase specic way (error handling, entitity resolving, uri resolving, logging), and write it to string, which optionally can be 'cut'.

Parameters:
xmlPath - Path to XML file
xslPath - Path to XSL file
cutXML - if true, cuts the <?xml> line that normally starts an xml document
Returns:
String with converted XML document

transform

public static void transform(Source xml,
                             File xslFile,
                             Result result,
                             Map params)
                      throws TransformerException
This is the base function which calls the actual XSL transformations. Performs XSL transformation on MMBase specific way (using MMBase cache, and URIResolver).

Throws:
TransformerException
Since:
MMBase-1.6
Warning: No Java Documentation Available.

transform

public static void transform(Source xml,
                             File xslFile,
                             Result result,
                             Map params,
                             boolean considerDir)
                      throws TransformerException
This is the base function which calls the actual XSL transformations. Performs XSL transformation on MMBase specific way (using MMBase cache, and URIResolver).

Parameters:
xml - The source XML
xslFile - The XSL which must be used for the transformation
result - The XSL out will be written to this
params - null or a Map to XSL transformations parameters
considerDir - If true, an URIResolver will be instantiated which can resolve entities relative to the XSL file.
Throws:
TransformerException
Since:
MMBase-1.6

transform

public static void transform(Source xml,
                             URL xslFile,
                             Result result,
                             Map params)
                      throws TransformerException
Throws:
TransformerException
Since:
MMBase-1.8

transform

public static void transform(Source xml,
                             URL xslFile,
                             Result result,
                             Map params,
                             boolean considerDir)
                      throws TransformerException
Throws:
TransformerException
Since:
MMBase-1.8

transform

public static void transform(File xmlFile,
                             File xslFile,
                             Result result,
                             Map params,
                             boolean considerDir)
                      throws TransformerException,
                             ParserConfigurationException,
                             IOException,
                             SAXException
Perfoms XSL Transformation on XML-file which is parsed MMBase specificly (useing MMBasse EntityResolver and Errorhandler).

Throws:
TransformerException
ParserConfigurationException
IOException
SAXException
Since:
MMBase-1.6
Warning: No Java Documentation Available.

transform

public static void transform(File xmlDir,
                             File xslFile,
                             File resultDir,
                             boolean recurse,
                             Map params,
                             boolean considerDir)
                      throws TransformerException,
                             ParserConfigurationException,
                             IOException,
                             SAXException
Can be used to transform a directory of XML-files. Of course the result must be written to files too. The transformations will be called with a paramter "root" which points back to the root directory relatively. You need this when all your transformations results (probably html's) need to refer to the same file which is relative to the root of the transformation.

Throws:
TransformerException
ParserConfigurationException
IOException
SAXException
Since:
MMBase-1.6
Warning: No Java Documentation Available.

getResult

public static Result getResult(String[] argv)
                        throws Exception
Throws:
Exception

main

public static void main(String[] argv)
Invocation of the class from the commandline for testing/building



MMBase build 1.8.1.20060716