]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/style/contentlib.xsl
contentlib.xsl improved, now handles eq eqT
[helm.git] / helm / style / contentlib.xsl
index 6efe8d6c993476cca6bdbb24a660cf5f9424bda8..e923aa1c8309ba7af124a1bf8f0340d2f1154faa 100644 (file)
                               xmlns:helm="http://www.cs.unibo.it/helm"
                               xmlns:xlink="http://www.w3.org/1999/xlink">
 
-<xsl:template name="mkmml-op-noannot"> <!-- make MML node for operators (noannot mode) --> 
-   <xsl:param name="arity"/>           <!-- operator arity        -->
-   <xsl:param name="c-tag"/>           <!-- CIC    tag            -->
-   <xsl:param name="m-tag"/>           <!-- MathML tag            -->
+<xsl:template name="out-mml-op"> <!-- outputs MML nodes for operators -->
+   <xsl:param name="arity"/>     <!-- operator arity                  -->
+   <xsl:param name="c-tag"/>     <!-- CIC    tag                      -->
+   <xsl:param name="m-tag"/>     <!-- MathML tag                      -->
+   <xsl:param name="mbody"/>     <!-- other sons of m:apply           -->
    <xsl:choose>
       <xsl:when test="count(child::*) = $arity + 1">
          <m:apply helm:xref="{@id}">
@@ -49,7 +50,7 @@
                   <xsl:value-of select="$c-tag/@id"/>
                </xsl:attribute>
             </xsl:element>
-            <xsl:apply-templates select="*[position() > 1]" mode="noannot"/>
+            <xsl:copy-of select="$mbody"/>
          </m:apply>
       </xsl:when>
       <xsl:otherwise>
    </xsl:choose>
 </xsl:template>
 
+<!-- noannot -->
+
+<xsl:template name="mk-mml-op-noannot">    <!-- makes MML nodes for operators (noannot mode) --> 
+   <xsl:param name="arity"/>               <!-- operator arity        -->
+   <xsl:param name="c-tag"/>               <!-- CIC    tag            -->
+   <xsl:param name="m-tag"/>               <!-- MathML tag            -->
+   <xsl:param name="rnset" 
+              select="*[position() > 1]"/> <!-- nodes for recursion   -->
+   <xsl:variable name="mbody">
+      <xsl:apply-templates select="$rnset" mode="noannot"/>
+   </xsl:variable>
+   <xsl:call-template name="out-mml-op">
+      <xsl:with-param name="arity" select="$arity"/>
+      <xsl:with-param name="c-tag" select="$c-tag"/>
+      <xsl:with-param name="m-tag" select="$m-tag"/>
+      <xsl:with-param name="mbody" select="$mbody"/>
+   </xsl:call-template>
+</xsl:template>
+
+<!-- interp -->
+
 <xsl:template name="start-interp"> <!-- interp mode starter -->
    <xsl:param name="rtree"/>
    <xsl:param name="atree"/>   
    </m:apply>
 </xsl:template>
 
-<xsl:template name="mkmml-op-interp"> <!-- make MML node for operators (interp mode) --> 
-   <xsl:param name="arity"/>          <!-- operator arity        -->
-   <xsl:param name="c-tag"/>          <!-- CIC    tag            -->
-   <xsl:param name="m-tag"/>          <!-- MathML tag            -->
-   <xsl:param name="atree"/>          <!-- abstract tree pointer -->
-   <xsl:choose>
-      <xsl:when test="count(child::*) = $arity + 1">
-         <m:apply helm:xref="{@id}">
-            <xsl:element name="{concat('m:',$m-tag)}">
-               <xsl:attribute name="definitionURL">
-                  <xsl:value-of select="$c-tag/@uri"/> 
-               </xsl:attribute>
-               <xsl:attribute name="helm:xref">
-                  <xsl:value-of select="$c-tag/@id"/>
-               </xsl:attribute>
-            </xsl:element>
-            <xsl:apply-templates select="*[position() > 1]" mode="interp">
-              <xsl:with-param name="atree" select="$atree"/>
-           </xsl:apply-templates>
-         </m:apply>
-      </xsl:when>
-      <xsl:otherwise>
-         <xsl:apply-imports/>
-      </xsl:otherwise>
-   </xsl:choose>
+<xsl:template name="mk-mml-op-interp"> <!-- make MML node for operators (interp mode) --> 
+   <xsl:param name="arity"/>           <!-- operator arity        -->
+   <xsl:param name="c-tag"/>           <!-- CIC    tag            -->
+   <xsl:param name="m-tag"/>           <!-- MathML tag            -->
+   <xsl:param name="atree"/>           <!-- abstract tree pointer -->
+   <xsl:variable name="mbody">
+      <xsl:apply-templates select="*[position() > 1]" mode="interp">
+         <xsl:with-param name="atree" select="$atree"/>
+      </xsl:apply-templates>
+   </xsl:variable>
+   <xsl:call-template name="out-mml-op">
+      <xsl:with-param name="arity" select="$arity"/>
+      <xsl:with-param name="c-tag" select="$c-tag"/>
+      <xsl:with-param name="m-tag" select="$m-tag"/>
+      <xsl:with-param name="mbody" select="$mbody"/>
+   </xsl:call-template>
 </xsl:template>
 
 </xsl:stylesheet>