How to generate codepoints with xslt 1.0

Here should go questions about transforming XML with XSLT and FOP.
Posts: 4
Joined: Fri Dec 02, 2005 5:55 pm
Location: Cologne

How to generate codepoints with xslt 1.0

Post by Toralion » Fri Jan 13, 2006 1:30 pm

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=". < 256">
<xsl:value-of select="codepoints-to-string(.)" />
<xsl:when test=". > 32767">
<xsl:value-of select=".-65536" />
<xsl:value-of select="." />
<xsl:value-of select="$stringToParse" />