I am getting this error since we made a field multi-valued (a list of multiple of the same elements):
argX is not of type xs:anyAtomicType?
This is the query that we are using to get values from MarkLogic:
declare variable $uris as xs:string external;
for $uri in tokenize($uris,';')
let $doc := fn:doc($uri)
return xdmp:gzip(
xdmp:unquote(fn:concat(
"<item>",
"<uri>",
$uri,
"</uri>",
"<date-loaded>",
$doc/date-loaded,
"</date-loaded>",
"<collections>",
string-join(xdmp:document-get-collections($uri), ";"),
"</collections>",
"</item>"
))
)
Now the field <date-loaded>
can have multiple values like this:
<date-loaded>2020-01-01</date-loaded>
<date-loaded>2020-01-02</date-loaded>
<date-loaded>2020-01-03</date-loaded>
Here the order is important. How should I change this query in a correct one that retrieves all the values of date-loaded
and put them each in a separate XML element?