4.2 Eliminate End Script Marks

The following takes care of end-scripts that semantically can be merged into other end markers.

<..eliminate baseline script marks..>
 <xsl:template match="span[
    (@class = ’end-script’)
    and
    ancestor::* [ following-sibling::* [
                          not( @class = ’content-less’ )
                       ]
                ][1]
            / following-sibling::* [
                          not( @class = ’content-less’ )
                      ][1]
            / self::*
     [
        (@class = ’end-math’)
        or
        (@class = ’end-script’)
        or
        (@class = ’end-root’)
        or
        (@class = ’end-stack’)
        or
        (@class = ’mid-stack’)
        or
        (@class = ’end-array’)
        or
        (@class = ’tr’)
        or
        (@title = ’implicit-baseline’)
     ]
 ]"  >
 </xsl:template>
-_-_-