Apache ODE extends the default XPath coverage provided by the WS-BPEL
specification mostly by adding support for XPath 2.0
and by offering a few utility extension functions to make some assignments easier.
XPath 2.0
To use XPath 2.0 in your processes just use the following queryLanguage and expressionLanguage attributes:
queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
If you want support at the process just add these attributes to your root process element. If you want to stick with XPath 1.0 but want XPath 2.0 support for a specific assignment you can also define these attributes on an assign element.
Extension Functions
All extension fucntions are defined in the ODE extension namespace: http://www.apache.org/ode/type/extension
. This namespace will be associated with the ode prefix in the following examples.
splitToElements
It's impossible to split a given string into a sequence of elements using assignments. The only possible alternative is XSL which is a lot of complexity for a very simple usage pattern. The ode:splitToElements function splits a given string (that can be a variable reference) into several elements by using a specific separators. Here is an example:
<assign>
<from>ode:splitToElements($authorizeMessage.credential/userList, ',', 'user')</from>
<to>$authorizedUsers</to>
</assign>
If the source element contains a list like "joe, paul, fred" the target variable will be assigned the sequence of elements:
<user>joe</user>
<user>paul</user>
<user>fred</user>
Alternatively this function can take a fourth parameter that would be the namespace of the elements used to wrap the split strings:
ode:splitToElements(stringToSplit, separator, targetElement, targetNamespace)