org.mmbase.util
Class XSLTransformer

java.lang.Object
  extended by org.mmbase.util.XSLTransformer

public class XSLTransformer
extends Object

Make XSL Transformations

Version:
$Id: XSLTransformer.java 41186 2010-02-26 17:54:31Z michiel $
Author:
Case Roole, cjr@dds.nl, Michiel Meeuwissen
Move:
org.mmbase.util.xml

Field Summary
static String NS_AWARE
           
 
Constructor Summary
XSLTransformer()
           
 
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<String,Object> params, boolean considerDir)
          Can be used to transform a directory of XML-files.
static void transform(File xmlFile, File xslFile, Result result, Map<String,Object> 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<String,Object> params)
          This is the base function which calls the actual XSL transformations.
static void transform(Source xml, File xslFile, Result result, Map<String,Object> params, boolean considerDir)
          This is the base function which calls the actual XSL transformations.
static void transform(Source xml, URL xslFile, Result result, Map<String,Object> params)
           
static void transform(Source xml, URL xslFile, Result result, Map<String,Object> 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
 

Field Detail

NS_AWARE

public static final String NS_AWARE
See Also:
Constant Field Values
Constructor Detail

XSLTransformer

public XSLTransformer()
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<String,Object> 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
Javadoc:

transform

public static void transform(Source xml,
                             File xslFile,
                             Result result,
                             Map<String,Object> 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<String,Object> params)
                      throws TransformerException
Throws:
TransformerException
Since:
MMBase-1.8

transform

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

transform

public static void transform(File xmlFile,
                             File xslFile,
                             Result result,
                             Map<String,Object> 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
Javadoc:

transform

public static void transform(File xmlDir,
                             File xslFile,
                             File resultDir,
                             boolean recurse,
                             Map<String,Object> 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
Javadoc:

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 2.0-SNAPSHOT - null