</span>
<xsl:choose>
- <xsl:when test="preceding-sibling::*[1]/text()='letin1'">
+ <xsl:when test="(preceding-sibling::*[1]/text()='letin1') or
+ (preceding-sibling::*[1]/text()='rw_step')">
<br/>
<xsl:call-template name="make_indent">
<xsl:with-param name="current_indent" select="$current_indent"/>
</xsl:otherwise>
</xsl:choose>
<xsl:variable name="charlength_first">
- <xsl:apply-templates select="*[3]/*[1]" mode="charcount"/>
+ <xsl:apply-templates select="*[3]" mode="root_charcount"/>
</xsl:variable>
<xsl:variable name="charlength_second">
- <xsl:apply-templates select="*[4]/*[1]" mode="charcount"/>
+ <xsl:apply-templates select="*[4]" mode="root_charcount"/>
</xsl:variable>
<xsl:variable name="charlength_side_proof">
- <xsl:apply-templates select="*[5]/*[1]" mode="charcount"/>
+ <xsl:apply-templates select="*[5]" mode="root_charcount"/>
</xsl:variable>
<xsl:variable name="split1"
- select="$charlength_first + $charlength_second > $framewidth"/>
+ select="($charlength_first + $charlength_second) > $framewidth"/>
<xsl:variable name="split2"
- select="$charlength_second + $charlength_side_proof > $framewidth"/>
+ select="($charlength_second + $charlength_side_proof) > $framewidth"/>
<!-- <xsl:value-of select="$current_indent"/> -->
- <!-- <xsl:value-of select="$charlength"/> -->
+ <!-- <xsl:value-of select="string($charlength_second)"/> -->
+ <!-- <xsl:value-of select="$charlength_side_proof"/> -->
+ <!-- <xsl:value-of select="$split2"/> -->
<br/>
<xsl:call-template name="make_indent">
<xsl:with-param name="current_indent" select="$current_indent"/>
</xsl:choose>
</xsl:template>
-<!-- COUNTING -->
+<!-- CHAR COUNTING -->
+
+<!-- enter this counting mode selecting the root -->
+<xsl:template match="*" mode="root_charcount">
+<xsl:param name="incurrent_length" select="0"/>
+ <xsl:choose>
+ <xsl:when test="count(*)=0">
+ <xsl:value-of select="0"/>
+ </xsl:when>
+ <xsl:when test="name()='m:ci'">
+ <xsl:value-of select="string-length()"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="*[1]" mode="charcount">
+ <xsl:with-param name="incurrent_length" select="$incurrent_length"/>
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<!-- enter this mode selecting the first child -->
<xsl:template match="m:ci|m:csymbol" mode="charcount">
<xsl:param name="incurrent_length" select="0"/>
<xsl:apply-templates mode="noannot" select="*[5]"/>
<xsl:apply-templates mode="pure" select="*[3]"/>
<xsl:apply-templates mode="pure" select="*[6]"/>
- <xsl:apply-templates mode="proof_transform" select="*[7]"/>
+ <xsl:call-template name="generate_side_proof">
+ <xsl:with-param name="proof" select="*[7]"/>
+ </xsl:call-template>
+ <!-- <xsl:apply-templates mode="proof_transform" select="*[7]"/> -->
</m:apply>
</xsl:when>
<!-- EQUALITY with extra-parameters -->
<xsl:apply-templates mode="noannot" select="*[5]"/>
<xsl:apply-templates mode="pure" select="*[3]"/>
<xsl:apply-templates mode="pure" select="*[6]"/>
- <xsl:apply-templates mode="pure" select="*[7]"/>
+ <xsl:call-template name="generate_side_proof">
+ <xsl:with-param name="proof" select="*[7]"/>
+ </xsl:call-template>
+ <!-- <xsl:apply-templates mode="pure" select="*[7]"/> -->
</m:apply>
<xsl:apply-templates mode="noannot" select="*[position()>7]"/>
</m:apply>
</m:ci>
<xsl:apply-templates mode="pure" select="*[3]"/>
<xsl:apply-templates mode="pure" select="*[6]"/>
- <xsl:apply-templates mode="pure" select="*[7]"/>
+ <xsl:call-template name="generate_side_proof">
+ <xsl:with-param name="proof" select="*[7]"/>
+ </xsl:call-template>
+ <!-- <xsl:apply-templates mode="pure" select="*[7]"/> -->
</m:apply>
<xsl:apply-templates mode="flat" select="*[8]">
<xsl:with-param name="n">
<m:csymbol>rw_step</m:csymbol>
<xsl:apply-templates mode="pure" select="*[5]"/>
<xsl:apply-templates mode="pure" select="*[3]"/>
- <xsl:apply-templates mode="pure" select="*[6]"/>
- <xsl:apply-templates mode="pure" select="*[7]"/>
+ <xsl:apply-templates mode="pure" select="*[6]"/>
+ <xsl:call-template name="generate_side_proof">
+ <xsl:with-param name="proof" select="*[7]"/>
+ </xsl:call-template>
+ <!-- <xsl:apply-templates mode="pure" select="*[7]"/> -->
</m:apply>
<xsl:apply-templates mode="flat" select="*[8]">
<xsl:with-param name="n">
<xsl:apply-templates mode="noannot" select="target/*[1]/*[5]"/>
<xsl:apply-templates mode="pure" select="target/*[1]/*[3]"/>
<xsl:apply-templates mode="pure" select="target/*[1]/*[6]"/>
- <xsl:apply-templates mode="proof_transform" select="target/*[1]/*[7]"/>
+ <xsl:call-template name="generate_side_proof">
+ <xsl:with-param name="proof" select="target/*[1]/*[7]"/>
+ </xsl:call-template>
+ <!-- <xsl:apply-templates mode="proof_transform" select="target/*[1]/*[7]"/> -->
</m:apply>
</xsl:when>
<xsl:otherwise>
</xsl:choose>
</xsl:template>
+<xsl:template name="is_simple">
+ <xsl:param name="proof" select="/.."/>
+ <xsl:value-of select="(count($proof/*)=0) or ((name($proof)='APPLY') and (count($proof/*[@sort='Prop' and (name(.)='LAMBDA' or name(.)='LETIN' or name(.)='APPLY' or name(.)='MUTCASE' or name(.)='FIX' or name(.)='COFIX')]) = 0))"/>
+</xsl:template>
+
+<xsl:template name="generate_side_proof">
+ <xsl:param name="proof" select="/.."/>
+<!--
+ <xsl:variable name="is_simple">
+ <xsl:call-template name="is_simple">
+ <xsl:with-param name="proof" select="$proof"/>
+ </xsl:call-template>
+ </xsl:variable> -->
+<xsl:variable name="is_simple" select="(count($proof/*)=0) or ((name($proof)='APPLY') and (count($proof/*[@sort='Prop' and (name(.)='LAMBDA' or name(.)='LETIN' or name(.)='APPLY' or name(.)='MUTCASE' or name(.)='FIX' or name(.)='COFIX')]) = 0))"/>
+ <xsl:choose>
+ <xsl:when test="$is_simple">
+ <xsl:choose>
+ <xsl:when test="name($proof)='APPLY'">
+ <xsl:apply-templates select="$proof" mode="letin"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="$proof" mode="pure"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="$proof" mode="noannot"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+<xsl:variable name="no_subproofs" select="count(*[@sort='Prop' and (name(.)='LAMBDA' or name(.)='LETIN' or name(.)='APPLY' or name(.)='MUTCASE' or name(.)='FIX' or name(.)='COFIX')])"/>
<xsl:template match="APPLY" mode="letin">
<xsl:variable name="no_subproofs" select="count(*[@sort='Prop' and (name(.)='LAMBDA' or name(.)='LETIN' or name(.)='APPLY' or name(.)='MUTCASE' or name(.)='FIX' or name(.)='COFIX')])"/>