Re: Character numbers

Subject: Re: Character numbers
From: David_Marston@xxxxxxxxx
Date: Fri, 11 Aug 2000 10:31:25 -0400
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 = '&#65;'">65</xsl:when>
  <xsl:when test="$char = '&#66;'">66</xsl:when>
  <xsl:when test="$char = '&#67;'">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


Current Thread