The 'restxq.xqm' was edited as below:
(:~ : This module contains some basic examples for RESTXQ annotations : @author BaseX Team :) module namespace page = 'http://basex.org/modules/web-page';
(:~ : This function generates the welcome page. : @return HTML page :) declare %rest:path("{$x}") %output:method("xhtml") %output:omit-xml-declaration("no") %output:doctype-public("-//W3C//DTD XHTML Basic 1.1//EN") %output:doctype-system("http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd") function page:start($x) as element(Q{http://www.w3.org/1999/xhtml%7Dhtml) { <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>BaseX HTTP Services</title> <link rel="stylesheet" type="text/css" href="static/style.css"/> </head> <body> <h3>Example 2</h3> <p>The next example presents how form data is processed via RESTXQ and the POST method:</p> <form method='get' name='databasequeryform' > <p> <select name='booktitle' > <option> Everyday Italian </option> <option> Harry Potter </option> </select> <input type="submit" value='send' /> </p> </form> </body> </html> }; declare %rest:GET %rest:path("xmldatabasefile.xml/bookstore/book") %rest:form-param("booktitle","{$x}") %rest:produces("text/html") %output:method("xhtml") function page:bookstore() as element(bookstore) { <bookstore> { let $x := fn:doc("xmldatabasefile.xml")/bookstore/book/title[contains(text(),'Everyday Italian')]/parent::* return $x } </bookstore> };
The server response:
HTTP ERROR 400
Problem accessing /. Reason: Stopped at /path/to/webapp/restxq.xqm, 58/10: [BASX0003] Variable $x is not specified as argument.
Powered by Jetty://
What is my mistake for the declaration:
... function page:bookstore() as element(bookstore) { ...