gpt4 book ai didi

xpath - 如何基于页面属性使用Xpath提取多个CQ页面

转载 作者:行者123 更新时间:2023-12-03 17:32:58 25 4
gpt4 key购买 nike

我有两个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子句与an或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%')]

关于xpath - 如何基于页面属性使用Xpath提取多个CQ页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31579010/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com