What I came up with still has some shortcomings. XSLT cannot match the xmlns attribute of an element, it is up to the XSLT parser to include it in the output. Without this capability, I cannot see a way to render the namespace declarations accurately. Second, character entities are escaped into their HTML equivalent when the stylesheet is displayed. When your HTML rendering requires "<" to be visually rendered, it will be displayed with its character equivalent of "<". A workaround is to escape the escape, using &lt;.
To download the stylesheet, see http://xmlandasp.net/examples/xslt/defaultss.xslt.