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 doc("bib.xml")/bib/book/title
return
<book>
{ $t }
</book>
}
</bib>
Adapted from XML Query Use Cases