Attributes

The select-if Attribute

Many elements have an optional select-if attribute. The value of this attribute (after property expansion) can be either ‘true’ or ‘false’ or a comparison expression in the form ‘value1=vaue2’. If the attribute evaluates to false, the element is ignored. This can be used for dynamic selection of elements based on variable data. For example, a query definition may contain multiple <select> elements. A particular select element can be chosen at runtime based on the value of a property.

    <select select-if="${query_type}=quick">
        <![CDATA[
        … 
        ]]>
    </select>
    <select>
        <![CDATA[
        …
        ]]>
    </select>

If at runtime the property ${query_type} contains the value “quick”, the first select element gets executed, else the second element will be processed.

The property element also supports the select-if attribute:

<finally>
    <property name="my_property"
              value="${dialog_title}"
              select-if="${@isset:myflag}"/>
</finally>

The property ${my_property} gets initialized only, if ${myflag} is set.