summaryrefslogtreecommitdiff
path: root/test/syntax/code/xquery
diff options
context:
space:
mode:
Diffstat (limited to 'test/syntax/code/xquery')
-rw-r--r--test/syntax/code/xquery20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/syntax/code/xquery b/test/syntax/code/xquery
new file mode 100644
index 00000000..9ac5efdf
--- /dev/null
+++ b/test/syntax/code/xquery
@@ -0,0 +1,20 @@
+declare option output:method 'json';
+
+(
+let $map := map { 'R': 'red', 'G': 'green', 'B': 'blue' }
+return (
+ $map?* (: 1. returns all values; same as: map:keys($map) ! $map(.) :),
+ $map?R (: 2. returns the value associated with the key 'R'; same as: $map('R') :),
+ $map?('G','B') (: 3. returns the values associated with the key 'G' and 'B' :)
+),
+
+('A', 'B', 'C') => count(),
+
+for $country in db:open('factbook')//country
+where $country/@population > 100000000
+let $name := $country/name[1]
+for $city in $country//city[population > 1000000]
+group by $name
+return <country name='{ $name }'>{ $city/name }</country>
+
+)