# xs:string

Converts the value of $item-var to a string.

If $item-var is the empty sequence, the empty sequence is returned. The empty sequence is a sequence containing zero items (), which is similar to null in SQL.

### Signatures

xs:string(item* $item-var) —> xs:string

### Arguments

Data Type | Argument | Description
--- | --- | ---
item* | $item-var | Represents an atomic value or an element.

### Returns

Returns the representation of $item-var as a string.

### Examples

#### XML Node

When you invoke the following query:

    {-- node example --}
    let $i := <book>The Toad</book>
    return <author>{xs:string($i)}</author>

The following result is generated:

    <author>The Toad</author>

#### Integer

When you invoke the following query:

    {-- integer example --}
    let $num := xs:integer("20")
    return (<integer>{xs:string($num)}</integer>)

The following result is generated:

    <integer>20</integer>

#### Float

When you invoke the following query:

    {-- float example --}
    let $num := xs:float("44.4")
    return (<float>{xs:string($num)}</float>)

The following result is generated:

    <float>44.4</float>

#### Boolean

When you invoke the following query:

    {-- boolean example --}
    let $boolean-var := xs:boolean("true")
    return (<boolean>{xs:string($boolean-var)}</boolean>)

The following result is generated:

    <boolean>true</boolean>

Related Topics

W3C string function description