Executes conditional statement. Sequentially checks if some of the specified conditions in inner if elements is satisfied and if found one returns its body as the result. If no true statement is found result of execution is body of else statement if specified, or empty value otherwise.

Syntax

<case>
    [<if condition="expression">
        if body
    </if>] *
    [<else>
        else body
    </else>]
</case>

Attributes

Name Required Default Description
condition yes If true (yes), body of if is evaluated.

Example

<var-def name="contact">
    <xpath expression="//a[contains(., 'contact')]/@href">
        <var name="pageContent"/>
    </xpath>
</var-def>

<var-def name="contactMail">
    <case>
        <if condition="${contact.toString() != ''}">
            <var name="contact"/>
        </if>
        <else>
            Contact is not defined!
        </else>
    </case>
</var-def>

Here, conditional processor is used to check if previous xpath search has found contact information on the page.