]> matita.cs.unibo.it Git - helm.git/commitdiff
drop_coercions.xsl has been added
authorAndrea Asperti <andrea.asperti@unibo.it>
Mon, 18 Jun 2001 10:22:55 +0000 (10:22 +0000)
committerAndrea Asperti <andrea.asperti@unibo.it>
Mon, 18 Jun 2001 10:22:55 +0000 (10:22 +0000)
helm/style/drop_coercions.xsl [new file with mode: 0644]

diff --git a/helm/style/drop_coercions.xsl b/helm/style/drop_coercions.xsl
new file mode 100644 (file)
index 0000000..688d397
--- /dev/null
@@ -0,0 +1,134 @@
+<?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/.                                         -->
+
+<!--******************************************************************--> 
+<!-- Coercions                                                        -->
+<!-- First draft: March 20 2001, Andrea Asperti                       -->
+<!--******************************************************************-->
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<!-- ************************** LAMBDA ****************************** -->
+
+<xsl:param name="CICURI" select="''"/>
+<xsl:param name="getterURL" select="''"/>
+<xsl:variable name="absPath"><xsl:value-of select="$getterURL"/>getxml?uri=</xsl:variable>
+<xsl:include href="params.xsl"/>
+
+<!-- coercions -->
+
+<xsl:template match="APPLY[CONST[position()='1' and 
+         (@uri='cic:/Algebra/CSemiGroups/csg_crr.con' or 
+          @uri='cic:/Algebra/CMonoids/cm_crr.con' or
+          @uri='cic:/Algebra/CGroups/cg_crr.con' or
+          @uri='cic:/Algebra/CRings/cr_crr.con' or
+          @uri='cic:/Algebra/CFields/cf_crr.con' or
+          @uri='cic:/Algebra/COrdFields/cof_crr.con' or
+          @uri='cic:/Algebra/CReals/crl_crr.con')]]">
+  <xsl:apply-templates select="*[position()=last()]"/>
+</xsl:template>
+
+<xsl:template match="APPLY[CONST[position()='1' and 
+   @uri='cic:/Algebra/CSetoids/CSetoid_functions/csf_fun.con']]">
+     <xsl:variable name="no_params">
+      <xsl:call-template name="get_no_params">
+       <xsl:with-param name="first_uri" select="$CICURI"/>
+       <xsl:with-param name="second_uri" select="CONST[1]/@uri"/>
+      </xsl:call-template>
+     </xsl:variable>
+    <xsl:choose>
+     <xsl:when test="(count(child::*) - number($no_params)) = 3">
+      <xsl:choose>
+       <xsl:when test="name(*[2+$no_params])='APPLY'">
+        <APPLY id="{@id}" sort="{@sort}">
+         <xsl:apply-templates select="*[2+$no_params]/*"/>
+         <xsl:apply-templates select="*[3+$no_params]"/>
+        </APPLY>
+       </xsl:when>
+       <xsl:otherwise>
+        <APPLY id="{@id}" sort="{@sort}">
+         <xsl:apply-templates select="*[2+$no_params]"/>
+         <xsl:apply-templates select="*[3+$no_params]"/> 
+        </APPLY>
+       </xsl:otherwise>
+      </xsl:choose>
+     </xsl:when>
+     <xsl:otherwise>
+      <APPLY id="{@id}" sort="{@sort}">
+       <xsl:apply-templates select="*"/>
+      </APPLY>
+     </xsl:otherwise>
+    </xsl:choose>
+</xsl:template>
+
+<xsl:template match="APPLY[CONST[position()='1' and 
+   @uri='cic:/Algebra/CSetoids/CSetoid_functions/csbf_fun.con']]">
+     <xsl:variable name="no_params">
+      <xsl:call-template name="get_no_params">
+       <xsl:with-param name="first_uri" select="$CICURI"/>
+       <xsl:with-param name="second_uri" select="CONST[1]/@uri"/>
+      </xsl:call-template>
+     </xsl:variable>
+    <xsl:choose>
+     <xsl:when test="(count(child::*) - number($no_params)) = 4">
+      <xsl:choose>
+       <xsl:when test="name(*[2+$no_params])='APPLY'">
+        <APPLY id="{@id}" sort="{@sort}">
+         <xsl:apply-templates select="*[2+$no_params]/*"/>
+         <xsl:apply-templates select="*[3+$no_params]"/>
+         <xsl:apply-templates select="*[4+$no_params]"/>
+        </APPLY>
+       </xsl:when>
+       <xsl:otherwise>
+        <APPLY id="{@id}" sort="{@sort}">
+         <xsl:apply-templates select="*[2+$no_params]"/>
+         <xsl:apply-templates select="*[3+$no_params]"/>
+         <xsl:apply-templates select="*[4+$no_params]"/>
+        </APPLY>
+       </xsl:otherwise>
+      </xsl:choose>
+     </xsl:when>
+     <xsl:otherwise>
+      <APPLY id="{@id}" sort="{@sort}">
+       <xsl:apply-templates select="*"/>
+      </APPLY>
+     </xsl:otherwise>
+    </xsl:choose>
+</xsl:template>
+
+
+<xsl:template match = "/|*">
+  <xsl:copy>
+   <xsl:copy-of select="@*"/>
+   <xsl:apply-templates select="*"/>
+  </xsl:copy>
+</xsl:template>
+
+
+</xsl:stylesheet>
+
+
+
+