XML:
<data>
<providers>
<provider num="v1">
<name>Smith</name>
<state>20</state>
<city>London</city>
</provider>
<provider num="v2">
<name>Jones</name>
<state>10</state>
<city>Paris</city>
</provider>
<provider num="v3">
<name>Adams</name>
<state>30</state>
<city>Athens</city>
</provider>
</providers>
</data>
XQuery:
let $p := doc("providers.xml")/data/providers/provider
where $p/state > 15
return <cities>{concat($p/city/text(), ' , ')}</cities>
I want the output to be the name of the cities, one after the other separated by comma, but I get the error: item expected, sequence found.