|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.fulcrum.xslt.DefaultXSLTService
public class DefaultXSLTService
Implementation of the Turbine XSLT Service. It transforms xml with a given xsl file. XSL stylesheets are compiled and cached (if the service property is set) to improve speeds.
Field Summary | |
---|---|
protected Hashtable |
cache
Cache of compiled Templates. |
protected boolean |
caching
Property to control the caching of Templates. |
protected String |
path
Path to style sheets used for tranforming well-formed XML documents. |
protected static String |
STYLESHEET_CACHING
|
protected static String |
STYLESHEET_PATH
|
Fields inherited from interface org.apache.fulcrum.xslt.XSLTService |
---|
ROLE |
Constructor Summary | |
---|---|
DefaultXSLTService()
|
Method Summary | |
---|---|
protected Templates |
compileTemplates(URL source)
Compile Templates from an input file. |
void |
configure(org.apache.avalon.framework.configuration.Configuration conf)
Avalon component lifecycle method This method processes the repository path, to make it relative to the web application root, if neccessary. |
void |
contextualize(org.apache.avalon.framework.context.Context context)
|
protected Templates |
getTemplates(String xslName)
Retrieves Templates. |
Transformer |
getTransformer(String xslName)
Retrieve a transformer for the given stylesheet name. |
void |
initialize()
Initializes the service. |
void |
service(org.apache.avalon.framework.service.ServiceManager manager)
Avalon component lifecycle method |
String |
transform(String xslName,
Map params)
Uses an xsl file without any input. |
String |
transform(String xslName,
Node in)
Uses an xsl file to transform xml input from a DOM note and returns a string containing the transformed output. |
String |
transform(String xslName,
Node in,
Map params)
Uses an xsl file to transform xml input from a DOM note and returns a string containing the transformed output. |
void |
transform(String xslName,
Node in,
Writer out)
Uses an xsl file to transform xml input from a DOM note and writes the output to a writer. |
void |
transform(String xslName,
Node in,
Writer out,
Map params)
Uses an xsl file to transform xml input from a DOM note and writes the output to a writer. |
String |
transform(String xslName,
Reader in)
Uses an xsl file to transform xml input from a reader and returns a string containing the transformed output. |
String |
transform(String xslName,
Reader in,
Map params)
Uses an xsl file to transform xml input from a reader and returns a string containing the transformed output. |
void |
transform(String xslName,
Reader in,
Writer out)
Uses an xsl file to transform xml input from a reader and writes the output to a writer. |
void |
transform(String xslName,
Reader in,
Writer out,
Map params)
Uses an xsl file to transform xml input from a reader and writes the output to a writer. |
protected void |
transform(String xslName,
Source xmlin,
Result xmlout,
Map params)
|
void |
transform(String xslName,
Writer out,
Map params)
Uses an xsl file without any xml input (simplified stylesheet) |
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 boolean caching
protected String path
protected Hashtable cache
protected static final String STYLESHEET_PATH
protected static final String STYLESHEET_CACHING
Constructor Detail |
---|
public DefaultXSLTService()
Method Detail |
---|
protected Templates compileTemplates(URL source) throws Exception
source
- the source URL
Exception
- the compilation failedprotected Templates getTemplates(String xslName) throws Exception
This method is synchronized on the xsl cache so that a thread does not attempt to load Templates from the cache while it is still being compiled.
xslName
- the name of the XSL file
Exception
- getting the template failedprotected void transform(String xslName, Source xmlin, Result xmlout, Map params) throws Exception
Exception
public void transform(String xslName, Reader in, Writer out) throws Exception
transform
in interface XSLTService
xslName
- The name of the file that contains the xsl stylesheet.in
- The reader that passes the xml to be transformedout
- The writer for the transformed output
Exception
- the transformation failedpublic String transform(String xslName, Reader in) throws Exception
transform
in interface XSLTService
xslName
- The name of the file that contains the xsl stylesheet.in
- The reader that passes the xml to be transformed
Exception
- the transformation failedpublic void transform(String xslName, Node in, Writer out) throws Exception
transform
in interface XSLTService
xslName
- The name of the file that contains the xsl stylesheet.in
- The DOM Node to be transformedout
- The writer for the transformed output
Exception
- the transformation failedpublic String transform(String xslName, Node in) throws Exception
transform
in interface XSLTService
xslName
- The name of the file that contains the xsl stylesheet.in
- The DOM Node to be transformed
Exception
- the transformation failedpublic void transform(String xslName, Reader in, Writer out, Map params) throws Exception
transform
in interface XSLTService
xslName
- The name of the file that contains the xsl stylesheet.in
- The reader that passes the xml to be transformedout
- The writer for the transformed outputparams
- A set of parameters that will be forwarded to the XSLT
Exception
- the transformation failedpublic String transform(String xslName, Reader in, Map params) throws Exception
transform
in interface XSLTService
xslName
- The name of the file that contains the xsl stylesheet.in
- The reader that passes the xml to be transformedparams
- A set of parameters that will be forwarded to the XSLT
Exception
- the transformation failedpublic void transform(String xslName, Node in, Writer out, Map params) throws Exception
transform
in interface XSLTService
xslName
- The name of the file that contains the xsl stylesheet.in
- The DOM Node to be transformedout
- The writer for the transformed outputparams
- A set of parameters that will be forwarded to the XSLT
Exception
- the transformation failedpublic String transform(String xslName, Node in, Map params) throws Exception
transform
in interface XSLTService
xslName
- The name of the file that contains the xsl stylesheet.in
- The DOM Node to be transformedparams
- A set of parameters that will be forwarded to the XSLT
Exception
- the transformation failedpublic String transform(String xslName, Map params) throws Exception
transform
in interface XSLTService
xslName
- The name of the file that contains the xsl stylesheet.params
- A set of parameters that will be forwarded to the XSLT
Exception
- the transformation failedpublic void transform(String xslName, Writer out, Map params) throws Exception
transform
in interface XSLTService
xslName
- The name of the file that contains the xsl stylesheetout
- The writer for the transformed output.params
- A set of parameters that will be forwarded to the XSLT
Exception
- the transformation failedpublic Transformer getTransformer(String xslName) throws Exception
transform(java.lang.String, javax.xml.transform.Source, javax.xml.transform.Result, java.util.Map)
.
xslName
- Identifies stylesheet to get transformer for
Exception
- retrieving the transformer failedpublic void configure(org.apache.avalon.framework.configuration.Configuration conf) throws org.apache.avalon.framework.configuration.ConfigurationException
configure
in interface org.apache.avalon.framework.configuration.Configurable
org.apache.avalon.framework.configuration.ConfigurationException
public void initialize() throws Exception
initialize
in interface org.apache.avalon.framework.activity.Initializable
Exception
public void contextualize(org.apache.avalon.framework.context.Context context) throws org.apache.avalon.framework.context.ContextException
contextualize
in interface org.apache.avalon.framework.context.Contextualizable
org.apache.avalon.framework.context.ContextException
public void service(org.apache.avalon.framework.service.ServiceManager manager)
service
in interface org.apache.avalon.framework.service.Serviceable
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |