Tags are given as literals
XQuery expression which is evaluated to become the contents of the element is enclosed in curly braces
The contents can also contain literal text outside the braces
List titles of all books in a bib
element.
Put each title in a book
element.
<bib>
{
FOR $t IN document("bib.xml")/bib/book/title
RETURN
<book>
{ $t }
</book>
}
</bib>
Adapted from XML Query Use Cases