Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The XSLT Mediator applies a specified XSLT transformation to a selected element of the current message payload. The source attribute specifies which element to be selected to apply the given XSLT transformationtransform. In the case where the source element is not specified, it uses the first child of the soap SOAP body as the selected element. Optionally, parameters can be passed into the transformations through the property elements. These properties are corresponding correspond to the XSL parameters and can be accessed during transformation by <xsl:param name="the name of the property"/>.

The feature element defines any features which that should be explicitly set to the TransformerFactory. The Setting feature: to http://ws.apache.org/ns/synapse/transform/feature/dom turns on DOM-based transformations instead of serializing elements into Byte byte streams and/or temporary files. Though this can be better in performance than using byte streams, sometimes it may This approach can improve performance but might not work for all transformations.

Finally, the The resource element can be used to resolve XSLT imports and includes from the repository. It works in exactly the same way as the corresponding element in a <proxy> definition (Proxy Service).

...

Table of Contents
maxLevel3
minLevel3

...

styleborder:1
locationtop
typeflat
separatorpipe

...

Syntax

Code Block
XML
XML

<xslt key="string" [source="xpath"]>
     <property name="string" (value="literal" | expression="xpath")/>*
     <feature name="string" value="true| false" />*
     <resource location="string" key="string"/>*
</xslt>

...

  • source - Specifies which element to be selected to apply the given XSLT transformation. In the case where the source element is not specified, it uses the first child of the soap body as the selected element.
  • property - Allows optional parameters to be passed into the transformations. These properties are corresponding to the XSL parameters and can be accessed during transformation.
  • feature - Defines any features which that should be explicitly set to the TransformerFactory. The Setting feature, to http://ws.apache.org/ns/synapse/transform/feature/dom turns on DOM-based transformations instead of serializing elements into Byte byte streams and/or temporary files. Though this can be better in performance than using byte streams, sometimes it may This approach can improve performance but might not work for all transformations.
  • resource - Resolves XSLT imports and includes from the repository. It works in exactly the same way as the corresponding element in a <proxy> definition (Proxy Service).

...

  • Key Type - Specifies either to use Static or Dynamic Key type.
  • Key - Specifies the registry key to refer the XSLT to. This supports static and dynamic keys.
  • Source- Specifies in which part of the message (specified in XPath) the XSLT should be applied. The default is the SOAP body of the message. It can be added in the Namespace Editor.

    Info
    titleTip

    You can click this link to add namespaces if you are providing an expression. You will be provided another panel named "Namespace Editor," where you can provide any number of namespace prefixes and URL that you have used in the XPath expression.

  • Properties of XSLT mediator - Manage the properties which would be referred from the XSLT in transformation (using get-property(prop-name)XPath extension function).
    • Property Name - Names the property.
    • Property Type - Specifies whether it is a static value or an XPath expression.
    • Value/Expression - Defines the static value or the XPath expression.
    • Action - Allows to delete the property.
  • Features of the XSLT mediator-Specifies the features to be enabled in the XSLT transformation. Read the introduction paragraph of this guide for an example feature.
    • Feature Name - Names the feature.
    • Feature Value - Specifies whether the feature is turn on (True) or Not (False).
    • Action - Allows to delete the feature.
Info
titleNote

You can configure the Mediator using XML. Click on "switch to source view" in the "Mediator" window.

...

Example

Code Block
XML
XML

<xslt xmlns="http://ws.apache.org/ns/synapse" key="transform/example.xslt" source="s11:Body/child" />

In this example, the XSLT can be picked by the key transform/example.xslt and the XSLT would be applied to a part of the message that is specified as an XPath expression. In this case, it is applied to s11:Body/child the message.

Excerpt
hiddentrue

Description of the XSLT Mediator in WSO2 ESB.