Conditions
To make choices based on conditions in BPEL 2.0, we use the <if>
activity to define the conditional branches, which replaced the <switch>
activity in BPEL 1.1. The <if>
activity can have several <elseif>
branches and one <else>
branch. The following example shows the structure of the <if>
activity:
<if> <condition>boolean-expression</condition> <!--activities --> <elseif> <condition>boolean-expression</condition> <!--activities --> </elseif> <elseif> <condition>boolean-expression</condition> <!--activities --> </elseif> ... <else> <!--activities --> </else> </if>
The Boolean expressions for the <condition>
elements are expressed in the XPath. We can use any valid XPath expression that returns a Boolean value. To use variables in conditions, we can use the $
operator, the same way as in assignments...