Mehr unter http://old.zope.org/Members/peterbe/DTML2ZPT/
with-Konstrukt
# DTML # <dtml-with "subfolder.index_html"> <a href="<dtml-var absolute_url>" title="<dtml-var title>" ><dtml-var title></a> </dtml-with>
# ZPT # <a href="dummylink.html" title="Dynamic Title" tal:define="doc nocall:context/subfolder/index_html; title doc/title" tal:attributes="href doc/absolute_url; title title" tal:content="title">Dynamic Title</a>
if-else-Kondition
# DTML # <H4> <dtml-if "_.len(result)==0"> <dtml-var document_title> <dtml-else> Untitled </dtml-if> </H4>
# ZPT # <H4> <span tal:replace="template/title" tal:condition="python:len(result)==0"/> <span tal:replace="string:Untitled" tal:condition="python:not(len(result)==0)"/> </H4>
oder
<h4 tal:content="python:test(len(result)==0, default, path('template/title'))">Untitled</h4>
Verwendung von Python-Modulen
url_quote-Qualifier
# DTML # <dtml-var "'?a=b'" url_quote>
# ZPT # <span tal:define="Std modules/Products/PythonScripts/standard" tal:replace="python:Std.url_quote('?a=b')"></span>
newline_to_br-Qualifier
# DTML # <dtml-var "attr('text')" newline_to_br>
# ZPT # <span tal:define="Std modules/Products.PythonScripts/standard; newline_to_br nocall:Std/newline_to_br;" tal:content="structure python:newline_to_br(context.attr('text'))"> </span>