/ Published in: ASP
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.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<% 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>
URL: http://www.nealgrosskopf.com/tech/thread.asp?pid=1