11.2 Short Cuts for Math Underline
<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>
<.set munder.>
</xsl:otherwise>
</xsl:choose>
</xsl:template> -_-_-
The following code makes to push the munder’s under the mover’s.
<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: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="@*" />
<.cont under-mover.>
</xsl:copy>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="." />
</xsl:otherwise>
</xsl:choose>
</xsl:template> -_-_-
<xsl:choose>
<xsl:when test="child::mover">
<xsl:apply-templates select="*" mode="under-mover" />
</xsl:when>
<xsl:otherwise>
<munder class="munder-underline">
<.munder prefix.>
<mrow class="mo-0032">
<xsl:apply-templates select="*" />
</mrow>
<.munder postfix.>
</munder>
</xsl:otherwise>
</xsl:choose> -_-_-
<xsl:apply-templates select="
ancestor::munder[1] / child::*[following-sibling::mrow]
"/>
-_-_-
<xsl:apply-templates select="
ancestor::munder[1] / child::*[preceding-sibling::mrow]
"/>
-_-_-
<munder class="munder-underline">
<span class="begin-end" title="speech-extra" > modified under </span>
<mrow class="mo-0332">
<mi>x</mi>
</mrow>
<span class="begin-end" title="speech-extra" > with bar </span>
</munder>