关于 XQuery 中 contains() 格式的问题
我的 XQuery 工作得很好,但我总是使用精确匹配,例如:
concat(' and title ="',$title,'"')
但是,这在现实世界中不起作用,因为我们需要更改精确匹配以包含。
在本例中,标题是一个 XML 元素,$title 是 XQuery 中定义的变量,我们想要的不仅仅是使用等号,而是测试标题是否包含子字符串 $title。
我已经尝试过该语法,但仍然失败,任何人都可以帮助我获得将“=”更改为包含的正确语法吗?
提前致谢。
my XQuery worked perferctly, but I've always used exact match, like:
concat(' and title ="',$title,'"')
However, this is not going to work in real world, since we need to change the exact match to contain.
In this case, the title is an XML element, $title is the variable defined in the XQuery, what we want is to do not just use equal sign but test whether the title contains the substring $title.
I've played around with the syntax but still failed, could anyone help me on getting the right syntax for changing the "=" to the contains?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用:
Use:
应该变成
但我真的不明白你想用 concat 做什么。您是否尝试使用 XQuery 生成 XQuery 表达式?在这种情况下你可以
改为
should become
But I don't understand really what you're trying to do with concat. Are you trying to generate an XQuery expression using XQuery? In that case you could change
to