<xsl:choose>
<xsl:when test="name(*[3]) = 'LAMBDA'">
<m:bvar>
- <m:ci><xsl:value-of select="LAMBDA/target/@binder"/></m:ci>
+ <m:ci><xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="LAMBDA/target/@binder"/></xsl:with-param></xsl:call-template></m:ci>
</m:bvar>
<xsl:apply-templates select="LAMBDA/target" mode="noannot"/>
</xsl:when>
<xsl:when test="name(*[3]) = 'LAMBDA'">
<xsl:variable name="bvarname" select="*[3]/target/@binder"/>
<m:bvar>
- <m:ci><xsl:value-of select="$bvarname"/></m:ci>
+ <m:ci><xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="$bvarname"/></xsl:with-param></xsl:call-template></m:ci>
</m:bvar>
<m:condition>
<xsl:apply-templates select="LAMBDA[1]/target" mode="noannot"/>
<m:apply>
<m:csymbol>app</m:csymbol>
<xsl:apply-templates select="*[4]" mode="noannot"/>
- <m:ci><xsl:value-of select="$bvarname"/></m:ci>
+ <m:ci><xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="$bvarname"/></xsl:with-param></xsl:call-template></m:ci>
</m:apply>
</xsl:otherwise>
</xsl:choose>
<xsl:when test="name(*[4]) = 'LAMBDA'">
<xsl:variable name="bvarname" select="*[4]/target/@binder"/>
<m:bvar>
- <m:ci><xsl:value-of select="$bvarname"/></m:ci>
+ <m:ci><xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="$bvarname"/></xsl:with-param></xsl:call-template></m:ci>
</m:bvar>
<m:condition>
<m:apply>
<m:csymbol>app</m:csymbol>
<xsl:apply-templates select="*[3]" mode="noannot"/>
- <m:ci><xsl:value-of select="$bvarname"/></m:ci>
+ <m:ci><xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="$bvarname"/></xsl:with-param></xsl:call-template></m:ci>
</m:apply>
</m:condition>
<xsl:apply-templates select="*[4]/target" mode="noannot"/>
<m:lambda helm:xref="{@id}">
<m:bvar>
<m:ci>
- <xsl:value-of select="target/@binder"/>
+ <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="target/@binder"/></xsl:with-param></xsl:call-template>
</m:ci>
<m:type>
<xsl:apply-templates select="source/*[1]" mode="noannot"/>
<m:csymbol>prod</m:csymbol>
<m:bvar>
<m:ci>
- <xsl:value-of select="target/@binder"/>
+ <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="target/@binder"/></xsl:with-param></xsl:call-template>
</m:ci>
<m:type>
<xsl:apply-templates select="source/*[1]" mode="noannot"/>
<xsl:template match="REL" mode="pure">
<m:ci helm:xref="{@id}">
- <xsl:value-of select="@binder"/>
+ <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="@binder"/></xsl:with-param></xsl:call-template>
</m:ci>
</xsl:template>
<xsl:for-each select="*[@id = (//ALLTYPES/TYPE/@id)]">
<m:apply>
<m:csymbol>let</m:csymbol>
- <m:ci><xsl:value-of select="concat('h',position())"/></m:ci>
+ <m:ci><xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="concat('h',position())"/></xsl:with-param></xsl:call-template></m:ci>
<xsl:apply-templates mode="noannot" select="."/>
</m:apply>
</xsl:for-each>
<!-- <xsl:when test="key('typeid',@id)"> -->
<xsl:when test="//ALLTYPES/TYPE[@id=$id]">
<m:ci>
- <xsl:value-of select="concat('h',$n)"/>
+ <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="concat('h',$n)"/></xsl:with-param></xsl:call-template>
</m:ci>
<xsl:apply-templates mode="flat" select="following-sibling::*[1]">
<xsl:with-param name="n" select="$n+1"/>
<xsl:template match="VAR" mode="pure">
<m:ci helm:xref="{@id}">
- <xsl:value-of select="substring-after(@relUri,",")"/>
+ <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="substring-after(@relUri,",")"/></xsl:with-param></xsl:call-template>
</m:ci>
</xsl:template>
<xsl:template match="META" mode="pure">
<m:ci helm:xref="{@id}">
- <xsl:value-of select="@no"/>
+ <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="@no"/></xsl:with-param></xsl:call-template>
</m:ci>
</xsl:template>
<xsl:template match="CONST" mode="pure">
<m:ci definitionURL="{@uri}" helm:xref="{@id}">
- <xsl:call-template name="name_of_uri">
+ <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:call-template name="name_of_uri">
<xsl:with-param name="uri" select="@uri"/>
- </xsl:call-template>
+ </xsl:call-template></xsl:with-param></xsl:call-template>
<!-- <xsl:value-of select="document(concat(string($absPath),@uri))/*/@name"/> -->
</m:ci>
</xsl:template>
<xsl:template match="MUTIND" mode="pure">
<m:ci definitionURL="{@uri}" helm:xref="{@id}">
<xsl:variable name="index"><xsl:value-of select="@noType"/></xsl:variable>
- <xsl:value-of select="document(concat(string($absPath),@uri))/InductiveDefinition/InductiveType[position()=number($index)+1]/@name"/>
+ <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="document(concat(string($absPath),@uri))/InductiveDefinition/InductiveType[position()=number($index)+1]/@name"/></xsl:with-param></xsl:call-template>
</m:ci>
</xsl:template>
<m:ci definitionURL="{@uri}" helm:xref="{@id}">
<xsl:variable name="Tindex"><xsl:value-of select="@noType"/></xsl:variable>
<xsl:variable name="Cindex"><xsl:value-of select="@noConstr"/></xsl:variable>
- <xsl:value-of select="document(concat(string($absPath),@uri))/InductiveDefinition/InductiveType[position()=number($Tindex)+1]/Constructor[position()=number($Cindex)]/@name"/>
+ <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="document(concat(string($absPath),@uri))/InductiveDefinition/InductiveType[position()=number($Tindex)+1]/Constructor[position()=number($Cindex)]/@name"/></xsl:with-param></xsl:call-template>
</m:ci>
</xsl:template>
<xsl:choose>
<xsl:when test="$nopar = 0">
<m:ci>
- <xsl:value-of select="document(concat(string($absPath),$Turi))/InductiveDefinition/InductiveType[position()=number($Tindex)+1]/Constructor[position()=number($pos)]/@name"/>
+ <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="document(concat(string($absPath),$Turi))/InductiveDefinition/InductiveType[position()=number($Tindex)+1]/Constructor[position()=number($pos)]/@name"/></xsl:with-param></xsl:call-template>
</m:ci>
</xsl:when>
<xsl:otherwise>
<m:apply>
<m:csymbol>app</m:csymbol>
<m:ci>
- <xsl:value-of select="document(concat(string($absPath),$Turi))/InductiveDefinition/InductiveType[position()=number($Tindex)+1]/Constructor[position()=number($pos)]/@name"/>
+ <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="document(concat(string($absPath),$Turi))/InductiveDefinition/InductiveType[position()=number($Tindex)+1]/Constructor[position()=number($pos)]/@name"/></xsl:with-param></xsl:call-template>
</m:ci>
<xsl:apply-templates select="./*[1]" mode="abstparams"><xsl:with-param name="noparams" select="$nopar"/><xsl:with-param name="binder">LAMBDA</xsl:with-param></xsl:apply-templates>
</m:apply>
<m:apply helm:xref="{@id}">
<xsl:variable name="findex"><xsl:value-of select="@noFun"/></xsl:variable>
<m:csymbol>fix</m:csymbol>
- <m:ci><xsl:value-of select="FixFunction[position()=number($findex)+1]/@name"/></m:ci>
+ <m:ci><xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="FixFunction[position()=number($findex)+1]/@name"/></xsl:with-param></xsl:call-template></m:ci>
<xsl:apply-templates mode="pure" select="*"/>
</m:apply>
</xsl:template>
<m:apply helm:xref="{@id}">
<xsl:variable name="findex"><xsl:value-of select="@noFun"/></xsl:variable>
<m:csymbol>cofix</m:csymbol>
- <m:ci><xsl:value-of select="CofixFunction[position()=number($findex)+1]/@name"/></m:ci>
+ <m:ci><xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="CofixFunction[position()=number($findex)+1]/@name"/></xsl:with-param></xsl:call-template></m:ci>
<xsl:apply-templates mode="pure" select="*"/>
</m:apply>
</xsl:template>
<xsl:template match="FixFunction" mode="pure">
<m:bvar>
- <m:ci><xsl:value-of select="@name"/></m:ci>
+ <m:ci><xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="@name"/></xsl:with-param></xsl:call-template></m:ci>
<m:type><xsl:apply-templates select="type/*[1]" mode="noannot"/></m:type>
</m:bvar>
<xsl:apply-templates select="body/*[1]" mode="noannot"/>
<xsl:template match="CofixFunction" mode="pure">
<m:bvar>
- <m:ci><xsl:value-of select="@name"/></m:ci>
+ <m:ci><xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="@name"/></xsl:with-param></xsl:call-template></m:ci>
<m:type><xsl:apply-templates select="type/*[1]" mode="noannot"/></m:type>
</m:bvar>
<xsl:apply-templates select="body/*[1]" mode="noannot"/>
</xsl:template>
</xsl:stylesheet>
+
+
+
+
+
<!-- Parameter affecting line-breaking -->
<!--***********************************************************************-->
-<xsl:variable name="framewidth" select="30"/>
+<xsl:variable name="framewidth" select="35"/>
<!--***********************************************************************-->
<!-- Gli oggetti sono stampati come mtext all'interno di una marca toplevel-->
<m:mphantom><m:mtext>_</m:mtext></m:mphantom>
<xsl:apply-templates select="*[3]"/>
<m:mphantom><m:mtext>_</m:mtext></m:mphantom>
- <m:mtext>and apply</m:mtext>
+ <m:mtext>and apply to</m:mtext>
<m:mphantom><m:mtext>_</m:mtext></m:mphantom>
<xsl:apply-templates select="*[position()>3]"/>
</m:mrow>
<xsl:template match = "m:set">
<xsl:choose>
<xsl:when test="count(child::*) = 0">
- <m:mo>
+ <m:mi>
<m:mchar name="emptyset"/>
- </m:mo>
+ </m:mi>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="charlength">
<xsl:choose>
<xsl:when test="string($binder) = "LAMBDA"">
<m:ci>
- <xsl:value-of select="target/@binder"/>
+ <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="target/@binder"/></xsl:with-param></xsl:call-template>
</m:ci>
</xsl:when>
<xsl:otherwise>
<xsl:param name="noleft" select="0"/>
<xsl:param name="number" select="1"/>
<xsl:if test="$noleft != 0">
- <m:ci>$<xsl:value-of select="$number"/></m:ci>
+ <m:ci><xsl:call-template name="insert_subscript"><xsl:with-param name="node_value">$<xsl:value-of select="$number"/></xsl:with-param></xsl:call-template></m:ci>
<xsl:call-template name="printparam"><xsl:with-param name="noleft" select="$noleft - 1"/><xsl:with-param name="number" select="$number + 1"/></xsl:call-template>
</xsl:if>
</xsl:template>
</xsl:choose>
</xsl:template>
+
+<!--***********************************************************************-->
+<!-- Insert a subscript if there is a number at the end of a ci element -->
+<!--***********************************************************************-->
+
+<xsl:template name="insert_subscript">
+<xsl:param name="node_value" select=""""/>
+<xsl:param name="current_pos" select="1"/>
+<xsl:param name="start_pos" select="0"/>
+ <xsl:choose>
+ <xsl:when test="$current_pos <= string-length(string($node_value))">
+ <xsl:variable name="current_char"><xsl:value-of select="substring(string($node_value),$current_pos,1)"/></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="(string($current_char) != "0") and (string($current_char) != "1") and (string($current_char) != "2") and (string($current_char) != "3") and (string($current_char) != "4") and (string($current_char) != "5") and (string($current_char) != "6") and (string($current_char) != "7") and (string($current_char) != "8") and (string($current_char) != "9")">
+ <xsl:choose>
+ <xsl:when test="$start_pos != 0">
+ <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value" select="$node_value"/><xsl:with-param name="current_pos" select="$current_pos + 1"/><xsl:with-param name="start_pos" select="0"/></xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value" select="$node_value"/><xsl:with-param name="current_pos" select="$current_pos + 1"/><xsl:with-param name="start_pos" select="$start_pos"/></xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$start_pos = 0">
+ <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value" select="$node_value"/><xsl:with-param name="current_pos" select="$current_pos + 1"/><xsl:with-param name="start_pos" select="$current_pos"/></xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value" select="$node_value"/><xsl:with-param name="current_pos" select="$current_pos + 1"/><xsl:with-param name="start_pos" select="$start_pos"/></xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="$start_pos != 0">
+ <m:msub>
+ <m:mi><xsl:value-of select="substring(string($node_value),1,$start_pos -1)"/></m:mi>
+ <m:mn><xsl:value-of select="substring(string($node_value),$start_pos)"/></m:mn>
+ </m:msub>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$node_value"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+
</xsl:stylesheet>
<m:apply helm:xref="{@id}">
<m:csymbol>and_ind</m:csymbol>
<xsl:apply-templates mode="noannot" select="*[6]"/>
- <m:ci><xsl:value-of select="*[5]/target/@binder"/></m:ci>
+ <m:ci><xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="*[5]/target/@binder"/></xsl:with-param></xsl:call-template></m:ci>
<xsl:apply-templates mode="pure" select="*[5]/source/*"/>
- <m:ci><xsl:value-of select="*[5]/target/LAMBDA/target/@binder"/></m:ci>
+ <m:ci><xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="*[5]/target/LAMBDA/target/@binder"/></xsl:with-param></xsl:call-template></m:ci>
<xsl:apply-templates mode="pure" select="*[5]/target/LAMBDA/source/*"/>
<xsl:apply-templates mode="noannot" select="*[5]/target/LAMBDA/target/*"/>
</m:apply>
<xsl:template match="*" mode="copy-of-no-prop">
<xsl:choose>
<xsl:when test="@id = //ALLTYPES/TYPE/@id">
- <m:ci>prev</m:ci>
+ <m:ci>previous</m:ci>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="." mode="pure"/>
<xsl:choose>
<xsl:when test="$letsubp">
<m:ci>
- <xsl:value-of select="'h2'"/>
+ <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="'h2'"/></xsl:with-param></xsl:call-template>
</m:ci>
</xsl:when>
<xsl:otherwise>
<m:ci>
- <xsl:value-of select="'h1'"/>
+ <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="'h1'"/></xsl:with-param></xsl:call-template>
</m:ci>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="$letsubp">
<m:ci>
- <xsl:value-of select="'h1'"/>
+ <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="'h1'"/></xsl:with-param></xsl:call-template>
</m:ci>
</xsl:when>
<xsl:otherwise>
</xsl:attribute>
</m:limit>
<m:bvar>
- <m:ci><xsl:value-of select="LAMBDA/target/@binder"/></m:ci>
+ <m:ci><xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="LAMBDA/target/@binder"/></xsl:with-param></xsl:call-template></m:ci>
</m:bvar>
<m:lowlimit>
<xsl:apply-templates select="*[5]" mode="noannot"/>
</xsl:attribute>
</m:diff>
<m:bvar>
- <m:ci><xsl:value-of select="LAMBDA[1]/target/@binder"/></m:ci>
+ <m:ci><xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="LAMBDA[1]/target/@binder"/></xsl:with-param></xsl:call-template></m:ci>
</m:bvar>
<xsl:apply-templates select="*[2]/target" mode="noannot"/>
</m:apply>
<m:set>
<m:bvar>
<m:ci>
- <xsl:value-of select="target/@binder"/>
+ <xsl:call-template name="insert_subscript"><xsl:with-param name="node_value"><xsl:value-of select="target/@binder"/></xsl:with-param></xsl:call-template>
</m:ci>
<m:type>
<xsl:apply-templates select="source" mode="noannot"/>