]> matita.cs.unibo.it Git - helm.git/commitdiff
Annotations now working again (even if in a bit trickier way).
authorClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Fri, 16 Mar 2001 17:27:33 +0000 (17:27 +0000)
committerClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Fri, 16 Mar 2001 17:27:33 +0000 (17:27 +0000)
The get method of the getter could now be safely removed... URRAH!

helm/style/annotatedcont.xsl
helm/style/content_to_html.xsl
helm/style/expandobj.xsl
helm/style/rootcontent.xsl

index 7d5a6d5b394f537b14a1923ff3b249d3256ecf5e..97f259d673e521972975164affd40fcdd855be50 100644 (file)
 
 <xsl:key name="id" use="@id" match="LAMBDA|LETIN|PROD|CAST|REL|SORT|APPLY|VAR|META|CONST|MUTIND|MUTCONSTRUCT|MUTCASE|FIX|COFIX|Definition|Axiom|CurrentProof|InductiveDefinition|Variable"/>
 
-<xsl:key name="annid" use="@of" match="Annotation"/>
-
 <xsl:template match="Definition|Axiom|CurrentProof|InductiveDefinition|Variable">
+    <xsl:variable name="id" select="@id"/>
     <xsl:choose>
-    <xsl:when test="key('annid',@id)">
+    <xsl:when test="$annotations='yes' and $CICAnnotations/Annotations/Annotation[@of=$id]">
      <annotation helm:xref="{@id}">
-      <xsl:apply-templates select="key('annid',@id)"/>
+      <xsl:apply-templates select="$CICAnnotations/Annotations/Annotation[@of=$id]"/>
      </annotation>
     </xsl:when>
     <xsl:otherwise>
 </xsl:template>
 
 <xsl:template match="LAMBDA|LETIN|PROD|CAST|REL|SORT|APPLY|VAR|META|CONST|MUTIND|MUTCONSTRUCT|MUTCASE|FIX|COFIX">
+    <xsl:variable name="id" select="@id"/>
     <xsl:choose>
-    <xsl:when test="key('annid',@id)">
+    <xsl:when test="$annotations='yes' and $CICAnnotations/Annotations/Annotation[@of=$id]">
      <annotation helm:xref="{@id}">
-      <xsl:apply-templates select="key('annid',@id)"/>
+      <xsl:apply-templates select="$CICAnnotations/Annotations/Annotation[@of=$id]"/>
      </annotation>
     </xsl:when>
     <xsl:otherwise>
     </xsl:choose>
 </xsl:template>
 
-<xsl:template match="node">
- <xsl:variable name="id" select="@id"/>
+<!-- The next two templates must be invoked with the context node -->
+<!-- belonging to the original document DOM tree                  -->
+
+<xsl:template mode="changecontextdocumentnode" match="*">
+ <xsl:param name="id" select="''"/>
  <xsl:apply-templates select="key('id',$id)"/>
 </xsl:template>
 
-<xsl:template match="attribute">
- <xsl:variable name="id" select="@id"/>
- <xsl:variable name="name" select="@name"/>
- <xsl:variable name="child" select="@child"/>
- <xsl:variable name="grandchild" select="@grandchild"/>
+<xsl:template mode="changecontextdocumentattribute" match="*">
+ <xsl:param name="id" select="''"/>
+ <xsl:param name="name" select="''"/>
+ <xsl:param name="child" select="''"/>
+ <xsl:param name="grandchild" select="''"/>
  <xsl:choose>
   <xsl:when test="$child">
    <xsl:choose>
  </xsl:choose>
 </xsl:template>
 
+<!-- $cicroot holds the root of the original document DOM tree  -->
+<!-- The next two templates are trampolines to the previous two -->
+<!-- that are used to change the context node to a node in the  -->
+<!-- document DOM tree of $cicroot                              -->
+
+<xsl:variable name="cicroot" select="/"/>
+
+<xsl:template match="node">
+ <xsl:apply-templates select="$cicroot/*[1]" mode="changecontextdocumentnode">
+  <xsl:with-param name="id" select="@id"/>
+ </xsl:apply-templates>
+</xsl:template>
+
+<xsl:template match="attribute">
+ <xsl:apply-templates select="$cicroot/*[1]" mode="changecontextdocumentattribute">
+  <xsl:with-param name="id" select="@id"/>
+  <xsl:with-param name="name" select="@name"/>
+  <xsl:with-param name="child" select="@child"/>
+  <xsl:with-param name="grandchild" select="@grandchild"/>
+ </xsl:apply-templates>
+</xsl:template>
+
 </xsl:stylesheet>
index 533cf22998ed1cceaa23e55e7f89644e601a0a00..74d6505bf71f1cf75f78d2149b5623677ae7890c 100644 (file)
 <xsl:param name="processorURL" select="'http://localhost:8080/helm/servlet/uwobo/'"/>
 <xsl:param name="keys" select="'C1,HC2'"/>
 <xsl:param name="naturalLanguage" select="'yes'"/>
+<xsl:param name="annotations" select="'no'"/>
 
 <xsl:variable name="absPath"><xsl:value-of select="$getterURL"/>getciconly?uri=</xsl:variable>
 
-<xsl:variable name="header"><xsl:value-of select="$processorURL"/>apply?keys=<xsl:value-of select="$keys"/>&#x26;param.naturalLanguage=<xsl:value-of select="$naturalLanguage"/>&#x26;param.keys=<xsl:value-of select="$keys"/>&#x26;param.getterURL=<xsl:value-of select="$getterURL"/>&#x26;param.processorURL=<xsl:value-of select="$processorURL"/>&#x26;xmluri=<xsl:value-of select="$absPath"/></xsl:variable>
+<xsl:variable name="header"><xsl:value-of select="$processorURL"/>apply?keys=<xsl:value-of select="$keys"/>&#x26;param.naturalLanguage=<xsl:value-of select="$naturalLanguage"/>&#x26;param.annotations=<xsl:value-of select="$annotations"/>&#x26;param.keys=<xsl:value-of select="$keys"/>&#x26;param.getterURL=<xsl:value-of select="$getterURL"/>&#x26;param.processorURL=<xsl:value-of select="$processorURL"/>&#x26;xmluri=<xsl:value-of select="$absPath"/></xsl:variable>
 
 <xsl:include href="html_init.xsl"/>
 <xsl:include href="html_set.xsl"/>
index d380be3ed63abb689ee61f2b3ef0118dcfdc766b..b42afa966a67baccc057586719d603d1c16a639e 100644 (file)
 <!-- Keys contains the keys of the stylesheets to be applied -->
 <xsl:param name="keys" select="'C1,C2'"/>
 <xsl:param name="naturalLanguage" select="'yes'"/>
+<xsl:param name="annotations" select="'no'"/>
 
 <xsl:variable name="absPath"><xsl:value-of select="$getterURL"/>getciconly?uri=</xsl:variable>
 
-<xsl:variable name="header"><xsl:value-of select="$processorURL"/>apply?keys=<xsl:value-of select="$keys"/>&#x26;param.naturalLanguage=<xsl:value-of select="$naturalLanguage"/>&#x26;param.keys=<xsl:value-of select="$keys"/>&#x26;param.getterURL=<xsl:value-of select="$getterURL"/>&#x26;param.processorURL=<xsl:value-of select="$processorURL"/>&#x26;xmluri=<xsl:value-of select="$absPath"/></xsl:variable>
+<xsl:variable name="header"><xsl:value-of select="$processorURL"/>apply?keys=<xsl:value-of select="$keys"/>&#x26;param.naturalLanguage=<xsl:value-of select="$naturalLanguage"/>&#x26;param.annotations=<xsl:value-of select="$annotations"/>&#x26;param.keys=<xsl:value-of select="$keys"/>&#x26;param.getterURL=<xsl:value-of select="$getterURL"/>&#x26;param.processorURL=<xsl:value-of select="$processorURL"/>&#x26;xmluri=<xsl:value-of select="$absPath"/></xsl:variable>
 
 <xsl:output 
        method="xml"
index e4bccecea65b0ee6b31b92c1f1ca1055dbef765a..34a97ab2db0cbb655823685c2c7bafc5be2ff702 100644 (file)
 
 <xsl:param name="getterURL" select="'http://localhost:8081/'"/>
 <xsl:param name="naturalLanguage" select="'yes'"/>
+<xsl:param name="annotations" select="'no'"/>
 <xsl:param name="CICURI" select="''"/>
 
 <xsl:variable name="absPath"><xsl:value-of select="$getterURL"/>getciconly?uri=</xsl:variable>
 
-<!-- WARNING: Using lazy evaluation: $CICURI.types may not exist, but -->
-<!-- document() is called only by need!!!                             -->
+<!-- WARNING: Using lazy evaluation: $CICURI.* may not exist, but -->
+<!-- document() is called only by need!!!                         -->
 <xsl:variable name="InnerTypes" select="document(concat($absPath,$CICURI,'.types'))"/>
+<xsl:variable name="CICAnnotations" select="document(concat($absPath,$CICURI,'.ann'))"/>
 
 <xsl:import href="annotatedcont.xsl"/>
-<xsl:key name="id" use="@id" match="LAMBDA|LETIN|PROD|CAST|REL|SORT|APPLY|VAR|META|CONST|MUTIND|MUTCONSTRUCT|MUTCASE|FIX|COFIX|Definition|Axiom|CurrentProof|InductiveDefinition|Variable"/>
+
 <xsl:include href="basic.xsl"/>
 <xsl:include href="set.xsl"/>
 <xsl:include href="reals.xsl"/>
 <xsl:include href="proofs.xsl"/>
 
 <xsl:variable name="showproof" select="0"/>
-</xsl:stylesheet>
-
-
 
+</xsl:stylesheet>