Providing I have such an element in ML:
<top-level-cote-mgt-rights>
<token>SUPPORT</token>
<token role="ADMIN">A/B/C</token>
<token role="APPROVER">A/B/C</token>
<token role="ADMIN">X/Y/Z</token>
<token role="APPROVER">X/Y/Z</token>
<token role="ADMIN">ADMIN/ONLY</token>
</top-level-cote-mgt-rights>
The following query is meant to look for token elements for which both the value is "ADMIN/ONLY" and the role attribute is "APPROVER"
let $uris := cts:uris('', (), cts:and-query((
cts:collection-query('/test/data'),
cts:element-query(xs:QName('top-level-cote-mgt-rights'),
cts:element-query(xs:QName('token'),
cts:and-query((
cts:element-attribute-word-query(xs:QName('token'), xs:QName('role'), 'APPROVER', ('exact'))
,cts:word-query('ADMIN/ONLY', ('exact'))
))
)
)
)))
return fn:doc($uris)//one:top-level-cote-mgt-rights
It should not return any result, and yet, it does return
<top-level-cote-mgt-rights xmlns="http://one.oecd.org/one">
<token>SUPPORT</token>
<token role="ADMIN">A/B/C</token>
<token role="APPROVER">A/B/C</token>
<token role="ADMIN">X/Y/Z</token>
<token role="APPROVER">X/Y/Z</token>
<token role="ADMIN">ADMIN/ONLY</token>
</top-level-cote-mgt-rights>
Looks like it is matching separately on an "token" value and on an "token" attribute, but not from the same "token" like I am trying to achieve.
What am I doing wrong?