|
Home > Online Product Documentation > Table of Contents > Simple XQuery FLWOR Expressions Simple XQuery FLWOR ExpressionsThe simplest XQuery FLWOR expression might be something like this:
This returns all of the
We can add a bit of substance by adding XQuery
This returns all of the titles of videos released in 1999. If you know SQL, that XQuery probably looks reassuringly similar to the equivalent SQL statement:
And if you know XPath, you might be wondering why our XQuery cannot be written as this:
Well, you can. This XPath expression is completely equivalent to the FLWOR expression above, and furthermore, it is a legal XQuery query. In fact, every legal XPath expression is also legal in XQuery. Thus the first query in this section can be written as:
Which style you prefer seems to depend on where you are coming from: if you have been using XML for years, especially XML with a deep hierarchy as found in "narrative" documents, then you will probably be comfortable with path expressions. But if you are more used to thinking of your data as representing a table, then the FLWOR style might suit you better. As you will see, FLWOR expressions are a lot more powerful than path expressions when it comes to doing joins. But for simple queries, the capabilities overlap and you have a choice. Although it might be true that in SQL every query is a SELECT statement, it is not so that in XQuery every query has to be a FLWOR expression. |
Insurance Companies That Use Stylus Studio
Everyone needs insurance, even insurance companies. That's why these top insurance companies are insured when it comes to XML. Come see which insurance providers are insured by the power of Stylus Studio!
FLWOR - An Introduction to the XQuery FLWOR Expression
An XQuery FLWOR Tutorial, covering an introduction to the main constructs of the XQuery FLWOR expression, including: For, Let, Where, Order By, and Return. Written by the W3C's Dr. Michael Kay.
Using XSLT Templates
Using XSLT Templates is an online video demonstration of the Stylus Studio XSLT designer. See just how easy it is to create, apply and match XSLT templates to your XML data to create beautiful HTML layouts for XML content publishing applications.
XHTML Tools
Powerful XHTML Tools for converting HTML to XHTML, validating XHTML, transforming XML to XHTML, editing JSP, creating XML driven Websites and more.