@Resource(type="xsl") public class XslContentHandlerFactory extends Object implements ContentHandlerFactory
DOMElementVisitor
Creator class.
Creates DOMElementVisitor
instances for performing node/element level
XSL templating (aka XSLT).
Template application can be done in a synchronized or unsynchronized fashion by setting
the system property "org.milyn.templating.xslt.synchronized". According to the spec,
this should not be necessary. However, Xalan 2.7.0 (for one) has a bug which results in
unsynchronized template application causing invalid transforms.
<resource-config selector="target-element"> <resource>XSL Resource - Inline orExample - URI based XSLT spec:URI
</resource> <!-- (Optional) The action to be applied on the template content. Should the content generated by the template: 1. replace ("replace") the target element, or 2. be added to ("addto") the target element, or 3. be inserted before ("insertbefore") the target element, or 4. be inserted after ("insertafter") the target element. 5. be bound to ("bindto") aBeanContext
variable named by the "bindId" param. Default "replace".--> <param name="action">replace/addto/insertbefore/insertafter/bindto</param> <!-- (Optional) Is this XSL template resource a complete XSL template, or just a "Templatelet". Only relevant for inlined XSL resources. URI based resource are always assumed to NOT be templatelets. Default "false" (for inline resources).--> <param name="is-xslt-templatelet">true/false</param> <!-- (Optional) Should the template be applied before (true) or after (false) Smooks visits the child elements of the target element. Default "false".--> <param name="applyTemplateBefore">true/false</param> <!-- (Optional) The name of theOutputStreamResource
to which the result should be written. If set, the "action" param is ignored. --> <param name="outputStreamResource">xyzResource</param> <!-- (Optional) Template encoding. Default "UTF-8".--> <param name="encoding">encoding</param> <!-- (Optional) bindId when "action" is "bindto". <param name="bindId">xxxx</param> <!-- (Optional) Fail on XSL Transformer Warning. Default "true".--> <param name="failOnWarning">false</param> <!-- Default "true" --> </resource-config>
<resource-config selector="target-element">
<!-- 1. See URIResourceLocator
-->
<resource>/com/acme/order-transform.xsl</resource>
</resource-config>
Example - Inlined XSLT spec:
<resource-config selector="target-element"> <!-- 1. Note how we have to specify the resource type when it's inlined. --> <!-- 2. Note how the inlined XSLT is wrapped as an XML Comment. CDATA Section wrapping also works. --> <!-- 3. Note if the inlined XSLT is a templatelet, is-xslt-templatelet=true must be specified. --> <resource type="xsl"> <!-- Inline XSLT.... --> </resource> <param name="is-xslt-templatelet">true</param> </resource-config>
XalanJavabeanExtension
.Modifier and Type | Field and Description |
---|---|
static String |
IS_XSLT_TEMPLATELET
Parameter name for templating feature.
|
static String |
ORG_MILYN_TEMPLATING_XSLT_SYNCHRONIZED
Synchonized template application system property key.
|
PARAM_RESTYPE
Constructor and Description |
---|
XslContentHandlerFactory() |
Modifier and Type | Method and Description |
---|---|
ContentHandler |
create(SmooksResourceConfiguration resourceConfig)
Create an XSL based ContentHandler instance ie from an XSL byte streamResult.
|
public static final String IS_XSLT_TEMPLATELET
public static final String ORG_MILYN_TEMPLATING_XSLT_SYNCHRONIZED
public ContentHandler create(SmooksResourceConfiguration resourceConfig) throws SmooksConfigurationException, InstantiationException
create
in interface ContentHandlerFactory
resourceConfig
- The SmooksResourceConfiguration for the XSL ContentHandler
to be created.ContentHandler
instance.SmooksConfigurationException
- Successfully created ContentHandler, but an error occured during configuration.InstantiationException
- Unable to create ContentHandler instance.JavaContentHandlerFactory
Copyright © 2020. All rights reserved.