org.apache.cocoon.components.xslt
Interface XSLTProcessor

All Superinterfaces:
Component
All Known Implementing Classes:
XSLTProcessorImpl

public interface XSLTProcessor
extends Component

This is the interface of the XSLT processor in Cocoon.

Since:
July 11, 2001
Version:
CVS $Id: XSLTProcessor.html 1304258 2012-03-23 10:09:27Z ilgrosso $, 1.0
Author:
Ovidiu Predescu

Field Summary
static String DEFAULT_FACTORY
          The default factory identifier.
static String ROLE
          The role implemented by an XSLTProcessor.
 
Method Summary
 TransformerHandler getTransformerHandler(Source stylesheet)
          Same as getTransformerHandler(Source,XMLFilter), with filter set to null and factory set to null.
 TransformerHandler getTransformerHandler(Source stylesheet, XMLFilter filter)
          Return a TransformerHandler for a given stylesheet Source.
 void setSourceResolver(SourceResolver resolver)
          Deprecated. The processor can now simply lookup the source resolver.
 void setTransformerFactory(String classname)
          Set the TransformerFactory for this instance.
 void transform(Source source, Source stylesheet, Parameters params, Result result)
          Applies an XSLT stylesheet to an XML document.
 

Field Detail

ROLE

static final String ROLE
The role implemented by an XSLTProcessor.


DEFAULT_FACTORY

static final String DEFAULT_FACTORY
The default factory identifier. (simply used as a pointer, the actual content is not meaningful)

See Also:
Constant Field Values
Method Detail

setSourceResolver

void setSourceResolver(SourceResolver resolver)
Deprecated. The processor can now simply lookup the source resolver.

Set the SourceResolver for this instance. The resolver is invoked to return a Source object, given an HREF.

Parameters:
resolver - a SourceResolver value

setTransformerFactory

void setTransformerFactory(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

TransformerHandler getTransformerHandler(Source stylesheet,
                                         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 Source object 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

TransformerHandler getTransformerHandler(Source stylesheet)
                                         throws ProcessingException
Same as getTransformerHandler(Source,XMLFilter), with filter set to null and factory 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

void transform(Source source,
               Source stylesheet,
               Parameters params,
               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-2010 The Apache Software Foundation. All Rights Reserved.