Execute an XQuery
The following construct(s) refer to this construct:
tfquery(string $query) => item*
Function tf:query compiles and executes a nested XQuery, that is passed as a string. It returns the result of the query as a sequence of items. Any errors that occur during compilation or execution of the nested query will be reported as execution errors of the calling query.
A string that contains an executable query.
The example uses a static query which might just as well been executed directly, but the power of this function is in executing queries that are created during run-time, for example by reading it from somewhere or assembling it from pieces.
let $query := "for $book in collection('ino:etc')//book where $book//last='Buneman' return $book" return tf:query($query)