使用cts:query检查属性的存在 [英] Checking presence of attribute with cts:query
问题描述
cts:element-query(xs:QName("elm"),cts:and-query(()))
将给出元素 elm 存在的所有片段.
cts:element-query(xs:QName("elm"),cts:and-query(()))
will give all the fragments where the element elm is present.
类似地,如果我希望在 elm 下存在属性(例如 atr )的所有文档,我该怎么办?
Similarly if I want all documents where an attribute(say atr) is present under elm what would I have to do?
cts:element-attribute-value-query()
要求我传递一个值以与属性值匹配.但是我只想检查该属性的存在,而不管它包含什么值.
cts:element-attribute-value-query()
requires that I pass a value to match against the attribute value. But I want to check only the existence of the attribute irrespective of what value it contains.
推荐答案
您可以通过简单的cts:element-attribute-value-query
You can do it by a simple cts:element-attribute-value-query
cts:element-attribute-value-query(
xs:QName('element'), xs:QName('attribute'), '*'))
如果您尚未在数据库中将通配符搜索设置为true,则还需要在cts:element-attribute-value-query
In case you have not set wildcarded search true in database, you also need to provide wildcarded enabled search explicitly in cts:element-attribute-value-query
cts:element-attribute-value-query(
xs:QName('element'), xs:QName('attribute'), '*', ("wildcarded")))
有关此详细信息,您可以检查 cts:element-attribute-value-query 页面
For more details on this you can check cts:element-attribute-value-query page
这篇关于使用cts:query检查属性的存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!