OpenWGA 5.4 - WebTML reference

WebTML tags

<tml:select>

Description :
Defines a collection of <tml:case> tags and executes the corresponding conditions.
Derived from: Attributes:
show inherited attributes ...
Name Value(s) Purpose
switch TML script expression Defines the TML script expression for this switch. The result is compared to the value attribute on the included <tml:case> tags.
testall true|false|t|f|1|0 If testall is 'true' all <tml:case> tags are evaluated even if one case value has already matched.

Details:
This tag can be used in two different ways:

Simple variant:
In this case <tml:select> only groups multiple <tml:case> tags in the body. <tml:select> evaluates if one case tag was executed. If none of the cases was executed and a <tml:caseelse> is present it will be evaluated.

Switch variant:
This variant is equivalent to the switch statement in modern programming languages like Java or C. In this variant the body of <tml:select> also contains a group of <tml:case> tags. In addition the attribute "switch" defines a TML script expression which is evaluated when the tag is rendered.
Each <tml:case> defines a value within the corresponding attribute. The value is compared to the result of the switch expression. If the value matches the result the corresponding case will be executed. This works for number and string values.
If no case value matches the switch result and a <tml:caseelse> is present it will be evaluated.
Examples:
Simple variant:
<tml:select>
    <tml:case condition="theLang == 'de'">German</tml:case>
    <tml:case condition="theLang == 'en'">English</tml:case>
    <tml:caseelse>unknown language</tml:caseelse>
</tml:select>

Switch variant:
<tml:select switch="theLang">
    <tml:case value="de">German</tml:case>
    <tml:case value="en">English</tml:case>
    <tml:caseelse>unknown language</tml:caseelse>
</tml:select>