Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

XQuery FLWOR + HTML

XQuery FLWOR + HTML


XML example document

We will continue to use this "books.xml" document in the examples below (the same file as in the previous section).

View the "books.xml" file in your browser.


Submit the result in an HTML list

Please look at the XQuery FLWOR expression below:

for $x in doc("books.xml")/bookstore/book/title

order by $x

return $x

The expression above selects all title elements under the book elements under the bookstore element and returns the title elements in alphabetical order.

Now, we want to list all the books in our bookstore using an HTML list. We add to the FLWOR expression