xml - content mathml to infix notation using ctop.xsl not getting as desired format -
i trying make math notation or infix expression content mathml,
i making of ctop.xsl
this:
/***ctop.xsl**/
it can parsed expression follows:
<html> <head> <script> function loadxmldoc(filename) { if (window.activexobject) { xhttp = new activexobject("msxml2.xmlhttp"); } else { xhttp = new xmlhttprequest(); } xhttp.open("get", filename, false); try {xhttp.responsetype = "msxml-document"} catch(err) {} // helping ie11 xhttp.send(""); return xhttp.responsexml; } function displayresult() { xml = loadxmldoc("contentmathml.xml"); xsl = loadxmldoc("ctop.xsl"); // code ie if (window.activexobject || xhttp.responsetype == "msxml-document") { ex = xml.transformnode(xsl); document.getelementbyid("example").innerhtml = ex; } // code chrome, firefox, opera, etc. else if (document.implementation && document.implementation.createdocument) { xsltprocessor = new xsltprocessor(); xsltprocessor.importstylesheet(xsl); resultdocument = xsltprocessor.transformtofragment(xml, document); document.getelementbyid("example").appendchild(resultdocument); } } </script> </head> <body onload="displayresult()"> <div id="example" /> </body> </html>
here contentmathml.xml input
i having content mathml :
input:
<math><apply><power></power><ci>x</ci><cn>2</cn></apply></math>
i getting output: x2
expected: x^2
i tried again input:
<math><apply><sin></sin><ci>x</ci></apply></math>
output: sinx expected output: sin(x)'
how can change ctop.xsl in such way infix output?
your input incorrect, should in mathml namespace:
<math xmlns="http://www.w3.org/1998/math/mathml"> <apply><power></power><ci>x</ci><cn>2</cn></apply> </math>
not directly related problem there newer, maintained, version of ctop.xsl stylesheet here
Comments
Post a Comment