[Zope] DTML singleton tags

tomas@fabula.de tomas@fabula.de
Mon, 2 Sep 2002 22:52:32 +0200


Hi, list

we are generating DTML code from XML via a XSLT transformation
(using Daniel Veillard's wonderful libxml2). Problem is, that
DTML has a couple of `singleton' tags, most prominently
<dtml-var ...>.

This is not very XML friendly, and as we want to produce
DTML, we have to embed DTML code in the XSLT stylesheet.

To make things easier, I just modified Zope (don't kill me ;)
to accept a trailing slash in tags, as in <dtml-var .../>.

Since the parser (in $ZOPEDIR/DocumentTemplate/DT_HTML.py)
doesn't know about the tag names, I chose the most lazy
variant and accept a trailing slash in *any* tag (with
possible whitespace between `/' and `>').

I'd like to make the patch available if there is any
interest. I'd be willing to modify my solution if this
makes the patch more acceptable. I see three possibilities:

(1) Lazy. Any (non-closing) tag accepts (and ignores) a
    trailing slash (that's what I've right now, and I'll
    stick to it if it stays my private solution).

(2) Sloppy. HTML-ish. Accept a trailing slash for singletons.
    Would be my favourite -- but would only be worth
    the effort if it gets integrated back, I think.

(3) Picky. XHTML-ish. Enforce trailing slash in singletons.
    Would break existing DTML code, thus I'd rule this
    out.

What do you think?

Regards
-- tomas