org.apache.cocoon.components.xslt
Class TraxProcessor

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.components.xslt.TraxProcessor
All Implemented Interfaces:
URIResolver, Poolable, Recyclable, Disposable, Initializable, Component, LogEnabled, Parameterizable, Serviceable, XSLTProcessor

public class TraxProcessor
extends 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 1304258 2012-03-23 10:09:27Z ilgrosso $

Nested Class Summary
static class TraxProcessor.MyTransformerHandlerAndValidity
          Subclass to allow for instanciation, as for some unknown reason the constructor is protected....
 
Nested classes/interfaces inherited from interface 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?
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?
protected  XMLizer m_xmlizer
           
 
Fields inherited from interface org.apache.excalibur.xml.xslt.XSLTProcessor
ROLE
 
Constructor Summary
TraxProcessor()
           
 
Method Summary
 void dispose()
          Disposable
protected  InputSource getInputSource(Source source)
          Return a new InputSource object that uses the InputStream and the system ID of the Source object.
 TransformerHandler getTransformerHandler(Source stylesheet)
           
 TransformerHandler getTransformerHandler(Source stylesheet, XMLFilter filter)
           
 XSLTProcessor.TransformerHandlerAndValidity getTransformerHandlerAndValidity(Source stylesheet)
           
 XSLTProcessor.TransformerHandlerAndValidity getTransformerHandlerAndValidity(Source stylesheet, XMLFilter filter)
           
 void initialize()
          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
protected  void sourceToSAX(Source source, ContentHandler handler)
           
 void transform(Source source, Source stylesheet, Parameters params, Result result)
           
 
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

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


m_xmlizer

protected XMLizer m_xmlizer

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
Initialize

Specified by:
initialize in interface Initializable
Throws:
Exception

dispose

public void dispose()
Disposable

Specified by:
dispose in interface Disposable

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(org.apache.excalibur.source.Source)

getTransformerHandler

public TransformerHandler getTransformerHandler(Source stylesheet,
                                                XMLFilter filter)
                                         throws XSLTProcessorException
Specified by:
getTransformerHandler in interface XSLTProcessor
Throws:
XSLTProcessorException
See Also:
XSLTProcessor.getTransformerHandler(org.apache.excalibur.source.Source, org.xml.sax.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

sourceToSAX

protected void sourceToSAX(Source source,
                           ContentHandler handler)
                    throws SAXException,
                           IOException,
                           SourceException
Throws:
SAXException
IOException
SourceException

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.

getInputSource

protected InputSource getInputSource(Source source)
                              throws IOException,
                                     SourceException
Return a new InputSource object that uses the InputStream and the system ID of the Source object.

Throws:
IOException - if I/O error occured.
SourceException

recycle

public void recycle()
Recycle the component

Specified by:
recycle in interface Recyclable


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