diff options
Diffstat (limited to 'Master/texmf-dist/tex4ht/xttl')
-rwxr-xr-x | Master/texmf-dist/tex4ht/xttl/docbook.4xt | 39 | ||||
-rwxr-xr-x | Master/texmf-dist/tex4ht/xttl/htspk.4xt | 2146 | ||||
-rwxr-xr-x | Master/texmf-dist/tex4ht/xttl/jsml.4xt | 2832 | ||||
-rwxr-xr-x | Master/texmf-dist/tex4ht/xttl/oo-math.4xt | 78 | ||||
-rwxr-xr-x | Master/texmf-dist/tex4ht/xttl/oo-text.4xt | 33 |
5 files changed, 5128 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex4ht/xttl/docbook.4xt b/Master/texmf-dist/tex4ht/xttl/docbook.4xt new file mode 100755 index 00000000000..7c69011fb5d --- /dev/null +++ b/Master/texmf-dist/tex4ht/xttl/docbook.4xt @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE xtpipes SYSTEM "xtpipes.dtd" > +<xtpipes preamble="yes" signature="docbook.4xt (2006-09-18-18:37)"> + <sax content-handler="xtpipes.lib.ScriptsManager" + lexical-handler="xtpipes.lib.ScriptsManagerLH" > + <script element="ulink" > + <set name="ulink" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match=" ulink[ + @url and starts-with( @url, '#') +]" > + <link> + <xsl:attribute name="linkend"> + <xsl:value-of select=" substring( @url, 2 )" /> + </xsl:attribute> + <xsl:apply-templates select="*|text()|comment()" /> + </link> +</xsl:template> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + + </set> + <xslt name="." xml="." xsl="ulink" /> +</script> + + </sax> +</xtpipes> + diff --git a/Master/texmf-dist/tex4ht/xttl/htspk.4xt b/Master/texmf-dist/tex4ht/xttl/htspk.4xt new file mode 100755 index 00000000000..c51b4a430ba --- /dev/null +++ b/Master/texmf-dist/tex4ht/xttl/htspk.4xt @@ -0,0 +1,2146 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE xtpipes SYSTEM "xtpipes.dtd" > +<xtpipes> + <sax content-handler="xtpipes.lib.ScriptsManager" + lexical-handler="xtpipes.lib.ScriptsManagerLH" > + <script element="br" > + <set name="br" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + <xsl:template match="br" > + <xsl:copy> + <xsl:apply-templates select="@*" /> + <xsl:comment>.</xsl:comment> + </xsl:copy> + </xsl:template> + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> + ]]> + </set> + <xslt name="." xml="." xsl="br" /> +</script> + + <script element="span::msup" > + <set name="m-sub-sup" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="span[ + ((@class = 'msup') or (@class = 'msub') + or (@class = 'msubsup')) + and + not( + child::span[ (@class = 'mrow-sub') ] + / child::span[ (@class != 'begin-script') + and + (@class != 'end-script') + and + (@class != 'mid-script') + ] + ) + and + not( + child::span[ (@class = 'mrow-super') ] + / child::span[ (@class != 'begin-script') + and + (@class != 'end-script') + and + (@class != 'mid-script') + ] + ) +]" > + <xsl:apply-templates select="child::span[ + @class = 'mrow-base' ]/*" /> +</xsl:template> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + + </set> + <xslt name="." xml="." xsl="m-sub-sup" /> + <set name="m-sup-2-3" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="span[ + (@class = 'msup') + and + (normalize-space( + child::span[ (@class = 'mrow-super') ] + / child::span[ (@class != 'begin-script') + and + (@class != 'end-script') + ] + ) = '2') + and not( + child::span[ (@class = 'mrow-base') ] + / child::span[ not( @title = 'speech-extra' ) ] + [ position() = last() ] + / self::* [ @class = 'mo-op' ] +) + +]" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" + mode="squared" /> + </xsl:copy> +</xsl:template> +<xsl:template match="*|@*|text()|comment()" + mode="squared" > + <xsl:copy> + <xsl:choose> + <xsl:when test=" @class = 'mrow-super' "> + <xsl:apply-templates select="@*" /> + <span class="mo-op"> + <xsl:text> squared </xsl:text> + </span> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:otherwise> + </xsl:choose> + </xsl:copy> +</xsl:template> +<xsl:template match="span[ + (@class = 'msup') + and + (normalize-space( + child::span[ (@class = 'mrow-super') ] + / child::span[ (@class != 'begin-script') + and + (@class != 'end-script') + ] + ) = '3') + and not( + child::span[ (@class = 'mrow-base') ] + / child::span[ not( @title = 'speech-extra' ) ] + [ position() = last() ] + / self::* [ @class = 'mo-op' ] +) + +]" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" + mode="cube" /> + </xsl:copy> +</xsl:template> +<xsl:template match="*|@*|text()|comment()" + mode="cube" > + <xsl:copy> + <xsl:choose> + <xsl:when test=" @class = 'mrow-super' "> + <xsl:apply-templates select="@*" /> + <span class="mo-op"> + <xsl:text> cube </xsl:text> + </span> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:otherwise> + </xsl:choose> + </xsl:copy> +</xsl:template> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + +</set> +<xslt name="." xml="." xsl="m-sup-2-3" /> + +</script> +<script element="span::msub" > + <set name="m-sub-sup" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="span[ + ((@class = 'msup') or (@class = 'msub') + or (@class = 'msubsup')) + and + not( + child::span[ (@class = 'mrow-sub') ] + / child::span[ (@class != 'begin-script') + and + (@class != 'end-script') + and + (@class != 'mid-script') + ] + ) + and + not( + child::span[ (@class = 'mrow-super') ] + / child::span[ (@class != 'begin-script') + and + (@class != 'end-script') + and + (@class != 'mid-script') + ] + ) +]" > + <xsl:apply-templates select="child::span[ + @class = 'mrow-base' ]/*" /> +</xsl:template> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + +</set> +<xslt name="." xml="." xsl="m-sub-sup" /> + +</script> +<script element="span::msubsup" > + <set name="subsup-prime" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="span[ + (@class = 'msubsup') + and + (count( + child::* [ @class='mrow-super' ] + / child::span [ not(@title = 'speech-extra') ] ) = 1) + and + (count( + child::* [ @class='mrow-super' ] + / child::span [ not(@title = 'speech-extra') ] + / child::span) = 1) + and + child::* [ @class='mrow-super' ] + / child::span [ not(@title = 'speech-extra') ] + / child::span[ @class='char' ] + / child::span[ + (@class = 'ch 2032') or (@class = 'ch 2033') + or (@class = 'ch 2034') + ] +]" > + <xsl:copy> + <xsl:attribute name="class" > + <xsl:text>msub</xsl:text> + </xsl:attribute> + <span class="mrow-base"> + <xsl:apply-templates select=" + *[@class = 'mrow-base'] / * + " /> + <xsl:apply-templates select=" + *[@class = 'mrow-super'] + / child::span [ not(@title = 'speech-extra') ] + " /> + </span> + <xsl:apply-templates select="*[@class = 'mrow-sub']" /> + </xsl:copy> +</xsl:template> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + +</set> +<xslt name="." xml="." xsl="subsup-prime" /> + + <set name="m-sub-sup" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="span[ + ((@class = 'msup') or (@class = 'msub') + or (@class = 'msubsup')) + and + not( + child::span[ (@class = 'mrow-sub') ] + / child::span[ (@class != 'begin-script') + and + (@class != 'end-script') + and + (@class != 'mid-script') + ] + ) + and + not( + child::span[ (@class = 'mrow-super') ] + / child::span[ (@class != 'begin-script') + and + (@class != 'end-script') + and + (@class != 'mid-script') + ] + ) +]" > + <xsl:apply-templates select="child::span[ + @class = 'mrow-base' ]/*" /> +</xsl:template> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + +</set> +<xslt name="." xml="." xsl="m-sub-sup" /> + + <set name="m-subsup-2-3" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="span[ + (@class = 'msubsup') + and + (normalize-space( + child::span[ (@class = 'mrow-super') ] + / child::span[ (@class != 'mid-script') + and + (@class != 'end-script') + ] + ) = '2') + and not( + child::span[ (@class = 'mrow-base') ] + / child::span[ not( @title = 'speech-extra' ) ] + [ position() = last() ] + / self::* [ @class = 'mo-op' ] +) + +]" > + <xsl:copy> + <xsl:attribute name="class" > + <xsl:text>msub</xsl:text> + </xsl:attribute> + <xsl:apply-templates select="*|text()|comment()" + mode="sub-squared" /> + </xsl:copy> +</xsl:template> +<xsl:template match="*|@*|text()|comment()" + mode="sub-squared" > + <xsl:copy> + <xsl:choose> + <xsl:when test=" @class = 'mrow-sub' "> + <xsl:apply-templates select="*[ + not( @class = 'end-script' ) + ] + |@*|text()|comment()" /> + <xsl:apply-templates select=" + following-sibling::*[1] / *[ + @class = 'end-script' + ] " /> + </xsl:when> + <xsl:when test=" @class = 'mrow-super' "> + <xsl:attribute name="class" > + <xsl:text>squared-super</xsl:text> + </xsl:attribute> + <span class="mo-op"> + <xsl:text> squared </xsl:text> + </span> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:otherwise> + </xsl:choose> + </xsl:copy> +</xsl:template> +<xsl:template match="span[ + (@class = 'msubsup') + and + (normalize-space( + child::span[ (@class = 'mrow-super') ] + / child::span[ (@class != 'mid-script') + and + (@class != 'end-script') + ] + ) = '3') + and not( + child::span[ (@class = 'mrow-base') ] + / child::span[ not( @title = 'speech-extra' ) ] + [ position() = last() ] + / self::* [ @class = 'mo-op' ] +) + +]" > + <xsl:copy> + <xsl:attribute name="class" > + <xsl:text>msub</xsl:text> + </xsl:attribute> + <xsl:apply-templates select="*|text()|comment()" + mode="sub-cube" /> + </xsl:copy> +</xsl:template> +<xsl:template match="*|@*|text()|comment()" + mode="sub-cube" > + <xsl:copy> + <xsl:choose> + <xsl:when test=" @class = 'mrow-sub' "> + <xsl:apply-templates select="*[ + not( @class = 'end-script' ) + ] + |@*|text()|comment()" /> + <xsl:apply-templates select=" + following-sibling::*[1] / *[ + @class = 'end-script' + ] " /> + </xsl:when> + <xsl:when test=" @class = 'mrow-super' "> + <xsl:attribute name="class" > + <xsl:text>cube-super</xsl:text> + </xsl:attribute> + <span class="mo-op"> + <xsl:text> cube </xsl:text> + </span> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:otherwise> + </xsl:choose> + </xsl:copy> +</xsl:template> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + +</set> +<xslt name="." xml="." xsl="m-subsup-2-3" /> + +</script> + + <script element="span::mfrac" > + <set name="mfrac" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="span[ @class = 'mfrac' ]" > + <xsl:copy> + <xsl:choose> + <xsl:when test=" + (string-length( + normalize-space(child::span[ @class = 'mrow-numerator' ][1]) + ) = 1) + and + (string-length( + normalize-space(child::span[ @class = 'mrow-enumerator' ][1]) + ) = 1) +"> + <xsl:variable name="a"> + <xsl:value-of select=" + normalize-space(child::span[ @class = 'mrow-numerator' ][1]) + " /> +</xsl:variable> +<xsl:variable name="b"> + <xsl:value-of select=" + normalize-space(child::span[ @class = 'mrow-enumerator' ][1]) + " /> +</xsl:variable> + + <xsl:choose> + <xsl:when test=" + (translate($a,'123456789','') != '') + or + (translate($b,'123456789','') != '') + " > + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:when> + <xsl:when test=" $a < $b "> + <xsl:attribute name="class"> + <xsl:text>word-frac</xsl:text> + </xsl:attribute> + <xsl:choose> + <xsl:when test=" $a = 1 "><xsl:text> one </xsl:text></xsl:when> + <xsl:when test=" $a = 2 "><xsl:text> two </xsl:text></xsl:when> + <xsl:when test=" $a = 3 "><xsl:text> three </xsl:text></xsl:when> + <xsl:when test=" $a = 4 "><xsl:text> four </xsl:text></xsl:when> + <xsl:when test=" $a = 5 "><xsl:text> five </xsl:text></xsl:when> + <xsl:when test=" $a = 6 "><xsl:text> six </xsl:text></xsl:when> + <xsl:when test=" $a = 7 "><xsl:text> seven </xsl:text></xsl:when> + <xsl:when test=" $a = 8 "><xsl:text> eight </xsl:text></xsl:when> + <xsl:when test=" $a = 9 "><xsl:text> nine </xsl:text></xsl:when> +</xsl:choose> + + <xsl:choose> + <xsl:when test=" $b = 2 "><xsl:text> half</xsl:text></xsl:when> + <xsl:when test=" $b = 3 "><xsl:text> third</xsl:text></xsl:when> + <xsl:when test=" $b = 4 "><xsl:text> fourth</xsl:text></xsl:when> + <xsl:when test=" $b = 5 "><xsl:text> fifth</xsl:text></xsl:when> + <xsl:when test=" $b = 6 "><xsl:text> sixth</xsl:text></xsl:when> + <xsl:when test=" $b = 7 "><xsl:text> seventh</xsl:text></xsl:when> + <xsl:when test=" $b = 8 "><xsl:text> eighth</xsl:text></xsl:when> + <xsl:when test=" $b = 9 "><xsl:text> nineth</xsl:text></xsl:when> +</xsl:choose> +<xsl:if test=" $a > 1 "><xsl:text>s</xsl:text></xsl:if> +<xsl:text> </xsl:text> + + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:otherwise> + </xsl:choose> +</xsl:when> + + <xsl:when test=" + (@class = 'mfrac') + and + child::span[ @class = 'mrow-enumerator' ] + / child::span[ @class = 'continuous-mfrac' ] + and + ( normalize-space( + child::span[ @class = 'mrow-numerator' ] + ) + = + normalize-space( + child::span[ @class = 'mrow-enumerator' ] + / child::span[ @class = 'continuous-mfrac' ] + / child::span[ @class = 'mrow-numerator' ] + ) + ) + and ( + normalize-space( + child::span[ @class = 'mrow-enumerator' ] / + child::span[ @class = 'mfrac' ] / + preceding-sibling::*[1] ) + = + normalize-space( + child::span[ @class = 'mrow-enumerator' ] / + child::span[ @class = 'mfrac' ] / + child::span[ @class = 'mrow-enumerator' ] / + child::span[ @class = 'continuous-mfrac' ] / + preceding-sibling::*[1] ) +) + +" > + <xsl:variable name="a"> + <xsl:apply-templates select=" + child::span[ @class = 'mrow-enumerator' ] / + child::span[ @class = 'mcontinuous-mfrac' ] / + preceding-sibling::*[2] + " mode="enum-op" /> +</xsl:variable> +<xsl:variable name="b"> + <xsl:apply-templates select=" + child::span[ @class = 'mrow-enumerator' ] / + child::span[ @class = 'mcontinuous-mfrac' ] / + child::span[ @class = 'mrow-enumerator' ] / + child::span[ + (@class = 'mfrac') or (@class = 'mcontinuous-mfrac') + ] / + preceding-sibling::*[2] + " mode="enum-op" /> +</xsl:variable> + + <xsl:choose> + <xsl:when test=" + normalize-space($a)=normalize-space($b) + " > + <xsl:attribute name="class"> + <xsl:value-of select=" 'continuous-mfrac' " /> + </xsl:attribute> + <xsl:apply-templates select="*|text()|comment()" /> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:otherwise> + </xsl:choose> +</xsl:when> + + <xsl:when test=" + (translate( + normalize-space( + child::span[ @class = 'mrow-numerator' ]), + '0123456789','')= '') + and ( normalize-space( + child::span[ @class = 'mrow-numerator' ]) + and + normalize-space( + child::span[ @class = 'mrow-enumerator' ] / + child::span[ @class = 'mfrac' ] / + child::span[ @class = 'mrow-numerator' ]) +) +and +( normalize-space( + child::span[ @class = 'mrow-enumerator' ] / + child::span[ @class = 'mfrac' ] / + child::span[ @class = 'mrow-numerator' ]) + and + normalize-space( + child::span[ @class = 'mrow-enumerator' ] / + child::span[ @class = 'mfrac' ] / + child::span[ @class = 'mrow-enumerator' ] / + child::span[ @class = 'mfrac' ] / + child::span[ @class = 'mrow-numerator' ]) +) + + and ( child::span[ @class = 'mrow-enumerator' ] / + child::span[ @class = 'mfrac' ] / + preceding-sibling::*[1][@class = 'mo-bin'] +) +and +( normalize-space( + child::span[ @class = 'mrow-enumerator' ] / + child::span[ @class = 'mfrac' ] / + preceding-sibling::*[1] ) + = + normalize-space( + child::span[ @class = 'mrow-enumerator' ] / + child::span[ @class = 'mfrac' ] / + child::span[ @class = 'mrow-enumerator' ] / + child::span[ @class = 'mfrac' ] / + preceding-sibling::*[1] ) +) + +"> + <xsl:variable name="a"> + <xsl:apply-templates select=" + child::span[ @class = 'mrow-enumerator' ] / + child::span[ @class = 'mfrac' ] / + preceding-sibling::*[2] + " mode="enum-op" /> +</xsl:variable> +<xsl:variable name="b"> + <xsl:apply-templates select=" + child::span[ @class = 'mrow-enumerator' ] / + child::span[ @class = 'mfrac' ] / + child::span[ @class = 'mrow-enumerator' ] / + child::span[ @class = 'mfrac' ] / + preceding-sibling::*[2] + " mode="enum-op" /> +</xsl:variable> +<xsl:variable name="c"> + <xsl:value-of select=" + normalize-space( + child::span[ @class = 'mrow-enumerator' ] / + child::span[ @class = 'mfrac' ] / + child::span[ @class = 'mrow-enumerator' ] / + child::span[ @class = 'mfrac' ] / + child::span[ @class = 'mrow-enumerator' ] ) + " /> +</xsl:variable> + + <xsl:choose> + <xsl:when test=" + ( translate($a,'0123456789 ','') = '') + and (normalize-space($a)=normalize-space($b)) + and starts-with( $c, normalize-space( $a )) + and starts-with( + normalize-space( + substring-after( $c, normalize-space( $a )) ) + , + normalize-space( + child::span[ @class = 'mrow-enumerator' ] / + child::span[ @class = 'mfrac' ] / + preceding-sibling::*[1] ) + ) + " > + <xsl:attribute name="class"> + <xsl:value-of select=" 'continuous-mfrac' " /> + </xsl:attribute> + <xsl:apply-templates select="*|text()|comment()" /> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:otherwise> + </xsl:choose> +</xsl:when> + + <xsl:otherwise> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:otherwise> + </xsl:choose> + </xsl:copy> +</xsl:template> +<xsl:template match="*" mode="enum-op"> + <xsl:if test="preceding-sibling::*" > + <xsl:apply-templates select=" preceding-sibling::*[1] " /> + </xsl:if> + <xsl:value-of select="." /> +</xsl:template> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + + </set> + <xslt name="." xml="." xsl="mfrac" /> +</script> + + <script element="span::munder-underline" > + <set name="munder" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="*" mode="content" > + <xsl:choose> + <xsl:when test=" @class = 'char' " > + <xsl:text>x</xsl:text> + </xsl:when> + <xsl:when test=" not( + (@title = 'speech-extra') or (@class = 'accent-char') + ) " > + <xsl:apply-templates select="*|text()" mode="content" /> + </xsl:when> + </xsl:choose> +</xsl:template> + + <xsl:template match="span[ + (@class = 'munder-underline') + and + child::span[ + (@class = 'mo-0332') + and + descendant::span[ @class = 'mi' ] + ] +]" > + <xsl:copy> + <xsl:apply-templates select="@*" /> + <xsl:variable name="content"> + <xsl:apply-templates select="*" mode="content" /> + </xsl:variable> + <xsl:choose> + <xsl:when test=" + string-length( normalize-space( $content )) = 1 + " > + <xsl:apply-templates + select=" *[ @class != 'begin-end' ] " /> + <span class="begin-end" title="speech-extra" > + <xsl:text> under bar </xsl:text> + </span> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="*|text()|comment()" /> + </xsl:otherwise> + </xsl:choose> + </xsl:copy> +</xsl:template> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + + </set> + <xslt name="." xml="." xsl="munder" /> +</script> +<script element="span::mover-overline" > + <set name="mover" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="*" mode="content" > + <xsl:choose> + <xsl:when test=" @class = 'char' " > + <xsl:text>x</xsl:text> + </xsl:when> + <xsl:when test=" not( + (@title = 'speech-extra') or (@class = 'accent-char') + ) " > + <xsl:apply-templates select="*|text()" mode="content" /> + </xsl:when> + </xsl:choose> +</xsl:template> + + <xsl:template match="span[ + (@class = 'mover-overline') + and + child::span[ + (@class = 'mo-00AF') + and + descendant::span[ @class = 'mi' ] + ] +]" > + <xsl:copy> + <xsl:apply-templates select="@*" /> + <xsl:variable name="content"> + <xsl:apply-templates select="*" mode="content" /> + </xsl:variable> + <xsl:choose> + <xsl:when test=" + string-length( normalize-space( $content )) = 1 + " > + <xsl:apply-templates + select=" *[ @class != 'begin-end' ] " /> + <span class="begin-end" title="speech-extra" > + <xsl:text> over bar </xsl:text> + </span> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="*|text()|comment()" /> + </xsl:otherwise> + </xsl:choose> + </xsl:copy> +</xsl:template> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + + </set> + <xslt name="." xml="." xsl="mover" /> +</script> + + <script element="span::limits-msub-msup" > + <set name="smash" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="span[ + (@class = 'limits-msub-msup') + and + child::*[ (position() = 1) + and (@class = 'limits-mrow-base') + and child::*[ (position() = 1) + and (@class = 'limits-msub-msup') + ] ] +]" > + <xsl:copy> + <xsl:apply-templates select="@*" /> + <xsl:apply-templates select=" + *[1] + / *[1] + / *[ not(@class='limits-mrow-super') ] " /> + <xsl:apply-templates select=" *[ + preceding-sibling::* + and + not(@class='limits-mrow-super') ]" /> + <xsl:apply-templates select=" + *[1] + / *[1] + / *[@class='limits-mrow-super' ] " /> + <xsl:apply-templates select=" *[ + preceding-sibling::* + and + (@class='limits-mrow-super') ]" /> + </xsl:copy> +</xsl:template> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + + </set> + <xslt name="." xml="." xsl="smash" /> +</script> + + <script element="span::mathvariant-bold" > + <set name="bold" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="*" mode="content" > + <xsl:choose> + <xsl:when test=" @class = 'char' " > + <xsl:text>x</xsl:text> + </xsl:when> + <xsl:when test=" not( + (@title = 'speech-extra') or (@class = 'accent-char') + ) " > + <xsl:apply-templates select="*|text()" mode="content" /> + </xsl:when> + </xsl:choose> +</xsl:template> + + <xsl:template match="span[ @class = 'mathvariant-bold' ]" > + <xsl:copy> + <xsl:apply-templates select="@*" /> + <xsl:variable name="content"> + <xsl:apply-templates select="*" mode="content" /> + </xsl:variable> + <xsl:choose> + <xsl:when test=" + string-length( normalize-space( $content )) = 1 + " > + <span class="begin-end" title="speech-extra" > + <xsl:text> bold </xsl:text> + </span> + <xsl:apply-templates select="*|text()|comment()" /> + </xsl:when> + <xsl:otherwise> + <span class="begin-end" title="speech-extra" > + <xsl:text> begin bold </xsl:text> + </span> + <xsl:apply-templates select="*|text()|comment()" /> + <span class="begin-end" title="speech-extra" > + <xsl:text> end bold </xsl:text> + </span> + </xsl:otherwise> + </xsl:choose> + </xsl:copy> +</xsl:template> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + + </set> + <xslt name="." xml="." xsl="bold" /> +</script> + + <script element="span::mi" > + <set name="math-cap" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="span[ @class = 'mi' ]" > + <xsl:copy> + <xsl:apply-templates select="@*" /> + <xsl:if test=" string-length(.) = 1 " > + <xsl:if test=" + (translate(.,'ABCDEFGHIJKLMNOPQRSTUVWXYZ', + '') = '' ) + " > + <span class="capital-description" + title="speech-extra" > + <xsl:text> capital </xsl:text> + </span> + </xsl:if> + </xsl:if> + <xsl:apply-templates select="*|text()|comment()" /> + </xsl:copy> +</xsl:template> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + + </set> + <xslt name="." xml="." xsl="math-cap" /> +</script> + + <script element="div::tr" > + <set name="bold" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="div[ + parent::div[ @class = 'tr' ] + and ( normalize-space(.) = '' ) + and not( normalize-space(following-sibling::*) != '' ) +]" > +</xsl:template> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + + </set> + <xslt name="." xml="." xsl="bold" /> +</script> + + <script element="span::inline-math" > + <set name="num-sub" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="span[ + (@class = 'msub') + and + (count( child::span[ @class = 'mrow-base' ] + / child::* ) = 1 ) + and not( ancestor::*[ + (@class = 'msub') + or + (@class = 'msup') + or + (@class = 'msubsup') + ] ) + and + not( child::span[ @class = 'mrow-sub' ] + / child::* [ + not( @title = 'speech-extra' ) + and + not( @class = 'mn' ) + and + not( + (@class = 'mo-punc') + and + ( . = ',' ) + and + preceding-sibling::*[1][ @class = 'mn' ] + and + following-sibling::*[1][ @class = 'mn' ] + and + following-sibling::*[2][ @class = 'mn' ] + and + following-sibling::*[3][ @class = 'mn' ] + and + ( not(following-sibling::*[4]) + or + not(following-sibling::*[4][ @class = 'mn' ]) + ) + ) + and + not( + (@class = 'mo-punc') + and + ( . = '.' ) + and + following-sibling::*[1][ @class = 'mn' ] + and + not( + following-sibling::*[ + (@class = 'mo-punc') + and + (. = '.') + ] + ) + ) + ]) +]" > + <xsl:copy> + <xsl:apply-templates select="@*" /> + <xsl:apply-templates select="*[1]" /> + <span class="mrow-sub"> + <span class="space" title="speech-extra"> + <xsl:text> </xsl:text> + </span> + <xsl:apply-templates + select="*[2] / *[ + not(@title = 'speech-extra') + and + not( + (@class = 'mo-punc') + and (. = ',') + ) + ]" /> + </span> + </xsl:copy> +</xsl:template> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + + </set> + <xslt name="." xml="." xsl="num-sub" /> + + <dom name="." xml="." method="fracLevel" class="HtSpk" /> +<set name="rmXmlDecl" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + +</set> +<xslt name="." xml="." xsl="rmXmlDecl" /> + + + <dom name="." xml="." method="scriptLevel" class="HtSpk" /> +<set name="rmXmlDecl" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + +</set> +<xslt name="." xml="." xsl="rmXmlDecl" /> + + + <dom name="." xml="." method="rootLevel" class="HtSpk" /> +<set name="rmXmlDecl" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + +</set> +<xslt name="." xml="." xsl="rmXmlDecl" /> + + + <set name="inline-math" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="*" mode="content" > + <xsl:choose> + <xsl:when test=" @class = 'char' " > + <xsl:text>x</xsl:text> + </xsl:when> + <xsl:when test=" not( + (@title = 'speech-extra') or (@class = 'accent-char') + ) " > + <xsl:apply-templates select="*|text()" mode="content" /> + </xsl:when> + </xsl:choose> +</xsl:template> + +<xsl:template match="span[ + (@class = 'end-script') + and + ancestor::* [ following-sibling::* [ + not( @class = 'content-less' ) + ] + ][1] + / following-sibling::* [ + not( @class = 'content-less' ) + ][1] + / self::* + [ + (@class = 'end-math') + or + (@class = 'end-script') + or + (@class = 'end-root') + or + (@class = 'end-stack') + or + (@class = 'mid-stack') + or + (@class = 'end-array') + or + (@class = 'tr') + or + (@title = 'implicit-baseline') + ] +]" > +</xsl:template> + +<xsl:template match="span[ + ((@class = 'mfrac') and + (translate( + concat( + span[ (@class = 'mrow-numerator')], + span[ (@class = 'mrow-enumerator')] + ) ,'0123456789','') = '') + and + not(descendant::*/descendant::*/descendant::*) + or + (@class = 'word-frac')) + and + preceding-sibling::*[1] + / self::span[ @class = 'mn'] + ]" > + <xsl:text> and </xsl:text> + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> +</xsl:template> + +<xsl:template match="span[ + (@class = 'mo-bin') + and + ( preceding-sibling::*[ + (position()=1) + and + ( (@title='speech-extra') + or (@class='mo-bin') + or (@class='mo-rel') ) + ] + and + ( + following-sibling::*[ (@class='mn') or (@class='mi') ] + or + (count(following-sibling::*[ + not(@title = 'speech-extra') + ]) = 1) + ) + or + not(preceding-sibling::*) + ) + and + (normalize-space(.)='minus') +]" > + <xsl:copy> + <xsl:attribute name="class"> + <xsl:text>mo-unary</xsl:text> + </xsl:attribute> + <xsl:apply-templates select="*|text()|comment()" + mode="minus-neg" /> + </xsl:copy> +</xsl:template> +<xsl:template match="*|@*|text()|comment()" mode="minus-neg" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" + mode="minus-neg" /> + </xsl:copy> +</xsl:template> +<xsl:template match="text()" mode="minus-neg" > + <xsl:choose> + <xsl:when test=" . = 'minus' " > + <xsl:text>negative</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="." /> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + +<xsl:template match="span[ @class = 'end-limits-script' ]" > + <xsl:if test=" parent::*[ not(following-sibling::*) ] "> + <xsl:copy> + <xsl:apply-templates select=" @* " /> + <xsl:choose> + <xsl:when test=" + parent::*[ preceding-sibling::span[ + @class != 'limits-mrow-base' + ] ] + " > + <xsl:text> end scripts </xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text> end script </xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:copy> + </xsl:if> +</xsl:template> +<xsl:template match="span[ @class = 'begin-limits-script' ]" > + <xsl:copy> + <xsl:apply-templates select=" @* " /> + <xsl:choose> + <xsl:when test=" + parent::*[ @class = 'limits-mrow-super' ] + " > + <xsl:apply-templates + select=" parent::* + / preceding-sibling::*[1] " + mode = "extra-over" /> + </xsl:when> + <xsl:when test=" + parent::*[ @class = 'limits-mrow-sub' ] + " > + <xsl:apply-templates + select=" parent::* + / preceding-sibling::*[1] " + mode = "extra-under" /> + </xsl:when> + </xsl:choose> + <xsl:apply-templates select="*|text()|comment()" /> + </xsl:copy> +</xsl:template> +<xsl:template match="*" mode="extra-over" > + <xsl:if test = " self::span[ @class = 'limits-mrow-super' ] " > + <xsl:text> over </xsl:text> + <xsl:apply-templates select=" preceding-sibling::*[1] " + mode = "extra-over" /> + </xsl:if> +</xsl:template> +<xsl:template match="*" mode="extra-under" > + <xsl:if test = " self::span[ @class = 'limits-mrow-sub' ] " > + <xsl:text> under </xsl:text> + <xsl:apply-templates select=" preceding-sibling::*[1] " + mode = "extra-under" /> + </xsl:if> +</xsl:template> + +<xsl:template match="span[ + (@class = 'begin-script') + and + following-sibling::*[ + child::span / child::span[ + (@class = 'ch 2032') or (@class = 'ch 2033') + or (@class = 'ch 2034') + ] ] +]" > +</xsl:template> +<xsl:template match="span[ + (@class = 'end-script') + and + preceding-sibling::*[ + child::span / child::span[ + (@class = 'ch 2032') or (@class = 'ch 2033') + or (@class = 'ch 2034') + ] ] +]" > +</xsl:template> + + + <xsl:template match="span[ + (@class = 'inline-math') + and + (count( child::*[ not(@title) or (@title != 'speech-extra') ] + ) = 1) +]" > + <xsl:copy> + <xsl:variable name="content"> + <xsl:apply-templates + select="child::*[ not(@title) or (@title != 'speech-extra') ] +" + mode="content" /> + </xsl:variable> + <xsl:choose> + <xsl:when test=" + string-length( normalize-space( $content )) = 1 + " > + <xsl:attribute name="class"> + <xsl:text>semi-math</xsl:text> + </xsl:attribute> + <xsl:apply-templates select="child::*[ not(@title) or (@title != 'speech-extra') ] +" /> + </xsl:when> + <xsl:when test=" child::*[ + (position() = 2) + and + ((@class = 'msub') or (@class = 'msup') or (@class = 'msubsup')) +]" > + <xsl:variable name="content"> + <xsl:apply-templates select="child::*[2] / child::*[ + @class = 'mrow-base' ]" + mode="content" /> + </xsl:variable> + <xsl:choose> + <xsl:when test=" + string-length( normalize-space( $content )) = 1 + " > + <xsl:attribute name="class"> + <xsl:text>semi-math</xsl:text> + </xsl:attribute> + <xsl:apply-templates select="*[2]" /> + + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="*|@*|comment()|text()" /> + </xsl:otherwise> + </xsl:choose> +</xsl:when> + + <xsl:otherwise> + <xsl:apply-templates select="*|@*|comment()|text()" /> + </xsl:otherwise> + </xsl:choose> + </xsl:copy> +</xsl:template> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + + </set> + <xslt name="." xml="." xsl="inline-math" /> + <set name="inline-math-2" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="*" mode="content" > + <xsl:choose> + <xsl:when test=" @class = 'char' " > + <xsl:text>x</xsl:text> + </xsl:when> + <xsl:when test=" not( + (@title = 'speech-extra') or (@class = 'accent-char') + ) " > + <xsl:apply-templates select="*|text()" mode="content" /> + </xsl:when> + </xsl:choose> +</xsl:template> + +<xsl:template match="span[ + (@class = 'end-script') + and + ancestor::*[ preceding-sibling::* [ + ((@class = 'begin-script') or (@class = 'mid-script')) ]] + +]" > + <xsl:copy> + <xsl:apply-templates select="*|@*|comment()" /> + <xsl:value-of select=" + ancestor::*[ preceding-sibling::* [ + ((@class = 'begin-script') or + (@class = 'mid-script')) ]] [1] + / preceding-sibling::* [ + ((@class = 'begin-script') or + (@class = 'mid-script')) ][1] + " /> + </xsl:copy> +</xsl:template> + +<xsl:template match="span[ @class = 'mi' ]" > + <span class="space" title="speech-extra"> + <xsl:text> </xsl:text> + </span> + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> +</xsl:template> + +<xsl:template match="span[ + (@class = 'begin-script') + and + following-sibling::* [1] / child::*[ + (position() = 1) + and + (@class = 'mrow-base') + and + ( normalize-space(.) = '' ) + ] +]" > +</xsl:template> + + + <xsl:template match="span[ + (@class = 'inline-math') + and + (count( child::*[ not(@title) or (@title != 'speech-extra') ] + ) = 2) + and + child::span[ + (@class = 'mo-unary') + and + following-sibling::*[1] + / descendant::span[ @class = 'mi' ] + ] +]" > + <xsl:copy> + <xsl:variable name="content"> + <xsl:apply-templates + select="child::*[ + (not(@title) or (@title != 'speech-extra')) + and not( @class = 'mo-unary' ) + ]" + mode="content" /> + </xsl:variable> + <xsl:choose> + <xsl:when test=" + string-length( normalize-space( $content )) = 1 + " > + <xsl:attribute name="class"> + <xsl:text>semi-math</xsl:text> + </xsl:attribute> + <xsl:apply-templates select="child::*[ not(@title) or (@title != 'speech-extra') ] +" /> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="*|@*|comment()|text()" /> + </xsl:otherwise> + </xsl:choose> + </xsl:copy> +</xsl:template> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + + </set> + <xslt name="." xml="." xsl="inline-math-2" /> + <set name="empty-el" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="*[ not(child::*) ]" > + <xsl:copy> + <xsl:apply-templates select="@*|comment()|text()" /> + <xsl:if test=" normalize-space(.) = '' " > + <xsl:comment>.</xsl:comment> + </xsl:if> + </xsl:copy> +</xsl:template> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + +</set> +<xslt name="." xml="." xsl="empty-el" /> + +</script> + + <script element="div::display-math" > + <set name="num-sub" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="span[ + (@class = 'msub') + and + (count( child::span[ @class = 'mrow-base' ] + / child::* ) = 1 ) + and not( ancestor::*[ + (@class = 'msub') + or + (@class = 'msup') + or + (@class = 'msubsup') + ] ) + and + not( child::span[ @class = 'mrow-sub' ] + / child::* [ + not( @title = 'speech-extra' ) + and + not( @class = 'mn' ) + and + not( + (@class = 'mo-punc') + and + ( . = ',' ) + and + preceding-sibling::*[1][ @class = 'mn' ] + and + following-sibling::*[1][ @class = 'mn' ] + and + following-sibling::*[2][ @class = 'mn' ] + and + following-sibling::*[3][ @class = 'mn' ] + and + ( not(following-sibling::*[4]) + or + not(following-sibling::*[4][ @class = 'mn' ]) + ) + ) + and + not( + (@class = 'mo-punc') + and + ( . = '.' ) + and + following-sibling::*[1][ @class = 'mn' ] + and + not( + following-sibling::*[ + (@class = 'mo-punc') + and + (. = '.') + ] + ) + ) + ]) +]" > + <xsl:copy> + <xsl:apply-templates select="@*" /> + <xsl:apply-templates select="*[1]" /> + <span class="mrow-sub"> + <span class="space" title="speech-extra"> + <xsl:text> </xsl:text> + </span> + <xsl:apply-templates + select="*[2] / *[ + not(@title = 'speech-extra') + and + not( + (@class = 'mo-punc') + and (. = ',') + ) + ]" /> + </span> + </xsl:copy> +</xsl:template> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + + </set> + <xslt name="." xml="." xsl="num-sub" /> + + <dom name="." xml="." method="fracLevel" class="HtSpk" /> +<set name="rmXmlDecl" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + +</set> +<xslt name="." xml="." xsl="rmXmlDecl" /> + + + <dom name="." xml="." method="scriptLevel" class="HtSpk" /> +<set name="rmXmlDecl" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + +</set> +<xslt name="." xml="." xsl="rmXmlDecl" /> + + + <dom name="." xml="." method="rootLevel" class="HtSpk" /> +<set name="rmXmlDecl" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + +</set> +<xslt name="." xml="." xsl="rmXmlDecl" /> + + + <set name="display-math" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="*" mode="content" > + <xsl:choose> + <xsl:when test=" @class = 'char' " > + <xsl:text>x</xsl:text> + </xsl:when> + <xsl:when test=" not( + (@title = 'speech-extra') or (@class = 'accent-char') + ) " > + <xsl:apply-templates select="*|text()" mode="content" /> + </xsl:when> + </xsl:choose> +</xsl:template> + +<xsl:template match="span[ + (@class = 'end-script') + and + ancestor::* [ following-sibling::* [ + not( @class = 'content-less' ) + ] + ][1] + / following-sibling::* [ + not( @class = 'content-less' ) + ][1] + / self::* + [ + (@class = 'end-math') + or + (@class = 'end-script') + or + (@class = 'end-root') + or + (@class = 'end-stack') + or + (@class = 'mid-stack') + or + (@class = 'end-array') + or + (@class = 'tr') + or + (@title = 'implicit-baseline') + ] +]" > +</xsl:template> + +<xsl:template match="span[ + ((@class = 'mfrac') and + (translate( + concat( + span[ (@class = 'mrow-numerator')], + span[ (@class = 'mrow-enumerator')] + ) ,'0123456789','') = '') + and + not(descendant::*/descendant::*/descendant::*) + or + (@class = 'word-frac')) + and + preceding-sibling::*[1] + / self::span[ @class = 'mn'] + ]" > + <xsl:text> and </xsl:text> + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> +</xsl:template> + +<xsl:template match="span[ + (@class = 'mo-bin') + and + ( preceding-sibling::*[ + (position()=1) + and + ( (@title='speech-extra') + or (@class='mo-bin') + or (@class='mo-rel') ) + ] + and + ( + following-sibling::*[ (@class='mn') or (@class='mi') ] + or + (count(following-sibling::*[ + not(@title = 'speech-extra') + ]) = 1) + ) + or + not(preceding-sibling::*) + ) + and + (normalize-space(.)='minus') +]" > + <xsl:copy> + <xsl:attribute name="class"> + <xsl:text>mo-unary</xsl:text> + </xsl:attribute> + <xsl:apply-templates select="*|text()|comment()" + mode="minus-neg" /> + </xsl:copy> +</xsl:template> +<xsl:template match="*|@*|text()|comment()" mode="minus-neg" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" + mode="minus-neg" /> + </xsl:copy> +</xsl:template> +<xsl:template match="text()" mode="minus-neg" > + <xsl:choose> + <xsl:when test=" . = 'minus' " > + <xsl:text>negative</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="." /> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + +<xsl:template match="span[ @class = 'end-limits-script' ]" > + <xsl:if test=" parent::*[ not(following-sibling::*) ] "> + <xsl:copy> + <xsl:apply-templates select=" @* " /> + <xsl:choose> + <xsl:when test=" + parent::*[ preceding-sibling::span[ + @class != 'limits-mrow-base' + ] ] + " > + <xsl:text> end scripts </xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text> end script </xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:copy> + </xsl:if> +</xsl:template> +<xsl:template match="span[ @class = 'begin-limits-script' ]" > + <xsl:copy> + <xsl:apply-templates select=" @* " /> + <xsl:choose> + <xsl:when test=" + parent::*[ @class = 'limits-mrow-super' ] + " > + <xsl:apply-templates + select=" parent::* + / preceding-sibling::*[1] " + mode = "extra-over" /> + </xsl:when> + <xsl:when test=" + parent::*[ @class = 'limits-mrow-sub' ] + " > + <xsl:apply-templates + select=" parent::* + / preceding-sibling::*[1] " + mode = "extra-under" /> + </xsl:when> + </xsl:choose> + <xsl:apply-templates select="*|text()|comment()" /> + </xsl:copy> +</xsl:template> +<xsl:template match="*" mode="extra-over" > + <xsl:if test = " self::span[ @class = 'limits-mrow-super' ] " > + <xsl:text> over </xsl:text> + <xsl:apply-templates select=" preceding-sibling::*[1] " + mode = "extra-over" /> + </xsl:if> +</xsl:template> +<xsl:template match="*" mode="extra-under" > + <xsl:if test = " self::span[ @class = 'limits-mrow-sub' ] " > + <xsl:text> under </xsl:text> + <xsl:apply-templates select=" preceding-sibling::*[1] " + mode = "extra-under" /> + </xsl:if> +</xsl:template> + +<xsl:template match="span[ + (@class = 'begin-script') + and + following-sibling::*[ + child::span / child::span[ + (@class = 'ch 2032') or (@class = 'ch 2033') + or (@class = 'ch 2034') + ] ] +]" > +</xsl:template> +<xsl:template match="span[ + (@class = 'end-script') + and + preceding-sibling::*[ + child::span / child::span[ + (@class = 'ch 2032') or (@class = 'ch 2033') + or (@class = 'ch 2034') + ] ] +]" > +</xsl:template> + + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + + </set> + <xslt name="." xml="." xsl="display-math" /> + <set name="display-math-2" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="*" mode="content" > + <xsl:choose> + <xsl:when test=" @class = 'char' " > + <xsl:text>x</xsl:text> + </xsl:when> + <xsl:when test=" not( + (@title = 'speech-extra') or (@class = 'accent-char') + ) " > + <xsl:apply-templates select="*|text()" mode="content" /> + </xsl:when> + </xsl:choose> +</xsl:template> + +<xsl:template match="span[ + (@class = 'end-script') + and + ancestor::*[ preceding-sibling::* [ + ((@class = 'begin-script') or (@class = 'mid-script')) ]] + +]" > + <xsl:copy> + <xsl:apply-templates select="*|@*|comment()" /> + <xsl:value-of select=" + ancestor::*[ preceding-sibling::* [ + ((@class = 'begin-script') or + (@class = 'mid-script')) ]] [1] + / preceding-sibling::* [ + ((@class = 'begin-script') or + (@class = 'mid-script')) ][1] + " /> + </xsl:copy> +</xsl:template> + +<xsl:template match="span[ @class = 'mi' ]" > + <span class="space" title="speech-extra"> + <xsl:text> </xsl:text> + </span> + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> +</xsl:template> + +<xsl:template match="span[ + (@class = 'begin-script') + and + following-sibling::* [1] / child::*[ + (position() = 1) + and + (@class = 'mrow-base') + and + ( normalize-space(.) = '' ) + ] +]" > +</xsl:template> + + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + + </set> + <xslt name="." xml="." xsl="display-math-2" /> + <set name="empty-el" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="*[ not(child::*) ]" > + <xsl:copy> + <xsl:apply-templates select="@*|comment()|text()" /> + <xsl:if test=" normalize-space(.) = '' " > + <xsl:comment>.</xsl:comment> + </xsl:if> + </xsl:copy> +</xsl:template> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + +</set> +<xslt name="." xml="." xsl="empty-el" /> + +</script> + + + <script element="div::split-side" > + <set name="clean-split" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="*" mode="content" > + <xsl:choose> + <xsl:when test=" @class = 'char' " > + <xsl:text>x</xsl:text> + </xsl:when> + <xsl:when test=" not( + (@title = 'speech-extra') or (@class = 'accent-char') + ) " > + <xsl:apply-templates select="*|text()" mode="content" /> + </xsl:when> + </xsl:choose> +</xsl:template> + + <xsl:template match=" div[ @class='split-side' ] +" > + <xsl:variable name="content"> + <xsl:apply-templates select="*" mode="content" /> + </xsl:variable> + <xsl:if test=" + string-length( normalize-space( $content )) != 0 + " > + <xsl:copy> + <xsl:apply-templates select=" *|@*|text()|comment() " /> + </xsl:copy> + </xsl:if> +</xsl:template> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + + </set> + <xslt name="." xml="." xsl="clean-split" /> +</script> + + <script element="div::newtheorem" > + <set name="newtheorem" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match=" + div[ (@class='newtheorem') + and + child::*[1] / child::span[ @class = 'theorem-head' ] + ] +" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + <div class="begin-end" title="speech-extra"> + <xsl:value-of select=" + concat( ' end ', + string( child::*[1] / + child::span[ @class = 'theorem-head' ] ) + ) " /> + </div> + </xsl:copy> +</xsl:template> + + <xsl:template match="*[ not(child::*) ]" > + <xsl:copy> + <xsl:apply-templates select="@*|comment()|text()" /> + <xsl:if test=" normalize-space(.) = '' " > + <xsl:comment>.</xsl:comment> + </xsl:if> + </xsl:copy> +</xsl:template> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + + </set> + <xslt name="." xml="." xsl="newtheorem" /> +</script> + + </sax> +</xtpipes> + diff --git a/Master/texmf-dist/tex4ht/xttl/jsml.4xt b/Master/texmf-dist/tex4ht/xttl/jsml.4xt new file mode 100755 index 00000000000..d4f4b8b4c3f --- /dev/null +++ b/Master/texmf-dist/tex4ht/xttl/jsml.4xt @@ -0,0 +1,2832 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE xtpipes SYSTEM "xtpipes.dtd" > +<xtpipes signature="jsml.4xt (2006-09-18-18:33)"> + <sax content-handler="xtpipes.lib.ScriptsManager, GroupMn, JsmlFilter" + lexical-handler="xtpipes.lib.ScriptsManagerLH" > + <script element="mn-group" > + <dom name="." xml="." method="mnGroup" class="HtJsml" /> +<set name="rmXmlDecl" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + +</set> +<xslt name="." xml="." xsl="rmXmlDecl" /> + + + <set name="merge" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="mn-group" > + <xsl:choose> + <xsl:when test=" not(child::mn) "> + <xsl:apply-templates select="*|text()" /> + </xsl:when> + <xsl:otherwise> + <mn> + <xsl:value-of select="." /> + </mn> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + + </set> + <xslt name="." xml="." xsl="merge" /> +</script> + + <script element="msup" > + <set name="m-sub-sup" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="*[ + (self::msup or self::msub or self::msubsup) + and + not( + child::mrow[ @class = 'mrow-sub' ] + / child::*[ not(@title = 'speech-extra') + and + (normalize-space(.) != '') + ] + ) + and + not( + child::mrow[ @class = 'mrow-super' ] + / child::*[ not(@title = 'speech-extra') + and + (normalize-space(.) != '') + ] + ) +]" > + <xsl:apply-templates select="child::mrow[ + @class = 'mrow-base' ]/*" /> +</xsl:template> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + + </set> + <xslt name="." xml="." xsl="m-sub-sup" /> + <set name="m-sup-2-3" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="msup[ + (normalize-space( + child::mrow[ (@class = 'mrow-super') ] + / child::*[ not (@class = 'begin-script') + and + not (@class = 'end-script') + ] + ) = '2') + and not( + child::mrow[ @class = 'mrow-base' ] + / child::span[ not( @title = 'speech-extra' ) ] + [ position() = last() ] + / self::* [ @class = 'mo-op' ] +) + + and (normalize-space(mrow[@class = 'mrow-base']) != '' ) +]" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" + mode="squared" /> + </xsl:copy> +</xsl:template> +<xsl:template match="*|@*|text()|comment()" + mode="squared" > + <xsl:copy> + <xsl:choose> + <xsl:when test=" @class = 'mrow-super' "> + <xsl:apply-templates select="@*" /> + <mo class="mo-op"> + <xsl:text> squared </xsl:text> + </mo> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="*|@*|text()" /> + </xsl:otherwise> + </xsl:choose> + </xsl:copy> +</xsl:template> +<xsl:template match="msup[ + (normalize-space( + child::mrow[ (@class = 'mrow-super') ] + / child::*[ not (@class = 'begin-script') + and + not (@class = 'end-script') + ] + ) = '3') + and not( + child::mrow[ @class = 'mrow-base' ] + / child::span[ not( @title = 'speech-extra' ) ] + [ position() = last() ] + / self::* [ @class = 'mo-op' ] +) + + and (normalize-space(mrow[@class = 'mrow-base']) != '' ) +]" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" + mode="cube" /> + </xsl:copy> +</xsl:template> +<xsl:template match="*|@*|text()|comment()" + mode="cube" > + <xsl:copy> + <xsl:choose> + <xsl:when test=" @class = 'mrow-super' "> + <xsl:apply-templates select="@*" /> + <mo class="mo-op"> + <xsl:text> cube </xsl:text> + </mo> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="*|@*|text()" /> + </xsl:otherwise> + </xsl:choose> + </xsl:copy> +</xsl:template> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + +</set> +<xslt name="." xml="." xsl="m-sup-2-3" /> + +</script> +<script element="msub" > + <set name="m-sub-sup" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="*[ + (self::msup or self::msub or self::msubsup) + and + not( + child::mrow[ @class = 'mrow-sub' ] + / child::*[ not(@title = 'speech-extra') + and + (normalize-space(.) != '') + ] + ) + and + not( + child::mrow[ @class = 'mrow-super' ] + / child::*[ not(@title = 'speech-extra') + and + (normalize-space(.) != '') + ] + ) +]" > + <xsl:apply-templates select="child::mrow[ + @class = 'mrow-base' ]/*" /> +</xsl:template> + + <xsl:template match=" + msub [ + normalize-space(child::*[1]) = 'log' + or + normalize-space(child::*[1]) = 'ln' +]" > + <xsl:copy> + <xsl:apply-templates select="@*" /> + <xsl:apply-templates select="child::*[1]" /> + <xsl:apply-templates select="child::*[2]" + mode="log" /> + </xsl:copy> +</xsl:template> +<xsl:template match="*" mode="log" > + <xsl:copy> + <xsl:apply-templates select="@*" /> + <xsl:choose> + <xsl:when test="parent::mrow[ @class = 'mrow-sub' ]" > + <BREAK SIZE="small"/> + <xsl:apply-templates select="*" /> + <BREAK SIZE="small"/> + <span title="speech-extra"> + <xsl:text>of</xsl:text> + </span> + <BREAK SIZE="small"/> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates + select="*[ not(@title = 'speech-extra') ]" + mode="log" /> + </xsl:otherwise> + </xsl:choose> + </xsl:copy> +</xsl:template> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + +</set> +<xslt name="." xml="." xsl="m-sub-sup" /> + +</script> +<script element="msubsup" > + <set name="subsup-prime" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="msubsup[ + (count( + child::mrow [ @class='mrow-super' ] + / child::* [ not(@title = 'speech-extra') ] + ) = 1) + and + not( + child::mrow [ @class='mrow-super' ] + / child::* [ not(@title = 'speech-extra') ] + / descendant::*[ preceding-sibling::* + or following-sibling::*] + ) + and + child::mrow [ @class='mrow-super' ] + / child::* [ not(@title = 'speech-extra') ] + / descendant-or-self::span[ @class='char' ] + / child::span[ + (@class = 'ch 2032') or (@class = 'ch 2033') + or (@class = 'ch 2034') + ] +]" > + <msub> + <mrow class="mrow-base"> + <xsl:apply-templates select=" + child::mrow[@class = 'mrow-base'] / * + " /> + <BREAK SIZE="small"/> + <xsl:apply-templates select=" + child::mrow[@class = 'mrow-super'] + / child::* [ not(@title = 'speech-extra') ] + " /> + </mrow> + <mrow class="mrow-sub"> + <xsl:apply-templates + select="*[@class = 'mrow-sub'] /* " /> + <xsl:apply-templates select=" + child::mrow[@class = 'mrow-super'] + / child::* [ @class = 'end-script' ] + " /> + </mrow> + </msub> +</xsl:template> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + +</set> +<xslt name="." xml="." xsl="subsup-prime" /> + + <set name="m-sub-sup" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="*[ + (self::msup or self::msub or self::msubsup) + and + not( + child::mrow[ @class = 'mrow-sub' ] + / child::*[ not(@title = 'speech-extra') + and + (normalize-space(.) != '') + ] + ) + and + not( + child::mrow[ @class = 'mrow-super' ] + / child::*[ not(@title = 'speech-extra') + and + (normalize-space(.) != '') + ] + ) +]" > + <xsl:apply-templates select="child::mrow[ + @class = 'mrow-base' ]/*" /> +</xsl:template> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + +</set> +<xslt name="." xml="." xsl="m-sub-sup" /> + + <set name="m-subsup-2-3" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="msubsup[ + (normalize-space( + child::mrow[ (@class = 'mrow-super') ] + / child::span[ (@class != 'mid-script') + and + (@class != 'end-script') + ] + ) = '2') + and not( + child::mrow[ @class = 'mrow-base' ] + / child::span[ not( @title = 'speech-extra' ) ] + [ position() = last() ] + / self::* [ @class = 'mo-op' ] +) + +]" > + <xsl:copy> + <xsl:attribute name="class" > + <xsl:text>msub</xsl:text> + </xsl:attribute> + <xsl:apply-templates select="*|text()|comment()" + mode="sub-squared" /> + </xsl:copy> +</xsl:template> +<xsl:template match="*|@*|text()|comment()" + mode="sub-squared" > + <xsl:copy> + <xsl:choose> + <xsl:when test=" @class = 'mrow-sub' "> + <xsl:apply-templates select="*[ + not( @class = 'end-script' ) + ] + |@*|text()|comment()" /> + <xsl:apply-templates select=" + following-sibling::*[1] / *[ + @class = 'end-script' + ] " /> + </xsl:when> + <xsl:when test=" @class = 'mrow-super' "> + <xsl:attribute name="class" > + <xsl:text>squared-super</xsl:text> + </xsl:attribute> + <mo class="mo-op"> + <xsl:text> squared </xsl:text> + </mo> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:otherwise> + </xsl:choose> + </xsl:copy> +</xsl:template> +<xsl:template match="msubsup[ + (normalize-space( + child::mrow[ (@class = 'mrow-super') ] + / child::span[ (@class != 'mid-script') + and + (@class != 'end-script') + ] + ) = '3') + and not( + child::mrow[ @class = 'mrow-base' ] + / child::span[ not( @title = 'speech-extra' ) ] + [ position() = last() ] + / self::* [ @class = 'mo-op' ] +) + +]" > + <xsl:copy> + <xsl:attribute name="class" > + <xsl:text>msub</xsl:text> + </xsl:attribute> + <xsl:apply-templates select="*|text()|comment()" + mode="sub-cube" /> + </xsl:copy> +</xsl:template> +<xsl:template match="*|@*|text()|comment()" + mode="sub-cube" > + <xsl:copy> + <xsl:choose> + <xsl:when test=" @class = 'mrow-sub' "> + <xsl:apply-templates select="*[ + not( @class = 'end-script' ) + ] + |@*|text()|comment()" /> + <xsl:apply-templates select=" + following-sibling::*[1] / *[ + @class = 'end-script' + ] " /> + </xsl:when> + <xsl:when test=" @class = 'mrow-super' "> + <xsl:attribute name="class" > + <xsl:text>cube-super</xsl:text> + </xsl:attribute> + <mo class="mo-op"> + <xsl:text> cube </xsl:text> + </mo> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:otherwise> + </xsl:choose> + </xsl:copy> +</xsl:template> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + +</set> +<xslt name="." xml="." xsl="m-subsup-2-3" /> + +</script> + + <script element="mfrac" > + <set name="mfrac" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="mfrac" > + <xsl:copy> + <xsl:choose> + <xsl:when test=" + (string-length( + normalize-space(child::mrow[ @class = 'mrow-numerator' ][1]) + ) = 1) + and + (string-length( + normalize-space(child::mrow[ @class = 'mrow-enumerator' ][1]) + ) = 1) +"> + <xsl:variable name="a"> + <xsl:value-of select=" + normalize-space(child::mrow[ @class = 'mrow-numerator' ][1]) + " /> +</xsl:variable> +<xsl:variable name="b"> + <xsl:value-of select=" + normalize-space(child::mrow[ @class = 'mrow-enumerator' ][1]) + " /> +</xsl:variable> + + <xsl:choose> + <xsl:when test=" + (translate($a,'123456789','') != '') + or + (translate($b,'123456789','') != '') + " > + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:when> + <xsl:when test=" $a < $b "> + <xsl:attribute name="class"> + <xsl:text>word-frac</xsl:text> + </xsl:attribute> + <xsl:choose> + <xsl:when test=" $a = 1 "><xsl:text> one </xsl:text></xsl:when> + <xsl:when test=" $a = 2 "><xsl:text> two </xsl:text></xsl:when> + <xsl:when test=" $a = 3 "><xsl:text> three </xsl:text></xsl:when> + <xsl:when test=" $a = 4 "><xsl:text> four </xsl:text></xsl:when> + <xsl:when test=" $a = 5 "><xsl:text> five </xsl:text></xsl:when> + <xsl:when test=" $a = 6 "><xsl:text> six </xsl:text></xsl:when> + <xsl:when test=" $a = 7 "><xsl:text> seven </xsl:text></xsl:when> + <xsl:when test=" $a = 8 "><xsl:text> eight </xsl:text></xsl:when> + <xsl:when test=" $a = 9 "><xsl:text> nine </xsl:text></xsl:when> +</xsl:choose> + + <xsl:choose> + <xsl:when test=" $b = 2 "><xsl:text> half</xsl:text></xsl:when> + <xsl:when test=" $b = 3 "><xsl:text> third</xsl:text></xsl:when> + <xsl:when test=" $b = 4 "><xsl:text> fourth</xsl:text></xsl:when> + <xsl:when test=" $b = 5 "><xsl:text> fifth</xsl:text></xsl:when> + <xsl:when test=" $b = 6 "><xsl:text> sixth</xsl:text></xsl:when> + <xsl:when test=" $b = 7 "><xsl:text> seventh</xsl:text></xsl:when> + <xsl:when test=" $b = 8 "><xsl:text> eighth</xsl:text></xsl:when> + <xsl:when test=" $b = 9 "><xsl:text> nineth</xsl:text></xsl:when> +</xsl:choose> +<xsl:if test=" $a > 1 "><xsl:text>s</xsl:text></xsl:if> +<xsl:text> </xsl:text> + + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:otherwise> + </xsl:choose> +</xsl:when> + + <xsl:when test=" + self::mfrac + and + child::mrow[ @class = 'mrow-enumerator' ] + / child::mfrac[ @class = 'continued-mfrac' ] + and + ( normalize-space( + child::mrow[ @class = 'mrow-numerator' ] + ) + = + normalize-space( + child::mrow[ @class = 'mrow-enumerator' ] + / child::mfrac[ @class = 'continued-mfrac' ] + / child::mrow[ @class = 'mrow-numerator' ] + ) + ) + and ( + normalize-space( + child::span[ @class = 'mrow-enumerator' ] / + child::mfrac / + preceding-sibling::*[1] ) + = + normalize-space( + child::span[ @class = 'mrow-enumerator' ] / + child::mfrac / + child::span[ @class = 'mrow-enumerator' ] / + child::span[ @class = 'continued-mfrac' ] / + preceding-sibling::*[1] ) +) + +" > + <xsl:variable name="a"> + <xsl:apply-templates select=" + child::span[ @class = 'mrow-enumerator' ] / + child::span[ @class = 'mcontinued-mfrac' ] / + preceding-sibling::*[2] + " mode="enum-op" /> +</xsl:variable> +<xsl:variable name="b"> + <xsl:apply-templates select=" + child::span[ @class = 'mrow-enumerator' ] / + child::span[ @class = 'mcontinued-mfrac' ] / + child::span[ @class = 'mrow-enumerator' ] / + child::span[ + self::mfrac or (@class = 'mcontinued-mfrac') + ] / + preceding-sibling::*[2] + " mode="enum-op" /> +</xsl:variable> + + <xsl:choose> + <xsl:when test=" + normalize-space($a)=normalize-space($b) + " > + <xsl:attribute name="class"> + <xsl:value-of select=" 'continued-mfrac' " /> + </xsl:attribute> + <xsl:apply-templates select="*|text()|comment()" /> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:otherwise> + </xsl:choose> +</xsl:when> + + <xsl:when test=" + (translate( + normalize-space( + child::mrow[ @class = 'mrow-numerator' ]), + '0123456789','')= '') + and ( normalize-space( + child::mrow[ @class = 'mrow-numerator' ]) + and + normalize-space( + child::mrow[ @class = 'mrow-enumerator' ] / + child::mfrac / + child::mrow[ @class = 'mrow-numerator' ]) +) +and +( normalize-space( + child::mrow[ @class = 'mrow-enumerator' ] / + child::mfrac / + child::mrow[ @class = 'mrow-numerator' ]) + and + normalize-space( + child::mrow[ @class = 'mrow-enumerator' ] / + child::mfrac / + child::mrow[ @class = 'mrow-enumerator' ] / + child::mfrac / + child::mrow[ @class = 'mrow-numerator' ]) +) + + and ( child::mrow[ @class = 'mrow-enumerator' ] / + child::mfrac / + preceding-sibling::*[1][@class = 'MathClass-bin'] +) +and +( normalize-space( + child::mrow[ @class = 'mrow-enumerator' ] / + child::mfrac / + preceding-sibling::*[1] ) + = + normalize-space( + child::mrow[ @class = 'mrow-enumerator' ] / + child::mfrac / + child::mrow[ @class = 'mrow-enumerator' ] / + child::mfrac / + preceding-sibling::*[1] ) +) + +"> + <xsl:variable name="a"> + <xsl:apply-templates select=" + child::mrow[ @class = 'mrow-enumerator' ] / + child::mfrac / + preceding-sibling::*[2] + " mode="enum-op" /> +</xsl:variable> +<xsl:variable name="b"> + <xsl:apply-templates select=" + child::mrow[ @class = 'mrow-enumerator' ] / + child::mfrac / + child::mrow[ @class = 'mrow-enumerator' ] / + child::mfrac / + preceding-sibling::*[2] + " mode="enum-op" /> +</xsl:variable> +<xsl:variable name="c"> + <xsl:value-of select=" + normalize-space( + child::mrow[ @class = 'mrow-enumerator' ] / + child::mfrac / + child::mrow[ @class = 'mrow-enumerator' ] / + child::mfrac / + child::mrow[ @class = 'mrow-enumerator' ] ) + " /> +</xsl:variable> + + <xsl:choose> + <xsl:when test=" + ( translate($a,'0123456789 ','') = '') + and (normalize-space($a)=normalize-space($b)) + and starts-with( $c, normalize-space( $a )) + and starts-with( + normalize-space( + substring-after( $c, normalize-space( $a )) ) + , + normalize-space( + child::mrow[ @class = 'mrow-enumerator' ] / + child::mfrac / + preceding-sibling::*[1] ) + ) + " > + <xsl:attribute name="class"> + <xsl:value-of select=" 'continued-mfrac' " /> + </xsl:attribute> + <xsl:apply-templates select="*|text()|comment()" /> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:otherwise> + </xsl:choose> +</xsl:when> + + <xsl:otherwise> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:otherwise> + </xsl:choose> + </xsl:copy> +</xsl:template> +<xsl:template match="*" mode="enum-op"> + <xsl:if test="preceding-sibling::*" > + <xsl:apply-templates select=" preceding-sibling::*[1] " /> + </xsl:if> + <xsl:value-of select="." /> +</xsl:template> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + + </set> + <xslt name="." xml="." xsl="mfrac" /> +</script> + + <script element="munder::munder-underline" > + <set name="munder" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="*" mode="content" > + <xsl:choose> + <xsl:when test=" @class = 'char' " > + <xsl:if test="not( child::*[ + (@class = 'ch 2032') or (@class = 'ch 2033') + or (@class = 'ch 2034') + ] )"> + <xsl:text>x</xsl:text> + </xsl:if> + </xsl:when> + <xsl:when test=" not( + (@title = 'speech-extra') or (@class = 'accent-char') + ) " > + <xsl:apply-templates select="*|text()" mode="content" /> + </xsl:when> + </xsl:choose> +</xsl:template> + + <xsl:template match="munder[ + (@class = 'munder-underline') + and + child::mrow[ + (@class = 'mo-0332') + and + descendant::mi + ] +]" > + <xsl:variable name="content"> + <xsl:apply-templates select="*" mode="content" /> + </xsl:variable> + <xsl:choose> + <xsl:when test=" + string-length( normalize-space( $content )) = 1 + " > + <xsl:copy> + <xsl:apply-templates select="@*" /> + <xsl:apply-templates + select=" *[ @class != 'begin-end' ] " /> + <span class="begin-end" title="speech-extra" > + <BREAK SIZE="small"/> + <xsl:text> under bar </xsl:text> + <BREAK SIZE="small"/> + </span> + </xsl:copy> + </xsl:when> + <xsl:otherwise> + <xsl:choose> + <xsl:when test="child::mrow / child::mover"> + <xsl:apply-templates select="child::mrow / child::mover" + mode="under-mover" /> + </xsl:when> + <xsl:otherwise> + <xsl:copy> + <xsl:apply-templates select=" *|@*|text() " /> + </xsl:copy> + </xsl:otherwise> +</xsl:choose> + + </xsl:otherwise> + </xsl:choose> +</xsl:template> +<xsl:template match="*" mode="under-mover" > + <xsl:choose> + <xsl:when test="self::mover"> + <xsl:copy> + <xsl:apply-templates select="@*" /> + <xsl:apply-templates select="*" mode="under-mover" /> + </xsl:copy> + </xsl:when> + <xsl:when test="self::mrow[ parent::mover ]"> + <xsl:copy> + <xsl:apply-templates select="@*" /> + <xsl:choose> + <xsl:when test="child::mover"> + <xsl:apply-templates select="*" mode="under-mover" /> + </xsl:when> + <xsl:otherwise> + <munder class="munder-underline"> + <xsl:apply-templates select=" + ancestor::munder[1] / child::*[following-sibling::mrow] +"/> + + <mrow class="mo-0032"> + <xsl:apply-templates select="*" /> + </mrow> + <xsl:apply-templates select=" + ancestor::munder[1] / child::*[preceding-sibling::mrow] +"/> + + </munder> + </xsl:otherwise> +</xsl:choose> + + </xsl:copy> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="." /> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + + </set> + <xslt name="." xml="." xsl="munder" /> +</script> +<script element="mover::mover-overline" > + <set name="mover" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="*" mode="content" > + <xsl:choose> + <xsl:when test=" @class = 'char' " > + <xsl:if test="not( child::*[ + (@class = 'ch 2032') or (@class = 'ch 2033') + or (@class = 'ch 2034') + ] )"> + <xsl:text>x</xsl:text> + </xsl:if> + </xsl:when> + <xsl:when test=" not( + (@title = 'speech-extra') or (@class = 'accent-char') + ) " > + <xsl:apply-templates select="*|text()" mode="content" /> + </xsl:when> + </xsl:choose> +</xsl:template> + + <xsl:template match="mover[ + (@class = 'mover-overline') + and + child::mrow[ + (@class = 'mo-00AF') + and + descendant::mi + ] +]" > + <xsl:variable name="content"> + <xsl:apply-templates select="*" mode="content" /> + </xsl:variable> + <xsl:choose> + <xsl:when test=" + string-length( normalize-space( $content )) = 1 + " > + <BREAK SIZE="small"/> +<xsl:choose> + <xsl:when test="child::mrow / child::munder"> + <xsl:apply-templates select="child::mrow / child::munder" + mode="under-munder" /> + </xsl:when> + <xsl:otherwise> + <xsl:copy> + <xsl:apply-templates select="@*" /> + <xsl:apply-templates + select=" *[ @class != 'begin-end' ] " /> + <span class="begin-end" title="speech-extra" > + <BREAK SIZE="small"/> + <xsl:text> over bar </xsl:text> + <BREAK SIZE="small"/> +</span> + + </xsl:copy> + </xsl:otherwise> +</xsl:choose> + + </xsl:when> + <xsl:otherwise> + <xsl:copy> + <xsl:apply-templates select="@*" /> + <xsl:apply-templates + select="*|text()|comment()" /> + </xsl:copy> + </xsl:otherwise> + </xsl:choose> +</xsl:template> +<xsl:template match="*" mode="under-munder" > + <xsl:choose> + <xsl:when test="self::munder"> + <xsl:copy> + <xsl:apply-templates select="@*" /> + <xsl:apply-templates select="*" mode="under-munder" /> + </xsl:copy> + </xsl:when> + <xsl:when test="self::mrow[ parent::munder ]"> + <xsl:copy> + <xsl:apply-templates select="@*" /> + <xsl:choose> + <xsl:when test="child::munder"> + <xsl:apply-templates select="*" mode="under-munder" /> + </xsl:when> + <xsl:otherwise> + <mover class="mover-overline"> + <mrow class="mo-00AF"> + <xsl:apply-templates select="*" /> + </mrow> + <span class="begin-end" title="speech-extra" > + <BREAK SIZE="small"/> + <xsl:text> over bar </xsl:text> + <BREAK SIZE="small"/> +</span> + + </mover> + </xsl:otherwise> +</xsl:choose> + + </xsl:copy> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="." /> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + + </set> + <xslt name="." xml="." xsl="mover" /> +</script> + + <script element="msub::limits-msub-msup" > + <set name="smash" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="*[ + (@class = 'limits-msub-msup') + and + child::*[ (position() = 1) + and (@class = 'limits-mrow-base') + and child::*[ (position() = 1) + and (@class = 'limits-msub-msup') + ] ] +]" > + <xsl:copy> + <xsl:apply-templates select="@*" /> + <xsl:apply-templates select=" + *[1] + / *[1] + / *[ not(@class='limits-mrow-super') ] " /> + <xsl:apply-templates select=" *[ + preceding-sibling::* + and + not(@class='limits-mrow-super') ]" /> + <xsl:apply-templates select=" + *[1] + / *[1] + / *[@class='limits-mrow-super' ] " /> + <xsl:apply-templates select=" *[ + preceding-sibling::* + and + (@class='limits-mrow-super') ]" /> + </xsl:copy> +</xsl:template> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + + </set> + <xslt name="." xml="." xsl="smash" /> +</script> +<script element="msup::limits-msub-msup" > + <set name="smash" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="*[ + (@class = 'limits-msub-msup') + and + child::*[ (position() = 1) + and (@class = 'limits-mrow-base') + and child::*[ (position() = 1) + and (@class = 'limits-msub-msup') + ] ] +]" > + <xsl:copy> + <xsl:apply-templates select="@*" /> + <xsl:apply-templates select=" + *[1] + / *[1] + / *[ not(@class='limits-mrow-super') ] " /> + <xsl:apply-templates select=" *[ + preceding-sibling::* + and + not(@class='limits-mrow-super') ]" /> + <xsl:apply-templates select=" + *[1] + / *[1] + / *[@class='limits-mrow-super' ] " /> + <xsl:apply-templates select=" *[ + preceding-sibling::* + and + (@class='limits-mrow-super') ]" /> + </xsl:copy> +</xsl:template> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + + </set> + <xslt name="." xml="." xsl="smash" /> +</script> +<script element="msubsup::limits-msub-msup" > + <set name="smash" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="*[ + (@class = 'limits-msub-msup') + and + child::*[ (position() = 1) + and (@class = 'limits-mrow-base') + and child::*[ (position() = 1) + and (@class = 'limits-msub-msup') + ] ] +]" > + <xsl:copy> + <xsl:apply-templates select="@*" /> + <xsl:apply-templates select=" + *[1] + / *[1] + / *[ not(@class='limits-mrow-super') ] " /> + <xsl:apply-templates select=" *[ + preceding-sibling::* + and + not(@class='limits-mrow-super') ]" /> + <xsl:apply-templates select=" + *[1] + / *[1] + / *[@class='limits-mrow-super' ] " /> + <xsl:apply-templates select=" *[ + preceding-sibling::* + and + (@class='limits-mrow-super') ]" /> + </xsl:copy> +</xsl:template> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + + </set> + <xslt name="." xml="." xsl="smash" /> +</script> + + + <script element="mi" > + <set name="math-cap" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="mi" > + <xsl:copy> + <xsl:apply-templates select="@*" /> + <xsl:if test=" string-length(.) = 1 " > + <xsl:if test=" + (translate(.,'ABCDEFGHIJKLMNOPQRSTUVWXYZ', + '') = '' ) + " > + <span class="capital-description" + title="speech-extra" > + <xsl:text> capital </xsl:text> + </span> + </xsl:if> + </xsl:if> + <xsl:apply-templates select="*|text()|comment()" /> + </xsl:copy> +</xsl:template> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + + </set> + <xslt name="." xml="." xsl="math-cap" /> +</script> + + <script element="tr" > + <set name="eqnum" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="div[ + (parent::tr or parent::mtr) + and ( normalize-space(.) = '' ) + and not( normalize-space(following-sibling::*) != '' ) +]" > +</xsl:template> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + + </set> + <xslt name="." xml="." xsl="eqnum" /> +</script> +<script element="mtr" > + <set name="eqnum" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="div[ + (parent::tr or parent::mtr) + and ( normalize-space(.) = '' ) + and not( normalize-space(following-sibling::*) != '' ) +]" > +</xsl:template> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + + </set> + <xslt name="." xml="." xsl="eqnum" /> +</script> + + <script element="span::inline-math" > + <set name="num-sub" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="msub[ + ( + (count( child::mrow[ @class = 'mrow-base' ] + / child::* ) = 1 ) + and child::mrow[ @class = 'mrow-base' ] / descendant::mi + and not( ancestor::*[ + self::msub or self::msup or self::msubsup + ] ) + + or + ( + count( child::mrow[ @class = 'mrow-base' ] + / child::* [ + not(self::BREAK) + ] + ) = 2 ) + and child::mrow[ @class = 'mrow-base' ] [ + child::*[1][ self::mi ] + and + child::*[ + (position() > 1) + and + (normalize-space(.) = + normalize-space( + descendant-or-self::span[ + (@class = 'ch 2032') or (@class = 'ch 2033') + or (@class = 'ch 2034') + ] + )) + ] + ] + and not( ancestor::*[ + self::msub or self::msup or self::msubsup + ] ) + + ) + and + child::mrow[ @class = 'mrow-sub' ] + / child::*[ not(@title = 'speech-extra') ][1] + / self::*[ + normalize-space(.) + = normalize-space( descendant::mn ) ] +]" > + <xsl:copy> + <xsl:apply-templates select="@*" /> + <BREAK SIZE="small"/> + <xsl:apply-templates select="*[1]" /> + <mrow class="mrow-sub"> + <xsl:apply-templates + select="*[2] / *[ + not(@title = 'speech-extra') + ]" /> + <BREAK SIZE="small"/> + </mrow> + </xsl:copy> +</xsl:template> +<xsl:template match="msubsup[ + ( + (count( child::mrow[ @class = 'mrow-base' ] + / child::* ) = 1 ) + and child::mrow[ @class = 'mrow-base' ] / descendant::mi + and not( ancestor::*[ + self::msub or self::msup or self::msubsup + ] ) + + ) + and + child::mrow[ @class = 'mrow-sub' ] + / child::*[ not(@title = 'speech-extra') ][1] + / self::*[ + normalize-space(.) + = normalize-space( descendant::mn ) ] +]" > + <msup> + <BREAK SIZE="small"/> + <xsl:apply-templates select="*[1]" /> + <mrow class="mrow-sub"> + <xsl:apply-templates + select="*[2] / *[ + not(@title = 'speech-extra') + ]" /> + <BREAK SIZE="small"/> + </mrow> + <xsl:apply-templates select="*[3]" /> + </msup> +</xsl:template> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + + </set> + <xslt name="." xml="." xsl="num-sub" /> + + <dom name="." xml="." method="fracLevel" class="HtJsml" /> +<set name="rmXmlDecl" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + +</set> +<xslt name="." xml="." xsl="rmXmlDecl" /> + + + <dom name="." xml="." method="scriptLevel" class="HtJsml" /> +<set name="rmXmlDecl" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + +</set> +<xslt name="." xml="." xsl="rmXmlDecl" /> + + + <dom name="." xml="." method="rootLevel" class="HtJsml" /> +<set name="rmXmlDecl" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + +</set> +<xslt name="." xml="." xsl="rmXmlDecl" /> + + + <set name="inline-math" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="mn-group-s" > + <xsl:apply-templates select="*|@*|text()|comment()" /> +</xsl:template> + +<xsl:template match="mo[ + (@class='MathClass-punc') + and ( (.='.') or (.=',') or (.='!') + or (.=';') or (.=':') or (.='?') ) +]" > + <xsl:copy> + <xsl:apply-templates select="@*" /> + <BREAK SIZE="small"/> + <xsl:choose> + <xsl:when test=" .='.' " > + <SAYAS SUB="dot">.</SAYAS> + </xsl:when> + <xsl:when test=" .=',' " > + <SAYAS SUB="comma">,</SAYAS> + </xsl:when> + <xsl:when test=" .=';' " > + <SAYAS SUB="semicolon">;</SAYAS> + </xsl:when> + <xsl:when test=" .=':' " > + <SAYAS SUB="colon">:</SAYAS> + </xsl:when> + <xsl:when test=" .='!' " > + <SAYAS SUB="exclamation mark">!</SAYAS> + </xsl:when> + <xsl:when test=" .='?' " > + <SAYAS SUB="question mark">?</SAYAS> + </xsl:when> + </xsl:choose> + <BREAK SIZE="small"/> + </xsl:copy> +</xsl:template> + +<xsl:template match="mn[ + ancestor::mover[ + not( descendant::*[ + (count( child::*[ not(@title = 'speech-extra') + and not( self::BREAK ) + ] + ) > 1) + ]) + and + ( + preceding-sibling::*[1][self::dot or self::mn-group-s] + or + following-sibling::*[1][self::dot or self::mn-group-s] + ) +] + + or + ancestor::munder[ + not( descendant::*[ + (count( child::*[ not(@title = 'speech-extra') + and not( self::BREAK ) + ] + ) > 1) + ]) + and + ( + preceding-sibling::*[1][self::dot or self::mn-group-s] + or + following-sibling::*[1][self::dot or self::mn-group-s] + ) +] + +]" > + <xsl:copy> + <SAYAS CLASS="digits"> + <xsl:value-of select="." /> + </SAYAS> + </xsl:copy> +</xsl:template> + + +<xsl:template match="*" mode="content" > + <xsl:choose> + <xsl:when test=" @class = 'char' " > + <xsl:if test="not( child::*[ + (@class = 'ch 2032') or (@class = 'ch 2033') + or (@class = 'ch 2034') + ] )"> + <xsl:text>x</xsl:text> + </xsl:if> + </xsl:when> + <xsl:when test=" not( + (@title = 'speech-extra') or (@class = 'accent-char') + ) " > + <xsl:apply-templates select="*|text()" mode="content" /> + </xsl:when> + </xsl:choose> +</xsl:template> + +<xsl:template match="span[ + (@class = 'end-script') + and + ancestor::* [ following-sibling::* [ + not( @class = 'content-less' ) + ] + ][1] + / following-sibling::* [ + not( @class = 'content-less' ) + ][1] + / self::* + [ + (@class = 'end-math') + or + (@class = 'end-script') + or + (@class = 'end-root') + or + (@class = 'end-stack') + or + (@class = 'mid-stack') + or + (@class = 'end-array') + or + self::td or self::mtd or self::tr or self::mtr + or + (@title = 'implicit-baseline') + ] +]" > + <BREAK SIZE="small"/> +</xsl:template> +<xsl:template match="span[ + (@class = 'end-script') + and + parent::mrow / parent::msub + and + ancestor::* [ following-sibling::* ][1] + / following-sibling::* [ normalize-space(.) != '' ][1] + [ + (self::msub or self::msubsup) + and + (normalize-space(child::mrow[ + @class = 'mrow-base' ]) = '') + ] +]" > + <BREAK SIZE="small"/> +</xsl:template> +<xsl:template match="span[ + (@class = 'end-script') + and + parent::mrow /parent::*[ self::msup or self::msubsup] + and + ancestor::* [ following-sibling::* ][1] + / following-sibling::* [ normalize-space(.) != '' ][1] + [ + self::msup + and + (normalize-space(child::mrow[ + @class = 'mrow-base' ]) = '') + ] +]" > + <BREAK SIZE="small"/> +</xsl:template> + +<xsl:template match="span[ + (@class = 'begin-script') + or (@class = 'mid-script') +]" > + <xsl:copy> + <xsl:apply-templates select="@*" /> + <xsl:apply-templates select="*|text()|comment()" + mode="clean-script" /> + </xsl:copy> +</xsl:template> +<xsl:template match="*" mode="clean-script" > + <xsl:copy> + <xsl:apply-templates select="@*" /> + <xsl:apply-templates select="*|text()|comment()" + mode="clean-script" /> + </xsl:copy> +</xsl:template> +<xsl:template match="text()" mode="clean-script" > +</xsl:template> +<xsl:template match="span[@class = 'scripts-extra']" + mode="clean-script" > + <xsl:copy> + <xsl:apply-templates select="@*" /> + <xsl:value-of select=" + ancestor::span[ + (@class = 'begin-script') + or (@class = 'mid-script') ] [1] + " /> + </xsl:copy> +</xsl:template> + +<xsl:template match="mfrac[ + ( + (translate( + concat( + mrow[ (@class = 'mrow-numerator')], + mrow[ (@class = 'mrow-enumerator')] + ) ,'0123456789','') = '') + and + not(descendant::*/descendant::* + /descendant::mn-group-s) + or + (@class = 'word-frac') + ) + and + preceding-sibling::*[1] + / self::mn-group-s[ child::*[ + (position() = last()) + and + self::mn + ] ] + ]" > + <xsl:text> and </xsl:text> + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> +</xsl:template> + +<xsl:template match="mo[ + (@class = 'MathClass-bin') + and + ( normalize-space(.) = + normalize-space(descendant::span[@class = 'ch 2212']) + ) + and + ( preceding-sibling::*[1][ + (@title='speech-extra') + or (@class='MathClass-bin') + or (@class='MathClass-rel') + or (@class='MathClass-punc') + or (@class='MathClass-op') + or self::mn-group-s [ child::* [ + (position() = last()) + and + (@class='MathClass-punc') + ] ] ] + and + ( + following-sibling::*[1][ self::mn-group-s + or self::mi ] + or + (count(following-sibling::*[ + not(@title = 'speech-extra') + ]) = 1) + ) + or + not(preceding-sibling::*) and following-sibling::* + ) +]" > + <xsl:copy> + <xsl:attribute name="class"> + <xsl:text>mo-unary</xsl:text> + </xsl:attribute> + <xsl:apply-templates select="*|text()|comment()" + mode="minus-neg" /> + </xsl:copy> +</xsl:template> +<xsl:template match="*|@*|text()|comment()" mode="minus-neg" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" + mode="minus-neg" /> + </xsl:copy> +</xsl:template> +<xsl:template match="text()" mode="minus-neg" > + <xsl:choose> + <xsl:when test=" . = 'minus' " > + <xsl:text>negative</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="." /> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + +<xsl:template match="span[ @class = 'end-limits-script' ]" > + <xsl:if test=" parent::*[ not(following-sibling::*) ] "> + <xsl:copy> + <xsl:apply-templates select=" @* " /> + <xsl:choose> + <xsl:when test=" + parent::*[ preceding-sibling::mrow[ + @class != 'limits-mrow-base' + ] ] + " > + <BREAK SIZE="small"/> + <xsl:text> end scripts </xsl:text> + <BREAK SIZE="small"/> + </xsl:when> + <xsl:otherwise> + <BREAK SIZE="small"/> + <xsl:text> end script </xsl:text> + <BREAK SIZE="small"/> + </xsl:otherwise> + </xsl:choose> + </xsl:copy> + </xsl:if> +</xsl:template> +<xsl:template match="span[ @class = 'begin-limits-script' ]" > + <xsl:copy> + <xsl:apply-templates select=" @* " /> + <xsl:choose> + <xsl:when test=" + parent::*[ @class = 'limits-mrow-super' ] + " > + <xsl:apply-templates + select=" parent::* + / preceding-sibling::*[1] " + mode = "extra-over" /> + </xsl:when> + <xsl:when test=" + parent::*[ @class = 'limits-mrow-sub' ] + " > + <xsl:apply-templates + select=" parent::* + / preceding-sibling::*[1] " + mode = "extra-under" /> + </xsl:when> + </xsl:choose> + <xsl:apply-templates select="*|text()|comment()" /> + </xsl:copy> +</xsl:template> +<xsl:template match="*" mode="extra-over" > + <xsl:if test = " self::mrow[ @class = 'limits-mrow-super' ] " > + <xsl:text> over </xsl:text> + <xsl:apply-templates select=" preceding-sibling::*[1] " + mode = "extra-over" /> + </xsl:if> +</xsl:template> +<xsl:template match="*" mode="extra-under" > + <xsl:if test = " self::mrow[ @class = 'limits-mrow-sub' ] " > + <xsl:text> under </xsl:text> + <xsl:apply-templates select=" preceding-sibling::*[1] " + mode = "extra-under" /> + </xsl:if> +</xsl:template> + +<xsl:template match="span[ + (@class = 'begin-script') + and + following-sibling::*[ not(@title = 'speech-extra') ] [1] + / descendant-or-self::*[ not( self::PROS ) ][1] + / + child::span / child::span[ + (@class = 'ch 2032') or (@class = 'ch 2033') + or (@class = 'ch 2034') + ] +]" > + <BREAK SIZE="small"/> +</xsl:template> +<xsl:template match="span[ + (@class = 'end-script') + and + preceding-sibling::*[ not(@title = 'speech-extra') ] [1] + / descendant-or-self::*[ not( self::PROS ) ][1] + / + child::span / child::span[ + (@class = 'ch 2032') or (@class = 'ch 2033') + or (@class = 'ch 2034') + ] +]" > + <BREAK SIZE="small"/> +</xsl:template> + +<xsl:template match="mrow[ + (@class = 'mrow-super') + and + parent::msup + and + (count( child::*[ not(@title = 'speech-extra') + and not( self::BREAK ) + ] + ) = 1) + and + child::*[ not(@title = 'speech-extra') + and not( self::BREAK ) + ] + [1][ + normalize-space(.) + = + normalize-space( + descendant::span[@class = 'ch 2218'] + ) + ] +]" > + <xsl:copy> + <xsl:apply-templates select="@*" /> + <xsl:apply-templates + select="*[not(@title = 'speech-extra') + and + not(self::BREAK) + ]" + mode="degree" /> + <BREAK SIZE="small"/> + </xsl:copy> +</xsl:template> +<xsl:template match="*" mode="degree" > + <xsl:copy> + <xsl:apply-templates select="@*" /> + <xsl:choose> + <xsl:when test="self::span[ @class='ch 2218' ]" > + <xsl:text>degree</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates + select="*[not(self::BREAK)]|text()" + mode="degree"/> + </xsl:otherwise> + </xsl:choose> + </xsl:copy> +</xsl:template> + + + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + + </set> + <xslt name="." xml="." xsl="inline-math" /> + <sax name="." xml="." content-handler="JsmlMathBreak" /> + + <set name="inline-math-2" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="*" mode="content" > + <xsl:choose> + <xsl:when test=" @class = 'char' " > + <xsl:if test="not( child::*[ + (@class = 'ch 2032') or (@class = 'ch 2033') + or (@class = 'ch 2034') + ] )"> + <xsl:text>x</xsl:text> + </xsl:if> + </xsl:when> + <xsl:when test=" not( + (@title = 'speech-extra') or (@class = 'accent-char') + ) " > + <xsl:apply-templates select="*|text()" mode="content" /> + </xsl:when> + </xsl:choose> +</xsl:template> + +<xsl:template match="span[ + (@class = 'end-script') + and + ancestor::*[ preceding-sibling::* [ + ((@class = 'begin-script') or (@class = 'mid-script')) ]] +]" > + <xsl:copy> + <xsl:apply-templates select="@*" /> + <xsl:apply-templates select=" + ancestor::*[ preceding-sibling::* [ + ((@class = 'begin-script') or + (@class = 'mid-script')) ]][1] + / preceding-sibling::* [ + ((@class = 'begin-script') or + (@class = 'mid-script')) ][1] + " mode="script-copy" /> + </xsl:copy> +</xsl:template> +<xsl:template match="*|@*|text()|comment()" + mode="script-copy" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> +</xsl:template> +<xsl:template match="span[ + (@class = 'begin-script') or + (@class = 'mid-script') ]" mode="script-copy" > + <xsl:apply-templates select="*|text()|comment()" /> +</xsl:template> + +<xsl:template match="span[ + ((@class = 'begin-script') or (@class = 'mid-script')) + and + following-sibling::* + / following-sibling::span[ @class = 'end-script' ] + and + following-sibling::*[1] + / descendant-or-self::*[ not(self::PROS) ][1] + / child::*[1][ + (@class = 'mrow-base') + and + (normalize-space(.)='') + ] +]" > +</xsl:template> + +<xsl:template match="span[ + (@class = 'begin-script') + and + following-sibling::* [1] / child::*[ + (position() = 1) + and + (@class = 'mrow-base') + and + ( normalize-space(.) = '' ) + ] +]" > +</xsl:template> + + + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + + </set> + <xslt name="." xml="." xsl="inline-math-2" /> +</script> + + <script element="div::display-math" > + <set name="num-sub" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="msub[ + ( + (count( child::mrow[ @class = 'mrow-base' ] + / child::* ) = 1 ) + and child::mrow[ @class = 'mrow-base' ] / descendant::mi + and not( ancestor::*[ + self::msub or self::msup or self::msubsup + ] ) + + or + ( + count( child::mrow[ @class = 'mrow-base' ] + / child::* [ + not(self::BREAK) + ] + ) = 2 ) + and child::mrow[ @class = 'mrow-base' ] [ + child::*[1][ self::mi ] + and + child::*[ + (position() > 1) + and + (normalize-space(.) = + normalize-space( + descendant-or-self::span[ + (@class = 'ch 2032') or (@class = 'ch 2033') + or (@class = 'ch 2034') + ] + )) + ] + ] + and not( ancestor::*[ + self::msub or self::msup or self::msubsup + ] ) + + ) + and + child::mrow[ @class = 'mrow-sub' ] + / child::*[ not(@title = 'speech-extra') ][1] + / self::*[ + normalize-space(.) + = normalize-space( descendant::mn ) ] +]" > + <xsl:copy> + <xsl:apply-templates select="@*" /> + <BREAK SIZE="small"/> + <xsl:apply-templates select="*[1]" /> + <mrow class="mrow-sub"> + <xsl:apply-templates + select="*[2] / *[ + not(@title = 'speech-extra') + ]" /> + <BREAK SIZE="small"/> + </mrow> + </xsl:copy> +</xsl:template> +<xsl:template match="msubsup[ + ( + (count( child::mrow[ @class = 'mrow-base' ] + / child::* ) = 1 ) + and child::mrow[ @class = 'mrow-base' ] / descendant::mi + and not( ancestor::*[ + self::msub or self::msup or self::msubsup + ] ) + + ) + and + child::mrow[ @class = 'mrow-sub' ] + / child::*[ not(@title = 'speech-extra') ][1] + / self::*[ + normalize-space(.) + = normalize-space( descendant::mn ) ] +]" > + <msup> + <BREAK SIZE="small"/> + <xsl:apply-templates select="*[1]" /> + <mrow class="mrow-sub"> + <xsl:apply-templates + select="*[2] / *[ + not(@title = 'speech-extra') + ]" /> + <BREAK SIZE="small"/> + </mrow> + <xsl:apply-templates select="*[3]" /> + </msup> +</xsl:template> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + + </set> + <xslt name="." xml="." xsl="num-sub" /> + + <dom name="." xml="." method="fracLevel" class="HtJsml" /> +<set name="rmXmlDecl" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + +</set> +<xslt name="." xml="." xsl="rmXmlDecl" /> + + + <dom name="." xml="." method="scriptLevel" class="HtJsml" /> +<set name="rmXmlDecl" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + +</set> +<xslt name="." xml="." xsl="rmXmlDecl" /> + + + <dom name="." xml="." method="rootLevel" class="HtJsml" /> +<set name="rmXmlDecl" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + +</set> +<xslt name="." xml="." xsl="rmXmlDecl" /> + + + <set name="display-math" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="mn-group-s" > + <xsl:apply-templates select="*|@*|text()|comment()" /> +</xsl:template> + +<xsl:template match="mo[ + (@class='MathClass-punc') + and ( (.='.') or (.=',') or (.='!') + or (.=';') or (.=':') or (.='?') ) +]" > + <xsl:copy> + <xsl:apply-templates select="@*" /> + <BREAK SIZE="small"/> + <xsl:choose> + <xsl:when test=" .='.' " > + <SAYAS SUB="dot">.</SAYAS> + </xsl:when> + <xsl:when test=" .=',' " > + <SAYAS SUB="comma">,</SAYAS> + </xsl:when> + <xsl:when test=" .=';' " > + <SAYAS SUB="semicolon">;</SAYAS> + </xsl:when> + <xsl:when test=" .=':' " > + <SAYAS SUB="colon">:</SAYAS> + </xsl:when> + <xsl:when test=" .='!' " > + <SAYAS SUB="exclamation mark">!</SAYAS> + </xsl:when> + <xsl:when test=" .='?' " > + <SAYAS SUB="question mark">?</SAYAS> + </xsl:when> + </xsl:choose> + <BREAK SIZE="small"/> + </xsl:copy> +</xsl:template> + +<xsl:template match="mn[ + ancestor::mover[ + not( descendant::*[ + (count( child::*[ not(@title = 'speech-extra') + and not( self::BREAK ) + ] + ) > 1) + ]) + and + ( + preceding-sibling::*[1][self::dot or self::mn-group-s] + or + following-sibling::*[1][self::dot or self::mn-group-s] + ) +] + + or + ancestor::munder[ + not( descendant::*[ + (count( child::*[ not(@title = 'speech-extra') + and not( self::BREAK ) + ] + ) > 1) + ]) + and + ( + preceding-sibling::*[1][self::dot or self::mn-group-s] + or + following-sibling::*[1][self::dot or self::mn-group-s] + ) +] + +]" > + <xsl:copy> + <SAYAS CLASS="digits"> + <xsl:value-of select="." /> + </SAYAS> + </xsl:copy> +</xsl:template> + + +<xsl:template match="*" mode="content" > + <xsl:choose> + <xsl:when test=" @class = 'char' " > + <xsl:if test="not( child::*[ + (@class = 'ch 2032') or (@class = 'ch 2033') + or (@class = 'ch 2034') + ] )"> + <xsl:text>x</xsl:text> + </xsl:if> + </xsl:when> + <xsl:when test=" not( + (@title = 'speech-extra') or (@class = 'accent-char') + ) " > + <xsl:apply-templates select="*|text()" mode="content" /> + </xsl:when> + </xsl:choose> +</xsl:template> + +<xsl:template match="span[ + (@class = 'end-script') + and + ancestor::* [ following-sibling::* [ + not( @class = 'content-less' ) + ] + ][1] + / following-sibling::* [ + not( @class = 'content-less' ) + ][1] + / self::* + [ + (@class = 'end-math') + or + (@class = 'end-script') + or + (@class = 'end-root') + or + (@class = 'end-stack') + or + (@class = 'mid-stack') + or + (@class = 'end-array') + or + self::td or self::mtd or self::tr or self::mtr + or + (@title = 'implicit-baseline') + ] +]" > + <BREAK SIZE="small"/> +</xsl:template> +<xsl:template match="span[ + (@class = 'end-script') + and + parent::mrow / parent::msub + and + ancestor::* [ following-sibling::* ][1] + / following-sibling::* [ normalize-space(.) != '' ][1] + [ + (self::msub or self::msubsup) + and + (normalize-space(child::mrow[ + @class = 'mrow-base' ]) = '') + ] +]" > + <BREAK SIZE="small"/> +</xsl:template> +<xsl:template match="span[ + (@class = 'end-script') + and + parent::mrow /parent::*[ self::msup or self::msubsup] + and + ancestor::* [ following-sibling::* ][1] + / following-sibling::* [ normalize-space(.) != '' ][1] + [ + self::msup + and + (normalize-space(child::mrow[ + @class = 'mrow-base' ]) = '') + ] +]" > + <BREAK SIZE="small"/> +</xsl:template> + +<xsl:template match="span[ + (@class = 'begin-script') + or (@class = 'mid-script') +]" > + <xsl:copy> + <xsl:apply-templates select="@*" /> + <xsl:apply-templates select="*|text()|comment()" + mode="clean-script" /> + </xsl:copy> +</xsl:template> +<xsl:template match="*" mode="clean-script" > + <xsl:copy> + <xsl:apply-templates select="@*" /> + <xsl:apply-templates select="*|text()|comment()" + mode="clean-script" /> + </xsl:copy> +</xsl:template> +<xsl:template match="text()" mode="clean-script" > +</xsl:template> +<xsl:template match="span[@class = 'scripts-extra']" + mode="clean-script" > + <xsl:copy> + <xsl:apply-templates select="@*" /> + <xsl:value-of select=" + ancestor::span[ + (@class = 'begin-script') + or (@class = 'mid-script') ] [1] + " /> + </xsl:copy> +</xsl:template> + +<xsl:template match="mfrac[ + ( + (translate( + concat( + mrow[ (@class = 'mrow-numerator')], + mrow[ (@class = 'mrow-enumerator')] + ) ,'0123456789','') = '') + and + not(descendant::*/descendant::* + /descendant::mn-group-s) + or + (@class = 'word-frac') + ) + and + preceding-sibling::*[1] + / self::mn-group-s[ child::*[ + (position() = last()) + and + self::mn + ] ] + ]" > + <xsl:text> and </xsl:text> + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> +</xsl:template> + +<xsl:template match="mo[ + (@class = 'MathClass-bin') + and + ( normalize-space(.) = + normalize-space(descendant::span[@class = 'ch 2212']) + ) + and + ( preceding-sibling::*[1][ + (@title='speech-extra') + or (@class='MathClass-bin') + or (@class='MathClass-rel') + or (@class='MathClass-punc') + or (@class='MathClass-op') + or self::mn-group-s [ child::* [ + (position() = last()) + and + (@class='MathClass-punc') + ] ] ] + and + ( + following-sibling::*[1][ self::mn-group-s + or self::mi ] + or + (count(following-sibling::*[ + not(@title = 'speech-extra') + ]) = 1) + ) + or + not(preceding-sibling::*) and following-sibling::* + ) +]" > + <xsl:copy> + <xsl:attribute name="class"> + <xsl:text>mo-unary</xsl:text> + </xsl:attribute> + <xsl:apply-templates select="*|text()|comment()" + mode="minus-neg" /> + </xsl:copy> +</xsl:template> +<xsl:template match="*|@*|text()|comment()" mode="minus-neg" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" + mode="minus-neg" /> + </xsl:copy> +</xsl:template> +<xsl:template match="text()" mode="minus-neg" > + <xsl:choose> + <xsl:when test=" . = 'minus' " > + <xsl:text>negative</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="." /> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + +<xsl:template match="span[ @class = 'end-limits-script' ]" > + <xsl:if test=" parent::*[ not(following-sibling::*) ] "> + <xsl:copy> + <xsl:apply-templates select=" @* " /> + <xsl:choose> + <xsl:when test=" + parent::*[ preceding-sibling::mrow[ + @class != 'limits-mrow-base' + ] ] + " > + <BREAK SIZE="small"/> + <xsl:text> end scripts </xsl:text> + <BREAK SIZE="small"/> + </xsl:when> + <xsl:otherwise> + <BREAK SIZE="small"/> + <xsl:text> end script </xsl:text> + <BREAK SIZE="small"/> + </xsl:otherwise> + </xsl:choose> + </xsl:copy> + </xsl:if> +</xsl:template> +<xsl:template match="span[ @class = 'begin-limits-script' ]" > + <xsl:copy> + <xsl:apply-templates select=" @* " /> + <xsl:choose> + <xsl:when test=" + parent::*[ @class = 'limits-mrow-super' ] + " > + <xsl:apply-templates + select=" parent::* + / preceding-sibling::*[1] " + mode = "extra-over" /> + </xsl:when> + <xsl:when test=" + parent::*[ @class = 'limits-mrow-sub' ] + " > + <xsl:apply-templates + select=" parent::* + / preceding-sibling::*[1] " + mode = "extra-under" /> + </xsl:when> + </xsl:choose> + <xsl:apply-templates select="*|text()|comment()" /> + </xsl:copy> +</xsl:template> +<xsl:template match="*" mode="extra-over" > + <xsl:if test = " self::mrow[ @class = 'limits-mrow-super' ] " > + <xsl:text> over </xsl:text> + <xsl:apply-templates select=" preceding-sibling::*[1] " + mode = "extra-over" /> + </xsl:if> +</xsl:template> +<xsl:template match="*" mode="extra-under" > + <xsl:if test = " self::mrow[ @class = 'limits-mrow-sub' ] " > + <xsl:text> under </xsl:text> + <xsl:apply-templates select=" preceding-sibling::*[1] " + mode = "extra-under" /> + </xsl:if> +</xsl:template> + +<xsl:template match="span[ + (@class = 'begin-script') + and + following-sibling::*[ not(@title = 'speech-extra') ] [1] + / descendant-or-self::*[ not( self::PROS ) ][1] + / + child::span / child::span[ + (@class = 'ch 2032') or (@class = 'ch 2033') + or (@class = 'ch 2034') + ] +]" > + <BREAK SIZE="small"/> +</xsl:template> +<xsl:template match="span[ + (@class = 'end-script') + and + preceding-sibling::*[ not(@title = 'speech-extra') ] [1] + / descendant-or-self::*[ not( self::PROS ) ][1] + / + child::span / child::span[ + (@class = 'ch 2032') or (@class = 'ch 2033') + or (@class = 'ch 2034') + ] +]" > + <BREAK SIZE="small"/> +</xsl:template> + +<xsl:template match="mrow[ + (@class = 'mrow-super') + and + parent::msup + and + (count( child::*[ not(@title = 'speech-extra') + and not( self::BREAK ) + ] + ) = 1) + and + child::*[ not(@title = 'speech-extra') + and not( self::BREAK ) + ] + [1][ + normalize-space(.) + = + normalize-space( + descendant::span[@class = 'ch 2218'] + ) + ] +]" > + <xsl:copy> + <xsl:apply-templates select="@*" /> + <xsl:apply-templates + select="*[not(@title = 'speech-extra') + and + not(self::BREAK) + ]" + mode="degree" /> + <BREAK SIZE="small"/> + </xsl:copy> +</xsl:template> +<xsl:template match="*" mode="degree" > + <xsl:copy> + <xsl:apply-templates select="@*" /> + <xsl:choose> + <xsl:when test="self::span[ @class='ch 2218' ]" > + <xsl:text>degree</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates + select="*[not(self::BREAK)]|text()" + mode="degree"/> + </xsl:otherwise> + </xsl:choose> + </xsl:copy> +</xsl:template> + + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + + </set> + <xslt name="." xml="." xsl="display-math" /> + <sax name="." xml="." content-handler="JsmlMathBreak" /> + + <set name="display-math-2" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="*" mode="content" > + <xsl:choose> + <xsl:when test=" @class = 'char' " > + <xsl:if test="not( child::*[ + (@class = 'ch 2032') or (@class = 'ch 2033') + or (@class = 'ch 2034') + ] )"> + <xsl:text>x</xsl:text> + </xsl:if> + </xsl:when> + <xsl:when test=" not( + (@title = 'speech-extra') or (@class = 'accent-char') + ) " > + <xsl:apply-templates select="*|text()" mode="content" /> + </xsl:when> + </xsl:choose> +</xsl:template> + +<xsl:template match="span[ + (@class = 'end-script') + and + ancestor::*[ preceding-sibling::* [ + ((@class = 'begin-script') or (@class = 'mid-script')) ]] +]" > + <xsl:copy> + <xsl:apply-templates select="@*" /> + <xsl:apply-templates select=" + ancestor::*[ preceding-sibling::* [ + ((@class = 'begin-script') or + (@class = 'mid-script')) ]][1] + / preceding-sibling::* [ + ((@class = 'begin-script') or + (@class = 'mid-script')) ][1] + " mode="script-copy" /> + </xsl:copy> +</xsl:template> +<xsl:template match="*|@*|text()|comment()" + mode="script-copy" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> +</xsl:template> +<xsl:template match="span[ + (@class = 'begin-script') or + (@class = 'mid-script') ]" mode="script-copy" > + <xsl:apply-templates select="*|text()|comment()" /> +</xsl:template> + +<xsl:template match="span[ + ((@class = 'begin-script') or (@class = 'mid-script')) + and + following-sibling::* + / following-sibling::span[ @class = 'end-script' ] + and + following-sibling::*[1] + / descendant-or-self::*[ not(self::PROS) ][1] + / child::*[1][ + (@class = 'mrow-base') + and + (normalize-space(.)='') + ] +]" > +</xsl:template> + +<xsl:template match="span[ + (@class = 'begin-script') + and + following-sibling::* [1] / child::*[ + (position() = 1) + and + (@class = 'mrow-base') + and + ( normalize-space(.) = '' ) + ] +]" > +</xsl:template> + + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + + </set> + <xslt name="." xml="." xsl="display-math-2" /> + +</script> + + <script element="PARA" > + <set name="apostro" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="span[ + (@class = 'char-del') + and child::span [ @class = 'ch 2019' ] +]" > + <xsl:text>'</xsl:text> +</xsl:template> + + <xsl:template match="PROS[ parent::SENT[@class='ol-mark'] ]" > + <xsl:copy> + <xsl:apply-templates + select="*[not(@class='char-del')]|@*|text()|comment()" /> + </xsl:copy> +</xsl:template> + + <xsl:template match=" PARA[ normalize-space(.) = '' ] " > +</xsl:template> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + + </set> + <xslt name="." xml="." xsl="apostro" /> +</script> + + <script element="div::split-side" > + <set name="clean-split" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="*" mode="content" > + <xsl:choose> + <xsl:when test=" @class = 'char' " > + <xsl:if test="not( child::*[ + (@class = 'ch 2032') or (@class = 'ch 2033') + or (@class = 'ch 2034') + ] )"> + <xsl:text>x</xsl:text> + </xsl:if> + </xsl:when> + <xsl:when test=" not( + (@title = 'speech-extra') or (@class = 'accent-char') + ) " > + <xsl:apply-templates select="*|text()" mode="content" /> + </xsl:when> + </xsl:choose> +</xsl:template> + + <xsl:template match=" div[ @class='split-side' ] +" > + <xsl:variable name="content"> + <xsl:apply-templates select="*" mode="content" /> + </xsl:variable> + <xsl:if test=" + string-length( normalize-space( $content )) != 0 + " > + <xsl:copy> + <xsl:apply-templates select=" *|@*|text()|comment() " /> + </xsl:copy> + </xsl:if> +</xsl:template> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + + </set> + <xslt name="." xml="." xsl="clean-split" /> +</script> + + <script element="div::newtheorem" > + <set name="newtheorem" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match=" + div[ (@class='newtheorem') + and + descendant::*[ self::p ][1] + / descendant::*[ self::span ][1] + [ @class = 'theorem-head' ] + ] +" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + <div class="begin-end" title="speech-extra"> + <BREAK SIZE="small"/> + <xsl:value-of select=" + concat( ' end ', + substring-before(concat( + normalize-space( + string( + descendant::*[ self::p ][1] + / descendant::*[ self::span ][1] + [ @class = 'theorem-head' ] + ) ) + , ' ' +) +, ' ') + ) " /> + </div> + </xsl:copy> +</xsl:template> + + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + + </set> + <xslt name="." xml="." xsl="newtheorem" /> +</script> + + <script element="br" > + <set name="br" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="br" > + <xsl:copy> + <xsl:apply-templates select="@*" /> + </xsl:copy> + <BREAK SIZE="small"/> +</xsl:template> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + + </set> + <xslt name="." xml="." xsl="br" /> +</script> + + <script element="BREAK" > + <set name="BREAK" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="BREAK" > + <xsl:copy> + <xsl:apply-templates select="@*" /> + </xsl:copy> +</xsl:template> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + + </set> + <xslt name="." xml="." xsl="BREAK" /> +</script> + + </sax> +</xtpipes> + diff --git a/Master/texmf-dist/tex4ht/xttl/oo-math.4xt b/Master/texmf-dist/tex4ht/xttl/oo-math.4xt new file mode 100755 index 00000000000..18fcf35521e --- /dev/null +++ b/Master/texmf-dist/tex4ht/xttl/oo-math.4xt @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE xtpipes SYSTEM "xtpipes.dtd" > +<xtpipes preamble="yes" signature="oo-math.4xt (2006-12-04-16:41)"> + <sax content-handler="xtpipes.lib.ScriptsManager,OomFilter" + lexical-handler="xtpipes.lib.ScriptsManagerLH" > + <script element="math:mtable" > + <dom name="." xml="." method="mtable" class="OoUtilities" /> +<set name="rmXmlDecl" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:math="http://www.w3.org/1998/Math/MathML" + xmlns:xlink="http://www.w3.org/1999/xlink" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + +</set> +<xslt name="." xml="." xsl="rmXmlDecl" /> + + + </script> + <script element="math:math" > + <set name="math:mo" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:math="http://www.w3.org/1998/Math/MathML" + xmlns:xlink="http://www.w3.org/1999/xlink" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match=" math:mo[ + (preceding-sibling::math:mn or preceding-sibling::math:mi) + and not(following-sibling::*) +]" > + <math:mtext> + <xsl:apply-templates select="*|@*|text()" /> + </math:mtext> +</xsl:template> +<xsl:template match=" math:mo[ + not(preceding-sibling::* or following-sibling::*) +]" > + <math:mtext> + <xsl:apply-templates select="*|@*|text()" /> + </math:mtext> +</xsl:template> +<xsl:template match=" math:mo[ + (.='{') or (.='}') +]" > + <math:mtext> + <xsl:apply-templates select="*|@*|text()" /> + </math:mtext> +</xsl:template> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + +</set> +<xslt name="." xml="." xsl="math:mo" /> + + + </script> + </sax> +</xtpipes> + diff --git a/Master/texmf-dist/tex4ht/xttl/oo-text.4xt b/Master/texmf-dist/tex4ht/xttl/oo-text.4xt new file mode 100755 index 00000000000..70e4cde93af --- /dev/null +++ b/Master/texmf-dist/tex4ht/xttl/oo-text.4xt @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE xtpipes SYSTEM "xtpipes.dtd" > +<xtpipes preamble="yes" signature="oo-text.4xt (2006-12-04-16:41)"> + <sax content-handler="xtpipes.lib.ScriptsManager,OoFilter" + lexical-handler="xtpipes.lib.ScriptsManagerLH" > + + <script element="table:table" > + <dom name="." xml="." method="table" class="OoUtilities" /> +<set name="rmXmlDecl" > + <![CDATA[ + <xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:math="http://www.w3.org/1998/Math/MathML" + xmlns:xlink="http://www.w3.org/1999/xlink" + > + <xsl:output omit-xml-declaration = "yes" /> + + <xsl:template match="*|@*|text()|comment()" > + <xsl:copy> + <xsl:apply-templates select="*|@*|text()|comment()" /> + </xsl:copy> + </xsl:template> + </xsl:stylesheet> +]]> + +</set> +<xslt name="." xml="." xsl="rmXmlDecl" /> + + + </script> + </sax> +</xtpipes> + |