Return to Snippet

Revision: 5486
at March 11, 2008 19:47 by neal_grosskopf


Initial Code
<%
If InStr(Request.ServerVariables("HTTP_ACCEPT"), "application/xhtml+xml") > 0 Then
    Response.ContentType = "application/xhtml+xml"
Else
    Response.ContentType = "application/xml"
End If
Response.Charset = "utf-8"
%>
<?xml-stylesheet type="text/xsl" href="xhtml.xsl"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>XHTML</title>
</head>

<body>

<!--
Contents of xhtml.xsl file

<stylesheet version="1.0"
     xmlns="http://www.w3.org/1999/XSL/Transform">
    <template match="/">
        <copy-of select="."/>
    </template>
</stylesheet>
-->


</body>
</html>

Initial URL
http://www.nealgrosskopf.com/tech/thread.asp?pid=1

Initial Description
Serve your xhtml pages correctly with this script and xsl file. Most websites serve their xhtml pages as text and not xml to Internet Explorer. With this it will serve to IE as xml. Your sites will be more valid because they will validate against the xml validator rather than the html validator.

Initial Title
How To Serve XHTML to Internet Explorer 6 And 7 as XML Using Content Negotiation

Initial Tags
ie, xhtml, xml, ie6

Initial Language
ASP