Easy Tutorial
❮ Xquery Summary Xquery Tutorial ❯

XQuery FLWOR + HTML


XML Example Document

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

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


Presenting Results in an HTML List

Consider the following XQuery FLWOR expression:

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 titles in our bookstore using an HTML list. We add <ul> and <li> tags to the FLWOR expression: <ul> {``<li>{$x}</li> } </ul>

The above code outputs:

Now we want to remove the title element and only display the data inside the title element. data($x)}</li>

The result will be an HTML list:

❮ Xquery Summary Xquery Tutorial ❯