The BPEL editor has an extension function called 'doXslTranform' in its mapper tool, which can be used in a BPEL 'Assign' activity to call a XSLT transformation.
![]() |
Let us consider a trivial BPEL process example where we will use the 'doXSLTransform' function that takes an input message of 'shoe' and transforms it to an return message consisting of 'shoe{ShoeMart}' and a price of '$50.00' for the shoe.
The input variable '$InputVar' is defined by
<xsd:element name="inputString" type="xsd:string"></xsd:element>
The output variable '$OutputVar' is defined by
<xsd:complexType name="returnType">
<xsd:sequence>
<xsd:element name="product" type="xsd:string"/>
<xsd:element name="value" type="xsd:string"></xsd:element>
</xsd:sequence>
</xsd:complexType>
Clicking on the function name in the dropdown menu shown in the figure above will drop the functiod into the selected band in the mapper for the output message 'OutputVar'. The 'doXslTransform' functoid is as shown below.
![]() |
urn:stylesheets:SimpleTransform.xsl
We are ready to define the 'Assign' activity to call the XSLT transformation. The mapping using the 'doXslTransform' function is as shown.
![]() |
The generated code for the mapping is as shown
<assign name="doXslTranform">
<copy>
<from>ns1:doXslTransform('urn:stylesheets:SimpleTransform.xsl',
$InputVar.part1)
</from>
<to variable="OutputVar" part="part1"/>
</copy>
</assign>
So with a few simple steps we are able to call an XSL transform from within a BPEL 'Assign' activity. Now cerate 'Composite Application' project, include the BPEL project in it and deploy it to the Glassfish
integration server. See the Video - BPEL and Composite Application Authoring
for how to deploy and run a test using the Composite Application project suite.
![]() |
Create a test case in the composite application project and run it with the input file.
<soapenv:Envelope
xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/ http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:bran="http://j2ee.netbeans.org/wsdl/Brand">
<soapenv:Body>
<bran:inputString>shoe</bran:inputString>
</soapenv:Body>
</soapenv:Envelope>
and notice the correct output after the XSL file transformation in the output file.
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/ http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<ns1:returnElem xmlns:ns1="http://j2ee.netbeans.org/wsdl/Brand">
<product xmlns="">shoe[ShoeMart]</product>
<value xmlns="">$50.00</value>
</ns1:returnElem>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>