<!-- 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">→</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">→</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>
+