XQuery doubt: how to get only the right branches

Hi,
I have to resolve the following query but I don’t know. First I get an error and second I’m not sure about if it can reply that I want.

In this tree I need to get all the xml file except the branch that not make good the condition ‘Where’.
This is the tree:

DVD->Production->rpElements:FrameworkTitle=“Nijiski”
->rpElements:FrameworkTitle=“BH90210”
->Media ->rpElements:FrameworkTitle=“Nijiski”
->rpElements:FrameworkTitle=“BH90210”

This is my query but it doesn’t work and I don’t know what I have to change.

declare namespace rp210Elements=“urn:SMPTE:Dictionary”
for $a in input()/DVD
let $b := $a/Production/rp210Elements:FrameworkTitle and $c := $a/Production/rp210Elements:FrameworkTitle
where contains(string($b), “Nijinski”) and contains(string($c), “Nijinski”)
return $a

I need to show the information of DVD and only the branches that make good the condition of contain the word Nijinski.
If someone could help me or give me any idea about how to do it I will be very grateful. I enclose also the xml file.
Thanks a lot for your attention.
Regards,
Diego

Hi Diego,
I couldn’t get my hands on your XML example, but if I read your example correctly I would suggest something like the xquery below.

There is no chance of your university/employer granting you some Tamino training ?

  • The Software AG nordic training for Tamino is in Copenhagen - and I would love to help you :wink:
    Finn
  • Tamino trainer in SAG nordic

declare namespace rp210Elements=“urn:SMPTE:Dictionary”
for $a in input()/DVD
where tf:containsText($a/Production/rp210Elements:FrameworkTitle, “Nijinski”) and tf:containsText($a/Production/rp210Elements:FrameworkTitle, “Nijinski”)
return $a

Thanks a lot for your help,
The problem is that the result of the query is not good still. I get the whole xml file and I only want to get the DVD and the branches where appear the word “Nijinski”.

declare namespace rp210Elements=“urn:SMPTE:Dictionary”
declare namespace DMS1=“urn:SMPTE:Groups:DMS1”
for $a in input()/DVD
where tf:containsText($a/Production/rp210Elements:FrameworkTitle, “Nijinski”) and
tf:containsText($a/Media/DMS1:ClipFramework/rp210Elements:FrameworkTitle, “Nijinski”)
return $a

I need that my reply doesn’t include the branch where appear “BH90210”.

DVD->Production->rpElements:FrameworkTitle=“Nijiski”
DVD->Production->rpElements:FrameworkTitle=“BH90210”
DVD->Media ->rpElements:FrameworkTitle=“Nijiski”
DVD->Media ->rpElements:FrameworkTitle=“BH90210”

Anyway thanks a lot for your help,
Diego