[whatwg] XSLT: HTML 5 --> HTML

Karl Dubost wrote:
> 
> Le 5 f?vr. 2007 ? 22:40, Elliotte Harold a ?crit :
>> Has anyone written an XSLT stylesheet that downgrades HTML 5 to 
>> classic HTML+ appropriate <div class=''> and <span class=''> elements? 
>> With the right CSS, this might make a lot of it deployable today. If 
>> not, I may take a whack at it.
> 
> unlikely. "div" and "span" elements didn't exist in HTML+.

I forgot (or never knew) there was something called HTML+. I just meant 
classic HTML plus the <div class=''> and <span class=''> elements. :-)

> It might be possible to write an XSLT to convert HTML 5 to HTML 4.01 
> and/or XHTML 1.0 but loosing some elements.
> That would be cool indeed if you could write it. Tag soup parser to 
> normalize to XHTML 1.0 or XHTML 1.1 is indeed a great idea. I don't 
> think XSLT is the best tool to do that, but I would be happy to hear 
> your thoughts about it.

It's a pretty straight-forward transform problem, and this is exactly 
what XSLT is designed to do.

It would probably have to be done in two parts. First make the document 
well-formed (possibly with a TagSoup fork). Then run the stylesheet. The 
problem with TagSoup is that it treats bogons (unknown elements as 
empty). It also doesn't quite follow Web Apps 1.0's error recovery 
algorithm. Possibly I could base the initial step on html5lib instead.


-- 
?Elliotte Rusty Harold  elharo at metalab.unc.edu
Java I/O 2nd Edition Just Published!
http://www.cafeaulait.org/books/javaio2/
http://www.amazon.com/exec/obidos/ISBN=0596527500/ref=nosim/cafeaulaitA/

Received on Tuesday, 6 February 2007 03:23:49 UTC