The question remains can the technique I showed in Fix for IE’s lack of application/xhtml+xml mean we can now embed other XML based formats inside the XHTML, as XML promises? The answer is, absolutely!
Here is a XHTML, SVG, MathML example page, that shows MathML and SVG embedded right along side an XHTML document. To properly view the page you will need to download these MathML Fonts, and these SVG and MathML plugins if viewing in IE.
What do we need to change to make this work?
- Modify the doctype to the XHTML file
- Modify the html tag to add the additional name-spaces
- Add object tags to head to inform IE to use plugins to render SVG/MathML
- Modify the xsl:stylesheet tag to include the additional name-spaces
Example of doctype, html and head tag modifcations
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="svgMathMlXhtml.xsl"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
"http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd"[
<!ENTITY % MATHML.prefixed "INCLUDE" >
<!ENTITY % MATHML.prefix "math" >
<!ENTITY % SVG.prefixed "INCLUDE" >
<!ENTITY % SVG.prefix "svg" >
]>
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:math="http://www.w3.org/1998/Math/MathML"
xml:lang="en">
<head>
<title>Advanced Example</title>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
<object id="AdobeSVG" classid="clsid:78156a80-c6a1-4bbf-8e6a-3cd390eeb4e2"></object>
<?import namespace="svg" implementation="#AdobeSVG"?>
<object id="MathPlayer" classid="clsid:32F66A20-7614-11D4-BD11-00104BD3F987"></object>
<?import namespace="math" implementation="#MathPlayer"?>
</head>
Example of xsl:stylesheet modifications
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:math="http://www.w3.org/1998/Math/MathML"
xmlns:svg="http://www.w3.org/2000/svg"
version="1.0">
<xsl:output method="xml" encoding="utf-8"/>
<xsl:template match="/">
<xsl:copy-of select="node()"/>
</xsl:template>
</xsl:stylesheet>
Have you ever tried sending a 100% strictly compliant xhtml to IE, so that IE would use It’s xml engine to render the page? If so, you know that IE borks on it and forces you to download the xhtml file. I’m here to tell you that I’ve found a work around, that is standards compliant and gets around that limitation and forces IE to use the XML rendering engine. Two steps are required for it to work:
- Configure web server to send xhtml files with the mime type of application/xml
- Then attach a XSL sheet to each xhtml file you serve to IE
Exmple File
Example xhtml code
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="fixMe.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>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
<title>Simple Example < /title>
</head>
<body>
<!-- xhtml code here -->
<body>
</html>
Required fixMe.xsl code
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0">
<xsl:output method="xml" encoding="utf-8"/>
<xsl:template match="/">
<xsl:copy-of select="node()"/>
</xsl:template>
</xsl:stylesheet>
Why does this work?
As far as IE is concerned you sent it a XML file, with an XSLT sheet applied to it. It’s XML rendering engine then applies the XSLT sheet which converts the XML page into an XHTML page. Without the XSLT sheet applied IE would have just showed us the source code to the page.
How did you ever figure this out?
I discovered this when I was developing this website, to teach myself XSLT. And knowing what I know about mime-types I figured it should work if I just changed the mime-type for XHTML from application/xhtml+xml to it’s alternate compliant mime-type of application/xml1, seeing as IE wasn’t having any issues displaying XML files sent as application/xml.
Additional Notes
Update: To see an example with SVG and MathML mixed in with the XHTML read So now that IE unerstands pure XHTML…
Here are a couple of links to parodies of the I’m a Mac I’m and I’m a PC Mac commercials:
- Video Parodies
- PC VS MAC VS Linux
If you haven’t yet seen the original Mac commercials, get off your lazy but and head over to the apple site and watch them.
The New York Times is running a piece entiteld Darwin’s God. Which analyzes why throughout human history mankind has universally had some sort of belief in a god and or the supernatural. The article summarizes the work DR Scott Atran, who has spent several years researching and hypothesizing the reason why anthropologists are constantly finding religious artifacts among dead and living civilizations. His argument boils down to the concept that the belief in a higher power is a side effect of our ability quickly asses our surroundings in order that we survive. The example given:
Agent detection evolved because assuming the presence of an agent — which is jargon for any creature with volitional, independent behavior — is more adaptive than assuming its absence. If you are a caveman on the savannah, you are better off presuming that the motion you detect out of the corner of your eye is an agent and something to run from, even if you are wrong. If it turns out to have been just the rustling of leaves, you are still alive; if what you took to be leaves rustling was really a hyena about to pounce, you are dead.
The problem with his argument is that he doesn’t take it to its logical conclusion. If you did take the argument to the logical conclusion you would arrive at the fact that nothing exists at all unless there was a primary first cause, out side the natural system, a higher power if you will. Don’t take my word for it as Alvin Plantinga has argued it much more eloquently.