Convert XHTML to HTML with XSLT

After fiddling a bit with the “copy-no-ns” XSLT template, I’ve ended up with a style sheet which converts XHTML to HTML 4.01, so you can use it as a post-processing step when serving to Internet Explorer. Note that this has not been tested with alternative namespaces such as SVG or MathML.

Edit: After moving to PHP 5 and libxslt, it was necessary to trim the xmlns declarations down a bit. The new version is online now.

Edit 2: I got a bit of a surprise when reading the W3C recommendations for declaring encoding and MIME type. The new version is online, but you must provide the content type at run time (using XSLTProcessor::setParameter in PHP 5). Of course, you can just ignore that and specify your own if it’s static.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s