Template Attribute Language
The Template Attribute Language (TAL) is a templating language used to generate dynamic HTML and XML documents. It is designed to facilitate a clear separation between presentation and application logic, thereby supporting collaboration between designers and programmers. This is achieved by expressing template logic through attributes defined in an XML namespace, which are added to otherwise valid HTML or XML elements. By using structured attributes rather than arbitrary embedded code, templates remain well-formed documents that can be viewed and edited with standard XML or HTML authoring systems. TAL was created for Zope but is used in other Python-based projects as well.
The Template Attribute Language (TAL) is a templating language used to generate dynamic HTML and XML documents. It is designed to facilitate a clear separation between presentation and application logic, thereby supporting collaboration between designers and programmers. This is achieved by expressing template logic through attributes defined in an XML namespace, which are added to otherwise valid HTML or XML elements. By using structured attributes rather than arbitrary embedded code, templates remain well-formed documents that can be viewed and edited with standard XML or HTML authoring systems. TAL was created for Zope but is used in other Python-based projects as well. replaces the given attributes (e. g. by using tal:attributes="name name; id name" the name and id attributes of an input field could be set to the value of the variable " name ") omit-tag allows to omit the start and end tag and only render the content if the given expression is true. on-error if an error occurs, this attribute works like the content tag. If a tag has more than one TAL attributes, they are evaluated in the above (fairly logical) order. In cases when no tag is present which lends itself to take the attributes, special TAL tags can be used, making the " tal: " prefix optional. e.g.: ... would cause the code inside the tal:if tags to be used whenever the context (whatever the application server defines the context to be, e.g. an object) contains variable " itemlist " with a true value, e.g. a list containing at least one element. The identifier following the colon is arbitrary; it simply needs to be there, and to be the same for the opening and closing tag. ( xmlns:metal="http://xml.zope.org/namespaces/metal" ). ... ... ...
References
No reference rows published for this article.
Cite this article
MLA
"Template Attribute Language." encyclopegia.org, 2026, https://encyclopegia.org/wiki/template-attribute-language. Accessed 25 November 2026.
Chicago
"Template Attribute Language." encyclopegia.org. Accessed November 25, 2026. https://encyclopegia.org/wiki/template-attribute-language.
APA
encyclopegia.org. (2026). Template Attribute Language. Retrieved November 25, 2026, from https://encyclopegia.org/wiki/template-attribute-language
Accessed November 25, 2026 · CC BY-SA 4.0 · citation page · JSON