string function

The fn:string function returns the string representation of a value.

Syntax

Read syntax diagramSkip visual syntax diagramfn:string(value)
value
The value that is to be represented as a string.

value is a node or an atomic value, or is the empty sequence.

If value is not specified, fn:string is evaluated for the current context item. If the current context item is undefined, an error is returned.

Returned value

If value is not the empty sequence:
  • If value is a node, the returned value is the string value of the node.
  • If value is an atomic value, the returned value is the result of casting value to the xs:string type.

If value is the empty sequence, the result is a string of length 0.

Example

The following function returns the string representation of 123:
fn:string(xs:integer(123))

The returned value is '123'.