index.html
263 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
<?xml version="1.0" encoding="utf-8"?>
<!--{xml-fix} XSLT Processor: SAXON 9.3.0.5 from Saxonica SAXON EE 9.3.0.5--><!--This document was created at 20111206 1709-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="EN" xml:lang="EN">
<head>
<meta name="generator" content=
"HTML Tidy for Windows (vers 14 February 2006), see www.w3.org" />
<title>XQueryX 3.0</title>
<style type="text/css">
/*<![CDATA[*/
code { font-family: monospace; }
div.constraint,
div.issue,
div.note,
div.notice { margin-left: 2em; }
div.issue
p.title { margin-left: -2em; }
ol.enumar { list-style-type: decimal; }
ol.enumla { list-style-type: lower-alpha; }
ol.enumlr { list-style-type: lower-roman; }
ol.enumua { list-style-type: upper-alpha; }
ol.enumur { list-style-type: upper-roman; }
li p { margin-top: 0.3em;
margin-bottom: 0.3em; }
sup small { font-style: italic;
color: #8F8F8F;
}
div.exampleInner pre { margin-left: 1em;
margin-top: 0em; margin-bottom: 0em}
div.exampleOuter {border: 4px double gray;
margin: 0em; padding: 0em}
div.exampleInner { background-color: #d5dee3;
border-top-width: 4px;
border-top-style: double;
border-top-color: #d3d3d3;
border-bottom-width: 4px;
border-bottom-style: double;
border-bottom-color: #d3d3d3;
padding: 4px; margin: 0em }
div.exampleWrapper { margin: 4px }
div.exampleHeader { font-weight: bold;
margin: 4px}
div.issue { border-bottom-color: black;
border-bottom-style: solid;
border-bottom-width: 1pt;
margin-bottom: 20pt;
}
th.issue-toc-head { border-bottom-color: black;
border-bottom-style: solid;
border-bottom-width: 1pt;
}
table.small { font-size: x-small; }
a.judgment:visited, a.judgment:link { font-family: sans-serif;
color: black;
text-decoration: none }
a.processing:visited, a.processing:link { color: black;
text-decoration: none }
a.env:visited, a.env:link { color: black;
text-decoration: none }
/*]]>*/
</style>
<link rel="stylesheet" type="text/css" href=
"http://www.w3.org/StyleSheets/TR/W3C-WD.css" />
</head>
<body>
<div class="head">
<p><a href="http://www.w3.org/"><img src=
"http://www.w3.org/Icons/w3c_home" alt="W3C" height="48" width=
"72" /></a></p>
<h1><a name="title" id="title"></a>XQueryX 3.0</h1>
<h2><a name="w3c-doctype" id="w3c-doctype"></a>W3C Working Draft 13
December 2011</h2>
<dl>
<dt>This version:</dt>
<dd><a href=
"http://www.w3.org/TR/2011/WD-xqueryx-30-20111213/">http://www.w3.org/TR/2011/WD-xqueryx-30-20111213/</a></dd>
<dt>Latest version:</dt>
<dd><a href=
"http://www.w3.org/TR/xqueryx-30/">http://www.w3.org/TR/xqueryx-30/</a></dd>
<dt>Previous versions:</dt>
<dd><a href=
"http://www.w3.org/TR/2011/WD-xqueryx-30-20110614/">http://www.w3.org/TR/2011/WD-xqueryx-30-20110614/
,</a> <a href=
"http://www.w3.org/TR/2010/WD-xqueryx-30-20101214/">http://www.w3.org/TR/2010/WD-xqueryx-30-20101214/
,</a> <a href=
"http://www.w3.org/TR/2009/WD-xqueryx-11-20091215/">http://www.w3.org/TR/2009/WD-xqueryx-11-20091215/
,</a> <a href=
"http://www.w3.org/TR/2008/WD-xqueryx-11-20081203/">http://www.w3.org/TR/2008/WD-xqueryx-11-20081203/</a></dd>
<dt>Editor:</dt>
<dd>Jim Melton, Oracle <a href=
"mailto:jim.melton@oracle.com"><jim.melton@oracle.com></a></dd>
</dl>
<p>See also <a href=
"http://www.w3.org/2003/03/Translations/byTechnology?technology=xqueryx-30">
<strong>translations</strong></a>.</p>
<p>This document is also available in these non-normative formats:
<a href=
"http://www.w3.org/TR/2011/WD-xqueryx-30-20111213/xqueryx-30.xml">XML</a>,
<a href=
"http://www.w3.org/TR/2011/WD-xqueryx-30-20111213/xqueryx-30-diff.html">
Change markings relative to previous Working Draft</a>,
and <a href=
"http://www.w3.org/TR/2010/REC-xqueryx-20101214/">Most recent
XQueryX Recommendation</a>.</p>
<p class="copyright"><a href=
"http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2011 <a href="http://www.w3.org/"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup>
(<a href="http://www.csail.mit.edu/"><acronym title=
"Massachusetts Institute of Technology">MIT</acronym></a>, <a href=
"http://www.ercim.eu/"><acronym title=
"European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>,
<a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.
W3C <a href=
"http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
<a href=
"http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
and <a href=
"http://www.w3.org/Consortium/Legal/copyright-documents">document
use</a> rules apply.</p>
</div>
<hr />
<div>
<h2><a name="abstract" id="abstract"></a>Abstract</h2>
<p>This document defines an XML Syntax for <span><a href=
"#xquery-30">[XQuery 3.0: An XML Query Language]</a></span> .</p>
</div>
<div>
<h2><a name="status" id="status"></a>Status of this Document</h2>
<p><em>This section describes the status of this document at the
time of its publication. Other documents may supersede this
document. A list of current W3C publications and the latest
revision of this technical report can be found in the <a href=
"http://www.w3.org/TR/">W3C technical reports index</a> at
http://www.w3.org/TR/.</em></p>
<p>This is one document in a set of seven documents that are being
progressed to Recommendation together (XQuery 3.0, XQueryX 3.0,
XSLT 3.0, Data Model 3.0, Functions and Operators 3.0,
Serialization 3.0, XPath 3.0).</p>
<p>This is a <a href=
"http://www.w3.org/2005/10/Process-20051014/tr.html#last-call">Last
Call Working Draft</a> as described in the <a href=
"http://www.w3.org/2005/10/Process-20051014/tr.html">Process
Document</a>. It was developed by the W3C <a href=
"http://www.w3.org/XML/Query/">XML Query Working Group</a>, which
is part of the <a href="http://www.w3.org/XML/Activity">XML
Activity</a>. Comments on this document will be formally accepted
at least through 10 February 2012. The Working Group expects to
advance this specification to <a href=
"http://www.w3.org/2005/10/Process-20051014/tr.html#RecsW3C">Recommendation</a>
Status.</p>
<p>This Last Call Working Draft makes a small number of substantive
technical changes (as well as many editorial changes), including
new features, adopted since the previous Working Draft was
published. The Working Group especially solicits comments on this
Draft from other W3C Working Groups, as well as from the general
public. Please note that this Working Draft of XQueryX 3.0
represents the second version of <a href=
"http://www.w3.org/TR/2010/REC-xqueryx-20101214/">a previous W3C
Recommendation</a>.</p>
<p>No implementation report currently exists. However, a Test Suite
for XQueryX 3.0 is under development.</p>
<p>This document incorporates changes made against the previous
publication of the Working Draft. Changes to this document since
the previous publication of the Working Draft are detailed in
<a href="#changelog"><b>D Change log</b></a>.</p>
<p>Please report errors in this document using W3C's <a href=
"http://www.w3.org/Bugs/Public/">public Bugzilla system</a>
(instructions can be found at <a href=
"http://www.w3.org/XML/2005/04/qt-bugzilla">http://www.w3.org/XML/2005/04/qt-bugzilla</a>).
If access to that system is not feasible, you may send your
comments to the W3C XSLT/XPath/XQuery public comments mailing list,
<a href=
"mailto:public-qt-comments@w3.org">public-qt-comments@w3.org</a>.
It will be very helpful if you include the string “[XQueryX30 or
XQX30]” in the subject line of your report, whether made in
Bugzilla or in email. Please use multiple Bugzilla entries (or, if
necessary, multiple email messages) if you have more than one
comment to make. Archives of the comments and responses are
available at <a href=
"http://lists.w3.org/Archives/Public/public-qt-comments/">http://lists.w3.org/Archives/Public/public-qt-comments/</a>.</p>
<p>Publication as a Working Draft does not imply endorsement by the
W3C Membership. This is a draft document and may be updated,
replaced or obsoleted by other documents at any time. It is
inappropriate to cite this document as other than work in
progress.</p>
<p>This document was produced by a group operating under the
<a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5
February 2004 W3C Patent Policy</a>. W3C maintains a <a href=
"http://www.w3.org/2004/01/pp-impl/18797/status#disclosures">public
list of any patent disclosures</a> made in connection with the
deliverables of the group; that page also includes instructions for
disclosing a patent. An individual who has actual knowledge of a
patent which the individual believes contains <a href=
"http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">
Essential Claim(s)</a> must disclose the information in accordance
with <a href=
"http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">
section 6 of the W3C Patent Policy</a>.</p>
</div>
<div class="toc">
<h2><a name="contents" id="contents"></a>Table of Contents</h2>
<p class="toc">1 <a href="#Introduction">Introduction</a><br />
2 <a href="#Mapping">Mapping the XQuery Syntax</a><br />
3 <a href="#Examples">Examples from the XML Query Use Cases in XML
Syntax</a><br />
    3.1 <a href="#Example1">Example 1</a><br />
        3.1.1 <a href=
"#Example1-XQuery">XQuery solution in XQuery Use Cases:</a><br />
        3.1.2 <a href=
"#Example1-XQueryX">A Solution in XQueryX:</a><br />
        3.1.3 <a href=
"#Example1-Transformation">Transformation of XQueryX Solution into
XQuery</a><br />
        3.1.4 <a href=
"#Example1-Abstract">Corresponding Grammar Abstract Parse
Tree</a><br />
    3.2 <a href="#Example2">Example 2</a><br />
        3.2.1 <a href=
"#Example2-XQuery">XQuery solution in XQuery Use Cases:</a><br />
        3.2.2 <a href=
"#Example2-XQueryX">A solution in XQueryX:</a><br />
        3.2.3 <a href=
"#Example2-Transformation">Transformation of XQueryX Solution into
XQuery</a><br />
    3.3 <a href="#Example3">Example 3</a><br />
        3.3.1 <a href=
"#Example3-XQuery">XQuery solution in XQuery Use Cases:</a><br />
        3.3.2 <a href=
"#Example3-XQueryX">A solution in XQueryX:</a><br />
        3.3.3 <a href=
"#Example3-Transformation">Transformation of XQueryX Solution into
XQuery</a><br />
    3.4 <a href="#Example4">Example 4</a><br />
        3.4.1 <a href=
"#Example4-XQuery">XQuery solution in XQuery Use Cases:</a><br />
        3.4.2 <a href=
"#Example4-XQueryX">A solution in XQueryX:</a><br />
        3.4.3 <a href=
"#Example4-Transformation">Transformation of XQueryX Solution into
XQuery</a><br />
4 <a href="#Schema">An XML Schema for the XQuery XML
Syntax</a><br />
5 <a href="#xqx_conformance">Conformance</a><br /></p>
<h3><a name="appendices" id="appendices"></a>Appendices</h3>
<p class="toc">A <a href="#biblio">References</a><br />
B <a href="#Stylesheet">Transforming XQueryX to XQuery</a><br />
C <a href="#xqueryx-id-mime-type">The application/xquery+xml Media
Type</a><br />
    C.1 <a href=
"#xqueryx-mime-introduction">Introduction</a><br />
    C.2 <a href=
"#xqueryx-mime-registration">Registration of MIME Media Type
application/xquery+xml</a><br />
        C.2.1 <a href=
"#xqueryx-mime-encoding">Encoding Considerations</a><br />
        C.2.2 <a href=
"#xqueryx-mime-security">Security Considerations</a><br />
        C.2.3 <a href=
"#xqueryx-mime-interoperability">Interoperability
Considerations</a><br />
        C.2.4 <a href=
"#xqueryx-mime-pubspec">Published specification</a><br />
        C.2.5 <a href=
"#xqueryx-mime-applications">Applications That Use This Media
Type</a><br />
        C.2.6 <a href=
"#xqueryx-mime-additional">Additional Information</a><br />
            C.2.6.1
<a href="#xqueryx-mime-recognizing">Recognizing XQuery Files
("Magic Numbers")</a><br />
            C.2.6.2
<a href="#xqueryx-mime-extensions">File Extensions</a><br />
            C.2.6.3
<a href="#xqueryx-mime-macfiletype">Macintosh File Type
Code(s)</a><br />
        C.2.7 <a href=
"#xqueryx-mime-author">Person and Email Address to Contact For
Further Information</a><br />
        C.2.8 <a href=
"#xqueryx-mime-intended-usage">Intended Usage</a><br />
        C.2.9 <a href=
"#xqueryx-mime-restrictions">Restrictions on usage</a><br />
        C.2.10 <a href=
"#xqueryx-mime-owner">Author/Change Controller</a><br />
        C.2.11 <a href=
"#xqueryx-mime-fragments">Fragment Identifiers</a><br />
D <a href="#changelog">Change log</a> (Non-Normative)<br />
    D.1 <a href=
"#changelog_substantive">Substantive changes</a><br />
    D.2 <a href=
"#changelog_incompatibilities">Incompatibilities</a><br />
    D.3 <a href=
"#changelog_editorial">Editorial changes</a><br /></p>
</div>
<hr />
<div class="body">
<div class="div1">
<h2><a name="Introduction" id="Introduction"></a>1
Introduction</h2>
<p>The <span><a href="#xquery-30-requirements">[XQuery 3.0
Requirements]</a></span> states that "The XML Query Language MAY
have more than one syntax binding. One query language syntax MUST
be convenient for humans to read and write. One query language
syntax MUST be expressed in XML in a way that reflects the
underlying structure of the query."</p>
<p>XQueryX is an XML representation of an XQuery. It was created by
mapping the productions of the XQuery grammar into XML productions.
The result is not particularly convenient for humans to read and
write, but it is easy for programs to parse, and because XQueryX is
represented in XML, standard XML tools can be used to create,
interpret, or modify queries.</p>
<p>In this document, examples and material labeled as "Note" are
provided for explanatory purposes and are not normative.</p>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p>Because the two syntaxes are merely different grammars that
express the same query semantics, they share all aspects of an
XQuery processing system except for the component that recognizes
and translates the source representation of a query (that is, the
parser). The aspects that are shared include both the static
context and the dynamic context that are defined in <span><a href=
"#xquery-30">[XQuery 3.0: An XML Query Language]</a></span> .</p>
</div>
<p>There are several environments in which XQueryX may be
useful:</p>
<ul>
<li>
<p><em>Parser Reuse.</em> In heterogeneous environments, a variety
of systems may be used to execute a query. One parser can generate
XQueryX for all of these systems.</p>
</li>
<li>
<p><em>Queries on Queries.</em> Because XQueryX is represented in
XML, queries can be queried and can be transformed into new
queries. For instance, a query can be performed against a set of
XQueryX queries to determine which queries use FLWOR expressions to
range over a set of invoices.</p>
</li>
<li>
<p><em>Generating Queries.</em> In some XML-oriented programming
environments, it may be more convenient to build a query in its
XQueryX representation than in the corresponding XQuery
representation, since ordinary XML tools can be used.</p>
</li>
<li>
<p><em>Embedding Queries in XML.</em> XQueryX can be embedded
directly in an XML document.</p>
</li>
</ul>
<p>This version of XQueryX is fully compatible with <span><a href=
"#xqueryx">[XML Syntax for XQuery 1.0 (XQueryX)]</a></span> . It
differs from that earlier version of the language by the addition
of new XML Schema definitions and XSLT stylesheet templates. All
queries expressed in the syntax defined by <span><a href=
"#xqueryx">[XML Syntax for XQuery 1.0 (XQueryX)]</a></span>
continue to be valid, with the same meaning, when processed by an
implementation of this version of XQueryX.</p>
<p>The most recent versions of the XQueryX XML Schema and the
XQueryX XSLT stylesheet are available at <a href=
"http://www.w3.org/2011/12/XQueryX/xqueryx.xsd">http://www.w3.org/2011/12/XQueryX/xqueryx.xsd</a>
and <a href=
"http://www.w3.org/2011/12/XQueryX/xqueryx.xsl">http://www.w3.org/2011/12/XQueryX/xqueryx.xsl</a>,
respectively.</p>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p>The locations at which the current versions of the XML Schema
and XSLT stylesheet are located during development of this
specification will vary with each Working Draft and Candidate
Recommendation of the spec that is published. The namespace target
URI is identical to that used for <span><a href="#xqueryx">[XML
Syntax for XQuery 1.0 (XQueryX)]</a></span> .</p>
</div>
</div>
<div class="div1">
<h2><a name="Mapping" id="Mapping"></a>2 Mapping the XQuery
Syntax</h2>
<p>XQueryX is an XML representation of the abstract syntax found in
Appendix A of <span><a href="#xquery-30">[XQuery 3.0: An XML Query
Language]</a></span> . The XQueryX syntax is defined by the XQueryX
Schema, which is specified in <a href="#Schema"><b>4 An XML Schema
for the XQuery XML Syntax</b></a>. The XQueryX semantics are
defined by a stylesheet that maps an instance of XQueryX to an
instance of XQuery; see <a href="#Stylesheet"><b>B Transforming
XQueryX to XQuery</b></a>.</p>
<p>The main data structure in the XQueryX Schema is the set of
types that describe expressions. We have chosen to model
expressions using substitution groups, with an "expr" abstract base
class and a number of intermediate abstract classes.</p>
<p>Consider the following productions from the abstract syntax:</p>
<div class="exampleInner">
<pre>
FLWORExpr ::= InitialClause IntermediateClause* ReturnClause
InitialClause ::= ForClause | LetClause | WindowClause
IntermediateClause ::= InitialClause | WhereClause | GroupByClause | OrderByClause | CountClause
ForClause ::= "outer"? "for" "$" VarName TypeDeclaration? PositionalVar? "in" ExprSingle
("," "$" VarName TypeDeclaration? PositionalVar? "in" ExprSingle)*
PositionalVar ::= "at" "$" VarName
LetClause ::= "let" "$" VarName TypeDeclaration? ":=" ExprSingle
("," "$" VarName TypeDeclaration? ":=" ExprSingle)*
WhereClause ::= "where" ExprSingle
</pre></div>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p>Those productions do not represent the entire FLWOR expression,
so some of the BNF non-terminal names are not resolved in the
example abstract syntax.</p>
</div>
<p>The following XQueryX Schema definitions reflect the structure
of those productions from that abstract syntax:</p>
<div class="exampleInner">
<pre>
<!-- The base class -->
<xsd:complexType name="expr"/>
<xsd:element name="expr" type="expr" abstract="true"/>
<!-- Simple wrapper class -->
<xsd:complexType name="exprWrapper">
<xsd:sequence>
<xsd:element ref="expr"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="flworExpr">
<xsd:complexContent>
<xsd:extension base="expr">
<xsd:sequence>
<xsd:choice>
<xsd:element ref="forClause"/>
<xsd:element ref="letClause"/>
<xsd:element ref="windowClause"/>
</xsd:choice>
<xsd:sequence>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element ref="forClause"/>
<xsd:element ref="letClause"/>
<xsd:element ref="windowClause"/>
<xsd:element ref="countClause"/>
<xsd:element ref="whereClause"/>
<xsd:element ref="groupByClause"/>
<xsd:element ref="orderByClause"/>
</xsd:choice>
<xsd:element ref="returnClause"/>
</xsd:sequence>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="flworExpr" type="flworExpr" substitutionGroup="expr"/>
<xsd:complexType name="forClause">
<xsd:sequence>
<xsd:element ref="forClauseItem" minOccurs="1" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="outer" type="xsd:boolean" default="false"/>
</xsd:complexType>
<xsd:element name="forClause" type="forClause"/>
<xsd:complexType name="forClauseItem">
<xsd:sequence>
<xsd:element ref="typedVariableBinding"/>
<xsd:element ref="positionalVariableBinding" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="forLetClauseItemExtensions" minOccurs="0"
maxOccurs="unbounded"/>
<xsd:element name="forExpr" type="exprWrapper"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="forClauseItem" type="forClauseItem"/>
<xsd:element name="forLetClauseItemExtensions" abstract="true"/>
<xsd:complexType name="letClause">
<xsd:sequence>
<xsd:element ref="letClauseItem" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="letClause" type="letClause"/>
<xsd:complexType name="letClauseItem">
<xsd:sequence>
<xsd:choice>
<xsd:sequence>
<xsd:element ref="typedVariableBinding"/>
<xsd:element ref="forLetClauseItemExtensions"
minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:element ref="forLetClauseItemExtensions"
minOccurs="0" maxOccurs="unbounded"/>
</xsd:choice>
<xsd:element name="letExpr" type="exprWrapper"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="letClauseItem" type="letClauseItem"/>
<xsd:element name="whereClause" type="exprWrapper"/>
</pre></div>
<p>Since XQuery uses the expression production liberally to allow
expressions to be flexibly combined, XQueryX uses the exprWrapper
type in embedded contexts to allow all expression types to
occur.</p>
</div>
<div class="div1">
<h2><a name="Examples" id="Examples"></a>3 Examples from the XML
Query Use Cases in XML Syntax</h2>
<p>Three of following examples are based on the data and queries in
the XMP (Experiences and Exemplars) use case in <span><a href=
"#xquery-30-use-cases">[XQuery 3.0 Use Cases]</a></span> , while a
fourth example is based on the data and queries in the NS (Queries
Using Namespaces) use case. For each example, we show the English
description of the query, the XQuery solution given in
<span><a href="#xquery-30-use-cases">[XQuery 3.0 Use
Cases]</a></span> , an XQueryX solution, and the XQuery that
results from applying the XQueryX-to-XQuery transformation defined
by the stylesheet in <a href="#Stylesheet"><b>B Transforming
XQueryX to XQuery</b></a> to the XQueryX solution. That produced
XQuery is presented only as a sanity-check — the intent of the
stylesheet is not to create the identical XQuery expression given
in <span><a href="#xquery-30-use-cases">[XQuery 3.0 Use
Cases]</a></span> , but to produce <em>a</em> valid XQuery
expression with the same semantics. The semantics of the XQueryX
solution are determined by the semantics of the XQuery expression
that results from that transformation. The "correctness" of that
transformation is determined by asking the following the question:
Can some XQueryX processor QX process some XQueryX document D1 to
produce results R1, after which the stylesheet is used to translate
D1 into an XQuery expression E1 that, when processed by some XQuery
processor Q, produces results R2 that are equivalent (under some
meaningful definition of "equivalent") to results R1?</p>
<p>Comparison of the results of the XQueryX-to-XQuery
transformation given in this document with the XQuery solutions in
the <span><a href="#xquery-30-use-cases">[XQuery 3.0 Use
Cases]</a></span> may be helpful in evaluating the correctness of
the XQueryX solution in each example.</p>
<p>The XQuery Use Cases solution given for each example is provided
only to assist readers of this document in understanding the
XQueryX solution. There is no intent to imply that this document
specifies a "compilation" or "transformation" of XQuery syntax into
XQueryX syntax.</p>
<p>In the following examples, note that path expressions are
expanded to show their structure. Also, note that the prefix syntax
for binary operators like "and" makes the precedence explicit. In
general, humans find it easier to read an XML representation that
does not expand path expressions, but it is less convenient for
programmatic representation and manipulation. XQueryX is designed
as a language that is convenient for production and modification by
software, and not as a convenient syntax for humans to read and
write.</p>
<p>Finally, please note that white space, including new lines, have
been added to some of the XQueryX documents and XQuery expressions
for readability. That additional white space is not produced by the
XQueryX-to-XQuery transformation.</p>
<div class="div2">
<h3><a name="Example1" id="Example1"></a>3.1 Example 1</h3>
<p>Here is Q1 from the <span><a href="#xquery-30-use-cases">[XQuery
3.0 Use Cases]</a></span> , use case XMP (Experiences and
Exemplars): "List books published by Addison-Wesley after 1991,
including their year and title."</p>
<div class="div3">
<h4><a name="Example1-XQuery" id="Example1-XQuery"></a>3.1.1 XQuery
solution in XQuery Use Cases:</h4>
<div class="exampleInner">
<pre>
<bib>
{
for $b in doc("http://bstore1.example.com/bib.xml")/bib/book
where $b/publisher = "Addison-Wesley" and $b/@year > 1991
return
<book year="{ $b/@year }">
{ $b/title }
</book>
}
</bib>
</pre></div>
</div>
<div class="div3">
<h4><a name="Example1-XQueryX" id="Example1-XQueryX"></a>3.1.2 A
Solution in XQueryX:</h4>
<div class="exampleInner">
<pre>
<?xml version="1.0"?>
<xqx:module xmlns:xqx="http://www.w3.org/2005/XQueryX"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2005/XQueryX
http://www.w3.org/2005/XQueryX/xqueryx.xsd">
<xqx:mainModule>
<xqx:queryBody>
<xqx:elementConstructor>
<xqx:tagName>bib</xqx:tagName>
<xqx:elementContent>
<xqx:flworExpr>
<xqx:forClause>
<xqx:forClauseItem>
<xqx:typedVariableBinding>
<xqx:varName>b</xqx:varName>
</xqx:typedVariableBinding>
<xqx:forExpr>
<xqx:pathExpr>
<xqx:stepExpr>
<xqx:filterExpr>
<xqx:functionCallExpr>
<xqx:functionName>doc</xqx:functionName>
<xqx:arguments>
<xqx:stringConstantExpr>
<xqx:value>http://bstore1.example.com/bib.xml</xqx:value>
</xqx:stringConstantExpr>
</xqx:arguments>
</xqx:functionCallExpr>
</xqx:filterExpr>
</xqx:stepExpr>
<xqx:stepExpr>
<xqx:xpathAxis>child</xqx:xpathAxis>
<xqx:nameTest>bib</xqx:nameTest>
</xqx:stepExpr>
<xqx:stepExpr>
<xqx:xpathAxis>child</xqx:xpathAxis>
<xqx:nameTest>book</xqx:nameTest>
</xqx:stepExpr>
</xqx:pathExpr>
</xqx:forExpr>
</xqx:forClauseItem>
</xqx:forClause>
<xqx:whereClause>
<xqx:andOp>
<xqx:firstOperand>
<xqx:equalOp>
<xqx:firstOperand>
<xqx:pathExpr>
<xqx:stepExpr>
<xqx:filterExpr>
<xqx:varRef>
<xqx:name>b</xqx:name>
</xqx:varRef>
</xqx:filterExpr>
</xqx:stepExpr>
<xqx:stepExpr>
<xqx:xpathAxis>child</xqx:xpathAxis>
<xqx:nameTest>publisher</xqx:nameTest>
</xqx:stepExpr>
</xqx:pathExpr>
</xqx:firstOperand>
<xqx:secondOperand>
<xqx:stringConstantExpr>
<xqx:value>Addison-Wesley</xqx:value>
</xqx:stringConstantExpr>
</xqx:secondOperand>
</xqx:equalOp>
</xqx:firstOperand>
<xqx:secondOperand>
<xqx:greaterThanOp>
<xqx:firstOperand>
<xqx:pathExpr>
<xqx:stepExpr>
<xqx:filterExpr>
<xqx:varRef>
<xqx:name>b</xqx:name>
</xqx:varRef>
</xqx:filterExpr>
</xqx:stepExpr>
<xqx:stepExpr>
<xqx:xpathAxis>attribute</xqx:xpathAxis>
<xqx:nameTest>year</xqx:nameTest>
</xqx:stepExpr>
</xqx:pathExpr>
</xqx:firstOperand>
<xqx:secondOperand>
<xqx:integerConstantExpr>
<xqx:value>1991</xqx:value>
</xqx:integerConstantExpr>
</xqx:secondOperand>
</xqx:greaterThanOp>
</xqx:secondOperand>
</xqx:andOp>
</xqx:whereClause>
<xqx:returnClause>
<xqx:elementConstructor>
<xqx:tagName>book</xqx:tagName>
<xqx:attributeList>
<xqx:attributeConstructor>
<xqx:attributeName>year</xqx:attributeName>
<xqx:attributeValueExpr>
<xqx:pathExpr>
<xqx:stepExpr>
<xqx:filterExpr>
<xqx:varRef>
<xqx:name>b</xqx:name>
</xqx:varRef>
</xqx:filterExpr>
</xqx:stepExpr>
<xqx:stepExpr>
<xqx:xpathAxis>attribute</xqx:xpathAxis>
<xqx:nameTest>year</xqx:nameTest>
</xqx:stepExpr>
</xqx:pathExpr>
</xqx:attributeValueExpr>
</xqx:attributeConstructor>
</xqx:attributeList>
<xqx:elementContent>
<xqx:pathExpr>
<xqx:stepExpr>
<xqx:filterExpr>
<xqx:varRef>
<xqx:name>b</xqx:name>
</xqx:varRef>
</xqx:filterExpr>
</xqx:stepExpr>
<xqx:stepExpr>
<xqx:xpathAxis>child</xqx:xpathAxis>
<xqx:nameTest>title</xqx:nameTest>
</xqx:stepExpr>
</xqx:pathExpr>
</xqx:elementContent>
</xqx:elementConstructor>
</xqx:returnClause>
</xqx:flworExpr>
</xqx:elementContent>
</xqx:elementConstructor>
</xqx:queryBody>
</xqx:mainModule>
</xqx:module>
</pre></div>
</div>
<div class="div3">
<h4><a name="Example1-Transformation" id=
"Example1-Transformation"></a>3.1.3 Transformation of XQueryX
Solution into XQuery</h4>
<p>Application of the stylesheet in <a href="#Stylesheet"><b>B
Transforming XQueryX to XQuery</b></a> to the XQueryX solution
results in:</p>
<div class="exampleInner">
<pre>
<bib>{
for $b in doc("http://bstore1.example.com/bib.xml")/child::bib/child::book
where (($b/child::publisher = "Addison-Wesley") and ($b/attribute::year > 1991))
return <book year="{$b/attribute::year}">{$b/child::title}</book>
}</bib>
</pre></div>
</div>
<div class="div3">
<h4><a name="Example1-Abstract" id="Example1-Abstract"></a>3.1.4
Corresponding Grammar Abstract Parse Tree</h4>
<p>For comparison, here is the abstract parse tree corresponding to
the XQuery for Example 1, as produced by the XQuery grammar applets
found at <a href=
"http://www.w3.org/2007/01/applets/">http://www.w3.org/2007/01/applets/</a>.</p>
<div class="exampleInner">
<pre>
XPath2
QueryList
Module
MainModule
Prolog
QueryBody
Expr
PathExpr
Constructor
DirectConstructor
DirElemConstructor >
LessThanOpOrTagO <
TagQName bib
DirAttributeList
StartTagClose >
DirElemContent
ElementContentChar
DirElemContent
ElementContentChar
DirElemContent
CommonContent
EnclosedExpr
Lbrace {
Expr
FLWORExpr
ForClause
VarName
QName b
PathExpr
FunctionCall
FunctionQName doc
PathExpr
StringLiteral "http://bstore1.example.com/bib.xml"
StepExpr
AbbrevForwardStep
NodeTest
NameTest
QName bib
StepExpr
AbbrevForwardStep
NodeTest
NameTest
QName book
WhereClause
AndExpr and
ComparisonExpr =
PathExpr
VarName
QName b
StepExpr
AbbrevForwardStep
NodeTest
NameTest
QName publisher
PathExpr
StringLiteral "Addison-Wesley"
ComparisonExpr >
PathExpr
VarName
QName b
StepExpr
AbbrevForwardStep @
NodeTest
NameTest
QName year
PathExpr
IntegerLiteral 1991
PathExpr
Constructor
DirectConstructor
DirElemConstructor >
LessThanOpOrTagO <
TagQName book
DirAttributeList
S
TagQName year
ValueIndicator =
DirAttributeValue
OpenQuot "
QuotAttrValueContent
CommonContent
EnclosedExpr
Lbrace {
Expr
PathExpr
VarName
QName b
StepExpr
AbbrevForwardStep @
NodeTest
NameTest
QName year
Rbrace }
CloseQuot "
StartTagClose >
DirElemContent
ElementContentChar
DirElemContent
ElementContentChar
DirElemContent
ElementContentChar
DirElemContent
ElementContentChar
DirElemContent
ElementContentChar
DirElemContent
ElementContentChar
DirElemContent
CommonContent
EnclosedExpr
Lbrace {
Expr
PathExpr
VarName
QName b
StepExpr
AbbrevForwardStep
NodeTest
NameTest
QName title
Rbrace }
DirElemContent
ElementContentChar
DirElemContent
ElementContentChar
DirElemContent
ElementContentChar
DirElemContent
ElementContentChar
DirElemContent
ElementContentChar
Rbrace }
DirElemContent
ElementContentChar
</pre></div>
</div>
</div>
<div class="div2">
<h3><a name="Example2" id="Example2"></a>3.2 Example 2</h3>
<p>Here is Q4 from the <span><a href="#xquery-30-use-cases">[XQuery
3.0 Use Cases]</a></span> , use case XMP (Experiences and
Exemplars): "For each author in the bibliography, list the author's
name and the titles of all books by that author, grouped inside a
"result" element."</p>
<div class="div3">
<h4><a name="Example2-XQuery" id="Example2-XQuery"></a>3.2.1 XQuery
solution in XQuery Use Cases:</h4>
<div class="exampleInner">
<pre>
<results>
{
let $a := doc("http://bstore1.example.com/bib/bib.xml")//author
for $last in distinct-values($a/last),
$first in distinct-values($a[last=$last]/first)
order by $last, $first
return
<result>
<author>
<last>{ $last }</last>
<first>{ $first }</first>
</author>
{
for $b in doc("http://bstore1.example.com/bib.xml")/bib/book
where some $ba in $b/author
satisfies ($ba/last = $last and $ba/first=$first)
return $b/title
}
</result>
}
</results>
</pre></div>
</div>
<div class="div3">
<h4><a name="Example2-XQueryX" id="Example2-XQueryX"></a>3.2.2 A
solution in XQueryX:</h4>
<div class="exampleInner">
<pre>
<?xml version="1.0"?>
<xqx:module xmlns:xqx="http://www.w3.org/2005/XQueryX"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2005/XQueryX
http://www.w3.org/2005/XQueryX/xqueryx.xsd">
<xqx:mainModule>
<xqx:queryBody>
<xqx:elementConstructor>
<xqx:tagName>results</xqx:tagName>
<xqx:elementContent>
<xqx:flworExpr>
<xqx:letClause>
<xqx:letClauseItem>
<xqx:typedVariableBinding>
<xqx:varName>a</xqx:varName>
</xqx:typedVariableBinding>
<xqx:letExpr>
<xqx:pathExpr>
<xqx:stepExpr>
<xqx:filterExpr>
<xqx:functionCallExpr>
<xqx:functionName>doc</xqx:functionName>
<xqx:arguments>
<xqx:stringConstantExpr>
<xqx:value>http://bstore1.example.com/bib.xml</xqx:value>
</xqx:stringConstantExpr>
</xqx:arguments>
</xqx:functionCallExpr>
</xqx:filterExpr>
</xqx:stepExpr>
<xqx:stepExpr>
<xqx:xpathAxis>descendant-or-self</xqx:xpathAxis>
<xqx:anyKindTest/>
</xqx:stepExpr>
<xqx:stepExpr>
<xqx:xpathAxis>child</xqx:xpathAxis>
<xqx:nameTest>author</xqx:nameTest>
</xqx:stepExpr>
</xqx:pathExpr>
</xqx:letExpr>
</xqx:letClauseItem>
</xqx:letClause>
<xqx:forClause>
<xqx:forClauseItem>
<xqx:typedVariableBinding>
<xqx:varName>last</xqx:varName>
</xqx:typedVariableBinding>
<xqx:forExpr>
<xqx:functionCallExpr>
<xqx:functionName>distinct-values</xqx:functionName>
<xqx:arguments>
<xqx:pathExpr>
<xqx:stepExpr>
<xqx:filterExpr>
<xqx:varRef>
<xqx:name>a</xqx:name>
</xqx:varRef>
</xqx:filterExpr>
</xqx:stepExpr>
<xqx:stepExpr>
<xqx:xpathAxis>child</xqx:xpathAxis>
<xqx:nameTest>last</xqx:nameTest>
</xqx:stepExpr>
</xqx:pathExpr>
</xqx:arguments>
</xqx:functionCallExpr>
</xqx:forExpr>
</xqx:forClauseItem>
<xqx:forClauseItem>
<xqx:typedVariableBinding>
<xqx:varName>first</xqx:varName>
</xqx:typedVariableBinding>
<xqx:forExpr>
<xqx:functionCallExpr>
<xqx:functionName>distinct-values</xqx:functionName>
<xqx:arguments>
<xqx:pathExpr>
<xqx:stepExpr>
<xqx:filterExpr>
<xqx:varRef>
<xqx:name>a</xqx:name>
</xqx:varRef>
</xqx:filterExpr>
<xqx:predicates>
<xqx:equalOp>
<xqx:firstOperand>
<xqx:pathExpr>
<xqx:stepExpr>
<xqx:filterExpr>
<xqx:contextItemExpr/>
</xqx:filterExpr>
</xqx:stepExpr>
<xqx:stepExpr>
<xqx:xpathAxis>child</xqx:xpathAxis>
<xqx:nameTest>last</xqx:nameTest>
</xqx:stepExpr>
</xqx:pathExpr>
</xqx:firstOperand>
<xqx:secondOperand>
<xqx:varRef>
<xqx:name>last</xqx:name>
</xqx:varRef>
</xqx:secondOperand>
</xqx:equalOp>
</xqx:predicates>
</xqx:stepExpr>
<xqx:stepExpr>
<xqx:xpathAxis>child</xqx:xpathAxis>
<xqx:nameTest>first</xqx:nameTest>
</xqx:stepExpr>
</xqx:pathExpr>
</xqx:arguments>
</xqx:functionCallExpr>
</xqx:forExpr>
</xqx:forClauseItem>
</xqx:forClause>
<xqx:orderByClause>
<xqx:orderBySpec>
<xqx:orderByExpr>
<xqx:varRef>
<xqx:name>last</xqx:name>
</xqx:varRef>
</xqx:orderByExpr>
</xqx:orderBySpec>
<xqx:orderBySpec>
<xqx:orderByExpr>
<xqx:varRef>
<xqx:name>first</xqx:name>
</xqx:varRef>
</xqx:orderByExpr>
</xqx:orderBySpec>
</xqx:orderByClause>
<xqx:returnClause>
<xqx:elementConstructor>
<xqx:tagName>result</xqx:tagName>
<xqx:elementContent>
<xqx:elementConstructor>
<xqx:tagName>author</xqx:tagName>
<xqx:elementContent>
<xqx:elementConstructor>
<xqx:tagName>last</xqx:tagName>
<xqx:elementContent>
<xqx:varRef>
<xqx:name>last</xqx:name>
</xqx:varRef>
</xqx:elementContent>
</xqx:elementConstructor>
<xqx:elementConstructor>
<xqx:tagName>first</xqx:tagName>
<xqx:elementContent>
<xqx:varRef>
<xqx:name>first</xqx:name>
</xqx:varRef>
</xqx:elementContent>
</xqx:elementConstructor>
</xqx:elementContent>
</xqx:elementConstructor>
<xqx:flworExpr>
<xqx:forClause>
<xqx:forClauseItem>
<xqx:typedVariableBinding>
<xqx:varName>b</xqx:varName>
</xqx:typedVariableBinding>
<xqx:forExpr>
<xqx:pathExpr>
<xqx:stepExpr>
<xqx:filterExpr>
<xqx:functionCallExpr>
<xqx:functionName>doc</xqx:functionName>
<xqx:arguments>
<xqx:stringConstantExpr>
<xqx:value>http://bstore1.example.com/bib.xml</xqx:value>
</xqx:stringConstantExpr>
</xqx:arguments>
</xqx:functionCallExpr>
</xqx:filterExpr>
</xqx:stepExpr>
<xqx:stepExpr>
<xqx:xpathAxis>child</xqx:xpathAxis>
<xqx:nameTest>bib</xqx:nameTest>
</xqx:stepExpr>
<xqx:stepExpr>
<xqx:xpathAxis>child</xqx:xpathAxis>
<xqx:nameTest>book</xqx:nameTest>
</xqx:stepExpr>
</xqx:pathExpr>
</xqx:forExpr>
</xqx:forClauseItem>
</xqx:forClause>
<xqx:whereClause>
<xqx:quantifiedExpr>
<xqx:quantifier>some</xqx:quantifier>
<xqx:quantifiedExprInClause>
<xqx:typedVariableBinding>
<xqx:varName>ba</xqx:varName>
</xqx:typedVariableBinding>
<xqx:sourceExpr>
<xqx:pathExpr>
<xqx:stepExpr>
<xqx:filterExpr>
<xqx:varRef>
<xqx:name>b</xqx:name>
</xqx:varRef>
</xqx:filterExpr>
</xqx:stepExpr>
<xqx:stepExpr>
<xqx:xpathAxis>child</xqx:xpathAxis>
<xqx:nameTest>author</xqx:nameTest>
</xqx:stepExpr>
</xqx:pathExpr>
</xqx:sourceExpr>
</xqx:quantifiedExprInClause>
<xqx:predicateExpr>
<xqx:andOp>
<xqx:firstOperand>
<xqx:equalOp>
<xqx:firstOperand>
<xqx:pathExpr>
<xqx:stepExpr>
<xqx:filterExpr>
<xqx:varRef>
<xqx:name>ba</xqx:name>
</xqx:varRef>
</xqx:filterExpr>
</xqx:stepExpr>
<xqx:stepExpr>
<xqx:xpathAxis>child</xqx:xpathAxis>
<xqx:nameTest>last</xqx:nameTest>
</xqx:stepExpr>
</xqx:pathExpr>
</xqx:firstOperand>
<xqx:secondOperand>
<xqx:varRef>
<xqx:name>last</xqx:name>
</xqx:varRef>
</xqx:secondOperand>
</xqx:equalOp>
</xqx:firstOperand>
<xqx:secondOperand>
<xqx:equalOp>
<xqx:firstOperand>
<xqx:pathExpr>
<xqx:stepExpr>
<xqx:filterExpr>
<xqx:varRef>
<xqx:name>ba</xqx:name>
</xqx:varRef>
</xqx:filterExpr>
</xqx:stepExpr>
<xqx:stepExpr>
<xqx:xpathAxis>child</xqx:xpathAxis>
<xqx:nameTest>first</xqx:nameTest>
</xqx:stepExpr>
</xqx:pathExpr>
</xqx:firstOperand>
<xqx:secondOperand>
<xqx:varRef>
<xqx:name>first</xqx:name>
</xqx:varRef>
</xqx:secondOperand>
</xqx:equalOp>
</xqx:secondOperand>
</xqx:andOp>
</xqx:predicateExpr>
</xqx:quantifiedExpr>
</xqx:whereClause>
<xqx:returnClause>
<xqx:pathExpr>
<xqx:stepExpr>
<xqx:filterExpr>
<xqx:varRef>
<xqx:name>b</xqx:name>
</xqx:varRef>
</xqx:filterExpr>
</xqx:stepExpr>
<xqx:stepExpr>
<xqx:xpathAxis>child</xqx:xpathAxis>
<xqx:nameTest>title</xqx:nameTest>
</xqx:stepExpr>
</xqx:pathExpr>
</xqx:returnClause>
</xqx:flworExpr>
</xqx:elementContent>
</xqx:elementConstructor>
</xqx:returnClause>
</xqx:flworExpr>
</xqx:elementContent>
</xqx:elementConstructor>
</xqx:queryBody>
</xqx:mainModule>
</xqx:module>
</pre></div>
</div>
<div class="div3">
<h4><a name="Example2-Transformation" id=
"Example2-Transformation"></a>3.2.3 Transformation of XQueryX
Solution into XQuery</h4>
<p>Application of the stylesheet in <a href="#Stylesheet"><b>B
Transforming XQueryX to XQuery</b></a> to the XQueryX solution
results in:</p>
<div class="exampleInner">
<pre>
<results>{
let $a:=doc("http://bstore1.example.com/bib.xml")/descendant-or-self::node()/child::author
for $last in distinct-values($a/child::last), $first in distinct-values($a[(./child::last = $last)]/child::first)
order by $last , $first
return <result><author><last>{$last}</last><first>{$first}</first></author>{
for $b in doc("http://bstore1.example.com/bib.xml")/child::bib/child::book
where (some $ba in $b/child::author satisfies (($ba/child::last = $last) and ($ba/child::first = $first)))
return $b/child::title
}</result>
}</results>
</pre></div>
</div>
</div>
<div class="div2">
<h3><a name="Example3" id="Example3"></a>3.3 Example 3</h3>
<p>Here is Q7 from the <span><a href="#xquery-30-use-cases">[XQuery
3.0 Use Cases]</a></span> , use case XMP (Experiences and
Exemplars): "List the titles and years of all books published by
Addison-Wesley after 1991, in alphabetic order."</p>
<div class="div3">
<h4><a name="Example3-XQuery" id="Example3-XQuery"></a>3.3.1 XQuery
solution in XQuery Use Cases:</h4>
<div class="exampleInner">
<pre>
<bib>
{
for $b in doc("http://bstore1.example.com/bib.xml")//book
where $b/publisher = "Addison-Wesley" and $b/@year > 1991
order by $b/title
return
<book>
{ $b/@year }
{ $b/title }
</book>
}
</bib>
</pre></div>
</div>
<div class="div3">
<h4><a name="Example3-XQueryX" id="Example3-XQueryX"></a>3.3.2 A
solution in XQueryX:</h4>
<div class="exampleInner">
<pre>
<?xml version="1.0"?>
<xqx:module xmlns:xqx="http://www.w3.org/2005/XQueryX"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2005/XQueryX
http://www.w3.org/2005/XQueryX/xqueryx.xsd">
<xqx:mainModule>
<xqx:queryBody>
<xqx:elementConstructor>
<xqx:tagName>bib</xqx:tagName>
<xqx:elementContent>
<xqx:flworExpr>
<xqx:forClause>
<xqx:forClauseItem>
<xqx:typedVariableBinding>
<xqx:varName>b</xqx:varName>
</xqx:typedVariableBinding>
<xqx:forExpr>
<xqx:pathExpr>
<xqx:stepExpr>
<xqx:filterExpr>
<xqx:functionCallExpr>
<xqx:functionName>doc</xqx:functionName>
<xqx:arguments>
<xqx:stringConstantExpr>
<xqx:value>http://bstore1.example.com/bib.xml</xqx:value>
</xqx:stringConstantExpr>
</xqx:arguments>
</xqx:functionCallExpr>
</xqx:filterExpr>
</xqx:stepExpr>
<xqx:stepExpr>
<xqx:xpathAxis>descendant-or-self</xqx:xpathAxis>
<xqx:anyKindTest/>
</xqx:stepExpr>
<xqx:stepExpr>
<xqx:xpathAxis>child</xqx:xpathAxis>
<xqx:nameTest>book</xqx:nameTest>
</xqx:stepExpr>
</xqx:pathExpr>
</xqx:forExpr>
</xqx:forClauseItem>
</xqx:forClause>
<xqx:whereClause>
<xqx:andOp>
<xqx:firstOperand>
<xqx:equalOp>
<xqx:firstOperand>
<xqx:pathExpr>
<xqx:stepExpr>
<xqx:filterExpr>
<xqx:varRef>
<xqx:name>b</xqx:name>
</xqx:varRef>
</xqx:filterExpr>
</xqx:stepExpr>
<xqx:stepExpr>
<xqx:xpathAxis>child</xqx:xpathAxis>
<xqx:nameTest>publisher</xqx:nameTest>
</xqx:stepExpr>
</xqx:pathExpr>
</xqx:firstOperand>
<xqx:secondOperand>
<xqx:stringConstantExpr>
<xqx:value>Addison-Wesley</xqx:value>
</xqx:stringConstantExpr>
</xqx:secondOperand>
</xqx:equalOp>
</xqx:firstOperand>
<xqx:secondOperand>
<xqx:greaterThanOp>
<xqx:firstOperand>
<xqx:pathExpr>
<xqx:stepExpr>
<xqx:filterExpr>
<xqx:varRef>
<xqx:name>b</xqx:name>
</xqx:varRef>
</xqx:filterExpr>
</xqx:stepExpr>
<xqx:stepExpr>
<xqx:xpathAxis>attribute</xqx:xpathAxis>
<xqx:nameTest>year</xqx:nameTest>
</xqx:stepExpr>
</xqx:pathExpr>
</xqx:firstOperand>
<xqx:secondOperand>
<xqx:integerConstantExpr>
<xqx:value>1991</xqx:value>
</xqx:integerConstantExpr>
</xqx:secondOperand>
</xqx:greaterThanOp>
</xqx:secondOperand>
</xqx:andOp>
</xqx:whereClause>
<xqx:orderByClause>
<xqx:orderBySpec>
<xqx:orderByExpr>
<xqx:pathExpr>
<xqx:stepExpr>
<xqx:filterExpr>
<xqx:varRef>
<xqx:name>b</xqx:name>
</xqx:varRef>
</xqx:filterExpr>
</xqx:stepExpr>
<xqx:stepExpr>
<xqx:xpathAxis>child</xqx:xpathAxis>
<xqx:nameTest>title</xqx:nameTest>
</xqx:stepExpr>
</xqx:pathExpr>
</xqx:orderByExpr>
</xqx:orderBySpec>
</xqx:orderByClause>
<xqx:returnClause>
<xqx:elementConstructor>
<xqx:tagName>book</xqx:tagName>
<xqx:elementContent>
<xqx:pathExpr>
<xqx:stepExpr>
<xqx:filterExpr>
<xqx:varRef>
<xqx:name>b</xqx:name>
</xqx:varRef>
</xqx:filterExpr>
</xqx:stepExpr>
<xqx:stepExpr>
<xqx:xpathAxis>attribute</xqx:xpathAxis>
<xqx:nameTest>year</xqx:nameTest>
</xqx:stepExpr>
</xqx:pathExpr>
<xqx:pathExpr>
<xqx:stepExpr>
<xqx:filterExpr>
<xqx:varRef>
<xqx:name>b</xqx:name>
</xqx:varRef>
</xqx:filterExpr>
</xqx:stepExpr>
<xqx:stepExpr>
<xqx:xpathAxis>child</xqx:xpathAxis>
<xqx:nameTest>title</xqx:nameTest>
</xqx:stepExpr>
</xqx:pathExpr>
</xqx:elementContent>
</xqx:elementConstructor>
</xqx:returnClause>
</xqx:flworExpr>
</xqx:elementContent>
</xqx:elementConstructor>
</xqx:queryBody>
</xqx:mainModule>
</xqx:module>
</pre></div>
</div>
<div class="div3">
<h4><a name="Example3-Transformation" id=
"Example3-Transformation"></a>3.3.3 Transformation of XQueryX
Solution into XQuery</h4>
<p>Application of the stylesheet in <a href="#Stylesheet"><b>B
Transforming XQueryX to XQuery</b></a> to the XQueryX solution
results in:</p>
<div class="exampleInner">
<pre>
<bib>{
for $b in doc("http://bstore1.example.com/bib.xml")/descendant-or-self::node()/child::book
where (($b/child::publisher = "Addison-Wesley") and ($b/attribute::year > 1991))
order by $b/child::title
return <book>{$b/attribute::year}{$b/child::title}</book>
}</bib>
</pre></div>
</div>
</div>
<div class="div2">
<h3><a name="Example4" id="Example4"></a>3.4 Example 4</h3>
<p>Here is Q8 from the <span><a href="#xquery-30-use-cases">[XQuery
3.0 Use Cases]</a></span> , use case NS (Queries Using Namespaces):
"Select all traders (either seller or high bidder) without negative
comments."</p>
<div class="div3">
<h4><a name="Example4-XQuery" id="Example4-XQuery"></a>3.4.1 XQuery
solution in XQuery Use Cases:</h4>
<div class="exampleInner">
<pre>
declare namespace ma = "http://www.example.com/AuctionWatch";
<Q8 xmlns:ma="http://www.example.com/AuctionWatch"
xmlns:eachbay="http://www.example.com/auctioneers#eachbay"
xmlns:xlink="http://www.w3.org/1999/xlink">
{
for $s in doc("auction.xml")//ma:Trading_Partners/(ma:Seller | ma:High_Bidder)
where $s/*:NegativeComments = 0
return $s
}
</Q8>
</pre></div>
</div>
<div class="div3">
<h4><a name="Example4-XQueryX" id="Example4-XQueryX"></a>3.4.2 A
solution in XQueryX:</h4>
<div class="exampleInner">
<pre>
<?xml version="1.0"?>
<!-- ================================================================================ -->
<!-- Errata applied: -->
<!-- XQX.E2 - Editorial (Bugzilla Bug 4963) -->
<!-- ================================================================================ -->
<xqx:module xmlns:xqx="http://www.w3.org/2005/XQueryX"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2005/XQueryX
http://www.w3.org/2005/XQueryX/xqueryx.xsd">
<xqx:mainModule>
<xqx:prolog>
<xqx:namespaceDecl>
<xqx:prefix>ma</xqx:prefix>
<xqx:uri>http://www.example.com/AuctionWatch</xqx:uri>
</xqx:namespaceDecl>
</xqx:prolog>
<xqx:queryBody>
<xqx:elementConstructor>
<xqx:tagName>Q8</xqx:tagName>
<xqx:attributeList>
<xqx:namespaceDeclaration>
<xqx:prefix>ma</xqx:prefix>
<xqx:uri>http://www.example.com/AuctionWatch</xqx:uri>
</xqx:namespaceDeclaration>
<xqx:namespaceDeclaration>
<xqx:prefix>eachbay</xqx:prefix>
<xqx:uri>http://www.example.com/auctioneers#eachbay</xqx:uri>
</xqx:namespaceDeclaration>
<xqx:namespaceDeclaration>
<xqx:prefix>xlink</xqx:prefix>
<xqx:uri>http://www.w3.org/1999/xlink</xqx:uri>
</xqx:namespaceDeclaration>
</xqx:attributeList>
<xqx:elementContent>
<xqx:flworExpr>
<xqx:forClause>
<xqx:forClauseItem>
<xqx:typedVariableBinding>
<xqx:varName>s</xqx:varName>
</xqx:typedVariableBinding>
<xqx:forExpr>
<xqx:pathExpr>
<xqx:stepExpr>
<xqx:filterExpr>
<xqx:functionCallExpr>
<xqx:functionName xqx:prefix="fn">doc</xqx:functionName>
<xqx:arguments>
<xqx:stringConstantExpr>
<xqx:value>auction.xml</xqx:value>
</xqx:stringConstantExpr>
</xqx:arguments>
</xqx:functionCallExpr>
</xqx:filterExpr>
</xqx:stepExpr>
<xqx:stepExpr>
<xqx:xpathAxis>descendant-or-self</xqx:xpathAxis>
<xqx:anyKindTest/>
</xqx:stepExpr>
<xqx:stepExpr>
<xqx:xpathAxis>child</xqx:xpathAxis>
<xqx:nameTest xqx:prefix="ma">Trading_Partners</xqx:nameTest>
</xqx:stepExpr>
<xqx:stepExpr>
<xqx:filterExpr>
<xqx:sequenceExpr>
<xqx:unionOp>
<xqx:firstOperand>
<xqx:pathExpr>
<xqx:stepExpr>
<xqx:xpathAxis>child</xqx:xpathAxis>
<xqx:nameTest xqx:prefix="ma">Seller</xqx:nameTest>
</xqx:stepExpr>
</xqx:pathExpr>
</xqx:firstOperand>
<xqx:secondOperand>
<xqx:pathExpr>
<xqx:stepExpr>
<xqx:xpathAxis>child</xqx:xpathAxis>
<xqx:nameTest xqx:prefix="ma">High_Bidder</xqx:nameTest>
</xqx:stepExpr>
</xqx:pathExpr>
</xqx:secondOperand>
</xqx:unionOp>
</xqx:sequenceExpr>
</xqx:filterExpr>
</xqx:stepExpr>
</xqx:pathExpr>
</xqx:forExpr>
</xqx:forClauseItem>
</xqx:forClause>
<xqx:whereClause>
<xqx:equalOp>
<xqx:firstOperand>
<xqx:pathExpr>
<xqx:stepExpr>
<xqx:filterExpr>
<xqx:varRef>
<xqx:name>s</xqx:name>
</xqx:varRef>
</xqx:filterExpr>
</xqx:stepExpr>
<xqx:stepExpr>
<xqx:xpathAxis>child</xqx:xpathAxis>
<xqx:Wildcard>
<xqx:star/>
<xqx:NCName>NegativeComments</xqx:NCName>
</xqx:Wildcard>
</xqx:stepExpr>
</xqx:pathExpr>
</xqx:firstOperand>
<xqx:secondOperand>
<xqx:integerConstantExpr>
<xqx:value>0</xqx:value>
</xqx:integerConstantExpr>
</xqx:secondOperand>
</xqx:equalOp>
</xqx:whereClause>
<xqx:returnClause>
<xqx:varRef>
<xqx:name>s</xqx:name>
</xqx:varRef>
</xqx:returnClause>
</xqx:flworExpr>
</xqx:elementContent>
</xqx:elementConstructor>
</xqx:queryBody>
</xqx:mainModule>
</xqx:module>
</pre></div>
</div>
<div class="div3">
<h4><a name="Example4-Transformation" id=
"Example4-Transformation"></a>3.4.3 Transformation of XQueryX
Solution into XQuery</h4>
<p>Application of the stylesheet in <a href="#Stylesheet"><b>B
Transforming XQueryX to XQuery</b></a> to the XQueryX solution
results in:</p>
<div class="exampleInner">
<pre>
declare namespace ma="http://www.example.com/AuctionWatch";
<Q8 xmlns:ma="http://www.example.com/AuctionWatch"
xmlns:eachbay="http://www.example.com/auctioneers#eachbay"
xmlns:xlink="http://www.w3.org/1999/xlink">{
for $s in fn:doc("auction.xml")/descendant-or-self::node()/
child::ma:Trading_Partners/
((child::ma:Seller union child::ma:High_Bidder))
where ($s/child::*:NegativeComments = 0)
return $s
}</Q8>
</pre></div>
</div>
</div>
</div>
<div class="div1">
<h2><a name="Schema" id="Schema"></a>4 An XML Schema for the XQuery
XML Syntax</h2>
<p>Here is the XML Schema against which XQueryX documents must be
valid.</p>
<div class="exampleInner">
<pre>
<?xml version="1.0"?>
<span><!-- ================================================================================ -->
<!-- NOTES TO READERS OF THIS SCHEMA: -->
<!-- The default value for both minOccurs and maxOccurs is "1". -->
<!-- The XQueryX schema has been designed to provide the ability to extend definitions -->
<!-- of top-level elements in extensions such as Full-Text and the Update Facility. -->
<!-- The nature of the modification is to define named complex types and redefine -->
<!-- those top-level elements in terms of the named complex types. -->
<!-- ================================================================================ -->
<!-- Changes from Recommendation (edition 1): -->
<!-- * Element defs using anon complex types changed to use named types (bug #4924) -->
<!-- * In Example 4, replaced xqx:parentheziedExpr with xqx:sequenceExpr (bug #4963) -->
<!-- * In XSLT stylesheet, deleted template for xqx:parenthesizedExpr (bug #4963) -->
<!-- * Replaced link to grammar applet with correct link (bug #5323) -->
<!-- * In XSLT stylesheet, corrected template for xqx:namespaceDeclaration (bug #5343) -->
<!-- Changes from Recommendation (edition 2): -->
<!-- * Added support for new Windowing clause in FLWOR expression -->
<!-- * Added support for new Group By Clause in FLWOR expression -->
<!-- * Added support for new Count Clause in FLWOR expression -->
<!-- * Added support for keyword "outer" on for expression -->
<!-- * Modified structure of FLWOR clause per "simplified FLWOR expressions" -->
<!-- * Modified validation syntax per Bugzilla Bug 5472 -->
<!-- * Modified function declaration so that external functions can be nondeterminstic -->
<!-- * Modified variable declaration so external variables can have an initial value -->
<!-- * Added support for new try-catch expression -->
<!-- * Added support for new decimal formatting declaration -->
<!-- * Added support for encoding in the version declaration -->
<!-- * Added support for new context item declaration -->
<!-- * Added support for computed namespace constructor -->
<!-- * Made changes triggered by Bugzilla Bugs 6309, 6310, and 6311 -->
<!-- * Modified errlist syntax per Bugzilla Bug 7053 -->
<!-- * Added support for public/private functions -->
<!-- * Replaced "outer for" support with support for "allowing empty" -->
<!-- * Added support for higher-order functions -->
<!-- * Added support for value-based "switch" expression -->
<!-- * Use pattern to prohibit "#)" in pragma contents per Bugzilla Bug 2711 -->
<!-- * Changed functionItemExpr child element QName to be functionName for consistency -->
<!-- * Replaced "public", "private", and "[non]deterministic" with %-annotations -->
<!-- * Added EQName to permit "URI-literal":NCNAME as alternative to NCName:NCName -->
<!-- * Changed type of atomicType to EQName, so it's really atomicOrUnionType -->
<!-- ================================================================================ -->
<!-- Errata applied: -->
<!-- XQX.E1 - Editorial (Bugzilla Bug 4924) -->
<!-- XQX.E7 - Substantive (Bugzilla Bug 2711) -->
<!-- ================================================================================ -->
<!-- Modifications: -->
<!-- 2008-07-30 - Add XQuery 1.1 grouping and windowing support -->
<!-- 2008-09-18 - Add XQuery 1.1 count and outer-for support, simplified FLWOR -->
<!-- 2008-09-27 - Add validation type, nondeterministic function declarations, -->
<!-- initial values for external variables, try-catch expression -->
<!-- 2008-11-25 - Add support for number formatting, Snelson's version declaration -->
<!-- proposal, context item declaration, computed namespace constructor,-->
<!-- fixes for validate expression, and change to allow the count -->
<!-- clause to only be an intermediate expression -->
<!-- 2009-01-13 - Bugs 6309 and 6310 (fixes to details of certain windowing clauses -->
<!-- 2009-03-03 - tumblingWindowClause syntax now matches slidingWindowClause syntax -->
<!-- 2009-09-06 - Modified errlist syntax per Bugzilla Bug 7053 -->
<!-- 2009-10-09 - Added support for private/public functions -->
<!-- Replace "outer for" with "allowing empty" -->
<!-- 2009-10-22 - Add support for higher-order functions & switch expression -->
<!-- 2010-04-06 - Changed functionItemExpr child QName -> functionName (consistency) -->
<!-- 2010-05-10 - Added %-annotation support for varDecl and functionDecl -->
<!-- 2010-06-23 - Added support for partial function application -->
<!-- 2011-02-02 - Added support for EQNames and atomicOrUnionType -->
<!-- 2011-05-04 - Updated structure of catch component of try-catch expression -->
<!-- 2011-05-04 - Updated validationexpr, mode/type alternatives, type is EQName -->
<!-- 2011-07-08 - Added support for concatenation operator || -->
<!-- * 2011-09-09 - Added support for simple mapping operator ! -->
<!-- * 2011-09-09 - Added support for sequenceTypeUnion in typeswitch -->
<!-- * 2011-09-09 - Added support for annotations on inline functions -->
<!-- 2011-09-14 - Added support for new group-by syntax -->
<!-- 2011-11-21 - Jim changed "literalFunctionItemExpr" to "namedFunctionRef" -->
<!-- 2011-11-21 - Jim changed "inlineFunctionItemExpr" to "inlineFunctionExpr" -->
<!-- ================================================================================ -->
</span>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.w3.org/2005/XQueryX"
targetNamespace="http://www.w3.org/2005/XQueryX"
elementFormDefault="qualified" attributeFormDefault="qualified">
<!-- A few helper declarations -->
<xsd:complexType name="emptyContent"/>
<xsd:element name="NCName" type="xsd:NCName"/>
<xsd:complexType name="QName">
<xsd:simpleContent>
<xsd:extension base="xsd:NCName">
<xsd:attribute name="prefix" type="xsd:NCName" use="optional"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<span> <xsd:complexType name="EQName">
<xsd:simpleContent>
<xsd:extension base="xsd:NCName">
<xsd:attribute name="prefix" type="xsd:NCName" use="optional"/>
<xsd:attribute name="URI" type="xsd:string" use="optional"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</span><!-- The base expression class -->
<xsd:complexType name="expr"/>
<xsd:element name="expr" type="expr" abstract="true"/>
<!-- A list of expressions -->
<xsd:complexType name="exprList">
<xsd:sequence>
<xsd:element ref="expr" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<span><!-- A list of expressions or placeholders -->
<!-- 2010-06-23 - Added support for partial function application -->
<xsd:complexType name="exprOrPlaceholderList">
<xsd:sequence>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element ref="expr"/>
<xsd:element name="argumentPlaceholder" type="emptyContent"/>
</xsd:choice>
</xsd:sequence>
</xsd:complexType>
</span><!-- A type to be used by elements that comprise an optional expr -->
<xsd:complexType name="exprWrapperOptional">
<xsd:sequence>
<xsd:element ref="expr" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<!-- Simple wrapper class -->
<xsd:complexType name="exprWrapper">
<xsd:sequence>
<xsd:element ref="expr"/>
</xsd:sequence>
</xsd:complexType>
<!-- constant expressions. We have 4 different subclasses for this -->
<xsd:complexType name="constantExpr">
<xsd:complexContent>
<xsd:extension base="expr">
<xsd:sequence>
<xsd:element name="value" type="xsd:anyType"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="constantExpr" type="constantExpr" abstract="true"
substitutionGroup="expr"/>
<xsd:complexType name="integerConstantExpr">
<xsd:complexContent>
<xsd:restriction base="constantExpr">
<xsd:sequence>
<xsd:element name="value" type="xsd:integer"/>
</xsd:sequence>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="integerConstantExpr" type="integerConstantExpr"
substitutionGroup="constantExpr"/>
<xsd:complexType name="decimalConstantExpr">
<xsd:complexContent>
<xsd:restriction base="constantExpr">
<xsd:sequence>
<xsd:element name="value" type="xsd:decimal"/>
</xsd:sequence>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="decimalConstantExpr" type="decimalConstantExpr"
substitutionGroup="constantExpr"/>
<xsd:complexType name="doubleConstantExpr">
<xsd:complexContent>
<xsd:restriction base="constantExpr">
<xsd:sequence>
<xsd:element name="value" type="xsd:double"/>
</xsd:sequence>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="doubleConstantExpr" type="doubleConstantExpr"
substitutionGroup="constantExpr"/>
<xsd:complexType name="stringConstantExpr">
<xsd:complexContent>
<xsd:restriction base="constantExpr">
<xsd:sequence>
<xsd:element name="value" type="xsd:string"/>
</xsd:sequence>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="stringConstantExpr" type="stringConstantExpr"
substitutionGroup="constantExpr"/>
<!-- Variables -->
<xsd:complexType name="varRef">
<xsd:complexContent>
<xsd:extension base="expr">
<xsd:sequence>
<span> <xsd:element name="name" type="EQName"/>
</span> </xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="varRef" type="varRef" substitutionGroup="expr"/>
<!-- root and context-item expressions -->
<!-- rootExpr deleted per Bugzilla Bug #2523 -->
<xsd:complexType name="contextItemExpr">
<xsd:complexContent>
<xsd:extension base="expr"/>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="contextItemExpr" type="contextItemExpr"
substitutionGroup="expr"/>
<!-- Pragmas and extension expressions -->
<!-- 2010-01-01, JM replaced pragmaContents elem def'n with one that has a pattern -->
<xsd:complexType name="pragma">
<xsd:sequence>
<span> <xsd:element name="pragmaName" type="EQName"/>
<xsd:element name="pragmaContents">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:pattern value="(([^#]|#+[^\)#])*#*)"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</span> </xsd:sequence>
</xsd:complexType>
<xsd:element name="pragma" type="pragma"/>
<xsd:complexType name="extensionExpr">
<xsd:complexContent>
<xsd:extension base="expr">
<xsd:sequence>
<xsd:element ref="pragma" maxOccurs="unbounded"/>
<xsd:element name="argExpr" type="exprWrapper" minOccurs="0"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="extensionExpr" type="extensionExpr"
substitutionGroup="expr"/>
<!-- Function call expressions -->
<!-- 2010-06-23 - Added support for partial function application -->
<xsd:complexType name="functionCallExpr">
<xsd:complexContent>
<xsd:extension base="expr">
<xsd:sequence>
<span> <xsd:element name="functionName" type="EQName"/>
<xsd:element name="arguments" type="exprOrPlaceholderList" minOccurs="0"/>
</span> </xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="functionCallExpr" type="functionCallExpr"
substitutionGroup="expr"/>
<!-- Constructor functions -->
<xsd:complexType name="constructorFunctionExpr">
<xsd:complexContent>
<xsd:extension base="expr">
<xsd:sequence>
<span> <xsd:element name="typeName" type="EQName"/>
</span> <xsd:element name="argExpr" type="exprWrapper"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="constructorFunctionExpr" type="constructorFunctionExpr"
substitutionGroup="expr"/>
<!-- Sequence expressions -->
<xsd:complexType name="sequenceExpr">
<xsd:complexContent>
<xsd:extension base="expr">
<xsd:sequence>
<xsd:element ref="expr" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="sequenceExpr" type="sequenceExpr" substitutionGroup="expr"/>
<xsd:complexType name="rangeSequenceExpr">
<xsd:complexContent>
<xsd:extension base="expr">
<xsd:sequence>
<xsd:element name="startExpr" type="exprWrapper"/>
<xsd:element name="endExpr" type="exprWrapper"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="rangeSequenceExpr" type="rangeSequenceExpr"
substitutionGroup="expr"/>
<!-- Builtin operator expressions -->
<xsd:complexType name="operatorExpr">
<xsd:complexContent>
<xsd:extension base="expr"/>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="unaryOperatorExpr">
<xsd:complexContent>
<xsd:extension base="operatorExpr">
<xsd:sequence>
<xsd:element name="operand" type="exprWrapper"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="binaryOperatorExpr">
<xsd:complexContent>
<xsd:extension base="operatorExpr">
<xsd:sequence>
<xsd:element name="firstOperand" type="exprWrapper"/>
<xsd:element name="secondOperand" type="exprWrapper"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<!-- General operator expressions -->
<xsd:element name="operatorExpr" type="operatorExpr"
abstract="true" substitutionGroup="expr"/>
<!-- Arithmetic operator expressions -->
<xsd:element name="arithmeticOp" type="operatorExpr"
abstract="true" substitutionGroup="operatorExpr"/>
<xsd:element name="addOp" type="binaryOperatorExpr"
substitutionGroup="arithmeticOp"/>
<xsd:element name="subtractOp" type="binaryOperatorExpr"
substitutionGroup="arithmeticOp"/>
<xsd:element name="multiplyOp" type="binaryOperatorExpr"
substitutionGroup="arithmeticOp"/>
<xsd:element name="divOp" type="binaryOperatorExpr"
substitutionGroup="arithmeticOp"/>
<xsd:element name="idivOp" type="binaryOperatorExpr"
substitutionGroup="arithmeticOp"/>
<xsd:element name="modOp" type="binaryOperatorExpr"
substitutionGroup="arithmeticOp"/>
<xsd:element name="unaryMinusOp" type="unaryOperatorExpr"
substitutionGroup="arithmeticOp"/>
<xsd:element name="unaryPlusOp" type="unaryOperatorExpr"
substitutionGroup="arithmeticOp"/>
<span><!-- String operator expressions -->
<xsd:element name="stringOp" type="operatorExpr"
abstract="true" substitutionGroup="operatorExpr"/>
<xsd:element name="stringConcatenateOp" type="binaryOperatorExpr"
substitutionGroup="stringOp"/>
</span><!-- Comparison operator expressions -->
<xsd:element name="comparisonOp" type="binaryOperatorExpr" abstract="true"
substitutionGroup="operatorExpr"/>
<!-- Value comparison operator expressions -->
<xsd:element name="valueComparisonOp" type="binaryOperatorExpr"
abstract="true" substitutionGroup="operatorExpr"/>
<xsd:element name="eqOp" type="binaryOperatorExpr"
substitutionGroup="valueComparisonOp"/>
<xsd:element name="neOp" type="binaryOperatorExpr"
substitutionGroup="valueComparisonOp"/>
<xsd:element name="gtOp" type="binaryOperatorExpr"
substitutionGroup="valueComparisonOp"/>
<xsd:element name="geOp" type="binaryOperatorExpr"
substitutionGroup="valueComparisonOp"/>
<xsd:element name="ltOp" type="binaryOperatorExpr"
substitutionGroup="valueComparisonOp"/>
<xsd:element name="leOp" type="binaryOperatorExpr"
substitutionGroup="valueComparisonOp"/>
<!-- General comparison operator expressions -->
<xsd:element name="generalComparisonOp" type="binaryOperatorExpr" abstract="true"
substitutionGroup="operatorExpr"/>
<xsd:element name="equalOp" type="binaryOperatorExpr"
substitutionGroup="generalComparisonOp"/>
<xsd:element name="notEqualOp" type="binaryOperatorExpr"
substitutionGroup="generalComparisonOp"/>
<xsd:element name="lessThanOp" type="binaryOperatorExpr"
substitutionGroup="generalComparisonOp"/>
<xsd:element name="lessThanOrEqualOp" type="binaryOperatorExpr"
substitutionGroup="generalComparisonOp"/>
<xsd:element name="greaterThanOp" type="binaryOperatorExpr"
substitutionGroup="generalComparisonOp"/>
<xsd:element name="greaterThanOrEqualOp" type="binaryOperatorExpr"
substitutionGroup="generalComparisonOp"/>
<!-- Node comparison operator expressions -->
<xsd:element name="nodeComparisonOp" type="binaryOperatorExpr"
abstract="true" substitutionGroup="operatorExpr"/>
<xsd:element name="isOp" type="binaryOperatorExpr"
substitutionGroup="nodeComparisonOp"/>
<!-- Order comparison operator expressions -->
<xsd:element name="orderComparisonOp" type="binaryOperatorExpr"
abstract="true" substitutionGroup="operatorExpr"/>
<xsd:element name="nodeBeforeOp" type="binaryOperatorExpr"
substitutionGroup="orderComparisonOp"/>
<xsd:element name="nodeAfterOp" type="binaryOperatorExpr"
substitutionGroup="orderComparisonOp"/>
<!-- Logical operator expressions -->
<xsd:element name="logicalOp" type="binaryOperatorExpr"
abstract="true" substitutionGroup="operatorExpr"/>
<xsd:element name="andOp" type="binaryOperatorExpr"
substitutionGroup="logicalOp"/>
<xsd:element name="orOp" type="binaryOperatorExpr"
substitutionGroup="logicalOp"/>
<xsd:element name="setOp" type="binaryOperatorExpr"
abstract="true" substitutionGroup="operatorExpr"/>
<xsd:element name="unionOp" type="binaryOperatorExpr"
substitutionGroup="setOp"/>
<xsd:element name="intersectOp" type="binaryOperatorExpr"
substitutionGroup="setOp"/>
<xsd:element name="exceptOp" type="binaryOperatorExpr"
substitutionGroup="setOp"/>
<!-- Basic typenames -->
<span><!-- By changing the type attribute from QName to EQName, this is now atomicOrUnionType -->
<!-- However, for backwards compatibility w/XQueryX 1.0, the name had to stay the same-->
<xsd:element name="atomicType" type="EQName" substitutionGroup="itemType"/>
</span>
<!-- Used in castable expression and cast expression -->
<xsd:complexType name="singleType">
<xsd:sequence>
<xsd:element ref="atomicType"/>
<xsd:element name="optional" type="emptyContent" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="singleType" type="singleType"/>
<!-- Item type schema types and elements -->
<xsd:element name="itemType" abstract="true"/>
<xsd:complexType name="emptyItemTypeContent"/>
<xsd:element name="anyItemType" type="emptyItemTypeContent"
substitutionGroup="itemType"/>
<xsd:simpleType name="occurrenceIndicator">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="?"/>
<xsd:enumeration value="*"/>
<xsd:enumeration value="+"/>
</xsd:restriction>
</xsd:simpleType>
<!-- Sequence type -->
<xsd:complexType name="sequenceType">
<xsd:choice>
<xsd:element name="voidSequenceType" type="emptyContent"/>
<xsd:sequence>
<xsd:element ref="itemType"/>
<xsd:element name="occurrenceIndicator" type="occurrenceIndicator"
minOccurs="0"/>
</xsd:sequence>
</xsd:choice>
</xsd:complexType>
<xsd:element name="sequenceType" type="sequenceType"/>
<xsd:element name="typeDeclaration" type="sequenceType"/>
<span><!-- Union of sequence types -->
<!-- 2011-09-09/JM - added a sequenceTypeUnion type -->
<xsd:complexType name="sequenceTypeUnion">
<xsd:sequence minOccurs="1" maxOccurs="unbounded">
<xsd:element ref="sequenceType"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="sequenceTypeUnion" type="sequenceTypeUnion"/>
</span>
<!-- Represents a "typed" variable (for clause, let clause etc) -->
<xsd:complexType name="typedVariableBinding">
<xsd:sequence>
<span> <xsd:element name="varName" type="EQName"/>
</span> <xsd:element ref="typeDeclaration" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="typedVariableBinding" type="typedVariableBinding"/>
<!-- Represents an untyped variable for the "at" clause in a for clause -->
<span> <xsd:element name="positionalVariableBinding" type="EQName"/>
<xsd:element name="variableBinding" type="EQName"/>
</span>
<!-- Represents all variable bindings in a for or let clause except typed and -->
<!-- positional variable bindings -->
<xsd:element name="forLetClauseItemExtensions" abstract="true"/>
<!-- Major syntax productions: FLWOR clause components -->
<!-- for clause -->
<xsd:complexType name="forClauseItem">
<xsd:sequence>
<xsd:element ref="typedVariableBinding"/>
<span> <xsd:element name="allowingEmpty" type="emptyContent"
minOccurs="0"/>
</span> <xsd:element ref="positionalVariableBinding" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="forLetClauseItemExtensions" minOccurs="0"
maxOccurs="unbounded"/>
<xsd:element name="forExpr" type="exprWrapper"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="forClauseItem" type="forClauseItem"/>
<xsd:complexType name="forClause">
<xsd:sequence>
<xsd:element ref="forClauseItem" minOccurs="1" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="forClause" type="forClause"/>
<!-- let clause -->
<xsd:complexType name="letClauseItem">
<xsd:sequence>
<xsd:choice>
<xsd:sequence>
<xsd:element ref="typedVariableBinding"/>
<xsd:element ref="forLetClauseItemExtensions"
minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:element ref="forLetClauseItemExtensions"
minOccurs="0" maxOccurs="unbounded"/>
</xsd:choice>
<xsd:element name="letExpr" type="exprWrapper"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="letClauseItem" type="letClauseItem"/>
<xsd:complexType name="letClause">
<xsd:sequence>
<xsd:element ref="letClauseItem" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="letClause" type="letClause"/>
<span><!-- This is the windowClause (part of FLWOR expression) -->
<!-- It corresponds to the following XQuery grammar -->
<!-- WindowClause ::= "for" (TumblingWindowClause | SlidingWindowClause) -->
<xsd:complexType name="windowClause">
<xsd:choice>
<xsd:element ref="tumblingWindowClause"/>
<xsd:element ref="slidingWindowClause"/>
</xsd:choice>
</xsd:complexType>
<xsd:element name="windowClause" type="windowClause"/>
<!-- This is the tumblingWindowClause -->
<!-- It corresponds to the following XQuery grammar -->
<!-- TumblingWindowClause ::= "tumbling" "window" "$" VarName TypeDeclaration? -->
<!-- "in" ExprSingle WindowStartCondition WindowEndCondition? -->
<xsd:complexType name="tumblingWindowClause">
<xsd:sequence>
<xsd:element ref="typedVariableBinding"/>
<xsd:element name="bindingSequence" type="exprWrapper"/>
<xsd:element ref="windowStartCondition"/>
<xsd:element ref="windowEndCondition" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="tumblingWindowClause" type="tumblingWindowClause"/>
<!-- This is the slidingWindowClause -->
<!-- It corresponds to the following XQuery grammar -->
<!-- SlidingWindowClause ::= "sliding" "window" "$" VarName TypeDeclaration? -->
<!-- "in" ExprSingle WindowStartCondition WindowEndCondition -->
<xsd:complexType name="slidingWindowClause">
<xsd:sequence>
<xsd:element ref="typedVariableBinding"/>
<xsd:element name="bindingSequence" type="exprWrapper"/>
<xsd:element ref="windowStartCondition"/>
<xsd:element ref="windowEndCondition"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="slidingWindowClause" type="slidingWindowClause"/>
<!-- windowStartCondition -->
<!-- Corresponds to the following XQuery grammar -->
<!-- WindowStartCondition ::= "start" WindowVars "when" ExprSingle -->
<xsd:complexType name="windowStartCondition">
<xsd:sequence>
<xsd:element ref="windowVars" minOccurs="0"/>
<xsd:element name="winStartExpr" type="exprWrapper"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="windowStartCondition" type="windowStartCondition"/>
<!-- windowEndCondition -->
<!-- Corresponds to the following XQuery grammar -->
<!-- WindowEndCondition ::= "only"? "end" WindowVars "when" ExprSingle -->
<xsd:complexType name="windowEndCondition">
<xsd:sequence>
<xsd:element ref="windowVars" minOccurs="0"/>
<xsd:element name="winEndExpr" type="exprWrapper"/>
</xsd:sequence>
<xsd:attribute name="onlyEnd" type="xsd:boolean" default="false"/>
</xsd:complexType>
<xsd:element name="windowEndCondition" type="windowEndCondition"/>
<!-- windowVars -->
<!-- Corresponds to the following XQuery grammar -->
<!-- WindowVars ::= ("$" \)? PositionalVar? ("previous" "$" PreviousItem)? -->
<!-- ("next" "$" NextItem)? -->
<xsd:complexType name="windowVars">
<xsd:sequence>
<xsd:element name="currentItem" type="EQName" minOccurs="0"/>
<xsd:element ref="positionalVariableBinding" minOccurs="0"/>
<xsd:element name="previousItem" type="EQName" minOccurs="0"/>
<xsd:element name="nextItem" type="EQName" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="windowVars" type="windowVars"/>
<!-- countClause (part of FLWOR expression) -->
<xsd:complexType name="countClause">
<xsd:sequence>
<xsd:element ref="varRef"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="countClause" type="countClause"/>
</span><!-- whereClause (part of FLWOR expression) -->
<xsd:element name="whereClause" type="exprWrapper"/>
<span><!-- groupByClause (part of FLWOR expression) -->
<!-- Corresponds to the following XQuery syntax -->
<!-- GroupByClause ::= "group" "by" GroupingSpecList -->
<!-- GroupingSpecList ::= GroupingSpec ("," GroupingSpec)* -->
<xsd:complexType name="groupByClause">
<xsd:sequence maxOccurs="unbounded">
<xsd:element ref="groupingSpec"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="groupByClause" type="groupByClause"/>
<!-- 2011-09-14/JM - added the ability to initialize a grouping variable, opt set type -->
<!-- Corresponds to the following XQuery syntax -->
<!-- GroupingSpec ::= -->
<!-- "$" VarName ( typeDeclaration? ":=" exprSingle )? ("collation" URILiteral)? -->
<xsd:complexType name="groupingSpec">
<xsd:sequence>
<xsd:element name="varName" type="EQName"/>
<xsd:element name="groupVarInitialize" minOccurs="0">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="typeDeclaration" minOccurs="0"/>
<xsd:element name="varValue" type="exprWrapper"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="collation" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="groupingSpec" type="groupingSpec"/>
</span><!-- order by clause -->
<xsd:simpleType name="emptyOrderingMode">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="empty greatest"/>
<xsd:enumeration value="empty least"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="orderingKind">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="ascending"/>
<xsd:enumeration value="descending"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="orderModifier">
<xsd:sequence>
<xsd:element name="orderingKind" type="orderingKind" minOccurs="0"/>
<xsd:element name="emptyOrderingMode" type="emptyOrderingMode" minOccurs="0"/>
<xsd:element name="collation" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="orderModifier" type="orderModifier"/>
<xsd:complexType name="orderBySpec">
<xsd:sequence>
<xsd:element name="orderByExpr" type="exprWrapper"/>
<xsd:element ref="orderModifier" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="orderBySpec" type="orderBySpec"/>
<xsd:complexType name="orderByClause">
<xsd:sequence>
<xsd:element name="stable" type="emptyContent" minOccurs="0"/>
<xsd:element ref="orderBySpec" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="orderByClause" type="orderByClause"/>
<!-- return clause -->
<xsd:element name="returnClause" type="exprWrapper"/>
<span><!-- This is the XQuery 3.0 flwor expression -->
<!-- Corresponds to the following XQuery syntax: -->
<!-- 1.1 FLWORExpr ::= (ForClause | LetClause | WindowClause) -->
<!-- (ForClause | LetClause | WindowClause | CountClause | -->
<!-- WhereClause | GroupByClause | OrderByClause)* -->
<!-- ReturnClause -->
<xsd:complexType name="flworExpr">
<xsd:complexContent>
<xsd:extension base="expr">
<xsd:sequence>
<xsd:choice>
<xsd:element ref="forClause"/>
<xsd:element ref="letClause"/>
<xsd:element ref="windowClause"/>
</xsd:choice>
<xsd:sequence>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element ref="forClause"/>
<xsd:element ref="letClause"/>
<xsd:element ref="windowClause"/>
<xsd:element ref="countClause"/>
<xsd:element ref="whereClause"/>
<xsd:element ref="groupByClause"/>
<xsd:element ref="orderByClause"/>
</xsd:choice>
<xsd:element ref="returnClause"/>
</xsd:sequence>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</span> <xsd:element name="flworExpr" type="flworExpr" substitutionGroup="expr"/>
<!-- conditional expressions -->
<xsd:complexType name="ifThenElseExpr">
<xsd:complexContent>
<xsd:extension base="expr">
<xsd:sequence>
<xsd:element name="ifClause" type="exprWrapper"/>
<xsd:element name="thenClause" type="exprWrapper"/>
<xsd:element name="elseClause" type="exprWrapper"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="ifThenElseExpr" type="ifThenElseExpr"
substitutionGroup="expr"/>
<!-- The following clauses describe quantified expressions -->
<xsd:simpleType name="quantifier">
<xsd:restriction base="xsd:NMTOKEN">
<xsd:enumeration value="some"/>
<xsd:enumeration value="every"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="quantifiedExprInClause">
<xsd:sequence>
<xsd:element ref="typedVariableBinding"/>
<xsd:element name="sourceExpr" type="exprWrapper"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="quantifiedExprInClause" type="quantifiedExprInClause"/>
<xsd:complexType name="quantifiedExpr">
<xsd:complexContent>
<xsd:extension base="expr">
<xsd:sequence>
<xsd:element name="quantifier" type="quantifier"/>
<xsd:element ref="quantifiedExprInClause" maxOccurs="unbounded"/>
<xsd:element name="predicateExpr" type="exprWrapper"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="quantifiedExpr" type="quantifiedExpr"
substitutionGroup="expr"/>
<span><!-- handle the switch expression -->
<!-- Note: no substitutionGroup as we cannot use this anywhere except within switch -->
<xsd:complexType name="switchExprCaseClause">
<xsd:complexContent>
<xsd:extension base="expr">
<xsd:sequence>
<xsd:element name="switchCaseExpr" type="exprWrapper" maxOccurs="unbounded"/>
<xsd:element name="resultExpr" type="exprWrapper"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="switchExprCaseClause"
type="switchExprCaseClause"/>
<!-- Note: no substitutionGroup as we cannot use this anywhere except within switch -->
<xsd:complexType name="switchExprDefaultClause">
<xsd:complexContent>
<xsd:extension base="expr">
<xsd:sequence>
<xsd:element name="resultExpr" type="exprWrapper"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="switchExprDefaultClause"
type="switchExprDefaultClause"/>
<xsd:complexType name="switchExpr">
<xsd:complexContent>
<xsd:extension base="expr">
<xsd:sequence>
<xsd:element name="argExpr" type="exprWrapper"/>
<xsd:element ref="switchExprCaseClause" maxOccurs="unbounded"/>
<xsd:element ref="switchExprDefaultClause"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="switchExpr" type="switchExpr"
substitutionGroup="expr"/>
</span><!-- handle the typeswitch expression -->
<!-- Note: no substitutionGroup as we cannot use this anywhere except within typeswitch -->
<!-- 2011-09-09/JM - replaced sequenceType with sequenceTypeUnion -->
<xsd:complexType name="typeswitchExprCaseClause">
<xsd:complexContent>
<xsd:extension base="expr">
<xsd:sequence>
<xsd:element ref="variableBinding" minOccurs="0"/>
<span> <xsd:choice>
<xsd:element ref="sequenceType"/>
<xsd:element ref="sequenceTypeUnion"/>
</xsd:choice>
</span> <xsd:element name="resultExpr" type="exprWrapper"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="typeswitchExprCaseClause"
type="typeswitchExprCaseClause"/>
<!-- Note: no substitutionGroup as we cannot use this anywhere except within typeswitch -->
<xsd:complexType name="typeswitchExprDefaultClause">
<xsd:complexContent>
<xsd:extension base="expr">
<xsd:sequence>
<xsd:element ref="variableBinding" minOccurs="0"/>
<xsd:element name="resultExpr" type="exprWrapper"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="typeswitchExprDefaultClause"
type="typeswitchExprDefaultClause"/>
<xsd:complexType name="typeswitchExpr">
<xsd:complexContent>
<xsd:extension base="expr">
<xsd:sequence>
<xsd:element name="argExpr" type="exprWrapper"/>
<xsd:element ref="typeswitchExprCaseClause" maxOccurs="unbounded"/>
<xsd:element ref="typeswitchExprDefaultClause"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="typeswitchExpr" type="typeswitchExpr"
substitutionGroup="expr"/>
<span><!-- TryCatchExpression -->
<!-- Corresponds to the following XQuery syntax -->
<!-- TryCatchExpression ::= TryClause CatchClause+ -->
<!-- TryClause ::= "{" TryTargetExpr "}" -->
<!-- TryTargetExpr ::= Expr -->
<xsd:complexType name="tryCatchExpr">
<xsd:complexContent>
<xsd:extension base="expr">
<xsd:sequence>
<xsd:element name="tryClause" type="exprWrapper"/>
<xsd:element ref="catchClause" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="tryCatchExpr" type="tryCatchExpr"
substitutionGroup="expr"/>
<!-- CatchClause (part of the TryCatchExpression) -->
<!-- Corresponds to the following XQuery syntax -->
<!-- CatchClause ::= "catch" CatchErrorList "{" Expr "}" -->
<xsd:complexType name="catchClause">
<xsd:sequence>
<xsd:element ref="catchErrorList"/>
<xsd:element name="catchExpr" type="exprWrapper"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="catchClause" type="catchClause"/>
<!-- CatchErrorList (part of the TryCatchExpression) -->
<!-- Corresponds to the following XQuery syntax -->
<!-- CatchErrorList ::= NameTest ( "|" NameTest )* -->
<!-- (remembering that NameTest is either QName or Wildcard) -->
<xsd:complexType name="catchErrorList">
<xsd:sequence maxOccurs="unbounded">
<xsd:choice>
<xsd:element ref="nameTest"/>
<xsd:element ref="Wildcard"/>
</xsd:choice>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="catchErrorList" type="catchErrorList"/>
</span><!-- instance-of expressions -->
<xsd:complexType name="instanceOfExpr">
<xsd:complexContent>
<xsd:extension base="expr">
<xsd:sequence>
<xsd:element name="argExpr" type="exprWrapper"/>
<xsd:element ref="sequenceType"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="instanceOfExpr" type="instanceOfExpr"
substitutionGroup="expr"/>
<!-- treat-as expressions -->
<xsd:complexType name="treatExpr">
<xsd:complexContent>
<xsd:extension base="expr">
<xsd:sequence>
<xsd:element name="argExpr" type="exprWrapper"/>
<xsd:element ref="sequenceType"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="treatExpr" type="treatExpr"
substitutionGroup="expr"/>
<!-- castable and cast expressions -->
<xsd:complexType name="castableExpr">
<xsd:complexContent>
<xsd:extension base="expr">
<xsd:sequence>
<xsd:element name="argExpr" type="exprWrapper"/>
<xsd:element ref="singleType"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="castableExpr" type="castableExpr"
substitutionGroup="expr"/>
<xsd:complexType name="castExpr">
<xsd:complexContent>
<xsd:extension base="expr">
<xsd:sequence>
<xsd:element name="argExpr" type="exprWrapper"/>
<xsd:element ref="singleType"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="castExpr" type="castExpr"
substitutionGroup="expr"/>
<!-- Validate expressions -->
<xsd:simpleType name="validationMode">
<xsd:restriction base="xsd:NMTOKEN">
<xsd:enumeration value="lax"/>
<xsd:enumeration value="strict"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="validateExpr">
<xsd:complexContent>
<xsd:extension base="expr">
<xsd:sequence>
<span> <xsd:choice>
<xsd:element name="validationMode" type="validationMode" minOccurs="0"/>
<xsd:element name="typeName" type="EQName" minOccurs="0"/>
</xsd:choice>
</span> <xsd:element name="argExpr" type="exprWrapper"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="validateExpr" type="validateExpr"
substitutionGroup="expr"/>
<!-- Direct constructors. Only elementConstructor for now -->
<!-- Note the absence of constructors corresponding to -->
<!-- the directCommentConstructor and the directPIConstructor -->
<!-- productions in the XQuery grammar. This is because they are -->
<!-- trivially identical to the computed variants -->
<!-- attributeConstructor is no longer a subclass of expr -->
<xsd:complexType name="attributeConstructor">
<xsd:sequence>
<xsd:element name="attributeName" type="QName"/>
<xsd:choice>
<xsd:element name="attributeValueExpr" type="exprList"/>
<xsd:element name="attributeValue" type="xsd:string"/>
</xsd:choice>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="namespaceDeclaration">
<xsd:sequence>
<xsd:element name="prefix" type="xsd:NCName" minOccurs="0"/>
<xsd:element name="uri" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<!-- element constructors -->
<xsd:complexType name="attributeList">
<xsd:sequence>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="attributeConstructor" type="attributeConstructor"/>
<xsd:element name="namespaceDeclaration" type="namespaceDeclaration"/>
</xsd:choice>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="attributeList" type="attributeList"/>
<xsd:element name="elementContent" type="exprList"/>
<xsd:complexType name="elementConstructor">
<xsd:complexContent>
<xsd:extension base="expr">
<xsd:sequence>
<xsd:element name="tagName" type="QName"/>
<xsd:element ref="attributeList" minOccurs="0"/>
<xsd:element ref="elementContent" minOccurs="0"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="elementConstructor" type="elementConstructor"
substitutionGroup="expr"/>
<!-- computed constructors -->
<!-- computed element constructor -->
<xsd:complexType name="computedElementConstructor">
<xsd:complexContent>
<xsd:extension base="expr">
<xsd:sequence>
<xsd:choice>
<span> <xsd:element name="tagName" type="EQName"/>
</span> <xsd:element name="tagNameExpr" type="exprWrapper"/>
</xsd:choice>
<xsd:element name="contentExpr" type="exprWrapper" minOccurs="0"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="computedElementConstructor" type="computedElementConstructor"
substitutionGroup="expr"/>
<!-- computed attribute constructor -->
<xsd:complexType name="computedAttributeConstructor">
<xsd:complexContent>
<xsd:extension base="expr">
<xsd:sequence>
<xsd:choice>
<span> <xsd:element name="tagName" type="EQName"/>
</span> <xsd:element name="tagNameExpr" type="exprWrapper"/>
</xsd:choice>
<xsd:element name="valueExpr" type="exprWrapper" minOccurs="0"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="computedAttributeConstructor" type="computedAttributeConstructor"
substitutionGroup="expr"/>
<!-- computed document constructor -->
<xsd:complexType name="computedDocumentConstructor">
<xsd:complexContent>
<xsd:extension base="expr">
<xsd:sequence>
<xsd:element name="argExpr" type="exprWrapper"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="computedDocumentConstructor" type="computedDocumentConstructor"
substitutionGroup="expr"/>
<!-- computed text constructor -->
<xsd:complexType name="computedTextConstructor">
<xsd:complexContent>
<xsd:extension base="expr">
<xsd:sequence>
<xsd:element name="argExpr" type="exprWrapper" minOccurs="0"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="computedTextConstructor" type="computedTextConstructor"
substitutionGroup="expr"/>
<!-- computed comment constructor -->
<xsd:complexType name="computedCommentConstructor">
<xsd:complexContent>
<xsd:extension base="expr">
<xsd:sequence>
<xsd:element name="argExpr" type="exprWrapper"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="computedCommentConstructor" type="computedCommentConstructor"
substitutionGroup="expr"/>
<span><!-- computed namespace constructor -->
<xsd:complexType name="computedNamespaceConstructor">
<xsd:complexContent>
<xsd:extension base="expr">
<xsd:sequence>
<xsd:choice>
<xsd:element name="prefix" type="xsd:NCName"/>
<xsd:element name="prefixExpr" type="exprWrapper"/>
</xsd:choice>
<xsd:element name="URIExpr" type="exprWrapper" minOccurs="0"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="computedNamespaceConstructor" type="computedNamespaceConstructor"
substitutionGroup="expr"/>
</span><!-- computed processing instruction constructor -->
<xsd:complexType name="computedPIConstructor">
<xsd:complexContent>
<xsd:extension base="expr">
<xsd:sequence>
<xsd:choice>
<xsd:element name="piTarget" type="xsd:NCName"/>
<xsd:element name="piTargetExpr" type="exprWrapper"/>
</xsd:choice>
<xsd:element name="piValueExpr" type="exprWrapper" minOccurs="0"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="computedPIConstructor" type="computedPIConstructor"
substitutionGroup="expr"/>
<!-- ordered and unordered expressions -->
<xsd:complexType name="unorderedExpr">
<xsd:complexContent>
<xsd:extension base="expr">
<xsd:sequence>
<xsd:element name="argExpr" type="exprWrapper"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="unorderedExpr" type="unorderedExpr" substitutionGroup="expr"/>
<xsd:complexType name="orderedExpr">
<xsd:complexContent>
<xsd:extension base="expr">
<xsd:sequence>
<xsd:element name="argExpr" type="exprWrapper"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="orderedExpr" type="orderedExpr" substitutionGroup="expr"/>
<span><!-- function item expressions -->
<!-- literal function item expression -->
<!-- 2010-04-06: Jim changed child element QName to be functionName for consistency -->
<!-- 2011-11-21: Jim changed "literalFunctionItemExpr" to "namedFunctionRef" -->
<xsd:complexType name="namedFunctionRef">
<xsd:complexContent>
<xsd:extension base="expr">
<xsd:sequence>
<xsd:element name="functionName" type="EQName"/>
<xsd:element name="integerConstantExpr" type="integerConstantExpr"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="namedFunctionRef" type="namedFunctionRef" substitutionGroup="expr"/>
<!-- inline function item expression -->
<!-- 2011-09-09/JM - Added annotations to inline functions -->
<!-- 2011-11-21: Jim changed "inlineFunctionItemExpr" to "inlineFunctionExpr" -->
<xsd:complexType name="inlineFunctionExpr">
<xsd:complexContent>
<xsd:extension base="expr">
<xsd:sequence>
<xsd:element name="annotation" type="annotation"
minOccurs="0" maxOccurs="unbounded"/>
<xsd:element ref="paramList"/>
<xsd:element ref="typeDeclaration" minOccurs="0"/>
<xsd:element name="functionBody" type="exprWrapper"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="inlineFunctionExpr" type="inlineFunctionExpr" substitutionGroup="expr"/>
<!-- dynamic function invocations -->
<!-- 2010-06-23 - Added support for partial function application -->
<xsd:complexType name="dynamicFunctionInvocationExpr">
<xsd:complexContent>
<xsd:extension base="expr">
<xsd:sequence>
<xsd:element name="functionItem">
<xsd:complexType>
<xsd:sequence>
<xsd:group ref="filterExpr"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="predicates" type="exprList" minOccurs="0"/>
<xsd:element name="arguments" type="exprOrPlaceholderList" minOccurs="0"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="dynamicFunctionInvocationExpr" type="dynamicFunctionInvocationExpr" substitutionGroup="expr"/>
</span><!-- wildcards -->
<xsd:complexType name="simpleWildcard">
<xsd:choice>
<span> <xsd:element name="QName" type="EQName"/>
</span> <xsd:element name="star" type="emptyContent"/>
</xsd:choice>
</xsd:complexType>
<!-- 2011-06-10: Redesigned to allow "URliteral:*" -->
<!-- Corresponds to the following XQuery syntax: -->
<!-- [44] Wildcard ::= "*" -->
<!-- | (NCName ":" "*") -->
<!-- | ("*" ":" NCName) -->
<!-- | (URILiteral ":" "*") -->
<xsd:complexType name="Wildcard">
<span> <xsd:choice minOccurs="0">
<xsd:sequence>
<xsd:element name="star" type="emptyContent"/>
<xsd:element ref="NCName"/>
</xsd:sequence>
<xsd:sequence>
<xsd:element ref="NCName"/>
<xsd:element name="star" type="emptyContent"/>
</xsd:sequence>
<xsd:sequence>
<xsd:element name="uri" type="xsd:string"/>
<xsd:element name="star" type="emptyContent"/>
</xsd:sequence>
</xsd:choice>
</span> </xsd:complexType>
<xsd:element name="Wildcard" type="Wildcard"/>
<!-- tests (name and/or type) -->
<span> <xsd:element name="schemaAttributeTest" type="EQName"
substitutionGroup="kindTest"/>
</span>
<xsd:complexType name="attributeTest">
<xsd:complexContent>
<xsd:extension base="emptyItemTypeContent">
<xsd:sequence minOccurs="0">
<xsd:element name="attributeName" type="simpleWildcard"/>
<span> <xsd:element name="typeName" type="EQName" minOccurs="0"/>
</span> </xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="attributeTest" type="attributeTest"
substitutionGroup="kindTest"/>
<xsd:element name="anyElementTest" abstract="true"
substitutionGroup="kindTest"/>
<span> <xsd:element name="schemaElementTest" type="EQName"
substitutionGroup="anyElementTest"/>
</span>
<xsd:complexType name="elementTest">
<xsd:complexContent>
<xsd:extension base="emptyItemTypeContent">
<xsd:sequence minOccurs="0">
<xsd:element name="elementName" type="simpleWildcard"/>
<xsd:sequence minOccurs="0">
<span> <xsd:element name="typeName" type="EQName"/>
</span> <xsd:element name="nillable" type="emptyContent" minOccurs="0"/>
</xsd:sequence>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="elementTest" type="elementTest"
substitutionGroup="anyElementTest"/>
<xsd:complexType name="documentTest">
<xsd:complexContent>
<xsd:extension base="emptyItemTypeContent">
<xsd:sequence>
<xsd:element ref="anyElementTest" minOccurs="0"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="documentTest" type="documentTest"
substitutionGroup="kindTest"/>
<xsd:complexType name="piTest">
<xsd:complexContent>
<xsd:extension base="emptyItemTypeContent">
<xsd:sequence>
<xsd:element name="piTarget" type="xsd:NCName" minOccurs="0"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="piTest" type="piTest" substitutionGroup="kindTest"/>
<span> <xsd:element name="nameTest" type="EQName"/>
</span> <xsd:element name="kindTest" substitutionGroup="itemType"/>
<xsd:element name="textTest" type="emptyItemTypeContent"
substitutionGroup="kindTest"/>
<xsd:element name="commentTest" type="emptyItemTypeContent"
substitutionGroup="kindTest"/>
<span> <xsd:element name="namespaceTest" type="emptyItemTypeContent"
substitutionGroup="kindTest"/>
</span> <xsd:element name="anyKindTest" type="emptyItemTypeContent"
substitutionGroup="kindTest"/>
<span><!-- functionTest variations -->
<xsd:element name="anyFunctionTest" type="emptyItemTypeContent" substitutionGroup="itemType"/>
<xsd:complexType name="typedFunctionTest">
<xsd:complexContent>
<xsd:extension base="emptyItemTypeContent">
<xsd:sequence>
<xsd:element ref="paramTypeList" minOccurs="0"/>
<xsd:element ref="sequenceType"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="typedFunctionTest" type="typedFunctionTest" substitutionGroup="itemType"/>
<xsd:complexType name="paramTypeList">
<xsd:sequence>
<xsd:element ref="sequenceType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="paramTypeList" type="paramTypeList"/>
<xsd:complexType name="parenthesizedItemType">
<xsd:complexContent>
<xsd:extension base="emptyItemTypeContent">
<xsd:sequence>
<xsd:element ref="itemType"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="parenthesizedItemType" type="parenthesizedItemType" substitutionGroup="itemType"/>
</span><!-- XPath axes -->
<xsd:simpleType name="xpathAxis">
<xsd:restriction base="xsd:NMTOKEN">
<xsd:enumeration value="child"/>
<xsd:enumeration value="attribute"/>
<xsd:enumeration value="self"/>
<xsd:enumeration value="parent"/>
<xsd:enumeration value="descendant-or-self"/>
<xsd:enumeration value="descendant"/>
<xsd:enumeration value="following"/>
<xsd:enumeration value="following-sibling"/>
<xsd:enumeration value="ancestor"/>
<xsd:enumeration value="ancestor-or-self"/>
<xsd:enumeration value="preceding"/>
<xsd:enumeration value="preceding-sibling"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:element name="xpathAxis" type="xpathAxis"/>
<!-- filter expressions -->
<!-- added literalFunctionItemExpr, inlineFunctionItemExpr, and -->
<!-- dynamicFunctionInvocation for higher-order functions -->
<span><!-- 2011-11-21: Jim changed "literalFunctionItemExpr" to "namedFunctionRef" -->
<!-- 2011-11-21: Jim changed "inlineFunctionItemExpr" to "inlineFunctionExpr" -->
</span> <xsd:group name="filterExpr">
<xsd:choice>
<xsd:element ref="constantExpr"/>
<xsd:element ref="varRef"/>
<xsd:element ref="contextItemExpr"/>
<xsd:element ref="functionCallExpr"/>
<xsd:element ref="sequenceExpr"/>
<xsd:element ref="elementConstructor"/>
<xsd:element ref="computedElementConstructor"/>
<xsd:element ref="computedAttributeConstructor"/>
<xsd:element ref="computedDocumentConstructor"/>
<xsd:element ref="computedTextConstructor"/>
<xsd:element ref="computedCommentConstructor"/>
<xsd:element ref="computedNamespaceConstructor"/>
<xsd:element ref="computedPIConstructor"/>
<xsd:element ref="orderedExpr"/>
<xsd:element ref="unorderedExpr"/>
<span> <xsd:element ref="namedFunctionRef"/>
<xsd:element ref="inlineFunctionExpr"/>
<xsd:element ref="dynamicFunctionInvocationExpr"/>
</span> </xsd:choice>
</xsd:group>
<!-- step expression -->
<!-- removed nameTest and Wildcard outer choices per Bugzilla Bug #2523 -->
<!-- replaced element "predicates" with choice of "predicates" & "dynamicfunctioninv'n" -->
<xsd:complexType name="stepExpr">
<xsd:sequence>
<xsd:choice>
<xsd:sequence>
<xsd:element ref="xpathAxis"/>
<xsd:choice>
<xsd:element ref="kindTest"/>
<xsd:element ref="nameTest"/>
<xsd:element ref="Wildcard"/>
</xsd:choice>
</xsd:sequence>
<xsd:element name="filterExpr">
<xsd:complexType>
<xsd:sequence>
<xsd:group ref="filterExpr"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:choice>
<xsd:element name="predicates" type="exprList" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="stepExpr" type="stepExpr"/>
<span> <!-- 2011-09-09/JM - Added mapStepExpr -->
<xsd:element name="mapStepExpr" type="stepExpr"/>
</span><!-- path expression -->
<!-- rewrote pathExpr definition per Bugzilla Bug #2523 -->
<!-- 2011-09-09/JM - Added mapStepExpr -->
<xsd:complexType name="pathExpr">
<xsd:complexContent>
<xsd:extension base="expr">
<xsd:choice>
<xsd:sequence>
<xsd:element name="rootExpr" type="emptyContent"/>
<span> <xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element ref="stepExpr"/>
<xsd:element ref="mapStepExpr"/>
</xsd:choice>
</xsd:sequence>
<xsd:choice maxOccurs="unbounded">
<xsd:element ref="stepExpr"/>
<xsd:element ref="mapStepExpr"/>
</xsd:choice>
</span> </xsd:choice>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="pathExpr" type="pathExpr" substitutionGroup="expr"/>
<!-- The following constructs deal with the query prolog -->
<xsd:complexType name="module">
<xsd:sequence>
<xsd:element ref="versionDecl" minOccurs="0"/>
<xsd:choice>
<xsd:element ref="mainModule"/>
<xsd:element ref="libraryModule"/>
</xsd:choice>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="module" type="module"/>
<xsd:complexType name="mainModule">
<xsd:sequence>
<xsd:element ref="prolog" minOccurs="0"/>
<xsd:element name="queryBody" type="exprWrapper"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="mainModule" type="mainModule"/>
<xsd:complexType name="libraryModule">
<xsd:sequence>
<xsd:element ref="moduleDecl"/>
<xsd:element ref="prolog" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="libraryModule" type="libraryModule"/>
<xsd:complexType name="versionDecl">
<xsd:sequence>
<xsd:element name="version" type="xsd:string" minOccurs="0"/>
<span> <xsd:element name="encoding" type="xsd:string" minOccurs="0"/>
</span> </xsd:sequence>
</xsd:complexType>
<xsd:element name="versionDecl" type="versionDecl"/>
<xsd:complexType name="prolog">
<xsd:sequence>
<xsd:element ref="prologPartOneItem" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element ref="prologPartTwoItem" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="prolog" type="prolog"/>
<xsd:element name="prologPartOneItem" abstract="true"/>
<xsd:element name="prologPartTwoItem" abstract="true"/>
<span> <xsd:simpleType name="boundarySpaceDecl">
<xsd:restriction base="xsd:NMTOKEN">
<xsd:enumeration value="strip"/>
<xsd:enumeration value="preserve"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:element name="boundarySpaceDecl" type="boundarySpaceDecl"
substitutionGroup="prologPartOneItem"/>
<xsd:element name="defaultCollationDecl" type="xsd:string"
substitutionGroup="prologPartOneItem"/>
<xsd:element name="baseUriDecl" type="xsd:string"
substitutionGroup="prologPartOneItem"/>
</span> <xsd:simpleType name="constructionDecl">
<xsd:restriction base="xsd:NMTOKEN">
<xsd:enumeration value="strip"/>
<xsd:enumeration value="preserve"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:element name="constructionDecl" type="constructionDecl"
substitutionGroup="prologPartOneItem"/>
<xsd:simpleType name="orderingModeDecl">
<xsd:restriction base="xsd:NMTOKEN">
<xsd:enumeration value="ordered"/>
<xsd:enumeration value="unordered"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:element name="orderingModeDecl" type="orderingModeDecl"
substitutionGroup="prologPartOneItem"/>
<xsd:element name="emptyOrderingDecl" type="emptyOrderingMode"
substitutionGroup="prologPartOneItem"/>
<xsd:complexType name="copyNamespacesDecl">
<xsd:sequence>
<xsd:element name="preserveMode">
<xsd:simpleType>
<xsd:restriction base="xsd:NMTOKEN">
<xsd:enumeration value="preserve"/>
<xsd:enumeration value="no-preserve"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="inheritMode">
<xsd:simpleType>
<xsd:restriction base="xsd:NMTOKEN">
<xsd:enumeration value="inherit"/>
<xsd:enumeration value="no-inherit"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="copyNamespacesDecl" type="copyNamespacesDecl"
substitutionGroup="prologPartOneItem"/>
<xsd:simpleType name="defaultNamespaceCategory">
<xsd:restriction base="xsd:NMTOKEN">
<xsd:enumeration value="function"/>
<xsd:enumeration value="element"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="defaultNamespaceDecl">
<xsd:sequence>
<xsd:element name="defaultNamespaceCategory" type="defaultNamespaceCategory"/>
<xsd:element name="uri" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="defaultNamespaceDecl" type="defaultNamespaceDecl"
substitutionGroup="prologPartOneItem"/>
<xsd:complexType name="namespaceDeclType">
<xsd:sequence>
<xsd:element name="prefix" type="xsd:NCName"/>
<xsd:element name="uri" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="namespaceDecl" type="namespaceDeclType"
substitutionGroup="prologPartOneItem"/>
<xsd:element name="moduleDecl" type="namespaceDeclType"/>
<span> <xsd:complexType name="decimalFormatDeclType">
<xsd:sequence>
<xsd:element name="decimalFormatName" type="EQName" minOccurs="0"/>
<xsd:element name="decimalFormatParam" minOccurs="0" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="decimalFormatParamName">
<xsd:simpleType>
<xsd:restriction base="xsd:NMTOKEN">
<xsd:enumeration value="decimal-separator"/>
<xsd:enumeration value="grouping-separator"/>
<xsd:enumeration value="infinity"/>
<xsd:enumeration value="minus-sign"/>
<xsd:enumeration value="NaN"/>
<xsd:enumeration value="percent"/>
<xsd:enumeration value="per-mille"/>
<xsd:enumeration value="zero-digit"/>
<xsd:enumeration value="digit"/>
<xsd:enumeration value="pattern-separator"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="decimalFormatParamValue" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="default" default="false">
<xsd:simpleType>
<xsd:restriction base="xsd:NMTOKEN">
<xsd:enumeration value="true"/>
<xsd:enumeration value="false"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
<xsd:element name="decimalFormatDecl" type="decimalFormatDeclType"
substitutionGroup="prologPartOneItem"/>
</span> <xsd:complexType name="schemaImport">
<xsd:sequence>
<xsd:choice minOccurs="0">
<xsd:element name="namespacePrefix" type="xsd:NCName"/>
<xsd:element name="defaultElementNamespace" type="emptyContent"/>
</xsd:choice>
<xsd:element name="targetNamespace" type="xsd:string"/>
<xsd:element name="targetLocation" type="xsd:string"
minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="schemaImport" type="schemaImport"
substitutionGroup="prologPartOneItem"/>
<xsd:complexType name="moduleImport">
<xsd:sequence>
<xsd:element name="namespacePrefix" type="xsd:NCName" minOccurs="0"/>
<xsd:element name="targetNamespace" type="xsd:string"/>
<xsd:element name="targetLocation" type="xsd:string"
minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="moduleImport" type="moduleImport"
substitutionGroup="prologPartOneItem"/>
<span> <xsd:complexType name="contextItemDecl">
<xsd:sequence>
<xsd:element ref="typeDeclaration" minOccurs="0"/>
<xsd:choice>
<xsd:element name="varValue" type="exprWrapper"/>
<xsd:sequence>
<xsd:element name="external">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="varValue" type="exprWrapper" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:choice>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="contextItemDecl" type="contextItemDecl"
substitutionGroup="prologPartTwoItem"/>
<!-- For %-annotations -->
<xsd:complexType name="annotation">
<xsd:sequence>
<xsd:element name="annotationName" type="EQName"/>
<xsd:element name="arguments" type="exprList" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</span> <xsd:complexType name="varDecl">
<xsd:sequence>
<span> <xsd:element name="annotation" type="annotation"
minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="varName" type="EQName"/>
<xsd:element ref="typeDeclaration" minOccurs="0"/>
<xsd:choice>
<xsd:element name="varValue" type="exprWrapper"/>
<xsd:sequence>
<xsd:element name="external">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="varValue" type="exprWrapper" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:choice>
</span> </xsd:sequence>
</xsd:complexType>
<xsd:element name="varDecl" type="varDecl"
substitutionGroup="prologPartTwoItem"/>
<xsd:complexType name="optionDecl">
<xsd:sequence>
<span> <xsd:element name="optionName" type="EQName"/>
</span> <xsd:element name="optionContents" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="optionDecl" type="optionDecl"
substitutionGroup="prologPartTwoItem"/>
<xsd:complexType name="functionDecl">
<xsd:sequence>
<span> <xsd:element name="annotation" type="annotation"
minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="functionName" type="EQName"/>
<xsd:element ref="paramList"/>
<xsd:element ref="typeDeclaration" minOccurs="0"/>
<xsd:choice>
<xsd:element name="functionBody" type="exprWrapper"/>
<xsd:element name="externalDefinition" type="emptyContent"/>
</xsd:choice>
</xsd:sequence>
<xsd:attribute name="nondeterministic" use="optional"
type="xsd:boolean" default="false"/>
<xsd:attribute name="private" use="optional"
type="xsd:boolean" default="false"/>
</span> </xsd:complexType>
<xsd:element name="functionDecl" type="functionDecl"
substitutionGroup="prologPartTwoItem"/>
<xsd:complexType name="param">
<xsd:sequence>
<span> <xsd:element name="varName" type="EQName"/>
</span> <xsd:element ref="typeDeclaration" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="param" type="param"/>
<xsd:complexType name="paramList">
<xsd:sequence>
<xsd:element ref="param" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="paramList" type="paramList"/>
</xsd:schema>
</pre></div>
</div>
<div class="div1">
<h2><a name="xqx_conformance" id="xqx_conformance"></a>5
Conformance</h2>
<p>This section defines the conformance criteria for an XQueryX
processor (see Figure 1, "Processing Model Overview", in
<span><a href="#xquery-30">[XQuery 3.0: An XML Query
Language]</a></span> , <a href=
"http://www.w3.org/TR/xquery-30/#id-processing-model">Section 2.2
Processing Model</a> <sup><small>XQ30</small></sup>.</p>
<p>In this section, the following terms are used to indicate the
requirement levels defined in <a href="#RFC2119">[RFC 2119]</a>.
[Definition: MUST means that the item is an absolute requirement of
the specification.] [Definition: SHOULD means that there may exist
valid reasons in particular circumstances to ignore a particular
item, but the full implications must be understood and carefully
weighed before choosing a different course.] [Definition: MAY means
that an item is truly optional.]</p>
<p>An XQueryX processor that claims to conform to this
specification MUST implement the XQueryX syntax as defined in
<a href="#Schema"><b>4 An XML Schema for the XQuery XML
Syntax</b></a> of this specification and include a claim of Minimal
Conformance as defined in <span><a href="#xquery-30">[XQuery 3.0:
An XML Query Language]</a></span> , <a href=
"http://www.w3.org/TR/xquery-30/#id-minimal-conformance">Section
5.1 Minimal Conformance</a> <sup><small>XQ30</small></sup>. In
addition to a claim of Minimal Conformance, it MAY claim
conformance to one or more optional features defined in
<span><a href="#xquery-30">[XQuery 3.0: An XML Query
Language]</a></span> , <a href=
"http://www.w3.org/TR/xquery-30/#id-conform-optional-features">Section
5.2 Optional Features</a> <sup><small>XQ30</small></sup>.</p>
</div>
</div>
<div class="back">
<div class="div1">
<h2><a name="biblio" id="biblio"></a>A References</h2>
<dl>
<dt class="label"><span><a name="xqueryx" id="xqueryx"></a>XML
Syntax for XQuery 1.0 (XQueryX)</span></dt>
<dd>
<div><a href="http://www.w3.org/TR/xqueryx/"><cite>XML Syntax for
XQuery 1.0 (XQueryX) (Second Edition)</cite></a>, Jim Melton and
Subramanian Muralidhar, Editors. World Wide Web Consortium, 14
December 2010. This version is
http://www.w3.org/TR/2010/REC-xqueryx-20101214/. The <a href=
"http://www.w3.org/TR/xqueryx/">latest version</a> is available at
http://www.w3.org/TR/xqueryx/.</div>
</dd>
<dt class="label"><span><a name="xquery-30-requirements" id=
"xquery-30-requirements"></a>XQuery 3.0 Requirements</span></dt>
<dd>
<div><a href=
"http://www.w3.org/TR/xquery-30-requirements/"><cite>XQuery 3.0
Requirements</cite></a>, Daniel Engovatov, Jonathan Robie, Editors.
World Wide Web Consortium, 16 September 2010. This
version is
http://www.w3.org/TR/2010/WD-xquery-30-requirements-20100916/. The
<a href="http://www.w3.org/TR/xquery-30-requirements/">latest
version</a> is available at
http://www.w3.org/TR/xquery-30-requirements/.</div>
</dd>
<dt class="label"><span><a name="xquery-30" id=
"xquery-30"></a>XQuery 3.0: An XML Query Language</span></dt>
<dd>
<div><a href="http://www.w3.org/TR/xquery-30/"><cite>XQuery 3.0: An
XML Query Language</cite></a>, Jonathan Robie, Don Chamberlin,
Michael Dyck, John Snelson, Editors. World Wide Web Consortium, 13
December 2011. This version is
http://www.w3.org/TR/2011/WD-xquery-30-20111213/. The <a href=
"http://www.w3.org/TR/xquery-30/">latest version</a> is available
at http://www.w3.org/TR/xquery-30/.</div>
</dd>
<dt class="label"><span><a name="xquery-30-use-cases" id=
"xquery-30-use-cases"></a>XQuery 3.0 Use Cases</span></dt>
<dd>
<div><a href=
"http://www.w3.org/TR/xquery-30-use-cases/"><cite>XQuery 3.0 Use
Cases</cite></a>, Tim Kraska, Editor. World Wide Web Consortium, 30
March 2011. This version is
http://www.w3.org/TR/2011/WD-xquery-30-use-cases-20110330/. The
<a href="http://www.w3.org/TR/xquery-30-use-cases/">latest
version</a> is available at
http://www.w3.org/TR/xquery-30-use-cases/.</div>
</dd>
<dt class="label"><span><a name="xquery-semantics" id=
"xquery-semantics"></a>XQuery 1.0 and XPath 2.0 Formal
Semantics</span></dt>
<dd>
<div><a href="http://www.w3.org/TR/xquery-semantics/"><cite>XQuery
1.0 and XPath 2.0 Formal Semantics (Second Edition)</cite></a>,
Jérôme Siméon, Denise Draper, Peter Frankhauser, <em>et. al.</em>,
Editors. World Wide Web Consortium, 14 December 2010. This version
is http://www.w3.org/TR/2010/REC-xquery-semantics-20101214/. The
<a href="http://www.w3.org/TR/xquery-semantics/">latest version</a>
is available at http://www.w3.org/TR/xquery-semantics/.</div>
</dd>
<dt class="label"><span><a name="RFC2119" id="RFC2119"></a>RFC
2119</span></dt>
<dd>
<div>S. Bradner. <em>Key Words for use in RFCs to Indicate
Requirement Levels.</em> IETF RFC 2119. See <a href=
"http://www.ietf.org/rfc/rfc2119.txt">http://www.ietf.org/rfc/rfc2119.txt</a>.</div>
</dd>
<dt class="label"><span><a name="RFC3023" id="RFC3023"></a>RFC
3023</span></dt>
<dd>
<div>M. Murata, S. St. Laurent, and D. Kohn. <em>XML Media
Types</em> IETF RFC 3023 or its successors. See <a href=
"http://www.ietf.org/rfc/rfc3023.txt">http://www.ietf.org/rfc/rfc3023.txt</a>.</div>
</dd>
</dl>
</div>
<div class="div1">
<h2><a name="Stylesheet" id="Stylesheet"></a>B Transforming XQueryX
to XQuery</h2>
<p>The following stylesheet converts from XQueryX syntax to XML
Query syntax. Note the intent of the stylesheet is to produce
<em>a</em> valid XQuery with the same semantics (see <a href=
"#xquery-semantics">[XQuery 1.0 and XPath 2.0 Formal
Semantics]</a>) as the input XQueryX.</p>
<div class="exampleInner">
<pre>
<?xml version="1.0"?>
<span><!-- ================================================================================ -->
<!-- Changes from Recommendation (edition 1): -->
<!-- * In XSLT stylesheet, deleted template for xqx:parenthesizedExpr (bug #4963) -->
<!-- * In XSLT stylesheet, corrected template for xqx:namespaceDeclaration (bug #5343) -->
<!-- Changes from Recommendation (edition 2): -->
<!-- * Added support for new Windowing clause in FLWOR expression -->
<!-- * Added support for new Group By Clause in FLWOR expression -->
<!-- * Added support for new Count Clause in FLWOR expression -->
<!-- * Added support for keyword "outer" on for expression -->
<!-- * Modified structure of FLWOR clause per "simplified FLWOR expressions" -->
<!-- * Modified validation syntax per Bugzilla Bug 5472 -->
<!-- * Modified function declaration so that external functions can be nondeterminstic -->
<!-- * Modified variable declaration so external variables can have an initial value -->
<!-- * Added support for new try-catch expression -->
<!-- * Made changes triggered by Bugzilla Bugs 6309, 6310, and 6311 -->
<!-- * Modified errlist syntax per Bugzilla Bug 7053 -->
<!-- * Added support for public/private functions -->
<!-- * Replaced "outer for" support with support for "allowing empty" -->
<!-- * Added support for higher-order functions -->
<!-- * Added support for value-based "switch" expression -->
<!-- * Changed functionItemExpr child element QName to be functionName for consistency -->
<!-- ================================================================================ -->
<!-- Errata applied: -->
<!-- XQX.E3 - Editorial (Bugzilla Bug 4963) -->
<!-- XQX.E5 - Editorial (Bugzilla Bug 5343) -->
<!-- XQX.E9 - Minor technical (Bugzilla Bug 6733) -->
<!-- ================================================================================ -->
<!-- Modifications: -->
<!-- 2008-07-30 - Add XQuery 1.1 grouping and windowing support -->
<!-- 2008-09-18 - Add XQuery 1.1 count and outer-for support, simplified FLWOR -->
<!-- 2008-09-27 - Add validation type, nondeterministic function declarations, -->
<!-- initial values for external variables, try-catch expressions -->
<!-- 2008-11-14 - Add decimal formatting decl, encoding for version decl, -->
<!-- context item decl, computed namespace constructor -->
<!-- 2008-11-25 - Add support for fixes for validate expression, and change to allow -->
<!-- the count clause to only be an intermediate expression -->
<!-- 2009-01-13 - Bugs 6309 and 6310 (fixes to details of certain windowing clauses -->
<!-- 2009-03-03 - tumblingWindowClause syntax now matches slidingWindowClause syntax -->
<!-- 2009-09-06 - Modified errlist syntax per Bugzilla Bug 7053 -->
<!-- 2009-10-09 - Added support for private/public functions -->
<!-- Replace "outer for" with "allowing empty" -->
<!-- 2009-10-22 - Add support for higher-order functions & switch expression -->
<!-- 2010-01-06 - Omit parens when following-sibling of rootExpr is stepExpr -->
<!-- 2010-04-06 - Changed functionItemExpr child QName -> functionName (consistency) -->
<!-- 2010-06-23 - Added support for partial function application -->
<!-- 2011-05-04 - Updated structure of catch component of try-catch expression -->
<!-- 2011-05-04 - Updated validationexpr, mode/type alternatives, type is EQName -->
<!-- 2011-05-31 - Fixed functionItemExpr and functionCallExpr re: unqualified names -->
<!-- 2011-07-08 - Added support for concatenation operator || -->
<!-- 2011-09-09 - Added support for simple mapping operator ! -->
<!-- 2011-09-09 - Added support for sequenceTypeUnion in typeswitch -->
<!-- 2011-09-09 - Added support for annotations on inline functions -->
<!-- 2011-09-14 - Added support for new group-by syntax -->
<!-- 2011-11-21 - Jim changed "literalFunctionItemExpr" to "namedFunctionRef" -->
<!-- 2011-11-21 - Jim changed "inlineFunctionItemExpr" to "inlineFunctionExpr" -->
<!-- ================================================================================ -->
</span><xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xqx="http://www.w3.org/2005/XQueryX">
<!-- Note that this stylesheet frequently invokes templates for
specified elements, even when there are no templates in the
stylesheet whose match="" attribute identifies those elements.
In such case, the default template's element matching template
is invoked, which merely invokes xsl:apply-templates -->
<xsl:output method="text"/>
<xsl:strip-space elements="*"/>
<xsl:preserve-space elements="xqx:value xqx:attributeValue xqx:pragmaContents
xqx:optionContents xqx:xquery"/>
<xsl:variable name="DOT" select="'.'"/>
<xsl:variable name="SPACE" select="' '"/>
<xsl:variable name="SLASH" select="'/'"/>
<xsl:variable name="SLASH_SLASH" select="'//'"/>
<xsl:variable name="LESSTHAN" select="'&lt;'"/>
<xsl:variable name="GREATERTHAN" select="'&gt;'"/>
<xsl:variable name="LPAREN" select="'('"/>
<xsl:variable name="RPAREN" select="')'"/>
<xsl:variable name="NEWLINE"><xsl:text>
</xsl:text></xsl:variable>
<xsl:variable name="COMMA" select="','"/>
<xsl:variable name="COMMA_SPACE" select="', '"/>
<xsl:variable name="COMMA_NEWLINE"><xsl:text>,
</xsl:text></xsl:variable>
<xsl:variable name="QUOTE"><xsl:text>'</xsl:text></xsl:variable>
<xsl:variable name="DOUBLEQUOTE"><xsl:text>"</xsl:text></xsl:variable>
<xsl:variable name="TO" select="' to '"/>
<xsl:variable name="LBRACE" select="'{'"/>
<xsl:variable name="RBRACE" select="'}'"/>
<xsl:variable name="LBRACKET" select="'['"/>
<xsl:variable name="RBRACKET" select="']'"/>
<xsl:variable name="DOLLAR" select="'$'"/>
<xsl:variable name="MINUS" select="'-'"/>
<xsl:variable name="PLUS" select="'+'"/>
<xsl:variable name="EQUAL" select="'='"/>
<xsl:variable name="COLON" select="':'"/>
<xsl:variable name="DOUBLE_COLON" select="'::'"/>
<xsl:variable name="SEMICOLON" select="';'"/>
<xsl:variable name="AT" select="'@'"/>
<xsl:variable name="STAR" select="'*'"/>
<xsl:variable name="QUESTIONMARK" select="'?'"/>
<span> <xsl:variable name="EXCLAMATIONMARK" select="'!'"/>
<xsl:variable name="PERCENT" select="'%'"/>
</span> <xsl:variable name="ASSIGN" select="':='"/>
<xsl:variable name="SEPARATOR" select="';'"/>
<xsl:variable name="PRAGMA_BEGIN" select="'(# '"/>
<xsl:variable name="PRAGMA_END" select="' #)'"/>
<span> <xsl:variable name="CONCATENATE" select="'||'"/>
</span> <xsl:template name="delimitedList">
<xsl:param name="delimiter" />
<xsl:param name="leftEncloser"/>
<xsl:param name="rightEncloser" />
<xsl:param name="selector"/>
<xsl:value-of select="$leftEncloser"/>
<xsl:for-each select="*">
<xsl:apply-templates select="."/>
<xsl:if test="not (position()=last())">
<xsl:value-of select="$delimiter"/>
</xsl:if>
</xsl:for-each>
<xsl:value-of select="$rightEncloser"/>
</xsl:template>
<xsl:template name="parenthesizedList">
<xsl:param name="delimiter" select="$COMMA_SPACE"/>
<xsl:call-template name="delimitedList">
<xsl:with-param name="delimiter" select="$delimiter" />
<xsl:with-param name="leftEncloser" select="$LPAREN"/>
<xsl:with-param name="rightEncloser" select="$RPAREN"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="commaSeparatedList">
<xsl:call-template name="delimitedList">
<xsl:with-param name="delimiter">
<xsl:value-of select="$COMMA_SPACE"/>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<!-- To resolve Bugzilla bug #3446, we now escape CR (#xD), NEL (#x85),
and LINE SEPARATOR (#x2028) characters in text nodes and attribute values.
Note that this template is invoked for a number of other purposes (e.g.,
xqx:collation, xqx:namespaceDeclaration) where the presence of such
characters would be invalid and thus are highly unlikely to appear.
If they do, then this template will happily escape them, deferring the
error until the resulting XQuery expression is processed. -->
<xsl:template name="quote">
<xsl:param name="item"/>
<xsl:value-of select="$DOUBLEQUOTE"/>
<xsl:call-template name="globalReplace">
<xsl:with-param name="stringToBeFixed">
<xsl:call-template name="globalReplace">
<xsl:with-param name="stringToBeFixed">
<xsl:call-template name="globalReplace">
<xsl:with-param name="stringToBeFixed">
<xsl:call-template name="globalReplace">
<xsl:with-param name="stringToBeFixed">
<xsl:call-template name="globalReplace">
<xsl:with-param name="stringToBeFixed">
<xsl:call-template name="globalReplace">
<xsl:with-param name="stringToBeFixed">
<xsl:value-of select="$item"/>
</xsl:with-param>
<xsl:with-param name="toBeReplaced">&amp;</xsl:with-param>
<xsl:with-param name="replacement">&amp;amp;</xsl:with-param>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="toBeReplaced">&lt;</xsl:with-param>
<xsl:with-param name="replacement">&amp;lt;</xsl:with-param>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="toBeReplaced" select="'&#x85;'"/>
<xsl:with-param name="replacement">&amp;#x85;</xsl:with-param>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="toBeReplaced" select="'&#xD;'"/>
<xsl:with-param name="replacement">&amp;#xD;</xsl:with-param>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="toBeReplaced" select="'&#x2028;'"/>
<xsl:with-param name="replacement">&amp;#x2028;</xsl:with-param>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="toBeReplaced"><xsl:text>"</xsl:text></xsl:with-param>
<xsl:with-param name="replacement"><xsl:text>""</xsl:text></xsl:with-param>
</xsl:call-template>
<xsl:value-of select="$DOUBLEQUOTE"/>
</xsl:template>
<xsl:template name="globalReplace">
<xsl:param name="stringToBeFixed"/>
<xsl:param name="toBeReplaced"/>
<xsl:param name="replacement"/>
<xsl:choose>
<xsl:when test="contains($stringToBeFixed, $toBeReplaced)">
<xsl:value-of select="concat(substring-before($stringToBeFixed, $toBeReplaced), $replacement)"/>
<xsl:call-template name="globalReplace">
<xsl:with-param name="stringToBeFixed" select="substring-after($stringToBeFixed, $toBeReplaced)"/>
<xsl:with-param name="toBeReplaced" select="$toBeReplaced"/>
<xsl:with-param name="replacement" select="$replacement"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$stringToBeFixed"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<span> <xsl:template name="renderQName">
<xsl:if test="@xqx:prefix">
<xsl:value-of select="@xqx:prefix"/>
<xsl:value-of select="$COLON"/>
</xsl:if>
<xsl:value-of select="."/>
</xsl:template>
</span>
<span> <xsl:template name="renderEQName"
match="xqx:QName | xqx:pragmaName | xqx:typeName | xqx:varName |
xqx:functionName | xqx:optionName | xqx:annotationName |
xqx:atomicType | xqx:tagName | xqx:name | xqx:decimalFormatName">
<xsl:choose>
<xsl:when test="xqx:tagName/parent::xqx:elementConstructor">
<xsl:call-template name="renderQName"/>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="@xqx:prefix and @xqx:URI">
<xsl:message terminate="yes">Incorrect XQueryX: Elements of type xqx:EQName must not have both 'prefix' and 'URI' attributes</xsl:message>
</xsl:when>
<xsl:when test="@xqx:prefix">
<xsl:value-of select="@xqx:prefix"/>
<xsl:value-of select="$COLON"/>
<xsl:value-of select="."/>
</xsl:when>
<xsl:when test="@xqx:URI">
<xsl:value-of select="$DOUBLEQUOTE"/>
<xsl:value-of select="@xqx:URI"/>
<xsl:value-of select="$DOUBLEQUOTE"/>
<xsl:value-of select="$COLON"/>
<xsl:value-of select="."/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</span> <xsl:template match="xqx:attributeName">
<xsl:choose>
<xsl:when test="@xqx:prefix='xmlns'">
<xsl:message terminate="yes">Incorrect XQueryX: Attribute names are not permitted to have prefix 'xmlns'; use xqx:namespaceDeclaration to declare namespaces</xsl:message>
</xsl:when>
<span> <xsl:when test=". = 'xmlns'">
<xsl:message terminate="yes">Incorrect XQueryX: Attribute names are not permitted to be 'xmlns'; use xqx:namespaceDeclaration to declare namespaces</xsl:message>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="renderQName"/>
</xsl:otherwise>
</span> </xsl:choose>
</xsl:template>
<xsl:template match="xqx:NCName">
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="xqx:rootExpr">
<xsl:value-of select="$SLASH"/>
</xsl:template>
<span><!-- 2010-06-23 - Added support for partial function application -->
<xsl:template match="xqx:argumentPlaceholder">
<xsl:value-of select="$QUESTIONMARK"/>
</xsl:template>
<!-- To resolve Bugzilla bug #6733, we now treat a
rootExpr child of pathExpr distinctly from a
rootExpr that occurs in other contexts,
transforming it to "(/)" as proper
XQuery grammar. There is an additional consideration
on this: If the immediately following sibling of
rootExpr is a stepExpr, then the parens must be
omitted. -->
<xsl:template match="xqx:pathExpr/xqx:rootExpr">
<xsl:if test="not(following-sibling::xqx:stepExpr or following-sibling::xqx:mapStepExpr)">
<xsl:value-of select="$LPAREN"/>
</xsl:if>
<xsl:value-of select="$SPACE"/>
<xsl:value-of select="$SLASH"/>
<xsl:value-of select="$SPACE"/>
<xsl:if test="not(following-sibling::xqx:stepExpr or following-sibling::xqx:mapStepExpr)">
<xsl:value-of select="$RPAREN"/>
</xsl:if>
</xsl:template>
</span> <xsl:template match="xqx:contextItemExpr">
<xsl:value-of select="$DOT"/>
</xsl:template>
<xsl:template match="xqx:stringConstantExpr">
<xsl:call-template name="quote">
<xsl:with-param name="item" select="xqx:value"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="xqx:integerConstantExpr |
xqx:decimalConstantExpr |
xqx:doubleConstantExpr">
<xsl:value-of select="xqx:value"/>
</xsl:template>
<xsl:template match="xqx:varRef">
<xsl:value-of select="$DOLLAR"/>
<span> <xsl:apply-templates select="xqx:name"/>
</span> </xsl:template>
<xsl:template match="xqx:pragma">
<xsl:value-of select="$PRAGMA_BEGIN"/>
<xsl:apply-templates select="xqx:pragmaName"/>
<xsl:value-of select="$SPACE"/>
<xsl:value-of select="xqx:pragmaContents"/>
<xsl:value-of select="$PRAGMA_END"/>
</xsl:template>
<xsl:template match="xqx:extensionExpr">
<xsl:apply-templates select="xqx:pragma"/>
<xsl:value-of select="$LBRACE"/>
<xsl:apply-templates select="xqx:argExpr"/>
<xsl:value-of select="$RBRACE"/>
</xsl:template>
<!-- Response to Bugzilla bug #2528 -->
<!-- Response to Bugzilla bug #12788 -->
<xsl:template match="xqx:functionCallExpr">
<span> <xsl:if test="(xqx:functionName = 'node' or
xqx:functionName = 'document-node' or
xqx:functionName = 'element' or
xqx:functionName = 'attribute' or
xqx:functionName = 'schema-element' or
xqx:functionName = 'schema-attribute' or
xqx:functionName = 'processing-instruction' or
xqx:functionName = 'comment' or
xqx:functionName = 'text' or
xqx:functionName = 'function' or
xqx:functionName = 'namespace-node' or
xqx:functionName = 'item' or
xqx:functionName = 'if' or
xqx:functionName = 'switch' or
xqx:functionName = 'typeswitch' or
xqx:functionName = 'empty-sequence') and
((not(xqx:functionName/@xqx:prefix) and not(xqx:functionName/@xqx:URI)) or
xqx:functionName/@xqx:prefix = '' or
xqx:functionName/@xqx:URI = '')">
<xsl:variable name="message"><xsl:text>Incorrect XQueryX: function calls must not use unqualified "reserved" name "</xsl:text><xsl:value-of select="xqx:functionName"/><xsl:text>"</xsl:text></xsl:variable>
<xsl:message terminate="yes"><xsl:value-of select="$message"/></xsl:message>
</xsl:if>
<xsl:apply-templates select="xqx:functionName"/>
</span> <xsl:choose>
<xsl:when test="xqx:arguments">
<xsl:for-each select="xqx:arguments">
<xsl:call-template name="parenthesizedList"/>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$LPAREN"/>
<xsl:value-of select="$RPAREN"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="xqx:constructorFunctionExpr">
<xsl:apply-templates select="xqx:typeName"/>
<xsl:for-each select="xqx:argExpr">
<xsl:call-template name="parenthesizedList"/>
</xsl:for-each>
</xsl:template>
<xsl:template match="xqx:unaryMinusOp | xqx:unaryPlusOp">
<xsl:value-of select="$LPAREN"/>
<xsl:choose>
<xsl:when test="self::xqx:unaryPlusOp"><xsl:value-of select="$PLUS"/></xsl:when>
<xsl:when test="self::xqx:unaryMinusOp"><xsl:value-of select="$MINUS"/></xsl:when>
</xsl:choose>
<xsl:apply-templates select="xqx:operand"/>
<xsl:value-of select="$RPAREN"/>
</xsl:template>
<xsl:template match="xqx:addOp | xqx:subtractOp | xqx:multiplyOp
| xqx:divOp | xqx:idivOp | xqx:modOp">
<xsl:value-of select="$LPAREN"/>
<xsl:apply-templates select="xqx:firstOperand"/>
<xsl:choose>
<xsl:when test="self::xqx:addOp"><xsl:value-of select="$PLUS"/></xsl:when>
<xsl:when test="self::xqx:subtractOp"><xsl:text> </xsl:text><xsl:value-of select="$MINUS"/><xsl:text> </xsl:text></xsl:when>
<xsl:when test="self::xqx:multiplyOp"><xsl:value-of select="$STAR"/></xsl:when>
<xsl:when test="self::xqx:divOp"><xsl:text> div </xsl:text></xsl:when>
<xsl:when test="self::xqx:idivOp"><xsl:text> idiv </xsl:text></xsl:when>
<xsl:when test="self::xqx:modOp"><xsl:text> mod </xsl:text></xsl:when>
</xsl:choose>
<xsl:apply-templates select="xqx:secondOperand"/>
<xsl:value-of select="$RPAREN"/>
</xsl:template>
<span> <xsl:template match="xqx:stringConcatenateOp">
<xsl:value-of select="$LPAREN"/>
<xsl:apply-templates select="xqx:firstOperand"/>
<xsl:value-of select="$CONCATENATE"/>
<xsl:apply-templates select="xqx:secondOperand"/>
<xsl:value-of select="$RPAREN"/>
</xsl:template>
</span> <xsl:template match="xqx:eqOp | xqx:neOp | xqx:ltOp
| xqx:gtOp | xqx:leOp | xqx:geOp">
<xsl:value-of select="$LPAREN"/>
<xsl:apply-templates select="xqx:firstOperand"/>
<xsl:choose>
<xsl:when test="self::xqx:eqOp"><xsl:text> eq </xsl:text></xsl:when>
<xsl:when test="self::xqx:neOp"><xsl:text> ne </xsl:text></xsl:when>
<xsl:when test="self::xqx:ltOp"><xsl:text> lt </xsl:text></xsl:when>
<xsl:when test="self::xqx:gtOp"><xsl:text> gt </xsl:text></xsl:when>
<xsl:when test="self::xqx:leOp"><xsl:text> le </xsl:text></xsl:when>
<xsl:when test="self::xqx:geOp"><xsl:text> ge </xsl:text></xsl:when>
</xsl:choose>
<xsl:apply-templates select="xqx:secondOperand"/>
<xsl:value-of select="$RPAREN"/>
</xsl:template>
<xsl:template match="xqx:equalOp | xqx:notEqualOp | xqx:lessThanOp
| xqx:greaterThanOp | xqx:lessThanOrEqualOp | xqx:greaterThanOrEqualOp">
<xsl:value-of select="$LPAREN"/>
<xsl:apply-templates select="xqx:firstOperand"/>
<xsl:choose>
<xsl:when test="self::xqx:equalOp">
<xsl:text> </xsl:text><xsl:value-of select="$EQUAL"/><xsl:text> </xsl:text>
</xsl:when>
<xsl:when test="self::xqx:notEqualOp">
<xsl:text> !</xsl:text><xsl:value-of select="$EQUAL"/><xsl:text> </xsl:text>
</xsl:when>
<xsl:when test="self::xqx:lessThanOp">
<xsl:text> </xsl:text><xsl:value-of select="$LESSTHAN"/><xsl:text> </xsl:text>
</xsl:when>
<xsl:when test="self::xqx:greaterThanOp">
<xsl:text> </xsl:text><xsl:value-of select="$GREATERTHAN"/><xsl:text> </xsl:text>
</xsl:when>
<xsl:when test="self::xqx:lessThanOrEqualOp">
<xsl:text> </xsl:text><xsl:value-of select="$LESSTHAN"/>
<xsl:value-of select="$EQUAL"/><xsl:text> </xsl:text>
</xsl:when>
<xsl:when test="self::xqx:greaterThanOrEqualOp">
<xsl:text> </xsl:text><xsl:value-of select="$GREATERTHAN"/>
<xsl:value-of select="$EQUAL"/><xsl:text> </xsl:text>
</xsl:when>
</xsl:choose>
<xsl:apply-templates select="xqx:secondOperand"/>
<xsl:value-of select="$RPAREN"/>
</xsl:template>
<xsl:template match="xqx:isOp | xqx:nodeBeforeOp | xqx:nodeAfterOp">
<xsl:value-of select="$LPAREN"/>
<xsl:apply-templates select="xqx:firstOperand"/>
<xsl:choose>
<xsl:when test="self::xqx:isOp"><xsl:text> is </xsl:text></xsl:when>
<xsl:when test="self::xqx:nodeBeforeOp"><xsl:text> </xsl:text>
<xsl:value-of select="$LESSTHAN"/><xsl:value-of select="$LESSTHAN"/>
<xsl:text> </xsl:text></xsl:when>
<xsl:when test="self::xqx:nodeAfterOp"><xsl:text> </xsl:text>
<xsl:value-of select="$GREATERTHAN"/><xsl:value-of select="$GREATERTHAN"/>
<xsl:text> </xsl:text></xsl:when>
</xsl:choose>
<xsl:apply-templates select="xqx:secondOperand"/>
<xsl:value-of select="$RPAREN"/>
</xsl:template>
<xsl:template match="xqx:andOp | xqx:orOp">
<xsl:value-of select="$LPAREN"/>
<xsl:apply-templates select="xqx:firstOperand"/>
<xsl:choose>
<xsl:when test="self::xqx:andOp"><xsl:text> and </xsl:text></xsl:when>
<xsl:when test="self::xqx:orOp"><xsl:text> or </xsl:text></xsl:when>
</xsl:choose>
<xsl:apply-templates select="xqx:secondOperand"/>
<xsl:value-of select="$RPAREN"/>
</xsl:template>
<xsl:template match="xqx:unionOp | xqx:intersectOp | xqx:exceptOp">
<xsl:value-of select="$LPAREN"/>
<xsl:apply-templates select="xqx:firstOperand"/>
<xsl:choose>
<xsl:when test="self::xqx:unionOp"><xsl:text> union </xsl:text></xsl:when>
<xsl:when test="self::xqx:intersectOp"><xsl:text> intersect </xsl:text></xsl:when>
<xsl:when test="self::xqx:exceptOp"><xsl:text> except </xsl:text></xsl:when>
</xsl:choose>
<xsl:apply-templates select="xqx:secondOperand"/>
<xsl:value-of select="$RPAREN"/>
</xsl:template>
<xsl:template match="xqx:sequenceExpr">
<xsl:for-each select=".">
<xsl:call-template name="parenthesizedList">
<xsl:with-param name="delimiter" select="$COMMA_NEWLINE"/>
</xsl:call-template>
</xsl:for-each>
</xsl:template>
<xsl:template match="xqx:rangeSequenceExpr">
<xsl:value-of select="$LPAREN"/>
<xsl:apply-templates select="xqx:startExpr"/>
<xsl:value-of select="$TO"/>
<xsl:apply-templates select="xqx:endExpr"/>
<xsl:value-of select="$RPAREN"/>
</xsl:template>
<xsl:template match="xqx:forClause">
<xsl:text> for </xsl:text>
<xsl:call-template name="commaSeparatedList"/>
<xsl:value-of select="$NEWLINE"/>
</xsl:template>
<xsl:template match="xqx:forClauseItem">
<xsl:apply-templates/>
</xsl:template>
<span> <xsl:template match="xqx:allowingEmpty">
<xsl:text> allowing empty </xsl:text>
</xsl:template>
</span> <xsl:template match="xqx:forExpr">
<xsl:value-of select="$NEWLINE"/>
<xsl:text> in </xsl:text>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="xqx:letClause">
<xsl:text> let </xsl:text>
<xsl:call-template name="commaSeparatedList"/>
<xsl:value-of select="$NEWLINE"/>
</xsl:template>
<xsl:template match="xqx:letClauseItem">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="xqx:letExpr">
<xsl:value-of select="$SPACE"/>
<xsl:value-of select="$ASSIGN"/>
<xsl:value-of select="$SPACE"/>
<xsl:apply-templates/>
</xsl:template>
<span> <xsl:template match="xqx:windowClause">
<xsl:text> for </xsl:text>
<xsl:apply-templates/>
<xsl:value-of select="$NEWLINE"/>
</xsl:template>
<xsl:template match="xqx:tumblingWindowClause">
<xsl:text> tumbling window </xsl:text>
<xsl:apply-templates select="xqx:typedVariableBinding"/>
<xsl:text> in </xsl:text>
<xsl:apply-templates select="xqx:bindingSequence"/>
<xsl:value-of select="$NEWLINE"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="xqx:windowStartCondition"/>
<xsl:value-of select="$NEWLINE"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="xqx:windowEndCondition"/>
</xsl:template>
<xsl:template match="xqx:slidingWindowClause">
<xsl:text> sliding window </xsl:text>
<xsl:apply-templates select="xqx:typedVariableBinding"/>
<xsl:text> in </xsl:text>
<xsl:apply-templates select="xqx:bindingSequence"/>
<xsl:value-of select="$NEWLINE"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="xqx:windowStartCondition"/>
<xsl:value-of select="$NEWLINE"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="xqx:windowEndCondition"/>
</xsl:template>
<xsl:template match="xqx:bindingSequence">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="xqx:windowStartCondition">
<xsl:text>start </xsl:text>
<xsl:apply-templates select="xqx:windowVars"/>
<xsl:text> when </xsl:text>
<xsl:apply-templates select="xqx:winStartExpr"/>
</xsl:template>
<xsl:template match="xqx:windowEndCondition">
<xsl:if test="@onlyEnd='true'">
<xsl:text>only </xsl:text>
</xsl:if>
<xsl:text>end </xsl:text>
<xsl:apply-templates select="xqx:windowVars"/>
<xsl:text> when </xsl:text>
<xsl:apply-templates select="xqx:winEndExpr"/>
</xsl:template>
<xsl:template match="xqx:windowVars">
<xsl:apply-templates select="xqx:currentItem"/>
<xsl:apply-templates select="xqx:positionalVariableBinding"/>
<xsl:apply-templates select="xqx:previousItem"/>
<xsl:apply-templates select="xqx:nextItem"/>
</xsl:template>
<xsl:template match="xqx:currentItem">
<xsl:value-of select="$DOLLAR"/>
<xsl:call-template name="renderEQName"/>
</xsl:template>
<xsl:template match="xqx:previousItem">
<xsl:text> previous </xsl:text>
<xsl:value-of select="$DOLLAR"/>
<xsl:call-template name="renderEQName"/>
</xsl:template>
<xsl:template match="xqx:nextItem">
<xsl:text> next </xsl:text>
<xsl:value-of select="$DOLLAR"/>
<xsl:call-template name="renderEQName"/>
</xsl:template>
<xsl:template match="xqx:countClause">
<xsl:text> count </xsl:text>
<xsl:apply-templates/>
<xsl:value-of select="$NEWLINE"/>
</xsl:template>
</span> <xsl:template match="xqx:whereClause">
<xsl:text> where </xsl:text>
<xsl:apply-templates select="*"/>
<xsl:value-of select="$NEWLINE"/>
</xsl:template>
<span> <xsl:template match="xqx:groupByClause">
<xsl:text> group by </xsl:text>
<xsl:call-template name="commaSeparatedList"/>
<xsl:value-of select="$NEWLINE"/>
</xsl:template>
<xsl:template match="xqx:groupingSpec">
<xsl:value-of select="$DOLLAR"/>
<xsl:apply-templates/>
</xsl:template>
<!-- 2011-09-14/JM - added the ability to initialize a grouping variable, opt set type -->
<xsl:template match="xqx:groupVarInitialize">
<xsl:if test="xqx:typeDeclaration">
<xsl:apply-templates select="xqx:typeDeclaration"/>
</xsl:if>
<xsl:value-of select="$SPACE"/>
<xsl:value-of select="$ASSIGN"/>
<xsl:value-of select="$SPACE"/>
<xsl:apply-templates select="xqx:varValue"/>
</xsl:template>
</span> <xsl:template match="xqx:collation">
<xsl:text> collation </xsl:text>
<xsl:call-template name="quote">
<xsl:with-param name="item">
<xsl:value-of select="."/>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template match="xqx:emptyOrderingMode">
<xsl:value-of select="$SPACE"/>
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="xqx:orderingKind">
<xsl:value-of select="$SPACE"/>
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="xqx:orderModifier">
<xsl:apply-templates select="*"/>
</xsl:template>
<xsl:template match="xqx:orderBySpec">
<xsl:apply-templates select="xqx:orderByExpr"/>
<xsl:value-of select="$SPACE"/>
<xsl:apply-templates select="xqx:orderModifier"/>
</xsl:template>
<xsl:template match="xqx:orderByClause">
<xsl:if test="xqx:stable">
<xsl:text> stable</xsl:text>
</xsl:if>
<xsl:text> order by </xsl:text>
<xsl:apply-templates select="xqx:orderBySpec[1]"/>
<xsl:for-each select="xqx:orderBySpec[position() > 1]">
<xsl:value-of select="$COMMA_SPACE"/>
<xsl:apply-templates select="."/>
</xsl:for-each>
<xsl:value-of select="$NEWLINE"/>
</xsl:template>
<xsl:template match="xqx:returnClause">
<xsl:text> return </xsl:text>
<xsl:apply-templates select="*"/>
<xsl:value-of select="$NEWLINE"/>
</xsl:template>
<!-- Surrounding FLWOR expressions with parentheses completes the set -->
<xsl:template match="xqx:flworExpr">
<xsl:value-of select="$NEWLINE"/>
<xsl:value-of select="$LPAREN"/>
<xsl:apply-templates select="*"/>
<xsl:value-of select="$RPAREN"/>
</xsl:template>
<xsl:template match="xqx:ifThenElseExpr">
<xsl:value-of select="$LPAREN"/>
<xsl:text> if </xsl:text>
<xsl:value-of select="$LPAREN"/>
<xsl:apply-templates select="xqx:ifClause"/>
<xsl:value-of select="$RPAREN"/>
<xsl:text> then </xsl:text>
<xsl:apply-templates select="xqx:thenClause"/>
<xsl:text> else </xsl:text>
<xsl:apply-templates select="xqx:elseClause"/>
<xsl:value-of select="$RPAREN"/>
</xsl:template>
<xsl:template match="xqx:positionalVariableBinding">
<xsl:text> at </xsl:text>
<xsl:value-of select="$DOLLAR"/>
<span> <xsl:call-template name="renderQName"/>
</span> </xsl:template>
<xsl:template match="xqx:variableBinding">
<xsl:value-of select="$DOLLAR"/>
<span> <xsl:call-template name="renderEQName"/>
</span> <xsl:if test="parent::xqx:typeswitchExprCaseClause">
<xsl:text> as </xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="xqx:typedVariableBinding" name="typedVariableBinding">
<xsl:value-of select="$DOLLAR"/>
<xsl:apply-templates select="xqx:varName"/>
<xsl:apply-templates select="xqx:typeDeclaration"/>
</xsl:template>
<xsl:template match="xqx:quantifiedExprInClause">
<xsl:apply-templates select="xqx:typedVariableBinding"/>
<xsl:text> in </xsl:text>
<xsl:apply-templates select="xqx:sourceExpr"/>
</xsl:template>
<xsl:template match="xqx:quantifiedExpr">
<xsl:value-of select="$LPAREN"/>
<xsl:value-of select="xqx:quantifier"/>
<xsl:value-of select="$SPACE"/>
<xsl:apply-templates select="xqx:quantifiedExprInClause[1]"/>
<xsl:for-each select="xqx:quantifiedExprInClause[position() > 1]">
<xsl:value-of select="$COMMA_SPACE"/>
<xsl:apply-templates select="."/>
</xsl:for-each>
<xsl:text> satisfies </xsl:text>
<xsl:apply-templates select="xqx:predicateExpr"/>
<xsl:value-of select="$RPAREN"/>
</xsl:template>
<xsl:template match="xqx:instanceOfExpr">
<xsl:value-of select="$LPAREN"/>
<xsl:apply-templates select="xqx:argExpr"/>
<xsl:text> instance of </xsl:text>
<xsl:apply-templates select="xqx:sequenceType"/>
<xsl:value-of select="$RPAREN"/>
</xsl:template>
<xsl:template match="xqx:castExpr">
<xsl:value-of select="$LPAREN"/>
<xsl:apply-templates select="xqx:argExpr"/>
<xsl:text> cast as </xsl:text>
<xsl:apply-templates select="xqx:singleType"/>
<xsl:value-of select="$RPAREN"/>
</xsl:template>
<xsl:template match="xqx:castableExpr">
<xsl:value-of select="$LPAREN"/>
<xsl:apply-templates select="xqx:argExpr"/>
<xsl:text> castable as </xsl:text>
<xsl:apply-templates select="xqx:singleType"/>
<xsl:value-of select="$RPAREN"/>
</xsl:template>
<xsl:template match="xqx:treatExpr">
<xsl:value-of select="$LPAREN"/>
<xsl:apply-templates select="xqx:argExpr"/>
<xsl:text> treat as </xsl:text>
<xsl:apply-templates select="xqx:sequenceType"/>
<xsl:value-of select="$RPAREN"/>
</xsl:template>
<span> <xsl:template match="xqx:switchExprCaseClause">
<xsl:for-each select="xqx:switchCaseExpr">
<xsl:value-of select="$NEWLINE"/>
<xsl:text> case (</xsl:text>
<xsl:apply-templates select="."/>
<xsl:text>) </xsl:text>
</xsl:for-each>
<xsl:value-of select="$NEWLINE"/>
<xsl:text> return </xsl:text>
<xsl:apply-templates select="xqx:resultExpr"/>
</xsl:template>
<xsl:template match="xqx:switchExprDefaultClause">
<xsl:value-of select="$NEWLINE"/>
<xsl:text> default return </xsl:text>
<xsl:apply-templates select="xqx:resultExpr"/>
</xsl:template>
<xsl:template match="xqx:switchExpr">
<xsl:value-of select="$LPAREN"/>
<xsl:text>switch</xsl:text>
<xsl:value-of select="$LPAREN"/>
<xsl:apply-templates select="xqx:argExpr"/>
<xsl:value-of select="$RPAREN"/>
<xsl:apply-templates select="xqx:switchExprCaseClause"/>
<xsl:apply-templates select="xqx:switchExprDefaultClause"/>
<xsl:value-of select="$RPAREN"/>
</xsl:template>
</span><!-- 2011-09-09/JM - augmented sequenceType with sequenceTypeUnion -->
<xsl:template match="xqx:typeswitchExprCaseClause">
<xsl:text> case </xsl:text>
<xsl:apply-templates select="xqx:variableBinding"/>
<span> <xsl:apply-templates select="xqx:sequenceType | xqx:sequenceTypeUnion"/>
</span> <xsl:text> return </xsl:text>
<xsl:apply-templates select="xqx:resultExpr"/>
</xsl:template>
<xsl:template match="xqx:typeswitchExprDefaultClause">
<xsl:text> default </xsl:text>
<xsl:apply-templates select="xqx:variableBinding"/>
<xsl:text> return </xsl:text>
<xsl:apply-templates select="xqx:resultExpr"/>
</xsl:template>
<xsl:template match="xqx:typeswitchExpr">
<xsl:value-of select="$LPAREN"/>
<xsl:text>typeswitch</xsl:text>
<xsl:value-of select="$LPAREN"/>
<xsl:apply-templates select="xqx:argExpr"/>
<xsl:value-of select="$RPAREN"/>
<xsl:apply-templates select="xqx:typeswitchExprCaseClause"/>
<xsl:apply-templates select="xqx:typeswitchExprDefaultClause"/>
<xsl:value-of select="$RPAREN"/>
</xsl:template>
<span> <xsl:template match="xqx:tryCatchExpr">
<xsl:value-of select="$NEWLINE"/>
<xsl:text>try </xsl:text>
<xsl:apply-templates select="xqx:tryClause"/>
<xsl:apply-templates select="xqx:catchClause"/>
</xsl:template>
<xsl:template match="xqx:tryClause">
<xsl:value-of select="$LBRACE"/>
<xsl:value-of select="$SPACE"/>
<xsl:apply-templates/>
<xsl:value-of select="$SPACE"/>
<xsl:value-of select="$RBRACE"/>
</xsl:template>
<xsl:template match="xqx:catchClause">
<xsl:value-of select="$NEWLINE"/>
<xsl:text> catch </xsl:text>
<xsl:apply-templates select="xqx:catchErrorList"/>
<xsl:apply-templates select="xqx:catchExpr"/>
</xsl:template>
<xsl:template match="xqx:catchErrorList">
<xsl:for-each select="xqx:nameTest | xqx:Wildcard">
<xsl:if test="(position() mod 5) = 0">
<xsl:value-of select="$NEWLINE"/>
<xsl:text> </xsl:text>
</xsl:if>
<xsl:if test="position() > 1">
<xsl:text>| </xsl:text>
</xsl:if>
<xsl:apply-templates select="."/>
<xsl:value-of select="$SPACE"/>
</xsl:for-each>
</xsl:template>
<xsl:template match="xqx:catchExpr">
<xsl:value-of select="$NEWLINE"/>
<xsl:value-of select="$LBRACE"/>
<xsl:value-of select="$SPACE"/>
<xsl:apply-templates/>
<xsl:value-of select="$SPACE"/>
<xsl:value-of select="$RBRACE"/>
</xsl:template>
</span> <xsl:template match="xqx:validateExpr">
<xsl:value-of select="$LPAREN"/>
<xsl:text> validate </xsl:text>
<span> <xsl:if test="xqx:validationMode">
<xsl:value-of select="xqx:validationMode"/>
<xsl:value-of select="$SPACE"/>
</xsl:if>
<xsl:if test="xqx:sequenceType">
<xsl:text>type </xsl:text>
<xsl:apply-templates select="xqx:typeName"/>
<xsl:value-of select="$SPACE"/>
</xsl:if>
<xsl:value-of select="$LBRACE"/>
<xsl:apply-templates select="xqx:argExpr"/>
<xsl:value-of select="$SPACE"/>
<xsl:value-of select="$RBRACE"/>
<xsl:value-of select="$SPACE"/>
</span> <xsl:value-of select="$RPAREN"/>
</xsl:template>
<xsl:template match="xqx:xpathAxis">
<xsl:value-of select="."/>
<xsl:value-of select="$DOUBLE_COLON"/>
</xsl:template>
<xsl:template match="xqx:predicates">
<xsl:for-each select="*">
<xsl:value-of select="$LBRACKET"/>
<xsl:apply-templates select="."/>
<xsl:value-of select="$RBRACKET"/>
</xsl:for-each>
</xsl:template>
<span> <!-- part of higher-order functions -->
<xsl:template match="xqx:dynamicFunctionInvocationExpr">
<xsl:apply-templates select="xqx:functionItem"/>
<xsl:apply-templates select="xqx:predicates"/>
<xsl:choose>
<xsl:when test="xqx:arguments">
<xsl:for-each select="xqx:arguments">
<xsl:call-template name="parenthesizedList"/>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$LPAREN"/>
<xsl:value-of select="$RPAREN"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- part of higher-order functions -->
<xsl:template match="xqx:functionItem">
<xsl:apply-templates/>
</xsl:template>
</span> <xsl:template match="xqx:star">
<xsl:value-of select="$STAR"/>
</xsl:template>
<xsl:template match="xqx:Wildcard[*]">
<span> <xsl:choose>
<xsl:when test="local-name(./child::*[1])='star'">
<xsl:apply-templates select="xqx:star"/>
<xsl:value-of select="$COLON"/>
<xsl:apply-templates select="xqx:NCName"/>
</xsl:when>
<xsl:when test="local-name(./child::*[1])='NCName'">
<xsl:apply-templates select="xqx:NCName"/>
<xsl:value-of select="$COLON"/>
<xsl:apply-templates select="xqx:star"/>
</xsl:when>
<xsl:when test="local-name(./child::*[1])='uri'">
<xsl:call-template name="quote">
<xsl:with-param name="item" select="xqx:uri"/>
</xsl:call-template>
<xsl:value-of select="$COLON"/>
<xsl:apply-templates select="xqx:star"/>
</xsl:when>
</xsl:choose>
</span> </xsl:template>
<xsl:template match="xqx:Wildcard[not(*)]">
<xsl:value-of select="$STAR"/>
</xsl:template>
<!-- select="xqx:EQname" fixed to be select="xqx"QName"; bug 12674 -->
<xsl:template name="simpleWildcard" match="xqx:simpleWildcard">
<xsl:apply-templates select="xqx:star"/>
<xsl:apply-templates select="xqx:QName"/>
</xsl:template>
<xsl:template match="xqx:textTest">
<xsl:text>text()</xsl:text>
</xsl:template>
<xsl:template match="xqx:commentTest">
<xsl:text>comment()</xsl:text>
</xsl:template>
<span> <xsl:template match="xqx:namespaceTest">
<xsl:text>namespace-node()</xsl:text>
</xsl:template>
</span> <xsl:template match="xqx:anyKindTest">
<xsl:text>node()</xsl:text>
</xsl:template>
<xsl:template match="xqx:piTest">
<xsl:text>processing-instruction</xsl:text>
<xsl:value-of select="$LPAREN"/>
<xsl:value-of select="*"/>
<xsl:value-of select="$RPAREN"/>
</xsl:template>
<xsl:template match="xqx:documentTest">
<xsl:text>document-node</xsl:text>
<xsl:value-of select="$LPAREN"/>
<xsl:apply-templates select="*"/>
<xsl:value-of select="$RPAREN"/>
</xsl:template>
<!-- // THIS IS WRONG!! A nameText is a QName *OR* a Wildcard!!! -->
<xsl:template match="xqx:nameTest">
<span> <xsl:call-template name="renderEQName"/>
</span> </xsl:template>
<xsl:template match="xqx:attributeTest">
<xsl:text>attribute</xsl:text>
<xsl:value-of select="$LPAREN"/>
<xsl:for-each select="xqx:attributeName">
<xsl:call-template name="simpleWildcard"/>
</xsl:for-each>
<xsl:if test="xqx:typeName">
<xsl:value-of select="$COMMA"/>
<xsl:apply-templates select="xqx:typeName"/>
</xsl:if>
<xsl:value-of select="$RPAREN"/>
</xsl:template>
<xsl:template match="xqx:elementTest">
<xsl:text>element</xsl:text>
<xsl:value-of select="$LPAREN"/>
<xsl:for-each select="xqx:elementName">
<xsl:call-template name="simpleWildcard"/>
</xsl:for-each>
<xsl:if test="xqx:typeName">
<xsl:value-of select="$COMMA"/>
<xsl:apply-templates select="xqx:typeName"/>
</xsl:if>
<xsl:if test="xqx:nillable">
<xsl:value-of select="$QUESTIONMARK"/>
</xsl:if>
<xsl:value-of select="$RPAREN"/>
</xsl:template>
<xsl:template match="xqx:schemaElementTest">
<xsl:text>schema-element</xsl:text>
<xsl:value-of select="$LPAREN"/>
<span> <xsl:call-template name="renderEQName"/>
</span> <xsl:value-of select="$RPAREN"/>
</xsl:template>
<xsl:template match="xqx:schemaAttributeTest">
<xsl:text>schema-attribute</xsl:text>
<xsl:value-of select="$LPAREN"/>
<span> <xsl:call-template name="renderEQName"/>
</span> <xsl:value-of select="$RPAREN"/>
</xsl:template>
<span> <!-- anyFunctionTest, part of higher-order functions -->
<xsl:template match="xqx:anyFunctionTest">
<xsl:text> function(*)</xsl:text>
</xsl:template>
<!-- typedFunctionTest, part of higher-order functions -->
<xsl:template match="xqx:typedFunctionTest">
<xsl:text> function</xsl:text>
<xsl:apply-templates select="xqx:paramTypeList"/>
<xsl:text> as </xsl:text>
<xsl:apply-templates select="xqx:sequenceType"/>
</xsl:template>
<xsl:template match="xqx:paramTypeList">
<xsl:call-template name="parenthesizedList"/>
</xsl:template>
<!-- parenthesizedItemType, part of higher-order functions -->
<xsl:template match="xqx:parenthesizedItemType">
<xsl:text> ( </xsl:text>
<xsl:apply-templates/>
<xsl:text> ) </xsl:text>
</xsl:template>
</span> <!-- rewrote test expression per Bugzilla Bug #2523 -->
<!-- 2011-09-09/JM - Added mapStepExpr -->
<xsl:template match="xqx:stepExpr">
<span> <xsl:if test="preceding-sibling::xqx:stepExpr or preceding-sibling::xqx:mapStepExpr">
</span> <xsl:value-of select="$SLASH"/>
</xsl:if>
<xsl:apply-templates select="*"/>
</xsl:template>
<span> <!-- 2011-09-09/JM - Added mapStepExpr -->
<xsl:template match="xqx:mapStepExpr">
<xsl:if test="preceding-sibling::xqx:stepExpr or preceding-sibling::xqx:mapStepExpr">
<xsl:value-of select="$EXCLAMATIONMARK"/>
</xsl:if>
<xsl:apply-templates select="*"/>
</xsl:template>
</span> <!-- deleted xqx:parenthesizedExpr per Bugzilla Bug #4963 -->
<xsl:template match="xqx:filterExpr">
<xsl:apply-templates/>
</xsl:template>
<span> <!-- part of higher-order functions -->
<!-- Response to Bugzilla bug #12788 -->
<!-- 2011-11-21 - Jim changed "literalFunctionItemExpr" to "namedFunctionRef" -->
<xsl:template match="xqx:namedFunctionRef">
<xsl:if test="(xqx:functionName = 'node' or
xqx:functionName = 'document-node' or
xqx:functionName = 'element' or
xqx:functionName = 'attribute' or
xqx:functionName = 'schema-element' or
xqx:functionName = 'schema-attribute' or
xqx:functionName = 'processing-instruction' or
xqx:functionName = 'comment' or
xqx:functionName = 'text' or
xqx:functionName = 'function' or
xqx:functionName = 'namespace-node' or
xqx:functionName = 'item' or
xqx:functionName = 'if' or
xqx:functionName = 'switch' or
xqx:functionName = 'typeswitch' or
xqx:functionName = 'empty-sequence') and
((not(@xqx:prefix) and not(@xqx:URI)) or
(@xqx:prefix and @xqx:prefix = '') or
(@xqx:URI and @xqx:URI = ''))">
<xsl:variable name="message"><xsl:text>Incorrect XQueryX: function calls must not use unqualified "reserved" name "</xsl:text><xsl:value-of select="xqx:functionName"/><xsl:text>"</xsl:text></xsl:variable>
<xsl:message terminate="yes"><xsl:value-of select="$message"/></xsl:message>
</xsl:if>
<xsl:apply-templates select="xqx:functionName"/>
<xsl:text>#</xsl:text>
<xsl:apply-templates select="xqx:integerConstantExpr"/>
</xsl:template>
<!-- part of higher-order functions -->
<!-- 2011-09-09/JM - Added annotations to inline functions -->
<!-- 2011-11-21 - Jim changed "inlineFunctionItemExpr" to "inlineFunctionExpr" -->
<xsl:template match="xqx:inlineFunctionExpr">
<xsl:apply-templates select="xqx:annotation"/>
<xsl:text> function </xsl:text>
<xsl:apply-templates select="xqx:paramList"/>
<xsl:apply-templates select="xqx:typeDeclaration"/>
<xsl:apply-templates select="xqx:functionBody"/>
</xsl:template>
</span> <!-- rewrote pathExpr template per Bugzilla Bug #2523 -->
<!-- 2011-09-09/JM - Added mapStepExpr as an alternative -->
<xsl:template match="xqx:pathExpr">
<span> <xsl:apply-templates select="xqx:rootExpr | xqx:stepExpr | xqx:mapStepExpr"/>
</span> </xsl:template>
<!-- To resolve Bugzilla bug #3446, we now escape NL (#xA) and TAB (#x9)
characters in attribute values -->
<xsl:template match="xqx:attributeConstructor">
<xsl:value-of select="$SPACE"/>
<xsl:apply-templates select="xqx:attributeName"/>
<xsl:value-of select="$EQUAL"/>
<xsl:choose>
<xsl:when test="xqx:attributeValue">
<xsl:call-template name="globalReplace">
<xsl:with-param name="stringToBeFixed">
<xsl:call-template name="globalReplace">
<xsl:with-param name="stringToBeFixed">
<xsl:call-template name="quote">
<xsl:with-param name="item">
<xsl:call-template name="globalReplace">
<xsl:with-param name="stringToBeFixed">
<xsl:call-template name="globalReplace">
<xsl:with-param name="stringToBeFixed">
<xsl:value-of select="xqx:attributeValue"/>
</xsl:with-param>
<xsl:with-param name="toBeReplaced"><xsl:text>{</xsl:text></xsl:with-param>
<xsl:with-param name="replacement"><xsl:text>{{</xsl:text></xsl:with-param>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="toBeReplaced"><xsl:text>}</xsl:text></xsl:with-param>
<xsl:with-param name="replacement"><xsl:text>}}</xsl:text></xsl:with-param>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="toBeReplaced" select="'&#xA;'"/>
<xsl:with-param name="replacement">&amp;#xA;</xsl:with-param>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="toBeReplaced" select="'&#x9;'"/>
<xsl:with-param name="replacement">&amp;#x9;</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$DOUBLEQUOTE"/>
<xsl:for-each select="./xqx:attributeValueExpr/xqx:*">
<xsl:value-of select="$LBRACE"/>
<xsl:apply-templates select="."/>
<xsl:value-of select="$RBRACE"/>
</xsl:for-each>
<xsl:value-of select="$DOUBLEQUOTE"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- replaced xqx:namespaceDeclaration per Bugzilla Bug #5343 -->
<xsl:template match="xqx:namespaceDeclaration">
<xsl:text> xmlns</xsl:text>
<xsl:if test="xqx:prefix">
<xsl:text>:</xsl:text>
<xsl:value-of select="xqx:prefix"/>
</xsl:if>
<xsl:value-of select="$EQUAL"/>
<xsl:call-template name="quote">
<xsl:with-param name="item">
<xsl:call-template name="globalReplace">
<xsl:with-param name="stringToBeFixed">
<xsl:call-template name="globalReplace">
<xsl:with-param name="stringToBeFixed">
<xsl:value-of select="xqx:uri"/>
</xsl:with-param>
<xsl:with-param name="toBeReplaced">
<xsl:text>{</xsl:text>
</xsl:with-param>
<xsl:with-param name="replacement">
<xsl:text>{{</xsl:text>
</xsl:with-param>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="toBeReplaced">
<xsl:text>}</xsl:text>
</xsl:with-param>
<xsl:with-param name="replacement">
<xsl:text>}}</xsl:text>
</xsl:with-param>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template match="xqx:attributeList">
<xsl:apply-templates select="*"/>
</xsl:template>
<xsl:template match="xqx:elementContent">
<xsl:for-each select="*">
<xsl:if test="not(self::xqx:elementConstructor)">
<xsl:value-of select="$SPACE"/>
<xsl:value-of select="$LBRACE"/>
</xsl:if>
<xsl:apply-templates select="."/>
<xsl:if test="not(self::xqx:elementConstructor)">
<xsl:value-of select="$SPACE"/>
<xsl:value-of select="$RBRACE"/>
</xsl:if>
</xsl:for-each>
</xsl:template>
<xsl:template match="xqx:elementConstructor">
<xsl:value-of select="$LESSTHAN"/>
<xsl:apply-templates select="xqx:tagName"/>
<xsl:apply-templates select="xqx:attributeList"/>
<xsl:value-of select="$GREATERTHAN"/>
<xsl:apply-templates select="xqx:elementContent"/>
<xsl:value-of select="$LESSTHAN"/>
<xsl:value-of select="$SLASH"/>
<xsl:apply-templates select="xqx:tagName"/>
<xsl:value-of select="$GREATERTHAN"/>
</xsl:template>
<xsl:template match="xqx:tagNameExpr">
<xsl:value-of select="$LBRACE"/>
<xsl:apply-templates select="*"/>
<xsl:value-of select="$RBRACE"/>
</xsl:template>
<xsl:template match="xqx:computedElementConstructor">
<xsl:text> element </xsl:text>
<xsl:apply-templates select="xqx:tagName"/>
<xsl:apply-templates select="xqx:tagNameExpr"/>
<xsl:value-of select="$SPACE"/>
<xsl:value-of select="$LBRACE"/>
<xsl:value-of select="$SPACE"/>
<xsl:apply-templates select="xqx:contentExpr"/>
<xsl:value-of select="$SPACE"/>
<xsl:value-of select="$RBRACE"/>
</xsl:template>
<span> <xsl:template match="xqx:contentExpr">
<xsl:apply-templates/>
</xsl:template>
</span> <xsl:template match="xqx:computedAttributeConstructor">
<xsl:text> attribute </xsl:text>
<xsl:apply-templates select="xqx:tagName"/>
<xsl:apply-templates select="xqx:tagNameExpr"/>
<xsl:value-of select="$SPACE"/>
<xsl:value-of select="$LBRACE"/>
<xsl:apply-templates select="xqx:valueExpr"/>
<xsl:value-of select="$SPACE"/>
<xsl:value-of select="$RBRACE"/>
</xsl:template>
<xsl:template match="xqx:computedDocumentConstructor">
<xsl:text> document {</xsl:text>
<xsl:apply-templates select="*"/>
<xsl:text> }</xsl:text>
</xsl:template>
<xsl:template match="xqx:computedTextConstructor">
<xsl:text> text</xsl:text>
<xsl:value-of select="$SPACE"/>
<xsl:value-of select="$LBRACE"/>
<xsl:apply-templates select="*"/>
<xsl:value-of select="$SPACE"/>
<xsl:value-of select="$RBRACE"/>
</xsl:template>
<xsl:template match="xqx:computedCommentConstructor">
<xsl:text> comment</xsl:text>
<xsl:value-of select="$LBRACE"/>
<xsl:apply-templates select="*"/>
<xsl:value-of select="$RBRACE"/>
</xsl:template>
<span> <xsl:template match="xqx:computedNamespaceConstructor">
<xsl:text> namespace </xsl:text>
<xsl:choose>
<xsl:when test="xqx:prefix">
<xsl:value-of select="xqx:prefix"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$LBRACE"/>
<xsl:apply-templates select="xqx:prefixExpr"/>
<xsl:value-of select="$RBRACE"/>
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="$SPACE"/>
<xsl:value-of select="$LBRACE"/>
<xsl:apply-templates select="xqx:URIExpr"/>
<xsl:value-of select="$RBRACE"/>
</xsl:template>
</span> <xsl:template match="xqx:piTargetExpr">
<xsl:value-of select="$LBRACE"/>
<xsl:apply-templates select="*"/>
<xsl:value-of select="$RBRACE"/>
</xsl:template>
<!-- Move value braces into computedPIConstructor template from this template, Bugzilla bug #3442 -->
<xsl:template match="xqx:piValueExpr">
<xsl:apply-templates select="*"/>
</xsl:template>
<!-- Move value braces into this template from piValueExpr template, Bugzilla bug #3442 -->
<xsl:template match="xqx:computedPIConstructor">
<xsl:text> processing-instruction </xsl:text>
<xsl:value-of select="xqx:piTarget"/>
<xsl:apply-templates select="xqx:piTargetExpr"/>
<xsl:value-of select="$LBRACE"/>
<xsl:apply-templates select="xqx:piValueExpr"/>
<xsl:value-of select="$RBRACE"/>
</xsl:template>
<xsl:template match="xqx:unorderedExpr">
<xsl:text> unordered</xsl:text>
<xsl:value-of select="$LBRACE"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="*"/>
<xsl:text> </xsl:text>
<xsl:value-of select="$RBRACE"/>
</xsl:template>
<xsl:template match="xqx:orderedExpr">
<xsl:text> ordered</xsl:text>
<xsl:value-of select="$LBRACE"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="*"/>
<xsl:text> </xsl:text>
<xsl:value-of select="$RBRACE"/>
</xsl:template>
<xsl:template match="xqx:versionDecl">
<xsl:text>xquery </xsl:text>
<span> <xsl:if test="xqx:version">
<xsl:text>version </xsl:text>
<xsl:call-template name="quote">
<xsl:with-param name="item" select="xqx:version"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="xqx:encoding and xqx:version">
<xsl:value-of select="$SPACE"/>
</xsl:if>
<xsl:if test="xqx:encoding">
<xsl:text>encoding </xsl:text>
<xsl:call-template name="quote">
<xsl:with-param name="item" select="xqx:encoding"/>
</xsl:call-template>
</xsl:if>
</span> <xsl:value-of select="$SEPARATOR"/>
<xsl:value-of select="$NEWLINE"/>
</xsl:template>
<xsl:template match="xqx:namespaceDecl">
<xsl:text>declare namespace </xsl:text>
<xsl:value-of select="xqx:prefix"/>
<xsl:value-of select="$EQUAL"/>
<xsl:call-template name="quote">
<xsl:with-param name="item" select="xqx:uri"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="xqx:defaultNamespaceDecl">
<xsl:text>declare default </xsl:text>
<xsl:value-of select="xqx:defaultNamespaceCategory"/>
<xsl:text> namespace </xsl:text>
<xsl:call-template name="quote">
<xsl:with-param name="item" select="xqx:uri"/>
</xsl:call-template>
</xsl:template>
<span> <xsl:template match="xqx:boundarySpaceDecl">
<xsl:text>declare boundary-space </xsl:text>
<xsl:value-of select="."/>
</xsl:template>
</span> <xsl:template match="xqx:defaultCollationDecl">
<xsl:text>declare default collation </xsl:text>
<xsl:call-template name="quote">
<xsl:with-param name="item" select="."/>
</xsl:call-template>
</xsl:template>
<xsl:template match="xqx:baseUriDecl">
<xsl:text>declare base-uri </xsl:text>
<xsl:call-template name="quote">
<xsl:with-param name="item" select="."/>
</xsl:call-template>
</xsl:template>
<xsl:template match="xqx:constructionDecl">
<xsl:text>declare construction </xsl:text>
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="xqx:orderingModeDecl">
<xsl:text>declare ordering </xsl:text>
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="xqx:emptyOrderingDecl">
<xsl:text>declare default order </xsl:text>
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="xqx:copyNamespacesDecl">
<xsl:text>declare copy-namespaces </xsl:text>
<xsl:value-of select="xqx:preserveMode"/>
<xsl:value-of select="$COMMA"/>
<xsl:value-of select="xqx:inheritMode"/>
</xsl:template>
<xsl:template match="xqx:optionDecl">
<xsl:text>declare option </xsl:text>
<xsl:apply-templates select="xqx:optionName"/>
<xsl:value-of select="$SPACE"/>
<xsl:call-template name="quote">
<xsl:with-param name="item" select="xqx:optionContents"/>
</xsl:call-template>
</xsl:template>
<span> <xsl:template match="xqx:decimalFormatDecl">
<xsl:if test="@xqx:default = 'true' and xqx:decimalFormatName">
<xsl:message terminate="yes">Incorrect XQueryX: xqx:decimalFormatDecl does not allow both @default=true and xqx:decimalFormatName</xsl:message>
</xsl:if>
<xsl:text>declare </xsl:text>
<xsl:if test="@xqx:default = 'true'">
<xsl:text>default </xsl:text>
</xsl:if>
<xsl:text>decimal-format </xsl:text>
<xsl:if test="xqx:decimalFormatName">
<xsl:apply-templates select="xqx:decimalFormatName"/>
<xsl:text> </xsl:text>
</xsl:if>
<xsl:apply-templates select="xqx:decimalFormatParam"/>
</xsl:template>
<xsl:template match="xqx:decimalFormatParam">
<xsl:value-of select="xqx:decimalFormatParamName"/>
<xsl:text> = </xsl:text>
<xsl:call-template name="quote">
<xsl:with-param name="item" select="xqx:decimalFormatParamValue"/>
</xsl:call-template>
<xsl:text> </xsl:text>
</xsl:template>
</span> <xsl:template match="xqx:voidSequenceType">
<xsl:text>empty-sequence()</xsl:text>
</xsl:template>
<xsl:template match="xqx:occurrenceIndicator">
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="xqx:anyItemType">
<xsl:text>item()</xsl:text>
</xsl:template>
<xsl:template match="xqx:sequenceType">
<xsl:apply-templates select="*"/>
</xsl:template>
<span><!-- 2011-09-09/JM - added a sequenceTypeUnion type -->
<xsl:template match="xqx:sequenceTypeUnion">
<xsl:apply-templates select="xqx:sequenceType[1]"/>
<xsl:if test="count(xqx:sequenceType) > 1">
<xsl:for-each select="xqx:sequenceType[position() > 1]">
<xsl:text> | </xsl:text>
<xsl:apply-templates select="."/>
</xsl:for-each>
</xsl:if>
</xsl:template>
</span> <xsl:template match="xqx:singleType">
<xsl:apply-templates select="xqx:atomicType"/>
<xsl:if test="xqx:optional">
<xsl:text>?</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="xqx:typeDeclaration">
<xsl:text> as </xsl:text>
<xsl:apply-templates select="*"/>
</xsl:template>
<span> <xsl:template match="xqx:contextItemDecl">
<xsl:text>declare context item </xsl:text>
<xsl:apply-templates select="xqx:typeDeclaration"/>
<xsl:if test="xqx:varValue">
<xsl:value-of select="$ASSIGN"/>
<xsl:apply-templates select="xqx:varValue"/>
</xsl:if>
<xsl:if test="xqx:external">
<xsl:text> external </xsl:text>
<xsl:if test="xqx:external/xqx:varValue">
<xsl:text>:= </xsl:text>
<xsl:apply-templates select="xqx:external/xqx:varValue"/>
</xsl:if>
</xsl:if>
</xsl:template>
<xsl:template match="xqx:annotation">
<xsl:value-of select="$SPACE"/>
<xsl:value-of select="$PERCENT"/>
<xsl:apply-templates select="xqx:annotationName"/>
<xsl:if test="xqx:arguments">
<xsl:for-each select="xqx:arguments">
<xsl:call-template name="parenthesizedList"/>
</xsl:for-each>
</xsl:if>
</xsl:template>
</span> <xsl:template match="xqx:varDecl">
<span> <xsl:text>declare</xsl:text>
<xsl:apply-templates select="xqx:annotation"/>
<xsl:text> variable </xsl:text>
<xsl:value-of select="$DOLLAR"/>
<xsl:apply-templates select="xqx:varName"/>
<xsl:apply-templates select="xqx:typeDeclaration"/>
<xsl:if test="xqx:varValue">
<xsl:value-of select="$ASSIGN"/>
<xsl:apply-templates select="xqx:varValue"/>
</xsl:if>
<xsl:if test="xqx:external">
<xsl:text> external </xsl:text>
<xsl:if test="xqx:external/xqx:varValue">
<xsl:text>:= </xsl:text>
<xsl:apply-templates select="xqx:external/xqx:varValue"/>
</xsl:if>
</span> </xsl:if>
</xsl:template>
<!-- Part of fix for Bugzilla bug #3520 -->
<xsl:template match="xqx:targetLocation">
<xsl:choose>
<xsl:when test="position()=1"> at </xsl:when>
<xsl:otherwise>,&#xD; </xsl:otherwise>
</xsl:choose>
<xsl:call-template name="quote">
<xsl:with-param name="item" select="."/>
</xsl:call-template>
</xsl:template>
<!-- Modified to fix Bugzilla bug #3520 -->
<xsl:template match="xqx:schemaImport">
<xsl:text> import schema </xsl:text>
<xsl:if test="xqx:defaultElementNamespace">
<xsl:text> default element namespace </xsl:text>
</xsl:if>
<xsl:if test="xqx:namespacePrefix">
<xsl:text> namespace </xsl:text>
<xsl:value-of select="xqx:namespacePrefix"/>
<xsl:value-of select="$EQUAL"/>
</xsl:if>
<xsl:call-template name="quote">
<xsl:with-param name="item" select="xqx:targetNamespace"/>
</xsl:call-template>
<xsl:apply-templates select="xqx:targetLocation"/>
</xsl:template>
<!-- Modified to fix Bugzilla bug #3520 -->
<xsl:template match="xqx:moduleImport">
<xsl:text> import module </xsl:text>
<xsl:if test="xqx:namespacePrefix">
<xsl:text> namespace </xsl:text>
<xsl:value-of select="xqx:namespacePrefix"/>
<xsl:value-of select="$EQUAL"/>
</xsl:if>
<xsl:call-template name="quote">
<xsl:with-param name="item" select="xqx:targetNamespace"/>
</xsl:call-template>
<xsl:apply-templates select="xqx:targetLocation"/>
</xsl:template>
<xsl:template match="xqx:param">
<xsl:value-of select="$DOLLAR"/>
<xsl:apply-templates select="xqx:varName"/>
<xsl:apply-templates select="xqx:typeDeclaration"/>
</xsl:template>
<xsl:template match="xqx:paramList">
<xsl:call-template name="parenthesizedList"/>
</xsl:template>
<xsl:template match="xqx:functionBody">
<xsl:value-of select="$NEWLINE"/>
<xsl:value-of select="$LBRACE"/>
<xsl:value-of select="$NEWLINE"/>
<xsl:apply-templates/>
<xsl:value-of select="$NEWLINE"/>
<xsl:value-of select="$RBRACE"/>
</xsl:template>
<xsl:template match="xqx:functionDecl">
<span> <xsl:text>declare</xsl:text>
<xsl:apply-templates select="xqx:annotation"/>
<xsl:text> function </xsl:text>
<xsl:apply-templates select="xqx:functionName"/>
<xsl:apply-templates select="xqx:paramList"/>
<xsl:apply-templates select="xqx:typeDeclaration"/>
<xsl:choose>
<xsl:when test="xqx:externalDefinition">
<xsl:text> external </xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="xqx:functionBody"/>
</xsl:otherwise>
</xsl:choose>
</span> </xsl:template>
<xsl:template match="xqx:queryBody">
<xsl:apply-templates select="*"/>
<xsl:value-of select="$NEWLINE"/>
</xsl:template>
<xsl:template match="xqx:moduleDecl">
<xsl:text> module namespace </xsl:text>
<xsl:value-of select="xqx:prefix"/>
<xsl:value-of select="$EQUAL"/>
<xsl:call-template name="quote">
<xsl:with-param name="item" select="xqx:uri" />
</xsl:call-template>
<xsl:value-of select="$SEPARATOR"/>
<xsl:value-of select="$NEWLINE"/>
</xsl:template>
<xsl:template match="xqx:prolog">
<xsl:for-each select="*">
<xsl:apply-templates select="."/>
<xsl:value-of select="$SEPARATOR"/>
<xsl:value-of select="$NEWLINE"/>
</xsl:for-each>
</xsl:template>
<xsl:template match="xqx:libraryModule">
<xsl:apply-templates select="xqx:moduleDecl"/>
<xsl:apply-templates select="xqx:prolog"/>
</xsl:template>
<xsl:template match="xqx:mainModule">
<xsl:apply-templates select="xqx:prolog"/>
<xsl:apply-templates select="xqx:queryBody"/>
</xsl:template>
<xsl:template match="xqx:module" priority="2">
<xsl:apply-templates select="*"/>
</xsl:template>
<xsl:template match="/xqx:*">
<xsl:message terminate="yes">Incorrect XQueryX: The only top-level element permitted is xqx:module</xsl:message>
</xsl:template>
</xsl:stylesheet>
</pre></div>
</div>
<div class="div1">
<h2><a name="xqueryx-id-mime-type" id="xqueryx-id-mime-type"></a>C
The <code>application/xquery+xml</code> Media Type</h2>
<p>This Appendix specifies the media type for XQueryX Version 3.0.
XQueryX is the XML syntax of a language, XQuery, for querying over
data from XML data sources, as specified in <a href=
"#xquery-30">[XQuery 3.0: An XML Query Language]</a>.</p>
<div class="note">
<p class="prefix"><b>Note:</b></p>
<p>Specification of media types is described in <a href=
"#RFC3023">[RFC 3023]</a>.</p>
</div>
<div class="div2">
<h3><a name="xqueryx-mime-introduction" id=
"xqueryx-mime-introduction"></a>C.1 Introduction</h3>
<p>This document, together with its normative references, defines
the XML syntax for the XML Query language XQuery Version 3.0. This
Appendix specifies the <code>application/xquery+xml</code> media
type, which is intended to be used for transmitting queries
expressed in the XQueryX syntax.</p>
<p>This media type is being submitted to the IESG for review,
approval, and registration with IANA.</p>
<p>This document was prepared by members of the W3C XML Query
Working Group. Please send comments to public-qt-comments@w3.org, a
public mailing list with archives at <a href=
"http://lists.w3.org/Archives/Public/public-qt-comments">http://lists.w3.org/Archives/Public/public-qt-comments</a>.</p>
</div>
<div class="div2">
<h3><a name="xqueryx-mime-registration" id=
"xqueryx-mime-registration"></a>C.2 Registration of MIME Media Type
<code>application/xquery+xml</code></h3>
<p>MIME media type name: <code>application</code></p>
<p>MIME subtype name: <code>xquery+xml</code></p>
<p>Required parameters: none</p>
<p>Optional parameters: <code>charset</code></p>
<p>This parameter has identical semantics to the
<code>charset</code> parameter of the <code>application/xml</code>
media type as specified in [RFC 3023].</p>
<div class="div3">
<h4><a name="xqueryx-mime-encoding" id=
"xqueryx-mime-encoding"></a>C.2.1 Encoding Considerations</h4>
<p>By virtue of XSLT content being XML, it has the same
considerations when sent as "<code>application/xquery+xml</code>"
as does XML. See [RFC 3023], section 3.2.</p>
</div>
<div class="div3">
<h4><a name="xqueryx-mime-security" id=
"xqueryx-mime-security"></a>C.2.2 Security Considerations</h4>
<p>Queries written in XQuery may cause arbitrary URIs or IRIs to be
dereferenced. Therefore, the security issues of [RFC3987] Section 8
should be considered. In addition, the contents of resources
identified by <code>file:</code> URIs can in some cases be
accessed, processed and returned as results. XQuery expressions can
invoke any of the functions defined in XQuery 1.0 and XPath 2.0
Functions and Operators, including <code>file-exists()</code>; a
<code>doc()</code> function also allows local filesystem probes as
well as access to any URI-defined resource accessible from the
system evaluating the XQuery expression.</p>
<p>XQuery is a full declarative programming language, and supports
user-defined functions, external function libraries (modules)
referenced by URI, and system-specific "native" functions.</p>
<p>Arbitrary recursion is possible, as is arbitrarily large memory
usage, and implementations may place limits on CPU and memory
usage, as well as restricting access to system-defined
functions.</p>
<p>The XML Query Working group is working on a facility to allow
XQuery expressions to be used to create and update persistent data.
Untrusted queries should not be given write access to data.</p>
<p>Furthermore, because the XQuery language permits extensions, it
is possible that application/xquery may describe content that has
security implications beyond those described here.</p>
</div>
<div class="div3">
<h4><a name="xqueryx-mime-interoperability" id=
"xqueryx-mime-interoperability"></a>C.2.3 Interoperability
Considerations</h4>
<p>See <a href=
"http://www.w3.org/TR/xquery-30/#id-xquery-conformance">Section 5
Conformance</a> <sup><small>XQ30</small></sup>.</p>
</div>
<div class="div3">
<h4><a name="xqueryx-mime-pubspec" id=
"xqueryx-mime-pubspec"></a>C.2.4 Published specification</h4>
<p>This media type registration is for XQueryX documents as
described by the XQueryX 3.0 specification, which is located at
<a href=
"http://www.w3.org/TR/xqueryx-30/">http://www.w3.org/TR/xqueryx-30/</a>.
It is also appropriate to use this media type with later versions
of the XQueryX language.</p>
</div>
<div class="div3">
<h4><a name="xqueryx-mime-applications" id=
"xqueryx-mime-applications"></a>C.2.5 Applications That Use This
Media Type</h4>
<p>The public <a href="http://www.w3.org/XML/Query/">XQuery Web
page</a> lists more than two dozen implementations of the XQuery
language, both proprietary and open source. Some of these are known
to support XQueryX.</p>
<p>This new media type is being registered to allow for deployment
of XQueryX on the World Wide Web.</p>
<p>There is no experimental, vendor specific, or personal tree
predecessor to "application/xquery+xml", reflecting the fact that
no applications currently recognize it. This new type is being
registered in order to allow for the expected deployment of XQueryX
3.0 on the World Wide Web, as a first class XML application.</p>
</div>
<div class="div3">
<h4><a name="xqueryx-mime-additional" id=
"xqueryx-mime-additional"></a>C.2.6 Additional Information</h4>
<div class="div4">
<h5><a name="xqueryx-mime-recognizing" id=
"xqueryx-mime-recognizing"></a>C.2.6.1 Recognizing XQuery Files
("Magic Numbers")</h5>
<p>Although no byte sequences can be counted on to consistently
identify XQueryX, XQueryX documents will have the sequence
"http://www.w3.org/2005/XQueryX" to identify the XQueryX namespace.
This sequence will normally be found in a namespace attribute of
the first element in the document.</p>
</div>
<div class="div4">
<h5><a name="xqueryx-mime-extensions" id=
"xqueryx-mime-extensions"></a>C.2.6.2 File Extensions</h5>
<p>The most common file extension in use for XQueryX is
<code>.xqx</code>.</p>
</div>
<div class="div4">
<h5><a name="xqueryx-mime-macfiletype" id=
"xqueryx-mime-macfiletype"></a>C.2.6.3 Macintosh File Type
Code(s)</h5>
<p>The appropriate Macintosh file type code is
<code>TEXT</code>.</p>
</div>
</div>
<div class="div3">
<h4><a name="xqueryx-mime-author" id=
"xqueryx-mime-author"></a>C.2.7 Person and Email Address to Contact
For Further Information</h4>
<p>Jim Melton, Oracle Corp., <a href=
"mailto:jim.melton@oracle.com">jim.melton@oracle.com</a></p>
</div>
<div class="div3">
<h4><a name="xqueryx-mime-intended-usage" id=
"xqueryx-mime-intended-usage"></a>C.2.8 Intended Usage</h4>
<p>COMMON</p>
</div>
<div class="div3">
<h4><a name="xqueryx-mime-restrictions" id=
"xqueryx-mime-restrictions"></a>C.2.9 Restrictions on usage</h4>
<p>The intended usage of this media type is for interchange of
XQueryX expressions.</p>
</div>
<div class="div3">
<h4><a name="xqueryx-mime-owner" id="xqueryx-mime-owner"></a>C.2.10
Author/Change Controller</h4>
<p>XQuery was produced by, and is maintained by, the World Wide Web
Consortium's XML Query Working Group. The W3C has change control
over this specification.</p>
</div>
<div class="div3">
<h4><a name="xqueryx-mime-fragments" id=
"xqueryx-mime-fragments"></a>C.2.11 Fragment Identifiers</h4>
<p>For documents labeled as "<code>application/xquery+xml</code>",
the fragment identifier notation is exactly that for
"<code>application/xml</code>", as specified in [RFC 3023].</p>
</div>
</div>
</div>
<div class="div1">
<h2><a name="changelog" id="changelog"></a>D Change log
(Non-Normative)</h2>
<p>This appendix lists the changes that have been made to this
specification since the publication of the XQueryX 1.0
Recommendation on 23 January 2007.</p>
<div class="div2">
<h3><a name="changelog_substantive" id=
"changelog_substantive"></a>D.1 Substantive changes</h3>
<p>In the Working Draft of 13 December 2011, the following
substantive changes have been made relative to XQueryX 1.0. The
changes made to this document are described below. The rationale
for each change is explained in the corresponding Bugzilla database
entry (if any). The following table summarizes the changes that
have been applied.</p>
<table border="1" cellpadding="5" width="100%">
<thead>
<tr>
<td>Change</td>
<td>Bugzilla</td>
<td>Category</td>
<td>Description</td>
</tr>
</thead>
<tbody>
<tr>
<td>Group By clause in FLWOR expression.</td>
<td>None.</td>
<td>Substantive.</td>
<td>A new clause was added to the FLWOR expression to allow query
writers to cause groups of tuples to be created based on the values
of some expression.</td>
</tr>
<tr>
<td>Window clause in FLWOR expression.</td>
<td>None.</td>
<td>Substantive.</td>
<td>A new clause was added to the FLWOR expression to allow query
writers to create sliding and tumbling windows of tuples based on a
number of criteria.</td>
</tr>
<tr>
<td>Simplification of FLWOR expression.</td>
<td>None.</td>
<td>Substantive.</td>
<td>The syntax of the FLWOR expression was considerably relaxed,
permitting most clauses (other than the return clause) to be used
at almost any position (only a few clauses are allowed to be the
first clause) within a FLWOR expression.</td>
</tr>
<tr>
<td>Outer for supported in FLWOR expressions.</td>
<td>None.</td>
<td>Substantive.</td>
<td>The syntax of the for clause in FLWOR expressions was extended
to allow the use of "outer for".</td>
</tr>
<tr>
<td>Count clause in FLWOR expression.</td>
<td>None.</td>
<td>Substantive.</td>
<td>A new clause was added to the FLWOR expression to allow query
writers to capture the total number of items that are returned by a
(portion of a) FLWOR expression.</td>
</tr>
<tr>
<td>Declaration of decimal number formats.</td>
<td>None.</td>
<td>Substantive.</td>
<td>A new option was added to the query prologue, allowing query
authors to specify a named (or an unnamed default) format for
decimal numbers. This allows the specification of such items as the
decimal separator, the minus sign, the percent and per mille signs,
and even the class of Unicode digits.</td>
</tr>
<tr>
<td>Query version and encoding declaration.</td>
<td>None.</td>
<td>Substantive.</td>
<td>Allows specification of either or both of the version of XQuery
to which a query adheres and the encoding of the query (e.g., UTF8,
ISO8859-1).</td>
</tr>
<tr>
<td>Enhanced validation expression.</td>
<td><a href=
"http://www.w3.org/Bugs/Public/show_bug.cgi?id=5472">[XQuery 1.1]
Requirement: validation by type</a></td>
<td>Substantive.</td>
<td>Permits query authors to validate an expression against a
specified XML Schema type.</td>
</tr>
<tr>
<td>Nondeterministic external functions.</td>
<td>None.</td>
<td>Substantive.</td>
<td>Functions declared to be external functions can also be
specified to be deterministic or nondeterministic.</td>
</tr>
<tr>
<td>Syntax used to provide default value for external
variables.</td>
<td>None.</td>
<td>Minor.</td>
<td>The declaration of external variables now uses ":=" to indicate
the default value given to such variables, instead of the keyword
"default".</td>
</tr>
<tr>
<td>Try/catch for error handling.</td>
<td>None.</td>
<td>Substantive.</td>
<td>A try/catch facility is provided that allows query authors to
control how errors are handled when raised by evaluation of
queries.</td>
</tr>
<tr>
<td>Context item declaration.</td>
<td>None.</td>
<td>Substantive.</td>
<td>It is now possible to declare both the type of and the default
initial value of the context item of a query, and to specify
whether its value may be provided by the external environment.</td>
</tr>
<tr>
<td>Computed namespace constructor.</td>
<td>None.</td>
<td>Substantive.</td>
<td>Added new complex type and element to XQueryX schema, and new
template to XQueryX stylesheet, in support of computed namespace
constructors in XQuery 1.1.</td>
</tr>
<tr>
<td>Generate proper syntax for variable names in positional
variable bindings.</td>
<td><a href=
"http://www.w3.org/Bugs/Public/show_bug.cgi?id=6309">[XQX30]
template for positionalVariableBinding</a></td>
<td>Substantive.</td>
<td>Modified XQueryX stylesheet template to correctly generate a
"$" preceding the variable name.</td>
</tr>
<tr>
<td>Allow positional variable bindings to be optional in window
variables.</td>
<td><a href=
"http://www.w3.org/Bugs/Public/show_bug.cgi?id=6310">[XQX30]
positionalVariableBinding should be optional in windowVars</a></td>
<td>Substantive.</td>
<td>Modified XQueryX schema to add minOccurs="0" on element
positionalVariableBinding in windowVars complex type
definition.</td>
</tr>
<tr>
<td>XQueryX syntax must allow wildcards in the try/catch error
list.</td>
<td><a href=
"http://www.w3.org/Bugs/Public/show_bug.cgi?id=7053">[XQX30] cannot
represent a catchErrorList wildcard in XQueryX</a></td>
<td>Substantive.</td>
<td>In XQueryX schema, modified catchErrorList complex type
definition to allow a choice between a nameText (essentially a
QName) and a Wildcard. In XQueryX stylesheet, modified
catchErrorList template to support Wildcard as well as
nameText.</td>
</tr>
<tr>
<td>Private functions.</td>
<td>None.</td>
<td>Substantive.</td>
<td>In XQueryX schema, added new attribute "private" in
functionDecl complex type. In XQUeryX stylesheet, template for
functionDecl, added support for @private (generate "private" for
private functions and "public" for others)</td>
</tr>
<tr>
<td>Replace "outer for" with "allowing empty".</td>
<td>None.</td>
<td>Substantive.</td>
<td>In XQueryX schema, forClause complex type, delete attribute
"outer"; in forClauseItem complex type, add new element
allowingEmpty. In XQueryX stylesheet template for forClause, remove
generation of "outer"; in template for forClauseItem, generate
"allowing empty".</td>
</tr>
<tr>
<td>Higher-order functions.</td>
<td>None.</td>
<td>Substantive.</td>
<td>Made changes to XQueryX schema and stylesheet corresponding to
new higher-order function syntax in XQuery 1.1.</td>
</tr>
<tr>
<td>New "switch" expression ("value switch", analogous to
typeswitch).</td>
<td>None.</td>
<td>Substantive.</td>
<td>Made changes to XQueryX schema and stylesheet corresponding to
new switch syntax in XQuery 3.0.</td>
</tr>
<tr>
<td>Support for partial function application.</td>
<td>None.</td>
<td>Substantive.</td>
<td>Made changes to XQueryX schema and stylesheet to support the
partial function application capability of XQuery 3.0.</td>
</tr>
<tr>
<td>XML Schema and XSLT Stylesheet</td>
<td><a href=
"http://www.w3.org/Bugs/Public/show_bug.cgi?id=11792#c3">lack of
syntactic symmetry between the control flow expressions</a></td>
<td>Substantive.</td>
<td>Eliminated the possibility of defining three "error variables"
as part of the catch clause; those variables (and others) are now
implicitly defined, and may be used without explicit definition. At
the same time, fixed a bug in the schema and stylesheet that
recognized and produced invalid syntax for the validation
expression.</td>
</tr>
</tbody>
</table>
<p>In the Working Draft of 13 December 2011, the following
substantive changes have been made relative to the preceding draft
of this document. The changes made to this document are described
below. The rationale for each change is explained in the
corresponding Bugzilla database entry (if any). The following table
summarizes the changes that have been applied.</p>
<table border="1" cellpadding="5" width="100%">
<thead>
<tr>
<td>Change</td>
<td>Bugzilla</td>
<td>Category</td>
<td>Description</td>
</tr>
</thead>
<tbody>
<tr>
<td>XML Schema and XSLT Stylesheet</td>
<td>None.</td>
<td>Substantive.</td>
<td>Added support for the string concatenation operator
("||").</td>
</tr>
<tr>
<td>XML Schema and XSLT Stylesheet</td>
<td>None.</td>
<td>Substantive.</td>
<td>Added support for the simple mapping operator ("!").</td>
</tr>
<tr>
<td>XML Schema and XSLT Stylesheet</td>
<td>None.</td>
<td>Substantive.</td>
<td>Added support for the sequenceTypeUnion in the typeswitch
expression.</td>
</tr>
<tr>
<td>XML Schema and XSLT Stylesheet</td>
<td>None.</td>
<td>Substantive.</td>
<td>Added support for the annotations on inline functions.</td>
</tr>
<tr>
<td>XML Schema and XSLT Stylesheet</td>
<td>None.</td>
<td>Substantive.</td>
<td>Added support for new group-by syntax.</td>
</tr>
<tr>
<td>XML Schema and XSLT Stylesheet</td>
<td>None.</td>
<td>Substantive.</td>
<td>Replaced the element named "literalFunctionItemExpr" with an
identical element named "namedFunctionRef"; Replaced the element
named "inlineFunctionItemExpr" with an identical element named
"inlineFunctionExpr"</td>
</tr>
</tbody>
</table>
</div>
<div class="div2">
<h3><a name="changelog_incompatibilities" id=
"changelog_incompatibilities"></a>D.2 Incompatibilities</h3>
<p>The Working Draft of 13 December 2011, contains the following
incompatibilities with XQueryX 1.0. The changes made to this
document are described below. The rationale for each change is
explained in the corresponding Bugzilla database entry (if any).
The following table summarizes the changes that have been
applied.</p>
<table border="1" cellpadding="5" width="100%">
<thead>
<tr>
<td>Change</td>
<td>Bugzilla</td>
<td>Category</td>
<td>Description</td>
</tr>
</thead>
<tbody>
<tr>
<td>(none)</td>
<td>—</td>
<td>—</td>
<td>—</td>
</tr>
</tbody>
</table>
</div>
<div class="div2">
<h3><a name="changelog_editorial" id="changelog_editorial"></a>D.3
Editorial changes</h3>
<p>In the Working Draft of 13 December 2011, the following
editorial changes have been made relative to XQueryX 1.0. The
changes made to this document are described below. The rationale
for each change is explained in the corresponding Bugzilla database
entry (if any). The following table summarizes the changes that
have been applied.</p>
<table border="1" cellpadding="5" width="100%">
<thead>
<tr>
<td>Change</td>
<td>Bugzilla</td>
<td>Category</td>
<td>Description</td>
</tr>
</thead>
<tbody>
<tr>
<td>Erratum XQX.E1</td>
<td><a href=
"http://www.w3.org/Bugs/Public/show_bug.cgi?id=4924">Arguably
incorrect element definition in XQueryX's Schema.</a></td>
<td>Editorial.</td>
<td>The published XQueryX 1.0 schema defined many elements using
anonymous complex types. That made it infeasible to extend the
content model of those elements in other specifications that define
XQueryX extensions corresponding perhaps to XQuery extensions.
While conceptually simple, a number of changes were required to
ensure that all elements are defined using named complex
types.</td>
</tr>
<tr>
<td>Erratum XQX.E2 and Erratum XQX.E3</td>
<td><a href=
"http://www.w3.org/Bugs/Public/show_bug.cgi?id=4963">Removed
element xqx:parenthesizedExpr used in example.</a></td>
<td>Editorial.</td>
<td>The XQueryX solution to Example 4 incorrectly contained an
<xqx:parenthesizedExpr> element. That element was changed to
an <xqx:sequenceExpr> element. The XSLT stylesheet in
Appendix B contained a template for the transformation of
<xqx:parenthesizedExpr> elements that was unnecessary and
confusing; that template was deleted.</td>
</tr>
<tr>
<td>Erratum XQX.E4</td>
<td><a href=
"http://www.w3.org/Bugs/Public/show_bug.cgi?id=5323">Bug in XQueryX
applet</a></td>
<td>Editorial.</td>
<td>The XQueryX 1.0 Recommendation linked to an obsolete version of
the XQuery 1.0 grammar applet. The proper link has now been
used.</td>
</tr>
<tr>
<td>Erratum XQX.E5</td>
<td><a href=
"http://www.w3.org/Bugs/Public/show_bug.cgi?id=5343">Problem with
{{ and }} in a Namespace Declaration Attribute</a></td>
<td>Editorial.</td>
<td>The XSLT stylsheet in Appendix B contained a template for the
transformation of <xqx:namespaceDeclaration> elements that
failed to correctly "escape" curly braces in the same manner as
does the template for the transformation of
<xqx:attributeConstructor> elements. That template has been
corrected.</td>
</tr>
<tr>
<td>Introduction.</td>
<td><a href=
"http://www.w3.org/Bugs/Public/show_bug.cgi?id=6377">[XQX]
non-normative notes</a></td>
<td>Editorial.</td>
<td>Added text in <a href="#Introduction"><b>1 Introduction</b></a>
to clarify that Notes are non-normative.</td>
</tr>
<tr>
<td>This appendix.</td>
<td>None.</td>
<td>Editorial.</td>
<td>Reorganized this appendix to more clearly distinguish between
substantive and editorial changes and to clearly identify
incompatibilities with the previous Recommendation.</td>
</tr>
<tr>
<td>Version number.</td>
<td>None.</td>
<td>Editorial.</td>
<td>Changed the version number of the spec from 1.1 to 3.0.</td>
</tr>
</tbody>
</table>
<p>In the Working Draft of 13 December 2011, the following
editorial changes have been made relative to the preceding draft of
this document. The changes made to this document are described
below. The rationale for each change is explained in the
corresponding Bugzilla database entry (if any). The following table
summarizes the changes that have been applied.</p>
<table border="1" cellpadding="5" width="100%">
<thead>
<tr>
<td>Change</td>
<td>Bugzilla</td>
<td>Category</td>
<td>Description</td>
</tr>
</thead>
<tbody>
<tr>
<td>Introduction.<sup>[<a name="FN-ANCH-d2e1458" id=
"FN-ANCH-d2e1458" href="#d2e1458">1</a>]</sup></td>
<td><a href=
"http://www.w3.org/Bugs/Public/show_bug.cgi?id=14045">section 1:
schema and stylesheet URLs</a></td>
<td>Editorial.</td>
<td>Corrected the URI of the XQueryX schema document and
stylesheet.</td>
</tr>
<tr>
<td>Introduction.</td>
<td><a href=
"http://www.w3.org/Bugs/Public/show_bug.cgi?id=14044">section 1:
version typo</a></td>
<td>Editorial.</td>
<td>Corrected the version number of the previous version of
XQueryX. Also removed normative reference to "this" document and
replaced it with a reference to the XQueryX 1.0 document.</td>
</tr>
</tbody>
<tbody>
<tr>
<td>
<p class="table.footnote"><sup><a name="d2e1458" id="d2e1458" href=
"#FN-ANCH-d2e1458">1.</a></sup> This row and all following rows
were added after the previously-published draft.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</body>
</html>