XQuery SupportThe XQuery Module gives users the ability to perform XQuery transformations on XML messages in Mule. This works in a very similar way to the XSLT Transformer shipped with Mule.
To use the XQuery transformer you need to add it to your Mule Xml configuration
Here we are configuring a transformer using in-line XQuery expressions.
We also define 2
<context-property> elements -
These properties are pulled from the current message and made available in the XQuery context so that they can be referenced in your XQuery statements. These can be object references or you can use Mule Expressions to get information from the current message.
Now your configured XQuery transformer can be referenced by an endpoint. In the following example, you can drop and XML file into a directory on the local machine (see the inbound file endpoint) and the result will be written to
The test data looks like -
The result written to
System.out will look like -
The full configuration for this examples looks like -
This can be tested using the following functional test -