Hi Lucjan
So if I remember my college chemistry then as long as you have a chemical formula then all the numeric characters need to be subscripted.
So with a little digging on the web I found a template that can be used, thanks to Kevin for the template.
http://www.biglist.com/lists/xsl-list/archives/200210/msg01480.html
So I took the template:
<xsl:template name="chemical_formater">
<xsl:param name="formula"/>
<xsl:variable name="each_char" select="substring($formula,1,1)"/>
<xsl:choose>
<xsl:when test="$each_char='1' or $each_char='2' or $each_char='3' or
$each_char='4' or $each_char='5' or $each_char='6' or $each_char='7' or
$each_char='8' or $each_char='9' or $each_char='0'">
<fo:inline baseline-shift="sub" font-size="75%">
<xsl:value-of select="$each_char"/>
</fo:inline>
</xsl:when>
<xsl:otherwise>
<fo:inline baseline-shift="normal">
<xsl:value-of select="$each_char"/>
</fo:inline>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="substring-after($formula,$each_char)!=''">
<xsl:call-template name="chemical_formater">
<xsl:with-param name="formula">
<xsl:value-of
select="substring-after($formula,$each_char)"/>
</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:template>
and put it in a separate XSL file, this can be loaded to the Template Manager and referenced from the main template.
Using the following XML
<ROWSET>
<ROW>
<VALUE>CO2</VALUE>
</ROW>
<ROW>
<VALUE>H2O</VALUE>
</ROW>
</ROWSET>
In the formfield where you want to show the formula:
<xsl:call-template name="chemical_formater">
<xsl:with-param name="formula" select="VALUE"/> </xsl:call-template>
This calls the chemical formatter template and passes the VALUE element for formatting. It returns the formula formatted correctly ie with the subscripts.
Regards, Tim