Xpath to fetch hst:component which doesn't contain a specific hst:containerItemComponent

Hi,

I have a scenario to fetch all the hst:components that doesn’t contain a specific hst:containerItemComponent with hst:label as “ABC” using xpath from cms/repository.

I have tried below xpath queries but not successful so far.

  1. //project//element(,hst:component)[descendant::hst:containeritemcomponent/@hst:label=‘ABC’]
    2)//project//element(
    ,hst:component)[jcr:contains(.//hst:containeritemcomponent/@hst:label, ‘ABC’)]

Thank You

Hi,
The simplest form would be
//element(*, hst:containeritemcomponent)[@hst:label='ABC']
where the square brackets serve as where-clause.
HTH
Jeroen

Hi Jeroen

Thank you for quick response.
Finding the hst:containeritemcomponent is not an issue.
I am facing difficulty while trying to get the component/pages that does not contain a particular containeritemcomponent.

Correcting above queries
.

  1. //project//element(,hst:component)[descendant::hst:containeritemcomponent/@hst:label !=‘ABC’]
    2)//project//element(
    ,hst:component)[not(jcr:contains(.//hst:containeritemcomponent/@hst:label, ‘ABC’))]