Mit The Destroyer’s archive for March 7th, 2007

So now that IE unerstands pure XHTML… by Mit The Destroyer

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?

  1. Modify the doctype to the XHTML file
  2. Modify the html tag to add the additional name-spaces
  3. Add object tags to head to inform IE to use plugins to render SVG/MathML
  4. 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>