]> 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 6e7ff7ca510fec16a2887df9dddeadf81d974841..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="''"/>
      <FONT color="red">CASE </FONT>
      <xsl:apply-templates mode="inline" select="*[position()=3]"/>
      <FONT color="red"> OF </FONT>
-<xsl:for-each select="piecewise/piece">
+     <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="./*[2]"/>
+      <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: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:with-param name="current_indent" select="$current_indent + 8"/>
          </xsl:apply-templates>
          <xsl:text> OF </xsl:text> 
-         <xsl:for-each select="piecewise/piece">
+         <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 + 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]">
@@ -2000,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> 
@@ -2081,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>