<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:m="http://www.w3.org/1998/Math/MathML"
- xmlns:helm="http://www.cs.unibo.it/helm"
- xmlns:xlink="http://www.w3.org/1999/xlink">
+ xmlns:helm="http://www.cs.unibo.it/helm">
-<xsl:template name="mk-mml-infix"> <!-- make MML node for infix operator -->
- <xsl:param name="c-tag"/> <!-- CIC tag -->
- <xsl:param name="m-tag"/> <!-- MathML tag -->
+<xsl:template name="out-mml-op"> <!-- outputs MML nodes for operators -->
+ <xsl:param name="hide" select="0"/> <!-- number of hidden parameters -->
+ <xsl:param name="arity"/> <!-- operator arity -->
+ <xsl:param name="c-tag"/> <!-- CIC tag -->
+ <xsl:param name="m-tag"/> <!-- MathML tag -->
+ <xsl:param name="mbody"/> <!-- other sons of m:apply -->
<xsl:choose>
- <xsl:when test="count(child::*) = 3">
+ <xsl:when test="count(child::*) = $arity + $hide + 1">
<m:apply helm:xref="{@id}">
<xsl:element name="{concat('m:',$m-tag)}">
<xsl:attribute name="definitionURL">
<xsl:value-of select="$c-tag/@id"/>
</xsl:attribute>
</xsl:element>
- <xsl:apply-templates select="*[2]" mode="noannot"/>
- <xsl:apply-templates select="*[3]" mode="noannot"/>
+ <xsl:copy-of select="$mbody"/>
</m:apply>
</xsl:when>
<xsl:otherwise>
</xsl:choose>
</xsl:template>
+<!-- noannot -->
+
+<xsl:template name="mk-mml-op-noannot"> <!-- makes MML nodes for operators (noannot mode) -->
+ <xsl:param name="hide"
+ select="0"/> <!-- hidden params -->
+ <xsl:param name="arity"
+ select="2"/> <!-- operator arity -->
+ <xsl:param name="c-tag"/> <!-- CIC tag -->
+ <xsl:param name="m-tag"/> <!-- MathML tag -->
+ <xsl:param name="rnset"
+ select="*[position() > 1 + $hide]"/> <!-- nodes for recursion -->
+ <xsl:variable name="mbody">
+ <xsl:apply-templates select="$rnset" mode="noannot"/>
+ </xsl:variable>
+ <xsl:call-template name="out-mml-op">
+ <xsl:with-param name="hide" select="$hide"/>
+ <xsl:with-param name="arity" select="$arity"/>
+ <xsl:with-param name="c-tag" select="$c-tag"/>
+ <xsl:with-param name="m-tag" select="$m-tag"/>
+ <xsl:with-param name="mbody" select="$mbody"/>
+ </xsl:call-template>
+</xsl:template>
+
+<!-- interp -->
+
+<xsl:template name="start-interp"> <!-- interp mode starter -->
+ <xsl:param name="rtree"/>
+ <xsl:param name="atree"/>
+ <m:apply helm:xref="{@id}">
+ <m:csymbol>interp</m:csymbol>
+ <xsl:apply-templates mode="interp" select="$rtree">
+ <xsl:with-param name="atree" select="$atree"/>
+ </xsl:apply-templates>
+ </m:apply>
+</xsl:template>
+
+<xsl:template name="mk-mml-op-interp"> <!-- make MML node for operators (interp mode) -->
+ <xsl:param name="arity"/> <!-- operator arity -->
+ <xsl:param name="c-tag"/> <!-- CIC tag -->
+ <xsl:param name="m-tag"/> <!-- MathML tag -->
+ <xsl:param name="atree"/> <!-- abstract tree pointer -->
+ <xsl:variable name="mbody">
+ <xsl:apply-templates select="*[position() > 1]" mode="interp">
+ <xsl:with-param name="atree" select="$atree"/>
+ </xsl:apply-templates>
+ </xsl:variable>
+ <xsl:call-template name="out-mml-op">
+ <xsl:with-param name="arity" select="$arity"/>
+ <xsl:with-param name="c-tag" select="$c-tag"/>
+ <xsl:with-param name="m-tag" select="$m-tag"/>
+ <xsl:with-param name="mbody" select="$mbody"/>
+ </xsl:call-template>
+</xsl:template>
+
</xsl:stylesheet>