XSLT and XPath function reference in alphabetical order

(Excerpt from “XSLT 2.0 & XPath 2.0” by Frank Bongers, chapter 5, translated from German)

A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z



String functions – codepoint conversion


XPath 2.0

Return value:

A sequence of xs:integer integers; the Unicode Codepoint values which represent the characters of the input string.




Obligatory. A xs:string string whose characters shall be converted to a sequence of Unicode Codepoint values.

Purpose of use:

The fn:string-to-codepoints() function is the counterpart of the fn:codepoints-to-string() function. It returns a sequence of integer values each of which corresponds to a Unicode Codepoint and which represent the individual characters of which the input string consists of. If the input string is the empty string, the function returns the empty sequence.

A possible problem results from the Unicode specification which, under certain circumstances, assigns several different codepoints (or a sequence of codepoints) to identical abstract characters. Therefore, the conversion does not necessarily have to be unique. For example, the Å character is representable by the codepoint 0197 (»latin capital letter a with ring above«) or the codepoint 8491 (»angstrom sign«).

Remark: The »Unicode Codespace« which can be used for the definition of codepoints includes the integer range from 0 to 10FFFF (hexadecimal), which means 0 to 1.114.111 (decimal).

Example – application on an input string:

fn:string-to-codepoints('Hello World!')

results in the sequence: (72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33).

In this example, each character of the input string is represented by the decimal number of its Unicode Codepoint, for example the H (Unicode U+0072) by 72.

Function definition:

XPath 1.0:

The function is not available.

XPath 2.0:

fn:string-to-codepoints($arg as xs:string?) as xs:integer*


<< back next >>




Copyright © Galileo Press, Bonn 2008
Printing of the online version is permitted exclusively for private use. Otherwise this chapter from the book "XSLT 2.0 & XPath 2.0" is subject to the same provisions as those applicable for the hardcover edition: The work including all its components is protected by copyright. All rights reserved, including reproduction, translation, microfilming as well as storage and processing in electronic systems.

Galileo Press, Rheinwerkallee 4, 53227 Bonn, Germany