RE: [xsl] String Manipulation - Distinguishing alphas and numerics in a string

Subject: RE: [xsl] String Manipulation - Distinguishing alphas and numerics in a string
From: "Conal Tuohy" <conalt@xxxxxxxxxxxxxxx>
Date: Thu, 31 Oct 2002 12:08:21 +1300
You need to write a template with a name attribute, and call it to process
the string. Pass the string to it as a parameter. This template would handle
the first part of the string, then if there's any string remaining, it
should call itself, passing itself the remainder of the string.

Kevin wrote:

> Does anyone know how to do this? (the chemistry is not the
> issue, I realize
> this is a bogus combination)
>
>
> XML source:
> <para>candybars are made of <chemical>H20ClF3</chemical>.</para>
>
>
> XSL needed?????
> <xsl:template match="chemical">
>   <xsl:variable name="this_chemical" select="."/>
>
> <!-- This is the part I'm stuck on. How do I process the string? The
> translate function only wants to replace something. How do I
> walk through
> the string and wrap each number with the FO for subscript? -->
>
> </xsl:template>
>
> XSL-FO desired:
>
> <fo:block>water is made of H<fo:inline baseline-shift="sub"
> >2</fo:inline>OClF<fo:inline baseline-shift="sub"
> >3</fo:inline>.</fo:block>



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread