7.3 Short-Cuts for Modifiers

<..short cut modifiers..>
 <script element="span::munder-underline" >
   <set name="munder" >
      <.open xslt script.>
      <.get content template.>
      <.under modifier templates.>
      <.close xslt script.>
   </set>
   <xslt name="." xml="." xsl="munder" />
 </script>
-_-_-

<..short cut modifiers..>+
 <script element="span::mover-overline" >
   <set name="mover" >
      <.open xslt script.>
      <.get content template.>
      <.over modifier templates.>
      <.close xslt script.>
   </set>
   <xslt name="." xml="." xsl="mover" />
 </script>
-_-_-

<..under modifier templates..>
 <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>
-_-_-

<..over modifier templates..>
 <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>
-_-_-
<span class="mover-overline">  
  <span class="begin-end" title="speech-extra"> modified above </span>  
  <span class="mo-00AF">  
    <span class="mathvariant-bold">  
      <span title="speech-extra" class="begin-end"> bold </span>  
      <span class="mi">  
          <span title="speech-extra"  
                class="capital-description"> capital </span>  
          Z  
      </span>  
    </span>  
  </span>  
  <span class="begin-end" title="speech-extra"> with bar </span>  
</span>

<span class="munder-underline">  
  <span class="begin-end" title="speech-extra" > modified under </span>  
  <span class="mo-0332">  
    <span class="mi">x</span>  
  </span>  
  <span class="begin-end" title="speech-extra" > with bar </span>  
</span>