Hi,
based on your recent questions I would really recommend that you try to understand RESTXQ in more detail. Apart from our documentation at https://docs.basex.org/wiki/RESTXQ (which Chrisdtian already pointed out), there was also a Talk given by Arve and Sabine named "How to develop RESTXQ-based web applications with BaseX", you can find the slides and the example code at https://files.basex.org/publications/xmlprague2013/.
All the details are given in the Spec at http://exquery.github.io/exquery/exquery-restxq-specification/restxq-1.0-spe...
You are using an annotation %rest:path("{$x}")
This means, your URL can be basically be any atomic type (see http://exquery.github.io/exquery/exquery-restxq-specification/restxq-1.0-spe...) and this value will be bound to the variable $x. This is also the reason why you have to declare $x as argument of the function. Within your function you never actually use this value, so probably you don't really intend to use a template in your path, so you might simply want to remove this. Of course, this is mostly guessing as we don't know what you actually want to do.
Cheers, Dirk
On 15/01/14 21:23, e-letter wrote:
On 15/01/2014, Christian Grün christian.gruen@gmail.com wrote:
This should help:
function page:bookstore($x)
I tried:
... function page:bookstore($x) as element(bookstore) {
<bookstore> { let $x := fn:doc("xmldatabasefile.xml")/bookstore/book/title[contains(text(),'Everyday Italian')]/parent::* return $x } </bookstore> };
The result:
HTTP ERROR 404
Problem accessing /. Reason: No function found that matches the request.
Powered by Jetty://
Then I tried:
... function page:bookstore($x) {...
which produces the same error result shown above. Then tried:
... function page:bookstore($x)
<bookstore> { let $x := fn:doc("xmldatabasefile.xml")/bookstore/book/title[contains(text(),'Everyday Italian')]/parent::* return $x } </bookstore>
The result:
HTTP ERROR 400
Problem accessing /. Reason: Stopped at /path/to/webapp/restxq.xqm, 59/2: [XPST0003] Expecting '{', found '<'.
Powered by Jetty://
What next must I try, please?