![]() [UP] The UI language |
The element ui:if This element compares two values. If the result is true, the inner nodes are expanded and the condition code is set to true; otherwise the inner nodes are ignored, and the conditon code is set to false. Declaration Level: Control structure <!ENTITY % string-operators 'eq|ne|match|nomatch'> <!ENTITY % int-operators 'int-eq|int-ne|int-lt|int-le|int-gt|int-ge'> <!ENTITY % operators '%string-operators;|%int-operators;'> <!ELEMENT ui:if ANY> <!ATTLIST ui:if value1 CDATA #REQUIRED value2 CDATA #REQUIRED op (%operators;) "eq" > Attributes
Sub elements All page body elements may occur as sub elements. Operators The following operators are defined for ui:if:
Regular expressions The engine matching regular expressions is PCRE (Perl-compatible regular expressions), so the Perl syntax is used. The expressions are not anchored by default, so have to write ^ and $$ to force anchoring. ^ matches the beginning of the string, and $$ matches the end of the string ("single-line expressions"). Note that you have to write double dollars $$ because the dollar character is the escape character for template parameters. Hints Note that template parameters and bracket expressions within ui:if are unconditionally evaluated. See ui:cond for a discussion of the consequences of this fact. Example <ui:if value1="$[n]" value2="1" op="gt"> The result has more than one solution: ... </ui:if> |