O'Reilly logo

XQuery from the Experts: A Guide to the W3C XML Query Language by Philip Wadler, Jim Tivy, Jérôme Siméon, Michael Rys, Jonathan Robie, Michael Kay, Mary Fernández, Denise Draper, Don Chamberlin, Howard Katz - Editor

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

FLWOR Expressions

The FLWOR expression is the workhorse of XQuery: It allows a user to iterate over sequences of values, compute intermediate results, and conditionally filter values. Like the typing of path expressions, the typing of FLWOR expressions also relies on factored types.

FLWOR expressions iterate over the items in a sequence. Here is an example in which we suppose that $articles has type element(article)+:

for $article in $articles
return $article/end_date - $article/start_date

has type xdt:dayTimeDuration +. To type the body of the for expression, we strip off the occurrence indicator from element(article)+ and type the body of the for expression assuming that $article has type element(article), yielding type xdt:dayTimeDuration ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required