bosari
bosari

Reputation: 2000

Which cts: query to use to eliminate the doc that contains a particular element?

I'm pulling a list of uris from meters database based on a timestamp. This is the code -

cts:uris( (),  (),  cts:and-query((
                cts:collection-query("meters") ,
                cts:element-value-query(xs:QName("mt:period"), "raw"),
                cts:element-range-query( xs:QName("mt:end-time"),  ">=", xs:dateTime("2018-02-17T05:37:00") ),
)
                 )
                              ))

But it is including keystore-raw.xml which is not the file that i want in the result set? How can I remove it from the result set. The parent element is keystore-metrics and also has elements like keystore-metric. I don't want any for loop.

Upvotes: 1

Views: 190

Answers (1)

To make sure an element exists in a document:

cts:element-query(xs:QName("Your-element"), cts:true-query())

To make sure an element does NOT exist in a document:

cts:not-query(cts:element-query(xs:QName("Your-element"), cts:true-query()))

Why does this work? Because the cts:element-query() confirms that the element is in the document and the cts:true-query() satisfies the requirements of the cts:element-query()

Upvotes: 5

Related Questions