Conditionally rendering elements

The TAL condition attribute determines whether an element should be rendered or not. In essence it is like an 'if' statement in most programming/scripting languages.

Syntax

tal:condition="EXPRESSION"

The expression

The expression (EXPRESSION) is evaluated as a TALES expression; unless the result indicates that the action is to be cancelled, that result is then coerced to a boolean value.

If the expression result is true, or the result cancels the action, then the element is unaffected and TAL processing continues as if the condition attribute were not present.

If the expression result is false then the current element and all of its children are removed from the DOM and not rendered to the output. Additionally, all further TAL processing on that element and its children is aborted. This usually has no undesired effects (since none of the children will be rendered), but beware that global variable definitions present upon child elements will not be performed.