|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.cocoon.util.AbstractLogEnabled org.apache.cocoon.components.xslt.XSLTProcessorImpl
Adaptation of Excalibur's XSLTProcessor implementation to allow for better error reporting. This is a bean implementation that can be configured in a spring context.
Nested Class Summary | |
static class |
XSLTProcessorImpl.MyTransformerHandlerAndValidity
Subclass to allow for instanciation, as for some unknown reason the constructor is protected.... |
Nested classes inherited from class org.apache.cocoon.components.xslt.XSLTProcessor |
XSLTProcessor.TransformerHandlerAndValidity |
Field Summary | |
protected boolean |
checkIncludes
Check included stylesheets |
protected SAXTransformerFactory |
factory
The trax TransformerFactory this component uses |
protected Map |
includesMap
Map of pairs of System ID's / validities of the included stylesheets |
protected boolean |
incrementalProcessing
Is incremental processing turned on? (default for Xalan: no) |
protected SourceResolver |
resolver
Resolver used to resolve XSLT document() calls, imports and includes |
protected org.apache.cocoon.core.xml.SAXParser |
saxParser
|
protected Store |
store
The store service instance |
protected String |
transformerFactory
The configured transformer factory to use |
Constructor Summary | |
XSLTProcessorImpl()
|
Method Summary | |
TransformerHandler |
getTransformerHandler(Source stylesheet)
Same as getTransformerHandler(Source,XMLFilter) , with
filter set to null . |
TransformerHandler |
getTransformerHandler(Source stylesheet,
XMLFilter filter)
Return a TransformerHandler for a given
stylesheet Source . |
XSLTProcessor.TransformerHandlerAndValidity |
getTransformerHandlerAndValidity(Source stylesheet)
Same as getTransformerHandlerAndValidity(Source,XMLFilter) , with
filter set to null . |
XSLTProcessor.TransformerHandlerAndValidity |
getTransformerHandlerAndValidity(Source stylesheet,
XMLFilter filter)
Return a TransformerHandler and
SourceValidity for a given stylesheet
Source . |
void |
init()
Initialize this component. |
Source |
resolve(String href,
String base)
Called by the processor when it encounters an xsl:include, xsl:import, or document() function. |
void |
setCheckIncludes(boolean checkIncludes)
|
void |
setIncrementalProcessing(boolean incrementalProcessing)
|
void |
setResolver(SourceResolver resolver)
|
void |
setSaxParser(org.apache.cocoon.core.xml.SAXParser saxParser)
|
void |
setStore(Store store)
|
void |
setTransformerFactory(String classname)
Set the transformer factory used by this component |
void |
transform(Source source,
Source stylesheet,
Map params,
Result result)
Applies an XSLT stylesheet to an XML document. |
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 |
protected Store store
protected String transformerFactory
protected SAXTransformerFactory factory
protected boolean incrementalProcessing
protected SourceResolver resolver
protected boolean checkIncludes
protected Map includesMap
protected org.apache.cocoon.core.xml.SAXParser saxParser
Constructor Detail |
public XSLTProcessorImpl()
Method Detail |
public void init() throws Exception
Exception
public void setStore(Store store)
public void setIncrementalProcessing(boolean incrementalProcessing)
public void setResolver(SourceResolver resolver)
public void setCheckIncludes(boolean checkIncludes)
public void setSaxParser(org.apache.cocoon.core.xml.SAXParser saxParser)
public void setTransformerFactory(String classname)
public TransformerHandler getTransformerHandler(Source stylesheet) throws XSLTProcessorException
XSLTProcessor
XSLTProcessor.getTransformerHandler(Source,XMLFilter)
, with
filter
set to null
.
getTransformerHandler
in interface XSLTProcessor
stylesheet
- a Source
value
TransformerHandler
value
XSLTProcessorException
- if an error occursXSLTProcessor.getTransformerHandler(org.apache.excalibur.source.Source)
public TransformerHandler getTransformerHandler(Source stylesheet, XMLFilter filter) throws XSLTProcessorException
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
stylesheet
- a Source
valuefilter
- a XMLFilter
value
TransformerHandler
value
XSLTProcessorException
- if an error occursXSLTProcessor.getTransformerHandler(org.apache.excalibur.source.Source,
org.xml.sax.XMLFilter)
public XSLTProcessor.TransformerHandlerAndValidity getTransformerHandlerAndValidity(Source stylesheet) throws XSLTProcessorException
XSLTProcessor
XSLTProcessor.getTransformerHandlerAndValidity(Source,XMLFilter)
, with
filter
set to null
.
getTransformerHandlerAndValidity
in interface XSLTProcessor
stylesheet
- a Source
value
XSLTProcessor.TransformerHandlerAndValidity
value
XSLTProcessorException
- if an error occursXSLTProcessor.getTransformerHandlerAndValidity(org.apache.excalibur.source.Source)
public XSLTProcessor.TransformerHandlerAndValidity getTransformerHandlerAndValidity(Source stylesheet, XMLFilter filter) throws XSLTProcessorException
XSLTProcessor
Return a TransformerHandler
and
SourceValidity
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.
getTransformerHandlerAndValidity
in interface XSLTProcessor
stylesheet
- a Source
valuefilter
- a XMLFilter
value
TransformerHandlerAndValidity
value
XSLTProcessorException
- if an error occursXSLTProcessor.getTransformerHandlerAndValidity(org.apache.excalibur.source.Source, org.xml.sax.XMLFilter)
public void transform(Source source, Source stylesheet, Map params, Result result) throws XSLTProcessorException
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 Map
result
- a Result
value
XSLTProcessorException
- if an error occursXSLTProcessor.transform(org.apache.excalibur.source.Source, org.apache.excalibur.source.Source, java.util.Map, javax.xml.transform.Result)
public 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 |