Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

How to fetch multiple cq pages using Xpath based on page's property

Avatar

Level 3

I have two cq page and I want to retrive these two using jcr:title property using XPATH. The below query is working fine for single.

    /jcr:root/content/test//element(*, cq:Page)[((jcr:like(jcr:content/@jcr:title, dell)))]

 But I want to excuate it for multiple items. I have tried with following option but it is not working

    /jcr:root/content/test//element(*, cq:Page)[((jcr:like(jcr:content/@jcr:title, [dell,samusng])))]

Could anyone help me to write xpath query?

1 Reply

Avatar

Level 10

use or condition & also i don;t understand why you don;t have %.  Any how query will be some thing like

/jcr:root/content/test//element(*, cq:Page)[((jcr:like(jcr:content/@jcr:title, '%dell%') or jcr:like(jcr:content/@jcr:title, '%samsung%')))]