fn:data

Return sequence of atomic items.

Top of page

Related Syntax Constructs

The following construct(s) refer to this construct:


Syntax

fn:data(item* $srcval) => anySimpleType*

Description

This function takes a sequence of items as argument and returns a sequence of atomic values. If the sequence is empty, an empty sequence is returned. If the item is an atomic value, it is returned. If the item is a node, it returns the typed value of the node.

Argument

$srcval

item value

Example

  • Get the typed value of name nodes:

    for    $a in input()//name
    return ($a, data($a))

    Note that in general the typed value differs from the string value that is returned by the function fn:string(). This may also apply to nodes that have the type xs:string, if the whitespace facet was used in the schema.