|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.avalon.framework.logger.AbstractLogEnabled org.apache.cocoon.components.xslt.XSLTProcessorImpl
public class 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 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 |
---|
protected ComponentManager manager
protected Store store
protected HashMap factories
protected SAXTransformerFactory factory
protected boolean useStore
protected boolean incrementalProcessing
protected SourceResolver resolver
protected TraxErrorHandler errorHandler
Constructor Detail |
---|
public XSLTProcessorImpl()
Method Detail |
---|
public void compose(ComponentManager manager) throws ComponentException
compose
in interface Composable
ComponentException
public void dispose()
dispose
in interface Disposable
public void parameterize(Parameters params) throws ParameterException
parameterize
in interface Parameterizable
ParameterException
public void setSourceResolver(SourceResolver resolver)
setSourceResolver
in interface XSLTProcessor
resolver
- a SourceResolver
valuepublic void setTransformerFactory(String classname)
setTransformerFactory
in interface XSLTProcessor
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.public TransformerHandler getTransformerHandler(Source stylesheet) throws ProcessingException
XSLTProcessor
XSLTProcessor.getTransformerHandler(Source,XMLFilter)
, with
filter
set to null
and factory
set to null
.
getTransformerHandler
in interface XSLTProcessor
stylesheet
- a Source
value
TransformerHandler
value
ProcessingException
- if an error occursTraxTransformer.setConsumer(org.apache.cocoon.xml.XMLConsumer)
public TransformerHandler getTransformerHandler(Source stylesheet, 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 Source object and performs a reparsing only if this changes.
getTransformerHandler
in interface XSLTProcessor
stylesheet
- a Source
valuefilter
- a XMLFilter
value
TransformerHandler
value
ProcessingException
- if an error occurspublic void transform(Source source, Source stylesheet, Parameters params, 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
source
- a Source
valuestylesheet
- a Source
valueparams
- a Parameters
valueresult
- a Result
value
ProcessingException
- if an error occurspublic Source resolve(String href, String base) throws TransformerException
resolve
in interface URIResolver
href
- An href attribute, which may be relative or absolute.base
- The base URI in effect when the href attribute
was encountered.
TransformerException
- if an error occurs when trying to
resolve the URI.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |