On Thu, Sep 01, 2005 at 11:44:48AM +0200, Tonico Strasser wrote:
> And, as long pages are served as text/html they are treated as old-style
> HTML by browsers anyway.
> XHTML pages served as text/html must follow the compatibility
> guidelines. E.g. in ZPT HTML mode, elements like <br/> will be
> converted to <br /> automagically (with space before the slash). That is
> a good thing IMHO.
>  Serving XHTML 1.0
>  HTML Compatibility Guidelines
Tonico, I think you misunderstood something: While it is true that
pages served as text/html are treated as HTML by browsers,
there are still quite some differences how they treat the HTML,
i. e. in which mode they operate (doctype switching).
Serving pages as text/html just makes the browser more forgiving.
E. g. a plain <br> tag won't normally be flagged as an error, while in
application/xhtml+xml it will be flagged as an error by the browser
(and Mozilla/Gecko does so). IE does not understand
application/xhtml+xml, so this is only a choice for intranets without
IE right now. For the Internet there is currently no choice but text/html
(maybe negotiating the MIME type depending on the browser).
Also there is nothing wrong with serving XHTML as text/html (except
that you are missing some browser error messages - if you want to make
sure your XHTML is correct, you can always rely on external
validation, see below)
Still - and that is my point - even IE (that only understands
text/html) has different modes of operation (basically standards mode
and quirks mode), triggerd by doctype switching.
If you want to use XHTML and make sure that that XHTML is correct,
this is what you can do:
(1) rely on the zope machinery to find possible mistakes: XML-mode
is not as forgiving as HTML-Mode for page templates - and I
think that is a good thing, and therefore I am also in favor of
making XML-Mode the default (+1).
Be aware though that even in HTML-Mode you can currently write
perfectly valid XHTML pages - you are just loosing Zope's
ability to detect XHTML errors.
(2) rely on external validation: html://validator.w3.org
this should probably be done much more often anyways
(3) rely on the browser to flag errors
e. g. Mozilla/Gecko in application/xhtml+xml, NOT possible
Beware: this is all about what input is accepted as valid XHTML,
interpreting the input as XHTML is the next step: normally you want
that XHTML to be interpreted in standards mode (that's why you wrote
XHTML in the first place) and you tell the browser by doctype
Philipp: If XML-Mode is the default, and therefore no xml-declaration
is needed (and the aforementioned unfortunate IE bug is therefore
circumvented) how would one toggle on HTML-Mode? - Am I missing
something? The situation right now is
xml-declaration -> XML-Mode
no xml-declaration -> HTML-Mode
HTML mode might still be needed in some situations (Fred gave some
Zope3-dev mailing list