In this recipe, we will examine how the functions are used in the XSLT mapper. The functions provide a convenient way of transforming data in a BPEL process. In this recipe, we will use some of the available functions, such as the multiply operation and the if branch statement.
For this recipe, we will take the example from the Performing copy between the variables recipe. We will extend the example by using a function to add a margin to the rent price of the car.
The following steps describe the actions needed to use the functions in the XSLT transformations:
We connect the input and output connector of the mathematical function, with the price node from the source and target schema respectively.
We enter the source node into field 1 (/ns0:TempElement/ns0:pieces[4]
) and insert the margin into field 2 (1.05
).
The functions we define in the XSLT mapper are stored in the XSL file. JDeveloper provides a convenient way of creating the transformation files. Behind the scenes, JDeveloper is building the XSL file. The XSLT mapper also performs real-time checking of the transformation file. For example, if we put the if xslt
construct into the mapper pane, it immediately becomes marked with the error icon as shown in the following screenshot:
The transformation file is, when finished, interpreted by the built-in XSLT engine when transforming the source variable to the target variable.
Oracle SOA Suite provides a number of functions that we can utilize for transformation purposes as follows:
Function Group |
Description |
---|---|
Conversion Functions |
Mainly contains the functions to convert the |
Date Functions |
Contains the date manipulation and formatting functions. |
Logical Functions |
This contains the logical operators such as <, >, =, true, false, or, not, and so on. |
Mathematical Functions |
Contains the mathematical functions such as abs, ceiling, sum, and so on. |
Node-set Functions |
This section enables various operations on the variables from the XML point of view. For example, the name function returns the name of the XML node. |
String Functions |
This section contains a number of string operation functions. Here, we also find the concat, compare, and contains functions. |
XSLT Constructs |
Contains the most important XSLT constructs. We find here the following constructs: choose, copy-of, for-each, if, otherwise, sort, variable, and when. |