1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068 |
- <?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="http://schemas.openxmlformats.org/officeDocument/2006/math">
- <xsl:output method="xml" encoding="UTF-16" />
-
-
- <xsl:variable name="sOperators"
- select="concat(
- '¨!"#&()+,-./:',
- ';<=>?@[\]^_`{',
- '|}~¡¦¬¯°±²³´·¹¿',
- '×~÷ˇ˘˙˜˝̀́̂̃̄̅̆̇̈̉',
- '̊̋̌̍̎̏̐̑̒̓̔̕',
- '̡̛̖̗̘̙̜̝̞̟̠̚',
- '̢̧̨̣̤̥̦̩̪̫̬̭',
- '̴̵̶̷̸̮̯̰̱̲̳̿',
- '         ‐‒–',
- '—‖†‡•․‥…′″‴‼',
- '⁀⁄⁎⁏⁐⁗⁡⁢⁣⁰⁴⁵',
- '⁶⁷⁸⁹⁺⁻⁼⁽⁾₀₁₂',
- '₃₄₅₆₇₈₉₊₋₌₍₎',
- '⃒⃓⃘⃙⃚⃐⃑⃔⃕⃖⃗⃛',
- '⃜⃝⃞⃟⃠⃡⃤⃥⃦⃨⃧⃩',
- '⃪⅀ⅆ←↑→↓↔↕↖↗↘↙',
- '↚↛↜↝↞↟↠↡↢↣↤↥',
- '↦↧↨↩↪↫↬↭↮↯↰↱',
- '↲↳↶↷↺↻↼↽↾↿⇀⇁',
- '⇂⇃⇄⇅⇆⇇⇈⇉⇊⇋⇌⇍',
- '⇎⇏⇐⇑⇒⇓⇔⇕⇖⇗⇘⇙',
- '⇚⇛⇜⇝⇞⇟⇠⇡⇢⇣⇤⇥',
- '⇦⇧⇨⇩⇳⇴⇵⇶⇷⇸⇹⇺',
- '⇻⇼⇽⇾⇿∀∁∂∃∄∆∇',
- '∈∉∊∋∌∍∏∐∑−∓∔',
- '∕∖∗∘∙√∛∜∝∣∤∥',
- '∦∧∨∩∪∫∬∭∮∯∰∱',
- '∲∳∴∵∶∷∸∹∺∻∼∽',
- '∾≀≁≂≃≄≅≆≇≈≉≊',
- '≋≌≍≎≏≐≑≒≓≔≕≖',
- '≗≘≙≚≛≜≝≞≟≠≡≢',
- '≣≤≥≦≧≨≩≪≫≬≭≮',
- '≯≰≱≲≳≴≵≶≷≸≹≺',
- '≻≼≽≾≿⊀⊁⊂⊃⊄⊅⊆',
- '⊇⊈⊉⊊⊋⊌⊍⊎⊏⊐⊑⊒',
- '⊓⊔⊕⊖⊗⊘⊙⊚⊛⊜⊝⊞',
- '⊟⊠⊡⊢⊣⊥⊦⊧⊨⊩⊪⊫',
- '⊬⊭⊮⊯⊰⊱⊲⊳⊴⊵⊶⊷',
- '⊸⊹⊺⊻⊼⊽⋀⋁⋂⋃⋄⋅',
- '⋆⋇⋈⋉⋊⋋⋌⋍⋎⋏⋐⋑',
- '⋒⋓⋔⋕⋖⋗⋘⋙⋚⋛⋜⋝',
- '⋞⋟⋠⋡⋢⋣⋤⋥⋦⋧⋨⋩',
- '⋪⋫⋬⋭⋮⋯⋰⋱⋲⋳⋴⋵',
- '⋶⋷⋸⋹⋺⋻⋼⋽⋾⋿⌅⌆',
- '⌈⌉⌊⌋⌜⌝⌞⌟⌢⌣〈〉',
- '⌽⌿⎰⎱⏜⏝⏞⏟⏠│├┤',
- '┬┴▁█▒■□▭▲△▴▵',
- '▶▷▸▹▼▽▾▿◀◁◂◃',
- '◄◅◊○◦◫◬◸◹◺◻◼',
- '◽◾◿★☆❲❳⟑⟒⟓⟔⟕',
- '⟖⟗⟘⟙⟚⟛⟜⟝⟞⟟⟠⟡',
- '⟢⟣⟤⟥⟦⟧⟨⟩⟪⟫⟰⟱',
- '⟲⟳⟴⟵⟶⟷⟸⟹⟺⟻⟼⟽',
- '⟾⟿⤀⤁⤂⤃⤄⤅⤆⤇⤈⤉',
- '⤊⤋⤌⤍⤎⤏⤐⤑⤒⤓⤔⤕',
- '⤖⤗⤘⤙⤚⤛⤜⤝⤞⤟⤠⤡',
- '⤢⤣⤤⤥⤦⤧⤨⤩⤪⤫⤬⤭',
- '⤮⤯⤰⤱⤲⤳⤴⤵⤶⤷⤸⤹',
- '⤺⤻⤼⤽⤾⤿⥀⥁⥂⥃⥄⥅',
- '⥆⥇⥈⥉⥊⥋⥌⥍⥎⥏⥐⥑',
- '⥒⥓⥔⥕⥖⥗⥘⥙⥚⥛⥜⥝',
- '⥞⥟⥠⥡⥢⥣⥤⥥⥦⥧⥨⥩',
- '⥪⥫⥬⥭⥮⥯⥰⥱⥲⥳⥴⥵',
- '⥶⥷⥸⥹⥺⥻⥼⥽⥾⥿⦀⦂',
- '⦃⦄⦅⦆⦇⦈⦉⦊⦋⦌⦍⦎',
- '⦏⦐⦑⦒⦓⦔⦕⦖⦗⦘⦙⦚',
- '⦶⦷⦸⦹⧀⧁⧄⧅⧆⧇⧈⧎',
- '⧏⧐⧑⧒⧓⧔⧕⧖⧗⧘⧙⧚',
- '⧛⧟⧡⧢⧣⧤⧥⧦⧫⧴⧵⧶',
- '⧷⧸⧹⧺⧻⧼⧽⧾⧿⨀⨁⨂',
- '⨃⨄⨅⨆⨇⨈⨉⨊⨋⨌⨍⨎',
- '⨏⨐⨑⨒⨓⨔⨕⨖⨗⨘⨙⨚',
- '⨛⨜⨝⨞⨟⨠⨡⨢⨣⨤⨥⨦',
- '⨧⨨⨩⨪⨫⨬⨭⨮⨯⨰⨱⨲',
- '⨳⨴⨵⨶⨷⨸⨹⨺⨻⨼⨽⨾',
- '⨿⩀⩁⩂⩃⩄⩅⩆⩇⩈⩉⩊',
- '⩋⩌⩍⩎⩏⩐⩑⩒⩓⩔⩕⩖',
- '⩗⩘⩙⩚⩛⩜⩝⩞⩟⩠⩡⩢',
- '⩣⩤⩥⩦⩧⩨⩩⩪⩫⩬⩭⩮',
- '⩯⩰⩱⩲⩳⩴⩵⩶⩷⩸⩹⩺',
- '⩻⩼⩽⩾⩿⪀⪁⪂⪃⪄⪅⪆',
- '⪇⪈⪉⪊⪋⪌⪍⪎⪏⪐⪑⪒',
- '⪓⪔⪕⪖⪗⪘⪙⪚⪛⪜⪝⪞',
- '⪟⪠⪡⪢⪣⪤⪥⪦⪧⪨⪩⪪',
- '⪫⪬⪭⪮⪯⪰⪱⪲⪳⪴⪵⪶',
- '⪷⪸⪹⪺⪻⪼⪽⪾⪿⫀⫁⫂',
- '⫃⫄⫅⫆⫇⫈⫉⫊⫋⫌⫍⫎',
- '⫏⫐⫑⫒⫓⫔⫕⫖⫗⫘⫙⫚',
- '⫛⫝̸⫝⫞⫟⫠⫢⫣⫤⫥⫦⫧',
- '⫨⫩⫪⫫⫬⫭⫮⫯⫰⫲⫳⫴',
- '⫵⫶⫷⫸⫹⫺⫻⫼⫽⫾⫿⬄',
- '⬆⬇⬌⬍〔〕〖〗〘〙!&',
- '()+,-./:;<=>',
- '?@[\]^_{|}')" />
-
- <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>
-
- <xsl:variable name="sNumbers" select="'0123456789'" />
-
- <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>
-
- <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>
-
- <xsl:template match="/">
- <mml:math>
- <xsl:apply-templates select="*" />
- </mml:math>
- </xsl:template>
- <xsl:template match="m:borderBox">
-
- <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}
- {U+00B8, U+0312, U+0327}
- {U+0060, U+0300, U+0316}
- {U+002D, U+0305, U+0332}
- {U+2212, U+0305, U+0332}
- {U+002E, U+0305, U+0323}
- {U+02D9, U+0307, U+0323}
- {U+02DD, U+030B, U+02DD}
- {U+00B4, U+0301, U+0317}
- {U+007E, U+0303, U+0330}
- {U+02DC, U+0303, U+0330}
- {U+00A8, U+0308, U+0324}
- {U+02C7, U+030C, U+032C}
- {U+005E, U+0302, U+032D}
- {U+00AF, U+0305, ::::::}
- {U+005F, ::::::, U+0332}
- {U+2192, U+20D7, U+20EF}
- {U+27F6, U+20D7, U+20EF}
- {U+2190, U+20D6, U+20EE}
- <xsl:template name="ToNonCombining">
- <xsl:param name="ch" />
- <xsl:choose>
-
- <xsl:when test="$ch='̆' or $ch='̮'">˘</xsl:when>
-
- <xsl:when test="$ch='̒' or $ch='̧'">¸</xsl:when>
-
- <xsl:when test="$ch='̀' or $ch='̖'">`</xsl:when>
-
- <xsl:when test="$ch='̅' or $ch='̲'">-</xsl:when>
-
- <xsl:when test="$ch='̅' or $ch='̲'">−</xsl:when>
-
- <xsl:when test="$ch='̅' or $ch='̣'">.</xsl:when>
-
- <xsl:when test="$ch='̇' or $ch='̣'">˙</xsl:when>
-
- <xsl:when test="$ch='̋' or $ch='˝'">˝</xsl:when>
-
- <xsl:when test="$ch='́' or $ch='̗'">´</xsl:when>
-
- <xsl:when test="$ch='̃' or $ch='̰'">~</xsl:when>
-
- <xsl:when test="$ch='̃' or $ch='̰'">˜</xsl:when>
-
- <xsl:when test="$ch='̈' or $ch='̤'">¨</xsl:when>
-
- <xsl:when test="$ch='̌' or $ch='̬'">ˇ</xsl:when>
-
- <xsl:when test="$ch='̂' or $ch='̭'">^</xsl:when>
-
- <xsl:when test="$ch='̅' ">¯</xsl:when>
-
- <xsl:when test=" $ch='̲'">_</xsl:when>
-
- <xsl:when test="$ch='⃗' or $ch='⃯'">→</xsl:when>
-
- <xsl:when test="$ch='⃗' or $ch='⃯'">⟶</xsl:when>
-
- <xsl:when test="$ch='⃖' or $ch='⃮'">←</xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$ch"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template match="m:acc">
- <mml:mover>
- <xsl:attribute name="accent">true</xsl:attribute>
- <mml:mrow>
- <xsl:apply-templates select="m:e[1]" />
- </mml:mrow>
- <xsl:variable name="chAcc">
- <xsl:choose>
- <xsl:when test="not(m:accPr[last()]/m:chr)">
- <xsl:value-of select="'̂'" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="substring(m:accPr/m:chr/@m:val,1,1)" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="chNonComb">
- <xsl:call-template name="ToNonCombining">
- <xsl:with-param name="ch" select="$chAcc" />
- </xsl:call-template>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="string-length($chAcc)=0">
- <mml:mo/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="ParseMt">
- <xsl:with-param name="sToParse" select="$chNonComb" />
- <xsl:with-param name="scr" select="m:e[1]/*/m:rPr[last()]/m:scr/@m:val" />
- <xsl:with-param name="sty" select="m:e[1]/*/m:rPr[last()]/m:sty/@m:val" />
- <xsl:with-param name="nor">
- <xsl:choose>
- <xsl:when test="count(m:e[1]/*/m:rPr[last()]/m:nor) = 0">0</xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="ForceFalseStrVal">
- <xsl:with-param name="str" select="translate(m:e[1]/*/m:rPr[last()]/m:nor/@m:val,
- 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
- 'abcdefghijklmnopqrstuvwxyz')" />
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </mml:mover>
- </xsl:template>
- <xsl:template name="OutputScript">
- <xsl:param name="ndCur" select="." />
- <xsl:choose>
-
- <xsl:when test="count($ndCur/*) > 0">
- <mml:mrow>
- <xsl:apply-templates select="$ndCur" />
- </mml:mrow>
- </xsl:when>
- <xsl:otherwise>
- <mml:none />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template match="m:sPre">
- <mml:mmultiscripts>
- <mml:mrow>
- <xsl:apply-templates select="m:e[1]" />
- </mml:mrow>
- <mml:mprescripts />
- <xsl:call-template name="OutputScript">
- <xsl:with-param name="ndCur" select="m:sub[1]"/>
- </xsl:call-template>
- <xsl:call-template name="OutputScript">
- <xsl:with-param name="ndCur" select="m:sup[1]" />
- </xsl:call-template>
- </mml:mmultiscripts>
- </xsl:template>
- <xsl:template match="m:m">
- <mml:mtable>
- <xsl:call-template name="CreateMathMLMatrixAttr">
- <xsl:with-param name="mcJc" select="m:mPr[last()]/m:mcs/m:mc/m:mcPr[last()]/m:mcJc/@m:val" />
- </xsl:call-template>
- <xsl:for-each select="m:mr">
- <mml:mtr>
- <xsl:for-each select="m:e">
- <mml:mtd>
- <xsl:apply-templates select="." />
- </mml:mtd>
- </xsl:for-each>
- </mml:mtr>
- </xsl:for-each>
- </mml:mtable>
- </xsl:template>
- <xsl:template name="CreateMathMLMatrixAttr">
- <xsl:param name="mcJc" />
- <xsl:variable name="sLowerCaseMcjc" select="translate($mcJc, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
- 'abcdefghijklmnopqrstuvwxyz')" />
- <xsl:choose>
- <xsl:when test="$sLowerCaseMcjc='left'">
- <xsl:attribute name="columnalign">left</xsl:attribute>
- </xsl:when>
- <xsl:when test="$sLowerCaseMcjc='right'">
- <xsl:attribute name="columnalign">right</xsl:attribute>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
- <xsl:template match="m:phant">
- <xsl:variable name="sLowerCaseZeroWidVal" select="translate(m:phantPr[last()]/m:zeroWid[last()]/@m:val,
- 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
- 'abcdefghijklmnopqrstuvwxyz')" />
- <xsl:variable name="sLowerCaseZeroAscVal" select="translate(m:phantPr[last()]/m:zeroAsc[last()]/@m:val,
- 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
- 'abcdefghijklmnopqrstuvwxyz')" />
- <xsl:variable name="sLowerCaseZeroDescVal" select="translate(m:phantPr[last()]/m:zeroDesc[last()]/@m:val,
- 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
- 'abcdefghijklmnopqrstuvwxyz')" />
- <xsl:variable name="sLowerCaseShowVal" select="translate(m:phantPr[last()]/m:show[last()]/@m:val,
- 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
- 'abcdefghijklmnopqrstuvwxyz')" />
-
- <xsl:variable name="fZeroWid">
- <xsl:choose>
- <xsl:when test="count(m:phantPr[last()]/m:zeroWid[last()]) = 0">0</xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="ForceFalseStrVal">
- <xsl:with-param name="str" select="$sLowerCaseZeroWidVal" />
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="fZeroAsc">
- <xsl:choose>
- <xsl:when test="count(m:phantPr[last()]/m:zeroAsc[last()]) = 0">0</xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="ForceFalseStrVal">
- <xsl:with-param name="str" select="$sLowerCaseZeroAscVal" />
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="fZeroDesc">
- <xsl:choose>
- <xsl:when test="count(m:phantPr[last()]/m:zeroDesc[last()]) = 0">0</xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="ForceFalseStrVal">
- <xsl:with-param name="str" select="$sLowerCaseZeroDescVal" />
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:variable name="fShow">
- <xsl:call-template name="ForceFalseStrVal">
- <xsl:with-param name="str" select="$sLowerCaseShowVal" />
- </xsl:call-template>
- </xsl:variable>
- <xsl:choose>
-
- <xsl:when test="$fShow = 1">
- <xsl:element name="mml:mpadded">
- <xsl:call-template name="CreateMpaddedAttributes">
- <xsl:with-param name="fZeroWid" select="$fZeroWid" />
- <xsl:with-param name="fZeroAsc" select="$fZeroAsc" />
- <xsl:with-param name="fZeroDesc" select="$fZeroDesc" />
- </xsl:call-template>
- <mml:mrow>
- <xsl:apply-templates select="m:e" />
- </mml:mrow>
- </xsl:element>
- </xsl:when>
-
- <xsl:when test="$fZeroWid=0 and $fZeroAsc=0 and $fZeroDesc=0">
- <xsl:element name="mml:mphantom">
- <mml:mrow>
- <xsl:apply-templates select="m:e" />
- </mml:mrow>
- </xsl:element>
- </xsl:when>
-
- <xsl:otherwise>
- <xsl:element name="mml:mphantom">
- <xsl:element name="mml:mpadded">
- <xsl:call-template name="CreateMpaddedAttributes">
- <xsl:with-param name="fZeroWid" select="$fZeroWid" />
- <xsl:with-param name="fZeroAsc" select="$fZeroAsc" />
- <xsl:with-param name="fZeroDesc" select="$fZeroDesc" />
- </xsl:call-template>
- <mml:mrow>
- <xsl:apply-templates select="m:e" />
- </mml:mrow>
- </xsl:element>
- </xsl:element>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template name="CreateMpaddedAttributes">
- <xsl:param name="fZeroWid" />
- <xsl:param name="fZeroAsc" />
- <xsl:param name="fZeroDesc" />
- <xsl:if test="$fZeroWid=1">
- <xsl:attribute name="width">0in</xsl:attribute>
- </xsl:if>
- <xsl:if test="$fZeroAsc=1">
- <xsl:attribute name="height">0in</xsl:attribute>
- </xsl:if>
- <xsl:if test="$fZeroDesc=1">
- <xsl:attribute name="depth">0in</xsl:attribute>
- </xsl:if>
- </xsl:template>
- <xsl:template match="m:rad">
- <xsl:variable name="fDegHide">
- <xsl:choose>
- <xsl:when test="count(m:radPr[last()]/m:degHide)=0">0</xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="ForceFalseStrVal">
- <xsl:with-param name="str" select="translate(m:radPr[last()]/m:degHide/@m:val,
- 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
- 'abcdefghijklmnopqrstuvwxyz')" />
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="$fDegHide=1">
- <mml:msqrt>
- <xsl:apply-templates select="m:e[1]" />
- </mml:msqrt>
- </xsl:when>
- <xsl:otherwise>
- <mml:mroot>
- <mml:mrow>
- <xsl:apply-templates select="m:e[1]" />
- </mml:mrow>
- <mml:mrow>
- <xsl:apply-templates select="m:deg[1]" />
- </mml:mrow>
- </mml:mroot>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template name="OutputNaryMo">
- <xsl:param name="ndCur" select="." />
- <xsl:param name="fGrow" select="0" />
- <mml:mo>
- <xsl:choose>
- <xsl:when test="$fGrow=1">
- <xsl:attribute name="stretchy">true</xsl:attribute>
- </xsl:when>
- <xsl:otherwise>
- <xsl:attribute name="stretchy">false</xsl:attribute>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="not($ndCur/m:naryPr[last()]/m:chr/@m:val) or
- $ndCur/m:naryPr[last()]/m:chr/@m:val=''">
- <xsl:text>∫</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$ndCur/m:naryPr[last()]/m:chr/@m:val" />
- </xsl:otherwise>
- </xsl:choose>
- </mml:mo>
- </xsl:template>
-
- <xsl:template match="m:nary">
- <xsl:variable name="sLowerCaseSubHide">
- <xsl:choose>
- <xsl:when test="count(m:naryPr[last()]/m:subHide) = 0">
- <xsl:text>off</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="translate(m:naryPr[last()]/m:subHide/@m:val,
- 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
- 'abcdefghijklmnopqrstuvwxyz')" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="sLowerCaseSupHide">
- <xsl:choose>
- <xsl:when test="count(m:naryPr[last()]/m:supHide) = 0">
- <xsl:text>off</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="translate(m:naryPr[last()]/m:supHide/@m:val,
- 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
- 'abcdefghijklmnopqrstuvwxyz')" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="sLowerCaseLimLoc">
- <xsl:value-of select="translate(m:naryPr[last()]/m:limLoc/@m:val,
- 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
- 'abcdefghijklmnopqrstuvwxyz')" />
- </xsl:variable>
- <xsl:variable name="sLowerGrow">
- <xsl:choose>
- <xsl:when test="count(m:naryPr[last()]/m:grow)=0">off</xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="translate(m:naryPr[last()]/m:grow/@m:val,
- 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
- 'abcdefghijklmnopqrstuvwxyz')" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="fLimLocSubSup">
- <xsl:choose>
- <xsl:when test="count(m:naryPr[last()]/m:limLoc)=0 or $sLowerCaseLimLoc='subsup'">1</xsl:when>
- <xsl:otherwise>0</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="fGrow">
- <xsl:call-template name="ForceFalseStrVal">
- <xsl:with-param name="str" select="$sLowerGrow" />
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="fSupHide">
- <xsl:call-template name="ForceFalseStrVal">
- <xsl:with-param name="str" select="$sLowerCaseSupHide" />
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="fSubHide">
- <xsl:call-template name="ForceFalseStrVal">
- <xsl:with-param name="str" select="$sLowerCaseSubHide" />
- </xsl:call-template>
- </xsl:variable>
- <mml:mrow>
- <xsl:choose>
- <xsl:when test="$fSupHide=1 and $fSubHide=1">
- <xsl:call-template name="OutputNaryMo">
- <xsl:with-param name="ndCur" select="." />
- <xsl:with-param name="fGrow" select="$fGrow" />
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="$fSubHide=1">
- <xsl:choose>
- <xsl:when test="$fLimLocSubSup=1">
- <mml:msup>
- <xsl:call-template name="OutputNaryMo">
- <xsl:with-param name="ndCur" select="." />
- <xsl:with-param name="fGrow" select="$fGrow" />
- </xsl:call-template>
- <mml:mrow>
- <xsl:apply-templates select="m:sup[1]" />
- </mml:mrow>
- </mml:msup>
- </xsl:when>
- <xsl:otherwise>
- <mml:mover>
- <xsl:call-template name="OutputNaryMo">
- <xsl:with-param name="ndCur" select="." />
- <xsl:with-param name="fGrow" select="$fGrow" />
- </xsl:call-template>
- <mml:mrow>
- <xsl:apply-templates select="m:sup[1]" />
- </mml:mrow>
- </mml:mover>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:when test="$fSupHide=1">
- <xsl:choose>
- <xsl:when test="$fLimLocSubSup=1">
- <mml:msub>
- <xsl:call-template name="OutputNaryMo">
- <xsl:with-param name="ndCur" select="." />
- <xsl:with-param name="fGrow" select="$fGrow" />
- </xsl:call-template>
- <mml:mrow>
- <xsl:apply-templates select="m:sub[1]" />
- </mml:mrow>
- </mml:msub>
- </xsl:when>
- <xsl:otherwise>
- <mml:munder>
- <xsl:call-template name="OutputNaryMo">
- <xsl:with-param name="ndCur" select="." />
- <xsl:with-param name="fGrow" select="$fGrow" />
- </xsl:call-template>
- <mml:mrow>
- <xsl:apply-templates select="m:sub[1]" />
- </mml:mrow>
- </mml:munder>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when test="$fLimLocSubSup=1">
- <mml:msubsup>
- <xsl:call-template name="OutputNaryMo">
- <xsl:with-param name="ndCur" select="." />
- <xsl:with-param name="fGrow" select="$fGrow" />
- </xsl:call-template>
- <mml:mrow>
- <xsl:apply-templates select="m:sub[1]" />
- </mml:mrow>
- <mml:mrow>
- <xsl:apply-templates select="m:sup[1]" />
- </mml:mrow>
- </mml:msubsup>
- </xsl:when>
- <xsl:otherwise>
- <mml:munderover>
- <xsl:call-template name="OutputNaryMo">
- <xsl:with-param name="ndCur" select="." />
- <xsl:with-param name="fGrow" select="$fGrow" />
- </xsl:call-template>
- <mml:mrow>
- <xsl:apply-templates select="m:sub[1]" />
- </mml:mrow>
- <mml:mrow>
- <xsl:apply-templates select="m:sup[1]" />
- </mml:mrow>
- </mml:munderover>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- <mml:mrow>
- <xsl:apply-templates select="m:e[1]" />
- </mml:mrow>
- </mml:mrow>
- </xsl:template>
- <xsl:template match="m:limLow">
- <mml:munder>
- <mml:mrow>
- <xsl:apply-templates select="m:e[1]" />
- </mml:mrow>
- <mml:mrow>
- <xsl:apply-templates select="m:lim[1]" />
- </mml:mrow>
- </mml:munder>
- </xsl:template>
- <xsl:template match="m:limUpp">
- <mml:mover>
- <mml:mrow>
- <xsl:apply-templates select="m:e[1]" />
- </mml:mrow>
- <mml:mrow>
- <xsl:apply-templates select="m:lim[1]" />
- </mml:mrow>
- </mml:mover>
- </xsl:template>
- <xsl:template match="m:sSub">
- <mml:msub>
- <mml:mrow>
- <xsl:apply-templates select="m:e[1]" />
- </mml:mrow>
- <mml:mrow>
- <xsl:apply-templates select="m:sub[1]" />
- </mml:mrow>
- </mml:msub>
- </xsl:template>
- <xsl:template match="m:sSup">
- <mml:msup>
- <mml:mrow>
- <xsl:apply-templates select="m:e[1]" />
- </mml:mrow>
- <mml:mrow>
- <xsl:apply-templates select="m:sup[1]" />
- </mml:mrow>
- </mml:msup>
- </xsl:template>
- <xsl:template match="m:sSubSup">
- <mml:msubsup>
- <mml:mrow>
- <xsl:apply-templates select="m:e[1]" />
- </mml:mrow>
- <mml:mrow>
- <xsl:apply-templates select="m:sub[1]" />
- </mml:mrow>
- <mml:mrow>
- <xsl:apply-templates select="m:sup[1]" />
- </mml:mrow>
- </mml:msubsup>
- </xsl:template>
- <xsl:template match="m:groupChr">
- <xsl:variable name="ndLastGroupChrPr" select="m:groupChrPr[last()]" />
- <xsl:variable name="sLowerCasePos" select="translate($ndLastGroupChrPr/m:pos/@m:val,
- 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
- 'abcdefghijklmnopqrstuvwxyz')" />
- <xsl:variable name="sLowerCaseVertJc" select="translate($ndLastGroupChrPr/m:vertJc/@m:val,
- 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
- 'abcdefghijklmnopqrstuvwxyz')" />
- <xsl:variable name="ndLastChr" select="$ndLastGroupChrPr/m:chr" />
- <xsl:variable name="chr">
- <xsl:choose>
- <xsl:when test="$ndLastChr and (not($ndLastChr/@m:val) or string-length($ndLastChr/@m:val) = 0)"></xsl:when>
- <xsl:when test="string-length($ndLastChr/@m:val) >= 1">
- <xsl:value-of select="substring($ndLastChr/@m:val,1,1)" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>⏟</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="$sLowerCasePos = 'top'">
- <xsl:choose>
- <xsl:when test="$sLowerCaseVertJc = 'bot'">
- <mml:mover accent="false">
- <mml:mrow>
- <xsl:apply-templates select="m:e[1]" />
- </mml:mrow>
- <mml:mo>
- <xsl:value-of select="$chr" />
- </mml:mo>
- </mml:mover>
- </xsl:when>
- <xsl:otherwise>
- <mml:munder accentunder="false">
- <mml:mo>
- <xsl:value-of select="$chr" />
- </mml:mo>
- <mml:mrow>
- <xsl:apply-templates select="m:e[1]" />
- </mml:mrow>
- </mml:munder>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when test="$sLowerCaseVertJc = 'bot'">
- <mml:mover accent="false">
- <mml:mo>
- <xsl:value-of select="$chr" />
- </mml:mo>
- <mml:mrow>
- <xsl:apply-templates select="m:e[1]" />
- </mml:mrow>
- </mml:mover>
- </xsl:when>
- <xsl:otherwise>
- <mml:munder accentunder="false">
- <mml:mrow>
- <xsl:apply-templates select="m:e[1]" />
- </mml:mrow>
- <mml:mo>
- <xsl:value-of select="$chr" />
- </mml:mo>
- </mml:munder>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template name="fName">
- <xsl:for-each select="m:fName/*">
- <xsl:apply-templates select="." />
- </xsl:for-each>
- </xsl:template>
- <xsl:template match="m:func">
- <mml:mrow>
- <mml:mrow>
- <xsl:call-template name="fName" />
- </mml:mrow>
- <mml:mo>⁡</mml:mo>
- <mml:mrow>
- <xsl:apply-templates select="m:e" />
- </mml:mrow>
- </mml:mrow>
- </xsl:template>
-
- <xsl:template match="m:f">
- <xsl:variable name="sLowerCaseType" select="translate(m:fPr[last()]/m:type/@m:val, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')" />
- <xsl:choose>
- <xsl:when test="$sLowerCaseType='lin'">
- <mml:mrow>
- <mml:mrow>
- <xsl:apply-templates select="m:num[1]" />
- </mml:mrow>
- <mml:mo>/</mml:mo>
- <mml:mrow>
- <xsl:apply-templates select="m:den[1]" />
- </mml:mrow>
- </mml:mrow>
- </xsl:when>
- <xsl:otherwise>
- <mml:mfrac>
- <xsl:call-template name="CreateMathMLFracProp">
- <xsl:with-param name="type" select="$sLowerCaseType" />
- </xsl:call-template>
- <mml:mrow>
- <xsl:apply-templates select="m:num[1]" />
- </mml:mrow>
- <mml:mrow>
- <xsl:apply-templates select="m:den[1]" />
- </mml:mrow>
- </mml:mfrac>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="CreateMathMLFracProp">
- <xsl:param name="type" />
- <xsl:variable name="sLowerCaseType" select="translate($type, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')" />
- <xsl:if test="$sLowerCaseType='skw' or $sLowerCaseType='lin'">
- <xsl:attribute name="bevelled">true</xsl:attribute>
- </xsl:if>
- <xsl:if test="$sLowerCaseType='nobar'">
- <xsl:attribute name="linethickness">0pt</xsl:attribute>
- </xsl:if>
- <xsl:choose>
- <xsl:when test="sLowerCaseNumJc='right'">
- <xsl:attribute name="numalign">right</xsl:attribute>
- </xsl:when>
- <xsl:when test="sLowerCaseNumJc='left'">
- <xsl:attribute name="numalign">left</xsl:attribute>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="sLowerCaseDenJc='right'">
- <xsl:attribute name="numalign">right</xsl:attribute>
- </xsl:when>
- <xsl:when test="sLowerCaseDenJc='left'">
- <xsl:attribute name="numalign">left</xsl:attribute>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match="m:e | m:den | m:num | m:lim | m:sup | m:sub">
- <xsl:choose>
-
- <xsl:when test="not(m:argPr[last()]/m:scrLvl/@m:val)">
- <xsl:apply-templates select="*" />
- </xsl:when>
-
- <xsl:otherwise>
- <mml:mstyle>
- <xsl:attribute name="scriptlevel">
- <xsl:value-of select="m:argPr[last()]/m:scrLvl/@m:val" />
- </xsl:attribute>
- <xsl:apply-templates select="*" />
- </mml:mstyle>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template match="m:bar">
- <xsl:variable name="sLowerCasePos" select="translate(m:barPr/m:pos/@m:val, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
- 'abcdefghijklmnopqrstuvwxyz')" />
- <xsl:variable name="fTop">
- <xsl:choose>
- <xsl:when test="$sLowerCasePos='top'">1</xsl:when>
- <xsl:otherwise>0</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="$fTop=1">
- <mml:mover accent="false">
- <mml:mrow>
- <xsl:apply-templates select="m:e[1]" />
- </mml:mrow>
- <mml:mo>
- <xsl:text>¯</xsl:text>
- </mml:mo>
- </mml:mover>
- </xsl:when>
- <xsl:otherwise>
- <mml:munder underaccent="false">
- <mml:mrow>
- <xsl:apply-templates select="m:e[1]" />
- </mml:mrow>
- <mml:mo>
- <xsl:text>_</xsl:text>
- </mml:mo>
- </mml:munder>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match="m:d">
- <mml:mfenced>
-
- <xsl:if test="m:dPr[1]/m:begChr/@m:val and not(m:dPr[1]/m:begChr/@m:val ='(')">
- <xsl:attribute name="open">
- <xsl:value-of select="m:dPr[1]/m:begChr/@m:val" />
- </xsl:attribute>
- </xsl:if>
-
- <xsl:if test="m:dPr[1]/m:endChr/@m:val and not(m:dPr[1]/m:endChr/@m:val =')')">
- <xsl:attribute name="close">
- <xsl:value-of select="m:dPr[1]/m:endChr/@m:val" />
- </xsl:attribute>
- </xsl:if>
-
- <xsl:choose>
-
- <xsl:when test="m:dPr[1]/m:sepChr/@m:val = ','" />
-
- <xsl:when test="not(m:dPr[1]/m:sepChr/@m:val)">
- <xsl:attribute name="separators">
- <xsl:value-of select="'|'" />
- </xsl:attribute>
- </xsl:when>
- <xsl:otherwise>
- <xsl:attribute name="separators">
- <xsl:value-of select="m:dPr[1]/m:sepChr/@m:val" />
- </xsl:attribute>
- </xsl:otherwise>
- </xsl:choose>
-
- <xsl:for-each select="m:e">
- <mml:mrow>
- <xsl:apply-templates select="." />
- </mml:mrow>
- </xsl:for-each>
- </mml:mfenced>
- </xsl:template>
- <xsl:template match="m:r">
- <xsl:variable name="fNor">
- <xsl:choose>
- <xsl:when test="count(child::m:rPr[last()]/m:nor) = 0">0</xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="ForceFalseStrVal">
- <xsl:with-param name="str" select="translate(child::m:rPr[last()]/m:nor/@m:val, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
- 'abcdefghijklmnopqrstuvwxyz')" />
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="$fNor=1">
- <mml:mtext>
- <xsl:variable name="sOutput" select="translate(.//m:t, ' ', ' ')" />
- <xsl:value-of select="$sOutput" />
- </mml:mtext>
- </xsl:when>
- <xsl:otherwise>
- <xsl:for-each select=".//m:t">
- <xsl:call-template name="ParseMt">
- <xsl:with-param name="sToParse" select="text()" />
- <xsl:with-param name="scr" select="../m:rPr[last()]/m:scr/@m:val" />
- <xsl:with-param name="sty" select="../m:rPr[last()]/m:sty/@m:val" />
- <xsl:with-param name="nor">0</xsl:with-param>
- </xsl:call-template>
- </xsl:for-each>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template name="CreateTokenAttributes">
- <xsl:param name="scr" />
- <xsl:param name="sty" />
- <xsl:param name="nor" />
- <xsl:param name="nCharToPrint" />
- <xsl:param name="sTokenType" />
- <xsl:choose>
- <xsl:when test="$nor=1">
- <xsl:attribute name="mathvariant">normal</xsl:attribute>
- </xsl:when>
- <xsl:otherwise>
- <xsl:variable name="mathvariant">
- <xsl:choose>
-
- <xsl:when test="$sTokenType='mn'" />
- <xsl:when test="$scr='monospace'">monospace</xsl:when>
- <xsl:when test="$scr='sans-serif' and $sty='i'">sans-serif-italic</xsl:when>
- <xsl:when test="$scr='sans-serif' and $sty='b'">bold-sans-serif</xsl:when>
- <xsl:when test="$scr='sans-serif' and $sty='bi'">sans-serif-bold-italic</xsl:when>
- <xsl:when test="$scr='sans-serif'">sans-serif</xsl:when>
- <xsl:when test="$scr='fraktur' and ($sty='b' or $sty='bi')">bold-fraktur</xsl:when>
- <xsl:when test="$scr='fraktur'">fraktur</xsl:when>
- <xsl:when test="$scr='double-struck'">double-struck</xsl:when>
- <xsl:when test="$scr='script' and ($sty='b' or $sty='bi')">bold-script</xsl:when>
- <xsl:when test="$scr='script'">script</xsl:when>
- <xsl:when test="($scr='roman' or not($scr) or $scr='') and $sty='b'">bold</xsl:when>
- <xsl:when test="($scr='roman' or not($scr) or $scr='') and $sty='i'">italic</xsl:when>
- <xsl:when test="($scr='roman' or not($scr) or $scr='') and $sty='p'">normal</xsl:when>
- <xsl:when test="($scr='roman' or not($scr) or $scr='') and $sty='bi'">bold-italic</xsl:when>
- <xsl:otherwise />
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="fontweight">
- <xsl:choose>
- <xsl:when test="$sty='b' or $sty='bi'">bold</xsl:when>
- <xsl:otherwise>normal</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="fontstyle">
- <xsl:choose>
- <xsl:when test="$sty='p' or $sty='b'">normal</xsl:when>
- <xsl:otherwise>italic</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:choose>
-
- <xsl:when test="$sTokenType='mo' and $mathvariant!='normal'" />
-
- <xsl:when test="$sTokenType='mi' and $nCharToPrint=1 and ($mathvariant='' or $mathvariant='italic')" />
- <xsl:when test="$sTokenType='mi' and $nCharToPrint > 1 and ($mathvariant='' or $mathvariant='italic')">
- <xsl:attribute name="mathvariant">
- <xsl:value-of select="'italic'" />
- </xsl:attribute>
- </xsl:when>
- <xsl:when test="$mathvariant!='italic' and $mathvariant!=''">
- <xsl:attribute name="mathvariant">
- <xsl:value-of select="$mathvariant" />
- </xsl:attribute>
- </xsl:when>
- <xsl:otherwise>
- <xsl:if test="not($sTokenType='mi' and $nCharToPrint=1) and $fontstyle='italic'">
- <xsl:attribute name="fontstyle">italic</xsl:attribute>
- </xsl:if>
- <xsl:if test="$fontweight='bold'">
- <xsl:attribute name="fontweight">bold</xsl:attribute>
- </xsl:if>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template match="m:eqArr">
- <mml:mtable>
- <xsl:for-each select="m:e">
- <mml:mtr>
- <mml:mtd>
- <xsl:choose>
- <xsl:when test="m:argPr[last()]/m:scrLvl/@m:val!='0' or
- not(m:argPr[last()]/m:scrLvl/@m:val) or
- m:argPr[last()]/m:scrLvl/@m:val=''">
- <mml:mrow>
- <mml:maligngroup />
- <xsl:call-template name="CreateEqArrRow">
- <xsl:with-param name="align" select="1" />
- <xsl:with-param name="ndCur" select="*[1]" />
- </xsl:call-template>
- </mml:mrow>
- </xsl:when>
- <xsl:otherwise>
- <mml:mstyle>
- <xsl:attribute name="scriptlevel">
- <xsl:value-of select="m:argPr[last()]/m:scrLvl/@m:val" />
- </xsl:attribute>
- <mml:maligngroup />
- <xsl:call-template name="CreateEqArrRow">
- <xsl:with-param name="align" select="1" />
- <xsl:with-param name="ndCur" select="*[1]" />
- </xsl:call-template>
- </mml:mstyle>
- </xsl:otherwise>
- </xsl:choose>
- </mml:mtd>
- </mml:mtr>
- </xsl:for-each>
- </mml:mtable>
- </xsl:template>
- <xsl:template name="CreateEqArrRow">
- <xsl:param name="align" />
- <xsl:param name="ndCur" />
- <xsl:variable name="sAllMt">
- <xsl:for-each select="$ndCur/m:t">
- <xsl:value-of select="." />
- </xsl:for-each>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="$ndCur/self::m:r">
- <xsl:call-template name="ParseEqArrMr">
- <xsl:with-param name="sToParse" select="$sAllMt" />
- <xsl:with-param name="scr" select="../m:rPr[last()]/m:scr/@m:val" />
- <xsl:with-param name="sty" select="../m:rPr[last()]/m:sty/@m:val" />
- <xsl:with-param name="nor">
- <xsl:choose>
- <xsl:when test="count($ndCur/m:rPr[last()]/m:nor) = 0">0</xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="ForceFalseStrVal">
- <xsl:with-param name="str" select="translate($ndCur/m:rPr[last()]/m:nor/@m:val,
- 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
- 'abcdefghijklmnopqrstuvwxyz')" />
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:with-param>
- <xsl:with-param name="align" select="$align" />
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates select="$ndCur" />
- </xsl:otherwise>
- </xsl:choose>
- <xsl:if test="count($ndCur/following-sibling::*) > 0">
- <xsl:variable name="cAmp">
- <xsl:call-template name="CountAmp">
- <xsl:with-param name="sAllMt" select="$sAllMt" />
- <xsl:with-param name="cAmp" select="0" />
- </xsl:call-template>
- </xsl:variable>
- <xsl:call-template name="CreateEqArrRow">
- <xsl:with-param name="align" select="($align+($cAmp mod 2)) mod 2" />
- <xsl:with-param name="ndCur" select="$ndCur/following-sibling::*[1]" />
- </xsl:call-template>
- </xsl:if>
- </xsl:template>
- <xsl:template name="CountAmp">
- <xsl:param name="sAllMt" />
- <xsl:param name="cAmp" />
- <xsl:choose>
- <xsl:when test="string-length(substring-after($sAllMt, '&')) > 0 or
- substring($sAllMt, string-length($sAllMt))='&'">
- <xsl:call-template name="CountAmp">
- <xsl:with-param name="sAllMt" select="substring-after($sAllMt, '&')" />
- <xsl:with-param name="cAmp" select="$cAmp+1" />
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$cAmp" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="ParseEqArrMr">
- <xsl:param name="sToParse" />
- <xsl:param name="sty" />
- <xsl:param name="scr" />
- <xsl:param name="nor" />
- <xsl:param name="align" />
- <xsl:if test="string-length($sToParse) > 0">
- <xsl:choose>
- <xsl:when test="substring($sToParse,1,1) = '&'">
- <xsl:choose>
- <xsl:when test="$align='0'">
- <mml:maligngroup />
- </xsl:when>
- <xsl:when test="$align='1'">
- <mml:malignmark />
- </xsl:when>
- </xsl:choose>
- <xsl:call-template name="ParseEqArrMr">
- <xsl:with-param name="sToParse" select="substring($sToParse,2)" />
- <xsl:with-param name="scr" select="$scr" />
- <xsl:with-param name="sty" select="$sty" />
- <xsl:with-param name="nor" select="$nor" />
- <xsl:with-param name="align">
- <xsl:choose>
- <xsl:when test="$align='1'">0</xsl:when>
- <xsl:otherwise>1</xsl:otherwise>
- </xsl:choose>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:variable name="sRepNumWith0">
- <xsl:call-template name="SReplaceNumWithZero">
- <xsl:with-param name="sToParse" select="$sToParse" />
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="sRepOperWith-">
- <xsl:call-template name="SReplaceOperWithMinus">
- <xsl:with-param name="sToParse" select="$sRepNumWith0" />
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="iFirstOper" select="string-length($sRepOperWith-) - string-length(substring-after($sRepOperWith-, '-'))" />
- <xsl:variable name="iFirstNum" select="string-length($sRepOperWith-) - string-length(substring-after($sRepOperWith-, '0'))" />
- <xsl:variable name="iFirstAmp" select="string-length($sRepOperWith-) - string-length(substring-after($sRepOperWith-, '&'))" />
- <xsl:variable name="fNumAtPos1">
- <xsl:choose>
- <xsl:when test="substring($sRepOperWith-,1,1)='0'">1</xsl:when>
- <xsl:otherwise>0</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="fOperAtPos1">
- <xsl:choose>
- <xsl:when test="substring($sRepOperWith-,1,1)='-'">1</xsl:when>
- <xsl:otherwise>0</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:choose>
-
- <xsl:when test="$fNumAtPos1='0' and $fOperAtPos1='0'">
- <xsl:choose>
- <xsl:when test="$nor = 0">
- <mml:mi>
- <xsl:call-template name="CreateTokenAttributes">
- <xsl:with-param name="scr" select="$scr" />
- <xsl:with-param name="sty" select="$sty" />
- <xsl:with-param name="nor" select="$nor" />
- <xsl:with-param name="nCharToPrint" select="1" />
- <xsl:with-param name="sTokenType" select="'mi'" />
- </xsl:call-template>
- <xsl:variable name="sOutput" select="translate(substring($sToParse, 1, 1), ' ', ' ')" />
- <xsl:value-of select="$sOutput" />
- </mml:mi>
- </xsl:when>
- <xsl:otherwise>
- <mml:mtext>
- <xsl:variable name="sOutput" select="translate(substring($sToParse, 1, 1), ' ', ' ')" />
- <xsl:value-of select="$sOutput" />
- </mml:mtext>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:call-template name="ParseEqArrMr">
- <xsl:with-param name="sToParse" select="substring($sToParse, 2)" />
- <xsl:with-param name="scr" select="$scr" />
- <xsl:with-param name="sty" select="$sty" />
- <xsl:with-param name="nor" select="$nor" />
- <xsl:with-param name="align" select="$align" />
- </xsl:call-template>
- </xsl:when>
-
- <xsl:when test="$fOperAtPos1='1'">
- <xsl:choose>
- <xsl:when test="$nor = 0">
- <mml:mo>
- <xsl:call-template name="CreateTokenAttributes">
- <xsl:with-param name="scr" />
- <xsl:with-param name="sty" />
- <xsl:with-param name="nor" select="$nor" />
- <xsl:with-param name="sTokenType" select="'mo'" />
- </xsl:call-template>
- <xsl:value-of select="substring($sToParse,1,1)" />
- </mml:mo>
- </xsl:when>
- <xsl:otherwise>
- <mml:mtext>
- <xsl:value-of select="substring($sToParse,1,1)" />
- </mml:mtext>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:call-template name="ParseEqArrMr">
- <xsl:with-param name="sToParse" select="substring($sToParse, 2)" />
- <xsl:with-param name="scr" select="$scr" />
- <xsl:with-param name="sty" select="$sty" />
- <xsl:with-param name="nor" select="$nor" />
- <xsl:with-param name="align" select="$align" />
- </xsl:call-template>
- </xsl:when>
-
- <xsl:otherwise>
- <xsl:variable name="sConsecNum">
- <xsl:call-template name="SNumStart">
- <xsl:with-param name="sToParse" select="$sToParse" />
- <xsl:with-param name="sPattern" select="$sRepNumWith0" />
- </xsl:call-template>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="$nor = 0">
- <mml:mn>
- <xsl:call-template name="CreateTokenAttributes">
- <xsl:with-param name="scr" />
- <xsl:with-param name="sty" select="'p'"/>
- <xsl:with-param name="nor" select="$nor" />
- <xsl:with-param name="sTokenType" select="'mn'" />
- </xsl:call-template>
- <xsl:value-of select="$sConsecNum" />
- </mml:mn>
- </xsl:when>
- <xsl:otherwise>
- <mml:mtext>
- <xsl:value-of select="$sConsecNum" />
- </mml:mtext>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:call-template name="ParseEqArrMr">
- <xsl:with-param name="sToParse" select="substring-after($sToParse, $sConsecNum)" />
- <xsl:with-param name="scr" select="$scr" />
- <xsl:with-param name="sty" select="$sty" />
- <xsl:with-param name="nor" select="$nor" />
- <xsl:with-param name="align" select="$align" />
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if>
- </xsl:template>
-
- <xsl:template name="ParseMt">
- <xsl:param name="sToParse" />
- <xsl:param name="sty" />
- <xsl:param name="scr" />
- <xsl:param name="nor" />
- <xsl:if test="string-length($sToParse) > 0">
- <xsl:variable name="sRepNumWith0">
- <xsl:call-template name="SReplaceNumWithZero">
- <xsl:with-param name="sToParse" select="$sToParse" />
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="sRepOperWith-">
- <xsl:call-template name="SReplaceOperWithMinus">
- <xsl:with-param name="sToParse" select="$sRepNumWith0" />
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="iFirstOper" select="string-length($sRepOperWith-) - string-length(substring-after($sRepOperWith-, '-'))" />
- <xsl:variable name="iFirstNum" select="string-length($sRepOperWith-) - string-length(substring-after($sRepOperWith-, '0'))" />
- <xsl:variable name="fNumAtPos1">
- <xsl:choose>
- <xsl:when test="substring($sRepOperWith-,1,1)='0'">1</xsl:when>
- <xsl:otherwise>0</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="fOperAtPos1">
- <xsl:choose>
- <xsl:when test="substring($sRepOperWith-,1,1)='-'">1</xsl:when>
- <xsl:otherwise>0</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:choose>
-
- <xsl:when test="$fOperAtPos1='0' and $fNumAtPos1='0'">
- <xsl:variable name="nCharToPrint">
- <xsl:choose>
- <xsl:when test="ancestor::m:fName">
- <xsl:choose>
- <xsl:when test="($iFirstOper=$iFirstNum) and
- ($iFirstOper=string-length($sToParse)) and
- (substring($sRepOperWith-, string-length($sRepOperWith-))!='0') and
- (substring($sRepOperWith-, string-length($sRepOperWith-))!='-')">
- <xsl:value-of select="string-length($sToParse)" />
- </xsl:when>
- <xsl:when test="$iFirstOper < $iFirstNum">
- <xsl:value-of select="$iFirstOper - 1" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$iFirstNum - 1" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>1</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <mml:mi>
- <xsl:call-template name="CreateTokenAttributes">
- <xsl:with-param name="scr" select="$scr" />
- <xsl:with-param name="sty" select="$sty" />
- <xsl:with-param name="nor" select="$nor" />
- <xsl:with-param name="nCharToPrint" select="$nCharToPrint" />
- <xsl:with-param name="sTokenType" select="'mi'" />
- </xsl:call-template>
- <xsl:variable name="sWrite" select="translate(substring($sToParse, 1, $nCharToPrint), ' ', ' ')" />
- <xsl:value-of select="$sWrite" />
- </mml:mi>
- <xsl:call-template name="ParseMt">
- <xsl:with-param name="sToParse" select="substring($sToParse, $nCharToPrint+1)" />
- <xsl:with-param name="scr" select="$scr" />
- <xsl:with-param name="sty" select="$sty" />
- <xsl:with-param name="nor" select="$nor" />
- </xsl:call-template>
- </xsl:when>
-
- <xsl:when test="$fOperAtPos1='1'">
- <mml:mo>
- <xsl:call-template name="CreateTokenAttributes">
- <xsl:with-param name="scr" />
- <xsl:with-param name="sty" />
- <xsl:with-param name="nor" select="$nor" />
- <xsl:with-param name="sTokenType" select="'mo'" />
- </xsl:call-template>
- <xsl:value-of select="substring($sToParse,1,1)" />
- </mml:mo>
- <xsl:call-template name="ParseMt">
- <xsl:with-param name="sToParse" select="substring($sToParse, 2)" />
- <xsl:with-param name="scr" select="$scr" />
- <xsl:with-param name="sty" select="$sty" />
- <xsl:with-param name="nor" select="$nor" />
- </xsl:call-template>
- </xsl:when>
-
- <xsl:otherwise>
- <xsl:variable name="sConsecNum">
- <xsl:call-template name="SNumStart">
- <xsl:with-param name="sToParse" select="$sToParse" />
- <xsl:with-param name="sPattern" select="$sRepNumWith0" />
- </xsl:call-template>
- </xsl:variable>
- <mml:mn>
- <xsl:call-template name="CreateTokenAttributes">
- <xsl:with-param name="scr" select="$scr" />
- <xsl:with-param name="sty" select="'p'" />
- <xsl:with-param name="nor" select="$nor" />
- <xsl:with-param name="sTokenType" select="'mn'" />
- </xsl:call-template>
- <xsl:value-of select="$sConsecNum" />
- </mml:mn>
- <xsl:call-template name="ParseMt">
- <xsl:with-param name="sToParse" select="substring-after($sToParse, $sConsecNum)" />
- <xsl:with-param name="scr" select="$scr" />
- <xsl:with-param name="sty" select="$sty" />
- <xsl:with-param name="nor" select="$nor" />
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if>
- </xsl:template>
-
- <xsl:template name="SNumStart">
- <xsl:param name="sToParse" select="''" />
-
- <xsl:param name="sPattern" select="'$sToParse'" />
- <xsl:choose>
-
- <xsl:when test="substring($sPattern, 1, 1) = '0'">
- <xsl:call-template name="SNumStart">
- <xsl:with-param name="sToParse" select="$sToParse" />
- <xsl:with-param name="sPattern" select="substring($sPattern, 2)" />
- </xsl:call-template>
- </xsl:when>
-
- <xsl:otherwise>
- <xsl:value-of select="substring($sToParse, 1, string-length($sToParse) - string-length($sPattern))" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="SRepeatCharAcc">
- <xsl:param name="cchRequired" select="1" />
- <xsl:param name="ch" select="'-'" />
- <xsl:param name="acc" select="$ch" />
- <xsl:variable name="cchAcc" select="string-length($acc)" />
- <xsl:choose>
- <xsl:when test="(2 * $cchAcc) < $cchRequired">
- <xsl:call-template name="SRepeatCharAcc">
- <xsl:with-param name="cchRequired" select="$cchRequired" />
- <xsl:with-param name="ch" select="$ch" />
- <xsl:with-param name="acc" select="concat($acc, $acc)" />
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="concat($acc, substring($acc, 1, $cchRequired - $cchAcc))" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="SRepeatChar">
- <xsl:param name="cchRequired" select="1" />
- <xsl:param name="ch" select="'-'" />
- <xsl:call-template name="SRepeatCharAcc">
- <xsl:with-param name="cchRequired" select="$cchRequired" />
- <xsl:with-param name="ch" select="$ch" />
- <xsl:with-param name="acc" select="$ch" />
- </xsl:call-template>
- </xsl:template>
-
- <xsl:template name="SReplaceOperWithMinus">
- <xsl:param name="sToParse" select="''" />
- <xsl:value-of select="translate($sToParse, $sOperators, $sMinuses)" />
- </xsl:template>
-
- <xsl:template name="SReplaceNumWithZero">
- <xsl:param name="sToParse" select="''" />
-
- <xsl:variable name="sSimpleReplace" select="translate($sToParse, $sNumbers, $sZeros)" />
-
- <xsl:variable name="sReplacePeriod">
- <xsl:call-template name="SReplace">
- <xsl:with-param name="sInput" select="$sSimpleReplace" />
- <xsl:with-param name="sOrig" select="'0.0'" />
- <xsl:with-param name="sReplacement" select="'000'" />
- </xsl:call-template>
- </xsl:variable>
-
- <xsl:call-template name="SReplace">
- <xsl:with-param name="sInput" select="$sReplacePeriod" />
- <xsl:with-param name="sOrig" select="'0,0'" />
- <xsl:with-param name="sReplacement" select="'000'" />
- </xsl:call-template>
- </xsl:template>
-
- <xsl:template name="CreateMencloseNotationAttrFromBorderBoxAttr">
- <xsl:param name="fHideTop" />
- <xsl:param name="fHideBot" />
- <xsl:param name="fHideLeft" />
- <xsl:param name="fHideRight" />
- <xsl:param name="fStrikeH" />
- <xsl:param name="fStrikeV" />
- <xsl:param name="fStrikeBLTR" />
- <xsl:param name="fStrikeTLBR" />
- <xsl:param name="sAttribute" />
- <xsl:choose>
- <xsl:when test="string-length($sAttribute) = 0">
- <xsl:choose>
- <xsl:when test="string-length($fHideTop) > 0
- and string-length($fHideBot) > 0
- and string-length($fHideLeft) > 0
- and string-length($fHideRight) > 0">
- <xsl:choose>
- <xsl:when test="$fHideTop = 0
- and $fHideBot = 0
- and $fHideLeft = 0
- and $fHideRight = 0">
-
- <xsl:call-template name="CreateMencloseNotationAttrFromBorderBoxAttr">
- <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:with-param name="sAttribute">
- <xsl:text>box</xsl:text>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
-
- <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:with-param name="sAttribute">
-
- <xsl:text>left right top bottom</xsl:text>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when test="string-length($fHideTop) > 0">
- <xsl:choose>
- <xsl:when test="$fHideTop=1">
- <xsl:call-template name="CreateMencloseNotationAttrFromBorderBoxAttr">
- <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:with-param name="sAttribute">
- <xsl:call-template name="SReplace">
- <xsl:with-param name="sInput" select="$sAttribute" />
- <xsl:with-param name="sOrig" select="'top'" />
- <xsl:with-param name="sReplacement" select="''" />
- </xsl:call-template>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="CreateMencloseNotationAttrFromBorderBoxAttr">
- <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:with-param name="sAttribute" select="$sAttribute" />
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:when test="string-length($fHideBot) > 0">
- <xsl:choose>
- <xsl:when test="$fHideBot=1">
- <xsl:call-template name="CreateMencloseNotationAttrFromBorderBoxAttr">
- <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:with-param name="sAttribute">
- <xsl:call-template name="SReplace">
- <xsl:with-param name="sInput" select="$sAttribute" />
- <xsl:with-param name="sOrig" select="'bottom'" />
- <xsl:with-param name="sReplacement" select="''" />
- </xsl:call-template>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="CreateMencloseNotationAttrFromBorderBoxAttr">
- <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:with-param name="sAttribute" select="$sAttribute" />
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:when test="string-length($fHideLeft) > 0">
- <xsl:choose>
- <xsl:when test="$fHideLeft=1">
- <xsl:call-template name="CreateMencloseNotationAttrFromBorderBoxAttr">
- <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:with-param name="sAttribute">
- <xsl:call-template name="SReplace">
- <xsl:with-param name="sInput" select="$sAttribute" />
- <xsl:with-param name="sOrig" select="'left'" />
- <xsl:with-param name="sReplacement" select="''" />
- </xsl:call-template>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="CreateMencloseNotationAttrFromBorderBoxAttr">
- <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:with-param name="sAttribute" select="$sAttribute" />
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:when test="string-length($fHideRight) > 0">
- <xsl:choose>
- <xsl:when test="$fHideRight=1">
- <xsl:call-template name="CreateMencloseNotationAttrFromBorderBoxAttr">
- <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:with-param name="sAttribute">
- <xsl:call-template name="SReplace">
- <xsl:with-param name="sInput" select="$sAttribute" />
- <xsl:with-param name="sOrig" select="'right'" />
- <xsl:with-param name="sReplacement" select="''" />
- </xsl:call-template>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="CreateMencloseNotationAttrFromBorderBoxAttr">
- <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:with-param name="sAttribute" select="$sAttribute" />
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:when test="string-length($fStrikeH) > 0">
- <xsl:choose>
- <xsl:when test="$fStrikeH=1">
- <xsl:call-template name="CreateMencloseNotationAttrFromBorderBoxAttr">
- <xsl:with-param name="fStrikeV" select="$fStrikeV" />
- <xsl:with-param name="fStrikeBLTR" select="$fStrikeBLTR" />
- <xsl:with-param name="fStrikeTLBR" select="$fStrikeTLBR" />
- <xsl:with-param name="sAttribute" select="concat($sAttribute, ' horizontalstrike')" />
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="CreateMencloseNotationAttrFromBorderBoxAttr">
- <xsl:with-param name="fStrikeV" select="$fStrikeV" />
- <xsl:with-param name="fStrikeBLTR" select="$fStrikeBLTR" />
- <xsl:with-param name="fStrikeTLBR" select="$fStrikeTLBR" />
- <xsl:with-param name="sAttribute" select="$sAttribute" />
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:when test="string-length($fStrikeV) > 0">
- <xsl:choose>
- <xsl:when test="$fStrikeV=1">
- <xsl:call-template name="CreateMencloseNotationAttrFromBorderBoxAttr">
- <xsl:with-param name="fStrikeBLTR" select="$fStrikeBLTR" />
- <xsl:with-param name="fStrikeTLBR" select="$fStrikeTLBR" />
- <xsl:with-param name="sAttribute" select="concat($sAttribute, ' verticalstrike')" />
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="CreateMencloseNotationAttrFromBorderBoxAttr">
- <xsl:with-param name="fStrikeBLTR" select="$fStrikeBLTR" />
- <xsl:with-param name="fStrikeTLBR" select="$fStrikeTLBR" />
- <xsl:with-param name="sAttribute" select="$sAttribute" />
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:when test="string-length($fStrikeBLTR) > 0">
- <xsl:choose>
- <xsl:when test="$fStrikeBLTR=1">
- <xsl:call-template name="CreateMencloseNotationAttrFromBorderBoxAttr">
- <xsl:with-param name="fStrikeTLBR" select="$fStrikeTLBR" />
- <xsl:with-param name="sAttribute" select="concat($sAttribute, ' updiagonalstrike')" />
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="CreateMencloseNotationAttrFromBorderBoxAttr">
- <xsl:with-param name="fStrikeTLBR" select="$fStrikeTLBR" />
- <xsl:with-param name="sAttribute" select="$sAttribute" />
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:when test="string-length($fStrikeTLBR) > 0">
- <xsl:choose>
- <xsl:when test="$fStrikeTLBR=1">
- <xsl:call-template name="CreateMencloseNotationAttrFromBorderBoxAttr">
- <xsl:with-param name="sAttribute" select="concat($sAttribute, ' downdiagonalstrike')" />
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="CreateMencloseNotationAttrFromBorderBoxAttr">
- <xsl:with-param name="sAttribute" select="$sAttribute" />
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:attribute name="notation">
- <xsl:value-of select="normalize-space($sAttribute)" />
- </xsl:attribute>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="TFromStrVal">
- <xsl:param name="str" />
- <xsl:choose>
- <xsl:when test="$str = 'on' or $str = '1' or $str = 'true'">1</xsl:when>
- <xsl:when test="$str = 'off' or $str = '0' or $str = 'false'">0</xsl:when>
- <xsl:otherwise>-1</xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="ForceFalseStrVal">
- <xsl:param name="str" />
- <xsl:variable name="tValue">
- <xsl:call-template name="TFromStrVal">
- <xsl:with-param name="str" select="$str"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="$tValue = '0'">0</xsl:when>
- <xsl:otherwise>1</xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="ForceTrueStrVal">
- <xsl:param name="str" />
- <xsl:variable name="tValue">
- <xsl:call-template name="TFromStrVal">
- <xsl:with-param name="str" select="$str"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="$tValue = '1'">1</xsl:when>
- <xsl:otherwise>0</xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- </xsl:stylesheet>
|