public class XslContentHandlerFactory extends Object implements org.smooks.api.delivery.ContentHandlerFactory
org.smooks.api.resource.visitor.dom.DOMElementVisitor Creator class.
Creates org.smooks.api.resource.visitor.dom.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.smooks.cartridges.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 or 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 ("ADD_TO") the target element, or
3. be inserted before ("INSERT_BEFORE") the target element, or
4. be inserted after ("INSERT_AFTER") the target element.
5. be bound to ("BIND_TO") a BeanContext variable named by the "bindId" param.
Default "replace".-->
<param name="action">REPLACE/ADD_TO/INSERT_BEFORE/INSERT_AFTER/BIND_TO</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 the OutputStreamResource
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 "BIND_TO".
<param name="bindId">xxxx</param>
<!-- (Optional) Fail on XSL Transformer Warning.
Default "true".-->
<param name="failOnWarning">false</param> <!-- Default "true" -->
</resource-config>
Example - URI based XSLT spec:
<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.
|
| Constructor and Description |
|---|
XslContentHandlerFactory() |
| Modifier and Type | Method and Description |
|---|---|
org.smooks.api.delivery.ContentHandler |
create(org.smooks.api.resource.config.ResourceConfig resourceConfig)
Create an XSL based ContentHandler instance ie from an XSL byte streamResult.
|
String |
getType() |
public static final String IS_XSLT_TEMPLATELET
public static final String ORG_MILYN_TEMPLATING_XSLT_SYNCHRONIZED
public org.smooks.api.delivery.ContentHandler create(org.smooks.api.resource.config.ResourceConfig resourceConfig)
throws org.smooks.api.SmooksConfigException
create in interface org.smooks.api.delivery.ContentHandlerFactoryresourceConfig - The SmooksResourceConfiguration for the XSL ContentHandler
to be created.ContentHandler instance.org.smooks.api.SmooksConfigExceptionJavaContentHandlerFactorypublic String getType()
getType in interface org.smooks.api.delivery.ContentHandlerFactoryCopyright © 2024. All rights reserved.