O'Reilly logo

XSLT, 2nd Edition by Doug Tidwell

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required