Hi,
I would like to store the results of an xquery extracting some nodes from an existing database into a new database.
So I have the DB 'collect' open and then do:
db:create('annotate-abcdef')
and then
for $i at $p in //entry[phraseme[text() = "abcdef"] and selected[text() = "yes"]] let $query := $i/query let $nodeid := $i/node let $node := db:open-id('TG-DTA-GerManC-stemming-ws', $nodeid) let $nodename := name($node) let $nodecontent := string($node) return insert node <div>{$nodeid} {$query} {element {$nodename} {$nodecontent}} </div> as last into db:open('annotate-abcdef')
However, the error message is
[XUDY0027] Insert target must not be empty.
How would I add a root element to the new DB, as I don't wan't to link it to an existing document? All nodes added to the DB are only results from queries over an existing DB. All I can see from the Wiki is using a document as initial data for the DB.
How do I set UPDINDEX ON for the new DB? I will later update the information added in the first place by other queries. To be able to use ft:mark, I would have to optimize the DB with db:optimize() after having added nodes, is this correct?
Thanks in advance and best regards
Cerstin