Looks like this might be one possible solution: https://mailman-mail5.webfaction.com/pipermail/lxml/2012-June/006432.html

Might want to shoot for html5 doctype instead of html 4