Hi,
As far as I understand your post you try to do a cross-collection join in order to retrieve all contracts that are related to a particular organisational unit.
I think the following query should do the job:
declare namespace ctC=?contract/contract?
declare namespace ctO=“contract/contractOrganisation”
for $a in collection(?contractColl?)/ctC:contract
where for $b in collection(?contractOrg?)/ctO:contractOrganisation//ctO:OrganisationalUnit
where $b/ctO:ou =?toto? and $b//ctO:OrganisationalPerson/ctO:cn = $a/ctC:contractResponsibleUid
return $a/@ctC:ID
It iterates over all contracts and checks for each contract if there is an OrganizationalUnit named ?toto? that has an OrganisationalPerson that is referred by the ctC:contractResponsibleUid sequence. For each successfully checked contract the ID attribute is returned. Please be ware that I didn?t check the query with the Tamino XQuery processor. So it may contain some syntax or typing errors.
Best regards,
Thorsten Fiebig
#webMethods#API-Management#Tamino