]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/style/content_to_html.xsl
- the mathql interpreter is not helm-dependent any more
[helm.git] / helm / style / content_to_html.xsl
index 4b51eb320c86729ac0d468e62836a916ac872db7..856fd69718a66103a38e43811ee1b836de23fc0c 100644 (file)
@@ -59,7 +59,7 @@
        media-type="text/html"
        doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" />
 
-<xsl:variable name="framewidth" select="45"/>
+<xsl:variable name="framewidth" select="55"/>
 
 <xsl:template name="mksymbol-1">
  <xsl:param name="symbol" select="''"/>
       <xsl:when test="$symbol = 'arrow'">
        <xsl:value-of select="'&#x00ae;'"/>
       </xsl:when>
+      <xsl:when test="$symbol = 'RightArrow'">
+       <xsl:value-of select="'&#222;'"/>
+      </xsl:when>
+      <xsl:when test="$symbol = 'subst'">
+       <xsl:value-of select="'&#x00ac;'"/>
+      </xsl:when>
+      <xsl:when test="$symbol = 'lift' or $symbol = 'lift_with_base'">
+       <xsl:value-of select="'&#x00ad;'"/>
+      </xsl:when>
+      <xsl:when test="$symbol = 'beta_red' or $symbol = 'beta_red1'">
+       <xsl:value-of select="'&#x00ae;'"/>
+      </xsl:when>
+      <xsl:when test="$symbol = 'beta'">
+       <xsl:value-of select="'&#x0062;'"/>
+      </xsl:when>
+      <xsl:when test="$symbol = 'par_beta_red' or $symbol = 'par_beta_red1'">
+       <xsl:value-of select="'&#x00de;'"/>
+      </xsl:when>
+      <xsl:when test="$symbol = 'isomorphic'">
+       <xsl:value-of select="'&#x0040;'"/>
+      </xsl:when>
+      <xsl:otherwise>
+       <xsl:text>???</xsl:text>
+      </xsl:otherwise>
      </xsl:choose>
     </xsl:variable>
-    <FONT FACE="symbol" SIZE="{$size}" mathcolor="{$color}">
+    <FONT FACE="symbol" SIZE="{$size}" color="{$color}">
      <xsl:value-of select="$fontsymbol"/>
     </FONT>
    </xsl:when>
       <xsl:when test="$symbol = 'arrow'">
        <xsl:value-of select="'&#8594;'"/>
       </xsl:when>
+      <xsl:when test="$symbol = 'RightArrow'">
+       <xsl:value-of select="'&#8658;'"/>
+      </xsl:when>
+      <xsl:when test="$symbol = 'subst'">
+       <xsl:value-of select="'&#8592;'"/>
+      </xsl:when>
+      <xsl:when test="$symbol = 'lift' or $symbol = 'lift_with_base'">
+       <xsl:value-of select="'&#8593;'"/>
+      </xsl:when>
+      <xsl:when test="$symbol = 'beta_red' or $symbol = 'beta_red1'">
+       <xsl:value-of select="'&#8594;'"/>
+      </xsl:when>
+      <xsl:when test="$symbol = 'beta'">
+       <xsl:value-of select="'&#946;'"/>
+      </xsl:when>
+      <xsl:when test="$symbol = 'par_beta_red' or $symbol = 'par_beta_red1'">
+       <xsl:value-of select="'&#8658;'"/>
+      </xsl:when>
+      <xsl:when test="$symbol = 'isomorphic'">
+       <xsl:value-of select="'&#8773;'"/>
+      </xsl:when>
+      <xsl:otherwise>
+       <xsl:text>???</xsl:text>
+      </xsl:otherwise>
      </xsl:choose>
     </xsl:variable>
     <FONT color="{$color}">
       <head>
         <title> <xsl:value-of select="$CICURI"/> </title> <!-- FG -->
          <style> A { text-decoration: none } </style>
+         <script>
+          <xsl:text disable-output-escaping="yes">
+           <![CDATA[
+            function Hide(which){
+             if (!document.getElementById)
+              return
+             which.style.display="none"
+            }
+
+            function Show(which){
+             if (!document.getElementById)
+              return
+             which.style.display=""
+            }
+
+            document.to_be_deleted = new Array();
+          ]]>
+          </xsl:text>
+         </script>
       </head>
       <body bgcolor="white">
+         <xsl:attribute name="onLoad">
+          if(document.getElementById)
+           for(var i=0;i&lt;document.to_be_deleted.length;i++)
+            Hide(document.getElementById(document.to_be_deleted[i]));
+         </xsl:attribute>
          <xsl:apply-templates>
             <xsl:with-param name="current_indent" select="0"/>
          </xsl:apply-templates>
    <xsl:variable name="name">
     <xsl:value-of select="m:csymbol"/>
    </xsl:variable>
+   <xsl:variable name="uri"><xsl:value-of select="*[1]/@definitionURL"/></xsl:variable>
    <xsl:choose>
     <!-- FORALL -->
     <xsl:when test="$name='forall'">
      <FONT color="red">CASE </FONT>
      <xsl:apply-templates mode="inline" select="*[position()=3]"/>
      <FONT color="red"> OF </FONT>
-     <xsl:for-each select="*[position() mod 2 = 0 and position()>3]">
+     <xsl:for-each select="m:piecewise/m:piece">
+<!--<xsl:for-each select="*[position() mod 2 = 0 and position()>3]">-->
       <xsl:choose>
        <xsl:when test="not(position() = 1)">
         <xsl:text> | </xsl:text> 
        </xsl:when> 
       </xsl:choose>
-      <xsl:apply-templates mode="inline" select="."/>
-      <FONT FACE="Symbol" SIZE="+0" mathcolor="green">&#222;</FONT>
+      <xsl:apply-templates mode="inline" select="./*[2]"/>
+      <xsl:call-template name="mksymbol-1">
+       <xsl:with-param name="symbol" select="'RightArrow'"/>
+       <xsl:with-param name="color" select="'green'"/>
+       <xsl:with-param name="size" select="'+0'"/>
+      </xsl:call-template>
       <xsl:apply-templates mode="inline"
-           select="following-sibling::*[position()= 1]"/>
+           select="./*[1]"/>
      </xsl:for-each>
     </xsl:when>
     <!-- FIX -->
       </xsl:choose>
      </xsl:for-each>
     </xsl:when>
-    <!-- proof -->
-    <xsl:when test="$name='proof'">
+    <!-- proof and side_proof -->
+    <xsl:when test="$name='proof' or $name='side_proof'">
        <xsl:apply-templates mode="inline" select="*[position()=2]"/>
        <FONT color="red">&#x00a0;proves&#x00a0;</FONT>
        <xsl:apply-templates mode="inline" select="*[position()=3]"/>
+       <xsl:if test="*[4]">
+        <FONT color="red">&#x00a0;which&#x00a0;is&#x00a0;equivalent&#x00a0;to&#x00a0;</FONT>
+        <xsl:apply-templates mode="inline" select="*[position()=4]"/>
+       </xsl:if>
+    </xsl:when>
+    <!-- letin1 -->
+    <xsl:when test="$name='letin1'">
+     <xsl:text>letin1 (inline error)</xsl:text>
     </xsl:when>
     <!-- false_ind -->
     <xsl:when test="$name='false_ind'">
        <xsl:apply-templates select="*[3]" mode="inline"/>
        <xsl:text>[</xsl:text>
        <xsl:apply-templates select="*[4]" mode="inline"/>
-       <a href="{*[1]/@definitionURL}">
-       <FONT color="green" FACE="symbol">
-        <xsl:text>&#x00ac;</xsl:text>
-       </FONT>
-       </a>
+       <xsl:choose>
+       <xsl:when test="$uri != ''">
+        <a href="{$uri}">
+         <xsl:call-template name="mksymbol-1">
+          <xsl:with-param name="symbol" select="$name"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+        </a>
+       </xsl:when>
+       <xsl:otherwise>
+         <xsl:call-template name="mksymbol-1">
+          <xsl:with-param name="symbol" select="$name"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+       </xsl:otherwise>
+       </xsl:choose>
        <xsl:apply-templates select="*[2]" mode="inline"/>
        <xsl:text>]</xsl:text>
       </xsl:when>
        <SUB>
        <xsl:apply-templates select="*[3]" mode="inline"/>
        </SUB>
-       <a href="{*[1]/@definitionURL}">
-       <FONT color="green" FACE="symbol">
-        <xsl:text>&#x00ad;</xsl:text>
-       </FONT>
-       </a>
+       <xsl:choose>
+       <xsl:when test="$uri != ''">
+         <a href="{$uri}">
+          <xsl:call-template name="mksymbol-1">
+           <xsl:with-param name="symbol" select="$name"/>
+           <xsl:with-param name="color" select="'green'"/>
+           <xsl:with-param name="size" select="'+0'"/>
+          </xsl:call-template>
+         </a>
+       </xsl:when>
+       <xsl:otherwise>
+          <xsl:call-template name="mksymbol-1">
+           <xsl:with-param name="symbol" select="$name"/>
+           <xsl:with-param name="color" select="'green'"/>
+           <xsl:with-param name="size" select="'+0'"/>
+          </xsl:call-template>
+       </xsl:otherwise>
+       </xsl:choose>
        <SUP>
        <xsl:apply-templates select="*[4]" mode="inline"/>
        </SUP>
       </xsl:when>
 
       <xsl:when test="$name='lift'">
-       <a href="{*[1]/@definitionURL}">
-       <FONT color="green" FACE="symbol">
-        <xsl:text>&#x00ad;</xsl:text>
-       </FONT>
-       </a>
+       <xsl:choose>
+       <xsl:when test="$uri != ''">
+        <a href="{$uri}">
+         <xsl:call-template name="mksymbol-1">
+          <xsl:with-param name="symbol" select="$name"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+        </a>
+       </xsl:when>
+       <xsl:otherwise>
+         <xsl:call-template name="mksymbol-1">
+          <xsl:with-param name="symbol" select="$name"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+       </xsl:otherwise>
+       </xsl:choose>
        <SUP>
        <xsl:apply-templates select="*[2]" mode="inline"/>
        </SUP>
       <!-- reduction --> 
       <xsl:when test="$name='beta_red1'">
        <xsl:apply-templates select="*[2]" mode="inline"/>
-       <a href="{*[1]/@definitionURL}">
-       <FONT color="green" FACE="symbol">
-        <xsl:text>&#x00ae;</xsl:text>
-       </FONT>
-       <SUB>
-        <FONT color="green" FACE="symbol">
-         <xsl:text>&#x0062;</xsl:text>
-        </FONT>
-       </SUB>
-       </a>
+       <xsl:choose>
+       <xsl:when test="$uri != ''">
+        <a href="{$uri}">
+         <xsl:call-template name="mksymbol-1">
+          <xsl:with-param name="symbol" select="$name"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         <SUB>
+         <xsl:call-template name="mksymbol-1">
+          <xsl:with-param name="symbol" select="'beta'"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         </SUB>
+        </a>
+       </xsl:when>
+       <xsl:otherwise>
+         <xsl:call-template name="mksymbol-1">
+          <xsl:with-param name="symbol" select="$name"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         <SUB>
+         <xsl:call-template name="mksymbol-1">
+          <xsl:with-param name="symbol" select="'beta'"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         </SUB>
+       </xsl:otherwise>
+       </xsl:choose>
        <xsl:apply-templates select="*[3]" mode="inline"/>
       </xsl:when>
 
       <xsl:when test="$name='beta_red'">
        <xsl:apply-templates select="*[2]" mode="inline"/>
-       <a href="{*[1]/@definitionURL}">
-       <FONT color="green" FACE="symbol">
-        <xsl:text>&#x00ae;</xsl:text>
-       </FONT>
-       <SUB>
-        <FONT color="green" FACE="symbol">
-         <xsl:text>&#x0062;*</xsl:text>
-        </FONT>
-       </SUB>
-       </a>
+       <xsl:choose>
+       <xsl:when test="$uri != ''"> 
+        <a href="{$uri}">
+         <xsl:call-template name="mksymbol-1">
+          <xsl:with-param name="symbol" select="$name"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         <SUB>
+         <xsl:call-template name="mksymbol-1">
+          <xsl:with-param name="symbol" select="'beta'"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         <xsl:text>*</xsl:text>
+         </SUB>
+        </a>
+       </xsl:when>
+       <xsl:otherwise>
+         <xsl:call-template name="mksymbol-1">
+          <xsl:with-param name="symbol" select="$name"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         <SUB>
+         <xsl:call-template name="mksymbol-1">
+          <xsl:with-param name="symbol" select="'beta'"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         <xsl:text>*</xsl:text>
+         </SUB>
+       </xsl:otherwise>
+       </xsl:choose>
        <xsl:apply-templates select="*[3]" mode="inline"/>
       </xsl:when>
 
       <xsl:when test="$name='par_beta_red1'">
        <xsl:apply-templates select="*[2]" mode="inline"/>
-       <a href="{*[1]/@definitionURL}">
-       <FONT color="green" FACE="symbol">
-        <xsl:text>&#x00de;</xsl:text>
-       </FONT>
-       <SUB>
-        <FONT color="green" FACE="symbol">
-         <xsl:text>&#x0062;</xsl:text>
-        </FONT>
-       </SUB>
-       </a>
+       <xsl:choose>
+       <xsl:when test="$uri != ''">
+        <a href="{$uri}">
+         <xsl:call-template name="mksymbol-1">
+          <xsl:with-param name="symbol" select="$name"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         <SUB>
+         <xsl:call-template name="mksymbol-1">
+          <xsl:with-param name="symbol" select="'beta'"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         </SUB>
+        </a>
+       </xsl:when>
+       <xsl:otherwise>
+         <xsl:call-template name="mksymbol-1">
+          <xsl:with-param name="symbol" select="$name"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         <SUB>
+         <xsl:call-template name="mksymbol-1">
+          <xsl:with-param name="symbol" select="'beta'"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         </SUB>
+       </xsl:otherwise>
+       </xsl:choose>
        <xsl:apply-templates select="*[3]" mode="inline"/>
       </xsl:when>
 
       <xsl:when test="$name='par_beta_red'">
        <xsl:apply-templates select="*[2]" mode="inline"/>
-       <a href="{*[1]/@definitionURL}">
-       <FONT color="green" FACE="symbol">
-        <xsl:text>&#x00de;</xsl:text>
-       </FONT>
-       <SUB>
-        <FONT color="green" FACE="symbol">
-         <xsl:text>&#x0062;*</xsl:text>
-        </FONT>
-       </SUB>
-       </a>
+       <xsl:choose>
+       <xsl:when test="$uri != ''">
+        <a href="{$uri}">
+         <xsl:call-template name="mksymbol-1">
+          <xsl:with-param name="symbol" select="$name"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         <SUB>
+         <xsl:call-template name="mksymbol-1">
+          <xsl:with-param name="symbol" select="'beta'"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         <xsl:text>*</xsl:text>
+         </SUB>
+        </a>
+       </xsl:when>
+       <xsl:otherwise>
+         <xsl:call-template name="mksymbol-1">
+          <xsl:with-param name="symbol" select="$name"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         <SUB>
+         <xsl:call-template name="mksymbol-1">
+          <xsl:with-param name="symbol" select="'beta'"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         <xsl:text>*</xsl:text>
+         </SUB>
+       </xsl:otherwise>
+       </xsl:choose>
        <xsl:apply-templates select="*[3]" mode="inline"/>
       </xsl:when>
 
       <!-- forgetful -->
       <xsl:when test="$name='forgetful'">
-       <a href="{*[1]/@definitionURL}">|</a>
+       <xsl:choose>
+       <xsl:when test="$uri != ''">
+        <a href="{$uri}">|</a>
+       </xsl:when>
+       <xsl:otherwise>
+        |
+       </xsl:otherwise>
+       </xsl:choose>
        <xsl:apply-templates select="*[2]" mode="inline"/>
-       <a href="{*[1]/@definitionURL}">|</a>
+        <xsl:choose>
+        <xsl:when test="$uri != ''">
+         <a href="{$uri}">|</a>
+        </xsl:when>
+       <xsl:otherwise>
+        |
+       </xsl:otherwise>
+       </xsl:choose>
       </xsl:when>
  
       <!-- boolean algebra of redexes -->
       <!-- isomorphic -->
       <xsl:when test="$name='isomorphic'">
        <xsl:apply-templates select="*[2]" mode="inline"/>
-       <a href="{*[1]/@definitionURL}">
-        <FONT color="green" FACE="symbol">
-        <xsl:text>&#x0040;</xsl:text>
-       </FONT>
-       </a>
+       <xsl:choose>
+       <xsl:when test="$uri != ''">
+        <a href="{$uri}">
+         <xsl:call-template name="mksymbol-1">
+          <xsl:with-param name="symbol" select="$name"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+        </a>
+       </xsl:when>
+       <xsl:otherwise>
+         <xsl:call-template name="mksymbol-1">
+          <xsl:with-param name="symbol" select="$name"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+       </xsl:otherwise>
+       </xsl:choose>
        <xsl:apply-templates select="*[3]" mode="inline"/>
       </xsl:when>
 
   </xsl:variable>
      <!-- <xsl:value-of select="$current_indent"/> -->
      <!-- <xsl:value-of select="$charlength"/> -->
+  <xsl:variable name="uri"><xsl:value-of select="*[1]/@definitionURL"/></xsl:variable>
      <xsl:choose>
      <!-- FORALL -->
       <xsl:when test="$name='forall'">
        <xsl:call-template name="mksymbol-1">
         <xsl:with-param name="symbol" select="$name"/>
         <xsl:with-param name="color" select="'blue'"/>
-        <xsl:with-param name="size" select="'+2'"/>
+        <xsl:with-param name="size" select="'+0'"/>
        </xsl:call-template>
        <xsl:apply-templates select="*[position()=3]">
         <xsl:with-param name="current_indent" select="$current_indent + 5"/>
           <xsl:with-param name="current_indent" select="$current_indent + 8"/>
          </xsl:apply-templates>
          <xsl:text> OF </xsl:text> 
-         <xsl:for-each select="*[position() mod 2 = 0 and position()>3]">
+         <xsl:for-each select="m:piecewise/m:piece">
+    <!--   <xsl:for-each select="*[position() mod 2 = 0 and position()>3]">-->
          <br/>
          <xsl:call-template name="make_indent">
           <xsl:with-param name="current_indent" select="$current_indent + 2"/> 
              <xsl:text>| </xsl:text>
             </xsl:otherwise>
             </xsl:choose>
-            <xsl:apply-templates select="."/>
-            <FONT FACE="Symbol" SIZE="+0" mathcolor="green">&#222;</FONT>
+          <xsl:apply-templates select="./*[2]"/>
+            <xsl:call-template name="mksymbol-1">
+             <xsl:with-param name="symbol" select="'RightArrow'"/>
+             <xsl:with-param name="color" select="'green'"/>
+             <xsl:with-param name="size" select="'+0'"/>
+            </xsl:call-template>
             <xsl:variable name="body_size">
-             <xsl:apply-templates 
-              select="following-sibling::*[1]/*[1]" mode="charcount"/>
+  <xsl:apply-templates 
+              select="./*[1]/*[1]" mode="charcount"/>
             </xsl:variable>
             <xsl:choose>
              <xsl:when test="$body_size > $framewidth">
                <xsl:with-param name="current_indent" 
                     select="$current_indent + 8"/>   
               </xsl:call-template>
-             <xsl:apply-templates 
-                   select="following-sibling::*[position()= 1]">
+<xsl:apply-templates 
+                   select="./*[1]">
               <xsl:with-param name="current_indent" 
                    select="$current_indent + 8"/>      
              </xsl:apply-templates>
             </xsl:when>
             <xsl:otherwise>
-             <xsl:apply-templates select="following-sibling::*[position()= 1]"
+     <xsl:apply-templates select="./*[1]"
                    mode="inline" />
             </xsl:otherwise>
            </xsl:choose>
       <!-- ***************************************** -->
       <!-- PROOF -->
       <xsl:when test="$name='proof'">
-       <xsl:apply-templates select="*[position()=2]">
-        <xsl:with-param name="current_indent" select="$current_indent"/>
-       </xsl:apply-templates>
-       <br/>
-       <!-- <xsl:element name="br"/> -->
-       <xsl:call-template name="make_indent">
-        <xsl:with-param name="current_indent" select="$current_indent"/> 
-       </xsl:call-template>
-       <FONT color="red">we proved&#x00a0;</FONT>
+       <xsl:variable name="nonce" select="generate-id()"/>
+       <xsl:variable name="freshid1" select="concat('a',$nonce)"/>
+       <xsl:variable name="freshid2" select="concat('b',$nonce)"/>
+       <xsl:variable name="freshid3" select="concat('c',$nonce)"/>
+       <span ID="{$freshid1}">
+        <xsl:apply-templates select="*[position()=2]">
+         <xsl:with-param name="current_indent" select="$current_indent"/>
+        </xsl:apply-templates>
+        &#x00a0;
+       </span>
+       <xsl:choose>
+        <xsl:when test="(preceding-sibling::*[1]/text()='letin1') or
+                        (preceding-sibling::*[1]/text()='rw_step') or
+                        (name(..)='m:lambda')">
+         <br/>
+         <xsl:call-template name="make_indent">
+          <xsl:with-param name="current_indent" select="$current_indent"/>
+         </xsl:call-template>
+         <FONT color="red">we proved&#x00a0;</FONT> 
+        </xsl:when>
+        <xsl:otherwise>
+         <script>
+          if(document.getElementById) {
+           document.write('\
+            <span ID="{$freshid2}">\
+             <a style="text-decoration:underline ; color:green" href="" onClick="Show(document.getElementById(\'{$freshid1}\')); Hide(document.getElementById(\'{$freshid2}\'));Show(document.getElementById(\'{$freshid3}\'));return (0==1);">Proof of</a>\
+            </span>\
+            <span ID="{$freshid3}">\
+             <br/>\
+             <xsl:call-template name="make_indent">
+              <xsl:with-param name="current_indent" select="$current_indent"/>
+             </xsl:call-template>\
+             <a style="text-decoration:underline ; color:red" href="" onClick="Hide(document.getElementById(\'{$freshid1}\')); Show(document.getElementById(\'{$freshid2}\'));Hide(document.getElementById(\'{$freshid3}\'));return (0==1);">we proved</a>\
+            </span>\
+           ');
+           document.to_be_deleted.push('<xsl:value-of select="$freshid1"/>');
+           document.to_be_deleted.push('<xsl:value-of select="$freshid3"/>');
+           document.write('&#x00a0;');
+          } else {
+           document.write('\
+            <br/>\
+            <xsl:call-template name="make_indent">
+             <xsl:with-param name="current_indent" select="$current_indent"/>
+            </xsl:call-template>\
+            <FONT color="red">we proved&#x00a0;</FONT>\
+           ');
+          }
+         </script>
+        </xsl:otherwise>
+       </xsl:choose>
        <xsl:apply-templates select="*[position()=3]">
         <xsl:with-param name="current_indent" select="$current_indent + 16"/>
        </xsl:apply-templates>
       </xsl:when>
+      <!-- side_proof -->
+      <xsl:when test="$name='side_proof'">
+       <xsl:variable name="nonce" select="generate-id()"/>
+       <xsl:variable name="freshid1" select="concat('a',$nonce)"/>
+       <xsl:variable name="freshid2" select="concat('b',$nonce)"/>
+       <xsl:variable name="freshid3" select="concat('c',$nonce)"/>
+       <xsl:variable name="freshid4" select="concat('d',$nonce)"/>
+       <span ID="{$freshid1}">
+        <xsl:apply-templates select="*[position()=2]">
+         <xsl:with-param name="current_indent" select="$current_indent"/>
+        </xsl:apply-templates>
+        &#x00a0;
+       </span>
+         <script>
+          if(document.getElementById) {
+           document.write('\
+            <span ID="{$freshid2}">\
+             <a style="text-decoration:underline ; color:green" href="" onClick="Show(document.getElementById(\'{$freshid1}\')); Hide(document.getElementById(\'{$freshid2}\'));Show(document.getElementById(\'{$freshid3}\'));Show(document.getElementById(\'{$freshid4}\'));return (0==1);">Justification</a>\
+            </span>\
+            <span ID="{$freshid3}">\
+             <br/>\
+             <xsl:call-template name="make_indent">
+              <xsl:with-param name="current_indent" select="$current_indent"/>
+             </xsl:call-template>\
+             <a style="text-decoration:underline ; color:red" href="" onClick="Hide(document.getElementById(\'{$freshid1}\')); Show(document.getElementById(\'{$freshid2}\'));Hide(document.getElementById(\'{$freshid3}\'));Hide(document.getElementById(\'{$freshid4}\'));return (0==1);">we proved</a>\
+            </span>\
+           ');
+           document.to_be_deleted.push('<xsl:value-of select="$freshid1"/>');
+           document.to_be_deleted.push('<xsl:value-of select="$freshid3"/>');
+           document.to_be_deleted.push('<xsl:value-of select="$freshid4"/>');
+           document.write('&#x00a0;');
+          } else {
+           document.write('\
+            <br/>\
+            <xsl:call-template name="make_indent">
+             <xsl:with-param name="current_indent" select="$current_indent"/>
+            </xsl:call-template>\
+            <FONT color="red">we proved&#x00a0;</FONT>\
+           ');
+          }
+         </script>
+       <span ID="{$freshid4}">
+        <xsl:apply-templates select="*[position()=3]">
+         <xsl:with-param name="current_indent" select="$current_indent + 16"/>
+        </xsl:apply-templates>
+       </span>
+      </xsl:when> 
+      <!-- eq_chain -->
+      <xsl:when test="$name='eq_chain'">
+       <FONT color="red">We have the following equality chain:</FONT>
+       <xsl:for-each select="*[position() mod 2 = 0]">
+        <xsl:variable name="pos" select="position()"/>
+        <br/>
+        <xsl:call-template name="make_indent">
+         <xsl:with-param name="current_indent" select="$current_indent + 5"/>
+        </xsl:call-template>
+        <xsl:choose>
+         <xsl:when test="$pos=1">
+          <xsl:apply-templates select=".">
+           <xsl:with-param name="current_indent" select="$current_indent + 5"/>
+          </xsl:apply-templates>
+          <xsl:text>&#x00a0;=</xsl:text>
+         </xsl:when>
+         <xsl:otherwise>
+          <xsl:text>=&#x00a0;</xsl:text>
+          <xsl:apply-templates select=".">
+           <xsl:with-param name="current_indent" select="$current_indent + 5"/>
+          </xsl:apply-templates>
+         </xsl:otherwise>
+        </xsl:choose>
+        <xsl:if test="$pos != last()">
+         <br/>
+         <xsl:call-template name="make_indent">
+          <xsl:with-param name="current_indent" select="$current_indent + 15"/>
+         </xsl:call-template>
+         <xsl:apply-templates select="../*[position()=2*$pos +1]">
+          <xsl:with-param name="current_indent" select="$current_indent + 15"/>
+         </xsl:apply-templates>
+        </xsl:if>
+       </xsl:for-each>
+      </xsl:when>
+       <!-- diseq_chain -->
+      <xsl:when test="$name='diseq_chain'">
+       <FONT color="red">We have the following chain of disequalities:</FONT>
+       <xsl:for-each select="*[position() mod 3 = 2]">
+        <xsl:variable name="pos" select="position()"/>
+        <br/>
+        <xsl:call-template name="make_indent">
+         <xsl:with-param name="current_indent" select="$current_indent + 5"/>
+        </xsl:call-template>
+        <xsl:choose>
+         <xsl:when test="$pos=1">
+          <xsl:apply-templates select=".">
+           <xsl:with-param name="current_indent" select="$current_indent + 5"/>
+          </xsl:apply-templates>
+          <xsl:text>&#x00a0;</xsl:text>
+          <xsl:apply-templates mode="inline" select="../*[position()=3*$pos]"/>
+         </xsl:when>
+         <xsl:otherwise>
+          <xsl:apply-templates mode="inline" select="../*[position()=3*($pos - 1)]"/>
+          <xsl:text>&#x00a0;</xsl:text>
+          <xsl:apply-templates select=".">
+           <xsl:with-param name="current_indent" select="$current_indent + 5"/>
+          </xsl:apply-templates>
+         </xsl:otherwise>
+        </xsl:choose>
+        <xsl:if test="$pos != last()">
+         <br/>
+         <xsl:call-template name="make_indent">
+          <xsl:with-param name="current_indent" select="$current_indent + 15"/>
+         </xsl:call-template>
+         <xsl:apply-templates select="../*[position()=3*$pos +1]">
+          <xsl:with-param name="current_indent" select="$current_indent + 15"/>
+         </xsl:apply-templates>
+        </xsl:if>
+       </xsl:for-each>
+      </xsl:when>
       <!-- letin1 -->
       <xsl:when test="$name='letin1'">
        <xsl:apply-templates select="*[position()=2]">
         </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:otherwise>
        </xsl:choose>
       </xsl:when>
-      <!-- nat_ind -->
-      <xsl:when test="$name='nat_ind_complete'">
-       <FONT color="red">By induction on&#x00a0;</FONT>
-       <xsl:apply-templates select="*[2]"/>:
-       <br/>
-       <xsl:call-template name="make_indent">
-        <xsl:with-param name="current_indent" select="$current_indent"/> 
-       </xsl:call-template>
-       <xsl:text>0&#x00a0;</xsl:text>
-       <FONT FACE="Symbol" mathcolor="green">&#222;</FONT>
-       <xsl:apply-templates select="*[3]">
-        <xsl:with-param name="current_indent" select="$current_indent + 8"/>
-       </xsl:apply-templates>
-       <br/>
-       <xsl:call-template name="make_indent">
-        <xsl:with-param name="current_indent" select="$current_indent"/> 
-       </xsl:call-template>
-       <xsl:text>S(</xsl:text>
-       <xsl:apply-templates select="*[4]"/>
-       <xsl:text>)&#x00a0;</xsl:text>
-       <FONT FACE="Symbol" mathcolor="green">&#222;</FONT>
-       <FONT color="red">Assume by induction</FONT>
-       <br/>
-       <xsl:call-template name="make_indent">
-        <xsl:with-param name="current_indent" select="$current_indent +10"/> 
-       </xsl:call-template>
-       <xsl:text>(</xsl:text>
-       <xsl:apply-templates select="*[5]"/>
-       <xsl:text>)</xsl:text>
-       <xsl:apply-templates select="*[6]">
-        <xsl:with-param name="current_indent" select="$current_indent + 14"/>
-       </xsl:apply-templates>
-       <br/>
-       <xsl:call-template name="make_indent">
-        <xsl:with-param name="current_indent" select="$current_indent +10"/> 
-       </xsl:call-template>
-       <xsl:apply-templates select="*[7]">
-        <xsl:with-param name="current_indent" select="$current_indent + 10"/>
-       </xsl:apply-templates>
-      </xsl:when>
       <!-- false_ind -->
       <xsl:when test="$name='false_ind'">
        <xsl:apply-templates select="*[3]">
        <xsl:call-template name="make_indent">
         <xsl:with-param name="current_indent" select="$current_indent"/> 
        </xsl:call-template>
-       *
+       Left:&#x00a0;
        <xsl:apply-templates select="*[4]">
         <xsl:with-param name="current_indent" select="$current_indent"/> 
        </xsl:apply-templates>
        <xsl:call-template name="make_indent">
         <xsl:with-param name="current_indent" select="$current_indent"/> 
        </xsl:call-template>
-       *
+       Right:&#x00a0;
        <xsl:apply-templates select="*[5]">
         <xsl:with-param name="current_indent" select="$current_indent"/> 
        </xsl:apply-templates>
        <xsl:apply-templates select="*[3]"/>
        <xsl:text>[</xsl:text>
        <xsl:apply-templates select="*[4]"/>
-       <a href="{*[1]/@definitionURL}">
-       <FONT color="blue" SIZE="+0" FACE="symbol">
-        <xsl:text>&#x00ac;</xsl:text>
-       </FONT>
-       </a>
+       <xsl:choose>
+       <xsl:when test="$uri != ''">
+        <a href="{$uri}">
+         <xsl:call-template name="mksymbol-1">
+          <xsl:with-param name="symbol" select="$name"/>
+          <xsl:with-param name="color" select="'blue'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+        </a>
+       </xsl:when>
+       <xsl:otherwise>
+         <xsl:call-template name="mksymbol-1">
+          <xsl:with-param name="symbol" select="$name"/>
+          <xsl:with-param name="color" select="'blue'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+       </xsl:otherwise>
+       </xsl:choose>
        <xsl:apply-templates select="*[2]"/>
        <xsl:text>]</xsl:text>
       </xsl:when>
        <SUB>
        <xsl:apply-templates select="*[3]" mode="inline"/>
        </SUB>
-       <a href="{*[1]/@definitionURL}">
-       <FONT color="green" FACE="symbol">
-        <xsl:text>&#x00ad;</xsl:text>
-       </FONT>
-       </a>
+       <xsl:choose>
+       <xsl:when test="$uri != ''">
+        <a href="{$uri}">
+         <xsl:call-template name="mksymbol-1">
+          <xsl:with-param name="symbol" select="$name"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+        </a>
+       </xsl:when>
+       <xsl:otherwise>
+         <xsl:call-template name="mksymbol-1">
+          <xsl:with-param name="symbol" select="$name"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+       </xsl:otherwise>
+       </xsl:choose>
        <SUP>
        <xsl:apply-templates select="*[4]" mode="inline"/>
        </SUP>
       </xsl:when>
 
       <xsl:when test="$name='lift'">
-       <a href="{*[1]/@definitionURL}">
-       <FONT color="green" FACE="symbol">
-        <xsl:text>&#x00ad;</xsl:text>
-       </FONT>
-       </a>
+       <xsl:choose>
+       <xsl:when test="$uri != ''">
+        <a href="{$uri}">
+         <xsl:call-template name="mksymbol-1">
+          <xsl:with-param name="symbol" select="$name"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+        </a>
+       </xsl:when>
+       <xsl:otherwise>
+         <xsl:call-template name="mksymbol-1">
+          <xsl:with-param name="symbol" select="$name"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+       </xsl:otherwise>
+       </xsl:choose>
        <SUP>
        <xsl:apply-templates select="*[2]" mode="inline"/>
        </SUP>
       <!-- reduction --> 
       <xsl:when test="$name='beta_red1'">
        <xsl:apply-templates select="*[2]" mode="inline"/>
-       <a href="{*[1]/@definitionURL}">
-       <FONT color="green" FACE="symbol">
-        <xsl:text>&#x00ae;</xsl:text>
-       </FONT>
-       <SUB>
-        <FONT color="green" FACE="symbol">
-         <xsl:text>&#x0062;</xsl:text>
-        </FONT>
-       </SUB>
-       </a>
+       <xsl:choose>
+       <xsl:when test="$uri != ''">
+        <a href="{$uri}">
+         <xsl:call-template name="mksymbol-1">
+          <xsl:with-param name="symbol" select="$name"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         <SUB>
+         <xsl:call-template name="mksymbol-1">
+          <xsl:with-param name="symbol" select="'beta'"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         </SUB>
+        </a>
+       </xsl:when>
+       <xsl:otherwise>
+         <xsl:call-template name="mksymbol-1">
+          <xsl:with-param name="symbol" select="$name"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         <SUB>
+         <xsl:call-template name="mksymbol-1">
+          <xsl:with-param name="symbol" select="'beta'"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         </SUB>
+       </xsl:otherwise>
+       </xsl:choose>
        <xsl:apply-templates select="*[3]" mode="inline"/>
       </xsl:when>
  
       <xsl:when test="$name='beta_red'">
        <xsl:apply-templates select="*[2]" mode="inline"/>
-       <a href="{*[1]/@definitionURL}">
-       <FONT color="green" FACE="symbol">
-        <xsl:text>&#x00ae;</xsl:text>
-       </FONT>
-       <SUB>
-        <FONT color="green" FACE="symbol">
-         <xsl:text>&#x0062;*</xsl:text>
-        </FONT>
-       </SUB>
-       </a>
+       <xsl:choose>
+       <xsl:when test="$uri != ''">
+        <a href="{$uri}">
+         <xsl:call-template name="mksymbol-1">
+          <xsl:with-param name="symbol" select="$name"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         <SUB>
+         <xsl:call-template name="mksymbol-1">
+          <xsl:with-param name="symbol" select="'beta'"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         <xsl:text>*</xsl:text>
+         </SUB>
+        </a>
+       </xsl:when>
+       <xsl:otherwise>
+         <xsl:call-template name="mksymbol-1">
+          <xsl:with-param name="symbol" select="$name"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         <SUB>
+         <xsl:call-template name="mksymbol-1">
+          <xsl:with-param name="symbol" select="'beta'"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         <xsl:text>*</xsl:text>
+         </SUB>
+       </xsl:otherwise>
+       </xsl:choose>
        <xsl:apply-templates select="*[3]" mode="inline"/>
       </xsl:when>
 
       <xsl:when test="$name='par_beta_red1'">
        <xsl:apply-templates select="*[2]" mode="inline"/>
-       <a href="{*[1]/@definitionURL}">
-       <FONT color="green" FACE="symbol">
-        <xsl:text>&#x00de;</xsl:text>
-       </FONT>
-       <SUB>
-        <FONT color="green" FACE="symbol">
-         <xsl:text>&#x0062;</xsl:text>
-        </FONT>
-       </SUB>
-       </a>
+       <xsl:choose>
+       <xsl:when test="$uri != ''">
+        <a href="{$uri}">
+         <xsl:call-template name="mksymbol-1">
+          <xsl:with-param name="symbol" select="$name"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         <SUB>
+         <xsl:call-template name="mksymbol-1">
+          <xsl:with-param name="symbol" select="'beta'"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         </SUB>
+        </a>
+       </xsl:when>
+       <xsl:otherwise>
+         <xsl:call-template name="mksymbol-1">
+          <xsl:with-param name="symbol" select="$name"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         <SUB>
+         <xsl:call-template name="mksymbol-1">
+          <xsl:with-param name="symbol" select="'beta'"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         </SUB>
+       </xsl:otherwise>
+       </xsl:choose>
        <xsl:apply-templates select="*[3]" mode="inline"/>
       </xsl:when>
 
       <xsl:when test="$name='par_beta_red'">
        <xsl:apply-templates select="*[2]" mode="inline"/>
-       <a href="{*[1]/@definitionURL}">
-       <FONT color="green" FACE="symbol">
-        <xsl:text>&#x00de;</xsl:text>
-       </FONT>
-       <SUB>
-        <FONT color="green" FACE="symbol">
-         <xsl:text>&#x0062;*</xsl:text>
-        </FONT>
-       </SUB>
-       </a>
+       <xsl:choose>
+       <xsl:when test="$uri != ''">
+        <a href="{$uri}">
+         <xsl:call-template name="mksymbol-1">
+          <xsl:with-param name="symbol" select="$name"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         <SUB>
+         <xsl:call-template name="mksymbol-1">
+          <xsl:with-param name="symbol" select="'beta'"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         <xsl:text>*</xsl:text>
+         </SUB>
+        </a>
+       </xsl:when>
+       <xsl:otherwise>
+         <xsl:call-template name="mksymbol-1">
+          <xsl:with-param name="symbol" select="$name"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         <SUB>
+         <xsl:call-template name="mksymbol-1">
+          <xsl:with-param name="symbol" select="'beta'"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+         <xsl:text>*</xsl:text>
+         </SUB>
+       </xsl:otherwise>
+       </xsl:choose>
        <xsl:apply-templates select="*[3]" mode="inline"/>
       </xsl:when>
 
       <!-- forgetful -->
       <xsl:when test="$name='forgetful'">
-       <a href="{*[1]/@definitionURL}">|</a>
+       <xsl:choose>
+       <xsl:when test="$uri != ''">
+        <a href="{$uri}">|</a>
+       </xsl:when>
+       <xsl:otherwise>
+        |
+       </xsl:otherwise>
+       </xsl:choose>
        <xsl:apply-templates select="*[2]" mode="inline"/>
-       <a href="{*[1]/@definitionURL}">|</a>
+       <xsl:choose>
+       <xsl:when test="$uri != ''">
+        <a href="{$uri}">|</a>
+       </xsl:when>
+       <xsl:otherwise>
+        |
+       </xsl:otherwise>
+       </xsl:choose>
       </xsl:when>
  
       <!-- boolean algebra of redexes -->
       <!-- isomorphic -->
       <xsl:when test="$name='isomorphic'">
        <xsl:apply-templates select="*[2]" mode="inline"/>
-       <a href="{*[1]/@definitionURL}">
-        <FONT color="green" FACE="symbol">
-        <xsl:text>&#x0040;</xsl:text>
-       </FONT>
-       </a>
+       <xsl:choose>
+       <xsl:when test="$uri != ''">
+        <a href="{$uri}">
+         <xsl:call-template name="mksymbol-1">
+          <xsl:with-param name="symbol" select="$name"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+        </a>
+       </xsl:when>
+       <xsl:otherwise>
+         <xsl:call-template name="mksymbol-1">
+          <xsl:with-param name="symbol" select="$name"/>
+          <xsl:with-param name="color" select="'green'"/>
+          <xsl:with-param name="size" select="'+0'"/>
+         </xsl:call-template>
+       </xsl:otherwise>
+       </xsl:choose>
        <xsl:apply-templates select="*[3]" mode="inline"/>
       </xsl:when>
 
  </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"/> 
@@ -1577,8 +2125,43 @@ CONJECTURES:
       <xsl:call-template name="make_indent">
        <xsl:with-param name="current_indent" select="$current_indent + 8"/> 
       </xsl:call-template>
-      <xsl:value-of select="./@no"/> : 
-      <xsl:apply-templates select="./*[1]">
+      <xsl:for-each select="Decl|Def|Hidden">
+       <xsl:choose>
+        <xsl:when test="name(.)='Decl'">
+         <xsl:choose>
+          <xsl:when test="@name">
+           <xsl:value-of select="@name"/>
+          </xsl:when>
+          <xsl:otherwise>
+           <xsl:text>_</xsl:text>
+          </xsl:otherwise>
+         </xsl:choose>
+         <xsl:text> : </xsl:text>
+         <xsl:apply-templates select="./*[1]">
+          <xsl:with-param name="current_indent" select="$current_indent"/>
+         </xsl:apply-templates>
+        </xsl:when>
+        <xsl:when test="name(.)='Def'">
+         <xsl:choose>
+          <xsl:when test="@name">
+           <xsl:value-of select="@name"/>
+          </xsl:when>
+          <xsl:otherwise>
+           <xsl:text>_</xsl:text>
+          </xsl:otherwise>
+         </xsl:choose>
+         <xsl:text> := </xsl:text>
+         <xsl:apply-templates select="./*[1]">
+          <xsl:with-param name="current_indent" select="$current_indent"/>
+         </xsl:apply-templates>
+        </xsl:when>
+        <xsl:otherwise>
+         <xsl:text> _ :? _ </xsl:text>
+        </xsl:otherwise>
+       </xsl:choose>
+      </xsl:for-each>
+      |- <xsl:value-of select="./@no"/> : 
+      <xsl:apply-templates select="./Goal/*[1]">
        <xsl:with-param name="current_indent" select="$current_indent + 11"/>
       </xsl:apply-templates>
       </xsl:for-each> 
@@ -1658,6 +2241,12 @@ VARIABLE <xsl:value-of select="@name"/><br/>
 TYPE = <xsl:apply-templates select="type/*[1]">
           <xsl:with-param name="current_indent" select="$current_indent + 7"/>
        </xsl:apply-templates>
+<xsl:if test="body">
+<br/>
+BODY = <xsl:apply-templates select="body/*[1]">
+          <xsl:with-param name="current_indent" select="$current_indent + 7"/>
+       </xsl:apply-templates>
+</xsl:if>
 </p>
 </xsl:template>