]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/DEVEL/mathml_editor/xsl/tml-mmlp.xsl
debian release 0.0.4-2:
[helm.git] / helm / DEVEL / mathml_editor / xsl / tml-mmlp.xsl
index 034c5073a1920e147d3b20f8f75573fa191279ae..7b225f0e3c1a2f15799e256d90c3634a7ef857db 100644 (file)
@@ -1,8 +1,36 @@
 <?xml version="1.0"?>
+
+<!--
+ This file is part of EdiTeX, an editor of mathematical
+ expressions based on TeX syntax.
+ Copyright (C) 2002-2003 Luca Padovani <lpadovan@cs.unibo.it>,
+                    2003 Paolo Marinelli <pmarinel@cs.unibo.it>.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+ For more information, please visit the project's home page
+ http://helm.cs.unibo.it/editex/
+ or send an email to <lpadovan@cs.unibo.it>
+-->
+
 <xsl:stylesheet
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
      xmlns:tml="http://helm.cs.unibo.it/2002/TML"
      xmlns:m="http://www.w3.org/1998/Math/MathML"
+     exclude-result-prefixes="tml"
      version="1.0">
 
   <xsl:output indent="yes"/>
     </m:mo>
   </xsl:template>
 
-  <xsl:template match="tml:cursor">
+  <xsl:template match="tml:o[@val='-']">
+    <m:mo>
+      <xsl:if test="@id">
+        <xsl:attribute name="xref">
+          <xsl:value-of select="@id"/>
+        </xsl:attribute>
+      </xsl:if>
+      &#x2212;
+    </m:mo>
+  </xsl:template>
+
+  <xsl:template match="tml:cursor[@visible='1']">
     <xsl:choose>
       <xsl:when test="substring(@val,1,1)='\'">
         <m:mrow>
       </xsl:when>
       <xsl:otherwise>
         <m:mtext mathcolor="blue">
-          <xsl:if test="@id">
-            <xsl:attribute name="xref">
-              <xsl:value-of select="@id"/>
-            </xsl:attribute>
-          </xsl:if>
-         <xsl:value-of select="@val"/>
-       </m:mtext>
+         <xsl:if test="@id">
+           <xsl:attribute name="xref">
+             <xsl:value-of select="@id"/>
+           </xsl:attribute>
+         </xsl:if><xsl:value-of select="@val"/>I</m:mtext>
       </xsl:otherwise>
     </xsl:choose>
   </xsl:template>
 
+  <xsl:template match="tml:cursor[not(@visible) or @visible='0']">
+  </xsl:template>
+
   <xsl:template match="tml:sb[@under='1'][*[1]/tml:sp[@over='1']]">
     <m:munderover>
       <xsl:if test="@id">
           <xsl:value-of select="@id"/>
         </xsl:attribute>
       </xsl:if>
-      <xsl:apply-templates select="*[2]"/>
-      <xsl:apply-templates select="*[1]"/>
+      <xsl:choose>
+        <xsl:when test="count(*) &lt; 2">
+         <m:mrow/>
+         <xsl:apply-templates select="*[1]"/>
+       </xsl:when>
+       <xsl:otherwise>
+          <xsl:apply-templates select="*[2]"/>
+          <xsl:apply-templates select="*[1]"/>
+       </xsl:otherwise>
+      </xsl:choose>
     </m:mroot>
   </xsl:template>
 
         </xsl:attribute>
       </xsl:if>
       <xsl:apply-templates select="*[1]"/>
+      <xsl:if test="tml:g/tml:cursor[@visible='1']">
+        <m:msub>
+          <m:mtext mathcolor="#808080">}</m:mtext>
+         <m:mtext><xsl:value-of select="@name"/></m:mtext>
+        </m:msub>
+      </xsl:if>
     </m:mstyle>
   </xsl:template>
 
     </m:mfrac>
   </xsl:template>
 
+  <xsl:template match="tml:c[@name='space']">
+    <m:mspace width="veryverythickmathspace">
+    </m:mspace>
+  </xsl:template>
+
 </xsl:stylesheet>