Thanks. Your query does not yield “Value has more than one item”, at least with the latest snapshot of BaseX. But maybe you are expecting another result?
On Tue, Dec 12, 2017 at 1:30 PM, Hondros, Constantine (ELS-AMS) C.Hondros@elsevier.com wrote:
Hi Christian,
I was already kicking myself for rushing and not providing a SCE! Please see the code below, and thanks.
declare option output:method 'json';
declare variable $authors := <authors>
<author> <given-name>Robert A</given-name> <surname>Sanders</surname> </author> <author> <given-name>Emily</given-name> <surname>Chapel</surname> </author>
</authors>;
map {
"authors": [ (for $b in $authors/author return map{"fn":$b/*:given-name/text(), "ln":$b/*:surname/text()}) ]
}
-----Original Message----- From: Christian Grün [mailto:christian.gruen@gmail.com] Sent: 12 December 2017 13:20 To: Hondros, Constantine (ELS-AMS) Cc: basex-talk@mailman.uni-konstanz.de Subject: Re: [basex-talk] XQuery 3.1/Build array of maps dynamically
*** External email: use caution ***
Hi Constantine,
(: just assume $authors is populated ...:)
Could you provide us with a little self-contained example? Because there are all kinds of populations out there.
TIA as well,
Christian
Elsevier B.V. Registered Office: Radarweg 29, 1043 NX Amsterdam, The Netherlands, Registration No. 33156677, Registered in The Netherlands.