Template Attribute Language
≈ 3 min read
Names in other languages
No names in other languages are held for this entry yet.
Article bodies are English and are not machine-translated. A name in another language is not a translation of the article.
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" ). ... ... ...
Text derived from https://en.wikipedia.org/w/index.php?oldid=1344907721 under CC BY-SA 4.0; modifications have been made.