Added "halts" in addition to stations
[quandoparte] / application / resources / stations / generatelist.xq
1 <stations>
2 {
3 for $doc in (
4         'nord.osm',
5         'nordovest.osm',
6         'nordest.osm',
7         'liguria.osm',
8         'centronord.osm', 
9         'centrosud.osm', 
10         'sud.osm', 
11         'sicilia.osm', 
12         'puglia.osm', 
13         'sardegna.osm',
14         'h-nord.osm',
15         'h-nordovest.osm',
16         'h-nordest.osm',
17         'h-liguria.osm',
18         'h-centronord.osm', 
19         'h-centrosud.osm', 
20         'h-sud.osm', 
21         'h-sicilia.osm', 
22         'h-puglia.osm', 
23         'h-sardegna.osm')
24 for $node in doc($doc)//node
25 where $node/tag[@k='name'] and (
26 fn:not(fn:exists($node//tag[@k='disused'])) or fn:contains($node//tag[@k='disused']/@v, 'no') 
27 ) and (
28 $node/tag[@k='operator'] and (
29 fn:contains($node//tag[@k='operator']/@v, 'RFI') or 
30 fn:contains($node//tag[@k='operator']/@v, 'Centostazioni') or 
31 fn:contains($node//tag[@k='operator']/@v, 'Grandi Stazioni')))
32 return 
33 <station>
34 <pos>{
35 data($node/@lat)
36 },{
37 data($node/@lon)
38 }
39 </pos>
40 <name>
41 {
42 data($node//tag[@k='name']/@v)
43 }
44 </name>
45 </station>
46 }
47 </stations>