Just confirming observations: ML 4.2
Here is my test setup:
=====
xquery version "1.0-ml";
declare namespace ft='full';
declare option xdmp:mapping "false";
let $nodes :=
(<ft:docroot f="t1"><ft:a>val1</ft:a></ft:docroot>
,<ft:docroot f="t2"><ft:a><ft:p><ft:c>val2</ft:c></ft:p></ft:a></ft:docroot>
,<ft:docroot f="t3"><ft:a><ft:p><ft:c
label="xxx">val3</ft:c></ft:p></ft:a></ft:docroot>
,<ft:docroot f="t4"><ft:a><ft:c label="xxx">val4</ft:c></ft:a></ft:docroot>
,<ft:docroot f="t5"><ft:p><ft:q><ft:c
label="zzz">val5</ft:c></ft:q></ft:p></ft:docroot>
,<ft:docroot f="t6"><ft:p><ft:q><ft:c
label="yyy">val6</ft:c></ft:q></ft:p></ft:docroot>
)
for $n in $nodes
return
let $filename := $n/@f
let $pathname := fn:string-join(("/test-", $filename, ".xml"),"")
return xdmp:document-insert( $pathname, $n)
=====
What to find:
Query1: All doc uris where q/c/@label exists.
--------
I looked at cts functions, but could not find direct solution for attributes.
However, for finding elements, cts:element-query works well. So...
(fn:collection()[.//ft:p//ft:c/@label])
with xdmp:node-uri.
or even
xdmp:plan(fn:collection()//ft:p//ft:c[./@label])
List cache resources seemed better with above.
Q:
Is the above possible with cts functions?
What if I wanted to combine an XPath search with say element-value-query, how
would XPath be mixed and matched with cts functions?
cts:element-value-query(xs:QName("ft:c"), "val4")
Query2:All doc uris where q/c/@label != xxx.
--------
cts functions have cts:not-query, which is not desired.
And since need XPath to test for existence, use XPath.
Q.Any way using cts functions?
Q. If I put string range index on label att...then some way for cts search
functions to be used?
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general