File: default.txt

package info (click to toggle)
highlight.js 10.7.3%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,332 kB
  • sloc: javascript: 41,059; makefile: 157; python: 29; sh: 20
file content (30 lines) | stat: -rw-r--r-- 855 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
xquery version "3.1";
(:~
 : @author Duncan Paterson
 : @version 1.0:)

declare variable $local:num := math:log10(12345);

(
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' :)
),

declare function local:city($country as node()*) as element (country) {
for $country in doc('factbook')//country
where $country/@population > 100000000
let $name := $country/name[1]
for $city in $country//city[population gt 1000000]
group by $name
return
   element country { attribute type { $name },
    $city/name }
};

return
('A', 'B', 'C') => count(),

<root>{local:city(.) + $local:num}</root>