OpenWGA 7.6 - WebTML reference

WebTML tags

<tml:if>

Description :

Simple condition tag, that is used to build an if/then/else selection.

This tag, together with subtags <tml:then>, <tml:elseif> and <tml:else> ,are used to build the structure of the selection. The <tml:if> tag defines the first condition with the available WebTML condition attributes. It depends on the result of the condition evaluation what subtags will render their contents. If the condition is "true" it will be the content of <tml:then>. If not then available <tml:elseif> tags will evaluate their conditions and put our their contents if they evaluate to "true". If no condition is "true" then an optional <tml:else> tag may render its contents.

Always use <tml:if> at least with one <tml:then> contained! <tml:if> always renders its direct contents even if the condition is false (although it hides the output then). Only the content of a contained <tml:then> is really skipped in the case of the condition being false, saving processing time and really avoiding unwanted operations.

However in cases where only the <tml:if/then> tags are needed it is easier to use the simpler condition tag <tml:case>.

Derived from: Attributes:
show inherited attributes ...
Name Value(s) Purpose

Examples:

A simple example demonstrating a complete if/then/elseif/else selection structure. Note that the usage of <tml:elseif> and <tml:else> are optional and that a single <tml:if> tag may take as many <tml:elseif> as needed:

<tml:if condition="...">
    <tml:then>
        This code is executed when the if-condition is true.
    </tml:then>
    <tml:elseif condition="...">
        This code is executed when the elseif-condition is true.
    </tml:elseif>
    <tml:elseif condition="...">
        This code is executed when the elseif-condition is true.
    </tml:elseif>
    <tml:else>
        This code is executed when neither the if-condition nor the elseif-conditions are true.
    </tml:else>
</tml:if>