On 10/01/2014, Dirk Kirsten dk@basex.org wrote:
Hi,
as already said on Github, you have to declare your namespace, because your function is in the book namespace. You can do so with the statement
module namespace book = "YOUR-NAMESPACE"
at the beginning of your XQuery file (not your xml file!).
Please excuse my stupidity for continuing to fail to understand.
A file with the suffix 'xqm' was edited from the original 'restxq.xqm' (which was removed from this directory) and placed in the directory 'webapp':
(:~ : 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("") %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() as element(Q{http://www.w3.org/1999/xhtml%7Dhtml) {...
Take a look at our example at https://docs.basex.org/wiki/RESTXQ#Usage. Here you can see that for the function page:hello() the page namespace was declared beforehand using
module namespace page = 'http://basex.org/examples/web-page';
I do not understand the url I must write for the element 'book', because I do not have a web site with a url that points to the element 'book'. I expect to add another line in my xqm file, something like:
... (:~ : This module contains some basic examples for RESTXQ annotations : @author BaseX Team :) module namespace page = 'http://basex.org/modules/web-page'; module namespace book = 'http://i.don%27t.know'; ...