XPATH query to retrieve documents from different root folders

Hi guys,

We have a document type (Articles) that contains a multi-value property of which is another document type (Categories). These document types are in multiple languages with each language having it’s own root folder.

Articles of one language should only contain categories from that of it’s own language. We are trying to create an XPath query to return all articles that contain at least one Category of a different root folder (e.g. en/US Article containing an en/CA Category) .

Since our system contains a large number of Articles we are trying to avoid looking trough every Category within every Article individually, whilst trying to make this as quick as possible and XPath query seems to be the best option.

We have tried multiple queries similar to the following but have had no luck preventing Articles that solely contain Categories from the en/US folder from being returned:

/jcr:root/content/documents/en/US//element(*,EAP:Article)[@EAP:categories/hippo:docbase!='5455b164-b7fa-4cc9-b180-bfdd3d71ccf7' and @EAP:categories/hippo:docbase!='8ec09a26-15a0-49ac-8dfc-33a8999fd247' and @EAP:categories/hippo:docbase!='6b4e3185-d50d-440f-af12-fae4cc0f2b47' and @EAP:categories/hippo:docbase!='3f7b6359-5d6c-4a0d-a091-1d84f73775b4' and @EAP:categories/hippo:docbase!='cafebabe-cafe-babe-cafe-babecafebabe']

Thank you in advance for your time,
Razvan Adam

If you don’t have too many Canadian category documents perhaps you can do [@EAP:categories/hippo:docbase = ‘uuid1’ or @EAP:categories/hippo:docbase!=‘uuid2’ where uuid1 and uuid2 are the handle uuids or the Canadian ones of course.

Otherwise maybe prevent earlier to not select Canadian categories from US articles?

We did not manage to do it via XPath query so instead we did it programatically.