Learn how to use XQuery's FLWR (for, let where, and return) expressions to process and restructure data from one or more documents.
by Srinivas Pandrangi,
Alex Cheng,
Dr. Hui Zhang,
QiDong Xu and
Jim Gan
October 21, 2002
n this article, you'll explore one of the most interesting types of XQuery expressionsthe FLWR expression, and see more detail on element constructors.
XQuery provides FLWR expressions for iterating over groups of nodes and for binding variables to intermediate results. The letters in the name "FLWR", pronounced "flower", stem from the keywords for, let, where, and returnthe four clauses in a FLWR expression. FLWR expressions are useful for processing and restructuring data from one or more documents.
For example, the following query returns the list of email addresses of all customers in the document customers.xml.
# see XQuery31.ixq in samples.zip
<customers>
{
for $c in document("data/customers.xml")//customer
return
$c/email
}
</customers>
It's quick, easy and you get access to all the articles on DevX.
This registration/login is to allow you to read articles on devx.com. Already a member?
To become a member of DevX.com create your Member Profile by completing the form below. Membership is free!