This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Character numbers



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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]