如何根据页面的 属性 使用 Xpath 获取多个 cq 页面

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

我有两个 cq 页面,我想使用 XPATH jcr:title 属性 检索这两个页面。以下查询适用于单身人士。

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

但我想为多个项目开脱。我已尝试使用以下选项,但它不起作用

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

谁能帮我写一个 xpath 查询?

正如评论中已经提到的 rakhi4110,您可以将多个 where 子句与 or 组合在一起,就像 SQL 中一样。尽管我认为您要么想要完全匹配,要么使用 jcr:containts 而不是 jcr:like

精确匹配:

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

包含:

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

或者,如果您真的想使用 jcr:like,如 SQL,使用 % 作为通配符:

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