org.apache.cocoon.components.xslt
Class TraxProcessor

java.lang.Object
  extended byorg.apache.cocoon.util.AbstractLogEnabled
      extended byorg.apache.cocoon.components.xslt.TraxProcessor
All Implemented Interfaces:
Disposable, Initializable, Parameterizable, Poolable, Recyclable, Serviceable, URIResolver, XSLTProcessor

public class TraxProcessor
extends org.apache.cocoon.util.AbstractLogEnabled
implements XSLTProcessor, Serviceable, Initializable, Disposable, Parameterizable, Recyclable, URIResolver

Adaptation of Excalibur's XSLTProcessor implementation to allow for better error reporting.

Since:
2.1.8
Version:
$Id: TraxProcessor.html 1304280 2012-03-23 11:18:01Z ilgrosso $

Nested Class Summary
static class TraxProcessor.MyTransformerHandlerAndValidity
          Subclass to allow for instanciation, as for some unknown reason the constructor is protected....
 
Nested classes inherited from class org.apache.excalibur.xml.xslt.XSLTProcessor
XSLTProcessor.TransformerHandlerAndValidity
 
Field Summary
protected  boolean m_checkIncludes
          Check included stylesheets
protected  SAXTransformerFactory m_defaultFactory
          The default TransformerFactory used by this component
protected  SAXTransformerFactory m_factory
          The trax TransformerFactory this component uses
protected  Map m_includesMap
          Map of pairs of System ID's / validities of the included stylesheets
protected  boolean m_incrementalProcessing
          Is incremental processing turned on? (default for Xalan: no)
protected  ServiceManager m_manager
          The ServiceManager
protected  SourceResolver m_resolver
          Resolver used to resolve XSLT document() calls, imports and includes
protected  Store m_store
          The store service instance
protected  String m_transformerFactory
          The configured transformer factory to use
protected  boolean m_useStore
          Is the store turned on? (default is off)
protected  SAXParser saxParser
           
 
Fields inherited from interface org.apache.excalibur.xml.xslt.XSLTProcessor
ROLE
 
Constructor Summary
TraxProcessor()
           
 
Method Summary
 void dispose()
           
 TransformerHandler getTransformerHandler(Source stylesheet)
           
 TransformerHandler getTransformerHandler(Source stylesheet, XMLFilter filter)
           
 XSLTProcessor.TransformerHandlerAndValidity getTransformerHandlerAndValidity(Source stylesheet)
           
 XSLTProcessor.TransformerHandlerAndValidity getTransformerHandlerAndValidity(Source stylesheet, XMLFilter filter)
           
 void initialize()
           
 void parameterize(Parameters params)
          Configure the component
 void recycle()
          Recycle the component
 Source resolve(String href, String base)
          Called by the processor when it encounters an xsl:include, xsl:import, or document() function.
 void service(ServiceManager manager)
          Compose.
 void setTransformerFactory(String classname)
          Set the transformer factory used by this component
 void transform(Source source, Source stylesheet, Parameters params, Result result)
           
 
Methods inherited from class org.apache.cocoon.util.AbstractLogEnabled
getLogger, setLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_store

protected Store m_store
The store service instance


m_transformerFactory

protected String m_transformerFactory
The configured transformer factory to use


m_factory

protected SAXTransformerFactory m_factory
The trax TransformerFactory this component uses


m_defaultFactory

protected SAXTransformerFactory m_defaultFactory
The default TransformerFactory used by this component


m_useStore

protected boolean m_useStore
Is the store turned on? (default is off)


m_incrementalProcessing

protected boolean m_incrementalProcessing
Is incremental processing turned on? (default for Xalan: no)


m_resolver

protected SourceResolver m_resolver
Resolver used to resolve XSLT document() calls, imports and includes


m_checkIncludes

protected boolean m_checkIncludes
Check included stylesheets


m_includesMap

protected Map m_includesMap
Map of pairs of System ID's / validities of the included stylesheets


saxParser

protected SAXParser saxParser

m_manager

protected ServiceManager m_manager
The ServiceManager

Constructor Detail

TraxProcessor

public TraxProcessor()
Method Detail

service

public void service(ServiceManager manager)
             throws ServiceException
Compose. Try to get the store

Specified by:
service in interface Serviceable
Throws:
ServiceException

initialize

public void initialize()
                throws Exception
Specified by:
initialize in interface Initializable
Throws:
Exception
See Also:
Initializable.initialize()

dispose

public void dispose()
Specified by:
dispose in interface Disposable
See Also:
Disposable.dispose()

parameterize

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

Specified by:
parameterize in interface Parameterizable
Throws:
ParameterException

setTransformerFactory

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

Specified by:
setTransformerFactory in interface XSLTProcessor

getTransformerHandler

public TransformerHandler getTransformerHandler(Source stylesheet)
                                         throws XSLTProcessorException
Specified by:
getTransformerHandler in interface XSLTProcessor
Throws:
XSLTProcessorException
See Also:
XSLTProcessor.getTransformerHandler(Source)

getTransformerHandler

public TransformerHandler getTransformerHandler(Source stylesheet,
                                                XMLFilter filter)
                                         throws XSLTProcessorException
Specified by:
getTransformerHandler in interface XSLTProcessor
Throws:
XSLTProcessorException
See Also:
XSLTProcessor.getTransformerHandler(Source, XMLFilter)

getTransformerHandlerAndValidity

public XSLTProcessor.TransformerHandlerAndValidity getTransformerHandlerAndValidity(Source stylesheet)
                                                                             throws XSLTProcessorException
Specified by:
getTransformerHandlerAndValidity in interface XSLTProcessor
Throws:
XSLTProcessorException

getTransformerHandlerAndValidity

public XSLTProcessor.TransformerHandlerAndValidity getTransformerHandlerAndValidity(Source stylesheet,
                                                                                    XMLFilter filter)
                                                                             throws XSLTProcessorException
Specified by:
getTransformerHandlerAndValidity in interface XSLTProcessor
Throws:
XSLTProcessorException

transform

public void transform(Source source,
                      Source stylesheet,
                      Parameters params,
                      Result result)
               throws XSLTProcessorException
Specified by:
transform in interface XSLTProcessor
Throws:
XSLTProcessorException

resolve

public Source resolve(String href,
                      String base)
               throws TransformerException
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.

recycle

public void recycle()
Recycle the component

Specified by:
recycle in interface Recyclable


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