org.apache.cocoon.components.xslt
Class XSLTProcessorImpl

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.components.xslt.XSLTProcessorImpl
All Implemented Interfaces:
URIResolver, Disposable, Component, Composable, LogEnabled, Parameterizable, XSLTProcessor

Deprecated. Use the avalon excalibur xslt processor instead.

public class XSLTProcessorImpl
extends AbstractLogEnabled
implements XSLTProcessor, Composable, Disposable, Parameterizable, URIResolver

This class defines the implementation of the XSLTProcessor component. To configure it, add the following lines in the cocoon.xconf file:

 <xslt-processor class="org.apache.cocoon.components.xslt.XSLTProcessorImpl">
    <parameter name="use-store" value="true"/>
    <parameter name="transformer-factory" value="org.apache.xalan.processor.TransformerFactoryImpl"/>
 </xslt-processor>
 
The <use-store> configuration forces the transformer to put the Templates generated from the XSLT stylesheet into the Store. This property is true by default.

The <transformer-factory> configuration tells the transformer to use a particular implementation of javax.xml.transform.TransformerFactory. This allows to force the use of a given TRAX implementation (e.g. xalan or saxon) if several are available in the classpath. If this property is not set, the transformer uses the standard TRAX mechanism (TransformerFactory.newInstance()).

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

Field Summary
protected  TraxErrorHandler errorHandler
          Deprecated. The error handler for the transformer
protected  HashMap factories
          Deprecated. The trax TransformerFactory lookup table
protected  SAXTransformerFactory factory
          Deprecated. The trax TransformerFactory this component uses
protected  boolean incrementalProcessing
          Deprecated. Is incremental processing turned on?
protected  ComponentManager manager
          Deprecated.  
protected  SourceResolver resolver
          Deprecated. The source resolver used by this processor
protected  Store store
          Deprecated. The store service instance
protected  boolean useStore
          Deprecated. Is the store turned on?
 
Fields inherited from interface org.apache.cocoon.components.xslt.XSLTProcessor
DEFAULT_FACTORY, ROLE
 
Constructor Summary
XSLTProcessorImpl()
          Deprecated.  
 
Method Summary
 void compose(ComponentManager manager)
          Deprecated. Compose.
 void dispose()
          Deprecated. Dispose
 TransformerHandler getTransformerHandler(Source stylesheet)
          Deprecated. Same as XSLTProcessor.getTransformerHandler(Source,XMLFilter), with filter set to null and factory set to null.
 TransformerHandler getTransformerHandler(Source stylesheet, XMLFilter filter)
          Deprecated. Return a TransformerHandler for a given stylesheet Source.
 void parameterize(Parameters params)
          Deprecated. Configure the component
 Source resolve(String href, String base)
          Deprecated. Called by the processor when it encounters an xsl:include, xsl:import, or document() function.
 void setSourceResolver(SourceResolver resolver)
          Deprecated. The processor can now simply lookup the source resolver.
 void setTransformerFactory(String classname)
          Deprecated. Set the transformer factory used by this component
 void transform(Source source, Source stylesheet, Parameters params, Result result)
          Deprecated. Applies an XSLT stylesheet to an XML document.
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

manager

protected ComponentManager manager
Deprecated. 

store

protected Store store
Deprecated. 
The store service instance


factories

protected HashMap factories
Deprecated. 
The trax TransformerFactory lookup table


factory

protected SAXTransformerFactory factory
Deprecated. 
The trax TransformerFactory this component uses


useStore

protected boolean useStore
Deprecated. 
Is the store turned on? (default is on)


incrementalProcessing

protected boolean incrementalProcessing
Deprecated. 
Is incremental processing turned on? (default for Xalan: no)


resolver

protected SourceResolver resolver
Deprecated. 
The source resolver used by this processor


errorHandler

protected TraxErrorHandler errorHandler
Deprecated. 
The error handler for the transformer

Constructor Detail

XSLTProcessorImpl

public XSLTProcessorImpl()
Deprecated. 
Method Detail

compose

public void compose(ComponentManager manager)
             throws ComponentException
Deprecated. 
Compose. Try to get the store

Specified by:
compose in interface Composable
Throws:
ComponentException

dispose

public void dispose()
Deprecated. 
Dispose

Specified by:
dispose in interface Disposable

parameterize

public void parameterize(Parameters params)
                  throws ParameterException
Deprecated. 
Configure the component

Specified by:
parameterize in interface Parameterizable
Throws:
ParameterException

setSourceResolver

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

Set the source resolver used by this component

Specified by:
setSourceResolver in interface XSLTProcessor
Parameters:
resolver - a SourceResolver value

setTransformerFactory

public void setTransformerFactory(String classname)
Deprecated. 
Set the transformer factory used by this component

Specified by:
setTransformerFactory in interface XSLTProcessor
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 TransformerHandler getTransformerHandler(Source stylesheet)
                                         throws ProcessingException
Deprecated. 
Description copied from interface: XSLTProcessor
Same as XSLTProcessor.getTransformerHandler(Source,XMLFilter), with filter set to null and factory set to null.

Specified by:
getTransformerHandler in interface XSLTProcessor
Parameters:
stylesheet - a Source value
Returns:
a TransformerHandler value
Throws:
ProcessingException - if an error occurs
See Also:
TraxTransformer.setConsumer(org.apache.cocoon.xml.XMLConsumer)

getTransformerHandler

public TransformerHandler getTransformerHandler(Source stylesheet,
                                                XMLFilter filter)
                                         throws ProcessingException
Deprecated. 
Description copied from interface: XSLTProcessor

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.

Specified by:
getTransformerHandler in interface XSLTProcessor
Parameters:
stylesheet - a Source value
filter - a XMLFilter value
Returns:
a TransformerHandler value
Throws:
ProcessingException - if an error occurs

transform

public void transform(Source source,
                      Source stylesheet,
                      Parameters params,
                      Result result)
               throws ProcessingException
Deprecated. 
Description copied from interface: XSLTProcessor
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.

Specified by:
transform in interface XSLTProcessor
Parameters:
source - a Source value
stylesheet - a Source value
params - a Parameters value
result - a Result value
Throws:
ProcessingException - if an error occurs

resolve

public Source resolve(String href,
                      String base)
               throws TransformerException
Deprecated. 
Called by the processor when it encounters an xsl:include, xsl:import, or document() function.

Specified by:
resolve in interface URIResolver
Parameters:
href - An href attribute, which may be relative or absolute.
base - The base URI in effect when the href attribute was encountered.
Returns:
A Source object, or null if the href cannot be resolved, and the processor should try to resolve the URI itself.
Throws:
TransformerException - if an error occurs when trying to resolve the URI.


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.