[Zope] Re: Is DTML a bastardized form of XML, or valid XML?
Joe Pallas
pallas@cs.stanford.edu
Fri, 23 Jun 2000 08:39:01 -0700
I'm pretty sure "new syntax" DTML is not actually valid XML, but it
doesn't really matter: it's a bad idea either way. The new syntax
is a misguided attempt to mix the base and meta levels, which can
only result in confusion.
DTML is not markup, it is a macro language for generating markup. As
such, it will not always be possible to coerce it into a form that
meets the syntax rules of the base language. But meeting those
rules, and consequently being able to use XML editors, is the only
real justification for the new syntax.
<h1 <!--#if "fervor > 2"-->class="hot"<!--#/if-->>
How do I do this in "new" DTML?
</h1>
<h1 <dtml-if "fervor > 2">class="hot"</dtml-if>>
This isn't valid XML (bad attribute).
</h1>
<dtml-if expr="fervor > 2">
<h1 class="hot">
<dtml-else>
<h1>
</dtml-if>
This isn't valid XML, either (bad nesting).
</h1>
<dtml-if expr="fervor > 2">
<h1 class="hot">
This is very clumsy and does not scale.
</h1>
<dtml-else>
<h1>
...but I think it is valid XML.
</h1>
</dtml-if>
Also, XML requires all attributes to be quoted, so forget about using
the implicit name/expr distinction with your shiny new XML editor.
The new syntax doesn't satisfy the arguments that were given to
support it, and it decreases the readability and maintainability of
DTML code that uses it by making it hard to distinguish DTML
directives from markup. I avoid it, and I don't recommend it to
others.
joe