Is it build on top of XPath and works like SQL for databases.
It is even suported by databases as querying language - see Posgres and XMLTable
for $x in doc("books.xml")/bookstore/book
where $x/price>30
order by $x/title
return $x/title
Looks like this
<ul>
{
for $x in doc("books.xml")/bookstore/book/title
order by $x
return <li>{$x}</li>
}
</ul>
You can even query to HTML
let $sum := sum(doc("books.xml")/bookstore/book/price)
return <ul>
{
for $x in doc("books.xml")/bookstore/book/title
order by $x
return <li>{$x}</li>
}
<li>Order x, total sum {$sum}</li>
</ul>
Or add variables
Let's try it :)
Btw nice tutorial is here: https://www.tutorialspoint.com/xquery/index.htm