Docs GODI Archive
Projects Blog Knowledge

Look up function:

(e.g. "List.find" or "keysym")
More options

The UI language
 ui:alist-value and ui:alist-item
 ui:dyn-enum-value and ui:dyn-enum-item
 ui:enum-value and ui:enum-item
 ui:enumeration and ui:enum
 ui:text and ui:password
 t:*, q:*, and p:*
 Dot notation (v1.v2)
The element ui:cond

This element contains several conditional branches. The first branch whose condition code evaluates to true is expanded. If no branch is true, nothing will be expanded.


Level: Control structure

<!ELEMENT ui:cond ( (ui:if | ui:ifexpr | ui:ifvar | ui:iflang | ui:true | ui:false)+ )>
Sub elements

The following sub elements are possible. All are conditional elements setting the condition code.


  <ui:ifvar variable="v" value="1">
    ...branch 1...
  <ui:ifvar variable="v" value="2">
    ...branch 2...
    ...branch 3...
If the variable v has the value 1, the first branch will be expanded. If it has the value 2, the second branch will be expanded. In all other cases, the third branch will be expanded.

There is a certain order in which the various types of expansions are performed. First, template parameters and bracket expressions are evaluated and replaced by the resulting values. After that, the conditions are tested, and the right conditional branches are selected. This particular order may lead to problems when the test conditions are used to ensure preconditions of expressions, like in:

<ui:if value1="$x" value2="0" op="int-gt">
  $[div(100,$x)]   <!-- Runtime Error! -->
Here, the division is carried out before the test whether $x is positive, and because of this a runtime error can happen. The solution is to put the bracket expression into a template, as templates are expanded only on demand:

<ui:template name="divide" from-caller="x">


<ui:if value1="$x" value2="0" op="int-gt">
  <t:divide x="$x"/>
This web site is published by Informatikbüro Gerd Stolpmann
Powered by Caml