]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/style/mmlctop.xsl-0.14
Until Garrigue puts a META file in lablgtk, we can use this one.
[helm.git] / helm / style / mmlctop.xsl-0.14
index ade27944aa038424e6755b845ff74dd010aa0bfb..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,9 +535,33 @@ 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>