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
- Contact:
How to generate codepoints with xslt 1.0
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=". < 256">
<xsl:value-of select="codepoints-to-string(.)" />
</xsl:when>
<xsl:when test=". > 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>
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=". < 256">
<xsl:value-of select="codepoints-to-string(.)" />
</xsl:when>
<xsl:when test=". > 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>
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service