org.apache.cocoon.components.xslt
Interface XSLTProcessor

All Superinterfaces:
org.apache.avalon.framework.component.Component
All Known Implementing Classes:
XSLTProcessorImpl

public interface XSLTProcessor
extends org.apache.avalon.framework.component.Component

This is the interface of the XSLT processor in Cocoon.

Since:
July 11, 2001
Version:
CVS $Id: XSLTProcessor.java,v 1.6.2.1 2002/06/16 22:45:49 vgritsenko Exp $
Author:
Ovidiu Predescu, Vadim Gritsenko

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.
 CacheValidity getTransformerValidity(Source stylesheet)
          Return a CacheValidity for a given stylesheet Source.
 void setSourceResolver(SourceResolver resolver)
          Set the SourceResolver for this instance.
 void transform(Source source, Source stylesheet, org.apache.avalon.framework.parameters.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

setSourceResolver

public void setSourceResolver(SourceResolver resolver)
Set the SourceResolver for this instance. The resolver is invoked to return a Source object, given an HREF.
Parameters:
resolver - a SourceResolver value

getTransformerValidity

public CacheValidity getTransformerValidity(Source stylesheet)

Return a CacheValidity for a given stylesheet Source. This can be used in a pipeline to handle caching of a transformation results.

This method accesses cache of the Templates objects to obtain list of included stylesheets, which is built when stylesheet is created.

Parameters:
stylesheet - a Source value
Returns:
a CacheValidity value

getTransformerHandler

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

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 TraxTransformer.setConsumer(org.apache.cocoon.xml.XMLConsumer) 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:
ProcessingException - if an error occurs

getTransformerHandler

public javax.xml.transform.sax.TransformerHandler getTransformerHandler(Source stylesheet)
                                                                 throws ProcessingException
Same as getTransformerHandler(Source,XMLFilter), with filter set to null.
Parameters:
stylesheet - a Source value
Returns:
a TransformerHandler value
Throws:
ProcessingException - if an error occurs
See Also:
TraxTransformer.setConsumer(org.apache.cocoon.xml.XMLConsumer)

transform

public void transform(Source source,
                      Source stylesheet,
                      org.apache.avalon.framework.parameters.Parameters params,
                      javax.xml.transform.Result result)
               throws ProcessingException
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:
ProcessingException - if an error occurs


Copyright � 1999-2002 Apache Software Foundation. All Rights Reserved.