Name

string()

Returns the string value of the argument.

Syntax

[1.0] string string(object)
[2.0] xs:string string(item()?)

Inputs

An [1.0]object or [2.0] item. The argument is converted to a string as described in the following subsection.

Output

[1.0] A string. The input argument is converted to a string as follows:

  • If the argument is a node-set, the first node in the node-set is converted to a string. (The first node in the node-set is the one that occurs first in document order.) For an element or root node, this means all of its text content. For an attribute, this means its value.

  • If the argument is a number, it is converted to a string as follows:

    • The value NaN is converted to the string "NaN".

    • Positive zero is converted to the string "0".

    • Negative zero is converted to the string "0".

    • Positive infinity is converted to the string "Infinity".

    • Negative infinity is converted to the string "–Infinity".

    • An integer is converted to a string representing that integer, using no decimal point and no leading zeros. If the integer is negative, it will be preceded by a minus sign ().

    • Any other number is converted to a string with a decimal point—at least one number before the decimal point and at least one number after the decimal point. If the number is negative, it will be preceded by a minus sign (). There will not be any leading zeros before the decimal point (with the possible exception of the one required digit before the decimal point). After the decimal point, there will be only as many digits ...

Get XSLT, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.