8.5 Nucleous of Continued Fractions

We are looking for the three most internal (bottom) fractions that belong to a continued fraction.

<..tail continued fractions..>
 <xsl:when test="          check numeral numerator
    (translate(
       normalize-space(
       child::mrow[ @class = ’mrow-numerator’ ]),
                               ’0123456789’,’’)= ’’)
    and <.check equality of numerators.>
    and <.check ops before two top fracs.>
 ">
   <.a,b := top 2 pre op values.>
   <xsl:choose>
      <xsl:when test="
          ( translate($a,’0123456789 ’,’’) = ’’)
          and (normalize-space($a)=normalize-space($b))
          and starts-with( $c, normalize-space( $a ))
          and starts-with(
                normalize-space(
                  substring-after( $c, normalize-space( $a )) )
                ,
                normalize-space(
                     child::mrow[ @class = ’mrow-enumerator’ ] /
                     child::mfrac /
                     preceding-sibling::*[1]                  )
              )
      " >
          <xsl:attribute name="class">
             <xsl:value-of select=" ’continued-mfrac’ " />
          </xsl:attribute>
          <xsl:apply-templates select="*|text()|comment()" />
      </xsl:when>
      <xsl:otherwise>
          <xsl:apply-templates select="*|@*|text()|comment()" />
      </xsl:otherwise>
   </xsl:choose>
 </xsl:when>
-_-_-

<..check equality of numerators..>
 (  normalize-space(
    child::mrow[ @class = ’mrow-numerator’ ])
   and
    normalize-space(
    child::mrow[ @class = ’mrow-enumerator’ ] /
    child::mfrac /
    child::mrow[ @class = ’mrow-numerator’ ])
 )
 and
 (  normalize-space(
    child::mrow[ @class = ’mrow-enumerator’ ] /
    child::mfrac /
    child::mrow[ @class = ’mrow-numerator’ ])
   and
    normalize-space(
    child::mrow[ @class = ’mrow-enumerator’ ] /
    child::mfrac /
    child::mrow[ @class = ’mrow-enumerator’ ] /
    child::mfrac /
    child::mrow[ @class = ’mrow-numerator’ ])
 )
-_-_-

<..check ops before two top fracs..>
 (  child::mrow[ @class = ’mrow-enumerator’ ] /
    child::mfrac /
    preceding-sibling::*[1][@class = ’MathClass-bin’]
 )
 and
 (  normalize-space(
    child::mrow[ @class = ’mrow-enumerator’ ] /
    child::mfrac /
    preceding-sibling::*[1] )
    =
    normalize-space(
    child::mrow[ @class = ’mrow-enumerator’ ] /
    child::mfrac /
    child::mrow[ @class = ’mrow-enumerator’ ] /
    child::mfrac /
    preceding-sibling::*[1] )
 )
-_-_-