• +49-(0)721-402485-12
Your experts for XML, XQuery and XML Databases

Overview of node functions

The following table provides an overview of the so-called node functions. Some of the node functions can be called up without any argument. In this case, the function call refers to the context element.

SignatureDescription
fn:name([
$arg as node()?])
as xs:string

returns the node name as character string in the form of a
QName with namespace prefix; an empty character string
is returned if no node name exists or the argument is the empty sequence

fn:node-name(
$arg as node()?)
as xs:QName?
returns the node name as expanded QName;
an empty sequence is returned if no node name exists
or the argument is the empty sequence
fn:local-name([
$arg as node()?])
as xs:string
returns the local portion of the node name as character string;
an empty character string is returned if no node name exists
or the argument is the empty sequence
fn:namespace-uri([
$arg as node()?])
as xs:string
returns the namespace portion of the node name as
character string; an empty character string is returned if
no node name exists, the node name does not belong to
a namespace or the argument is the empty sequence
fn:root([
$arg as node()?])
as node()?
returns the root of the tree to which $arg belongs,
or the empty sequence in case $arg is the empty sequence
fn:string([
$arg as item()?])
as xs:string
returns the textual value of a node; the function can also
be applied to any values and returns then the same as
xs:string($arg); string(()) returns the empty character string
fn:data([
$arg as item()*])
as xdt:anyAtomicType*
returns a sequence of atomic values, one for each element
of the input sequence; if the element of the input sequence is
an atomic value, it is returned unchanged, if it is a node,
its typed value is returned
fn:number([
$arg as item()?])
as xs:double
returns xs:double($arg) in case this does not result in an error,
and otherwise NaN

 

Source: "XQuery – Grundlagen und fortgeschrittene Methoden", dpunkt-Verlag, Heidelberg (2004)

<< backnext >>