Hi,
I have a database that contains several thousand records with elements that I will never need so I want to remove them. The following code snippet returns the expected element:
import module namespace functx = 'http://www.functx.com'; let $p := collection("Patterns/nl-verbs.csv")/csv/record[1] let $remove := ("onbekend1", "onbekend2", "onbekend3", "onbekend4") return functx:remove-elements($p, $remove)
I tried to use update:apply to update the database but when I execute the following function, I get this message: [XPDY0002] element(functx:remove-elements): Context is undeclared
import module namespace functx = 'http://www.functx.com'; declare %updating function local:clean_verbs( $old as node(), $rem as xs:string* ) as empty-sequence() { update:apply(functx:remove-elements, [$old, $rem]) };
let $p := collection("Patterns/nl-verbs.csv")/csv/record[1] let $remove := ("onbekend1", "onbekend2", "onbekend3", "onbekend4")
return local:clean_verbs($p, $remove)
I have two questions: 1: If I want to use the update module, how should I provide the context to the query? 2: How can I update all records without making use of update:apply or update:for-each (what is the befit of the update-module)?
Cheers, Ben