<?xml version="1.0" encoding="UTF-8" ?>
<!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"
>
<?xml-stylesheet type="text/xsl" href="mathml.xsl"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript"><![CDATA[
function showMathML(target, source) {
    // srcout = '<?xml version="1.0"?>'
    //     + '<html xmlns="http://www.w3.org/1999/xhtml">'
   //      + '<body>'
   //      + source
   //      + '</body></html>'
   //      + '';
  tgt = document.getElementById(target);
  // tgt.setAttribute("data","data:application/xhtml+xml;charset=utf-8," + escape(srcout));
  tgt.innerHTML = source;
}
function renderMathML(target, source) {
  srcout = '<?xml version="1.0"?>'
         +  '<!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">'
         + '<?xml-stylesheet type="text/xsl" href="./mathml.xsl"?>'
         + '<html xmlns="http://www.w3.org/1999/xhtml">'
         + '<body><div style="float:left;">'
         + source
         + '</div></body></html>'
         + '';  
  var req = new XMLHttpRequest();
  req.open("GET", "mathml.xsl", false);
  req.send(null);
  processor = new XSLTProcessor();
  processor.importStylesheet(req.responseXML);
  var frag = processor.transformToFragment((new DOMParser()).parseFromString(srcout, 'application/xml'),document);
  tgt = document.getElementById(target);
  while (tgt.lastChild) tgt.removeChild(tgt.lastChild);
  tgt.appendChild(frag);
}
function sourceIn(source) {
  document.getElementById('myinputarea').value = source;
}
]]></script>
<title>CPT -- Translator</title>
</head>
<body>
<h1>Content Pseudo-TeX (CPT) -- Translator</h1>
<p>
Designed to be viewed using <a href="http://www.mozilla.org">Firefox 2.0</a> (or higher -- also check
<a href="http://www.mozilla.org/projects/mathml/fonts/">fonts</a>)
with <a href="http://www.java.com">Java 1.5</a> (or higher) runtime plug-in installed.
Other platforms (such as MSIE 6.0 or higher with Java 1.5 and Design Science MathPlayer plugins)
may work, but have not been tested.
</p>
<p>
<em>Warning:</em> Java Plug-In version 1.6.0 update 10 does <em>not</em>
work with this applet!  There is a bug in how that plug-in version (which
implements a new plug-in architecture) handles applets in XHTML files.  I
suggest you either use the older Update 7 plug-in or set Update 10 for
"compatibility mode" via the Java Panel.  In either case, the bug should
be fixed in Update 12, whenever that comes out. 
</p>
<p>  
For an initial glimpse of how the Translator works, click
the "Load example" link at the bottom of this page, then click "Render."
</p>
<p>
For detailed information about the source mark-up syntax, read the
<a href="mathtransdoc.xml">documentation page</a>.
</p>
<p>
For another approach, the source mark-up can also be
<a href="in-page-doc.xml">embedded within a page</a>.
See the <a href="index.xml">list of tools and materials</a>.
</p>
<p><a id="applettop"/>
<object id="myinputapplet"
        classid="java:MathTransApplet.class" 
        type="application/x-java-applet"
	archive="mathtrans.jar" height="1" width="1"/></p>
<table><tr><td valign="top">
<strong>Enter source mark-up here:</strong><form action="">
<fieldset style="border:none;">
<textarea id="myinputarea" rows="15" cols="50">Type input source here</textarea><br/>
<input type="button" id="here" value="Render"
    onclick="document.getElementById('myinputapplet').setBlockDisplay('false');
	     showMathML('myoutputlayer',document.getElementById('myinputapplet').preOut(document.getElementById('myinputarea').value));
             document.getElementById('myinputapplet').setBlockDisplay('true');
             renderMathML('myrenderlayer',document.getElementById('myinputapplet').mmlOut(document.getElementById('myinputarea').value));"/><br/>
</fieldset></form><br/>
</td><td valign="top">
Copy and Paste Content MathML from here (after rendering):
<br/>
<div style="width:450px;height:200px;border:solid;border-width:1px;overflow:auto" id="myoutputlayer">MathML output here</div>
<br/>
Rendered:<br/>
<div id="myrenderlayer" style="height:100px;width:450px;"></div>
</td></tr></table>
<p><a href="#applettop" 
onclick="sourceIn('\\int[v:x][l:0][u:\\pi;]{\\sin{x}}=2');">
Load example source markup:</a><br/><kbd>\int[v:x][l:0][u:\pi;]{\sin{x}}=2</kbd></p>
</body>
</html>
