Name
[2.0]
codepoints-to-string()
Converts a sequence of Unicode codepoints to a string.
Syntax
xs:stringcodepoints-to-string(xs:integer*)
Inputs
A sequence of xs:integers, each of which represents a
Unicode codepoint.
Output
An xs:string created by
concatenating the given codepoints. If the input argument is the
empty sequence, codepoints-to-string() returns a
zero-length string. If any codepoint in the argument is not a
legal XML character, the XSLT processor raises an error.
Defined in
XQuery 1.0 and XPath 2.0 Functions and Operators section 7.2, “Functions to Assemble and Disassemble Strings.”
Example
Here’s a short stylesheet that converts sequences of integers into strings:
<?xml version="1.0"?> <!-- codepoints-to-string.xsl --> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xsl:output method="text"/> <xsl:template match="/"> <xsl:text>
Tests of the codepoints-to-string() </xsl:text> <xsl:text>function:
</xsl:text> <xsl:text>
 codepoints-to-string</xsl:text> <xsl:text>((76, 105, 108, 121)) = </xsl:text> <xsl:value-of select="codepoints-to-string((76, 105, 108, 121))"/> <xsl:text>
 codepoints-to-string</xsl:text> <xsl:text>((83, 116, 114, 97, 223, 101)) = </xsl:text> <xsl:value-of select="codepoints-to-string((83, 116, 114, 97, 223, 101))"/> </xsl:template> </xsl:stylesheet>
The stylesheet generates these results:
Tests of the codepoints-to-string() function: codepoints-to-string((76, 105, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access