Title: Math: Converting to MathML
1Math Converting to MathML
- Eric Lamont Rankin
- Grainger Engineering Library Information Center
- University of Illinois at Urbana-Champaign
- http//dli.grainger.uiuc.edu rankin_at_uiuc.edu
2Math Converting to MathML
- Goal Convert publisher-dependent SGML math
markup to standard MathML - Use XSLT to transform markup from one form to
another - Challenges encountered along the way
3Math Converting to MathML
- Use XSLT to transform markup from one schema to
another - Convert SGML markup into MathML presentational
tags - Validate MathML using plugin (IBM Techexplorer)
and native browser (W3C Amaya) - One XSL stylesheet for each publisher
4Math Converting to MathML
- Use XSLT to transform markup from one form to
another - Simple mapping (renaming tags)
ltdformulagt . . . lt/dformulagt
ltmathgt . . . lt/mathgt
ltxsltemplate matchdformulagt ltxslelement
namemathgt ltxslapply-templates/gt
lt/xslelementgt lt/xsltemplategt
5Math Converting to MathML
- Use XSLT to transform markup from one form to
another - Complex operations (changing node order while
iteratively traversing node tree)
ltmathgt ltmsubsupgt ltmrowgtltmchar
namealpha/gtlt/mrowgt
ltmrowgtltmigtilt/mngtlt/mrowgt
ltmrowgtltmngt2lt/mngtlt/mrowgt lt/msubsupgt lt/mathgt
ltdformulagt ltggtalt/ggt ltsupgt2lt/supgt
ltinfgtilt/infgt lt/dformulagt
6Math Converting to MathML
ltxslwhen test"sup or inf"gt ltxslfor-each
select"childnode()"gt ltxslchoosegt
ltxslwhen test"name(selfnode())'sup'
and name(following-siblingnode()1)'inf'"gt
ltxslelement name"msubsup"gt
ltxslelement name"mrow"gt
ltxslapply-templates
select"preceding-siblingnode()1"/gt
lt/xslelementgt
ltxslelement name"mrow"gt ltxslapply-template
s select"following-siblingnode()1"/gt lt/xsle
lementgt ltxslelement name"mrow"gt
ltxslapply-templates select"selfnode()"/gt lt/xs
lelementgt lt/xslelementgt
lt/xslwhengt . . . THERE ARE FIVE
MORE CASES TO HANDLE !
7Math Converting to MathML
- Challenges encountered along the way
- Scripting needed to parse text nodes
ltdformulagta2clt/dformulagt becomes ltmathgtltmigtalt/mi
gtltmogtlt/mogtltmngt2lt/mngtltmogtlt/mogtltmigtclt/migtlt/mathgt
Original SGML math markup does not distinguish
between variables, operators, and numbers
explicitly.
8Math Converting to MathML
- Challenges encountered along the way
- Rendering does not always conform to spec
ltmfenced open closegt . . .
lt/mfencedgt
ltmogtlt/mogt . . . ltmogtlt/mogt
There should be no difference (rendered using
Amaya)
9Math Converting to MathML
- Challenges encountered along the way
- Browsers render equations slightly differently
Original print from publisher Techexplorer
(Netscape) Amaya
10Math Converting to MathML
- XSLT allows us to generate standard MathML from
publisher-dependent SGML math markup - MathML can be rendered in browsers without the
need to style (Amaya, Techexplorer) - Next Step
- create XSL stylesheets for remaining publishers
- continue to minimize hand editing