I answer to myself : db:open('factbook')//city/@name/string() will works fine.
Still, is there a best way ? Is there some problems with that ? Is the element way better for xquery web usage ?
Cheers
Florent
On Thu, May 7, 2015 at 2:18 AM, Florent Gallaire fgallaire@gmail.com wrote:
In the RESTXQ documentation there is this example which works fine :
declare %rest:path("cities") %output:method("json") %output:json("format=jsonml") function page:cities() { element cities { db:open('factbook')//city/name } };
If I have the same factbook db but with name as attribute and not as element, with the only change in the code the xquery request db:open('factbook')//city/@name I will have the error message: [XQDY0025] Duplicate attribute 'name'.
That's ok, but what is the right way in xquery to easily use multiple attributes as return value of request.
Is the right way to prefer elements to attributes ?
Cheers
Florent
-- FLOSS Engineer & Lawyer