data

The atomic value of a node

Description

The fn:data function accepts a sequence of items and returns their typed values. For atomic values, this simply means returning the value itself, unchanged. For nodes, this means extracting the typed value of the node.

Calling this function is often unnecessary because the typed value of a node is extracted automatically (in a process known as atomization) for many XQueryXPath 2.0 expressions, including comparisons, arithmetic operations and function calls. The most common use case for the fn:data function is in XQuery element constructors.

Parameters

Description

arg:string()

the item to get the value of

Examples

XPath

Results

data($cat//product[1]/number)

557

data($cat//number)

(557, 563, 443, 784)

data($cat//product[1]/@dept)

WMN

data($cat//product[1]/colorChoices)

navy black

data($cat//product[1])

557 Fleece Pullover navy black

data($cat//product[4]/desc)

Our favorite shirt!