Page 1 of 1

How to generate codepoints with xslt 1.0

Posted: Fri Jan 13, 2006 1:30 pm
by Toralion
I 'm searching for a solution to create unicode codepoints with xslt 1.0 (converting xml2rtf).

XSLT 2.0 (or rather Xpath2) provides a function "string-to-codepoint" but unfortunately I have to use 1.0.

Does anyone know any other solution to convert a unicode character to the adequate number?
Maybe any function provided by xalan, msxsl and/or exsl?

Regards Tora

This is how it works in 2.0.:
<xsl:template name="StringToCodePoint">
<xsl:param name="stringToParse" />
<xsl:param name="stringToken" select="string-to-codepoints($stringToParse)" />
<xsl:for-each select="$stringToken">
<xsl:when test=". &lt; 256">
<xsl:value-of select="codepoints-to-string(.)" />
<xsl:when test=". &gt; 32767">
<xsl:value-of select=".-65536" />
<xsl:value-of select="." />
<xsl:value-of select="$stringToParse" />