[Zope] too strict html validation in page templates (zpt)

Passin, Tom tpassin@mitretek.org
Wed, 18 Dec 2002 14:37:06 -0500


[normand cote]

> The following bit validates ok at http://validator.w3.org but=20
> fails as input to a page template ("EOF in middle of=20
> construct").  The problem is that the attributes on the span=20
> tag are not separated by whitespace.  It works fine as a dtml=20
> method, though.
>

Hmm, sounds like a bug in the validator.  I think (not sure, though)
that SGML requires a space between attribute name/value pairs.
Ceratinly XML does.  The HTML 4.01 Rec says about attributes -

"Attribute/value pairs appear before the final ">" of an element's start
tag. Any number of (legal) attribute value pairs, separated by spaces,
may appear in an element's start tag."

> The reason this is such a problem is that Dreamweaver MX (and=20
> perhaps other
> versions) tends to create markup that looks like this, and it=20
> is the most common tool used by page designers with whom I work.
>=20

Perhaps browsers have been tolerant of run-together attributes, but it
is a bad idea to encourage at this point.  They will mess up any
conversion to xml or xhtml.  I am surprised that DW would emit bad
markup like that, even if browsers accept it.

Rather than try to hack the ZPT parser to allow these constructions,
better to write a preprocessor to fix them up, I think.

Cheers,

Tom P