org.apache.excalibur.xml.xslt
Interface XSLTProcessor

All Superinterfaces:
Component
All Known Implementing Classes:
XSLTProcessorImpl

public interface XSLTProcessor
extends Component

This is the interface of the XSLT processor.

Since:
July 11, 2001
Version:
CVS $Id: XSLTProcessor.java,v 1.4 2004/02/28 11:47:16 cziegeler Exp $, 1.0
Author:
Avalon Development Team

Nested Class Summary
static class XSLTProcessor.TransformerHandlerAndValidity
           
 
Field Summary
static java.lang.String ROLE
          The role implemented by an XSLTProcessor.
 
Method Summary
 javax.xml.transform.sax.TransformerHandler getTransformerHandler(Source stylesheet)
          Same as getTransformerHandler(Source,XMLFilter), with filter set to null.
 javax.xml.transform.sax.TransformerHandler getTransformerHandler(Source stylesheet, org.xml.sax.XMLFilter filter)
          Return a TransformerHandler for a given stylesheet Source.
 XSLTProcessor.TransformerHandlerAndValidity getTransformerHandlerAndValidity(Source stylesheet)
          Same as getTransformerHandlerAndValidity(Source,XMLFilter), with filter set to null.
 XSLTProcessor.TransformerHandlerAndValidity getTransformerHandlerAndValidity(Source stylesheet, org.xml.sax.XMLFilter filter)
          Return a TransformerHandler and SourceValidity for a given stylesheet Source.
 void setTransformerFactory(java.lang.String classname)
          Set the TransformerFactory for this instance.
 void transform(Source source, Source stylesheet, Parameters params, javax.xml.transform.Result result)
          Applies an XSLT stylesheet to an XML document.
 

Field Detail

ROLE

public static final java.lang.String ROLE
The role implemented by an XSLTProcessor.

Method Detail

setTransformerFactory

public void setTransformerFactory(java.lang.String classname)
Set the TransformerFactory for this instance. The factory is invoked to return a TransformerHandler to perform the transformation.

Parameters:
classname - the name of the class implementing TransformerFactory value. If an error is found or the indicated class doesn't implement the required interface the original factory of the component is maintained.

getTransformerHandler

public javax.xml.transform.sax.TransformerHandler getTransformerHandler(Source stylesheet,
                                                                        org.xml.sax.XMLFilter filter)
                                                                 throws XSLTProcessorException

Return a TransformerHandler for a given stylesheet Source. This can be used in a pipeline to handle the transformation of a stream of SAX events. See org.apache.cocoon.transformation.TraxTransformer#setConsumer for an example of how to use this method.

The additional filter argument, if it's not null, is inserted in the chain SAX events as an XML filter during the parsing or the source document.

This method caches the Templates object with meta information (modification time and list of included stylesheets) and performs a reparsing only if this changes.

Parameters:
stylesheet - a Source value
filter - a XMLFilter value
Returns:
a TransformerHandler value
Throws:
XSLTProcessorException - if an error occurs

getTransformerHandlerAndValidity

public XSLTProcessor.TransformerHandlerAndValidity getTransformerHandlerAndValidity(Source stylesheet,
                                                                                    org.xml.sax.XMLFilter filter)
                                                                             throws XSLTProcessorException

Return a TransformerHandler and SourceValidity for a given stylesheet Source. This can be used in a pipeline to handle the transformation of a stream of SAX events. See org.apache.cocoon.transformation.TraxTransformer#setConsumer for an example of how to use this method.

The additional filter argument, if it's not null, is inserted in the chain SAX events as an XML filter during the parsing or the source document.

This method caches the Templates object with meta information (modification time and list of included stylesheets) and performs a reparsing only if this changes.

Parameters:
stylesheet - a Source value
filter - a XMLFilter value
Returns:
a TransformerHandlerAndValidity value
Throws:
XSLTProcessorException - if an error occurs

getTransformerHandler

public javax.xml.transform.sax.TransformerHandler getTransformerHandler(Source stylesheet)
                                                                 throws XSLTProcessorException
Same as getTransformerHandler(Source,XMLFilter), with filter set to null.

Parameters:
stylesheet - a Source value
Returns:
a TransformerHandler value
Throws:
XSLTProcessorException - if an error occurs

getTransformerHandlerAndValidity

public XSLTProcessor.TransformerHandlerAndValidity getTransformerHandlerAndValidity(Source stylesheet)
                                                                             throws XSLTProcessorException
Same as getTransformerHandlerAndValidity(Source,XMLFilter), with filter set to null.

Parameters:
stylesheet - a Source value
Returns:
a XSLTProcessor.TransformerHandlerAndValidity value
Throws:
XSLTProcessorException - if an error occurs

transform

public void transform(Source source,
                      Source stylesheet,
                      Parameters params,
                      javax.xml.transform.Result result)
               throws XSLTProcessorException
Applies an XSLT stylesheet to an XML document. The source and stylesheet documents are specified as Source objects. The result of the transformation is placed in Result, which should be properly initialized before invoking this method. Any additional parameters passed in params will become arguments to the stylesheet.

Parameters:
source - a Source value
stylesheet - a Source value
params - a Parameters value
result - a Result value
Throws:
XSLTProcessorException - if an error occurs


Copyright © 1997-2005 The Apache Software Foundation. All Rights Reserved.