6.3 Clean Script Marks

<..clean begin and mid script marks..>
 <xsl:template match="span[
    (@class = ’begin-script’)
    or (@class = ’mid-script’)
 ]" >
   <xsl:copy>
      <xsl:apply-templates select="@*" />
      <xsl:apply-templates select="*|text()|comment()"
                           mode="clean-script" />
   </xsl:copy>
 </xsl:template>
 <xsl:template match="*"  mode="clean-script" >
   <xsl:copy>
      <xsl:apply-templates select="@*" />
      <xsl:apply-templates select="*|text()|comment()"
                           mode="clean-script" />
   </xsl:copy>
 </xsl:template>
 <xsl:template match="text()"  mode="clean-script" >
 </xsl:template>
 <xsl:template match="span[@class = ’scripts-extra’]"
                mode="clean-script" >
   <xsl:copy>
      <xsl:apply-templates select="@*" />
      <xsl:value-of select="
         ancestor::span[
           (@class = ’begin-script’)
            or (@class = ’mid-script’) ] [1]
       " />
   </xsl:copy>
 </xsl:template>
-_-_-

The following is for script annotation on empty msu::base.

<..remove marks on empty scripts..>
 <xsl:template match="span[
      ((@class = ’begin-script’) or (@class = ’mid-script’))
    and
      following-sibling::*
      / following-sibling::span[ @class = ’end-script’ ]
    and
      following-sibling::*[1]
      / descendant-or-self::*[ not(self::PROS) ][1]
      / child::*[1][
            (@class = ’mrow-base’)
          and
            (normalize-space(.)=’’)
        ]
 ]" >
 </xsl:template>
-_-_-
<span class="begin-script" title="speech-extra">  
  ...  
</span>  
<PROS PITCH="+10">  
  <msub>  
    <mrow class="mrow-base"/>  
    <mrow class="mrow-sub">  
      ...  
    </mrow>  
  </msub>  
  <mi>n</mi>  
</PROS>  
<span class="end-script" title="speech-extra">  
  ...