| <?xml version="1.0" encoding="UTF-8"?> | |
| <!-- | |
| Copyright (c) 2022. American Printing House for the Blind, 1839 Frankfort Avenue, Louisville, KY 40206, www.aph.org | |
| This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. | |
| This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. | |
| You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. | |
| --> | |
| <xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
| <xsl:output method="text"/> | |
| <xsl:variable name="math-begin"></xsl:variable> | |
| <xsl:variable name="math-end"></xsl:variable> | |
| <xsl:variable name="expression-begin"></xsl:variable> | |
| <xsl:variable name="expression-separator"></xsl:variable> | |
| <xsl:variable name="expression-end"></xsl:variable> | |
| <xsl:variable name="minus-sign">−</xsl:variable> | |
| <xsl:variable name="fraction-begin"></xsl:variable> | |
| <xsl:variable name="fraction-separator"></xsl:variable> | |
| <xsl:variable name="fraction-separator-bevelled"></xsl:variable> | |
| <xsl:variable name="fraction-end"></xsl:variable> | |
| <xsl:variable name="fraction-mixed-begin"></xsl:variable> | |
| <xsl:variable name="fraction-mixed-separator"></xsl:variable> | |
| <xsl:variable name="fraction-mixed-separator-bevelled"></xsl:variable> | |
| <xsl:variable name="fraction-mixed-end"></xsl:variable> | |
| <xsl:variable name="fraction-complex-begin"></xsl:variable> | |
| <xsl:variable name="fraction-complex-separator"></xsl:variable> | |
| <xsl:variable name="fraction-complex-separator-bevelled"></xsl:variable> | |
| <xsl:variable name="fraction-complex-end"></xsl:variable> | |
| <xsl:variable name="fraction-simple-begin"></xsl:variable> | |
| <xsl:variable name="fraction-simple-separator"></xsl:variable> | |
| <xsl:variable name="fraction-simple-separator-bevelled"></xsl:variable> | |
| <xsl:variable name="fraction-simple-end"></xsl:variable> | |
| <xsl:variable name="subscript-begin"></xsl:variable> | |
| <xsl:variable name="subscript-separator"></xsl:variable> | |
| <xsl:variable name="subscript-end"></xsl:variable> | |
| <xsl:variable name="superscript-begin"></xsl:variable> | |
| <xsl:variable name="superscript-separator"></xsl:variable> | |
| <xsl:variable name="superscript-end"></xsl:variable> | |
| <xsl:variable name="subsuperscript-begin"></xsl:variable> | |
| <xsl:variable name="subsuperscript-separator"></xsl:variable> | |
| <xsl:variable name="subsuperscript-end"></xsl:variable> | |
| <xsl:variable name="subsuper-comma"></xsl:variable> | |
| <xsl:variable name="underscript-begin"></xsl:variable> | |
| <xsl:variable name="underscript-separator"></xsl:variable> | |
| <xsl:variable name="underscript-end"></xsl:variable> | |
| <xsl:variable name="overscript-begin"></xsl:variable> | |
| <xsl:variable name="overscript-separator"></xsl:variable> | |
| <xsl:variable name="overscript-end"></xsl:variable> | |
| <xsl:variable name="underoverscript-begin"></xsl:variable> | |
| <xsl:variable name="underoverscript-separator"></xsl:variable> | |
| <xsl:variable name="underoverscript-end"></xsl:variable> | |
| <xsl:variable name="root-begin"></xsl:variable> | |
| <xsl:variable name="root-separator"></xsl:variable> | |
| <xsl:variable name="root-end"></xsl:variable> | |
| <xsl:variable name="sqrt-begin"></xsl:variable> | |
| <xsl:variable name="sqrt-end"></xsl:variable> | |
| <xsl:variable name="table-begin"></xsl:variable> | |
| <xsl:variable name="table-end"></xsl:variable> | |
| <xsl:variable name="table-row-begin"></xsl:variable> | |
| <xsl:variable name="table-row-end"></xsl:variable> | |
| <xsl:variable name="table-cell-begin"></xsl:variable> | |
| <xsl:variable name="table-cell-end"></xsl:variable> | |
| <xsl:variable name="table-nemeth-round-open"></xsl:variable> | |
| <xsl:variable name="table-nemeth-round-close"></xsl:variable> | |
| <xsl:variable name="table-nemeth-square-open"></xsl:variable> | |
| <xsl:variable name="table-nemeth-square-close"></xsl:variable> | |
| <xsl:variable name="table-nemeth-curly-open"></xsl:variable> | |
| <xsl:variable name="table-nemeth-curly-close"></xsl:variable> | |
| <xsl:variable name="table-nemeth-angled-open"></xsl:variable> | |
| <xsl:variable name="table-nemeth-angled-close"></xsl:variable> | |
| <xsl:variable name="table-nemeth-bar"></xsl:variable> | |
| <xsl:template match="node()|@*"> | |
| <xsl:copy> | |
| <xsl:apply-templates select="node()|@*"/> | |
| </xsl:copy> | |
| </xsl:template> | |
| <xsl:template match="math"> | |
| <xsl:value-of select="$math-begin"/> | |
| <xsl:apply-templates select="*"> | |
| <xsl:with-param name="insubsup" select="0"/> | |
| </xsl:apply-templates> | |
| <xsl:value-of select="$math-end"/> | |
| </xsl:template> | |
| <xsl:template match="mn|mi"> | |
| <xsl:value-of select="."/> | |
| </xsl:template> | |
| <xsl:template match="mo"> | |
| <!--<xsl:value-of select="."/>--> | |
| <xsl:choose> | |
| <!--<xsl:when test=". = '-'">--> | |
| <xsl:when test="contains(., '-')"> | |
| <xsl:text>−</xsl:text> | |
| </xsl:when> | |
| <xsl:otherwise> | |
| <xsl:value-of select="."/> | |
| </xsl:otherwise> | |
| </xsl:choose> | |
| <!--<xsl:param name="insubsup" /> | |
| <xsl:if test="not(preceding-sibling::mtable or following-sibling::mtable)"> | |
| <xsl:choose> | |
| <xsl:when test=". = ',' and $insubsup > 0"> | |
| <xsl:value-of select="$subsuper-comma"/> | |
| </xsl:when> | |
| <xsl:when test=". = '-'"> | |
| <xsl:value-of select="$minus-sign"/> | |
| </xsl:when> | |
| <xsl:otherwise> | |
| <xsl:value-of select="."/> | |
| </xsl:otherwise> | |
| </xsl:choose> | |
| </xsl:if>--> | |
| </xsl:template> | |
| <xsl:template match="mrow"> | |
| <xsl:param name="insubsup"/> | |
| <xsl:param name="operator-begin"/> | |
| <xsl:param name="operator-end"/> | |
| <xsl:value-of select="$expression-begin"/> | |
| <xsl:apply-templates select="*"> | |
| <xsl:with-param name="insubsup" select="$insubsup"/> | |
| <xsl:with-param name="operator-begin" select="$operator-begin"/> | |
| <xsl:with-param name="operator-end" select="$operator-end"/> | |
| </xsl:apply-templates> | |
| <xsl:value-of select="$expression-end"/> | |
| </xsl:template> | |
| <xsl:template match="mfrac"> | |
| <xsl:param name="insubsup"/> | |
| <xsl:param name="operator-begin"/> | |
| <xsl:param name="operator-end"/> | |
| <xsl:choose> | |
| <xsl:when test="local-name(*[1]) = 'mfrac' or local-name(*[2]) = 'mfrac'"> | |
| <xsl:value-of select="$fraction-complex-begin"/> | |
| <xsl:apply-templates select="*[1]"> | |
| <xsl:with-param name="insubsup" select="$insubsup"/> | |
| <xsl:with-param name="operator-begin" select="$operator-begin"/> | |
| <xsl:with-param name="operator-end" select="$operator-end"/> | |
| </xsl:apply-templates> | |
| <xsl:value-of select="$fraction-complex-separator"/> | |
| <xsl:apply-templates select="*[2]"> | |
| <xsl:with-param name="insubsup" select="$insubsup"/> | |
| <xsl:with-param name="operator-begin" select="$operator-begin"/> | |
| <xsl:with-param name="operator-end" select="$operator-end"/> | |
| </xsl:apply-templates> | |
| <xsl:value-of select="$fraction-complex-end"/> | |
| </xsl:when> | |
| <xsl:when | |
| test="(local-name(preceding-sibling::*[1]) = 'mn' or preceding-sibling::*[1] = '⁤') and local-name(*[1]) = 'mn' and local-name(*[2]) = 'mn' and not(local-name(..) = 'mfrac')"> | |
| <xsl:value-of select="$fraction-mixed-begin"/> | |
| <xsl:apply-templates select="*[1]"> | |
| <xsl:with-param name="insubsup" select="$insubsup"/> | |
| <xsl:with-param name="operator-begin" select="$operator-begin"/> | |
| <xsl:with-param name="operator-end" select="$operator-end"/> | |
| </xsl:apply-templates> | |
| <xsl:value-of select="$fraction-mixed-separator"/> | |
| <xsl:apply-templates select="*[2]"> | |
| <xsl:with-param name="insubsup" select="$insubsup"/> | |
| <xsl:with-param name="operator-begin" select="$operator-begin"/> | |
| <xsl:with-param name="operator-end" select="$operator-end"/> | |
| </xsl:apply-templates> | |
| <xsl:value-of select="$fraction-mixed-end"/> | |
| </xsl:when> | |
| <xsl:when test="local-name(*[1]) = 'mn' and local-name(*[2]) = 'mn'"> | |
| <xsl:value-of select="$fraction-simple-begin"/> | |
| <xsl:apply-templates select="*[1]"> | |
| <xsl:with-param name="insubsup" select="$insubsup"/> | |
| <xsl:with-param name="operator-begin" select="$operator-begin"/> | |
| <xsl:with-param name="operator-end" select="$operator-end"/> | |
| </xsl:apply-templates> | |
| <xsl:value-of select="$fraction-simple-separator"/> | |
| <xsl:apply-templates select="*[2]"> | |
| <xsl:with-param name="insubsup" select="$insubsup"/> | |
| <xsl:with-param name="operator-begin" select="$operator-begin"/> | |
| <xsl:with-param name="operator-end" select="$operator-end"/> | |
| </xsl:apply-templates> | |
| <xsl:value-of select="$fraction-simple-end"/> | |
| </xsl:when> | |
| <xsl:otherwise> | |
| <xsl:value-of select="$fraction-begin"/> | |
| <xsl:apply-templates select="*[1]"> | |
| <xsl:with-param name="insubsup" select="$insubsup"/> | |
| <xsl:with-param name="operator-begin" select="$operator-begin"/> | |
| <xsl:with-param name="operator-end" select="$operator-end"/> | |
| </xsl:apply-templates> | |
| <xsl:value-of select="$fraction-separator"/> | |
| <xsl:apply-templates select="*[2]"> | |
| <xsl:with-param name="insubsup" select="$insubsup"/> | |
| <xsl:with-param name="operator-begin" select="$operator-begin"/> | |
| <xsl:with-param name="operator-end" select="$operator-end"/> | |
| </xsl:apply-templates> | |
| <xsl:value-of select="$fraction-end"/> | |
| </xsl:otherwise> | |
| </xsl:choose> | |
| </xsl:template> | |
| <xsl:template match="mfrac[@bevelled='true']"> | |
| <xsl:param name="insubsup"/> | |
| <xsl:param name="operator-begin"/> | |
| <xsl:param name="operator-end"/> | |
| <xsl:choose> | |
| <xsl:when test="local-name(*[1]) = 'mfrac' or local-name(*[2]) = 'mfrac'"> | |
| <xsl:value-of select="$fraction-complex-begin"/> | |
| <xsl:apply-templates select="*[1]"> | |
| <xsl:with-param name="insubsup" select="$insubsup"/> | |
| <xsl:with-param name="operator-begin" select="$operator-begin"/> | |
| <xsl:with-param name="operator-end" select="$operator-end"/> | |
| </xsl:apply-templates> | |
| <xsl:value-of select="$fraction-complex-separator-bevelled"/> | |
| <xsl:apply-templates select="*[2]"> | |
| <xsl:with-param name="insubsup" select="$insubsup"/> | |
| <xsl:with-param name="operator-begin" select="$operator-begin"/> | |
| <xsl:with-param name="operator-end" select="$operator-end"/> | |
| </xsl:apply-templates> | |
| <xsl:value-of select="$fraction-complex-end"/> | |
| </xsl:when> | |
| <xsl:when | |
| test="(local-name(preceding-sibling::*[1]) or preceding-sibling::*[1] = '⁤') and local-name(*[1]) = 'mn' and local-name(*[2]) = 'mn' and not(local-name(..) = 'mfrac')"> | |
| <xsl:value-of select="$fraction-mixed-begin"/> | |
| <xsl:apply-templates select="*[1]"> | |
| <xsl:with-param name="insubsup" select="$insubsup"/> | |
| <xsl:with-param name="operator-begin" select="$operator-begin"/> | |
| <xsl:with-param name="operator-end" select="$operator-end"/> | |
| </xsl:apply-templates> | |
| <xsl:value-of select="$fraction-mixed-separator-bevelled"/> | |
| <xsl:apply-templates select="*[2]"> | |
| <xsl:with-param name="insubsup" select="$insubsup"/> | |
| <xsl:with-param name="operator-begin" select="$operator-begin"/> | |
| <xsl:with-param name="operator-end" select="$operator-end"/> | |
| </xsl:apply-templates> | |
| <xsl:value-of select="$fraction-mixed-end"/> | |
| </xsl:when> | |
| <xsl:when test="local-name(*[1]) = 'mn' and local-name(*[2]) = 'mn'"> | |
| <xsl:value-of select="$fraction-simple-begin"/> | |
| <xsl:apply-templates select="*[1]"> | |
| <xsl:with-param name="insubsup" select="$insubsup"/> | |
| <xsl:with-param name="operator-begin" select="$operator-begin"/> | |
| <xsl:with-param name="operator-end" select="$operator-end"/> | |
| </xsl:apply-templates> | |
| <xsl:value-of select="$fraction-simple-separator-bevelled"/> | |
| <xsl:apply-templates select="*[2]"> | |
| <xsl:with-param name="insubsup" select="$insubsup"/> | |
| <xsl:with-param name="operator-begin" select="$operator-begin"/> | |
| <xsl:with-param name="operator-end" select="$operator-end"/> | |
| </xsl:apply-templates> | |
| <xsl:value-of select="$fraction-simple-end"/> | |
| </xsl:when> | |
| <xsl:otherwise> | |
| <xsl:value-of select="$fraction-begin"/> | |
| <xsl:apply-templates select="*[1]"> | |
| <xsl:with-param name="insubsup" select="$insubsup"/> | |
| <xsl:with-param name="operator-begin" select="$operator-begin"/> | |
| <xsl:with-param name="operator-end" select="$operator-end"/> | |
| </xsl:apply-templates> | |
| <xsl:value-of select="$fraction-separator-bevelled"/> | |
| <xsl:apply-templates select="*[2]"> | |
| <xsl:with-param name="insubsup" select="$insubsup"/> | |
| <xsl:with-param name="operator-begin" select="$operator-begin"/> | |
| <xsl:with-param name="operator-end" select="$operator-end"/> | |
| </xsl:apply-templates> | |
| <xsl:value-of select="$fraction-end"/> | |
| </xsl:otherwise> | |
| </xsl:choose> | |
| </xsl:template> | |
| <xsl:template match="msub"> | |
| <xsl:param name="insubsup"/> | |
| <xsl:param name="operator-begin"/> | |
| <xsl:param name="operator-end"/> | |
| <xsl:value-of select="$subscript-begin"/> | |
| <xsl:apply-templates select="node()[1]"> | |
| <xsl:with-param name="insubsup" select="$insubsup"/> | |
| <xsl:with-param name="operator-begin" select="$operator-begin"/> | |
| <xsl:with-param name="operator-end" select="$operator-end"/> | |
| </xsl:apply-templates> | |
| <xsl:call-template name="subsup_loop"> | |
| <xsl:with-param name="separator" select="$subscript-separator"/> | |
| <xsl:with-param name="count" select="$insubsup + 1"/> | |
| </xsl:call-template> | |
| <xsl:apply-templates select="node()[2]"> | |
| <xsl:with-param name="insubsup" select="$insubsup + 1"/> | |
| <xsl:with-param name="operator-begin" select="$operator-begin"/> | |
| <xsl:with-param name="operator-end" select="$operator-end"/> | |
| </xsl:apply-templates> | |
| <xsl:value-of select="$subscript-end"/> | |
| </xsl:template> | |
| <xsl:template match="msup"> | |
| <xsl:param name="insubsup"/> | |
| <xsl:param name="operator-begin"/> | |
| <xsl:param name="operator-end"/> | |
| <xsl:value-of select="$superscript-begin"/> | |
| <xsl:apply-templates select="node()[1]"> | |
| <xsl:with-param name="insubsup" select="$insubsup + 1"/> | |
| <xsl:with-param name="operator-begin" select="$operator-begin"/> | |
| <xsl:with-param name="operator-end" select="$operator-end"/> | |
| </xsl:apply-templates> | |
| <xsl:call-template name="subsup_loop"> | |
| <xsl:with-param name="separator" select="$superscript-separator"/> | |
| <xsl:with-param name="count" select="$insubsup + 1"/> | |
| </xsl:call-template> | |
| <xsl:apply-templates select="node()[2]"> | |
| <xsl:with-param name="insubsup" select="$insubsup + 1"/> | |
| <xsl:with-param name="operator-begin" select="$operator-begin"/> | |
| <xsl:with-param name="operator-end" select="$operator-end"/> | |
| </xsl:apply-templates> | |
| <xsl:value-of select="$superscript-end"/> | |
| </xsl:template> | |
| <xsl:template match="msubsup"> | |
| <xsl:param name="insubsup"/> | |
| <xsl:param name="operator-begin"/> | |
| <xsl:param name="operator-end"/> | |
| <xsl:value-of select="$subsuperscript-begin"/> | |
| <xsl:apply-templates select="node()[1]"> | |
| <xsl:with-param name="insubsup" select="$insubsup"/> | |
| <xsl:with-param name="operator-begin" select="$operator-begin"/> | |
| <xsl:with-param name="operator-end" select="$operator-end"/> | |
| </xsl:apply-templates> | |
| <xsl:value-of select="$subsuperscript-separator"/> | |
| <xsl:apply-templates select="node()[2]"> | |
| <xsl:with-param name="insubsup" select="$insubsup + 1"/> | |
| <xsl:with-param name="operator-begin" select="$operator-begin"/> | |
| <xsl:with-param name="operator-end" select="$operator-end"/> | |
| </xsl:apply-templates> | |
| <xsl:value-of select="$subsuperscript-separator"/> | |
| <xsl:apply-templates select="node()[3]"> | |
| <xsl:with-param name="insubsup" select="$insubsup + 1"/> | |
| <xsl:with-param name="operator-begin" select="$operator-begin"/> | |
| <xsl:with-param name="operator-end" select="$operator-end"/> | |
| </xsl:apply-templates> | |
| <xsl:value-of select="$subsuperscript-end"/> | |
| </xsl:template> | |
| <xsl:template name="subsup_loop"> | |
| <xsl:param name="separator"/> | |
| <xsl:param name="count"/> | |
| <xsl:if test="$count > 0"> | |
| <xsl:value-of select="$separator"/> | |
| <xsl:call-template name="subsup_loop"> | |
| <xsl:with-param name="separator" select="$separator"/> | |
| <xsl:with-param name="count" select="$count - 1"/> | |
| </xsl:call-template> | |
| </xsl:if> | |
| </xsl:template> | |
| <xsl:template match="munder"> | |
| <xsl:param name="insubsup"/> | |
| <xsl:param name="operator-begin"/> | |
| <xsl:param name="operator-end"/> | |
| <xsl:value-of select="$underscript-begin"/> | |
| <xsl:apply-templates select="*[1]"> | |
| <xsl:with-param name="insubsup" select="$insubsup"/> | |
| <xsl:with-param name="operator-begin" select="$operator-begin"/> | |
| <xsl:with-param name="operator-end" select="$operator-end"/> | |
| </xsl:apply-templates> | |
| <xsl:value-of select="$underscript-separator"/> | |
| <xsl:apply-templates select="*[2]"> | |
| <xsl:with-param name="insubsup" select="$insubsup"/> | |
| <xsl:with-param name="operator-begin" select="$operator-begin"/> | |
| <xsl:with-param name="operator-end" select="$operator-end"/> | |
| </xsl:apply-templates> | |
| <xsl:value-of select="$underscript-end"/> | |
| </xsl:template> | |
| <xsl:template match="mover"> | |
| <xsl:param name="insubsup"/> | |
| <xsl:param name="operator-begin"/> | |
| <xsl:param name="operator-end"/> | |
| <xsl:value-of select="$overscript-begin"/> | |
| <xsl:apply-templates select="*[1]"> | |
| <xsl:with-param name="insubsup" select="$insubsup"/> | |
| <xsl:with-param name="operator-begin" select="$operator-begin"/> | |
| <xsl:with-param name="operator-end" select="$operator-end"/> | |
| </xsl:apply-templates> | |
| <xsl:value-of select="$overscript-separator"/> | |
| <xsl:apply-templates select="*[2]"> | |
| <xsl:with-param name="insubsup" select="$insubsup"/> | |
| <xsl:with-param name="operator-begin" select="$operator-begin"/> | |
| <xsl:with-param name="operator-end" select="$operator-end"/> | |
| </xsl:apply-templates> | |
| <xsl:value-of select="$overscript-end"/> | |
| </xsl:template> | |
| <xsl:template match="munderover"> | |
| <xsl:param name="insubsup"/> | |
| <xsl:param name="operator-begin"/> | |
| <xsl:param name="operator-end"/> | |
| <xsl:value-of select="$underoverscript-begin"/> | |
| <xsl:apply-templates select="*[1]"> | |
| <xsl:with-param name="insubsup" select="$insubsup"/> | |
| <xsl:with-param name="operator-begin" select="$operator-begin"/> | |
| <xsl:with-param name="operator-end" select="$operator-end"/> | |
| </xsl:apply-templates> | |
| <xsl:value-of select="$underscript-separator"/> | |
| <xsl:apply-templates select="*[2]"> | |
| <xsl:with-param name="insubsup" select="$insubsup"/> | |
| <xsl:with-param name="operator-begin" select="$operator-begin"/> | |
| <xsl:with-param name="operator-end" select="$operator-end"/> | |
| </xsl:apply-templates> | |
| <xsl:value-of select="$overscript-separator"/> | |
| <xsl:apply-templates select="*[3]"> | |
| <xsl:with-param name="insubsup" select="$insubsup"/> | |
| <xsl:with-param name="operator-begin" select="$operator-begin"/> | |
| <xsl:with-param name="operator-end" select="$operator-end"/> | |
| </xsl:apply-templates> | |
| <xsl:value-of select="$underoverscript-end"/> | |
| </xsl:template> | |
| <xsl:template match="msqrt"> | |
| <xsl:param name="insubsup"/> | |
| <xsl:param name="operator-begin"/> | |
| <xsl:param name="operator-end"/> | |
| <xsl:value-of select="$sqrt-begin"/> | |
| <xsl:apply-templates select="*"> | |
| <xsl:with-param name="insubsup" select="$insubsup"/> | |
| <xsl:with-param name="operator-begin" select="$operator-begin"/> | |
| <xsl:with-param name="operator-end" select="$operator-end"/> | |
| </xsl:apply-templates> | |
| <xsl:value-of select="$sqrt-end"/> | |
| </xsl:template> | |
| <xsl:template match="mroot"> | |
| <xsl:param name="insubsup"/> | |
| <xsl:param name="operator-begin"/> | |
| <xsl:param name="operator-end"/> | |
| <xsl:value-of select="$root-begin"/> | |
| <xsl:apply-templates select="*[2]"> | |
| <xsl:with-param name="insubsup" select="$insubsup"/> | |
| <xsl:with-param name="operator-begin" select="$operator-begin"/> | |
| <xsl:with-param name="operator-end" select="$operator-end"/> | |
| </xsl:apply-templates> | |
| <xsl:value-of select="$root-separator"/> | |
| <xsl:apply-templates select="*[1]"> | |
| <xsl:with-param name="insubsup" select="$insubsup"/> | |
| <xsl:with-param name="operator-begin" select="$operator-begin"/> | |
| <xsl:with-param name="operator-end" select="$operator-end"/> | |
| </xsl:apply-templates> | |
| <xsl:value-of select="$root-end"/> | |
| </xsl:template> | |
| <xsl:template match="mtable"> | |
| <xsl:param name="insubsup"/> | |
| <xsl:value-of select="$table-begin"/> | |
| <xsl:apply-templates select="*"> | |
| <xsl:with-param name="insubsup" select="$insubsup"/> | |
| <xsl:with-param name="operator-begin" select="preceding-sibling::*[1]"/> | |
| <xsl:with-param name="operator-end" select="following-sibling::*[1]"/> | |
| </xsl:apply-templates> | |
| <xsl:value-of select="$table-end"/> | |
| </xsl:template> | |
| <xsl:template match="mtr"> | |
| <xsl:param name="insubsup"/> | |
| <xsl:param name="operator-begin"/> | |
| <xsl:param name="operator-end"/> | |
| <xsl:value-of select="$table-row-begin"/> | |
| <!--<xsl:value-of select="$operator-begin"/>--> | |
| <xsl:choose> | |
| <xsl:when test="$operator-begin = '('"> | |
| <xsl:value-of select="$table-nemeth-round-open"/> | |
| </xsl:when> | |
| <xsl:when test="$operator-begin = '['"> | |
| <xsl:value-of select="$table-nemeth-square-open"/> | |
| </xsl:when> | |
| <xsl:when test="$operator-begin = '{'"> | |
| <xsl:value-of select="$table-nemeth-curly-open"/> | |
| </xsl:when> | |
| <xsl:when test="$operator-begin = '<'"> | |
| <xsl:value-of select="$table-nemeth-angled-open"/> | |
| </xsl:when> | |
| <xsl:when test="$operator-begin = '|'"> | |
| <xsl:value-of select="$table-nemeth-bar"/> | |
| </xsl:when> | |
| <xsl:otherwise> | |
| <xsl:value-of select="$operator-begin"/> | |
| </xsl:otherwise> | |
| </xsl:choose> | |
| <xsl:apply-templates select="*"> | |
| <xsl:with-param name="insubsup" select="$insubsup"/> | |
| <xsl:with-param name="operator-begin" select="$operator-begin"/> | |
| <xsl:with-param name="operator-end" select="$operator-end"/> | |
| </xsl:apply-templates> | |
| <!--<xsl:value-of select="$operator-end"/>--> | |
| <xsl:choose> | |
| <xsl:when test="$operator-end = ')'"> | |
| <xsl:value-of select="$table-nemeth-round-close"/> | |
| </xsl:when> | |
| <xsl:when test="$operator-end = ']'"> | |
| <xsl:value-of select="$table-nemeth-square-close"/> | |
| </xsl:when> | |
| <xsl:when test="$operator-end = '}'"> | |
| <xsl:value-of select="$table-nemeth-curly-close"/> | |
| </xsl:when> | |
| <xsl:when test="$operator-end = '>'"> | |
| <xsl:value-of select="$table-nemeth-angled-close"/> | |
| </xsl:when> | |
| <xsl:when test="$operator-end = '|'"> | |
| <xsl:value-of select="$table-nemeth-bar"/> | |
| </xsl:when> | |
| <xsl:otherwise> | |
| <xsl:value-of select="$operator-end"/> | |
| </xsl:otherwise> | |
| </xsl:choose> | |
| <xsl:value-of select="$table-row-end"/> | |
| </xsl:template> | |
| <xsl:template match="mtd"> | |
| <xsl:param name="insubsup"/> | |
| <xsl:param name="operator-begin"/> | |
| <xsl:param name="operator-end"/> | |
| <xsl:value-of select="$table-cell-begin"/> | |
| <xsl:apply-templates select="*"> | |
| <xsl:with-param name="insubsup" select="$insubsup"/> | |
| <xsl:with-param name="operator-begin" select="$operator-begin"/> | |
| <xsl:with-param name="operator-end" select="$operator-end"/> | |
| </xsl:apply-templates> | |
| <xsl:value-of select="$table-cell-end"/> | |
| </xsl:template> | |
| <xsl:template match="mfenced"> | |
| <xsl:param name="insubsup"/> | |
| <xsl:param name="operator-begin"/> | |
| <xsl:param name="operator-end"/> | |
| <xsl:value-of select="$expression-begin"/> | |
| <xsl:choose> | |
| <xsl:when test="@open"> | |
| <xsl:value-of select="@open"/> | |
| </xsl:when> | |
| <xsl:otherwise> | |
| <xsl:text>(</xsl:text> | |
| </xsl:otherwise> | |
| </xsl:choose> | |
| <xsl:for-each select="*"> | |
| <xsl:apply-templates select="."> | |
| <xsl:with-param name="insubsup" select="$insubsup"/> | |
| <xsl:with-param name="operator-begin" select="$operator-begin"/> | |
| <xsl:with-param name="operator-end" select="$operator-end"/> | |
| </xsl:apply-templates> | |
| <xsl:if test="position() < last()"> | |
| <xsl:value-of select="$expression-separator"/> | |
| <xsl:choose> | |
| <xsl:when test="../@separators"> | |
| <xsl:choose> | |
| <xsl:when test="string-length(../@separators) > position()"> | |
| <xsl:value-of select="substring(../@separators, position(), 1)"/> | |
| </xsl:when> | |
| <xsl:otherwise> | |
| <xsl:value-of select="substring(../@separators, string-length(../@separators), 1)"/> | |
| </xsl:otherwise> | |
| </xsl:choose> | |
| </xsl:when> | |
| <xsl:otherwise> | |
| <xsl:text>,</xsl:text> | |
| </xsl:otherwise> | |
| </xsl:choose> | |
| </xsl:if> | |
| </xsl:for-each> | |
| <xsl:choose> | |
| <xsl:when test="@close"> | |
| <xsl:value-of select="@close"/> | |
| </xsl:when> | |
| <xsl:otherwise> | |
| <xsl:text>)</xsl:text> | |
| </xsl:otherwise> | |
| </xsl:choose> | |
| <xsl:value-of select="$expression-end"/> | |
| </xsl:template> | |
| <xsl:template match="menclose"> | |
| <xsl:param name="insubsup"/> | |
| <xsl:param name="operator-begin"/> | |
| <xsl:param name="operator-end"/> | |
| <xsl:if test="contains(@notation, 'radical')"> | |
| <xsl:value-of select="$expression-begin"/> | |
| </xsl:if> | |
| <xsl:apply-templates select="*"> | |
| <xsl:with-param name="insubsup" select="$insubsup"/> | |
| <xsl:with-param name="operator-begin" select="$operator-begin"/> | |
| <xsl:with-param name="operator-end" select="$operator-end"/> | |
| </xsl:apply-templates> | |
| <xsl:if test="contains(@notation, 'radical')"> | |
| <xsl:value-of select="$expression-end"/> | |
| </xsl:if> | |
| </xsl:template> | |
| <xsl:template match="merror|mphantum|annotation"/> | |
| </xsl:transform> |