[ZPT] Default tal/tales namespaces in HTML parser
Fred L. Drake, Jr.
fdrake@acm.org
Tue, 10 Apr 2001 22:10:22 -0400 (EDT)
Guido van Rossum writes:
> I feel that I should owe up a property of the HTML TAL implementation
> that's not in the TAL an TALES specs. While the XML parser requires
> that you declare all namespaces before you can use them, the HTML
> parser pre-initializes its namespaces with declarations for the "tal:"
> and "tales:" prefixes, so that you can start using tal and tales
> attributes right away.
>
> I find this both convenient (saves two lines of junk in each template)
> and helpful for consistency (everybody will tend to use "tal:" and
> "tales:" for their prefixes, aiding code portability), but it is
> probably in violation of some HTML standard.
>
> Should I take it out?
Evan Simpson writes:
> Not unless we must, please. I may easily be wrong, but I suspect that the
> HTML standard hasn't a thing to say about namespace-d attributes. It's good
That depends on what you mean by "hasn't a thing to say". (You knew
that was the answer, didn't you? ;-)
The HTML and XHTML specifications both specify DTDs using the schema
languages defined in SGML and XML, respectively. To conform, the
documents must be valid according the the rules of the schema and
metalanguage (SGML & XML). In both cases, inclusion of attributes
that are not specified in the schema is illegal, so any namespace
usage is incorrect.
XHTML describes use of namespaces with XHTML, noting that it is not
"strictly conforming", but seems to imply that it is acceptable (note
the lack of a technical term here!). In both examples of this
provided in the recommendation, the XHTML namespace is explicitly
declared in the document instance, and no DOCTYPE declaration is
included. (I don't recall ever seeing namespaces and a DOCTYPE
co-existing in W3C specifications.)
So, strictly speaking, we can't have TAL/METAL attributes in valid
HTML or XHTML. The spirit of the XHTML recommendation suggests
otherwise, however, but it was released before the W3C finalized a
schema language which allows validation in the presence of 3rd-party
namespaces.
However, to address Guido's question directly, *none* of the W3C
recommendations indicate that any magic pre-declarations of namespaces
should be used. Nor have I seen examples which do so. So I'm
inclined to take it out simply because no other tool works that way.
-Fred
--
Fred L. Drake, Jr. <fdrake at acm.org>
PythonLabs at Digital Creations