Return argument value as a string.
The following construct(s) refer to this construct:
fn:string(item $value) => string
This accessor function returns the value of $value
represented as a string. If $value
is a non-empty
sequence, a type exception is raised. If $value
is an
empty sequence or an empty string, a string of length zero is returned as
result. If $value
is a node, the string value of the
node is returned. If $value
is an atomic value, it is
converted to a string and returned.
Note that the value returned by this function, when applied to a node, may differ from the typed value, even if the node is specified in the schema as being of type xs:string. To access the typed value, use the function fn:data.
$value |
one of an atomic value, a string or the string value of a node |
---|
Get a sequence of numeric values as a string value:
string((1,2,3))
This query results in a type exception.
string("(1,2,3)")
This query returns the string value "(1,2,3)"
.
Get a namespace as a string value:
string(xs:anyURI("http://no%20space%20lost"))
If URIs contain special characters, they will not be escaped.