This documentation is for WSO2 Enterprise Integrator version 6.5.0 . View documentation for the latest release in the 6.x.x family and the latest release in the 7.x.x family.

All docs This doc
||
Skip to end of metadata
Go to start of metadata

Objective

This sample explains the usage of XslTransform() function.

Introducing XslTransform() Function

doXslTransform(string, node-set, (string, object)*) function is used to perform XSLT transformations, where BPEL variable values can be transformed into different schema. For more details on input parameters, refer to http://docs.oasis-open.org/wsbpel/2.0/CS01/wsbpel-v2.0-CS01.html#SA00039_table

Required name spaces:

doXslTransform() should be defined under "http://docs.oasis-open.org/wsbpel/2.0/process/executable" namespace.

Deploying the Sample

WSO2 BPS provides a sample, which can be deployed and executed to understand the function. Follow the instructions below to deploy and trigger the process.

1. Log in into BPS server management console and select "Processes -> Add" under the "Main" menu.

2. Upload the <EI_HOME>/samples/business-process/bpel/XslTransform.zip directory. 

3. In the "Deployed Processes" window, click the "Process ID" to access its "Process Information" window.

4. Under the "WSDL Details" widget, trigger the process using the "TryIt" link to create an instance of it.

Example Usage

Refer to XslTransform.zip and the example usage of the function as given below: 

<copy>
    <from>
        bpws:doXslTransform("HelloXslWorld.xsl", $myVar.TestPart, 'middle', $otherVar)
    </from>
    <tovariable="myVar"part="TestPart"/>
</copy>

In the above doXslTransform(), four parameters are passed.

  • HelloXslWorld.xsl - Style sheet file.
  • $myVar.TestPart - Input source to be transformed.
  • middle - Name of the object to be used in the transformation.
  • $otherVar - Object which will be referred as 'middle'.

The doXslTransform()function accepts pairs of string and objects, so that they can be referred in the style sheet. For example, in HelloXslWorld.xsl:

<xsl:value-ofselect="concat(*/content/text(), $middle, ' World')"/>
  • No labels