<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:mml="http://www.w3.org/1998/Math/MathML"
xmlns:m="" target="_blank">http://schemas.openxmlformats.org/officeDocument/2006/math">
<xsl:output method="xml" encoding="UTF-16" />
<!-- %% Global Definitions -->
<!-- Every single unicode character that is recognized by OMML as an operator -->
<xsl:variable name="sOperators"
select="concat(
'¨!"#&()+,-./:',
';<=>?@[\]^_`{',
'|}~¡¦¬¯°±²³´·¹¿',
'×~÷ˇ˘˙˜˝̀́̂̃̄̅̆̇̈̉',
'̊̋̌̍̎̏̐̑̒̓̔̕',
'̡̛̖̗̘̙̜̝̞̟̠̚',
'̢̧̨̣̤̥̦̩̪̫̬̭',
'̴̵̶̷̸̮̯̰̱̲̳̿',
'         ‐‒–',
'—‖†‡•․‥…′″‴‼',
'⁀⁄⁎⁏⁐⁗⁡⁢⁣⁰⁴⁵',
'⁶⁷⁸⁹⁺⁻⁼⁽⁾₀₁₂',
'₃₄₅₆₇₈₉₊₋₌₍₎',
'⃒⃓⃘⃙⃚⃐⃑⃔⃕⃖⃗⃛',
'⃜⃝⃞⃟⃠⃡⃤⃥⃦⃨⃧⃩',
'⃪⅀ⅆ←↑→↓↔↕↖↗↘↙',
'↚↛↜↝↞↟↠↡↢↣↤↥',
'↦↧↨↩↪↫↬↭↮↯↰↱',
'↲↳↶↷↺↻↼↽↾↿⇀⇁',
'⇂⇃⇄⇅⇆⇇⇈⇉⇊⇋⇌⇍',
'⇎⇏⇐⇑⇒⇓⇔⇕⇖⇗⇘⇙',
'⇚⇛⇜⇝⇞⇟⇠⇡⇢⇣⇤⇥',
'⇦⇧⇨⇩⇳⇴⇵⇶⇷⇸⇹⇺',
'⇻⇼⇽⇾⇿∀∁∂∃∄∆∇',
'∈∉∊∋∌∍∏∐∑−∓∔',
'∕∖∗∘∙√∛∜∝∣∤∥',
'∦∧∨∩∪∫∬∭∮∯∰∱',
'∲∳∴∵∶∷∸∹∺∻∼∽',
'∾≀≁≂≃≄≅≆≇≈≉≊',
'≋≌≍≎≏≐≑≒≓≔≕≖',
'≗≘≙≚≛≜≝≞≟≠≡≢',
'≣≤≥≦≧≨≩≪≫≬≭≮',
'≯≰≱≲≳≴≵≶≷≸≹≺',
'≻≼≽≾≿⊀⊁⊂⊃⊄⊅⊆',
'⊇⊈⊉⊊⊋⊌⊍⊎⊏⊐⊑⊒',
'⊓⊔⊕⊖⊗⊘⊙⊚⊛⊜⊝⊞',
'⊟⊠⊡⊢⊣⊥⊦⊧⊨⊩⊪⊫',
'⊬⊭⊮⊯⊰⊱⊲⊳⊴⊵⊶⊷',
'⊸⊹⊺⊻⊼⊽⋀⋁⋂⋃⋄⋅',
'⋆⋇⋈⋉⋊⋋⋌⋍⋎⋏⋐⋑',
'⋒⋓⋔⋕⋖⋗⋘⋙⋚⋛⋜⋝',
'⋞⋟⋠⋡⋢⋣⋤⋥⋦⋧⋨⋩',
'⋪⋫⋬⋭⋮⋯⋰⋱⋲⋳⋴⋵',
'⋶⋷⋸⋹⋺⋻⋼⋽⋾⋿⌅⌆',
'⌈⌉⌊⌋⌜⌝⌞⌟⌢⌣〈〉',
'⌽⌿⎰⎱⏜⏝⏞⏟⏠│├┤',
'┬┴▁█▒■□▭▲△▴▵',
'▶▷▸▹▼▽▾▿◀◁◂◃',
'◄◅◊○◦◫◬◸◹◺◻◼',
'◽◾◿★☆❲❳⟑⟒⟓⟔⟕',
'⟖⟗⟘⟙⟚⟛⟜⟝⟞⟟⟠⟡',
'⟢⟣⟤⟥⟦⟧⟨⟩⟪⟫⟰⟱',
'⟲⟳⟴⟵⟶⟷⟸⟹⟺⟻⟼⟽',
'⟾⟿⤀⤁⤂⤃⤄⤅⤆⤇⤈⤉',
'⤊⤋⤌⤍⤎⤏⤐⤑⤒⤓⤔⤕',
'⤖⤗⤘⤙⤚⤛⤜⤝⤞⤟⤠⤡',
'⤢⤣⤤⤥⤦⤧⤨⤩⤪⤫⤬⤭',
'⤮⤯⤰⤱⤲⤳⤴⤵⤶⤷⤸⤹',
'⤺⤻⤼⤽⤾⤿⥀⥁⥂⥃⥄⥅',
'⥆⥇⥈⥉⥊⥋⥌⥍⥎⥏⥐⥑',
'⥒⥓⥔⥕⥖⥗⥘⥙⥚⥛⥜⥝',
'⥞⥟⥠⥡⥢⥣⥤⥥⥦⥧⥨⥩',
'⥪⥫⥬⥭⥮⥯⥰⥱⥲⥳⥴⥵',
'⥶⥷⥸⥹⥺⥻⥼⥽⥾⥿⦀⦂',
'⦃⦄⦅⦆⦇⦈⦉⦊⦋⦌⦍⦎',
'⦏⦐⦑⦒⦓⦔⦕⦖⦗⦘⦙⦚',
'⦶⦷⦸⦹⧀⧁⧄⧅⧆⧇⧈⧎',
'⧏⧐⧑⧒⧓⧔⧕⧖⧗⧘⧙⧚',
'⧛⧟⧡⧢⧣⧤⧥⧦⧫⧴⧵⧶',
'⧷⧸⧹⧺⧻⧼⧽⧾⧿⨀⨁⨂',
'⨃⨄⨅⨆⨇⨈⨉⨊⨋⨌⨍⨎',
'⨏⨐⨑⨒⨓⨔⨕⨖⨗⨘⨙⨚',
'⨛⨜⨝⨞⨟⨠⨡⨢⨣⨤⨥⨦',
'⨧⨨⨩⨪⨫⨬⨭⨮⨯⨰⨱⨲',
'⨳⨴⨵⨶⨷⨸⨹⨺⨻⨼⨽⨾',
'⨿⩀⩁⩂⩃⩄⩅⩆⩇⩈⩉⩊',
'⩋⩌⩍⩎⩏⩐⩑⩒⩓⩔⩕⩖',
'⩗⩘⩙⩚⩛⩜⩝⩞⩟⩠⩡⩢',
'⩣⩤⩥⩦⩧⩨⩩⩪⩫⩬⩭⩮',
'⩯⩰⩱⩲⩳⩴⩵⩶⩷⩸⩹⩺',
'⩻⩼⩽⩾⩿⪀⪁⪂⪃⪄⪅⪆',
'⪇⪈⪉⪊⪋⪌⪍⪎⪏⪐⪑⪒',
'⪓⪔⪕⪖⪗⪘⪙⪚⪛⪜⪝⪞',
'⪟⪠⪡⪢⪣⪤⪥⪦⪧⪨⪩⪪',
'⪫⪬⪭⪮⪯⪰⪱⪲⪳⪴⪵⪶',
'⪷⪸⪹⪺⪻⪼⪽⪾⪿⫀⫁⫂',
'⫃⫄⫅⫆⫇⫈⫉⫊⫋⫌⫍⫎',
'⫏⫐⫑⫒⫓⫔⫕⫖⫗⫘⫙⫚',
'⫛⫝̸⫝⫞⫟⫠⫢⫣⫤⫥⫦⫧',
'⫨⫩⫪⫫⫬⫭⫮⫯⫰⫲⫳⫴',
'⫵⫶⫷⫸⫹⫺⫻⫼⫽⫾⫿⬄',
'⬆⬇⬌⬍〔〕〖〗〘〙!&',
'()+,-./:;<=>',
'?@[\]^_{|}')" />
<!-- A string of '-'s repeated exactly as many times as the operators above -->
<xsl:variable name="sMinuses">
<xsl:call-template name="SRepeatChar">
<xsl:with-param name="cchRequired" select="string-length($sOperators)" />
<xsl:with-param name="ch" select="'-'" />
</xsl:call-template>
</xsl:variable>
<!-- Every single unicode character that is recognized by OMML as a number -->
<xsl:variable name="sNumbers" select="'0123456789'" />
<!-- A string of '0's repeated exactly as many times as the list of numbers above -->
<xsl:variable name="sZeros">
<xsl:call-template name="SRepeatChar">
<xsl:with-param name="cchRequired" select="string-length($sNumbers)" />
<xsl:with-param name="ch" select="'0'" />
</xsl:call-template>
</xsl:variable>
<!-- %%Template: SReplace
Replace all occurences of sOrig in sInput with sReplacement
and return the resulting string. -->
<xsl:template name="SReplace">
<xsl:param name="sInput" />
<xsl:param name="sOrig" />
<xsl:param name="sReplacement" />
<xsl:choose>
<xsl:when test="not(contains($sInput, $sOrig))">
<xsl:value-of select="$sInput" />
</xsl:when>
<xsl:otherwise>
<xsl:variable name="sBefore" select="substring-before($sInput, $sOrig)" />
<xsl:variable name="sAfter" select="substring-after($sInput, $sOrig)" />
<xsl:variable name="sAfterProcessed">
<xsl:call-template name="SReplace">
<xsl:with-param name="sInput" select="$sAfter" />
<xsl:with-param name="sOrig" select="$sOrig" />
<xsl:with-param name="sReplacement" select="$sReplacement" />
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="concat($sBefore, concat($sReplacement, $sAfterProcessed))" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Templates -->
<xsl:template match="/">
<mml:math>
<xsl:apply-templates select="*" />
</mml:math>
</xsl:template>
<xsl:template match="m:borderBox">
<!-- Get Lowercase versions of properties -->
<xsl:variable name="sLowerCaseHideTop" select="translate(m:borderBoxPr[last()]/m:hideTop[last()]/@m:val, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz')" />
<xsl:variable name="sLowerCaseHideBot" select="translate(m:borderBoxPr[last()]/m:hideBot[last()]/@m:val, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz')" />
<xsl:variable name="sLowerCaseHideLeft" select="translate(m:borderBoxPr[last()]/m:hideLeft[last()]/@m:val, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz')" />
<xsl:variable name="sLowerCaseHideRight" select="translate(m:borderBoxPr[last()]/m:hideRight[last()]/@m:val, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz')" />
<xsl:variable name="sLowerCaseStrikeH" select="translate(m:borderBoxPr[last()]/m:strikeH[last()]/@m:val, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz')" />
<xsl:variable name="sLowerCaseStrikeV" select="translate(m:borderBoxPr[last()]/m:strikeV[last()]/@m:val, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz')" />
<xsl:variable name="sLowerCaseStrikeBLTR" select="translate(m:borderBoxPr[last()]/m:strikeBLTR[last()]/@m:val, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz')" />
<xsl:variable name="sLowerCaseStrikeTLBR" select="translate(m:borderBoxPr[last()]/m:strikeTLBR[last()]/@m:val, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz')" />
<xsl:variable name="fHideTop">
<xsl:call-template name="ForceTrueStrVal">
<xsl:with-param name="str" select="$sLowerCaseHideTop" />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="fHideBot">
<xsl:call-template name="ForceTrueStrVal">
<xsl:with-param name="str" select="$sLowerCaseHideBot" />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="fHideLeft">
<xsl:call-template name="ForceTrueStrVal">
<xsl:with-param name="str" select="$sLowerCaseHideLeft" />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="fHideRight">
<xsl:call-template name="ForceTrueStrVal">
<xsl:with-param name="str" select="$sLowerCaseHideRight" />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="fStrikeH">
<xsl:call-template name="ForceTrueStrVal">
<xsl:with-param name="str" select="$sLowerCaseStrikeH" />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="fStrikeV">
<xsl:call-template name="ForceTrueStrVal">
<xsl:with-param name="str" select="$sLowerCaseStrikeV" />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="fStrikeBLTR">
<xsl:call-template name="ForceTrueStrVal">
<xsl:with-param name="str" select="$sLowerCaseStrikeBLTR" />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="fStrikeTLBR">
<xsl:call-template name="ForceTrueStrVal">
<xsl:with-param name="str" select="$sLowerCaseStrikeTLBR" />
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$fHideTop=1
and $fHideBot=1
and $fHideLeft=1
and $fHideRight=1
and $fStrikeH=0
and $fStrikeV=0
and $fStrikeBLTR=0
and $fStrikeTLBR=0">
<mml:mrow>
<xsl:apply-templates select="m:e[1]" />
</mml:mrow>
</xsl:when>
<xsl:otherwise>
<mml:menclose>
<xsl:call-template name="CreateMencloseNotationAttrFromBorderBoxAttr">
<xsl:with-param name="fHideTop" select="$fHideTop" />
<xsl:with-param name="fHideBot" select="$fHideBot" />
<xsl:with-param name="fHideLeft" select="$fHideLeft" />
<xsl:with-param name="fHideRight" select="$fHideRight" />
<xsl:with-param name="fStrikeH" select="$fStrikeH" />
<xsl:with-param name="fStrikeV" select="$fStrikeV" />
<xsl:with-param name="fStrikeBLTR" select="$fStrikeBLTR" />
<xsl:with-param name="fStrikeTLBR" select="$fStrikeTLBR" />
</xsl:call-template>
<xsl:apply-templates select="m:e[1]" />
</mml:menclose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="*">
<xsl:apply-templates select="*" />
</xsl:template>
<!--
{ Non-combining, Upper-combining, Lower-combining }
{U+02D8, U+0306, U+032E}, // BREVE
{U+00B8, U+0312, U+0327}, // CEDILLA
{U+0060, U+0300, U+0316}, // GRAVE ACCENT
{U+002D, U+0305, U+0332}, // HYPHEN-MINUS/OVERLINE
{U+2212, U+0305, U+0332}, // MINUS SIGN/OVERLINE
{U+002E, U+0305, U+0323}, // FULL STOP/DOT ABOVE
{U+02D9, U+0307, U+0323}, // DOT ABOVE
{U+02DD, U+030B, U+02DD}, // DOUBLE ACUTE ACCENT
{U+00B4, U+0301, U+0317}, // ACUTE ACCENT
{U+007E, U+0303, U+0330}, // TILDE
{U+02DC, U+0303, U+0330}, // SMALL TILDE
{U+00A8, U+0308, U+0324}, // DIAERESIS
{U+02C7, U+030C, U+032C}, // CARON
{U+005E, U+0302, U+032D}, // CIRCUMFLEX ACCENT
{U+00AF, U+0305, ::::::}, // MACRON
{U+005F, ::::::, U+0332}, // LOW LINE
{U+2192, U+20D7, U+20EF}, // RIGHTWARDS ARROW
{U+27F6, U+20D7, U+20EF}, // LONG RIGHTWARDS ARROW
{U+2190, U+20D6, U+20EE}, // LEFT ARROW
-->
<xsl:template name="ToNonCombining">
<xsl:param name="ch" />
<xsl:choose>
<!-- BREVE -->
<xsl:when test="$ch='̆' or $ch='̮'">˘</xsl:when>
<!-- CEDILLA -->
<xsl:when test="$ch='̒' or $ch='̧'">¸</xsl:when>
<!-- GRAVE ACCENT -->
<xsl:when test="$ch='̀' or $ch='̖'">`</xsl:when>
<!-- HYPHEN-MINUS/OVERLINE -->
<xsl:when test="$ch='̅' or $ch='̲'">-</xsl:when>
<!-- MINUS SIGN/OVERLINE -->
<xsl:when test="$ch='̅' or $ch='̲'">−</xsl:when>
<!-- FULL STOP/DOT ABOVE -->
<xsl:when test="$ch='̅' or $ch='̣'">.</xsl:when>
<!-- DOT ABOVE -->
<xsl:when test="$ch='̇' or $ch='̣'">˙</xsl:when>
<!-- DOUBLE ACUTE ACCENT -->
<xsl:when test="$ch='̋' or $ch='˝'">˝</xsl:when>
<!-- ACUTE ACCENT -->
<xsl:when test="$ch='́' or $ch='̗'">´</xsl:when>
<!-- TILDE -->
<xsl:when test="$ch='̃' or $ch='̰'">~</xsl:when>
<!-- SMALL TILDE -->
<xsl:when test="$ch='̃' or $ch='̰'">˜</xsl:when>
<!-- DIAERESIS -->
<xsl:when test="$ch='̈' or $ch='̤'">¨</xsl:when>
<!-- CARON -->
<xsl:when test="$ch='̌' or $ch='̬'">ˇ</xsl:when>
<!-- CIRCUMFLEX ACCENT -->
<xsl:when test="$ch='̂' or $ch='̭'">^</xsl:when>
<!-- MACRON -->
<xsl:when test="$ch='̅' ">¯</xsl:when>
<!-- LOW LINE -->
<xsl:when test=" $ch='̲'">_</xsl:when>
<!-- RIGHTWARDS ARROW -->
<xsl:when test="$ch='⃗' or $ch='⃯'">→</xsl:when>
<!-- LONG RIGHTWARDS ARROW -->
<xsl:when test="$ch='⃗' or $ch='⃯'">⟶</xsl:when>
<!-- LEFT ARROW -->
<xsl:when test="$ch='⃖' or $ch='⃮'">←</xsl:when>