Hi Andreas,
> %rest:query-param("page:category", "{$category}")
• The first argument is the name of the query parameter how it will be
passed on by the client.
• The second argument is the name of your XQuery variable
> function page:list($page:category as xs:string) { () };
This should work:
> function page:list($category as xs:string?) { };
Hope this helps,
Christian
> [basex:restxq] Variable $category is not specified as argument.
>
> If I replace *every* '$category' with '$page:category' I get:
>
> [basex:restxq] Variable $page:category is specified more than once.
>
> But the only place I use '$page:category' in this module is at this point.
>
> The rules are, as far as I have understood:
>
> 1. In a module, only one namespace can be used for the functions and
> variables defined therein,
> foreign namespaces can be sourced via module imports only.
> 2. This namespace can not be in the
> {http://www.w3.org/2005/xquery-local-functions} namespace,
> but must go into my own namespace, here {http://localhost/web-page}.
> 3. All variables must be in the relevant namespaces *(global or local only?)*.
>
> I now have tried several approaches. As I see in the XQM modules in the BaseX
> DBA application,
> it seems, that neither the '%rest:query-param' is needed nor is it needed to
> prefix variable/parameter
> names, that are local to that function. This can be found, for example, in
> 'dba/common.xqm':
>
>
> module namespace dba = 'dba/common';
> (:~
> : Shows a "page not found" error.
> : @param $path path to unknown page
> : @return page
> :)
> declare
> %rest:path("/dba/{$path}")
> %output:method("html")
> function dba:unknown(
> $path as xs:string
> ) as element(html) {
> html:wrap(
> <tr>
> <td>
> <h2>Page not found:</h2>
> <ul>
> <li>Page: dba/{ $path }</li>
> <li>Method: { Request:method() }</li>
> </ul>
> </td>
> </tr>
> )
> };
>
>
> So, I am disturbed by now. What am I doing wrong here?
>
> --
> Goody Bye, Minden jót, Mit freundlichen Grüßen,
> Andreas Mixich
>