]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/style/content.xsl
Performance improvements and bug fixed
[helm.git] / helm / style / content.xsl
index ae4a1a812c27c94909f768f3a1e42f42296ba423..d36e0152aef666a62880876ec6f8b02d043dbaa1 100644 (file)
            media-type="text/mathml" /> -->
 
 <!-- DA FARE: 
-1)risolvere nella fase di pre-processing le uri relative, settando l'attributo
+1)risolvere nella fase di pre-processing le uri relative delle var, settando 
+l'attributo
 definitionURL dell'oggetto corrispondente (alcuni punteranno a nulla! -quelli 
 che non hanno il file di definizione corrispondente-); [le uri assolute hanno
 la forma cic:/.../ in definitionURL e questo schema di uri verra' risolto da
 Amaya o da chi di dovere in /really_very_local/helm/PARSER/example/.../]
-2)aggiungere nei file xml gli ID, affinche' nello stylesheet si setti
-l'attributo xref di ogni oggetto per puntare (tramite ID) al suo corrispondente
-della rappresentazione interna. 
 -->
 
 <!--******************************************************************-->
 <!-- Variable containing the absolute path of the CIC file            -->
 <!--******************************************************************-->
 
-<xsl:variable name="absPath">http://localhost:8081/get?url=</xsl:variable>
+<xsl:variable name="absPath">http://localhost:8081/getciconly?uri=</xsl:variable>
 
 <!-- CIC TERMS -->
 
@@ -47,7 +45,7 @@ della rappresentazione interna.
     <m:lambda helm:xref="{@id}">
      <m:bvar>
       <m:ci>
-       <xsl:value-of select="target/@binder"/>
+       <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="target/@binder"/></xsl:with-param></xsl:call-template>
       </m:ci>
       <m:type>
        <xsl:apply-templates select="source/*[1]" mode="noannot"/>
@@ -65,10 +63,17 @@ della rappresentazione interna.
       <xsl:apply-templates select="source/*[1]" mode="noannot"/>
      </xsl:when>
      <xsl:otherwise>
-      <m:csymbol>prod</m:csymbol>
+      <xsl:choose>
+       <xsl:when test="@type = 'Prop'">
+        <m:csymbol>forall</m:csymbol>
+       </xsl:when>
+       <xsl:otherwise>
+        <m:csymbol>prod</m:csymbol>
+       </xsl:otherwise>
+      </xsl:choose>
        <m:bvar>
         <m:ci>
-         <xsl:value-of select="target/@binder"/>
+         <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="target/@binder"/></xsl:with-param></xsl:call-template>
         </m:ci>
         <m:type>
          <xsl:apply-templates select="source/*[1]" mode="noannot"/>
@@ -89,7 +94,7 @@ della rappresentazione interna.
 
 <xsl:template match="REL" mode="pure">
     <m:ci helm:xref="{@id}">
-     <xsl:value-of select="@binder"/>
+     <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="@binder"/></xsl:with-param></xsl:call-template>
     </m:ci>
 </xsl:template>
 
@@ -103,17 +108,18 @@ della rappresentazione interna.
 
 <xsl:template match="APPLY" mode="pure">
    <xsl:choose>
-    <!-- <xsl:when test="//ALLTYPES and boolean(key('typeid',*/@id))"> -->
+    <!-- <xsl:when test="//InnerTypes and boolean(key('typeid',*/@id))"> -->
     <!-- start looking for subproofs -->
-    <xsl:when test="((*/@id) = (//ALLTYPES/TYPE/@id))"> 
+    <!-- <xsl:when test="((*/@id) = (//InnerTypes/TYPE/@of))"> -->
+    <xsl:when test="//InnerTypes and count(*[@sort='Prop' and (name(.)='LAMBDA' or name(.)='LETIN' or name(.)='APPLY' or name(.)='MUTCASE' or name(.)='FIX' or name(.)='COFIX')]) > 0">
      <m:apply helm:xref="{@id}">
       <m:csymbol>letin</m:csymbol>
       <!-- <xsl:for-each select="*[boolean(key('typeid',@id))]"> -->
       <!-- first process all subproofs (let-in) -->
-      <xsl:for-each select="*[@id = (//ALLTYPES/TYPE/@id)]">
+      <xsl:for-each select="*[@id = (//InnerTypes/TYPE/@of)]">
        <m:apply>
         <m:csymbol>let</m:csymbol>
-        <m:ci><xsl:value-of select="concat('h',position())"/></m:ci>
+        <m:ci><xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="concat('h',position())"/></xsl:with-param></xsl:call-template></m:ci>
         <xsl:apply-templates mode="noannot" select="."/>
        </m:apply>
       </xsl:for-each>
@@ -137,26 +143,17 @@ della rappresentazione interna.
 
 <xsl:template match="*" mode="flat">
  <xsl:param name="n" select="1"/>
+ <xsl:variable name="id" select="@id"/>
  <xsl:choose>
-  <xsl:when test="@id">
-   <xsl:variable name="id" select="@id"/>
-   <xsl:choose>
-    <!-- <xsl:when test="key('typeid',@id)"> -->
-    <xsl:when test="//ALLTYPES/TYPE[@id=$id]">
-     <m:ci>
-      <xsl:value-of select="concat('h',$n)"/>
-     </m:ci>
-     <xsl:apply-templates mode="flat" select="following-sibling::*[1]">
-      <xsl:with-param name="n" select="$n+1"/>
-     </xsl:apply-templates>
-    </xsl:when>
-    <xsl:otherwise>
-     <xsl:apply-templates mode="pure" select="."/>
-     <xsl:apply-templates mode="flat" select="following-sibling::*[1]">
-      <xsl:with-param name="n" select="$n"/>
-     </xsl:apply-templates>
-    </xsl:otherwise>
-   </xsl:choose>
+  <!-- <xsl:when test="key('typeid',@id)"> -->
+  <!-- <xsl:when test="//InnerTypes/TYPE[@of=$id]"> -->
+  <xsl:when test="//InnerTypes and @sort='Prop' and (name(.)='LAMBDA' or name(.)='LETIN' or name(.)='APPLY' or name(.)='MUTCASE' or name(.)='FIX' or name(.)='COFIX')">
+   <m:ci>
+    <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="concat('h',$n)"/></xsl:with-param></xsl:call-template>
+   </m:ci>
+   <xsl:apply-templates mode="flat" select="following-sibling::*[1]">
+    <xsl:with-param name="n" select="$n+1"/>
+   </xsl:apply-templates>
   </xsl:when>
   <xsl:otherwise>
    <xsl:apply-templates mode="pure" select="."/>
@@ -169,21 +166,21 @@ della rappresentazione interna.
 
 <xsl:template match="VAR" mode="pure">
     <m:ci helm:xref="{@id}">
-     <xsl:value-of select="substring-after(@relUri,&quot;,&quot;)"/>
+     <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="substring-after(@relUri,&quot;,&quot;)"/></xsl:with-param></xsl:call-template>
     </m:ci>
 </xsl:template>
 
 <xsl:template match="META" mode="pure">
     <m:ci helm:xref="{@id}">
-     <xsl:value-of select="@no"/>
+     <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="@no"/></xsl:with-param></xsl:call-template>
     </m:ci>
 </xsl:template>
 
 <xsl:template match="CONST" mode="pure">
     <m:ci definitionURL="{@uri}" helm:xref="{@id}">
-     <xsl:call-template name="name_of_uri">
+     <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:call-template name="name_of_uri">
       <xsl:with-param name="uri" select="@uri"/>
-     </xsl:call-template>
+     </xsl:call-template></xsl:with-param></xsl:call-template>
      <!-- <xsl:value-of select="document(concat(string($absPath),@uri))/*/@name"/> -->
     </m:ci>
 </xsl:template>
@@ -191,7 +188,7 @@ della rappresentazione interna.
 <xsl:template match="MUTIND" mode="pure">
     <m:ci definitionURL="{@uri}" helm:xref="{@id}">
      <xsl:variable name="index"><xsl:value-of select="@noType"/></xsl:variable>
-     <xsl:value-of select="document(concat(string($absPath),@uri))/InductiveDefinition/InductiveType[position()=number($index)+1]/@name"/>
+     <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="document(concat(string($absPath),@uri))/InductiveDefinition/InductiveType[position()=number($index)+1]/@name"/></xsl:with-param></xsl:call-template>
     </m:ci>
 </xsl:template>
 
@@ -199,7 +196,7 @@ della rappresentazione interna.
     <m:ci definitionURL="{@uri}" helm:xref="{@id}">
      <xsl:variable name="Tindex"><xsl:value-of select="@noType"/></xsl:variable>
      <xsl:variable name="Cindex"><xsl:value-of select="@noConstr"/></xsl:variable>
-     <xsl:value-of select="document(concat(string($absPath),@uri))/InductiveDefinition/InductiveType[position()=number($Tindex)+1]/Constructor[position()=number($Cindex)]/@name"/>
+     <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="document(concat(string($absPath),@uri))/InductiveDefinition/InductiveType[position()=number($Tindex)+1]/Constructor[position()=number($Cindex)]/@name"/></xsl:with-param></xsl:call-template>
     </m:ci>
 </xsl:template>
 
@@ -217,14 +214,14 @@ della rappresentazione interna.
       <xsl:choose>
       <xsl:when test="$nopar = 0">
        <m:ci>
-        <xsl:value-of select="document(concat(string($absPath),$Turi))/InductiveDefinition/InductiveType[position()=number($Tindex)+1]/Constructor[position()=number($pos)]/@name"/>
+        <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="document(concat(string($absPath),$Turi))/InductiveDefinition/InductiveType[position()=number($Tindex)+1]/Constructor[position()=number($pos)]/@name"/></xsl:with-param></xsl:call-template>
        </m:ci>
       </xsl:when>
       <xsl:otherwise>
        <m:apply>
         <m:csymbol>app</m:csymbol>
         <m:ci>
-         <xsl:value-of select="document(concat(string($absPath),$Turi))/InductiveDefinition/InductiveType[position()=number($Tindex)+1]/Constructor[position()=number($pos)]/@name"/>
+         <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="document(concat(string($absPath),$Turi))/InductiveDefinition/InductiveType[position()=number($Tindex)+1]/Constructor[position()=number($pos)]/@name"/></xsl:with-param></xsl:call-template>
         </m:ci>
         <xsl:apply-templates select="./*[1]" mode="abstparams"><xsl:with-param name="noparams" select="$nopar"/><xsl:with-param name="binder">LAMBDA</xsl:with-param></xsl:apply-templates>
         </m:apply>
@@ -239,7 +236,7 @@ della rappresentazione interna.
     <m:apply helm:xref="{@id}">
      <xsl:variable name="findex"><xsl:value-of select="@noFun"/></xsl:variable>
      <m:csymbol>fix</m:csymbol>
-     <m:ci><xsl:value-of select="FixFunction[position()=number($findex)+1]/@name"/></m:ci>
+     <m:ci><xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="FixFunction[position()=number($findex)+1]/@name"/></xsl:with-param></xsl:call-template></m:ci>
      <xsl:apply-templates mode="pure" select="*"/>
     </m:apply>
 </xsl:template>
@@ -248,7 +245,7 @@ della rappresentazione interna.
    <m:apply helm:xref="{@id}">
      <xsl:variable name="findex"><xsl:value-of select="@noFun"/></xsl:variable>
      <m:csymbol>cofix</m:csymbol>
-     <m:ci><xsl:value-of select="CofixFunction[position()=number($findex)+1]/@name"/></m:ci>
+     <m:ci><xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="CofixFunction[position()=number($findex)+1]/@name"/></xsl:with-param></xsl:call-template></m:ci>
      <xsl:apply-templates mode="pure" select="*"/>
     </m:apply>
 </xsl:template>
@@ -257,7 +254,7 @@ della rappresentazione interna.
 
 <xsl:template match="FixFunction" mode="pure">
     <m:bvar>
-     <m:ci><xsl:value-of select="@name"/></m:ci>
+     <m:ci><xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="@name"/></xsl:with-param></xsl:call-template></m:ci>
      <m:type><xsl:apply-templates select="type/*[1]" mode="noannot"/></m:type>
     </m:bvar> 
     <xsl:apply-templates select="body/*[1]" mode="noannot"/>
@@ -265,10 +262,15 @@ della rappresentazione interna.
 
 <xsl:template match="CofixFunction" mode="pure">
     <m:bvar>
-     <m:ci><xsl:value-of select="@name"/></m:ci>
+     <m:ci><xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="@name"/></xsl:with-param></xsl:call-template></m:ci>
      <m:type><xsl:apply-templates select="type/*[1]" mode="noannot"/></m:type>
     </m:bvar> 
     <xsl:apply-templates select="body/*[1]" mode="noannot"/>
 </xsl:template>
 
 </xsl:stylesheet>
+
+
+
+
+