]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/style/reals.xsl
...
[helm.git] / helm / style / reals.xsl
index 5f111875a028c4b76a96f04a3f00b73222b7fb43..09fd63ac28a53a759e82146c82b6ded17b233116 100644 (file)
@@ -32,8 +32,7 @@
 
 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                               xmlns:m="http://www.w3.org/1998/Math/MathML"
-                              xmlns:helm="http://www.cs.unibo.it/helm"
-                              xmlns:xlink="http://www.w3.org/1999/xlink">
+                              xmlns:helm="http://www.cs.unibo.it/helm">
 
 
 <!-- ************************* LOGIC *********************************-->
 
 <!-- Unary Operations and power -->
 
-<xsl:template match="APPLY[CONST[
- attribute::uri='cic:/Coq/Reals/Rdefinitions/Ropp.con' or
- attribute::uri='cic:/Coq/Reals/Rbasic_fun/Rabsolu.con' or
- attribute::uri='cic:/Coq/Reals/Rfunctions/fact.con' or
- attribute::uri='cic:/Coq/Reals/Rbase/Rsqr.con']]" mode="pure">
-    <xsl:choose>
-     <xsl:when test="count(child::*) = 2">
-      <xsl:variable name="elem">
-       <xsl:choose>
-        <xsl:when test="CONST/@uri='cic:/Coq/Reals/Rdefinitions/Ropp.con'">
-         <xsl:value-of select="'minus'"/>
-        </xsl:when>
-        <xsl:when test="CONST/@uri='cic:/Coq/Reals/Rbasic_fun/Rabsolu.con'">
-         <xsl:value-of select="'abs'"/>
-        </xsl:when>
-        <xsl:when test="CONST/@uri='cic:/Coq/Reals/Rfunctions/fact.con'">
-         <xsl:value-of select="'factorial'"/>
-        </xsl:when>
-        <xsl:when test="CONST/@uri='cic:/Coq/Reals/Rbase/Rsqr.con'">
-         <xsl:value-of select="'power'"/>
-        </xsl:when>
-       </xsl:choose>
-      </xsl:variable>
-      <m:apply helm:xref="{@id}">
-       <xsl:element name="{concat('m:',$elem)}">
-        <xsl:attribute name="definitionURL">
-         <xsl:value-of select="CONST/@uri"/> 
-        </xsl:attribute>
-        <xsl:attribute name="helm:xref">
-         <xsl:value-of select="CONST/@id"/>
-        </xsl:attribute>
-       </xsl:element>
-       <xsl:apply-templates select="*[2]" mode="noannot"/>
-       <xsl:if test="string($elem)='power'">
-        <m:cn><xsl:value-of select="*[2]/@value"/></m:cn>
-       </xsl:if>
-      </m:apply>
-     </xsl:when>
-     <xsl:otherwise>
-      <xsl:apply-imports/>
-     </xsl:otherwise>
-    </xsl:choose>
+<xsl:template match="APPLY[CONST/@uri='cic:/Coq/Reals/Rdefinitions/Ropp.con']" mode="pure">
+   <xsl:call-template name="mk-mml-op-noannot">
+      <xsl:with-param name="arity" select="1"/>
+      <xsl:with-param name="c-tag" select="CONST"/>
+      <xsl:with-param name="m-tag" select="'minus'"/>
+   </xsl:call-template>
 </xsl:template>
 
-<xsl:template match="APPLY[CONST[
- attribute::uri='cic:/Coq/Reals/Rdefinitions/Rinv.con']]" mode="pure">
-    <xsl:choose>
-     <xsl:when test="count(child::*) = 2">
-      <m:apply helm:xref="{@id}">
-       <m:power/>
-       <xsl:apply-templates select="*[2]" mode="noannot"/>
-       <m:apply>
-        <m:minus>
-         <xsl:attribute name="definitionURL">
-          <xsl:value-of select="CONST/@uri"/> 
-         </xsl:attribute>
-         <xsl:attribute name="helm:xref">
-          <xsl:value-of select="CONST/@id"/>
-         </xsl:attribute>
-        </m:minus>
-        <m:cn>1</m:cn>
-       </m:apply>
-      </m:apply>
-     </xsl:when>
-     <xsl:otherwise>
-      <xsl:apply-imports/>
-     </xsl:otherwise>
-    </xsl:choose>
+<xsl:template match="APPLY[CONST/@uri='cic:/Coq/Reals/Rbasic_fun/Rabsolu.con']" mode="pure">
+   <xsl:call-template name="mk-mml-op-noannot">
+      <xsl:with-param name="arity" select="1"/>
+      <xsl:with-param name="c-tag" select="CONST"/>
+      <xsl:with-param name="m-tag" select="'abs'"/>
+   </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="APPLY[CONST/@uri='cic:/Coq/Reals/Rfunctions/fact.con']" mode="pure">
+   <xsl:call-template name="mk-mml-op-noannot">
+      <xsl:with-param name="arity" select="1"/>
+      <xsl:with-param name="c-tag" select="CONST"/>
+      <xsl:with-param name="m-tag" select="'factorial'"/>
+   </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="APPLY[CONST/@uri='cic:/Coq/Reals/Rbase/Rsqr.con']" mode="pure">
+   <xsl:variable name="mbody">
+      <xsl:apply-templates select="*[2]" mode="noannot"/>
+      <m:cn>2</m:cn>
+   </xsl:variable>
+   <xsl:call-template name="out-mml-op">
+      <xsl:with-param name="arity" select="1"/>
+      <xsl:with-param name="c-tag" select="CONST"/>
+      <xsl:with-param name="m-tag" select="'power'"/>
+      <xsl:with-param name="mbody" select="$mbody"/>
+   </xsl:call-template>
+</xsl:template>
+
+<xsl:template match="APPLY[CONST/@uri='cic:/Coq/Reals/Rdefinitions/Rinv.con']" mode="pure">
+   <xsl:variable name="mbody1">
+      <xsl:apply-templates select="*[2]" mode="noannot"/>
+      <xsl:variable name="mbody2">
+         <m:cn>1</m:cn>
+      </xsl:variable>
+      <xsl:call-template name="out-mml-op">
+         <xsl:with-param name="arity" select="1"/>
+         <xsl:with-param name="c-tag" select="CONST"/>
+         <xsl:with-param name="m-tag" select="'minus'"/>
+         <xsl:with-param name="mbody" select="$mbody2"/>
+      </xsl:call-template>
+   </xsl:variable>
+   <xsl:call-template name="out-mml-op">
+      <xsl:with-param name="arity" select="1"/>
+      <xsl:with-param name="c-tag" select="CONST"/>
+      <xsl:with-param name="m-tag" select="'power'"/>
+      <xsl:with-param name="mbody" select="$mbody1"/>
+   </xsl:call-template>
 </xsl:template>
 
 <!-- Binary Operations and Relations -->
 
 <xsl:template match="APPLY[CONST/@uri='cic:/Coq/Reals/Rdefinitions/Rle.con']" mode="pure">
-   <xsl:call-template name="mkmml-op-noannot">
+   <xsl:call-template name="mk-mml-op-noannot">
       <xsl:with-param name="arity" select="2"/>
       <xsl:with-param name="c-tag" select="CONST"/>
       <xsl:with-param name="m-tag" select="'leq'"/>
 </xsl:template>
 
 <xsl:template match="APPLY[CONST/@uri='cic:/Coq/Reals/Rdefinitions/Rlt.con']" mode="pure">
-   <xsl:call-template name="mkmml-op-noannot">
+   <xsl:call-template name="mk-mml-op-noannot">
       <xsl:with-param name="arity" select="2"/>
       <xsl:with-param name="c-tag" select="CONST"/>
       <xsl:with-param name="m-tag" select="'lt'"/>
 </xsl:template>
 
 <xsl:template match="APPLY[CONST/@uri='cic:/Coq/Reals/Rdefinitions/Rge.con']" mode="pure">
-   <xsl:call-template name="mkmml-op-noannot">
+   <xsl:call-template name="mk-mml-op-noannot">
       <xsl:with-param name="arity" select="2"/>
       <xsl:with-param name="c-tag" select="CONST"/>
       <xsl:with-param name="m-tag" select="'geq'"/>
 </xsl:template>
 
 <xsl:template match="APPLY[CONST/@uri='cic:/Coq/Reals/Rdefinitions/Rgt.con']" mode="pure">
-   <xsl:call-template name="mkmml-op-noannot">
+   <xsl:call-template name="mk-mml-op-noannot">
       <xsl:with-param name="arity" select="2"/>
       <xsl:with-param name="c-tag" select="CONST"/>
       <xsl:with-param name="m-tag" select="'gt'"/>
 </xsl:template>
 
 <xsl:template match="APPLY[CONST/@uri='cic:/Coq/Reals/Rdefinitions/Rplus.con']" mode="pure">
-   <xsl:call-template name="mkmml-op-noannot">
+   <xsl:call-template name="mk-mml-op-noannot">
       <xsl:with-param name="arity" select="2"/>
       <xsl:with-param name="c-tag" select="CONST"/>
       <xsl:with-param name="m-tag" select="'plus'"/>
 </xsl:template>
 
 <xsl:template match="APPLY[CONST/@uri='cic:/Coq/Reals/Rdefinitions/Rminus.con']" mode="pure">
-   <xsl:call-template name="mkmml-op-noannot">
+   <xsl:call-template name="mk-mml-op-noannot">
       <xsl:with-param name="arity" select="2"/>
       <xsl:with-param name="c-tag" select="CONST"/>
       <xsl:with-param name="m-tag" select="'minus'"/>
 </xsl:template>
 
 <xsl:template match="APPLY[CONST/@uri='cic:/Coq/Reals/Rdefinitions/Rmult.con']" mode="pure">
-   <xsl:call-template name="mkmml-op-noannot">
+   <xsl:call-template name="mk-mml-op-noannot">
       <xsl:with-param name="arity" select="2"/>
       <xsl:with-param name="c-tag" select="CONST"/>
       <xsl:with-param name="m-tag" select="'times'"/>
 </xsl:template>
 
 <xsl:template match="APPLY[CONST/@uri='cic:/Coq/Reals/Rdefinitions/Rdiv.con']" mode="pure">
-   <xsl:call-template name="mkmml-op-noannot">
+   <xsl:call-template name="mk-mml-op-noannot">
       <xsl:with-param name="arity" select="2"/>
       <xsl:with-param name="c-tag" select="CONST"/>
       <xsl:with-param name="m-tag" select="'divide'"/>
 </xsl:template>
 
 <xsl:template match="APPLY[CONST/@uri='cic:/Coq/Reals/Rbasic_fun/Rmin.con']" mode="pure">
-   <xsl:call-template name="mkmml-op-noannot">
+   <xsl:call-template name="mk-mml-op-noannot">
       <xsl:with-param name="arity" select="2"/>
       <xsl:with-param name="c-tag" select="CONST"/>
       <xsl:with-param name="m-tag" select="'min'"/>
 </xsl:template>
 
 <xsl:template match="APPLY[CONST/@uri='cic:/Coq/Reals/Rbasic_fun/Rmax.con']" mode="pure">
-   <xsl:call-template name="mkmml-op-noannot">
+   <xsl:call-template name="mk-mml-op-noannot">
       <xsl:with-param name="arity" select="2"/>
       <xsl:with-param name="c-tag" select="CONST"/>
       <xsl:with-param name="m-tag" select="'max'"/>
 </xsl:template>
 
 <xsl:template match="APPLY[CONST/@uri='cic:/Coq/Reals/Rfunctions/pow.con']" mode="pure">
-   <xsl:call-template name="mkmml-op-noannot">
+   <xsl:call-template name="mk-mml-op-noannot">
       <xsl:with-param name="arity" select="2"/>
       <xsl:with-param name="c-tag" select="CONST"/>
       <xsl:with-param name="m-tag" select="'power'"/>
 </xsl:template>
 
 </xsl:stylesheet>
-
-