problem with delete a document per docname

Hallo there,
my XQuery to delete a document per docname looks like this:

declare namespace tf = "http://namespaces.softwareag.com/tamino/TaminoFunction"
update for $q in collection('myCollection')/myDocRootElement
where tf:getDocname($q)='myDocname'
do(
delete $q/..
)

And I’ve got a error with messsage " Runtime type exception: invalid node-type;Expected NodeType: document"

Can you tell me, what’s wrong?

thank you in advance

mzha

Hi,

sorry, I cannot test thsi at the moment, but the error message indicates taht you should use root($q) rather than $q. Please try:


declare namespace tf = "http://namespaces.softwareag.com/tamino/TaminoFunction"
update for $q in collection('myCollection')/myDocRootElement
where tf:getDocname(root($q))='myDocname'
do(
delete root($q)
)

If thsi does not work, please tell and I will set up a system to test

regards

harald

Hi Harald,

Thanks a lot. It works now. :wink:

mzha