]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/style/mmlctop.xsl-0.14
Version 1.2.1beta => 1.2.1
[helm.git] / helm / style / mmlctop.xsl-0.14
index 4ab889155b1293fd5cfab544a816643e7889c290..be41c5be300c5eeeb5e5229a65019583bea9e639 100755 (executable)
 <!-- HELM: we don't have a default namespace.
      Removed xmlns="http://www.w3.org/1998/Math/MathML" -->
 
+<!-- HELM: was
 <xsl:output method="xml" indent="yes"/>
+-->
+<xsl:output method="xml"/>
+<!-- HELM -->
 
 <xsl:strip-space elements="apply semantics annotation-xml
         csymbol fn cn ci interval matrix matrixrow vector
@@ -299,8 +303,10 @@ LINEAR ALGEBRA
   <xsl:param name="PAREN" select="$PAR_NO"/>
   <xsl:param name="PAR_NO_IGNORE" select="$YES"/>
 <!-- HELM: added -->
+<!-- CSC
 <xsl:choose>
   <xsl:when test="child::text()">
+-->
 <!-- HELM -->
   <xsl:choose>
     <xsl:when test=". &lt; 0 and $IN_PREC &gt; $NO_PREC and $PAREN=$PAR_NO
@@ -326,6 +332,7 @@ LINEAR ALGEBRA
     </xsl:otherwise>
   </xsl:choose>
 <!-- HELM: added -->
+<!--CSC
   </xsl:when>
   <xsl:otherwise>
    <m:mrow>
@@ -336,6 +343,7 @@ LINEAR ALGEBRA
    </m:mrow> 
   </xsl:otherwise>
  </xsl:choose>
+-->
 <!-- HELM -->
 </xsl:template>
 
@@ -420,9 +428,29 @@ LINEAR ALGEBRA
         <m:mn> <xsl:value-of select="@base"/> </m:mn>
       </m:msub>
    </xsl:when>
-    <xsl:otherwise>
+   <xsl:otherwise>
+<!--HELM: Was:
+ <m:mn> <xsl:apply-templates mode = "semantics"/> </m:mn>
+HELM: Now is: -->
+    <xsl:choose>
+     <xsl:when test="child::text() and not(*[1])">
       <m:mn> <xsl:apply-templates mode = "semantics"/> </m:mn>
-    </xsl:otherwise>
+     </xsl:when>
+     <xsl:otherwise>
+      <xsl:choose>
+       <xsl:when test="not(*[2])">
+        <xsl:copy-of select="*[1]"/>
+       </xsl:when>
+       <xsl:otherwise>
+        <m:mrow>
+         <xsl:copy-of select="*|text()"/>
+        </m:mrow>
+       </xsl:otherwise>
+      </xsl:choose>
+     </xsl:otherwise>
+    </xsl:choose>
+<!-- HELM -->
+   </xsl:otherwise>
   </xsl:choose>
 </xsl:template>
 
@@ -507,17 +535,38 @@ LINEAR ALGEBRA
         <m:mn> <xsl:value-of select="@base"/> </m:mn>
       </m:msub>
    </xsl:when>
-    <xsl:otherwise>
+   <xsl:otherwise>
+    <xsl:choose>
+     <xsl:when test="child::text() and not(*[1])">
       <m:mn m:xref="{@id}"> <xsl:apply-templates mode = "semantics"/> </m:mn>
-    </xsl:otherwise>
+     </xsl:when>
+     <xsl:otherwise>
+      <xsl:variable name="id" select="@id"/>
+      <xsl:choose>
+       <xsl:when test="not(*[2])">
+        <xsl:for-each select="*[1]">
+         <xsl:copy>
+          <xsl:attribute name="m:xref">
+           <xsl:value-of select="$id"/>
+          </xsl:attribute>
+          <xsl:copy-of select="@*|*"/>
+         </xsl:copy>
+        </xsl:for-each>
+       </xsl:when>
+       <xsl:otherwise>
+        <m:mrow m:xref="{$id}">
+         <xsl:copy-of select="*|text()"/>
+        </m:mrow>
+       </xsl:otherwise>
+      </xsl:choose>
+     </xsl:otherwise>
+    </xsl:choose>
+   </xsl:otherwise>
   </xsl:choose>
 </xsl:template>
 
 <!-- HELM: ci could not contain MAthML presentation -->
 <xsl:template match = "m:ci">
-<!-- HELM: added -->
-<xsl:choose>
-  <xsl:when test="child::text()">
 <!-- HELM -->
   <xsl:choose>
     <xsl:when test="@type='vector' or @type=matrix or @type=set">
@@ -564,21 +613,22 @@ LINEAR ALGEBRA
         </m:mrow>
       </xsl:if>
       <xsl:if test="not(*[2])">
+<!--HELM: Was:
         <xsl:apply-templates select="*[1]"/>
+HELM: Now is: -->
+        <xsl:variable name="id" select="@id"/>
+        <xsl:for-each select="*[1]">
+         <xsl:copy>
+          <xsl:attribute name="m:xref">
+           <xsl:value-of select="$id"/>
+          </xsl:attribute>
+         <xsl:copy-of select="@*|*"/>
+         </xsl:copy>
+        </xsl:for-each>
+<!-- HELM -->
       </xsl:if>
     </xsl:otherwise>
   </xsl:choose>
-<!-- HELM: added -->
-</xsl:when>
-  <xsl:otherwise>
-   <m:mrow>
-    <xsl:copy-of select="*"/>
-    <xsl:attribute name="m:xref">
-     <xsl:value-of select="@id"/>
-    </xsl:attribute>
-   </m:mrow> 
-  </xsl:otherwise>
- </xsl:choose>
 <!-- HELM -->
 </xsl:template>