Re: MathML Namespace + Mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg46090] Re: [mg45863] MathML Namespace + Mathematica
- From: Murray Eisenberg <murray at math.umass.edu>
- Date: Thu, 5 Feb 2004 04:03:09 -0500 (EST)
- Organization: Mathematics & Statistics, Univ. of Mass./Amherst
- References: <5.0.0.25.0.20040204101953.00a62288@pop.directnic.com>
- Reply-to: murray at math.umass.edu
- Sender: owner-wri-mathgroup at wolfram.com
Are you sure about the .xml extension? Mozilla (1.5, under Windows XP and with the appropriate math fonts installed) seems to choke on it: Trying to load such a page with extension .xml immediately crashes Mozilla! Here's the entire Notebook expression for the .nb file I started with: Notebook[{ Cell[BoxData[ \(\[Integral]\_0\%\[Pi]\( x\^2\) \[DifferentialD]x\)], "Input"] }, FrontEndVersion->"5.0 for Microsoft Windows", ScreenRectangle->{{0, 1280}, {0, 979}}, WindowSize->{496, 740}, WindowMargins->{{0, Automatic}, {Automatic, 0}}, CellLabelAutoDelete->True ] And here's the entire .xml file generated by Save As Special...XML (XHTML+MathML): <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="HTMLFiles/pmathml.xsl"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "HTMLFiles/xhtml1-transitional.dtd"> <!-- This HTML document was created by converting a Mathematica notebook using Export. --> <html xmlns="http://www.w3.org/1999/xhtml" class="Notebook"> <head > <title> integral.nb </title> <link href="HTMLFiles/Default.css" rel="stylesheet" type="text/css" /> </head> <body> <p class="Input"> <math xmlns='http://www.w3.org/1998/Math/MathML'> <mrow> <msubsup> <mo>∫</mo> <mn>0</mn> <mi>π</mi> </msubsup> <mrow> <msup> <mi>x</mi> <mn>2</mn> </msup> <mo>⁢</mo> <mrow> <mo>ⅆ</mo> <mi>x</mi> </mrow> </mrow> </mrow> </math> </p> <hr /> <p style='font-family: Helvetica; font-size: 8pt'>Created by <a href="http://www.wolfram.com"><span style='font-style: italic'>Mathematica</span></a> (February 4, 2004) </p> </body> </html> Dale Horton wrote: > At 04:19 AM 1/28/2004, Florian Huber wrote: > >> Hi, >> >> I like to use the Export-Mode HTML+MathML in Mathematica 5.0. >> >> It would be great to use the MathPlayer from Design Science to show the >> equations. >> >> But there is one problem: Is far as I know, do I have to put the >> namespace >> m: to all MathML-Tags. >> >> Is there an export option in HTMLSave in Mathematica to fix this? >> >> Regards >> >> F. Huber > > > The XHTML+MathML format uses the "Universal Style Sheet" provided by the > W3C. It renders in several browsers (including IE with MathPlayer). See > http://www.w3.org/Math/XSL/ > > One common mistake is that the document must be parsed as an XML file. > This means you should use the .xml extension, not .html or .htm. > > If for some reason the default MathML output doesn't fit your needs, > there are options for controlling the MathML. It takes the form > > Export["file.xml", expr, "XHTML+MathML", > ConversionOptions -> {"MathMLOptions" -> mathmlopts}] > > Where expr is the thing you are exporting (like a NotebookObject). > > And mathmlopts are the options that you want to apply to the MathML. > These are listed in the MathML documentation (AddOns&Links>XML > Capabilities). To prefix the tags with "m:", mathmlopts would be > > {"NamespacePrefixes" -> {"http://www.w3.org/1998/Math/MathML" -> "m"}} > > Or if you want to use the menu item, you can use SetOptions and the menu > will inherit the setting. > > SetOptions[Export, ConversionOptions -> {"MathMLOptions" -> > {"NamespacePrefixes" -> {"http://www.w3.org/1998/Math/MathML" -> "m"}}}] > > -Dale > > -- Murray Eisenberg murray at math.umass.edu Mathematics & Statistics Dept. Lederle Graduate Research Tower phone 413 549-1020 (H) University of Massachusetts 413 545-2859 (W) 710 North Pleasant Street fax 413 545-1801 Amherst, MA 01003-9305