public class XsltTransmogrifier<T> extends AbstractCachingXmlProcessor<Templates> implements org.openehealth.ipf.commons.core.modules.api.Transmogrifier<Source,T>
Source into an object of type T. The stylesheet to be used is passed with the
zap(Source, Object...) call, however, the Xslt Template object is cached for subsequent transformations
using this stylesheet.
Xslt parameters can be passed in as Map parameter.
Note: This class is thread-safe and reentrant.
AbstractCachingXmlProcessor.Loader<S>RESOURCE_LOCATION| Constructor and Description |
|---|
XsltTransmogrifier() |
XsltTransmogrifier(Class<T> outputFormat) |
XsltTransmogrifier(Class<T> outputFormat,
ClassLoader classLoader) |
XsltTransmogrifier(Class<T> outputFormat,
ClassLoader classLoader,
Map<String,Object> staticParams) |
XsltTransmogrifier(Class<T> outputFormat,
Map<String,Object> staticParams) |
| Modifier and Type | Method and Description |
|---|---|
protected Templates |
createResource(Object... params)
Creates a ready-to-use resource (e.g.
|
protected ConcurrentMap<String,AbstractCachingXmlProcessor.Loader<Templates>> |
getCache() |
TransformerFactory |
getFactory() |
Map<String,Object> |
getStaticParams() |
void |
setStaticParams(Map<String,Object> staticParams) |
protected void |
setXsltParameters(Transformer transformer,
Map<String,Object> param)
Sets the parameter to the
Transformer object |
T |
zap(Source source,
Object... params)
Converts a Source into a Result using a XSL processor.
|
resource, resourceCacheKey, resourceContent, resourceLocation, resourceParameterspublic XsltTransmogrifier()
public XsltTransmogrifier(Class<T> outputFormat, ClassLoader classLoader)
public XsltTransmogrifier(Class<T> outputFormat, Map<String,Object> staticParams)
public XsltTransmogrifier(Class<T> outputFormat, ClassLoader classLoader, Map<String,Object> staticParams)
outputFormat - currently supported: String, Writer, OutputStreamclassLoader - class loader for resource retrieval, may be nullstaticParams - static Xslt parameterspublic TransformerFactory getFactory()
protected ConcurrentMap<String,AbstractCachingXmlProcessor.Loader<Templates>> getCache()
getCache in class AbstractCachingXmlProcessor<Templates>public T zap(Source source, Object... params)
The XSL stylesheet resource location is mandatory in the first extra parameter. XSL Parameters may be passed as a Map in the second parameter.
protected void setXsltParameters(Transformer transformer, Map<String,Object> param)
Transformer objectprotected Templates createResource(Object... params)
AbstractCachingXmlProcessorcreateResource in class AbstractCachingXmlProcessor<Templates>params - validator/transmogrifier parameters.Copyright © 2020 Open eHealth Foundation. All rights reserved.