]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/style/annotatedcont.xsl
- the mathql interpreter is not helm-dependent any more
[helm.git] / helm / style / annotatedcont.xsl
index e97d08f2be48eba80abf8c93fea3a816631272b8..97f259d673e521972975164affd40fcdd855be50 100644 (file)
@@ -1,5 +1,29 @@
 <?xml version="1.0"?>
 
+<!-- Copyright (C) 2000, HELM Team                                     -->
+<!--                                                                   -->
+<!-- This file is part of HELM, an Hypertextual, Electronic            -->
+<!-- Library of Mathematics, developed at the Computer Science         -->
+<!-- Department, University of Bologna, Italy.                         -->
+<!--                                                                   -->
+<!-- HELM is free software; you can redistribute it and/or             -->
+<!-- modify it under the terms of the GNU General Public License       -->
+<!-- as published by the Free Software Foundation; either version 2    -->
+<!-- of the License, or (at your option) any later version.            -->
+<!--                                                                   -->
+<!-- HELM is distributed in the hope that it will be useful,           -->
+<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of    -->
+<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     -->
+<!-- GNU General Public License for more details.                      -->
+<!--                                                                   -->
+<!-- You should have received a copy of the GNU General Public License -->
+<!-- along with HELM; if not, write to the Free Software               -->
+<!-- Foundation, Inc., 59 Temple Place - Suite 330, Boston,            -->
+<!-- MA  02111-1307, USA.                                              -->
+<!--                                                                   -->
+<!-- For details, see the HELM World-Wide-Web page,                    -->
+<!-- http://cs.unibo.it/helm/.                                         -->
+
 <!--***********************************************************************--> 
 <!-- XSLT version 0.1 of annotated MathML content to MathML presentation:  -->
 <!-- First draft: March 29 2000, Claudio Sacerdoti Coen, Irene Schena      -->
 
 <xsl:import href="objcontent.xsl"/>
 
-<xsl:key name="id" use="@id" match="LAMBDA|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: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: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:choose>
 </xsl:template>
 
-<xsl:template match="LAMBDA|PROD|CAST|REL|SORT|APPLY|VAR|META|CONST|MUTIND|MUTCONSTRUCT|MUTCASE|FIX|COFIX">
+<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>