It is common knowledge that XHTML is better HTML and you can serve XHTML content as HTML.
However, the second statement is incorrect, for various reasons;
it is enough to say that the HTML validator does not tolerate XML-style empty tags.
It seems serving XHTML to the browser is of no advantage and can cause serious problems if the browser does not understand the difference.
This raises the question of downgrading XHTML to HTML.
I could not find any relevant instruction at the WWW Corporation so I decided I have to roll my own with XSLT.
I attach the XSLT code and I kindly ask for comments (because I am a novice in this area).
Please note that all tags and attributes have to be copied stripping the napespace;
<xsl:copydoes not work as expected because I get <br></brinstead of <bronly.
I decided to copy the comments explicitly
in order to be able to embed Internet Explorer conditional inclusion comments into the output.
Chris
<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">
<xsl:output
method="html" doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
doctype-system="http://www.w3.org/TR/html4/loose.dtd"
/>
<xsl:template match="@*"<xsl: attribute name="{name()}" <xsl:value-of select="." /</xsl:attribute>
</xsl:template>
<xsl:template match="*"
<xsl:element name="{name()}" <xsl:apply-templates select="@* | node()" /</xsl:element
</xsl:template<xs l:template match="comment( )"<xsl:copy /</xsl:template>
</xsl:stylesheet>
However, the second statement is incorrect, for various reasons;
it is enough to say that the HTML validator does not tolerate XML-style empty tags.
It seems serving XHTML to the browser is of no advantage and can cause serious problems if the browser does not understand the difference.
This raises the question of downgrading XHTML to HTML.
I could not find any relevant instruction at the WWW Corporation so I decided I have to roll my own with XSLT.
I attach the XSLT code and I kindly ask for comments (because I am a novice in this area).
Please note that all tags and attributes have to be copied stripping the napespace;
<xsl:copydoes not work as expected because I get <br></brinstead of <bronly.
I decided to copy the comments explicitly
in order to be able to embed Internet Explorer conditional inclusion comments into the output.
Chris
<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">
<xsl:output
method="html" doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
doctype-system="http://www.w3.org/TR/html4/loose.dtd"
/>
<xsl:template match="@*"<xsl: attribute name="{name()}" <xsl:value-of select="." /</xsl:attribute>
</xsl:template>
<xsl:template match="*"
<xsl:element name="{name()}" <xsl:apply-templates select="@* | node()" /</xsl:element
</xsl:template<xs l:template match="comment( )"<xsl:copy /</xsl:template>
</xsl:stylesheet>
Comment