<?xml version="1.0"?>
+<!-- Copyright (C) 2000, HELM Team -->
+<!-- -->
+<!-- This file is part of HELM, an Hypertextual, Electronic -->
+<!-- Library of Mathematics, developed at the Computer Science -->
+<!-- Department, University of Bologna, Italy. -->
+<!-- -->
+<!-- HELM is free software; you can redistribute it and/or -->
+<!-- modify it under the terms of the GNU General Public License -->
+<!-- as published by the Free Software Foundation; either version 2 -->
+<!-- of the License, or (at your option) any later version. -->
+<!-- -->
+<!-- HELM 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 General Public License for more details. -->
+<!-- -->
+<!-- You should have received a copy of the GNU General Public License -->
+<!-- along with HELM; if not, write to the Free Software -->
+<!-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, -->
+<!-- MA 02111-1307, USA. -->
+<!-- -->
+<!-- For details, see the HELM World-Wide-Web page, -->
+<!-- http://cs.unibo.it/helm/. -->
+
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:m="http://www.w3.org/1998/Math/MathML">
</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>