On top of the query (in the query prolog), you can bind your database to the context. After that, there’ll be no need to bind it to a variable:
declare context item := db:open("com.w3schools.books"); /bookstore
On Sat, Oct 12, 2019 at 10:11 AM thufir hawat.thufir@gmail.com wrote:
nevermind, it's:
let $db := db:open("com.w3schools.books") return $db/bookstore
I thought it was unusual because of db:open.
-Thufir
On 2019-10-12 12:50 a.m., thufir wrote:
these FLWOR .xq files work as is:
let $db := db:open("com.w3schools.books") for $x in $db/bookstore return $x
or
<new_catalog>{ let $db := db:open("com.w3schools.books") for $x in $db/bookstore/book return <new_book>{$x/title,$x/author}</new_book> }</new_catalog>
Probably a silly question, but, rather than, as in the first query, using $x can I not somehow specify just "/"?
thanks,
Thufir