• +49-(0)721-402485-12
Ihre Experten für XML, XQuery und XML-Datenbanken


Sequences are the central data structure in XQuery. In this section, the structure of sequences is first introduced. Then functions and operators are explained.

The structure of a sequence

A sequence consists of no, one or several entries ("items"). Such an item is an atomic value or a node, whereby it is not required that a sequence consists of homogenous items. A sequence can be constructed by stringing together the individual items separated by comma. A bracketing illustrates the sequence formation, but is in many cases not required. However, the empty sequence can only be represented by (). Distinction is to be made between an empty sequence and "nothing". Especially when calling a function, it is a difference whether the call is made without an argument or with an empty sequence as argument.

A sequence of an item is not distinguishable from this item. In other words: Also a single value is a sequence according to XQuery. As a consequence, sequences cannot be nested in one another. Therefore the following sequences are identical:

  • (1, 2, 1) and (1, (2, 1))
    return a sequence of three numbers
  • (1, (),<B/>) and (1, <B/>)
    return a sequence of a number and a node
  • (<A/>) and <A/>
    return a sequence with only one item
  • () and ((),())
    return the empty sequence

A sequence is ordered and has no set properties, which means it may contain dublicates (multiple values or nodes).


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

<< backnext >>