With STL it is possible to show or to hide a XML element based on a condition. For this purpose we use the stl:if and the stl:omit-tag attributes.
The difference between stl:if and stl:omit-tag is that the first one hides the entire element (and its children) and the second one only the tag (not its children). For example, we will either have a link to a form to edit the task, or we will just have the title of the task, depends on the value of the variable can_edit. We can do that with:
<a href="edit_task" stl:if="can_edit">${title}</a>
<stl:inline stl:if="not can_edit">${title}</stl:inline>
or
<a href="edit_task" stl:omit-tag="not can_edit">${title}</a>
This is the syntax of the stl:if and stl:omit-tag attributes:
stl:if="[not] expression"
stl:omit-tag="[not] expression"
The value of the attribute is a boolean expression, the same boolean expressions we have seen in section .
Something important to note from the previous template snippet is that the language STL uses XML namespaces, this means that the STL namespace must be declared:
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns:stl="http://xml.itools.org/namespaces/stl"
...