This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Character numbers
- To: xsl-list at mulberrytech dot com
- Subject: Re: Character numbers
- From: David_Marston at lotus dot com
- Date: Fri, 11 Aug 2000 10:31:25 -0400
- Reply-To: xsl-list at mulberrytech dot com
Ewout Kanger writes:
>I am looking for a way to retrieve character numbers:
>example:
>If a string is 'A' I want 65,...
This doesn't look like an ideal job for XSLT, which
generally covers up those things. You could write an
extension function for it. If the list of characters
is suitably small, you could do something like:
<xsl:variable name="charnum"><xsl:choose>
<xsl:when test="$char = 'A'">65</xsl:when>
<xsl:when test="$char = 'B'">66</xsl:when>
<xsl:when test="$char = 'C'">67</xsl:when>
...
<xsl:otherwise>-1</xsl:otherwise>
</xsl:choose></xsl:variable>
Why do you want this, anyway? Perhaps your larger task
can be accomplished in a better way.
.................David Marston
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list