Check for cts: query attribute

cts:element-query(xs:QName("elm"),cts:and-query(())) will provide all fragments in which the elm element is present.

Similarly, if I need all the documents in which an attribute (like atr ) is present in elm , what should I do?

cts:element-attribute-value-query() requires me to pass the value corresponding to the attribute value. But I want to check only the presence of the attribute no matter what value it contains.

+6
source share
2 answers

You can make it simple cts: element-attribute-value-query

 cts:element-attribute-value-query( xs:QName('element'), xs:QName('attribute'), '*')) 

If you did not set the wildcard lookup to true in the database, you also need to provide a wildcard lookup explicitly in cts: element-attribute-value-query

 cts:element-attribute-value-query( xs:QName('element'), xs:QName('attribute'), '*', ("wildcarded"))) 

For more information about this, you can check the cts: element-attribute-value-query page

+3
source

Try using a wildcard. One difference between elements and attributes is that elements can be empty. Attributes cannot, so they must always match the pattern. You may need to include some character indexes for optimal performance.

 cts:element-attribute-value-query( xs:QName('div'), xs:QName('id'), '*')) 
+1
source

All Articles