Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

How to use OR operator in xpath query language?

Avatar

Level 9

Hi All,

How to use OR operator for two different values of a JCR property?

Please help me with the syntax.

I want to get the results with two different values for cq:template property.

Thanks,

Kishore

1 Accepted Solution

Avatar

Correct answer by
Level 3

Refer the below queries for example

/jcr:root/content//*[@pageTitle='GeoMetrixx' or @jcr:title='Geometrixx Media']

In the above query i  am searching with two properties pagetitle and jcr:title with OR operator.Even AND operator work as well.

/jcr:root/content//*[@cq:template='/libs/cq/core/content/projects/templates/creative-project-management' or @cq:template='/libs/cq/core/content/projects/templates/default'] which searches for cq:template property with 2 different values.

 

Refer the below doc for more information.

http://www.fadfish.com/anatomy-of-xpath-queries-in-aem.

https://docs.jboss.org/jbossdna/0.7/manuals/reference/html/jcr-query-and-search.html#jcr-xpath-query....

View solution in original post

3 Replies

Avatar

Correct answer by
Level 3

Refer the below queries for example

/jcr:root/content//*[@pageTitle='GeoMetrixx' or @jcr:title='Geometrixx Media']

In the above query i  am searching with two properties pagetitle and jcr:title with OR operator.Even AND operator work as well.

/jcr:root/content//*[@cq:template='/libs/cq/core/content/projects/templates/creative-project-management' or @cq:template='/libs/cq/core/content/projects/templates/default'] which searches for cq:template property with 2 different values.

 

Refer the below doc for more information.

http://www.fadfish.com/anatomy-of-xpath-queries-in-aem.

https://docs.jboss.org/jbossdna/0.7/manuals/reference/html/jcr-query-and-search.html#jcr-xpath-query....

Avatar

Level 7

Hi Kishore@CQ,

If your problem has been solved, please mark it as solved.

Regards

Tuhin