Hello,

I am trying to build a web application, powered by data served through
BaseX.
One of the use cases I have is that I want to find all "documents" that
match a xquery.

I have the following in a RESTXQ file:

declare
  %rest:path("filter_by_author")
  %rest:GET
  %rest:query-param("name", "{$name}")
  function page:by_author($name as xs:string) {
    let $docs := db:node-id(db:open("sp")//head/meta[@name='author' and
contains(lower-case(@content), lower-case(web:decode-url($name)))]) return
    <response>
        {for $node_id in distinct-values($docs) return <title
value="{$node_id}" />}
    </response>
};

As expected, this does not work because it returns the node IDs. How can I
get the "document ID" or "document path" from a node? I understand XQuery
does not know about files in a collection (I found the following thread /
message in the archives about it:
https://mailman.uni-konstanz.de/pipermail/basex-talk/2010-July/000499.html)
- but is there a "db" function that would allow me to do it?

Thanks for your help,
- Tim

Reply via email to