Hello, 

I want to devise a generic xquery script, which accepts actual XPATH to be run across all documents in all databases, from command line. Something like:

curl -i "http://localhost:8984/rest?run=get_query_result.xq&n=/root/*//calls/@name/string()"

Basically, parameter "n" would hold the query.

I am trying this using xquery module eval method. But, am not succeeding in it. I have my script something as under:

declare variable $n as xs:string external;
declare option output:item-separator "
";

let $aList :=
for $db in db:list()
let $vars := map {'db_name':$db , 'query' : $n}
let $query_to_execute := "db:open($db_name)$query"
return xquery:eval($query_to_execute,$vars)

return distinct-values($aList)

My questions are:

1. Can we assign dynamic values as a value to a map's key ?
2. Can I map have more than one key, in query:eval ?

Please point me in right direction, or explain what am I doing wrong in above code ..

- Mansi