]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/style/mmlextension.xsl
Modified Files:
[helm.git] / helm / style / mmlextension.xsl
index 9113ba51c2a1643c2a0b3aee6e53a82d32c921ab..f9dcfae51b6dd0ee8cb0809ad77fd7398982ea7a 100644 (file)
 <!-- CSYMBOL -->
 
 <xsl:template match="m:apply[m:csymbol]">
+<xsl:param name="nopar" select="1"/>
     <xsl:variable name="name"><xsl:value-of select="m:csymbol"/></xsl:variable>
     <xsl:variable name="charlength"><xsl:apply-templates select="m:csymbol" mode="charcount"/></xsl:variable>
     <m:mrow>
          <m:mtr>
           <m:mtd>
            <m:mrow>
-            <m:mo stretchy="false">(</m:mo>
-            <xsl:apply-templates select="*[position()=2]"/>
+            <xsl:if test="$nopar=0">
+             <m:mo stretchy="false">(</m:mo>
+            </xsl:if>
+            <xsl:apply-templates select="*[position()=2]"><xsl:with-param name="nopar" select="0"/></xsl:apply-templates>
            </m:mrow>
           </m:mtd>
          </m:mtr>
           <m:mtd>
            <m:mrow>
             <m:mo mathmathcolor="Blue">&#x2192;</m:mo>
-            <xsl:apply-templates select="*[position()=3]"/>
+            <xsl:choose>
+            <xsl:when test="*[position()=3]/m:csymbol">
+             <xsl:variable name="nextp"><xsl:value-of select="*[position()=3]/m:csymbol"/></xsl:variable>
+             <xsl:choose>
+             <xsl:when test="$nextp='arrow'">
+              <xsl:apply-templates select="*[position()=3]"><xsl:with-param name="nopar" select="1"/></xsl:apply-templates>
+             </xsl:when>
+             <xsl:otherwise>
+              <xsl:apply-templates select="*[position()=3]"><xsl:with-param name="nopar" select="0"/></xsl:apply-templates>
+             </xsl:otherwise>
+             </xsl:choose>
+            </xsl:when>
+            <xsl:otherwise>
+             <xsl:apply-templates select="*[position()=3]"><xsl:with-param name="nopar" select="0"/></xsl:apply-templates>
+            </xsl:otherwise>
+            </xsl:choose>
            </m:mrow>
           </m:mtd>
          </m:mtr>
+         <xsl:if test="$nopar=0">
          <m:mtr>
           <m:mtd>
            <m:mrow>
            </m:mrow>
           </m:mtd>
          </m:mtr>
+         </xsl:if>
         </m:mtable>
        </xsl:when>
        <xsl:otherwise>
-        <m:mo stretchy="false">(</m:mo>
-        <xsl:apply-templates select="*[position()=2]"/>
+        <xsl:if test="$nopar=0">
+         <m:mo stretchy="false">(</m:mo>
+        </xsl:if>
+        <xsl:apply-templates select="*[position()=2]"><xsl:with-param name="nopar" select="0"/></xsl:apply-templates>
         <m:mo mathcolor="Blue">&#x2192;</m:mo>
-        <xsl:apply-templates select="*[position()=3]"/>
-        <m:mo stretchy="false">)</m:mo>
+        <xsl:choose>
+        <xsl:when test="*[position()=3]/m:csymbol">
+         <xsl:variable name="nextp"><xsl:value-of select="*[position()=3]/m:csymbol"/></xsl:variable>
+         <xsl:choose>
+         <xsl:when test="$nextp='arrow'">
+          <xsl:apply-templates select="*[position()=3]"><xsl:with-param name="nopar" select="1"/></xsl:apply-templates>
+         </xsl:when>
+         <xsl:otherwise>
+          <xsl:apply-templates select="*[position()=3]"><xsl:with-param name="nopar" select="0"/></xsl:apply-templates>
+         </xsl:otherwise>
+         </xsl:choose>
+        </xsl:when>
+        <xsl:otherwise>
+         <xsl:apply-templates select="*[position()=3]"><xsl:with-param name="nopar" select="0"/></xsl:apply-templates>
+        </xsl:otherwise>
+        </xsl:choose>
+        <xsl:if test="$nopar=0">
+         <m:mo stretchy="false">)</m:mo>
+        </xsl:if>
        </xsl:otherwise>
        </xsl:choose>
       </xsl:when>
 </xsl:stylesheet> 
 
 
+