8.2 Unary Op on Core Content of Length One
The ‘mo-unary’ is established in the first pass over inline-math, so we need to wait
for the second pass with the following.
<xsl:template match="span[
(@class = ’inline-math’)
and
(count( <.math content element.> ) = 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="<.math content element.>" />
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="*|@*|comment()|text()" />
</xsl:otherwise>
</xsl:choose>
</xsl:copy>
</xsl:template> -_-_-
<span class="inline-math">
<span class="begin-math" title="speech-extra"> begin math </span>
<span name="mo-unary">
<span class="char" title="ch-verbose">
<span class="ch 2212" title="ch-verbose">negative</span>
</span>
</span>
<span class="mathvariant-bold">
<span title="speech-extra" class="begin-end"> bold </span>
<span title="speech-extra" class="space"><!----> </span>
<span class="mi">
<span title="speech-extra" class="capital-description">
capital
</span>
A
</span>
</span>
<span class="end-math" title="speech-extra">end math</span>
</span>