5.1 Core Content of One Element

<..eliminate inline math narrative NO..>
 <xsl:template match="span[
     (@class = ’inline-math’)
   and
     (count( <.math content element.> ) = 1)
 ]" >
   <xsl:copy>
     <xsl:choose>
        <xsl:when test="child::mfrac or child::msqrt
                     or child::mover or child::munder
        ">
           <xsl:attribute name="class">
              <xsl:text>semi-math</xsl:text>
           </xsl:attribute>
           <BREAK SIZE="small"/>
           <xsl:apply-templates
               select="<.math content element.>" />
        </xsl:when>
        <xsl:otherwise>
           <.non-adjacent narrative.>
        </xsl:otherwise>
     </xsl:choose>
   </xsl:copy>
 </xsl:template>
-_-_-

<..non-adjacent narrative..>
 <xsl:variable name="content">
    <xsl:apply-templates
        select="<.math content element.>"
          mode="content" />
 </xsl:variable>
 <xsl:choose>
    <.math narrative of length one.>
    <.math narrative of just one element.>
    <.simple sub or sup.>
    <xsl:otherwise>
       <xsl:apply-templates
                     select="*|@*|text()|comment()" />
    </xsl:otherwise>
 </xsl:choose>
-_-_-

<..math content element..>
 child::*[ not(@title = ’speech-extra’)
           and not( self::BREAK )
         ]
-_-_-

<..math narrative of length one..>
 <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>
-_-_-

<..math narrative of just one element..>
 <xsl:when test="
    not(<.math content element.>
         / descendant::* [
             count(child::*[
                 not(self::BREAK)
             ] ) &gt; 1
           ] )
 " >
    <xsl:attribute name="class">
       <xsl:text>semi-math</xsl:text>
    </xsl:attribute>
    <PROS PITCH="-5">
    <BREAK SIZE="small"/>
       <xsl:apply-templates
               select="<.math content element.>" />
    <BREAK SIZE="small"/>
    </PROS>
 </xsl:when>
-_-_-

<..simple sub or sup..>
 <xsl:when test="  child::*[
      (position() = 2)
    and
      (self::msub or self::msup or self::msubsup)
 ]" >
     <xsl:variable name="content">
        <xsl:apply-templates
            select="child::*[2] / child::*[
                    (@class = ’mrow-base’)
                 or (@class = ’limits-mrow-base’) ]"
              mode="content" />
     </xsl:variable>
     <xsl:choose>
        <xsl:when test="
           string-length( normalize-space( $content )) = 1
          or
           (translate($content,’0123456789 ’,’’) = ’’)
        " >
           <xsl:attribute name="class">
              <xsl:text>semi-math</xsl:text>
           </xsl:attribute>
           <PROS PITCH="-5">
           <BREAK SIZE="small"/>
              <xsl:apply-templates select="*[2]" />
           <BREAK SIZE="small"/>
           </PROS>
       </xsl:when>
        <xsl:otherwise>
           <xsl:apply-templates select="*|@*|text()" />
        </xsl:otherwise>
     </xsl:choose>
 </xsl:when>
-_-_-
<span class="inline-math">  
  <msub>  
    <mrow class="mrow-base">  
      <mi>C</mi>  
    </mrow>  
    <mrow class="mrow-sub">  
      <mi>i</mi>  
    </mrow>  
  </msub>  
</span>