Note: This example only works with the XQuery scriptengine extension.
This quickstart demonstrates how to use the Saxon XQuery script engine extension to transform data in camunda BPM.
The example includes a BPMN 2.0 process which invokes a simple script task which transforms two input XML documents into a single output XML output.
- BPMN source code
- XQuery transform
- Input data: names and skills
- Output data: output
- JUnit tests
The example XML files names and skills are loaded and passed as String input variables when starting the process.
A script task uses an XQuery transform to merge the two documents saved in the names
and skills
process variables. The script type is xquery
.
The transform output is saved in the process variable xmlOutput
as a String.
Converting String process variables into Documents in the transform, we apply the XQuery fn:parse-xml()
function.
declare namespace ns = "http://my.namespace/v1";
declare variable $names external;
declare variable $skills external;
let $namesDoc := fn:parse-xml($names)
let $skillsDoc := fn:parse-xml($skills)
Other than that, the XQuery transform is written in the usual way.
- Checkout the project with Git
- Read and run the JUnit tests
Note that testing the transform without going through the process engine is also supported.