|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.avalon.framework.logger.AbstractLoggable | +--org.apache.cocoon.components.xslt.XSLTProcessorImpl
This class defines the implementation of the XSLTProcessor
component.
To configure it, add the following lines in the
<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()
).
Field Summary | |
protected java.util.List |
includes
List accumulating included stylesheets |
protected boolean |
incrementalProcessing
Is incremental processing turned on? |
protected org.apache.avalon.framework.component.ComponentManager |
manager
|
protected SourceResolver |
resolver
Resolver used to resolve XSLT document() calls, imports and includes |
protected Store |
store
The store service instance |
protected javax.xml.transform.sax.SAXTransformerFactory |
tfactory
The trax TransformerFactory |
protected java.lang.Class |
tfactoryClass
The factory class used to create tfactory |
protected boolean |
useStore
Is the store turned on? |
Fields inherited from interface org.apache.cocoon.components.xslt.XSLTProcessor |
ROLE |
Constructor Summary | |
XSLTProcessorImpl()
|
Method Summary | |
void |
compose(org.apache.avalon.framework.component.ComponentManager manager)
Compose. |
void |
dispose()
Dispose |
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 |
parameterize(org.apache.avalon.framework.parameters.Parameters params)
Configure the component |
javax.xml.transform.Source |
resolve(java.lang.String href,
java.lang.String base)
Called by the processor when it encounters an xsl:include, xsl:import, or document() function. |
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. |
Methods inherited from class org.apache.avalon.framework.logger.AbstractLoggable |
getLogger, setLogger, setupLogger, setupLogger, setupLogger |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected org.apache.avalon.framework.component.ComponentManager manager
protected Store store
protected javax.xml.transform.sax.SAXTransformerFactory tfactory
protected java.lang.Class tfactoryClass
protected boolean useStore
protected boolean incrementalProcessing
protected SourceResolver resolver
protected java.util.List includes
Constructor Detail |
public XSLTProcessorImpl()
Method Detail |
public void compose(org.apache.avalon.framework.component.ComponentManager manager) throws org.apache.avalon.framework.component.ComponentException
compose
in interface org.apache.avalon.framework.component.Composable
public void dispose()
dispose
in interface org.apache.avalon.framework.activity.Disposable
public void parameterize(org.apache.avalon.framework.parameters.Parameters params) throws org.apache.avalon.framework.parameters.ParameterException
parameterize
in interface org.apache.avalon.framework.parameters.Parameterizable
public CacheValidity getTransformerValidity(Source stylesheet)
XSLTProcessor
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.
getTransformerValidity
in interface XSLTProcessor
org.apache.cocoon.components.xslt.XSLTProcessor
stylesheet
- a Source
valueCacheValidity
valuepublic javax.xml.transform.sax.TransformerHandler getTransformerHandler(Source stylesheet) throws ProcessingException
XSLTProcessor
XSLTProcessor.getTransformerHandler(Source,XMLFilter)
, with
filter
set to null
.getTransformerHandler
in interface XSLTProcessor
org.apache.cocoon.components.xslt.XSLTProcessor
stylesheet
- a Source
valueTransformerHandler
valueProcessingException
- if an error occursTraxTransformer.setConsumer(org.apache.cocoon.xml.XMLConsumer)
public javax.xml.transform.sax.TransformerHandler getTransformerHandler(Source stylesheet, org.xml.sax.XMLFilter filter) throws ProcessingException
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 Templates object with meta information (modification time and list of included stylesheets) and performs a reparsing only if this changes.
getTransformerHandler
in interface XSLTProcessor
org.apache.cocoon.components.xslt.XSLTProcessor
stylesheet
- a Source
valuefilter
- a XMLFilter
valueTransformerHandler
valueProcessingException
- if an error occurspublic void transform(Source source, Source stylesheet, org.apache.avalon.framework.parameters.Parameters params, javax.xml.transform.Result result) throws ProcessingException
XSLTProcessor
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.transform
in interface XSLTProcessor
org.apache.cocoon.components.xslt.XSLTProcessor
source
- a Source
valuestylesheet
- a Source
valueparams
- a Parameters
valueresult
- a Result
valueProcessingException
- if an error occurspublic javax.xml.transform.Source resolve(java.lang.String href, java.lang.String base) throws javax.xml.transform.TransformerException
resolve
in interface javax.xml.transform.URIResolver
href
- An href attribute, which may be relative or absolute.base
- The base URI in effect when the href attribute
was encountered.javax.xml.transform.TransformerException
- if an error occurs when trying to
resolve the URI.public void setSourceResolver(SourceResolver resolver)
XSLTProcessor
SourceResolver
for
this instance. The resolver
is invoked to return a
Source
object, given an HREF.setSourceResolver
in interface XSLTProcessor
org.apache.cocoon.components.xslt.XSLTProcessor
resolver
- a SourceResolver
value
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |