]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/style/drop_coercions.xsl
Brand new implementation based on functors taking a strategy in input.
[helm.git] / helm / style / drop_coercions.xsl
index f2bc44d0d7f43c2ec8e6a6f16c21a307de71a1f6..7b1316013c086a19e3192b25fed02e496fcc42fa 100644 (file)
 <!-- 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')]]">
+         (@uri='cic:/Algebra/algebra/CSemiGroups/csg_crr.con' or 
+          @uri='cic:/Algebra/algebra/CMonoids/cm_crr.con' or
+          @uri='cic:/Algebra/algebra/CGroups/cg_crr.con' or
+          @uri='cic:/Algebra/algebra/CRings/cr_crr.con' or
+          @uri='cic:/Algebra/algebra/CFields/cf_crr.con' or
+          @uri='cic:/Algebra/algebra/COrdFields/cof_crr.con' or
+          @uri='cic:/Algebra/reals/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']]">
+   @uri='cic:/Algebra/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"/>
@@ -84,7 +84,7 @@
 </xsl:template>
 
 <xsl:template match="APPLY[CONST[position()='1' and 
-   @uri='cic:/Algebra/CSetoids/CSetoid_functions/csbf_fun.con']]">
+   @uri='cic:/Algebra/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:template>
 
 <xsl:template match="APPLY[CONST[position()='1' and 
-   @uri='cic:/Algebra/CSetoids/CSetoid_relations_and_predicates/csr_rel.con']]">
+   @uri='cic:/Algebra/algebra/CSetoids/CSetoid_relations_and_predicates/csr_rel.con']]">
      <xsl:variable name="no_params">
       <xsl:call-template name="get_no_params">
        <xsl:with-param name="first_uri" select="$CICURI"/>
     </xsl:choose>
 </xsl:template>
 
+<xsl:template match="APPLY[CONST[position()='1' and 
+   @uri='cic:/Algebra/algebra/CRings/nat_injection/nring.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)) = 2">
+      <xsl:apply-templates select="*[2+$no_params]"/>
+     </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>