ec2-34-239-154-201.compute-1.amazonaws.com | ToothyWiki | RecentChanges | Login | Webcomic

A restatement of HTML as an XML application.

Anyone using or thinking of using this on a web site should first read [Sending XHTML as text/html Considered Harmful], and watch out for all sorts of niggling issues to do with differences handling character encodings between different browsers and platforms. YouHaveBeenWarned?.

More to the point - this falls into the category of "But why would you WANT to?" AFAICT.  You're using the nastiest hackiest bit of XML (that was left in there pretty much solely so that you could do this) and improving your web browsing experience not one jot.  And since you can just arbitarily extend HTML with new tags, you could do all the translations you wanted.
And if you're generating the XHTML from base XML (which is sometimes a useful idea) - why not translate all the way to HTML?  --Vitenka

Kazuhiko is under the (quite possibly mistaken) impression that XHTML is a subset of HTML, in that it is only HTML which can be validated in a nice way.  He is therefore confused by "translate all the way to HTML".  What bits of XHTML are not valid in HTML? - [note: having read the advocacy link above, the only real answer he seems to have is that a real HTML 4 browser would render <br/> as <br>>.  Given current browsers do not appear to be real, is there anything else?]
If you're translating from XML, you're certainly translating to well formed HTML.  And there's nothing stopping you writing bad XHTML if you want to write bad HTML.  As for what xhtml is not valid html - depends how old your browser is, really.  Lots of tags, and certainly the addition of closing slashes to single tags, are pretty new.  Why not map to 3-transitional which you can guarantee all browsers will handle.  (And the big one would be the opening <XHTML> tag.)  --Vitenka
Rereading the advocacy doc, they make exactly my point of "Why bother?".  Though they're mostly focussed on future extensibility and the fact that HTML as it is currently implemented by your WebBrowser? is a non SGML? compatible mess, and may well be cleaned up some day.  YeahRight?.  --Vitenka
XML is a family of infinitely-many formats. You can use XSLT to specify translations between XML formats (e.g. YourCustomXMLFormat? and XHTML) or from XML to HTML or to plain text. XHTML is one XML format. HTML is not an XML format. XHTML is almost a subset of HTML, but with certain changes. It is not identical to translating <tag /> to <tag>, as the end tag is not optional for all HTML elements. e.g. <title /> would be interpreted as <title> instead of <title></title>; the former would be invalid HTML and also causes web browsers such as IE to choke. XHTML is useful if you need to use other XML features. For example you can include XML elements from other namespaces, such as MathML? or SVG, in an XHTML document. (Whether a browser will do anything useful with said document is another matter.) And as XHTML is XML, it can be processed using XSLT. --B

CategoryComputing, CategoryWeb, CategoryAbbreviation

ec2-34-239-154-201.compute-1.amazonaws.com | ToothyWiki | RecentChanges | Login | Webcomic
Edit this page | View other revisions | Recently used referrers
Last edited November 16, 2005 1:23 pm (viewing revision 7, which is the newest) (diff)