A bit off topic, but on our project, we run every parsed page through xmllint to verify that it is valid XHTML (validates against the XHTML DTD).
If you can do the same functionality at the template layer (in DEBUG mode, of course), that would be really cool. Paul