How to generate codepoints with xslt 1.0

Here should go questions about transforming XML with XSLT and FOP.
Toralion
Posts: 4
Location: Cologne

How to generate codepoints with xslt 1.0

Fri Jan 13, 2006 1:30 pm

Hello,
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

P.S.
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:choose>
<xsl:when test=". &lt; 256">
<xsl:value-of select="codepoints-to-string(.)" />
</xsl:when>
<xsl:when test=". &gt; 32767">
<xsl:text>\u</xsl:text>
<xsl:value-of select=".-65536" />
<xsl:text>\'3f</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>\u</xsl:text>
<xsl:value-of select="." />
<xsl:text>\'3f</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<xsl:value-of select="$stringToParse" />
</xsl:template>

Return to “XSLT and FOP”

Who is online

Users browsing this forum: No registered users and 0 guests