saxon:compile-query($query as xs:string) ==> jt:net.sf.saxon.query.XQueryExpression
This function takes as input a string containing an XQuery query, and produces as output a compiled
query suitable for use with the saxon:query() extension function.
The static context for the query (for example, its namespace bindings and its base URI) must be defined
within its own query prolog. It does not inherit any context values from the query or stylesheet in which
saxon:compile-query() function is called. The query cannot access variables or functions
defined in the containing query or stylesheet.
There are several ways the string containing the query might be constructed. It can be built directly as
a dynamic string in the calling application. In the case of XSLT, it can be read from a file using
unparsed-text() function. It can also be generated by calling saxon:serialize() on an XML
representation of the query, using
the serialization method saxon:xquery
The compiled query can be evaluated (repeatedly) using the saxon:query()