[ZPT] Proposal: add a 'prolog' property to templates
tseaver at palladion.com
Thu Mar 22 07:24:36 EDT 2007
-----BEGIN PGP SIGNED MESSAGE-----
Lots of templates in use have the following ugly hack, or some version
of it, in order to avoid repeating DTD, etc.:
><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
There are a couple of issues here:
- First, this is nasty, and it makes the document itself unparseable
(since SGML requires the DTD to appear *first*).
- Second, the presence of an HTML DTD in the source template, even
without the <tal:wrap> hack, is a lie: the templates themselves
do not conform to the DTD, because they have namespaced elements,
even though the rendered output might be conformant once the ZPT
engine strips them all away.
- The presence of the DTD in the rendered output is, however, a
requirement in order to get the browsers (IE, in particular) to
render it properly.
For templates aimed at producing XML, the issue is less severe, as fewer
documents need or want DTDs declared. There might be a problems where
includng the <?xml...?> prolog or other processing instructions would be
problematic in the source template.
Give templates an optional 'prolog' attribute, which, if present, would
be prepended to the rendered output.
- - The prolog would likely need to be ASCII, as it appears before any of
the inline encoding hints. ZPT might not need to enforce this
- - Persistent templates would expose this attribute as a property (in
the Zope2 ZMI) or as part of their schema (IZPTPage, or whatever).
- - Filesystem-based templtes would have to keep the prolog in an
ancillary file (e.g., the CMF's '.metadata' file).
Tres Seaver +1 540-429-0999 tseaver at palladion.com
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v220.127.116.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----
More information about the ZPT