Defining a variable
This recipe will examine how to define a variable on the target side. Similar to the previous recipe, we will amend the example from the Using the xsl:for-each command recipe by adding a variable to the target part. The variables can be useful when we need a particular piece of information from a BPEL process or when we need to define a constant value which is then used in different places in the transformation. In this recipe, we will create a variable and assign a value to it. The content of the variable presents the rebate on the price of the available cars.
How to do it…
The following steps will describe how to add a variable to the transformation and assign a value to it. On the mapper pane, we right-click on the target side and select Add Variable…. A dialog box opens where we define the variable name and optionally its value as shown in the following screenshot:
Now that we have defined the variable and set its value, we calculate the rent price of the car and round...