org.apache.synapse.mediators.transform
Class XSLTMediator

java.lang.Object
  extended by org.apache.synapse.mediators.AbstractMediator
      extended by org.apache.synapse.mediators.transform.XSLTMediator
All Implemented Interfaces:
AspectConfigurable, Mediator, SynapseArtifact

public class XSLTMediator
extends AbstractMediator

The XSLT mediator performs an XSLT transformation requested, using the current message. The source attribute (if available) specifies the source element on which the transformation would be applied. It will default to the first child of the messages' SOAP body, if it is omitted.

Additional properties passed into this mediator would become parameters for XSLT. Additional features passed into this mediator would become features except for "http://ws.apache.org/ns/synapse/transform/feature/dom" for the Transformer Factory, which is used to decide between using DOM and Streams during the transformation process. By default this is turned on as an optimization, but should be set to false if issues are detected

Note: Set the TransformerFactory system property to generate and use translets -Djavax.xml.transform.TransformerFactory=org.apache.xalan.xsltc.trax.TransformerFactoryImpl


Field Summary
static String RESULT_BUILDER_FACTORY
          The name of the attribute that allows to specify the ResultBuilderFactory.
static String SOURCE_BUILDER_FACTORY
          The name of the attribute that allows to specify the SourceBuilderFactory.
static String USE_DOM_SOURCE_AND_RESULTS
          The feature for which deciding switching between DOM and Stream during the transformation process
 
Fields inherited from class org.apache.synapse.mediators.AbstractMediator
log, trace, traceState
 
Constructor Summary
XSLTMediator()
           
 
Method Summary
 void addAllProperties(List<MediatorProperty> list)
           
 void addAttribute(String name, String value)
          Add an attribute to be set on the TransformerFactory used by this mediator instance.
 void addFeature(String featureName, boolean isFeatureEnable)
          Add a feature to be set on the TransformerFactory used by this mediator instance.
 void addProperty(MediatorProperty p)
           
 List<MediatorProperty> getAttributes()
           
 List<MediatorProperty> getFeatures()
           
 List<MediatorProperty> getProperties()
           
 ResourceMap getResourceMap()
           
 SynapseXPath getSource()
           
 String getTargetPropertyName()
           
 Value getXsltKey()
           
 boolean mediate(MessageContext synCtx)
          Transforms this message (or its element specified as the source) using the given XSLT transformation
 void setResourceMap(ResourceMap resourceMap)
           
 void setSource(SynapseXPath source)
           
 void setSourceXPathString(String sourceXPathString)
           
 void setTargetPropertyName(String targetPropertyName)
           
 void setXsltKey(Value xsltKey)
           
 
Methods inherited from class org.apache.synapse.mediators.AbstractMediator
auditLog, auditWarn, configure, disableStatistics, enableStatistics, getAspectConfiguration, getDescription, getLog, getTraceState, getType, handleException, handleException, isStatisticsEnable, isTraceOn, isTraceOrDebugOn, setDescription, setEffectiveTraceState, setTraceState, shouldTrace, traceOrDebug, traceOrDebugWarn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

USE_DOM_SOURCE_AND_RESULTS

public static final String USE_DOM_SOURCE_AND_RESULTS
The feature for which deciding switching between DOM and Stream during the transformation process

See Also:
Constant Field Values

SOURCE_BUILDER_FACTORY

public static final String SOURCE_BUILDER_FACTORY
The name of the attribute that allows to specify the SourceBuilderFactory.

See Also:
Constant Field Values

RESULT_BUILDER_FACTORY

public static final String RESULT_BUILDER_FACTORY
The name of the attribute that allows to specify the ResultBuilderFactory.

See Also:
Constant Field Values
Constructor Detail

XSLTMediator

public XSLTMediator()
Method Detail

mediate

public boolean mediate(MessageContext synCtx)
Transforms this message (or its element specified as the source) using the given XSLT transformation

Parameters:
synCtx - the current message where the transformation will apply
Returns:
true always

getSource

public SynapseXPath getSource()

setSource

public void setSource(SynapseXPath source)

getXsltKey

public Value getXsltKey()

setXsltKey

public void setXsltKey(Value xsltKey)

addProperty

public void addProperty(MediatorProperty p)

addFeature

public void addFeature(String featureName,
                       boolean isFeatureEnable)
Add a feature to be set on the TransformerFactory used by this mediator instance. This method can also be used to enable some Synapse specific optimizations and enhancements as described in the documentation of this class.

Parameters:
featureName - The name of the feature
isFeatureEnable - the desired state of the feature
See Also:
TransformerFactory.setFeature(String, boolean), XSLTMediator

addAttribute

public void addAttribute(String name,
                         String value)
Add an attribute to be set on the TransformerFactory used by this mediator instance. This method can also be used to enable some Synapse specific optimizations and enhancements as described in the documentation of this class.

Parameters:
name - The name of the feature
value - should this feature enable?
See Also:
TransformerFactory.setAttribute(String, Object), XSLTMediator

getFeatures

public List<MediatorProperty> getFeatures()
Returns:
Return the features explicitly set to the TransformerFactory through this mediator.

getAttributes

public List<MediatorProperty> getAttributes()
Returns:
Return the attributes explicitly set to the TransformerFactory through this mediator.

addAllProperties

public void addAllProperties(List<MediatorProperty> list)

getProperties

public List<MediatorProperty> getProperties()

setSourceXPathString

public void setSourceXPathString(String sourceXPathString)

getTargetPropertyName

public String getTargetPropertyName()

setTargetPropertyName

public void setTargetPropertyName(String targetPropertyName)

getResourceMap

public ResourceMap getResourceMap()

setResourceMap

public void setResourceMap(ResourceMap resourceMap)


Copyright © 2005-2012 Apache Software Foundation. All Rights Reserved.