index.html
762 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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="EN"><head><META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>XForms 1.1 </title><style type="text/css">
code { font-family: monospace; }
div.constraint,
div.issue,
div.note,
div.notice { 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; }
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}
.xmlverb-default { color: #333333; background-color: #ffffff; font-family: monospace }
.xmlverb-element-name { color: #990000 }
.xmlverb-element-nsprefix { color: #666600 }
.xmlverb-attr-name { color: #660000 }
.xmlverb-attr-content { color: #000099; font-weight: bold }
.xmlverb-ns-name { color: #666600 }
.xmlverb-ns-uri { color: #330099 }
.xmlverb-text { color: #000000; font-weight: bold }
.xmlverb-comment { color: #006600; font-style: italic }
.xmlverb-pi-name { color: #006600; font-style: italic }
.xmlverb-pi-content { color: #006666; font-style: italic }
</style><link rel="stylesheet" type="text/css" href="http://www.w3.org/StyleSheets/TR/W3C-REC.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>XForms 1.1 </h1>
<h2><a name="w3c-doctype" id="w3c-doctype"></a>W3C Recommendation 20 October 2009</h2><dl><dt>This version:</dt><dd>
<a href="http://www.w3.org/TR/2009/REC-xforms-20091020/">http://www.w3.org/TR/2009/REC-xforms-20091020/</a>
</dd><dt>Latest version:</dt><dd>
<a href="http://www.w3.org/TR/xforms/">http://www.w3.org/TR/xforms/</a>
</dd><dt>Previous version:</dt><dd><a href="http://www.w3.org/TR/2009/PR-xforms11-20090818/">http://www.w3.org/TR/2009/PR-xforms11-20090818/</a></dd><dt><br>Editor:</dt><dd>John M. Boyer, IBM</dd><dt><br></dt></dl><p>Please refer to the <a href="/2009/10/REC-xforms-20091020-errata.html"><strong>errata</strong></a> for this document, which may
include normative corrections.</p><p>This document is also available in these non-normative formats:
<a href="index-diff.html">diff-marked HTML</a>
.</p><p>The English version of this specification is the only normative version. Non-normative <a href="http://www.w3.org/MarkUp/Forms/Translation/">translations</a> may also be available.</p><p class="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2009 <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.org/"><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>XForms is an XML application that represents the next generation of forms for the Web. XForms is not a free-standing document type, but is intended to be
integrated into other markup languages, such as XHTML, ODF or SVG. An XForms-based web form gathers and processes XML data using an architecture that
separates presentation, purpose and content. The underlying data of a form is organized into <b>instances</b> of data schema (though formal
schema definitions are not required). An XForm allows processing of data to occur using three mechanisms:</p><ul><li><p>a declarative <b>model</b> composed of formulae for data calculations and constraints, data type and other property declarations, and data submission parameters</p></li><li><p>a <b>view</b> layer composed of intent-based user interface controls</p></li><li><p>an imperative <b>controller</b> for orchestrating data manipulations, interactions between the model and view layers, and data submissions.</p></li></ul><p>Thus, XForms accommodates form component reuse, fosters strong data type validation, eliminates unnecessary round-trips to the server, offers device independence
and reduces the need for scripting. </p><p>XForms 1.1 refines the XML processing platform introduced by <a href="#ref-xforms-1.0">[XForms 1.0]</a> by adding several new
submission capabilities, action handlers, utility functions, user interface improvements, and helpful datatypes
as well as a more powerful action processing facility, including conditional, iterated and background execution,
the ability to manipulate data arbitrarily and to access event context information.</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 document has been reviewed by W3C Members, by software developers, and by other W3C groups and interested parties, and is endorsed by the Director as a W3C <a href="http://www.w3.org/2005/10/Process-20051014/tr.html#maturity-levels">Recommendation</a>. It is a stable document and may be used as reference material or cited from another document. W3C's role in making the Recommendation is to draw attention to the specification and to promote its widespread deployment. This enhances the functionality and interoperability of the Web.</p><p>This document was produced by the
<a href="http://www.w3.org/MarkUp/Forms/">W3C Forms Working Group</a> as part of the
<a href="http://www.w3.org/2002/Forms/Activity">Forms Activity</a> within the
<a href="http://www.w3.org/Interaction/">W3C Interaction Domain</a>. The working group has supplied a <a href="http://www.w3.org/MarkUp/Forms/Test/XForms1.1/Edition1/driverPages/html/index.html">test suite</a> (<a href="http://www.w3.org/MarkUp/Forms/Test/XForms1.1/Edition1/zip/TestCases11.zip">zip file</a>) and an <a href="http://www.w3.org/MarkUp/Forms/2008/XForms11ImplReports/results.htm">implementation report</a> demonstrating at least one implementation for each test of a feature and at least two interoperable implementations for each test of a required feature. </p><p>Please send comments about this document to
<a href="mailto:www-forms-editor@w3.org">www-forms-editor@w3.org</a>.
(with <a href="http://lists.w3.org/Archives/Public/www-forms-editor/">public archive</a>).
Please send discussion email to <a href="mailto:www-forms@w3.org">www-forms@w3.org</a>
(with <a href="http://lists.w3.org/Archives/Public/www-forms/">public archive</a>).</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/32219/status">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="#intro">About the XForms Specification</a><br>
1.1 <a href="#intro-background">Background</a><br>
1.2 <a href="#intro-reading">Reading the Specification</a><br>
1.3 <a href="#intro-org">How the Specification is Organized</a><br>
1.4 <a href="#intro-conventions">Documentation Conventions</a><br>
1.5 <a href="#intro-diffs">Differences between XForms 1.1 and XForms 1.0</a><br>
1.5.1 <a href="#intro-diffs-model-instance">Model and Instance</a><br>
1.5.2 <a href="#intro-diffs-submission">Enhanced Submissions</a><br>
1.5.3 <a href="#intro-diffs-datatypes-mips">Datatypes and Model Item Properties</a><br>
1.5.4 <a href="#intro-diffs-xpath">Functions and XPath Expressions</a><br>
1.5.5 <a href="#intro-diffs-ui">User Interface</a><br>
1.5.6 <a href="#intro-diffs-actions">Actions and Events</a><br>
2 <a href="#concepts"> Introduction to XForms </a><br>
2.1 <a href="#concepts-xhtml">An Example</a><br>
2.2 <a href="#concepts-xml-instance-data">Providing XML Instance Data</a><br>
2.3 <a href="#concepts-model">Constraining Values</a><br>
2.4 <a href="#concepts-multiple">Multiple Forms per Document</a><br>
3 <a href="#structure">Document Structure</a><br>
3.1 <a href="#structure-namespace">Namespace for XForms</a><br>
3.2 <a href="#structure-attrs">XForms Core Attribute Collections</a><br>
3.2.1 <a href="#structure-attrs-common">Common Attributes</a><br>
3.2.2 <a href="#structure-attrs-link">Linking Attributes</a><br>
3.2.3 <a href="#structure-attrs-single-node">Single-Node Binding Attributes</a><br>
3.2.4 <a href="#structure-attrs-nodeset">Node-Set Binding Attributes</a><br>
3.2.5 <a href="#structure-attrs-mip">Model Item Property Attributes</a><br>
3.3 <a href="#structure-abstract">The XForms Core Module</a><br>
3.3.1 <a href="#structure-model">The model Element</a><br>
3.3.2 <a href="#structure-model-instance">The instance Element</a><br>
3.3.3 <a href="#structure-model-submission">The submission Element</a><br>
3.3.4 <a href="#structure-bind-element">The bind Element</a><br>
3.4 <a href="#module-extension">The XForms Extension Module</a><br>
3.4.1 <a href="#structure-extension">The extension Element</a><br>
3.5 <a href="#module-mustUnderstand">The XForms MustUnderstand Module</a><br>
4 <a href="#rpm">Processing Model</a><br>
4.1 <a href="#rpm-events">Events Overview</a><br>
4.2 <a href="#rpm-init">Initialization Events</a><br>
4.2.1 <a href="#evt-modelConstruct">The xforms-model-construct Event</a><br>
4.2.2 <a href="#evt-modelConstructDone">The xforms-model-construct-done Event</a><br>
4.2.3 <a href="#evt-ready">The xforms-ready Event</a><br>
4.2.4 <a href="#evt-modelDestruct">The xforms-model-destruct Event</a><br>
4.3 <a href="#rpm-interaction">Interaction Events</a><br>
4.3.1 <a href="#evt-rebuild">The xforms-rebuild Event</a><br>
4.3.2 <a href="#evt-recalculate">The xforms-recalculate Event</a><br>
4.3.3 <a href="#evt-revalidate">The xforms-revalidate Event</a><br>
4.3.4 <a href="#evt-refresh">The xforms-refresh Event</a><br>
4.3.5 <a href="#evt-reset">The xforms-reset Event</a><br>
4.3.6 <a href="#evt-next">The xforms-next and xforms-previous Events</a><br>
4.3.7 <a href="#evt-focus">The xforms-focus Event</a><br>
4.3.8 <a href="#evt-help">The xforms-help and xforms-hint Events</a><br>
4.3.9 <a href="#evt-submit">The xforms-submit Event</a><br>
4.3.10 <a href="#evt-submit-serialize">The xforms-submit-serialize Event</a><br>
4.4 <a href="#evt-notify">Notification Events</a><br>
4.4.1 <a href="#evt-insert">The xforms-insert Event</a><br>
4.4.2 <a href="#evt-delete">The xforms-delete Event</a><br>
4.4.3 <a href="#evt-valueChanged">The xforms-value-changed Event</a><br>
4.4.4 <a href="#evt-valid">The xforms-valid Event</a><br>
4.4.5 <a href="#evt-invalid">The xforms-invalid Event</a><br>
4.4.6 <a href="#evt-readonly">The xforms-readonly Event</a><br>
4.4.7 <a href="#evt-readwrite">The xforms-readwrite Event</a><br>
4.4.8 <a href="#evt-required">The xforms-required Event</a><br>
4.4.9 <a href="#evt-optional">The xforms-optional Event</a><br>
4.4.10 <a href="#evt-enabled">The xforms-enabled Event</a><br>
4.4.11 <a href="#evt-disabled">The xforms-disabled Event</a><br>
4.4.12 <a href="#evt-activate">The DOMActivate Event</a><br>
4.4.13 <a href="#evt-DOMFocusIn">The DOMFocusIn Event</a><br>
4.4.14 <a href="#evt-DOMFocusOut">The DOMFocusOut Event</a><br>
4.4.15 <a href="#evt-select">The xforms-select and xforms-deselect Events</a><br>
4.4.16 <a href="#evt-in-range">The xforms-in-range Event</a><br>
4.4.17 <a href="#evt-out-of-range">The xforms-out-of-range Event</a><br>
4.4.18 <a href="#evt-scroll">The xforms-scroll-first and xforms-scroll-last Events</a><br>
4.4.19 <a href="#evt-submit-done">The xforms-submit-done Event</a><br>
4.5 <a href="#rpm-errors">Error Indications</a><br>
4.5.1 <a href="#evt-bindingException">The xforms-binding-exception Event</a><br>
4.5.2 <a href="#evt-computeException">The xforms-compute-exception Event</a><br>
4.5.3 <a href="#evt-versionException">The xforms-version-exception Event</a><br>
4.5.4 <a href="#evt-linkException">The xforms-link-exception Event</a><br>
4.5.5 <a href="#evt-output-error">The xforms-output-error Event</a><br>
4.5.6 <a href="#evt-submit-error">The xforms-submit-error Event</a><br>
4.6 <a href="#rpm-event-sequences">Event Sequencing</a><br>
4.6.1 <a href="#sequence-for-input">For input, secret, textarea, range, or upload Controls</a><br>
4.6.2 <a href="#sequence-for-output">For output Controls</a><br>
4.6.3 <a href="#sequence-for-select">For select or select1 Controls</a><br>
4.6.4 <a href="#sequence-for-trigger">For trigger Controls</a><br>
4.6.5 <a href="#sequence-for-submit">For submit Controls</a><br>
4.6.6 <a href="#rpm-event-seq-swovc">Sequence: Selection Without Value Change</a><br>
4.6.7 <a href="#rpm-event-seq-vc">Sequence: Value Change</a><br>
4.6.8 <a href="#rpm-event-seq-aat">Sequence: Activating a Trigger</a><br>
4.6.9 <a href="#rpm-event-seq-s">Sequence: Submission</a><br>
4.7 <a href="#idref-resolve">Resolving ID References in XForms</a><br>
4.7.1 <a href="#idref-resolve-repeat">References to Elements within a repeat Element</a><br>
4.7.2 <a href="#idref-resolve-bind">References to Elements within a bind Element</a><br>
4.8 <a href="#expr-instance">DOM Interface for Access to Instance Data</a><br>
4.8.1 <a href="#idl-getInstanceDocument">The getInstanceDocument() Method</a><br>
4.8.2 <a href="#idl-rebuild">The rebuild() Method</a><br>
4.8.3 <a href="#idl-recalculate">The recalculate() Method</a><br>
4.8.4 <a href="#idl-revalidate">The revalidate() Method</a><br>
4.8.5 <a href="#idl-refresh">The refresh() Method</a><br>
4.9 <a href="#expr-hasfeature">Feature string for the hasFeature method call</a><br>
5 <a href="#datatypes">Datatypes</a><br>
5.1 <a href="#datatypes-schema">XML Schema Built-in Datatypes</a><br>
5.2 <a href="#datatypes-xforms">XForms Datatypes</a><br>
5.2.1 <a href="#empty-content-types">Additional XForms Datatypes to Allow Empty Content</a><br>
5.2.2 <a href="#dt-listItem">xforms:listItem</a><br>
5.2.3 <a href="#dt-listItems">xforms:listItems</a><br>
5.2.4 <a href="#dt-dayTimeDuration">xforms:dayTimeDuration</a><br>
5.2.5 <a href="#dt-yearMonthDuration">xforms:yearMonthDuration</a><br>
5.2.6 <a href="#dt-email">xforms:email</a><br>
5.2.7 <a href="#dt-card-number">xforms:card-number</a><br>
6 <a href="#model">Model Item Properties</a><br>
6.1 <a href="#model-xformsconstraints">Model Item Property Definitions</a><br>
6.1.1 <a href="#model-prop-type">The type Property</a><br>
6.1.2 <a href="#model-prop-readOnly">The readonly Property</a><br>
6.1.3 <a href="#model-prop-required">The required Property</a><br>
6.1.4 <a href="#model-prop-relevant">The relevant Property</a><br>
6.1.5 <a href="#model-prop-calculate">The calculate Property</a><br>
6.1.6 <a href="#model-prop-constraint">The constraint Property</a><br>
6.1.7 <a href="#model-prop-p3ptype">The p3ptype Property</a><br>
6.2 <a href="#model-using">Schema Constraints</a><br>
6.2.1 <a href="#model-using-atomic">Atomic Datatype</a><br>
7 <a href="#expr">XPath Expressions in XForms</a><br>
7.1 <a href="#expr-datatypes">XPath Datatypes</a><br>
7.2 <a href="#expr-eval">Evaluation Context</a><br>
7.3 <a href="#expr-dependencies">References, Dependencies, and Dynamic Dependencies</a><br>
7.4 <a href="#expr-expression-categories">Expression Categories</a><br>
7.4.1 <a href="#expr-model-binding-expression-computed-expression">Model Binding Expressions and Computed Expressions</a><br>
7.4.2 <a href="#expr-actions-submissions">Expressions in Actions and Submissions</a><br>
7.4.3 <a href="#expr-ui-expressions">UI Expressions</a><br>
7.4.4 <a href="#ui-binding-foreign">UI Binding in other XML vocabularies</a><br>
7.4.5 <a href="#ui-binding-examples">Binding Examples</a><br>
7.5 <a href="#expr-lib">The XForms Function Library</a><br>
7.6 <a href="#expr-lib-bool">Boolean Functions</a><br>
7.6.1 <a href="#fn-boolean-from-string">The boolean-from-string() Function</a><br>
7.6.2 <a href="#fn-is-card-number">The is-card-number() Function</a><br>
7.7 <a href="#expr-lib-num">Number Functions</a><br>
7.7.1 <a href="#fn-avg">The avg() Function</a><br>
7.7.2 <a href="#fn-min">The min() Function</a><br>
7.7.3 <a href="#fn-max">The max() Function</a><br>
7.7.4 <a href="#fn-count-non-empty">The count-non-empty() Function</a><br>
7.7.5 <a href="#fn-index">The index() Function</a><br>
7.7.6 <a href="#fn-power">The power() Function</a><br>
7.7.7 <a href="#fn-random">The random() Function</a><br>
7.7.8 <a href="#fn-compare">The compare() Function</a><br>
7.8 <a href="#expr-lib-string">String Functions</a><br>
7.8.1 <a href="#fn-if">The if() Function</a><br>
7.8.2 <a href="#fn-property">The property() Function</a><br>
7.8.3 <a href="#fn-digest">The digest() Function</a><br>
7.8.4 <a href="#fn-hmac">The hmac() Function</a><br>
7.9 <a href="#expr-lib-date">Date and Time Functions</a><br>
7.9.1 <a href="#fn-local-date">The local-date() Function</a><br>
7.9.2 <a href="#fn-local-dateTime">The local-dateTime() Function</a><br>
7.9.3 <a href="#fn-now">The now() Function</a><br>
7.9.4 <a href="#fn-days-from-date">The days-from-date() Function</a><br>
7.9.5 <a href="#fn-days-to-date">The days-to-date() Function</a><br>
7.9.6 <a href="#fn-seconds-from-dateTime">The seconds-from-dateTime() Function</a><br>
7.9.7 <a href="#fn-seconds-to-dateTime">The seconds-to-dateTime() Function</a><br>
7.9.8 <a href="#fn-adjust-dateTime-to-timezone">The adjust-dateTime-to-timezone() Function</a><br>
7.9.9 <a href="#fn-seconds">The seconds() Function</a><br>
7.9.10 <a href="#fn-months">The months() Function</a><br>
7.10 <a href="#expr-lib-nodeset">Node-set Functions</a><br>
7.10.1 <a href="#fn-instance">The instance() Function</a><br>
7.10.2 <a href="#fn-current">The current() Function</a><br>
7.10.3 <a href="#fn-id">The id() Function</a><br>
7.10.4 <a href="#fn-context">The context() Function</a><br>
7.11 <a href="#expr-lib-object">Object Functions</a><br>
7.11.1 <a href="#fn-choose">The choose() Function</a><br>
7.11.2 <a href="#fn-event">The event() Function</a><br>
7.12 <a href="#expr-lib-extension">Extension Functions</a><br>
8 <a href="#controls">Core Form Controls</a><br>
8.1 <a href="#N74868">The XForms Core Form Controls Module</a><br>
8.1.1 <a href="#ui-processing">Implementation Requirements Common to All Form Controls</a><br>
8.1.2 <a href="#ui-input">The input Element</a><br>
8.1.3 <a href="#ui-secret">The secret Element</a><br>
8.1.4 <a href="#ui-textarea">The textarea Element</a><br>
8.1.5 <a href="#ui-output">The output Element</a><br>
8.1.5.1 <a href="#ui-output-mediatype">The mediatype Element (for output)</a><br>
8.1.6 <a href="#ui-upload">The upload Element</a><br>
8.1.6.1 <a href="#ui-upload-filename">The filename Element</a><br>
8.1.6.2 <a href="#ui-upload-mediatype">The mediatype Element (for upload)</a><br>
8.1.7 <a href="#ui-range">The range Element</a><br>
8.1.8 <a href="#ui-trigger">The trigger Element</a><br>
8.1.9 <a href="#ui-submit">The submit Element</a><br>
8.1.10 <a href="#ui-selectMany">The select Element</a><br>
8.1.11 <a href="#ui-selectOne">The select1 Element</a><br>
8.2 <a href="#ui-commonelems">Common Support Elements</a><br>
8.2.1 <a href="#ui-commonelems-label">The label Element</a><br>
8.2.2 <a href="#ui-commonelems-help">The help Element</a><br>
8.2.3 <a href="#ui-commonelems-hint">The hint Element</a><br>
8.2.4 <a href="#ui-commonelems-alert">The alert Element</a><br>
8.3 <a href="#ui-selection-commonelems">Common Markup for Selection Controls</a><br>
8.3.1 <a href="#ui-selection-commonelems-choices">The choices Element</a><br>
8.3.2 <a href="#ui-selection-commonelems-item">The item Element</a><br>
8.3.3 <a href="#ui-selection-commonelems-value">The value Element</a><br>
9 <a href="#ui">Container Form Controls</a><br>
9.1 <a href="#ui-group-module">The XForms Group Module</a><br>
9.1.1 <a href="#ui-group">The group Element</a><br>
9.2 <a href="#ui-switch-module">The XForms Switch Module</a><br>
9.2.1 <a href="#ui-switch">The switch Element</a><br>
9.2.2 <a href="#ui-case">The case Element</a><br>
9.3 <a href="#ui-repeat-module">The XForms Repeat Module</a><br>
9.3.1 <a href="#ui-repeat">The repeat Element</a><br>
9.3.2 <a href="#ui-nested-repeats">Nested Repeats</a><br>
9.3.3 <a href="#ui-repeat-processing">Repeat Processing</a><br>
9.3.4 <a href="#ui-repeat-ui">User Interface Interaction</a><br>
9.3.5 <a href="#ui.repeat.via.attrs">Creating Repeating Structures Via Attributes</a><br>
9.3.6 <a href="#ui-selection-commonelems-itemset">The itemset Element</a><br>
9.3.7 <a href="#ui-selection-commonelems-copy">The copy Element</a><br>
10 <a href="#action">XForms Actions</a><br>
10.1 <a href="#action-action">The action Element</a><br>
10.2 <a href="#action-setvalue">The setvalue Element</a><br>
10.3 <a href="#action-insert">The insert Element</a><br>
10.4 <a href="#action-delete">The delete Element</a><br>
10.5 <a href="#action-setindex">The setindex Element</a><br>
10.6 <a href="#action-toggle">The toggle Element</a><br>
10.6.1 <a href="#action-toggle-case">The case Element Child of the toggle Element</a><br>
10.7 <a href="#action-setfocus">The setfocus Element</a><br>
10.7.1 <a href="#action-setfocus-control">The control Element Child of the setfocus Element</a><br>
10.8 <a href="#action-dispatch">The dispatch Element</a><br>
10.8.1 <a href="#action-dispatch-name">The name Child Element</a><br>
10.8.2 <a href="#action-dispatch-targetid">The targetid Child Element</a><br>
10.8.3 <a href="#action-dispatch-delay">The delay Child Element</a><br>
10.9 <a href="#action-rebuild">The rebuild Element</a><br>
10.10 <a href="#action-recalculate">The recalculate Element</a><br>
10.11 <a href="#action-revalidate">The revalidate Element</a><br>
10.12 <a href="#action-refresh">The refresh Element</a><br>
10.13 <a href="#action-reset">The reset Element</a><br>
10.14 <a href="#action-load">The load Element</a><br>
10.14.1 <a href="#action-load-resource">The resource Element child of load</a><br>
10.15 <a href="#action-send">The send Element</a><br>
10.16 <a href="#action-message">The message Element</a><br>
10.17 <a href="#action-conditional">Conditional Execution of XForms Actions</a><br>
10.18 <a href="#action-iterated">Iteration of XForms Actions</a><br>
10.19 <a href="#action-other">Actions from Other Modules</a><br>
11 <a href="#submit">The XForms Submission Module</a><br>
11.1 <a href="#submit-submission-element">The submission Element</a><br>
11.2 <a href="#submit-evt-submit">The xforms-submit Event</a><br>
11.3 <a href="#submit-evt-submit-serialize">The xforms-submit-serialize Event</a><br>
11.4 <a href="#submit-evt-submit-done">The xforms-submit-done Event</a><br>
11.5 <a href="#submit-evt-submit-error">The xforms-submit-error Event</a><br>
11.6 <a href="#submit-resource">The Submission Resource</a><br>
11.6.1 <a href="#submit-resource-elem">The resource Element</a><br>
11.7 <a href="#submit-method">The Submission Method</a><br>
11.7.1 <a href="#submit-method-elem">The method Element</a><br>
11.8 <a href="#submit-header">The header Element</a><br>
11.8.1 <a href="#submit-header-name">The name Element</a><br>
11.8.2 <a href="#submit-header-value">The value Element</a><br>
11.9 <a href="#submit-options">Submission Options</a><br>
11.9.1 <a href="#submit-get">The get Submission Method</a><br>
11.9.2 <a href="#submit-post">The post, multipart-post, form-data-post, and urlencoded-post Submission Methods</a><br>
11.9.3 <a href="#submit-put">The put Submission Method</a><br>
11.9.4 <a href="#submit-delete">The delete Submission Method</a><br>
11.9.5 <a href="#serialize-xml">Serialization as application/xml</a><br>
11.9.6 <a href="#serialize-multipart">Serialization as multipart/related</a><br>
11.9.7 <a href="#serialize-form-data">Serialization as multipart/form-data</a><br>
11.9.8 <a href="#serialize-urlencode">Serialization as application/x-www-form-urlencoded</a><br>
11.10 <a href="#submit-data-replacement">Replacing Data with the Submission Response</a><br>
11.11 <a href="#SOAP">Integration with SOAP</a><br>
11.11.1 <a href="#SOAP-envelope">Representation of SOAP Envelope</a><br>
11.11.2 <a href="#SOAP-mediatype">Indicating a SOAP submission</a><br>
11.11.3 <a href="#SOAP-HTTP-Binding">SOAP HTTP Binding</a><br>
11.11.4 <a href="#SOAP-response">Handling the SOAP Response</a><br>
12 <a href="#conform">Conformance</a><br>
12.1 <a href="#conform-desc-documents">Conforming XForms Documents</a><br>
12.2 <a href="#conform-desc-generators">Conforming XForms Generators</a><br>
12.3 <a href="#xforms-base-tech">Base Technologies for XForms Processors</a><br>
12.4 <a href="#conform-levels">Conformance Levels</a><br>
12.4.1 <a href="#conform-levels-model">XForms Model</a><br>
12.4.2 <a href="#conform-levels-full">XForms Full</a><br>
13 <a href="#terms">Glossary Of Terms</a><br>
</p>
<h3><a name="mainsection" id="mainsection"></a>Appendices</h3><p class="toc">A <a href="#references">References</a><br>
A.1 <a href="#references-norm">Normative References</a><br>
A.2 <a href="#references-inform">Informative References</a><br>
B <a href="#data-mutation-patterns">Patterns for Data Mutations</a><br>
B.1 <a href="#data-mutation-patterns-prepend-element">Prepend Element Copy</a><br>
B.2 <a href="#data-mutation-patterns-append-element">Append Element Copy</a><br>
B.3 <a href="#data-mutation-patterns-duplicate-element">Duplicate Element</a><br>
B.4 <a href="#data-mutation-patterns-set-attribute">Set Attribute</a><br>
B.5 <a href="#data-mutation-patterns-remove-element">Remove Element</a><br>
B.6 <a href="#data-mutation-patterns-remove-attribute">Remove Attribute</a><br>
B.7 <a href="#data-mutation-patterns-remove-nodeset">Remove Nodeset</a><br>
B.8 <a href="#data-mutation-patterns-copy-nodeset">Copy Nodeset</a><br>
B.9 <a href="#data-mutation-patterns-copy-attributelist">Copy Attribute List</a><br>
B.10 <a href="#data-mutation-patterns-replace-element">Replace Element</a><br>
B.11 <a href="#data-mutation-patterns-replace-attribute">Replace Attribute</a><br>
B.12 <a href="#data-mutation-patterns-replace-instance">Replace Instance with Insert</a><br>
B.13 <a href="#data-mutation-patterns-move-element">Move Element</a><br>
B.14 <a href="#data-mutation-patterns-move-attribute">Move Attribute</a><br>
B.15 <a href="#data-mutation-patterns-insert-arbitrary">Insert Element into Non-Contiguous, Heterogeneous Nodeset</a><br>
C <a href="#recalc">Recalculation Sequence Algorithm</a><br>
C.1 <a href="#rpm-processing-recalc-mddg">Details on Creating the Master Dependency Directed Graph</a><br>
C.2 <a href="#rpm-processing-recalc-pds">Details on Creating the Pertinent Dependency Subgraph</a><br>
C.3 <a href="#rpm-processing-recalc-compute">Details on Computing Individual Vertices</a><br>
C.4 <a href="#rpm-processing-recalc-example">Example of Calculation Processing</a><br>
D <a href="#privsec">Privacy Considerations</a><br>
D.1 <a href="#N89295">Using P3P with XForms</a><br>
E <a href="#mode">Input Modes</a> (Non-Normative)<br>
E.1 <a href="#mode-syntax">inputmode Attribute Value Syntax</a><br>
E.2 <a href="#mode-ua-behavior">User Agent Behavior</a><br>
E.3 <a href="#mode-values">List of Tokens</a><br>
E.3.1 <a href="#mode-scripts">Script Tokens</a><br>
E.3.2 <a href="#mode-modifiers">Modifier Tokens</a><br>
E.4 <a href="#mode-patterns">Relationship to XML Schema pattern facets</a><br>
E.5 <a href="#mode-examples">Examples</a><br>
F <a href="#schema">Schema for XForms</a> (Non-Normative)<br>
F.1 <a href="#schema-events">Schema for XML Events</a><br>
G <a href="#style">XForms and Styling</a> (Non-Normative)<br>
G.1 <a href="#N90079">Pseudo-classes</a><br>
G.2 <a href="#N90219">Pseudo-elements</a><br>
G.3 <a href="#N90304">Examples</a><br>
H <a href="#xforms-examples">Complete XForms Examples</a> (Non-Normative)<br>
H.1 <a href="#xforms-in-xhtml-00">XForms in XHTML</a><br>
H.2 <a href="#bookmarks-in-x-smiles">Editing Hierarchical Bookmarks Using XForms</a><br>
H.3 <a href="#N90418">Survey Using XForms and SVG</a><br>
I <a href="#acks">Acknowledgements</a> (Non-Normative)<br>
J <a href="#prod-notes">Production Notes</a> (Non-Normative)<br>
</p></div><hr><div class="body"><div class="div1">
<h2><a name="intro" id="intro"></a>1 About the XForms Specification</h2><div class="div2">
<h3><a name="intro-background" id="intro-background"></a>1.1 Background</h3><p>Forms are an important part of the Web, and they continue to be the primary means for enabling interactive Web applications. Web applications and electronic commerce solutions have sparked the demand for better Web forms with richer interactions. XForms is the response to this demand, and provides a new platform-independent markup language for online interaction between a person (through an <a title="XForms Processor" href="#def-XForms-Processor">XForms Processor</a>) and another, usually remote, agent. XForms are the successor to HTML forms, and benefit from the lessons learned from HTML forms. </p><p>Further background information on XForms can be found at <a href="http://www.w3.org/MarkUp/Forms/">http://www.w3.org/MarkUp/Forms</a>. </p></div><div class="div2">
<h3><a name="intro-reading" id="intro-reading"></a>1.2 Reading the Specification</h3><p>This specification has been written with various types of readers in mind—in particular XForms authors and XForms implementors. We hope the specification will provide authors with the tools they need to write efficient, attractive and accessible documents without overexposing them to the XForms implementation details. Implementors, however, should find all they need to build conforming XForms Processors. The specification begins with a general presentation of XForms before specifying the technical details of the various XForms components. </p><p>The specification has been written with various modes of presentation in mind. In case of a discrepancy, the online electronic version is considered the authoritative version of the document. </p><p>With regard to implementing behaviors defined for XForms content herein,
this document uses the terms <b>must</b>, <b>must not</b>, <b>required</b>, <b>shall</b>, <b>shall not</b>, <b>recommended</b>, <b>should</b>, <b>should not</b>,
<b>may</b>, and <b>optional</b> in accord with <a href="#ref-rfc-2119">[RFC 2119]</a>.
Generally, the elements, attributes, functions and behaviors of XForms content defined in this specification are required to implement unless explicitly specified otherwise.
The term <b>author-optional</b>, when applied to a content item such as an element, attribute, or function parameter, indicates to form authors that they may omit the content item and obtain the default behavior. The term author-optional is orthogonal to the conformance status (required, recommended, or optional) of the content item.
</p></div><div class="div2">
<h3><a name="intro-org" id="intro-org"></a>1.3 How the Specification is Organized</h3><p>The specification is organized into the following chapters: </p><dl><dt class="label">Chapters 1 and 2</dt><dd><p>An introduction to XForms. The introduction outlines the design principles and includes a brief tutorial on XForms. </p></dd><dt class="label">Chapters 3 and up</dt><dd><p>XForms reference manual. The bulk of the reference manual consists of the specification of XForms. This reference defines XForms and how XForms Processors must interpret the various components in order to claim conformance. </p></dd><dt class="label">Appendixes</dt><dd><p>Appendixes contain an XML Schema description of XForms, references, examples, and other useful information. </p></dd></dl></div><div class="div2">
<h3><a name="intro-conventions" id="intro-conventions"></a>1.4 Documentation Conventions</h3><p>Throughout this document, the following namespace prefixes and corresponding namespace identifiers are used: </p><blockquote><p><b>xforms:</b> The XForms namespace, e.g. <code>http://www.w3.org/2002/xforms</code> (see <a href="#structure-namespace"><b>3.1 Namespace for XForms</b></a>)<br><b>html:</b> An XHTML namespace, e.g. <code>http://www.w3.org/1999/xhtml</code> (see <a href="#ref-xhtml-1.0">[XHTML 1.0]</a>)<br><b>xs:</b> The XML Schema namespace <code>http://www.w3.org/2001/XMLSchema</code> (see <a href="#ref-xschema-1">[XML Schema part 1]</a>)<br><b>xsd:</b> The XML Schema namespace <code>http://www.w3.org/2001/XMLSchema</code> (see <a href="#ref-xschema-2">[XML Schema part 2]</a>)<br><b>xsi:</b> The XML Schema for instances namespace <code>http://www.w3.org/2001/XMLSchema-instance</code> (see <a href="#ref-xschema-1">[XML Schema part 1]</a>)<br><b>ev:</b> The XML Events namespace <code>http://www.w3.org/2001/xml-events</code> (see <a href="#ref-xml-events">[XML Events]</a>)<br><b>my:</b> Any user defined namespace</p></blockquote><p>This is only a convention; any namespace prefix may be used in practice. </p><p>The following typographical conventions are used to present technical material in this document. </p><p>Official terms are defined in the following manner: [<a name="def-term" id="def-term" title="term">Definition</a>: You can find most <b>terms</b> in chapter <a href="#terms"><b>13 Glossary Of Terms</b></a>].
Links to <b>term</b>s may be specially highlighted where necessary. </p><p>The XML representations of various elements within XForms are presented using the syntax for Abstract Modules in XHTML Modularization <a href="#ref-xhtml-mod">[XHTML Modularization]</a>.</p><p>Examples are set off typographically:</p><div class="exampleOuter">
<div class="exampleHead">Example item</div><div class="exampleInner"><pre>Example Item</pre></div></div><p>References to external documents appear as follows: <a href="#ref-example">[Sample Reference]</a> with links to the references section of this document. </p><dl><dt class="label"><a name="ref-example" id="ref-example"></a>Sample Reference</dt><dd><cite>Reference</cite> - linked to from above.</dd></dl><p>The following typesetting convention is used for additional commentary: </p><div class="note"><p class="prefix"><b>Note:</b></p><p>A gentle explanation to readers. </p></div><table border="1" summary="Editorial note: Editorial Note Name"><tr><td align="left" valign="top" width="50%"><b>Editorial note: Editorial Note Name</b></td><td align="right" valign="top" width="50%"> </td></tr><tr><td colspan="2" align="left" valign="top"> Editorial commentary, not intended for final publication.</td></tr></table><div class="issue"><p class="prefix"><a name="sample-implementation-issue" id="sample-implementation-issue"></a><b>Issue (sample-implementation-issue):</b></p><p class="prefix"><b>Issue-Name</b></p><p> A specific issue for which input from implementors is requested, for example as part of the Candidate Recommendation phase. </p><p class="prefix"><b>Resolution:</b></p><p>None recorded.</p></div></div><div class="div2">
<h3><a name="intro-diffs" id="intro-diffs"></a>1.5 Differences between XForms 1.1 and XForms 1.0</h3><p>This informative section provides an overview of the new features and changed behaviors available in XForms 1.1.</p><div class="div3">
<h4><a name="intro-diffs-model-instance" id="intro-diffs-model-instance"></a>1.5.1 Model and Instance</h4><p>The <code>model</code> element now must support a <code>version</code> attribute to help authors bridge the transition between XForms 1.0 to XForms 1.1.</p><p>The <code>instance</code> element now has a <code>resource</code> attribute that allows instance data to be obtained from a URI only if the instance
does not already contain data. By contrast, the <code>src</code> attribute overrides the inline content in an <code>instance</code>. The <code>resource</code>
attribute is more useful in systems that must support save and reload of XForms-based documents.</p></div><div class="div3">
<h4><a name="intro-diffs-submission" id="intro-diffs-submission"></a>1.5.2 Enhanced Submissions</h4><p>The <code>submission</code> element offers many new features that allow significantly improved data communications capabilities for XForms, including:</p><ul><li><p>Access to SOAP-based web services, RESTful services, ATOM-based services, and non-XML services</p></li><li><p>Improved control over submission processing and serialization</p></li><li><p>Ability to control the submission URI and headers with instance data</p></li><li><p>Targetted instance data replacement capabilities</p></li></ul><p>The <code>submission</code> element now has a <code>resource</code> attribute and <code>resource</code> child element that allow the instance data to dynamically control
the submission URI. As a result, the <code>action</code> attribute is deprecated, though still supported in XForms 1.1.</p><p>In XForms 1.0, submissions were already more capable than AJAX, based on the ability to automatically update a form with results from HTTP and HTTPS services, including RSS feeds.
In XForms 1.1, the <code>method</code> attribute now supports <code>delete</code> as well as any other QName.
The <code>method</code> child element also allows the method to be dynamically controlled by instance data.
Submission headers can now be added, and even dynamically controlled by instance data, using the <code>header</code> child element.
These features complete the capabilities needed for ATOM and RESTful services. XForms 1.1 also offers special submission header behavior through the <code>mediatype</code>
attribute to allow communications with SOAP 1.1 and 1.2 web services.</p><p>The <code>submission</code> element now supports attributes <code>relevant</code> and <code>validate</code>, which allow form authors to turn off instance data relevance pruning
and validity checking. This allows <code>submission</code> to be used to save and reload unfinished data on a server or the local file system.</p><p>The <code>submission</code> element now supports the <code>targetref</code> attribute, which allows partial instance replacement by identifying a node to be replaced with the
submission result. The <code>replace</code> attribute also now supports a <code>text</code> setting, which allows the content of the target node, rather than the target node itself, to be
replaced with a non-XML (text) submission result.</p><p>The <code>submission</code> element now also supports the <code>xforms-submit-serialize</code> event, which allows the form author to provide a custom serialization,
such as plain text or the full XForms document, as the submission data. The <code>serialization</code> attribute also provides increased control over the submission data
serialization, including the setting <code>none</code>, which allows <code>submission</code> to be used for simple URI activation.</p><p>The <code>xforms-submit-done</code> and <code>xforms-submit-error</code> events now have event context information available that provide more information
about both successful and failed submissions, such as the response headers of successful submissions and the reason code for failed submissions.</p><p>Finally, over a dozen new examples have been added to illustrate <code>submission</code> usage.</p></div><div class="div3">
<h4><a name="intro-diffs-datatypes-mips" id="intro-diffs-datatypes-mips"></a>1.5.3 Datatypes and Model Item Properties</h4><p>XForms 1.1 now offers <code>email</code> and <code>card-number</code> datatypes so form authors can easily validate email address and credit card number input values.</p><p>To further simplify authoring, XForms 1.1 now also provides its own definitions of the XML Schema datatypes, except the XForms versions permit the empty string. Allowing empty
string means that input like an age or a birthdate can be collected without being required input for validity (an empty string is not in the lexical space of XML schema datatypes like
<code>xsd:positiveInteger</code> and <code>xsd:date</code>). If an input is required, the form author can still use the XForms versions of the datatypes in combination with the
<code>required</code> model item property. The XForms datatypes also aid authoring by allowing type definitions to omit namespace qualification, e.g. <code>type="date"</code>
rather than <code>type="xsd:date"</code>, if the default namespace of the model is set to XForms. </p><p>The <code>readonly</code> model item property was defined to be an inviolate property of the data model. This means it cannot be violated by anything outside of the model item property system,
including not just form controls but also XForms actions and instance data access from the DOM interface.</p></div><div class="div3">
<h4><a name="intro-diffs-xpath" id="intro-diffs-xpath"></a>1.5.4 Functions and XPath Expressions</h4><p>XForms 1.1 now contains many new functions that can be used in <code>calculate</code> and other XPath expressions to enable numerous features, including:</p><ul><li><p>basic date math and working with local dates and times: <code>local-date()</code>, <code>local-dateTime()</code>,
<code>days-to-date()</code>, <code>seconds-to-dateTime()</code>, and <code>adjust-dateTime-to-timezone()</code></p></li><li><p>working with tabular data and parallel lists: <code>current()</code>, <code>choose()</code> and <code>context()</code> </p></li><li><p>basic security capabilities: <code>digest()</code>, <code>hmac()</code>, and <code>random()</code></p></li><li><p>improved numeric and string processing: <code>power()</code>, <code>is-card-number()</code>, and <code>compare()</code></p></li><li><p>search across instances of a model: two parameter <code>id()</code> function</p></li><li><p>access to context information added to many XForms events: <code>event()</code></p></li></ul><p>The specification now provides a better classification of binding expression types as well as a more rigorous definition for dynamic dependencies.
These definitions ensure that XPath expressions in form controls and actions which use the <code>index()</code> are automatically re-evaluated when appropriate.</p><p>Due to the addition of the <code>choose()</code> function, the <code>if()</code> function is still supported but deprecated as futureproofing against the
conflict with the <code>if</code> keyword in XPath 2.0.</p></div><div class="div3">
<h4><a name="intro-diffs-ui" id="intro-diffs-ui"></a>1.5.5 User Interface</h4><p>The behavioral description common to all form controls has been improved to indicate default layout styling and rendering requirements for required data.</p><p>The <code>output</code> form control has been improved to render non-text mediatypes, particularly images, obtained from instance data.</p><p>An example was added to show the use of a <code>DOMActivate</code> handler on an <code>input</code> to automatically initiate a submission
once a user enters and commits input, such as a search query.</p><p>The processing model and implementation requirements on selection controls were elaborated upon to ensure consistency of behavior between
selection data expressed as textual lists versus element lists. </p><p>The ability to create wizard-like interfaces with dynamically available form controls has been improved. Details are in the description of improvements to actions.</p><p>The specification provides more rigorous definitions and classifications of form controls, which have been applied throughout the specification to ensure
proper support of varied features related to form controls, such as events, applicability of model item properties, and focusability.</p><p>The XForms repeat has been made more powerful and flexible. The specification now provides rigorous definitions and processing model descriptions for
repeated content, including creation, destruction, IDREF resolution and event flow between repeated content and the containing content (which may itself be repeated).
The <code>repeat</code> is now capable of operating over any nodeset, not just an homogeneous collection. A formal processing model for repeat index handling has been defined. </p></div><div class="div3">
<h4><a name="intro-diffs-actions" id="intro-diffs-actions"></a>1.5.6 Actions and Events</h4><p>The <code>insert</code> and <code>delete</code> actions have been converted from specialized actions associated with <code>repeat</code> to generalized data insertion and
deletion operations. An entire appendix of 15 examples was added to illustrate this additional capability in detail.</p><p>All XForms actions, as well as sets of actions, can be executed conditionally or iteratively. Combined with the generalized <code>insert</code> and <code>delete</code>,
this means that the information processing power of XForms 1.1 is Turing-complete.</p><p>The <code>dispatch</code> action now allows the event name and target to be specified by instance data. A new attribute, <code>delay</code>, has also been added
to allow an event to be scheduled for dispatch at a later time. Since the event handler for the event can schedule same event for later dispatch, it is possible
in XForms 1.1 to create background daemon tasks.</p><p>The <code>setfocus</code> and <code>toggle</code> have been improved to help with creating wizard interfaces and handling dynamically available content.
The control to focus and the case to select can now be specified by instance data. These actions have also been improved relative to the recalculation processing model.
They now perform deferred updates before their regular processing to ensure the user interface is automatically refreshed. </p><p>As part of the improvement to repeat index management, the <code>setindex</code> action now behaves more like <code>setvalue</code>, which means it
now sets the flags for automatic recalculation, revalidation and user interface refresh. As well, this action now also performs deferred updates before its
regular processing to ensure the user interface is up to date. </p><p>Finally, the <code>setvalue</code> action has been improved due to the addition of the <code>context()</code> function. Now it is possible to express the
<code>value</code> attribute in terms of the same context node used to evaluate the single node binding. This improves the ability to use <code>setvalue</code>
inside of a <code>repeat</code> to set values of instance nodes that are outside of the repeat nodeset based on values that are within the repeat nodeset.</p></div></div></div><div class="div1">
<h2><a name="concepts" id="concepts"></a>2 Introduction to XForms </h2><p>XForms has been designed on the basis of several years' experience with HTML forms. HTML forms have formed the backbone of the e-commerce revolution, and having shown their worth, have also indicated numerous ways they could be improved.</p><p>The primary difference when comparing XForms with HTML forms, apart from XForms being in XML, is the separation of the data being collected from the markup of the controls collecting the individual values. By doing this, it not only makes XForms more tractable by making it clear what is being submitted where, it also eases reuse of forms, since the underlying essential part of a Form is no longer irretrievably bound to the page it is used in.</p><p>A second major difference is that XForms, while designed to be integrated into XHTML, is no longer restricted only to be a part of that language, but may be integrated into any suitable markup language.</p><p>XForms has striven to improve authoring, reuse, internationalization, accessibility, usability, and device independence. Here is a summary of the primary benefits of using XForms:</p><dl><dt class="label">Strong typing</dt><dd><p>Submitted data is strongly typed and can be checked using off-the-shelf tools. This speeds up form filling since it reduces the need for round trips to the server for validation.</p></dd><dt class="label">XML submission</dt><dd><p>This obviates the need for custom server-side logic to marshal the submitted data to the application back-end. The received XML instance document can be directly validated and processed by the application back-end.</p></dd><dt class="label">Existing schema re-use</dt><dd><p>This obviates duplication, and ensures that updating the validation rules as a result of a change in the underlying business logic does not require re-authoring validation constraints within the XForms application.</p></dd><dt class="label">External schema augmentation</dt><dd><p>This enables the XForms author to go beyond the basic set of constraints available from the back-end. Providing such additional constraints as part of the XForms Model enhances the overall usability of the resulting Web application.</p></dd><dt class="label">Internationalization</dt><dd><p>Using XML 1.0 for instance data ensures that the submitted data is internationalization ready.</p></dd><dt class="label">Enhanced accessibility</dt><dd><p>XForms separates content and presentation. User interface controls encapsulate all relevant metadata such as labels, thereby enhancing accessibility of the application when using different modalities. XForms user interface controls are generic and suited for device-independence.</p></dd><dt class="label">Multiple device support</dt><dd><p>The high-level nature of the user interface controls, and the consequent intent-based authoring of the user interface makes it possible to re-target the user interaction to different devices.</p></dd><dt class="label">Less use of scripting</dt><dd><p>By defining XML-based declarative event handlers that cover common use cases, the majority of XForms documents can be statically analyzed, reducing the need for imperative scripts for event handlers.</p></dd></dl><div class="div2">
<h3><a name="concepts-xhtml" id="concepts-xhtml"></a>2.1 An Example</h3><p>In the XForms approach, forms are comprised of a section that describes what the form does, called the <a title="XForms Model" href="#def-XForms-Model">XForms Model</a>, and another section that describes how the form is to be presented.</p><p> Consider a simple electronic commerce form that might be rendered as follows:</p><img src="images/concepts-xhtml.png" alt="screen shot of a graphic rendering"><p>It is clear that we are collecting a value that represents whether cash or a credit card is being used, and if a credit card, its number and expiration date.</p><p>This can be represented in the XForms <code>model</code> element, which in XHTML would typically be contained within the <code>head</code> section:</p><div class="exampleOuter"><div class="exampleInner"><pre><xforms:model>
<xforms:instance>
<ecommerce xmlns="">
<method/>
<number/>
<expiry/>
</ecommerce>
</xforms:instance>
<xforms:submission action="http://example.com/submit" method="post" id="submit" includenamespaceprefixes=""/>
</xforms:model></pre></div></div><p> This simply says that we are collecting three pieces of information (note that we have as yet not said anything about their types), and that they will be submitted using the URL in the <code>action</code> attribute.</p><p>XForms defines a device-neutral, platform-independent set of <a title="form control" href="#def-form-control">form controls</a> suitable for general-purpose use. The controls are <em>bound</em> to the XForms Model via the XForms binding mechanism, in this simple case using the <code>ref</code> attribute on the controls. In XHTML, this markup would typically appear within the <code>body</code> section (note that we have intentionally defaulted the XForms namespace prefix here):</p><div class="exampleOuter"><div class="exampleInner"><pre><select1 ref="method">
<label>Select Payment Method:</label>
<item>
<label>Cash</label>
<value>cash</value>
</item>
<item>
<label>Credit</label>
<value>cc</value>
</item>
</select1>
<input ref="number">
<label>Credit Card Number:</label>
</input>
<input ref="expiry">
<label>Expiration Date:</label>
</input>
<submit submission="submit">
<label>Submit</label>
</submit></pre></div></div><p>Notice the following features of this design:</p><ul><li><p>The user interface is not hard-coded to use radio buttons. Different devices (such as voice browsers) can render the concept of "select one" as appropriate.</p></li><li><p><a title="" href="#def-core-form-control">Core form controls</a> always have labels directly associated with them as child elements— this is a key feature designed to enhance accessibility.</p></li><li><p>There is no need for an enclosing <code>form</code> element, as in HTML. (See <a href="#concepts-multiple"><b>2.4 Multiple Forms per Document</b></a> for details on how to author multiple forms per document)</p></li><li><p>Markup for specifying form controls has been simplified in comparison with HTML forms.</p></li></ul><p> The fact that you can bind form controls to the model like this simplifies integrating XForms into other <a title="host language" href="#def-host-language">host languages</a>, since any form control markup may be used to bind to the model.</p></div><div class="div2">
<h3><a name="concepts-xml-instance-data" id="concepts-xml-instance-data"></a>2.2 Providing XML Instance Data</h3><p>The <a title="XForms Processor" href="#def-XForms-Processor">XForms Processor</a> can directly submit the data collected as XML. In the example, the submitted data would look like this:</p><div class="exampleOuter">
<div class="exampleHead">Submitted Data</div><div class="exampleInner"><pre><ecommerce>
<method>cc</method>
<number>1235467789012345</number>
<expiry>2001-08</expiry>
</ecommerce></pre></div></div><p>XForms processing keeps track of the state of the partially filled form through this <a title="instance data" href="#def-instance-data">instance data</a>. Initial values for the instance data may be provided or left empty as in the example. Element <code>instance</code> essentially holds a skeleton XML document that gets updated as the user fills out the form. It gives the author full control on the structure of the submitted XML data, including namespace information. When the form is submitted, the instance data is serialized as an XML document. Here is an alternative version of the earlier example:</p><div class="exampleOuter">
<div class="exampleHead">Model</div><div class="exampleInner"><pre><xforms:model>
<xforms:instance>
<payment method="cc" xmlns="http://commerce.example.com/payment">
<number/>
<expiry/>
</payment>
</xforms:instance>
<xforms:submission action="http://example.com/submit" method="post" includenamespaceprefixes="#default"/>
</xforms:model></pre></div></div><p>In this case the submitted data would look like this:</p><div class="exampleOuter">
<div class="exampleHead">Submitted Data</div><div class="exampleInner"><pre><payment method="cc" xmlns="http://commerce.example.com/payment">
<number>1235467789012345</number>
<expiry>2001-08</expiry>
</payment></pre></div></div><p>This design has features worth calling out:</p><ul><li><p>There is complete flexibility in the structure of the XML instance data, including the use of attributes. Notice that XML namespaces are used, and that a wrapper element of the author's choosing contains the instance data.</p></li><li><p>Empty elements <code>number</code> and <code>expiry</code> serve as place-holders in the XML structure, and will be filled in with form data provided by the user.</p></li><li><p>An initial value (<code>"cc"</code>) for the form control is provided through the instance data, in this case an attribute <code>method</code>. In the submitted XML, this initial value will be replaced by the user input, if the user changes the form control displaying that data.</p></li></ul><p>To connect this instance data with form controls, the <code>ref</code> attributes on the form controls need to be changed to point to the proper part of the instance data, using <a title="binding expression" href="#def-binding-expression">binding expressions</a>:</p><div class="exampleOuter">
<div class="exampleHead">Binding Form Controls to Instance Nodes with <code>ref</code></div><div class="exampleInner"><pre>... xmlns:my="http://commerce.example.com/payment"
...
<xforms:select1 ref="@method">...</xforms:select1>
...
<xforms:input ref="my:number">...</xforms:input>
...
<xforms:input ref="/my:payment/my:expiry">...</xforms:input>
</pre></div></div><p>Binding expressions are based on XPath <a href="#ref-xpath-1.0">[XPath 1.0]</a>, including the use of the <code>@</code> character to refer to attributes, as seen here. Note that for illustrative purposes, the first two expressions make use of the XPath context node, which defaults to the top-level element (here <code>my:payment</code>). The third expression shows an absolute path.</p></div><div class="div2">
<h3><a name="concepts-model" id="concepts-model"></a>2.3 Constraining Values</h3><p>XForms allows data to be checked for validity as the form is being filled. In the absence of specific information about the types of values being collected, all values are returned as strings, but it is possible to assign types to values in the instance data. In this example, <code>number</code> should accept digits only, and should have between 14 and 18 digits and <code>expiry</code> should accept only valid month/date combinations.</p><p>Furthermore, the credit card information form controls for <code>number</code> and <code>expiry</code> are only relevant if the <code>"cc"</code> option is chosen for <code>method</code>, but are required in that case.</p><p>By specifying an additional component, <a title="model item property" href="#def-model-item-property">model item properties</a>, authors can include rich declarative validation information in forms. Such information can be taken from XML Schemas as well as XForms-specific additions, such as <code>relevant</code>. Such properties appear on <code>bind</code> elements, while <a title="Schema constraint" href="#def-Schema-constraint">Schema constraint</a>s are expressed in an XML Schema fragment, either inline or external. For example:</p><div class="exampleOuter">
<div class="exampleHead">Declarative Validation with Model Item Properties</div><div class="exampleInner"><pre>... xmlns:my="http://commerce.example.com/payment"...
<xforms:model>
...
<xforms:bind nodeset="/my:payment/my:number"
relevant="/my:payment/@method = 'cc'"
required="true()"
type="my:ccnumber"/>
<xforms:bind nodeset="/my:payment/my:expiry"
relevant="/my:payment/@method = 'cc'"
required="true()"
type="xsd:gYearMonth"/>
<xs:schema ...>
...
<xs:simpleType name="ccnumber">
<xs:restriction base="xsd:string">
<xs:pattern value="\d{14,18}"/>
</xs:restriction>
</xs:simpleType>
...
</xs:schema>
</xforms:model></pre></div></div><div class="note"><p class="prefix"><b>Note:</b></p><p> In the above example, the <code>relevant</code> expression uses absolute XPath notation (beginning with <code>/</code>) because the evaluation context nodes for <a title="computed expression" href="#def-computed-expression">computed expression</a>s are determined by the <a title="binding expression" href="#def-binding-expression">binding expression</a> (see <a href="#expr-eval"><b>7.2 Evaluation Context</b></a>), and so any relative node path in the first <code>bind</code> <code>relevant</code> above would be relative to <code>/my:payment/my:number</code></p></div></div><div class="div2">
<h3><a name="concepts-multiple" id="concepts-multiple"></a>2.4 Multiple Forms per Document</h3><p>XForms processing places no limits on the number of individual forms that can be placed in a single <a title="containing document" href="#def-containing-document">containing document</a>. When a single document contains multiple forms, each form needs a separate <code>model</code> element, each with an <code>id</code> attribute so that they can be referenced from elsewhere in the containing document.</p><p>In addition, form controls should specify which <code>model</code> element contains the instance data to which they bind. This is accomplished through a <code>model</code> attribute that is part of the binding attributes. If no <code>model</code> attribute is specified on the binding element, the nearest ancestor binding element's <code>model</code> attribute is used, and failing that, the first XForms Model in document order is used. This technique is called 'scoped resolution', and is used frequently in XForms.</p><p>The next example adds an opinion poll to our electronic commerce form.</p><div class="exampleOuter">
<div class="exampleHead">Adding a <code>poll</code> model</div><div class="exampleInner"><pre><xforms:model>
<xforms:instance>
...payment instance data...
</xforms:instance>
<xforms:submission action="http://example.com/submit" method="post"/>
</xforms:model>
<xforms:model id="poll">
<xforms:instance>
<helpful/>
</xforms:instance>
<xforms:submission id="pollsubmit" .../>
</xforms:model></pre></div></div><p>Additionally, the following markup would appear in the body section of the document:</p><div class="exampleOuter">
<div class="exampleHead">Form Controls for <code>poll</code> model</div><div class="exampleInner"><pre><xforms:select1 ref="/helpful" model="poll">
<xforms:label>How useful is this page to you?</xforms:label>
<xforms:item>
<xforms:label>Not at all helpful</xforms:label>
<xforms:value>0</xforms:value>
</xforms:item>
<xforms:item>
<xforms:label>Barely helpful</xforms:label>
<xforms:value>1</xforms:value>
</xforms:item>
<xforms:item>
<xforms:label>Somewhat helpful</xforms:label>
<xforms:value>2</xforms:value>
</xforms:item>
<xforms:item>
<xforms:label>Very helpful</xforms:label>
<xforms:value>3</xforms:value>
</xforms:item>
</xforms:select1>
<xforms:submit submission="pollsubmit">
<xforms:label>Submit</xforms:label>
</xforms:submit></pre></div></div><p>The main difference here is the use of <code>model="poll"</code>, which identifies the instance. Note that <code>submit</code> refers to the <code>submission</code> element by ID and does not require binding attributes. </p><p>More XForms examples can be found in <a href="#xforms-examples"><b>H Complete XForms Examples</b></a>.</p></div></div><div class="div1">
<h2><a name="structure" id="structure"></a>3 Document Structure</h2><p>XForms is an application of XML <a href="#ref-xml-1.0">[XML 1.0]</a> and has been designed for use within other XML vocabularies—in particular within a future version of XHTML <a href="#ref-xhtml-1.0">[XHTML 1.0]</a>. XForms always requires such a <a title="host language" href="#def-host-language">host language</a>. This chapter discusses the structure of XForms that allow XForms to be used with other document types.</p><div class="div2">
<h3><a name="structure-namespace" id="structure-namespace"></a>3.1 Namespace for XForms</h3><p>The namespace URI for XForms is <code>http://www.w3.org/2002/xforms</code>. The XForms schema has the target namespace specified and as such is compatible with the XForms 1.0 definition. </p><div class="exampleOuter">
<div class="exampleHead">XForms used in combination with XHTML 1.0</div><div class="exampleInner"><pre><switch xmlns="http://www.w3.org/2002/xforms">
<case id="in" selected="true">
<input ref="yourname">
<label>Please tell me your name</label>
<toggle ev:event="DOMActivate" case="out"/>
</input>
</case>
<case id="out" selected="false">
<html:p>Hello <output ref="yourname" />
<trigger id="editButton">
<label>Edit</label>
<toggle ev:event="DOMActivate" case="in"/>
</trigger>
</html:p>
</case>
</switch></pre></div><p>
The above example is unchanged from the specification in XForms 1.0 (in the example, the prefixes html and ev are defined by an ancestor of the <code>switch</code> element).
</p></div></div><div class="div2">
<h3><a name="structure-attrs" id="structure-attrs"></a>3.2 XForms Core Attribute Collections</h3><div class="div3">
<h4><a name="structure-attrs-common" id="structure-attrs-common"></a>3.2.1 Common Attributes</h4><p>The Common Attribute Collection applies to every element in the XForms namespace.</p><dl><dt class="label">anyAttribute</dt><dd><p>Foreign attributes are allowed on all XForms elements.</p></dd><dt class="label">id</dt><dd><p>The author-optional <code>id</code> attribute of type <code>xsd:ID</code> assigns an identity to the containing element.</p></dd></dl><div class="note"><p class="prefix"><b>Note:</b></p><p>Elements can be identified using any attribute of type ID (such as <code>xml:id</code>), not just the <code>id</code> attribute defined above.</p></div><div class="note"><p class="prefix"><b>Note:</b></p><p>The <a title="" href="#action-xmlevents">XML Events attributes</a> are foreign attributes and therefore are
allowed on any XForms element that includes the <a title="" href="#structure-attrs-common">Common</a> attributes.
This specification lists both <a title="" href="#structure-attrs-common">Common</a> and
<a title="" href="#structure-attrs-common">Events</a> attributes on XForms actions for reading
convenience, i.e. since authors are most likely to place <a title="" href="#structure-attrs-common">Events</a>
attributes on the actual event handler elements.</p></div></div><div class="div3">
<h4><a name="structure-attrs-link" id="structure-attrs-link"></a>3.2.2 Linking Attributes</h4><p>The <a title="host language" href="#def-host-language">host language</a> may permit a Linking Attributes Collection
to be applied to XForms elements as an alternate means of obtaining content related to the element.
An example is the <code>src</code> attribute from <a href="#ref-xhtml-1.0">[XHTML 1.0]</a>. The schedule by which link traversal
occurs is defined by the host language. If the link traversal fails, the host language may dispatch
<a title="" href="#evt-linkException">xforms-link-exception</a>
to the
<code>model</code> associated with the in-scope evaluation context node of the element that bears the Linking
Attributes Collection for the failed link. </p><div class="note"><p class="prefix"><b>Note:</b></p><p>Section <a href="#structure-model-instance"><b>3.3.2 The instance Element</b></a> defines attribute <code>src</code> for the <code>instance</code> element. </p></div></div><div class="div3">
<h4><a name="structure-attrs-single-node" id="structure-attrs-single-node"></a>3.2.3 Single-Node Binding Attributes</h4><p id="model-ref">The following attributes can be used to define a binding between an XForms element such as a form control or an action and an instance data node defined by an XPath expression.</p><dl><dt class="label">ref</dt><dd><p><a title="binding expression" href="#def-binding-expression">Binding expression</a> interpreted as XPath. This attribute has no meaning when a <code>bind</code> attribute is present.</p></dd><dt class="label">model</dt><dd><p>Author-optional XForms Model selector. Specifies the <code>ID</code> of an XForms Model to be associated with this binding element. This attribute has no meaning for the current binding element when a <code>bind</code> attribute is present. Rules for determining the context XForms Model are located at <a href="#expr-eval"><b>7.2 Evaluation Context</b></a>.</p></dd><dt class="label">bind</dt><dd><p>Author-optional reference to a <code>bind</code> element.</p></dd></dl><p>In this specification, when an XForms element is declared to have a Single-Node Binding, then the author must specify the Single-Node Binding unless the element explicitly states that it is author-optional. </p><p>In some cases, an XForms element may allow a Single-Node Binding, but one or more attributes in the Single-Node Binding attribute group are inappropriate for that XForms element. In such cases, the exact attributes are listed for the XForms element, but those attributes still express a Single-Node Binding if they appear in the element. For example, the <code>submission</code> element forbids the <code>model</code> attribute because the model is defined to be the one containing the <code>submission</code>, so the attributes <code>ref</code> and <code>bind</code> are listed for <code>submission</code> rather than referring to the Single-Node Binding attribute group, but if a <code>ref</code> or <code>bind</code> attribute is used on a <code>submission</code>, it does express a Single-Node Binding. </p><p>When the Single-Node Binding is required, one of <code>ref</code> or <code>bind</code> is required.
When <code>bind</code> is used, the node is determined by the referenced <code>bind</code>.
See <a href="#idref-resolve-bind"><b>4.7.2 References to Elements within a bind Element</b></a> for details on selecting an identified <code>bind</code> that is iterated by one or more containing <code>bind</code> elements.
When <code>ref</code> is used, the node is determined by evaluating the XPath expression with the evaluation context described in Section <a href="#expr-eval"><b>7.2 Evaluation Context</b></a>.
</p><p><b>First-node rule</b>: When a Single-Node Binding attribute selects a node-set of size > 1, the first node in the node-set, based on document order, is used.</p><p>It is an exception (<a href="#evt-bindingException"><b>4.5.1 The xforms-binding-exception Event</b></a>) if the <a title="XForms Processor" href="#def-XForms-Processor">XForms Processor</a> encounters a <code>model</code> attribute <code>IDREF</code> value that refers to an <code>ID</code> not on a <code>model</code> element, or a <code>bind</code> attribute <code>IDREF</code> value that refers to an <code>ID</code> not on a <code>bind</code> element.</p></div><div class="div3">
<h4><a name="structure-attrs-nodeset" id="structure-attrs-nodeset"></a>3.2.4 Node-Set Binding Attributes</h4><p id="model-nodeset">The following attributes define a binding between an XForms element such as a form control or an action and a node-set defined by the XPath expression.</p><dl><dt class="label">nodeset</dt><dd><p><a title="binding expression" href="#def-binding-expression">Binding expression</a> interpreted as XPath. This attribute has no meaning when a <code>bind</code> attribute is present.</p></dd><dt class="label">model</dt><dd><p>Author-optional XForms Model selector. Specifies the <code>ID</code> of an XForms Model to be associated with this binding element.
This attribute has no meaning for the current binding element when a <code>bind</code> attribute is present. Rules for determining the context XForms Model are located at <a href="#expr-eval"><b>7.2 Evaluation Context</b></a>.</p></dd><dt class="label">bind</dt><dd><p>Author-optional reference to a <code>bind</code> element.</p></dd></dl><p>In this specification, when an XForms element is declared to have a Node-Set Binding, then the author must specify the Node-Set Binding
unless the element explicitly states that it is author-optional. </p><p>In some cases, an XForms element may allow a Node-Set Binding, but one or more attributes in the Node-Set Binding attribute group are inappropriate for that XForms element. In such cases, the exact attributes are listed for the XForms element, but those attributes still express a Node-Set Binding if they appear in the element. For example, the <code>bind</code> element only allows the <code>nodeset</code> attribute. The <code>model</code> and <code>bind</code> attributes are not allowed on a <code>bind</code> element, but if the <code>nodeset</code> attribute appears on a <code>bind</code> element, it does express a Node-Set Binding. </p><p>When the Node-Set Binding is required, one of <code>nodeset</code> or <code>bind</code> is required.
When <code>bind</code> is used, the node-set is determined by the referenced <code>bind</code>.
See <a href="#idref-resolve-bind"><b>4.7.2 References to Elements within a bind Element</b></a> for details on selecting an identified <code>bind</code> that is iterated by one or more containing <code>bind</code> elements. When <code>nodeset</code> is used, the node-set is determined by evaluating the XPath expression with the evaluation context described in Section <a href="#expr-eval"><b>7.2 Evaluation Context</b></a>.</p><p>It is an exception (<a href="#evt-bindingException"><b>4.5.1 The xforms-binding-exception Event</b></a>) if the <a title="XForms Processor" href="#def-XForms-Processor">XForms Processor</a> encounters a <code>model</code> attribute <code>IDREF</code> value that refers to an <code>ID</code> not on a <code>model</code> element, or a <code>bind</code> attribute <code>IDREF</code> value that refers to an <code>ID</code> not on a <code>bind</code> element.</p></div><div class="div3">
<h4><a name="structure-attrs-mip" id="structure-attrs-mip"></a>3.2.5 Model Item Property Attributes</h4><p>This collection contains one attribute for each model item property, with an attribute name exactly matching the name of the model item property, as defined in <a href="#model-xformsconstraints"><b>6.1 Model Item Property Definitions</b></a>.</p></div></div><div class="div2">
<h3><a name="structure-abstract" id="structure-abstract"></a>3.3 The XForms Core Module</h3><p>The XForms Core Module defines the major structural elements of XForms, intended for inclusion in a containing document. The elements and attributes included in this module are:</p><table border="1" summary="listing of XForms Core elements, attributes, and content models"><tbody><tr><th rowspan="1" colspan="1">Element</th><th rowspan="1" colspan="1">Attributes</th><th rowspan="1" colspan="1">Minimal Content Model</th></tr><tr><td rowspan="1" colspan="1"><a title="" href="#structure-model">model</a></td><td rowspan="1" colspan="1"><a title="" href="#structure-attrs-common">Common</a>, functions (QNameList), schema (list of xsd:anyURI), version (<a title="versionList" href="#def-versionList">xforms:versionList</a>)</td><td rowspan="1" colspan="1">(instance|xs:schema| submission|bind|<a title="" href="#action-content-set">Action</a>)*</td></tr><tr><td rowspan="1" colspan="1"><a title="" href="#structure-model-instance">instance</a></td><td rowspan="1" colspan="1"><a title="" href="#structure-attrs-common">Common</a>, src (xsd:anyURI), resource (xsd:anyURI)</td><td rowspan="1" colspan="1">(ANY) </td></tr><tr><td rowspan="1" colspan="1">submission</td><td rowspan="1" colspan="1">
<blockquote><p><a title="" href="#structure-attrs-common">Common</a><br>ref (<a title="binding expression" href="#def-binding-expression">binding-expression</a>)<br>bind (xsd:IDREF)<br>resource (xsd:anyURI)<br>action (xsd:anyURI) [deprecated]<br>mode ("asynchronous"|"synchronous")<br>method ("post"|"get"|"put"|"delete"|"multipart-post"|"form-data-post"|"urlencoded-post"|Any other <a href="http://www.w3.org/TR/REC-xml-names/#NT-NCName">NCName</a>|<a title="QNameButNotNCName" href="#def-QNameButNotNCName">QNameButNotNCName</a>)<br>validate (xsd:boolean)<br>relevant (xsd:boolean)<br>serialization ("application/xml"|"application/x-www-form-urlencoded"|"multipart/related"|"multipart/form-data"|"none")<br>version (xsd:NMTOKEN)<br>indent (xsd:boolean)<br>mediatype (xsd:string)<br>encoding (xsd:string)<br>omit-xml-declaration (xsd:boolean)<br>standalone (xsd:boolean)<br>cdata-section-elements (QNameList)<br>replace ("all"|"instance"|"text"|"none" | <a title="QNameButNotNCName" href="#def-QNameButNotNCName">QNameButNotNCName</a>)<br>instance (xsd:IDREF)<br>targetref (nodeset XPath Expression)<br>separator (';' | '&')<br>includenamespaceprefixes (xsd:NMTOKENS)</p></blockquote>
</td><td rowspan="1" colspan="1">(<a title="" href="#submit-resource-elem">resource</a> | <a title="" href="#submit-method-elem">method</a> | <a title="" href="#submit-header">header</a>)*, <a title="" href="#action-content-set">Action</a>*</td></tr><tr><td rowspan="1" colspan="1"><a title="" href="#structure-bind-element">bind</a></td><td rowspan="1" colspan="1"><a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#structure-attrs-mip">Model Item Properties</a>, nodeset (<a title="model binding expression" href="#def-model-binding-expression">model-binding-expression</a>)</td><td rowspan="1" colspan="1">(bind)*</td></tr></tbody></table><p>Elements defined in the XForms Actions module, when that module is included, are also allowed in the content model of <code>model</code> and <code>submission</code>, as shown above.</p><p>Within the containing document, these structural elements are typically not rendered.</p><p>The <a title="XForms Processor" href="#def-XForms-Processor">XForms Processor</a> must ignore any foreign-namespaced attributes that are unrecognized. </p><p>Note that the presence of foreign namespaced elements is subject to the definition of the containing or compound document profile.</p><div class="div3">
<h4><a name="structure-model" id="structure-model"></a>3.3.1 The model Element</h4><p> This element represents a form definition and is used as a container for elements that define the XForms Model.
No restriction is placed on how many <code>model</code> elements may exist within a containing document.</p><p>Common Attributes: <a title="" href="#structure-attrs-common">Common</a></p><p>Special Attributes:</p><dl><dt class="label">functions</dt><dd><p>Author-optional space-separated list of XPath extension functions (represented by QNames) required by this XForms Model. Guidance on the use of this attribute is at <a href="#expr-lib-extension"><b>7.12 Extension Functions</b></a>.</p></dd><dt class="label">schema</dt><dd><p>Author-optional list of <code>xsd:anyURI</code> links to XML Schema documents outside this <code>model</code> element. The <a title="XForms Processor" href="#def-XForms-Processor">XForms Processor</a> must process all Schemas listed in this attribute.
Within each XForms Model, there is a limit of one Schema per namespace declaration, including inline and linked Schemas.</p><p id="def-schema-applicable">The schema definitions for a namespace are determined to be <b>applicable</b> to instance nodes based on an instance schema validation episode initialized to <a title="lax processing" href="#def-lax-processing">lax processing</a>. When an element lacks a schema declaration, the XML Schema specification defines the recursive checking of children and attributes as optional. For this specification, this recursive checking is required. Schema processing for a node with matching schema declarations is governed by its content processing definition, which is <a title="strict processing" href="#def-strict-processing">strict</a> by default.</p><div class="note"><p class="prefix"><b>Note:</b></p><p>The <code>schema</code> list may include URI fragments referring to elements located outside the current model elsewhere in the
containing document; e.g. <code>"#myschema"</code>. <code>xs:schema</code> elements located inside the current model need not be listed.</p></div></dd><dt class="label">version</dt><dd><p>Author-optional attribute with a default value of empty string and legal values defined by the datatype <a title="versionList" href="#def-versionList">xforms:versionList</a>. Examples are <code>"1.0"</code> and <code>"1.0 1.1"</code>. If one or more versions are indicated by this attribute on the default <code>model</code>, then an <a title="XForms Processor" href="#def-XForms-Processor">XForms Processor</a> must support at least one of the listed language versions of XForms. Otherwise, the <a title="XForms Processor" href="#def-XForms-Processor">XForms Processor</a> must terminate processing after dispatching the event <a title="" href="#evt-versionException">xforms-version-exception</a> to the default <code>model</code>. If the <a title="XForms Processor" href="#def-XForms-Processor">XForms Processor</a> supports more than one language version indicated by the version setting on the default <code>model</code> or if the version setting on the default <code>model</code> is empty string (whether specified or by default), then the <a title="XForms Processor" href="#def-XForms-Processor">XForms Processor</a> may execute the XForms content using any language conformance level available to it. If any non-default <code>model</code> has a version setting that is incompatible with the language version selected by the <a title="XForms Processor" href="#def-XForms-Processor">XForms Processor</a>, then the <a title="XForms Processor" href="#def-XForms-Processor">XForms Processor</a> must terminate processing after dispatching the event <a title="" href="#evt-versionException">xforms-version-exception</a> to the default <code>model</code>.
</p></dd></dl><p>Examples:</p><div class="exampleOuter">
<div class="exampleHead">This example shows a simple usage of <code>model</code>, with the XForms namespace defaulted:</div><div class="exampleInner"><pre><model id="Person" schema="MySchema.xsd">
<instance resource="http://example.com/cgi-bin/get-instance" />
...
</model></pre></div></div><div class="exampleOuter">
<div class="exampleHead">Handler for xforms-version-exception</div><div class="exampleInner"><pre><model>
<message level="modal" ev:event="xforms-version-exception">
<output value="event('errorinformation')"/>
</message>
...
</model>
...
<model id="m2" version="1.1">
...
</model>
</pre></div><p>Since the <code>version</code> attribute is not specified on the <code>model</code>, the <a title="XForms Processor" href="#def-XForms-Processor">XForms Processor</a> may choose any language conformance level, which may be incompatible with the version setting of the second <code>model</code>. Therefore, the message action occurs during initialization of the second <code>model</code> due to its version incompatibility with the default <code>model</code>.</p></div><div class="exampleOuter">
<div class="exampleHead">An Example of Differing but Compatible Version Settings</div><div class="exampleInner"><pre><model version="1.0 1.1">
...
</model>
...
<model id="m2">
...
</model>
</pre></div><p>Since the <code>version</code> attribute is not specified on the second <code>model</code>, it is compatible with any choice made based on the version setting on the default model.</p></div></div><div class="div3">
<h4><a name="structure-model-instance" id="structure-model-instance"></a>3.3.2 The instance Element</h4><p>This author-optional element contains or references initial instance data.</p><p>Common Attributes: <a title="" href="#structure-attrs-common">Common</a></p><p>Special Attributes:</p><dl><dt class="label">src</dt><dd><p>Author-optional link to externally defined initial instance data. If the link traversal fails, it is treated as an exception (<a href="#evt-linkException"><b>4.5.4 The xforms-link-exception Event</b></a>).</p></dd><dt class="label">resource</dt><dd><p>Author-optional link to externally defined initial instance data. If the link is traversed and the traversal fails, it is treated as an exception (<a href="#evt-linkException"><b>4.5.4 The xforms-link-exception Event</b></a>).</p></dd></dl><p>If the <code>src</code> attribute is given, then it takes precedence over inline content and the <code>resource</code> attribute, and the XML data for the instance is obtained from the link. If the <code>src</code> attribute is omitted, then the data for the instance is obtained from inline content if it is given or the <code>resource</code> attribute otherwise. If both the <code>resource</code> attribute and inline content are provided, the inline content takes precedence. </p><p>If the initial instance data is given by a link (from <code>src</code> or <code>resource</code>), then the instance data is formed by creating an XPath data model of the linked resource. If the link cannot be traversed, then processing halts after dispatching an <a title="" href="#evt-linkException">xforms-link-exception</a> with a <code>resource-uri</code> of the link that failed.</p><p>If the initial instance data is given by inline content, then instance data is obtained by first creating a detached copy of the inline content (including namespaces inherited from the enveloping ancestors), then creating an XPath data model over the detached copy. The detached copy must consist of content that would be well-formed XML if it existed in a separate document. Note that this restricts the element content of <code>instance</code> to a single child element.</p><p>If creation of the XPath data model for the instance data fails due to an XML error, then processing halts after dispatching an <a title="" href="#evt-linkException">xforms-link-exception</a>
with a <code>resource-uri</code> indicating either the URI for an external instance, a fragment identifier URI reference (including the leading # mark) for an identified internal instance, or empty string for an unidentified internal instance.
This exception could happen, for example, if the content had no top-level element or more than one top-level element, neither of which is permitted by the grammar of XML. </p><div class="note"><p class="prefix"><b>Note:</b></p><p>All data relevant to the XPath data model must be preserved during processing and as input to submission serialization, including processing instructions, comment nodes and all whitespace.</p></div><div class="note"><p class="prefix"><b>Note:</b></p><p>XForms authors who need additional control over the serialization of namespace nodes can use the <code>includenamespaceprefixes</code> attribute on the <code>submission</code> element.</p></div></div><div class="div3">
<h4><a name="structure-model-submission" id="structure-model-submission"></a>3.3.3 The submission Element</h4><p>Details about the <code>submission</code> element and its processing are described in <a href="#submit"><b>11 The XForms Submission Module</b></a>.</p></div><div class="div3">
<h4><a name="structure-bind-element" id="structure-bind-element"></a>3.3.4 The bind Element</h4><p>Element <code>bind</code> selects a node-set from the <a title="instance data" href="#def-instance-data">instance data</a> with either
a <a title="model binding expression" href="#def-model-binding-expression">model binding expression</a> in the <code>nodeset</code> attribute or the
default of the in-scope evaluation context node. Other attributes on element <code>bind</code> encode
<a title="model item property" href="#def-model-item-property">model item properties</a> to be applied to each node in the
node-set. When <code>bind</code> has an attribute of type <code>xsd:ID</code>, the <code>bind</code> then associates
that identifier with the selected node-set.</p><p>Common Attributes: <a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#structure-attrs-mip">Model Item Properties</a> (author-optional)</p><p>Special Attributes:</p><dl><dt class="label">nodeset</dt><dd><p>An author-optional attribute containing a <a title="model binding expression" href="#def-model-binding-expression">model binding expression</a> that selects the set of nodes on which this <code>bind</code> operates.
If the attribute is omitted, the default is the in-scope evaluation context node.</p></dd></dl><p>See <a href="#model"><b>6 Model Item Properties</b></a> for details on model item properties.</p><p>See <a href="#expr-eval"><b>7.2 Evaluation Context</b></a> for details on how the evaluation context is determined for each attribute of the <code>bind</code> element.</p></div></div><div class="div2">
<h3><a name="module-extension" id="module-extension"></a>3.4 The XForms Extension Module</h3><p>There are many different ways a <a title="host language" href="#def-host-language">host language</a> might include XForms. One approach uses only well-formed processing, disregarding validation. Another case uses strict validation, for example XHTML 1.0, in which only predefined elements are allowed. Another common approach is to allow unregulated content in a few select places. A host language that chooses this option can use the Extension module.</p><table border="1" summary="listing of XForms Core elements, attributes, and content models"><tbody><tr><th rowspan="1" colspan="1">Element</th><th rowspan="1" colspan="1">Attributes</th><th rowspan="1" colspan="1">Minimal Content Model</th></tr><tr><td rowspan="1" colspan="1"><a title="" href="#structure-extension">extension</a></td><td rowspan="1" colspan="1"><a title="" href="#structure-attrs-common">Common</a> </td><td rowspan="1" colspan="1">ANY</td></tr></tbody></table><div class="div3">
<h4><a name="structure-extension" id="structure-extension"></a>3.4.1 The extension Element</h4><p>Author-optional element <code>extension</code> is a container for application-specific extension elements from any namespace other than the XForms namespace. This specification does not define the processing of this element.</p><p>Common Attributes: <a title="" href="#structure-attrs-common">Common</a></p><p>For example, RDF metadata could be attached to an individual form control as follows:</p><div class="exampleOuter"><div class="exampleInner"><pre><input ref="dataset/user/email" id="email-input">
<label>Enter your email address</label>
<extension>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="#email-input">
<my:addressBook>personal</my:addressBook>
</rdf:Description>
</rdf:RDF>
</extension>
</input></pre></div></div></div></div><div class="div2">
<h3><a name="module-mustUnderstand" id="module-mustUnderstand"></a>3.5 The XForms MustUnderstand Module</h3><p>This section is deleted.</p></div></div><div class="div1">
<h2><a name="rpm" id="rpm"></a>4 Processing Model</h2><p>This chapter defines the XForms Processing Model declaratively by enumerating the various states attained by an XForms Processor and the possible state transitions that exist in each of these states. The chapter enumerates the pre-conditions and post-conditions that must be satisfied in each of these states. XForms Processors may be implemented in any manner, so long as the end results are identical to that described in this chapter.</p><p>State transitions are in general initiated by sending events to parts of the XForms tree. The XForms Processing Model consists of events in the following categories:</p><ul><li><p>Initialization</p></li><li><p>Interaction</p></li><li><p>Notification</p></li><li><p>Error Conditions</p></li></ul><div class="div2">
<h3><a name="rpm-events" id="rpm-events"></a>4.1 Events Overview</h3><p>XForms processing is defined in terms of events, event handlers, and event responses. XForms uses the events system defined in <a href="#ref-dom2-events">[DOM2 Events]</a><a href="#ref-xml-events">[XML Events]</a>, with an event capture phase, arrival of the event at its Target, and finally the event bubbling phase.</p><table border="1" frame="box" summary="list of all events, with cancelable, bubbleable, and target node info"><thead><tr><th rowspan="1" colspan="1">Event name</th><th rowspan="1" colspan="1">Cancelable?</th><th rowspan="1" colspan="1">Bubbles?</th><th rowspan="1" colspan="1">Target element</th></tr></thead><tbody><tr><td colspan="4" rowspan="1"> <a href="#rpm-init"><b>4.2 Initialization Events</b></a></td></tr><tr><td rowspan="1" colspan="1">xforms-model-construct</td><td rowspan="1" colspan="1">No</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1"> <code>model</code> </td></tr><tr><td rowspan="1" colspan="1">xforms-model-construct-done</td><td rowspan="1" colspan="1">No</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1"> <code>model</code> </td></tr><tr><td rowspan="1" colspan="1">xforms-ready</td><td rowspan="1" colspan="1">No</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1"> <code>model</code> </td></tr><tr><td rowspan="1" colspan="1">xforms-model-destruct</td><td rowspan="1" colspan="1">No</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1"> <code>model</code> </td></tr><tr><td colspan="4" rowspan="1"> <a href="#rpm-interaction"><b>4.3 Interaction Events</b></a></td></tr><tr><td rowspan="1" colspan="1">xforms-rebuild</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1"> <code>model</code> </td></tr><tr><td rowspan="1" colspan="1">xforms-recalculate</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1"> <code>model</code> </td></tr><tr><td rowspan="1" colspan="1">xforms-revalidate</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1"><code>model</code></td></tr><tr><td rowspan="1" colspan="1">xforms-refresh</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1"> <code>model</code> </td></tr><tr><td rowspan="1" colspan="1">xforms-reset</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1"> <code>model</code> </td></tr><tr><td rowspan="1" colspan="1">xforms-previous</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1">No</td><td rowspan="1" colspan="1"><a title="" href="#elems-form-controls">Core Form Controls</a></td></tr><tr><td rowspan="1" colspan="1">xforms-next</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1">No</td><td rowspan="1" colspan="1"><a title="" href="#elems-form-controls">Core Form Controls</a></td></tr><tr><td rowspan="1" colspan="1">xforms-focus</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1">No</td><td rowspan="1" colspan="1"><a title="" href="#elems-form-controls">Core Form Controls</a>|<code>group</code>|<code>switch</code>|<code>repeat</code></td></tr><tr><td rowspan="1" colspan="1">xforms-help</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1"><a title="" href="#elems-form-controls">Core Form Controls</a></td></tr><tr><td rowspan="1" colspan="1">xforms-hint</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1"><a title="" href="#elems-form-controls">Core Form Controls</a></td></tr><tr><td rowspan="1" colspan="1">xforms-submit</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1"> <code>submission</code> </td></tr><tr><td rowspan="1" colspan="1">xforms-submit-serialize</td><td rowspan="1" colspan="1">No</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1"><code>submission</code> </td></tr><tr><td colspan="4" rowspan="1"> <a href="#evt-notify"><b>4.4 Notification Events</b></a></td></tr><tr><td rowspan="1" colspan="1">xforms-insert</td><td rowspan="1" colspan="1">No</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1"><code>instance</code></td></tr><tr><td rowspan="1" colspan="1">xforms-delete</td><td rowspan="1" colspan="1">No</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1"><code>instance</code></td></tr><tr><td rowspan="1" colspan="1">xforms-value-changed</td><td rowspan="1" colspan="1">No</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1"><a title="" href="#elems-form-controls">Core Form Controls</a></td></tr><tr><td rowspan="1" colspan="1">xforms-valid</td><td rowspan="1" colspan="1">No</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1"><a title="" href="#elems-form-controls">Core Form Controls|</a><code>group</code>|<code>switch</code></td></tr><tr><td rowspan="1" colspan="1">xforms-invalid</td><td rowspan="1" colspan="1">No</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1"><a title="" href="#elems-form-controls">Core Form Controls</a>|<code>group</code>|<code>switch</code></td></tr><tr><td rowspan="1" colspan="1">xforms-readonly</td><td rowspan="1" colspan="1">No</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1"><a title="" href="#elems-form-controls">Core Form Controls</a>|<code>group</code>|<code>switch</code></td></tr><tr><td rowspan="1" colspan="1">xforms-readwrite</td><td rowspan="1" colspan="1">No</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1"><a title="" href="#elems-form-controls">Core Form Controls</a>|<code>group</code>|<code>switch</code></td></tr><tr><td rowspan="1" colspan="1">xforms-required</td><td rowspan="1" colspan="1">No</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1"><a title="" href="#elems-form-controls">Core Form Controls</a>|<code>group</code>|<code>switch</code></td></tr><tr><td rowspan="1" colspan="1">xforms-optional</td><td rowspan="1" colspan="1">No</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1"><a title="" href="#elems-form-controls">Core Form Controls</a>|<code>group</code>|<code>switch</code></td></tr><tr><td rowspan="1" colspan="1">xforms-enabled</td><td rowspan="1" colspan="1">No</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1"><a title="" href="#elems-form-controls">Core Form Controls</a>|<code>group</code>|<code>switch</code></td></tr><tr><td rowspan="1" colspan="1">xforms-disabled</td><td rowspan="1" colspan="1">No</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1"><a title="" href="#elems-form-controls">Core Form Controls</a>|<code>group</code>|<code>switch</code></td></tr><tr><td rowspan="1" colspan="1">DOMActivate</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1"><a title="" href="#elems-form-controls">Core Form Controls</a></td></tr><tr><td rowspan="1" colspan="1">DOMFocusIn</td><td rowspan="1" colspan="1">No</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1"><a title="" href="#elems-form-controls">Core Form Controls</a>|<code>group</code>|<code>switch</code>|<code>repeat</code></td></tr><tr><td rowspan="1" colspan="1">DOMFocusOut</td><td rowspan="1" colspan="1">No</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1"><a title="" href="#elems-form-controls">Core Form Controls</a>|<code>group</code>|<code>switch</code>|<code>repeat</code></td></tr><tr><td rowspan="1" colspan="1">xforms-select</td><td rowspan="1" colspan="1">No</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1"><code>item</code> or <code>case</code></td></tr><tr><td rowspan="1" colspan="1">xforms-deselect</td><td rowspan="1" colspan="1">No</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1"><code>item</code> or <code>case</code></td></tr><tr><td rowspan="1" colspan="1">xforms-in-range</td><td rowspan="1" colspan="1">No</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1"><a title="" href="#elems-form-controls">Core Form Controls</a></td></tr><tr><td rowspan="1" colspan="1">xforms-out-of-range</td><td rowspan="1" colspan="1">No</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1"><a title="" href="#elems-form-controls">Core Form Controls</a></td></tr><tr><td rowspan="1" colspan="1">xforms-scroll-first</td><td rowspan="1" colspan="1">No</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1"> <code>repeat</code> </td></tr><tr><td rowspan="1" colspan="1">xforms-scroll-last</td><td rowspan="1" colspan="1">No</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1"> <code>repeat</code> </td></tr><tr><td rowspan="1" colspan="1">xforms-submit-done</td><td rowspan="1" colspan="1">No</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1"><code>submission</code></td></tr><tr><td colspan="4" rowspan="1"> <a href="#rpm-errors"><b>4.5 Error Indications</b></a></td></tr><tr><td rowspan="1" colspan="1">xforms-binding-exception</td><td rowspan="1" colspan="1">No</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1">any element that can contain a binding expression</td></tr><tr><td rowspan="1" colspan="1">xforms-compute-exception</td><td rowspan="1" colspan="1">No</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1"><code>model</code></td></tr><tr><td rowspan="1" colspan="1">xforms-version-exception</td><td rowspan="1" colspan="1">No</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1">The default <code>model</code></td></tr><tr><td rowspan="1" colspan="1">xforms-link-exception</td><td rowspan="1" colspan="1">No</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1"><code>model</code></td></tr><tr><td rowspan="1" colspan="1">xforms-output-error</td><td rowspan="1" colspan="1">No</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1"><code>output</code></td></tr><tr><td rowspan="1" colspan="1">xforms-submit-error</td><td rowspan="1" colspan="1">No</td><td rowspan="1" colspan="1">Yes</td><td rowspan="1" colspan="1"><code>submission</code></td></tr></tbody></table></div><div class="div2">
<h3><a name="rpm-init" id="rpm-init"></a>4.2 Initialization Events</h3><p>This section defines the various stages of the <em>initialization</em> phase. The processor begins initialization by dispatching an event <code>xforms-model-construct</code> to each XForms Model in the containing document. How the XForms Processor itself is requested to initialize is implementation dependent.</p><div class="div3">
<h4><a name="evt-modelConstruct" id="evt-modelConstruct"></a>4.2.1 The xforms-model-construct Event</h4><p>Dispatched to each XForms model by the XForms processor.</p><p>Target: <code>model</code></p><p>Bubbles: Yes</p><p>Cancelable: No</p><p>Context Info: None</p><p>The default action for this event results in the following:</p><ol class="enumar"><li><p>All XML Schemas are loaded. If an error occurs while attempting to access or process a remote document, processing halts with an exception (<a href="#evt-linkException"><b>4.5.4 The xforms-link-exception Event</b></a>).</p></li><li><p>For each <code>instance</code> element,
an XPath data model [<a href="#expr"><b>7 XPath Expressions in XForms</b></a>] is constructed from it as described in Section <a href="#structure-model-instance"><b>3.3.2 The instance Element</b></a>.
If there are no <code>instance</code> elements, the data model is not constructed in this phase, but during user interface construction
(<a href="#evt-modelConstructDone"><b>4.2.2 The xforms-model-construct-done Event</b></a>). </p></li><li><p>If applicable, P3P initialization occurs. <a href="#ref-p3p-1.0">[P3P 1.0]</a></p></li><li><p>Perform the behaviors of <code>xforms-rebuild</code>,
<code>xforms-recalculate</code>, and <code>xforms-revalidate</code> in sequence
on this <code>model</code> element
without dispatching events to invoke the behaviors.
The notification event markings for these operations are discarded, and the
<code>xforms-refresh</code> behavior is not
performed since the user interface has not yet been initialized.</p></li></ol><p>After all XForms Models have been initialized, an <code>xforms-model-construct-done</code> event is dispatched to each <code>model</code> element.</p></div><div class="div3">
<h4><a name="evt-modelConstructDone" id="evt-modelConstructDone"></a>4.2.2 The xforms-model-construct-done Event</h4><p>Dispatched after the completion of <code>xforms-model-construct</code> processing.</p><p>Target: <code>model</code></p><p>Bubbles: Yes</p><p>Cancelable: No</p><p>Context Info: None</p><p>The default action for this event happens once, no matter how many XForms Models are present in the containing document, and results in the following, for each <a title="form control" href="#def-form-control">form control</a>:</p><p>Processing can proceed in one of two different ways depending on whether an <code>instance</code> in a <code>model</code> exists when the first form control is processed.</p><p>If the <code>instance</code> referenced on the form control existed when the first form control was processed: </p><ol class="enumar"><li><p>The single node binding expression is evaluated, if it exists on the form control, to ensure that it points to a node that exists. If this is not the case then the form control should behave in the same manner as if it had bound to a model item with the <code>relevant</code> model item property resolved to <code>false</code>.</p></li><li><p>Otherwise, the user interface for the form control is created and initialized.</p></li></ol><p>If the <code>instance</code> referenced on the form control did not exist when the first form control for the same <code>instance</code> was processed: </p><ol class="enumar"><li><p>For the first reference to an <code>instance</code> a default <code>instance</code> is created by following the rules described below.</p><ol class="enumla"><li><p>A root <code>instanceData</code> element is created.</p></li><li><p>An instance data element node will be created using the binding expression from the user interface control as the <code>name</code>. If the <code>name</code> is not a valid QName, processing halts with an exception (<a href="#evt-bindingException"><b>4.5.1 The xforms-binding-exception Event</b></a>). </p></li></ol></li><li><p>For the second and subsequent references to an <code>instance</code> which was automatically created the following processing is performed:</p><ol class="enumla"><li><p>If a matching instance data node is found, the user interface control will be connected to that element.</p></li><li><p>If a matching instance data node is not found, an instance data node will be created using the binding expression from the user interface control as the <code>name</code>. If the <code>name</code> is not a valid QName, processing halts with an exception (<a href="#evt-bindingException"><b>4.5.1 The xforms-binding-exception Event</b></a>). </p></li></ol></li></ol><p>The above steps comprise the default processing of <code>xforms-model-construct-done</code>.</p><p>After all form controls have been initialized and all <code>xforms-model-construct-done</code> events have been processed, an <code>xforms-ready</code> event is dispatched to each <code>model</code> element.</p></div><div class="div3">
<h4><a name="evt-ready" id="evt-ready"></a>4.2.3 The xforms-ready Event</h4><p>Dispatched as part of <code>xforms-model-construct-done</code> processing.</p><p>Target: <code>model</code></p><p>Bubbles: Yes</p><p>Cancelable: No</p><p>Context Info: None</p><p>The default action for this event results in the following: None; notification event only.</p></div><div class="div3">
<h4><a name="evt-modelDestruct" id="evt-modelDestruct"></a>4.2.4 The xforms-model-destruct Event</h4><p>Dispatched by the processor to advise of imminent shutdown of the XForms Processor, which can occur from user action, or from the <code>load</code> XForms Action, or as a result of form submission.</p><p>Target: <code>model</code></p><p>Bubbles: No</p><p>Cancelable: No</p><p>Context Info: None</p><p>The default action for this event results in the following: None; notification event only.</p></div></div><div class="div2">
<h3><a name="rpm-interaction" id="rpm-interaction"></a>4.3 Interaction Events</h3><div class="div3">
<h4><a name="evt-rebuild" id="evt-rebuild"></a>4.3.1 The xforms-rebuild Event</h4><p>Dispatched in response to: a request to rebuild the internal data structures that track computational dependencies within a particular XForms Model.</p><p>Target: <code>model</code></p><p>Bubbles: Yes</p><p>Cancelable: Yes</p><p>Context Info: None</p><p>The default action for this event results in the following:</p><p>All model item properties are initialized by processing all <code>bind</code> elements in document order. For each <code>bind</code>:</p><ol class="enumar"><li><p>If the attribute <code>nodeset</code> is attached to the bind, it is evaluated to select an XPath node-set. Otherwise, if the <code>bind</code>
does not have a <code>nodeset</code> attribute, then the selected XPath node-set consists of the in-scope evaluation context.</p></li><li><p>For each node in the selected XPath node-set, model item properties are applied according to the remaining attributes on the <code>bind</code> element
(for details on the model item properties, see <a href="#model"><b>6 Model Item Properties</b></a>).
If a node already contains a model item property of the same name due to the processing of prior <code>bind</code> elements, then XForms processing for the
containing document halts with an exception (<a href="#evt-bindingException"><b>4.5.1 The xforms-binding-exception Event</b></a>).
</p></li><li><p>For each node in the selected XPath node-set, any child <code>bind</code> elements are recursively processed as described in the three points of this list.</p></li></ol><p> After initial processing of the <code>bind</code> elements, the computational dependency data structures
are rebuilt, and then the change list <em>L</em> is set to contain references to all instance nodes that have an associated computational expression
so that a <em>full</em> recalculation is performed the next time the behavior of
<code>xforms-recalculate</code> is invoked.</p></div><div class="div3">
<h4><a name="evt-recalculate" id="evt-recalculate"></a>4.3.2 The xforms-recalculate Event</h4><p>Dispatched in response to: a request to recalculate all calculations associated with a particular XForms Model.</p><p>Target: <code>model</code></p><p>Bubbles: Yes</p><p>Cancelable: Yes</p><p>Context Info: None</p><p>The default action for this event results in the following:</p><p>The values of all instance data items match their associated 'calculate' constraints, if any.
All model item properties that can contain computed expressions are resolved.
In addition to contributing further
node value changes that will cause xforms-value-changed
notifications in xforms-refresh, the model item properties
that change are marked to help
xforms-refresh to determine the notification
events to dispatch. </p><ul><li><p>If the required model item property changes,
then either the xforms-required event must be marked for
dispatch if required is true or the xforms-optional
event must be marked for dispatch if required is false.
Marking one of these events for dispatch
unmarks the other.</p></li><li><p>If the readonly model item property changes,
then either the xforms-readonly event must be marked for
dispatch if readonly is true or the xforms-readwrite
event must be marked for dispatch if readonly is false.
Marking one of these events for dispatch
unmarks the other.</p></li><li><p>If the relevant model item property changes,
then either the xforms-enabled event must be marked for
dispatch if relevant is true or the xforms-disabled
event must be marked for dispatch if relevant is false.
Marking one of these events for dispatch
unmarks the other.</p></li></ul><p>An XPath expression is bound either to the value or to a model item property
(e.g., <code>required</code>, <code>relevant</code>) of one or more instance nodes.
The combination of an XPath expression with a single instance node's value or model item property
is considered as a single computational unit, a <b>compute</b>, for the
purposes of recalculation.</p><p>When it is time to recalculate a model item property, the
XPath expression is evaluated.
The evaluation context is determined from the model binding expression
that applied the model item property, as defined for computed expressions in
<a href="#expr-eval"><b>7.2 Evaluation Context</b></a>. The XPath expression may <b>reference</b> or
<b>refer to</b> another instance node, in which case the value of the instance node is
<b>referenced</b>. Each referenced instance node has as <b>dependents</b> those
computes which directly refer to the instance node. References to the current node's value in
<code>calculate</code> expressions are explicitly ignored, i.e., if an expression associated
with a compute refers to the instance node associated with the compute, then the instance node
does not take itself as a dependent. A compute is <b>computationally dependent</b> on an
instance node (whose value may or may not be computed) if there is a path of dependents leading
from the instance node through zero or more other instance nodes to the compute. A compute is
part of a <b>circular dependency</b> if it is computationally dependent on itself.</p><div class="note"><p class="prefix"><b>Note:</b></p><p>Referring to a node's value in a <code>calculate</code> on the node, as in the following example, may have effects that vary by implementation: <code><bind nodeset="x" calculate=".+1"/></code>. Model item properties
other than <code>calculate</code>, such as <code>required</code> or <code>readonly</code>
are well-defined in the presence of self-references.</p></div><div class="note"><p class="prefix"><b>Note:</b></p><p>An example of a calculate formula that contains a self-reference (i.e. that refers to the node it calculates)
appears in Section <a href="#model-prop-readOnly"><b>6.1.2 The readonly Property</b></a>. The example enforces a default value for a node
and, as mentioned above, does not create a circular dependency. An example of a circular
dependency is <code><bind nodeset="A|B" calculate="../A + ../B"/></code>. In this example,
node <code>A</code> depends in part on <code>B</code>, and node <code>B</code>
depends in part on <code>A</code>.</p></div><p>When a recalculation event begins, there will be a list <em>L</em> of one or more instance nodes
whose values may have been changed, e.g., by user input being propagated to the instance or by a <code>setvalue</code> action.</p><ol class="enumar"><li><p>An XForms Processor must recalculate computes for nodes in <em>L</em>, if any,
and nodes that are computationally dependent on nodes in <em>L</em>.</p></li><li><p>An XForms Processor must perform only a single recalculation of each compute that is
computationally dependent on one or more of the elements in <em>L</em>.</p></li><li><p>An XForms Processor must recalculate a compute <em>C</em> after recalculating all
computes of instance nodes on which <em>C</em> is computationally dependent.
(Equivalently, an XForms Processor must recalculate a compute <em>C</em> before
recalculating any compute that is computationally dependent on the instance node
associated with <em>C</em>.)</p></li><li><p>Finally, if a compute is part of a circular dependency and also computationally dependent
on an element in <em>L</em>, then an XForms processor must report an exception
(<a href="#evt-computeException"><b>4.5.2 The xforms-compute-exception Event</b></a>).</p></li></ol><p><a href="#recalc"><b>C Recalculation Sequence Algorithm</b></a> describes one possible method for achieving the required recalculation behavior.</p></div><div class="div3">
<h4><a name="evt-revalidate" id="evt-revalidate"></a>4.3.3 The xforms-revalidate Event</h4><p>Dispatched in response to: a request to revalidate a particular XForms Model.</p><p>Target: <code>model</code></p><p>Bubbles: Yes</p><p>Cancelable: Yes</p><p>Context Info: None</p><p id="def-validity">An instance node is <a title="valid" href="#def-valid-node">valid</a> if and only if the following conditions hold:</p><ul><li><p>the constraint model item property is true</p></li><li><p>the value is non-empty if the required model item property is true</p></li><li><p>the node satisfies all applicable XML schema definitions
(including those associated by the type model item property, by an external or an inline schema, or by <code>xsi:type</code>)</p></li></ul><div class="note"><p class="prefix"><b>Note:</b></p><p><code>xsi:type</code> attributes on instance data elements are processed even in the absence of external or inline schema.</p></div><div class="note"><p class="prefix"><b>Note:</b></p><p>The applicable XML schema definitions are determined as defined in Section <a href="#structure-model"><b>3.3.1 The model Element</b></a>.</p></div><p>The default action for this event results in the following:</p><p>All instance data nodes in all <code>instance</code> elements in the <code>model</code> are checked
for validity according to the above definition. If the validity of a node changes, then
either the xforms-valid event must be marked for dispatch if the node changes from invalid to valid
or the xforms-invalid event must be marked for dispatch if the node changes from valid to invalid.
Marking one of these events for dispatch unmarks the other.
</p><div class="note"><p class="prefix"><b>Note:</b></p><p>Since the event sequence for <code>xforms-model-construct</code> excludes <code>xforms-refresh</code> and discards
event notification marks, form controls bound to invalid nodes do not receive an initial <code>xforms-invalid</code> event.</p></div></div><div class="div3">
<h4><a name="evt-refresh" id="evt-refresh"></a>4.3.4 The xforms-refresh Event</h4><p>Dispatched in response to: a request to update all form controls associated with a particular XForms Model.</p><p>Target: <code>model</code></p><p>Bubbles: Yes</p><p>Cancelable: Yes</p><p>Context Info: None</p><p>The default action for this event results in the following:</p><ol class="enumar"><li><p>All <a title="" href="#def-ui-expression">UI Expressions</a> are reevaluated (implementations may optimize this operation but must behave as if all UI Expressions are reevaluated).</p></li><li><p>
A node can be changed by a number of mechanisms in XForms, including confirmed user input to a form control,
an <code>xforms-recalculate</code> (<a href="#evt-recalculate"><b>4.3.2 The xforms-recalculate Event</b></a>), and
the <code>setvalue</code> action (<a href="#action-setvalue"><b>10.2 The setvalue Element</b></a>).
If the value of an instance data node was
changed, then the node must be marked
for dispatching the xforms-value-changed event.</p></li><li><p>If the xforms-value-changed event
is marked for dispatching, then all of the appropriate
model item property notification events must also
be marked for dispatching (xforms-optional or xforms-required,
xforms-readwrite or xforms-readonly, and
xforms-enabled or xforms-disabled).</p></li><li><p>The user interface reflects the state of the model, which means that all forms controls and related UI elements
reflect their corresponding instance data, including:</p><ul><li><p>current values (for the appropriate form controls and related UI elements)</p></li><li><p><a title="" href="#def-validity">validity</a></p></li><li><p>other model item properties (<code>required</code>, <code>readonly</code> and
<code>relevant</code>).</p></li><li><p>the proper number of and content for repeat objects.</p></li></ul><p>This process includes sending the notification events to the form controls.
For each form control, each notification event for which the form control is
a legitimate target and that is marked for dispatching on the bound node must be dispatched
(xforms-value-changed, xforms-valid, xforms-invalid, xforms-optional, xforms-required,
xforms-readwrite, xforms-readonly, and xforms-enabled, xforms-disabled). The notification
events xforms-out-of-range or xforms-in-range must also be dispatched as appropriate.
This specification does not specify an ordering for the events.</p></li></ol></div><div class="div3">
<h4><a name="evt-reset" id="evt-reset"></a>4.3.5 The xforms-reset Event</h4><p>Dispatched in response to: a user request to reset the model.</p><p>Target: <code>model</code></p><p>Bubbles: Yes</p><p>Cancelable: Yes</p><p>Context Info: None</p><p>The default action for this event results in the following:</p><p>The instance data is reset to the tree structure and values it had immediately after having processed the <code>xforms-ready</code> event. Then, the events <code>xforms-rebuild</code>, <code>xforms-recalculate</code>, <code>xforms-revalidate</code> and <code>xforms-refresh</code> are dispatched to the <code>model</code> element in sequence.</p></div><div class="div3">
<h4><a name="evt-next" id="evt-next"></a>4.3.6 The xforms-next and xforms-previous Events</h4><p>Dispatched in response to: user request to navigate to the next or previous <a title="" href="#elems-form-controls">Core Form Control</a>.</p><p>Target: <a title="" href="#elems-form-controls">Core Form Controls</a></p><p>Bubbles: No</p><p>Cancelable: Yes</p><p>Context Info: None</p><p>The default action for these events results in the following: Navigation according to the default navigation order. For example, on a keyboard interface, "tab" might generate an <code>xforms-next</code> event, while "shift+tab" might generate an <code>xforms-previous</code> event. </p><p>Navigation is determined on a containing document-wide basis. The host language is responsible for defining overall navigation order. The following describes a possible technique based on a <code>navindex</code> attribute, using individual form controls as a navigation unit: The <<code>group</code>>, <<code>repeat</code>>, and <<code>switch</code>> structures serve as container navigation units that, instead of providing a single navigation point, create a local navigation context for child form controls (and possibly other substructures). The navigation sequence is determined as follows:</p><ol class="enumar"><li><p>Form controls that have a <code>navindex</code> specified and assign a positive value to it are navigated first.</p><ol class="enumla"><li><p>Outermost form controls are navigated in increasing order of the <code>navindex</code> value. Values need not be sequential nor must they begin with any particular value. Form controls that have identical <code>navindex</code> values are to be navigated in document order.</p></li><li><p>Ancestor form controls (<<code>group</code>>, <<code>repeat</code>>, and <<code>switch</code>>) establish a local navigation sequence. All form controls within a local sequence are navigated, in increasing order of the <code>navindex</code> value, before any outside the local sequence are navigated. Form controls that have identical <code>navindex</code> values are navigated in document order.</p></li></ol></li><li><p> Those form controls that do not specify <code>navindex</code> or supply a value of "0" are navigated next. These form controls are navigated in document order.</p></li><li><p>Those form controls that are disabled, hidden, or not <code>relevant</code> are assigned a relative order in the overall sequence but do not participate as navigable controls.</p></li><li><p> The navigation sequence past the last form control (or before the first) is undefined. XForms Processors may cycle back to the first/last control, remove focus from the form, or other possibilities.</p></li></ol></div><div class="div3">
<h4><a name="evt-focus" id="evt-focus"></a>4.3.7 The xforms-focus Event</h4><p>Dispatched in response to: set focus to a form control.</p><p>Target: <a title="" href="#elems-form-controls">Core Form Control</a>|<code>group</code>|<code>switch</code>|<code>repeat</code></p><p>Bubbles: No</p><p>Cancelable: Yes</p><p>Context Info: None</p><p>The default action for these events results in the following:</p><p>Focus is given to the target form control if the form control is able to accept focus. Changing the focus to a form control within a repeat object may cause one or more repeat index values to be changed as described in Section <a href="#ui-repeat-ui"><b>9.3.4 User Interface Interaction</b></a>.
Setting focus to a <code>repeat</code> container form control sets the focus to the <a title="" href="#def-repeat-object">repeat object</a> associated with the repeat index.
Setting the focus to a <code>group</code> or <code>switch</code> container form control set the focus to the first form control in the container that is able to accept focus.
Any form control is able to accept the focus if it is relevant.</p><div class="note"><p class="prefix"><b>Note:</b></p><p>This event is implicitly invoked to implement XForms accessibility features such as <code>accesskey</code>
and when the user changes the focus. </p></div></div><div class="div3">
<h4><a name="evt-help" id="evt-help"></a>4.3.8 The xforms-help and xforms-hint Events</h4><p>Dispatched in response to: a user request for help or hint information.</p><p>Target: <a title="" href="#elems-form-controls">Core Form Control</a></p><p>Bubbles: Yes</p><p>Cancelable: Yes</p><p>Context Info: None</p><p>The default action for these events results in the following: If the form control has help/hint elements supplied, these are used to construct a message that is displayed to the user. Otherwise, user agents may provide default help or hint messages, but are not required to.</p></div><div class="div3">
<h4><a name="evt-submit" id="evt-submit"></a>4.3.9 The xforms-submit Event</h4><p>See chapter <a href="#submit-evt-submit"><b>11.2 The xforms-submit Event</b></a>.</p></div><div class="div3">
<h4><a name="evt-submit-serialize" id="evt-submit-serialize"></a>4.3.10 The xforms-submit-serialize Event</h4><p>See chapter <a href="#submit-evt-submit-serialize"><b>11.3 The xforms-submit-serialize Event</b></a>.</p></div></div><div class="div2">
<h3><a name="evt-notify" id="evt-notify"></a>4.4 Notification Events</h3><div class="div3">
<h4><a name="evt-insert" id="evt-insert"></a>4.4.1 The xforms-insert Event</h4><p>Dispatched in response to: Successful insertion of one or more nodes by an XForms <code>insert</code> action.</p><p>Target: <code>instance</code></p><p>Bubbles: Yes</p><p>Cancelable: No</p><p>Context Info:</p><table border="1" summary="Event context properties for xforms-insert event"><tbody><tr><th rowspan="1" colspan="1">Property</th><th rowspan="1" colspan="1">Type</th><th rowspan="1" colspan="1">Value</th></tr><tr><td rowspan="1" colspan="1">inserted-nodes</td><td rowspan="1" colspan="1">node-set</td><td rowspan="1" colspan="1">The instance data node or nodes inserted.</td></tr><tr><td rowspan="1" colspan="1">origin-nodes</td><td rowspan="1" colspan="1">node-set</td><td rowspan="1" colspan="1">The instance data nodes referenced by the <code>insert</code> action's <code>origin</code> attribute if present, or the empty nodeset if not present.</td></tr><tr><td rowspan="1" colspan="1">insert-location-node</td><td rowspan="1" colspan="1">node-set</td><td rowspan="1" colspan="1">The <code>insert location node</code> as defined by the <code>insert</code> action.</td></tr><tr><td rowspan="1" colspan="1">position</td><td rowspan="1" colspan="1">string</td><td rowspan="1" colspan="1">The insert position, <code>before</code> or <code>after</code>.</td></tr></tbody></table><p>Default Action: None; notification event only.</p><div class="note"><p class="prefix"><b>Note:</b></p><p>Notification events are those with no default processing defined. Although this event is dispatched by <code>insert</code> processing as a notification, <code>repeat</code> processing associates behavior with the capture phase of this event.</p></div></div><div class="div3">
<h4><a name="evt-delete" id="evt-delete"></a>4.4.2 The xforms-delete Event</h4><p>Dispatched in response to: Successful deletion of one or more nodes by an XForms <code>delete</code> action.</p><p>Target: <code>instance</code></p><p>Bubbles: Yes</p><p>Cancelable: No</p><p>Context Info: </p><table border="1" summary="Event context properties for xforms-delete event"><tbody><tr><th rowspan="1" colspan="1">Property</th><th rowspan="1" colspan="1">Type</th><th rowspan="1" colspan="1">Value</th></tr><tr><td rowspan="1" colspan="1">deleted-nodes</td><td rowspan="1" colspan="1">node-set</td><td rowspan="1" colspan="1">The instance data node or nodes deleted. Note that these nodes are no longer referenced by their parents.</td></tr><tr><td rowspan="1" colspan="1">delete-location</td><td rowspan="1" colspan="1">number</td><td rowspan="1" colspan="1">The <code>delete location</code> as defined by the <code>delete</code> action, or NaN if there is no delete location.</td></tr></tbody></table><p>Default Action: None; notification event only.</p><div class="note"><p class="prefix"><b>Note:</b></p><p>Notification events are those with no default processing defined. Although this event is dispatched by <code>delete</code> processing as a notification, <code>repeat</code> processing associates behavior with the capture phase of this event.</p></div></div><div class="div3">
<h4><a name="evt-valueChanged" id="evt-valueChanged"></a>4.4.3 The xforms-value-changed Event</h4><p>Dispatched in response to: a change to an instance data node bound to a core form control.</p><p>Target: <a title="" href="#elems-form-controls">Core Form Controls</a></p><p>Bubbles: Yes</p><p>Cancelable: No</p><p>Context Info: None</p><p>The default action for this event results in the following: None; notification event only.</p><p>This event is dispatched during <a href="#evt-refresh"><b>4.3.4 The xforms-refresh Event</b></a>
if the bound instance data node has been marked for dispatching this event
due to a change.
</p><div class="note"><p class="prefix"><b>Note:</b></p><p>For incremental processing, this specification does not define how often XForms Processors fire
these events. Implementations are expected to optimize processing (for instance not flashing the
entire screen for each character entered, etc.). </p></div><div class="note"><p class="prefix"><b>Note:</b></p><p>The change to the instance data associated with this event happens before the event is dispatched.</p></div></div><div class="div3">
<h4><a name="evt-valid" id="evt-valid"></a>4.4.4 The xforms-valid Event</h4><p>Dispatched in response to: an instance data node either changing and being or becoming <a title="valid" href="#def-valid-node">valid</a>.</p><p>Target: <a title="" href="#elems-form-controls">Core Form Controls</a>|<code>group</code>|<code>switch</code></p><p>Bubbles: Yes</p><p>Cancelable: No</p><p>Context Info: None</p><p>The default action for this event results in the following: None; notification event only.</p><p>This event is dispatched during <a href="#evt-refresh"><b>4.3.4 The xforms-refresh Event</b></a> if
the bound instance data node has been marked for dispatching
this event in <a href="#evt-revalidate"><b>4.3.3 The xforms-revalidate Event</b></a>.
</p></div><div class="div3">
<h4><a name="evt-invalid" id="evt-invalid"></a>4.4.5 The xforms-invalid Event</h4><p>Dispatched in response to: an instance data node either changing and being or becoming invalid (not <a title="valid" href="#def-valid-node">valid</a>). </p><p>Target: <a title="" href="#elems-form-controls">Core Form Controls</a>|<code>group</code>|<code>switch</code></p><p>Bubbles: Yes</p><p>Cancelable: No</p><p>Context Info: None</p><p>The default action for this event results in the following: None; notification event only.</p><p>This event is dispatched during <a href="#evt-refresh"><b>4.3.4 The xforms-refresh Event</b></a> if
the bound instance data node has been marked for dispatching
this event in <a href="#evt-revalidate"><b>4.3.3 The xforms-revalidate Event</b></a>.
</p></div><div class="div3">
<h4><a name="evt-readonly" id="evt-readonly"></a>4.4.6 The xforms-readonly Event</h4><p>Dispatched in response to: an instance data node either changing and being or becoming readonly. </p><p>Target: <a title="" href="#elems-form-controls">Core Form Controls</a>|<code>group</code>|<code>switch</code></p><p>Bubbles: Yes</p><p>Cancelable: No</p><p>Context Info: None</p><p>The default action for this event results in the following: None; notification event only.</p><p>This event is dispatched during <a href="#evt-refresh"><b>4.3.4 The xforms-refresh Event</b></a> if
the bound instance data node has been marked for dispatching
this event in <a href="#evt-recalculate"><b>4.3.2 The xforms-recalculate Event</b></a>
or <a href="#evt-refresh"><b>4.3.4 The xforms-refresh Event</b></a>.
</p></div><div class="div3">
<h4><a name="evt-readwrite" id="evt-readwrite"></a>4.4.7 The xforms-readwrite Event</h4><p>Dispatched in response to: an instance data node either changing and being or becoming read-write. </p><p>Target: <a title="" href="#elems-form-controls">Core Form Controls</a>|<code>group</code>|<code>switch</code></p><p>Bubbles: Yes</p><p>Cancelable: No</p><p>Context Info: None</p><p>The default action for this event results in the following: None; notification event only.</p><p>This event is dispatched during <a href="#evt-refresh"><b>4.3.4 The xforms-refresh Event</b></a> if
the bound instance data node has been marked for dispatching
this event in <a href="#evt-recalculate"><b>4.3.2 The xforms-recalculate Event</b></a>
or <a href="#evt-refresh"><b>4.3.4 The xforms-refresh Event</b></a>.
</p></div><div class="div3">
<h4><a name="evt-required" id="evt-required"></a>4.4.8 The xforms-required Event</h4><p>Dispatched in response to: an instance data node either changing and being or becoming required. </p><p>Target: <a title="" href="#elems-form-controls">Core Form Controls</a>|<code>group</code>|<code>switch</code></p><p>Bubbles: Yes</p><p>Cancelable: No</p><p>Context Info: None</p><p>The default action for this event results in the following: None; notification event only.</p><p>This event is dispatched during <a href="#evt-refresh"><b>4.3.4 The xforms-refresh Event</b></a> if
the bound instance data node has been marked for dispatching
this event in <a href="#evt-recalculate"><b>4.3.2 The xforms-recalculate Event</b></a>
or <a href="#evt-refresh"><b>4.3.4 The xforms-refresh Event</b></a>.
</p></div><div class="div3">
<h4><a name="evt-optional" id="evt-optional"></a>4.4.9 The xforms-optional Event</h4><p>Dispatched in response to: an instance data node either changing and being or becoming optional. </p><p>Target: <a title="" href="#elems-form-controls">Core Form Controls</a>|<code>group</code>|<code>switch</code></p><p>Bubbles: Yes</p><p>Cancelable: No</p><p>Context Info: None</p><p>The default action for this event results in the following: None; notification event only.</p><p>This event is dispatched during <a href="#evt-refresh"><b>4.3.4 The xforms-refresh Event</b></a> if
the bound instance data node has been marked for dispatching
this event in <a href="#evt-recalculate"><b>4.3.2 The xforms-recalculate Event</b></a>
or <a href="#evt-refresh"><b>4.3.4 The xforms-refresh Event</b></a>.
</p></div><div class="div3">
<h4><a name="evt-enabled" id="evt-enabled"></a>4.4.10 The xforms-enabled Event</h4><p>Dispatched in response to: an instance data node either changing and being or becoming enabled. </p><p>Target: <a title="" href="#elems-form-controls">Core Form Controls</a>|<code>group</code>|<code>switch</code></p><p>Bubbles: Yes</p><p>Cancelable: No</p><p>Context Info: None</p><p>The default action for this event results in the following: None; notification event only.</p><p>This event is dispatched during <a href="#evt-refresh"><b>4.3.4 The xforms-refresh Event</b></a> if
the bound instance data node has been marked for dispatching
this event in <a href="#evt-recalculate"><b>4.3.2 The xforms-recalculate Event</b></a>
or <a href="#evt-refresh"><b>4.3.4 The xforms-refresh Event</b></a>.
</p></div><div class="div3">
<h4><a name="evt-disabled" id="evt-disabled"></a>4.4.11 The xforms-disabled Event</h4><p>Dispatched in response to: an instance data node either changing and being or becoming disabled. </p><p>Target: <a title="" href="#elems-form-controls">Core Form Controls</a>|<code>group</code>|<code>switch</code></p><p>Bubbles: Yes</p><p>Cancelable: No</p><p>Context Info: None</p><p>The default action for this event results in the following: None; notification event only.</p><p>This event is dispatched during <a href="#evt-refresh"><b>4.3.4 The xforms-refresh Event</b></a> if
the bound instance data node has been marked for dispatching
this event in <a href="#evt-recalculate"><b>4.3.2 The xforms-recalculate Event</b></a>
or <a href="#evt-refresh"><b>4.3.4 The xforms-refresh Event</b></a>.
</p></div><div class="div3">
<h4><a name="evt-activate" id="evt-activate"></a>4.4.12 The DOMActivate Event</h4><p>Dispatched in response to: the "default action request" for a core form control, for instance pressing a button or hitting enter.</p><p>Target: <a title="" href="#elems-form-controls">Core Form Controls</a></p><p>Bubbles: Yes</p><p>Cancelable: Yes</p><p>Context Info: None</p><p>The default action for this event results in the following: None; notification event only.</p></div><div class="div3">
<h4><a name="evt-DOMFocusIn" id="evt-DOMFocusIn"></a>4.4.13 The DOMFocusIn Event</h4><p>Dispatched in response to: a form control receiving focus.</p><p>Target: <a title="" href="#elems-form-controls">Core Form Controls</a>|<code>group</code>|<code>switch</code>|<code>repeat</code></p><p>Bubbles: Yes</p><p>Cancelable: No</p><p>Context Info: None</p><p>The default action for this event results in the following: None; notification event only.</p></div><div class="div3">
<h4><a name="evt-DOMFocusOut" id="evt-DOMFocusOut"></a>4.4.14 The DOMFocusOut Event</h4><p>Dispatched in response to: a form control losing focus.</p><p>Target: <a title="" href="#elems-form-controls">Core Form Controls</a>|<code>group</code>|<code>switch</code>|<code>repeat</code></p><p>Bubbles: Yes</p><p>Cancelable: No</p><p>Context Info: None</p><p>The default action for this event results in the following: None; notification event only.</p></div><div class="div3">
<h4><a name="evt-select" id="evt-select"></a>4.4.15 The xforms-select and xforms-deselect Events</h4><p>Dispatched in response to: an <code>item</code> in a <code>select</code>, <code>select1</code>, or a <code>case</code> in a <code>switch</code> becoming selected or deselected.</p><p>Target: <code>item</code> or <code>case</code></p><p>Bubbles: Yes</p><p>Cancelable: No</p><p>Context Info: None</p><p>The default action for this event results in the following: None; notification event only.</p></div><div class="div3">
<h4><a name="evt-in-range" id="evt-in-range"></a>4.4.16 The xforms-in-range Event</h4><p>Dispatched in response to: the value of an instance data node has changed such that the value can now be represented by the form control. </p><p>Target: <a title="" href="#elems-form-controls">Core Form Controls</a></p><p>Bubbles: Yes</p><p>Cancelable: No</p><p>Context Info: None</p><p>The default action for this event results in the following: None; notification event only.</p><p>This event is dispatched whenever the value of an instance data node that was not possible to represent given the constraints specified on a form control has changed such that the value can now be represented by the form control. </p></div><div class="div3">
<h4><a name="evt-out-of-range" id="evt-out-of-range"></a>4.4.17 The xforms-out-of-range Event</h4><p>Dispatched in response to: the value of an instance data node has changed such that the value can not be represented by the form control. </p><p>Target: <a title="" href="#elems-form-controls">Core Form Controls</a></p><p>Bubbles: Yes</p><p>Cancelable: No</p><p>Context Info: None</p><p>The default action for this event results in the following: None; notification event only.</p><p>This event is dispatched whenever the value of an instance data node can not be represented given the constraints specified on a form control. </p></div><div class="div3">
<h4><a name="evt-scroll" id="evt-scroll"></a>4.4.18 The xforms-scroll-first and xforms-scroll-last Events</h4><p>Dispatched in response to: a setindex action attempting to set an index outside the range of a <code>repeat</code>.</p><p>Target: <code>repeat</code></p><p>Bubbles: Yes</p><p>Cancelable: No</p><p>Context Info: None</p><p>The default action for this event results in the following: None; notification event only.</p></div><div class="div3">
<h4><a name="evt-submit-done" id="evt-submit-done"></a>4.4.19 The xforms-submit-done Event</h4><p>See chapter <a href="#submit-evt-submit-done"><b>11.4 The xforms-submit-done Event</b></a>.</p></div></div><div class="div2">
<h3><a name="rpm-errors" id="rpm-errors"></a>4.5 Error Indications</h3><p>Error indications happen as a result of unusual conditions in the XForms Processor. Some of these are "fatal" errors, which halt processing, and bear the suffix "exception". Others are simply for notification, and bear the suffix "error". For all events in this section, it is permissible for the XForms Processor to perform some kind of default handling, for example logging error messages to a file.</p><div class="div3">
<h4><a name="evt-bindingException" id="evt-bindingException"></a>4.5.1 The xforms-binding-exception Event</h4><p>Dispatched as an indication of: an illegal binding expression, or a <code>model</code> attribute that fails to point to the ID of a <code>model</code> element, or a <code>bind</code> attribute that fails to point to the ID of a <code>bind</code> element, or a <code>submission</code> attribute that fails to point to the ID of a <code>submission</code> element, or an <code>instance</code> attribute on the <code>submission</code> element that fails to point to an <code>instance</code> element in the same <code>model</code> element as the <code>submission</code>.</p><p>Target: any element that can contain a binding expression</p><p>Bubbles: Yes</p><p>Cancelable: No</p><p>Context Info: None</p><p>Default Action: Fatal error (halts processing).</p></div><div class="div3">
<h4><a name="evt-computeException" id="evt-computeException"></a>4.5.2 The xforms-compute-exception Event</h4><p>Dispatched as an indication of: an error occurring during XPath evaluation for a model item property (see <a href="#model"><b>6 Model Item Properties</b></a>).</p><p>Target: <code>model</code></p><p>Bubbles: Yes</p><p>Cancelable: No</p><p>Context Info:</p><table border="1" summary="Event context properties for xforms-compute-exception event"><tbody><tr><th rowspan="1" colspan="1">Property</th><th rowspan="1" colspan="1">Type</th><th rowspan="1" colspan="1">Value</th></tr><tr><td rowspan="1" colspan="1">error-message</td><td rowspan="1" colspan="1">string</td><td rowspan="1" colspan="1">An implementation-specific string that should contain the expression being processed when the exception was detected.</td></tr></tbody></table><p>Default Action: Fatal error (halts processing).</p></div><div class="div3">
<h4><a name="evt-versionException" id="evt-versionException"></a>4.5.3 The xforms-version-exception Event</h4><p>Dispatched as an indication of failure of the version checks defined in the description of the <code>version</code> attribute in Section <a href="#structure-model"><b>3.3.1 The model Element</b></a>.</p><p>Target: the default <code>model</code></p><p>Bubbles: Yes</p><p>Cancelable: No</p><p>Context Info: </p><table border="1" summary="Event context properties for xforms-version-exception event"><tbody><tr><th rowspan="1" colspan="1">Property</th><th rowspan="1" colspan="1">Type</th><th rowspan="1" colspan="1">Value</th></tr><tr><td rowspan="1" colspan="1">error-information</td><td rowspan="1" colspan="1">string</td><td rowspan="1" colspan="1">An implementation-specific error string</td></tr></tbody></table><p>Default Action: Fatal error (halts processing).</p><div class="note"><p class="prefix"><b>Note:</b></p><p>This exception occurs early in processing. XForms processors are not expected to
product XForms user interface elements nor even execute XForms action handlers (such as a
<code>message</code> action) in response to this event. This exception is dispatched for the benefit of
implementation-specific processing code that may be monitoring the behavior of an XForms processor.</p></div></div><div class="div3">
<h4><a name="evt-linkException" id="evt-linkException"></a>4.5.4 The xforms-link-exception Event</h4><p>Dispatched as an indication of: a failure to traverse or process the result of
a link in a situation critical to form processing,
such as schema or instance initialization.</p><p>Target: <code>model</code> associated with the in-scope evaluation context node of the element performing the link</p><p>Bubbles: Yes</p><p>Cancelable: No</p><p>Context Info: </p><table border="1" summary="Event context properties for xforms-link-exception event"><tbody><tr><th rowspan="1" colspan="1">Property</th><th rowspan="1" colspan="1">Type</th><th rowspan="1" colspan="1">Value</th></tr><tr><td rowspan="1" colspan="1">resource-uri</td><td rowspan="1" colspan="1">string</td><td rowspan="1" colspan="1">The URI associated with the failed link (xsd:anyURI)</td></tr></tbody></table><p>Default Action: Fatal error (halts processing).</p><div class="note"><p class="prefix"><b>Note:</b></p><p>This exception occurs early in processing. XForms processors are not expected to
produce XForms user interface elements nor even execute XForms action handlers (such as a
<code>message</code> action) in response to this event. This exception is dispatched for the benefit of
implementation-specific processing code that may be monitoring the behavior of an XForms processor.</p></div></div><div class="div3">
<h4><a name="evt-output-error" id="evt-output-error"></a>4.5.5 The xforms-output-error Event</h4><p>Dispatched by the processor immediately after the failure of an <code>output</code> to render or update the rendition of content.</p><p>Target: <code>output</code></p><p>Bubbles: Yes</p><p>Cancelable: No</p><p>Context Info: None.</p><p>Default Action: None; notification event only.</p><div class="note"><p class="prefix"><b>Note:</b></p><p>The <code>output</code> element content can include XForms actions, so an <code>output</code> element can contain
an event handler for the <code>xforms-output-error</code> event. See Section <a href="#ui-output"><b>8.1.5 The output Element</b></a>.</p></div></div><div class="div3">
<h4><a name="evt-submit-error" id="evt-submit-error"></a>4.5.6 The xforms-submit-error Event</h4><p>See chapter <a href="#submit-evt-submit-error"><b>11.5 The xforms-submit-error Event</b></a>.</p></div></div><div class="div2">
<h3><a name="rpm-event-sequences" id="rpm-event-sequences"></a>4.6 Event Sequencing</h3><p>The previous sections describe processing associated with individual events. This section gives the overall sequence of related events that
must occur in several common situations. In the following lists, events that may be fired more than once are prefixed with [n].</p><div class="div3">
<h4><a name="sequence-for-input" id="sequence-for-input"></a>4.6.1 For <code>input</code>, <code>secret</code>, <code>textarea</code>, <code>range</code>, or <code>upload</code> Controls</h4><ul><li><p>When the form control is interactively changed, and has the <code>incremental="true"</code> setting, the event sequence described at <a href="#rpm-event-seq-vc"><b>4.6.7 Sequence: Value Change</b></a> may be initiated at implementation dependent intervals.</p></li><li><p>When the form control is interactively changed and does not have the <code>incremental="true"</code> setting, no events are required to be dispatched, and thus no order is defined.</p></li><li><p>When the user activates the control and the value has changed, then, after the new value is placed into the bound instance node, the event sequence consists of the events described at <a href="#rpm-event-seq-vc"><b>4.6.7 Sequence: Value Change</b></a> followed by dispatching the DOMActivate event. See <a href="#ui-input"><b>8.1.2 The input Element</b></a> for an example.</p></li><li><p>When focus changes from the form control and the value has changed, then, after the new value is placed into the bound instance node, the event sequence is as described at <a href="#rpm-event-seq-vc"><b>4.6.7 Sequence: Value Change</b></a>.</p></li></ul></div><div class="div3">
<h4><a name="sequence-for-output" id="sequence-for-output"></a>4.6.2 For <code>output</code> Controls</h4><ul><li><p>The implementation of an <code>output</code> dispatches <code>xforms-output-error</code> if it unable to process the output data (such as corrupt image data when the output mediatype indicates it is image data). This event may occur each time the <code>output</code> is given new data (such as a change of data in the bound data node or a change of the bound data node).</p></li></ul></div><div class="div3">
<h4><a name="sequence-for-select" id="sequence-for-select"></a>4.6.3 For <code>select</code> or <code>select1</code> Controls</h4><ul><li><p>When a selection is interactively changed, and the form control has the <code>incremental="true"</code> setting (which is the default for the <code>select</code> or <code>select1</code> elements), the event sequence is described at
<a href="#rpm-event-seq-swovc"><b>4.6.6 Sequence: Selection Without Value Change</b></a>, which may be followed immediately by the sequence described at <a href="#rpm-event-seq-vc"><b>4.6.7 Sequence: Value Change</b></a>.</p></li><li><p>When a selection is interactively changed, and the <code>select</code> or <code>select1</code> form control has the <code>incremental="false"</code> setting, the event sequence is described at <a href="#rpm-event-seq-swovc"><b>4.6.6 Sequence: Selection Without Value Change</b></a>.</p></li><li><p>When the user activates the control and the selection has changed, then, after the new value is placed into the bound instance node, the event sequence consists of the events described at <a href="#rpm-event-seq-vc"><b>4.6.7 Sequence: Value Change</b></a> followed by dispatching the DOMActivate event. Note that this event sequence will have been preceded by the event sequence described at <a href="#rpm-event-seq-swovc"><b>4.6.6 Sequence: Selection Without Value Change</b></a> at the moment the selection was changed.</p></li><li><p>When focus changes from the form control and the selection has changed, then, after the new value is placed into the bound instance node, the event sequence is as described at <a href="#rpm-event-seq-vc"><b>4.6.7 Sequence: Value Change</b></a>. Note that this event sequence will have been preceded by the event sequence described at <a href="#rpm-event-seq-swovc"><b>4.6.6 Sequence: Selection Without Value Change</b></a> at the moment the selection was changed.</p></li></ul></div><div class="div3">
<h4><a name="sequence-for-trigger" id="sequence-for-trigger"></a>4.6.4 For <code>trigger</code> Controls</h4><ul><li><p>Activating the form control causes the event sequence defined at <a href="#rpm-event-seq-aat"><b>4.6.8 Sequence: Activating a Trigger</b></a>.</p></li></ul></div><div class="div3">
<h4><a name="sequence-for-submit" id="sequence-for-submit"></a>4.6.5 For <code>submit</code> Controls</h4><ul><li><p>Activating the form control causes the event sequence defined at <a href="#rpm-event-seq-aat"><b>4.6.8 Sequence: Activating a Trigger</b></a>, followed immediately by the event sequence defined at <a href="#rpm-event-seq-s"><b>4.6.9 Sequence: Submission</b></a>.</p></li></ul></div><div class="div3">
<h4><a name="rpm-event-seq-swovc" id="rpm-event-seq-swovc"></a>4.6.6 Sequence: Selection Without Value Change</h4><ol class="enumar"><li><p>xforms-deselect (for each <code>item</code> deselected by the change, if any)</p></li><li><p>xforms-select (for each <code>item</code> selected by the change, if any)</p></li></ol></div><div class="div3">
<h4><a name="rpm-event-seq-vc" id="rpm-event-seq-vc"></a>4.6.7 Sequence: Value Change</h4><ol class="enumar"><li><p>xforms-recalculate</p></li><li><p>xforms-revalidate</p></li><li><p>xforms-refresh performs reevaluation of
UI binding expressions then dispatches these
events according to value changes, model
item property changes and validity changes:</p><ul><li><p>[n] xforms-value-changed</p></li><li><p>[n] xforms-valid or xforms-invalid</p></li><li><p>[n] xforms-enabled or xforms-disabled</p></li><li><p>[n] xforms-optional or xforms-required</p></li><li><p>[n] xforms-readonly or xforms-readwrite</p></li><li><p>[n] xforms-out-of-range or xforms-in-range</p></li></ul><p>(The order in which these events are dispatched is not defined).</p></li><li><p>Perform further deferred updates as necessary</p></li></ol></div><div class="div3">
<h4><a name="rpm-event-seq-aat" id="rpm-event-seq-aat"></a>4.6.8 Sequence: Activating a Trigger</h4><ol class="enumar"><li><p>DOMActivate</p></li></ol></div><div class="div3">
<h4><a name="rpm-event-seq-s" id="rpm-event-seq-s"></a>4.6.9 Sequence: Submission</h4><ol class="enumar"><li><p>xforms-submit</p></li><li><p>xforms-submit-serialize</p></li><li><p>xforms-submit-done or xforms-submit-error</p></li></ol></div></div><div class="div2">
<h3><a name="idref-resolve" id="idref-resolve"></a>4.7 Resolving ID References in XForms</h3><p>The element of a document for which an IDREF must be resolved is called the <b>source element</b>, and the element
bearing the matching ID, if there is one, is called the <b>target element</b>. Due to the run-time expansion of repeated
content in XForms, it is possible that there will be more than one occurrence of both the source and target elements. This
section describes how XForms IDREF resolution works to accommodate such repetition of the originating document's content.</p><p>Each run-time occurrence of the source element is called a <b>source object</b>, and each run-time occurrence of the
target element is called a <b>target object</b>. It is the source object that performs the IDREF resolution, and the result
of the search is either null or a target object.</p><p>Whether or not repeated content is involved, a null search result for an IDREF resolution is handled differently depending on
the source object. If there is a null search result for the target object and the source object is an XForms action such as <code>dispatch</code>,
<code>send</code>, <code>setfocus</code>, <code>setindex</code> or <code>toggle</code>, then the action is terminated with no effect. Similarly, a
<code>submit</code> form control does not dispatch <code>xforms-submit</code> if its <code>submission</code> attribute does not indicate
an existing <code>submission</code> element. Likewise, when an XPath function associated with the source object performs the
IDREF search and a null result is obtained, the function returns an empty result such as <code>NaN</code> for the
<code>index()</code> function or empty nodeset for the <code>instance()</code> function.
However, an <code>xforms-binding-exception</code> occurs if there is a null search result for the target object indicated
by attributes <code>bind</code>, <code>model</code> and <code>instance</code>.</p><p>If the target element is not repeated, then the search for the target object is trivial since there is only one associated with the
target element that bears the matching ID. This is true regardless of whether or not the source object is repeated. However,
if the target element is repeated, then additional information must be used to help select a target object from among those
associated with the identified target element. </p><div class="div3">
<h4><a name="idref-resolve-repeat" id="idref-resolve-repeat"></a>4.7.1 References to Elements within a repeat Element</h4><p>When the target element that is identified by the IDREF of a source object has one or more <code>repeat</code> elements as ancestors,
then the set of ancestor repeats are partitioned into two subsets, those in common with the source element and those that are
not in common. Any ancestor <code>repeat</code> elements of the target element not in common with the source element are descendants
of the <code>repeat</code> elements that the source and target element have in common, if any.</p><p>For the <code>repeat</code> elements that are in common, the desired target object exists in the same set of run-time objects that
contains the source object. Then, for each ancestor <code>repeat</code> of the target element that is not in common with the source element,
the current index of the <code>repeat</code> determines the set of run-time objects that contains the desired target object.</p></div><div class="div3">
<h4><a name="idref-resolve-bind" id="idref-resolve-bind"></a>4.7.2 References to Elements within a bind Element</h4><p>When a source object expresses a Single Node Binding or Node Set Binding with a <code>bind</code> attribute, the IDREF of the <code>bind</code>
attribute is resolved to a target bind object whose associated nodeset is used by the Single Node Binding or Node Set Binding.
However, if the target <code>bind</code> element has one or more <code>bind</code> element ancestors, then the identified <code>bind</code>
may be a target element that is associated with more than one target bind object.</p><p>If a target <code>bind</code> element is outermost, or if all of its ancestor <code>bind</code> elements have <code>nodeset</code> attributes
that select only one node, then the target <code>bind</code> only has one associated bind object, so this is the desired
target bind object whose nodeset is used in the Single Node Binding or Node Set Binding. Otherwise, the in-scope evaluation
context node of the source object containing the <code>bind</code> attribute is used to help select the appropriate target bind object
from among those associated with the target <code>bind</code> element.</p><p>From among the bind objects associated with the target <code>bind</code> element, if there exists a bind object created with the
same in-scope evaluation context node as the source object, then that bind object is the desired target bind object. Otherwise,
the IDREF resolution produced a null search result.</p></div></div><div class="div2">
<h3><a name="expr-instance" id="expr-instance"></a>4.8 DOM Interface for Access to Instance Data</h3><p> For each <code>model</code> element, the XForms Processor maintains the state in an internal structure called <a title="instance data" href="#def-instance-data">instance data</a> that conforms to the XPath Data Model <a href="#ref-xpath-1.0">[XPath 1.0]</a>. XForms Processors that implement DOM must provide DOM access to this instance data via the interface defined below. </p><div class="note"><p class="prefix"><b>Note:</b></p><p>Instance data always has a single root element, and thus corresponds to a DOM Document. </p></div><p>The IDL for this interface follows:</p><div class="exampleInner"><pre>#include "dom.idl"
pragma prefix "w3c.org"
module xforms {
interface XFormsModelElement : dom::Element {
dom::Document getInstanceDocument(in dom::DOMString instanceID)
raises(dom::DOMException);
void rebuild();
void recalculate();
void revalidate();
void refresh();
};
};</pre></div><div class="div3">
<h4><a name="idl-getInstanceDocument" id="idl-getInstanceDocument"></a>4.8.1 The getInstanceDocument() Method</h4><p>If the <code>instance-id</code> parameter is the empty string, then the document element of the default instance is returned. Otherwise, this method returns a DOM Document that corresponds to the instance data associated with the <code>instance</code> element containing an <code>ID</code> matching the <code>instance-id</code> parameter. If there is no matching instance data, a <code>DOMException</code> is thrown. </p><p>The implementation of the DOM interface for the instance document must not permit direct mutations of readonly instance nodes. Specifically, the implementation must not allow insertion of a node
whose parent is readonly, direct deletion of a readonly node, nor setting the content of a readonly node. A node that is not readonly can be deleted, including all descendants, even if it has readonly descendants.</p></div><div class="div3">
<h4><a name="idl-rebuild" id="idl-rebuild"></a>4.8.2 The rebuild() Method</h4><p>This method signals the XForms Processor to rebuild any internal data structures used to track computational dependencies within this XForms Model. This method takes no parameters and raises no exceptions. </p></div><div class="div3">
<h4><a name="idl-recalculate" id="idl-recalculate"></a>4.8.3 The recalculate() Method</h4><p>This method signals the XForms Processor to perform a full recalculation of this XForms Model. This method takes no parameters and raises no exceptions. </p></div><div class="div3">
<h4><a name="idl-revalidate" id="idl-revalidate"></a>4.8.4 The revalidate() Method</h4><p>This method signals the XForms Processor to perform a full revalidation of this XForms Model. This method takes no parameters and raises no exceptions. </p></div><div class="div3">
<h4><a name="idl-refresh" id="idl-refresh"></a>4.8.5 The refresh() Method</h4><p>This method signals the XForms Processor to perform a full refresh of form controls bound to instance nodes within this XForms Model. This method takes no parameters and raises no exceptions. </p></div></div><div class="div2">
<h3><a name="expr-hasfeature" id="expr-hasfeature"></a>4.9 Feature string for the hasFeature method call</h3><p>For this version of the XForms specification, the feature string for the <a href="#ref-dom2-core">[DOM2 Core]</a> <code>DOMImplementation</code> interface <code>hasFeature</code> method call is <code>"org.w3c.xforms.dom"</code> and the version string is <code>"1.0"</code>. </p></div></div><div class="div1">
<h2><a name="datatypes" id="datatypes"></a>5 Datatypes</h2><p>This chapter defines the datatypes used in defining an <a title="XForms Model" href="#def-XForms-Model">XForms Model</a>.</p><div class="div2">
<h3><a name="datatypes-schema" id="datatypes-schema"></a>5.1 XML Schema Built-in Datatypes</h3><p>XForms supports all XML Schema 1.0 <a title="datatype" href="#def-datatype">datatypes</a> except for <code>xsd:duration</code>, <code>xsd:ENTITY</code>, <code>xsd:ENTITIES</code>, and <code>xsd:NOTATION</code>. Concepts <a title="value space" href="#def-value-space">value space</a>, <a title="lexical space" href="#def-lexical-space">lexical space</a> and constraining <a title="facet" href="#def-facet">facet</a>s are as specified in <a href="#ref-xschema-2">[XML Schema part 2]</a>. XForms Processors must treat these datatypes as in-scope without requiring the inclusion of an XML Schema.</p><div class="note"><p class="prefix"><b>Note:</b></p><p>The built-in datatype <code>xsd:duration</code> is not supported, except as an abstract datatype. Instead, either <code>xforms:dayTimeDuration</code> or <code>xforms:yearMonthDuration</code> should be used.</p></div></div><div class="div2">
<h3><a name="datatypes-xforms" id="datatypes-xforms"></a>5.2 XForms Datatypes</h3><p>XForms defines the following types in the XForms namespace. These datatypes can be used in the <code>type</code> model item property without a namespace prefix when the default namespace is the XForms namespace. All of these datatypes allow empty content. XForms Processors must treat these datatypes as in-scope without requiring the inclusion of an XML Schema. </p><div class="div3">
<h4><a name="empty-content-types" id="empty-content-types"></a>5.2.1 Additional XForms Datatypes to Allow Empty Content</h4><p>Many default XML schema types report empty content as invalid, which conflicts with the use of the <code>required</code> model item property. The following XForms datatypes are defined as having a lexical space consisting of either the empty string or the lexical space of the corresponding XML schema datatype. Although some XML schema datatypes do allow empty string content, they have also been added to the available XForms datatypes for form authoring consistency. </p><p>Built-in primitive types (in the XForms namespace):</p><blockquote><p>dateTime<br>time<br>date<br>gYearMonth<br>gYear<br>gMonthDay<br>gDay<br>gMonth<br>string<br>boolean<br>base64Binary<br>hexBinary<br>float<br>decimal<br>double<br>anyURI<br>QName</p></blockquote><p>Built-in derived types (in the XForms namespace):</p><blockquote><p>normalizedString<br>token<br>language<br>Name<br>NCName<br>ID<br>IDREF<br>IDREFS<br>NMTOKEN<br>NMTOKENS<br>integer<br>nonPositiveInteger<br>negativeInteger<br>long<br>int<br>short<br>byte<br>nonNegativeInteger<br>unsignedLong<br>unsignedInt<br>unsignedShort<br>unsignedByte<br>positiveInteger</p></blockquote></div><div class="div3">
<h4><a name="dt-listItem" id="dt-listItem"></a>5.2.2 xforms:listItem</h4><p>This datatype serves as a base for the <a title="" href="#dt-listItems">listItems</a> datatype. The lexical space for listItem permits one or more characters valid for xsd:string, except white space characters. </p></div><div class="div3">
<h4><a name="dt-listItems" id="dt-listItems"></a>5.2.3 xforms:listItems</h4><p>XForms includes form controls that produce simpleType list content. This is facilitated by defining a <code>derived-by-list</code> datatype.
The lexical space for listItems is defined by list-derivation from <a title="" href="#dt-listItem">listItem</a>.</p><div class="note"><p class="prefix"><b>Note:</b></p><p>In most cases, it is better to use markup to distinguish items in a list. See <a href="#ui-selection-commonelems-itemset"><b>9.3.6 The itemset Element</b></a>.</p></div></div><div class="div3">
<h4><a name="dt-dayTimeDuration" id="dt-dayTimeDuration"></a>5.2.4 xforms:dayTimeDuration</h4><p>XForms includes a totally ordered duration datatype that can represent a duration of days, hours, minutes, and fractional seconds.
The value space for this datatype is the set of fractional second values. This datatype is derived from <code>xsd:duration</code>.</p><p>The dayTimeDuration datatype is made available by the XForms processor based on the following lexical space definition:</p><div class="exampleOuter">
<div class="exampleHead">xforms:dayTimeDuration type definition</div><div class="exampleInner"><pre><xs:simpleType name="dayTimeDuration">
<xs:restriction base="xsd:string">
<xs:pattern value="([\-]?P([0-9]+D(T([0-9]+(H([0-9]+(M([0-9]+(\.[0-9]*)?S
|\.[0-9]+S)?|(\.[0-9]*)?S)|(\.[0-9]*)?S)?|M([0-9]+
(\.[0-9]*)?S|\.[0-9]+S)?|(\.[0-9]*)?S)|\.[0-9]+S))?
|T([0-9]+(H([0-9]+(M([0-9]+(\.[0-9]*)?S|\.[0-9]+S)?
|(\.[0-9]*)?S)|(\.[0-9]*)?S)?|M([0-9]+(\.[0-9]*)?S|\.[0-9]+S)?
|(\.[0-9]*)?S)|\.[0-9]+S)))?"/>
</xs:restriction>
</xs:simpleType></pre></div></div></div><div class="div3">
<h4><a name="dt-yearMonthDuration" id="dt-yearMonthDuration"></a>5.2.5 xforms:yearMonthDuration</h4><p>XForms includes a totally ordered duration datatype that can represent a duration of a whole number of months and years.
The value space for this datatype is the set of integer month values. This datatype is derived from <code>xsd:duration</code>.</p><p>The yearMonthDuration datatype is made available by the XForms processor based on the following lexical space definition:</p><div class="exampleOuter">
<div class="exampleHead">xforms:yearMonthDuration type definition</div><div class="exampleInner"><pre><xs:simpleType name="yearMonthDuration">
<xs:restriction base="xsd:string">
<xs:pattern value="([\-]?P[0-9]+(Y([0-9]+M)?|M))?"/>
</xs:restriction>
</xs:simpleType></pre></div></div></div><div class="div3">
<h4><a name="dt-email" id="dt-email"></a>5.2.6 xforms:email</h4><p> This datatype represents an email address,
as defined by <a href="#ref-rfc-2822">[RFC 2822]</a>. Internationalized email addresses are not restricted by
XForms beyond the definition in the RFC. For simplicity, some extremely uncommon features of the
RFC syntax are not allowed, such as "Obsolete Addressing" from section 4.4, square-bracketed
"domain-literal"s, and insignificant whitespace and comments.</p><p>Examples of valid xforms:email addresses</p><blockquote><p>editors@example.com<br>~my_mail+{nospam}$?@sub-domain.example.info</p></blockquote><p>Examples of invalid xforms:email addresses</p><blockquote><p>editors@(this is a comment)example.info<br>editors{at}example{dot}info<br>mailto:editors@example.com</p></blockquote><div class="note"><p class="prefix"><b>Note:</b></p><p>The string <code>mailto:editors@example.com</code> is a valid xsd:anyURI but not a valid xforms:email because the colon separator for the URI scheme is
not allowed before the '@' symbol. A valid xforms:email address does not include a <code>mailto:</code> URI scheme.</p></div><div class="note"><p class="prefix"><b>Note:</b></p><p>It is outside the scope of XForms to determine whether a given email address actually corresponds to an active mailbox.</p></div><p>The email datatype is made available by the XForms processor based on the following lexical space definition:</p><div class="exampleOuter">
<div class="exampleHead">xforms:email type definition</div><div class="exampleInner"><pre><xs:simpleType name="email">
<xs:restriction base="xsd:string">
<xs:pattern value="([A-Za-z0-9!#-'\*\+\-/=\?\^_`\{-~]+(\.[A-Za-z0-9!#-'\*\+\-/=\?\^_`\{-~]+)*@[A-Za-z0-9!#-'\*\+\-/=\?\^_`\{-~
]+(\.[A-Za-z0-9!#-'\*\+\-/=\?\^_`\{-~]+)*)?"/>
</xs:restriction>
</xs:simpleType></pre></div></div></div><div class="div3">
<h4><a name="dt-card-number" id="dt-card-number"></a>5.2.7 xforms:card-number</h4><p>This type defines the basic lexical properties of a datatype that can be used to represent various ID, debit and credit card numbers..
The lexical space of the xforms:card-number datatype is a pattern restriction on <code>xsd:string</code>: it must be zero or more digits (0 - 9).</p><div class="note"><p class="prefix"><b>Note:</b></p><p>The display representation of this datatype by form controls is not required to match the lexical space of the bound instance data. User agents should apply appropriate conventions to the display and input of values, including separator characters.</p></div><div class="exampleOuter">
<div class="exampleHead">xforms:card-number type definition</div><div class="exampleInner"><pre>
<xs:simpleType name="card-number">
<xs:annotation>
<xs:documentation>
This type defines the basic lexical properties for a dataypte that can be used to represent
various ID numbers such as for debit and credit cards.
This type does not apply the Luhn checksum algorithm.
</xs:documentation>
</xs:annotation>
<xs:restriction base="xsd:string">
<xs:pattern value="[0-9]*"/>
</xs:restriction>
</xs:simpleType></pre></div></div><p>The standard defines the structure of the number as well as how to apply the Luhn formula to ensure a correct check digit. This type only specifies the format of the number. The complementary XPath function <code>is-card-number()</code> should be used to validate that the ID number conforms to the specification.</p><div class="exampleOuter">
<div class="exampleHead">Credit Card Example</div><div class="exampleInner"><pre>
<model xmlns="http://www.w3.org/2002/xforms">
<instance>
<payment method="cc" xmlns="http://commerce.example.com/payment">
<number>4111111111111111</number>
<expiry/>
</payment>
</instance>
<bind nodeset="number" type="card-number" constraint="is-card-number(.)"/>
</model></pre></div><p>This example specifies that the element <code>number</code> is of the type <code>card-number</code> and that to be valid the <code>is-card-number()</code> function must evaluate to true indicating that check digit is valid.
</p></div></div></div></div><div class="div1">
<h2><a name="model" id="model"></a>6 Model Item Properties</h2><p>This chapter defines infoset contributions that can be bound to instance data nodes with element <code>bind</code> (see <a href="#structure-bind-element"><b>3.3.4 The bind Element</b></a>). The combination of these contributions to an <a title="instance data item" href="#def-instance-data-node">instance data node</a> is called a <a title="model item" href="#def-model-item">model item</a>. Taken together, these contributions are called <a title="model item property" href="#def-model-item-property">model item properties</a>, and are defined in the following section. In contrast, the term <a title="Schema constraint" href="#def-Schema-constraint">Schema constraint</a> refers only to XML Schema constraints from the <a title="facet" href="#def-facet">facet</a>s of a given datatype.</p><div class="div2">
<h3><a name="model-xformsconstraints" id="model-xformsconstraints"></a>6.1 Model Item Property Definitions</h3><p>Model item properties can be distinguished along various axes.</p><p>Computed expressions vs. fixed properties:</p><ul><li><p>Fixed properties are static values that the XForms Processor evaluates only once. Such properties consist of literals, and are not subject to XPath evaluation.</p></li><li><p><a title="computed expression" href="#def-computed-expression">Computed expressions</a> are XPath expressions that provide a value to the XForms Processor. Such values are recalculated at certain times as specified by the XForms Processing Model (see <a href="#rpm"><b>4 Processing Model</b></a>). These expressions encode dynamic properties, often constraints, such as the dependency among various data items. Computed expressions are not restricted to examining the value of the instance data node to which they apply. XPath expressions provide the means to traverse the instance data; more complex computations may be encoded as call-outs to external scripts.</p></li></ul><p>Inheritance rules:</p><p>Some model item properties define inheritance rules, in which case the XForms Processor needs to keep track of two separate values: 1) the <b>local value</b>, which is applied from an attribute of element <code>bind</code>, and 2) the <b>inherited value</b>, which is determined by combining the evaluated local value with the evaluated values from ancestor nodes in the instance data.</p><div class="note"><p class="prefix"><b>Note:</b></p><p>The sample recalculation algorithm defined in <a href="#recalc"><b>C Recalculation Sequence Algorithm</b></a> is defined to operate only on the local values of a model item property. It assumes that an implementation propagates the combined values to a node's descendants.</p></div><p>Assigning local values:</p><p>Local values are assigned by processing all bind elements in an XForms Model in document order. It is an error to attempt to set a model item property twice on the same node (see <a href="#evt-rebuild"><b>4.3.1 The xforms-rebuild Event</b></a> for details).. </p><p>The following sections list the model item properties available as part of all <a title="model item" href="#def-model-item">model items</a>. For each, the following information is provided:</p><blockquote><p>Description<br>Computed Expression (yes or no)<br>Legal Values<br>Default Value<br>Inheritance Rules</p></blockquote><div class="div3">
<h4><a name="model-prop-type" id="model-prop-type"></a>6.1.1 The type Property</h4><p>Description:
The <code>type</code> model item property can be applied to both elements and attributes.
The <code>type</code> model item property is not applied to instance nodes that contain child elements.
The <code>type</code> model item property associates a datatype (as defined in <a href="#ref-xschema-2">[XML Schema part 2]</a>) with the string-value (as defined in <a href="#ref-xpath-1.0">[XPath 1.0]</a>) of an instance node.
The datatype being associated can be obtained from a simpleType definition or a simpleContent definition from a complexType.
If the datatype cannot be obtained as just described, then the Default Value of <code>xsd:string</code> is used.
This model item property does not prevent form controls and XForms actions from setting invalid values into data nodes.
</p><p>Computed Expression: No.</p><p>Legal Values: Any <code>xsd:QName</code> representing a datatype definition in an XML Schema.
The namespace context from the parent <code>bind</code> of the <code>type</code>
attribute is used to resolve the namespace qualification of the value.</p><p>Default Value: <code>xsd:string</code>.</p><p>Inheritance Rules: does not inherit.</p><p>This model item property contributes to the overall validity assessment of a node; the effect of validity state on bound form controls is described in Section <a href="#ui-processing"><b>8.1.1 Implementation Requirements Common to All Form Controls</b></a>.</p><div class="note"><p class="prefix"><b>Note:</b></p><p>In XML Schema, an element can be made nillable. Although this means it can have empty content, nillable is defined by <a href="#ref-xschema-1">[XML Schema part 1]</a>
to be a property of an element, not a type. Therefore, the nillable property from XML Schema cannot be applied to instance nodes using the
<code>type</code> model item property. </p></div><div class="exampleOuter">
<div class="exampleHead">Associating datatypes with instance nodes</div><div class="exampleInner"><pre>
<model xmlns:my="http://example.org">
<xs:schema targetNamespace="http://example.org" xmlns:my="http://example.org">
<xs:simpleType name="Currency">
<xs:restriction base="xsd:string">
<xs:enumeration value="USD"/>
<xs:enumeration value="EUR"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="Price">
<xs:simpleContent>
<xs:extension base="xsd:double">
<xs:attribute name="currency" type="my:Currency" use="optional" default="USD"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:schema>
<instance>
<data xmlns="http://example.org">
<aString>Hello, world!</aString>
<simpleType>
<price>100.00</price>
<price>abc</price>
<price currency="EUR">100.00</price>
<price currency="EUR">abc</price>
</simpleType>
<complexType>
<price>100.00</price>
<price>abc</price>
<price currency="abc">100.00</price>
<price currency="EUR">abc</price>
</complexType>
</data>
</instance>
<bind nodeset="my:aString" type="xsd:string"/>
<bind nodeset="my:simpleType/my:price" type="xsd:double"/>
<bind nodeset="my:complexType/my:price" type="my:Price"/>
<bind nodeset="my:complexType/my:price[3]/@currency" type="my:Currency"/>
<bind nodeset="/my:data" type="xsd:string"/>
</model>
</pre></div><p>The first bind expresses the default datatype of xsd:string.</p><p>The second and third binds place type model item properties on each
of the four <code>price</code> element children of the elements
<code>simpleType</code> and <code>complexType</code>. Both binds associate
the datatype <code>xsd:double</code> with the nodes. In both cases,
the first and third nodes are considered valid according to the type
model item property because their content matches the <code>xsd:double</code>
datatype constraint. For both binds, the second and fourth <code>price</code> nodes
are not valid due to their content.</p><p>The fourth bind places a type model item property on the <code>currency</code>
attribute of the third <code>price</code> element. According to this association,
the <code>currency</code> attribute node is not valid because its content does
not match the enumeration given for <code>my:Currency</code>. Note that
the containing element <code>price</code> is valid according to its type
model item property.</p><p>The fifth bind attempts to associate a datatype with the <code>data</code>
element. The association is ignored since the <code>data</code> element
contains child elements.</p></div></div><div class="div3">
<h4><a name="model-prop-readOnly" id="model-prop-readOnly"></a>6.1.2 The readonly Property</h4><p>Description: describes whether the node content is restricted from changing. </p><p>Computed Expression: Yes. </p><p>Legal Values: Any expression that is convertible to XPath <code>boolean</code> with <code>boolean()</code>. </p><p>Default Value: <code>false()</code>, unless a <code>calculate</code> is specified for the value property, then <code>true()</code>. </p><p>Inheritance Rules: If any ancestor node evaluates to <code>true</code>, this value is treated as <code>true</code>. Otherwise, the local value is used.</p><div class="note"><p class="prefix"><b>Note:</b></p><p>This is the equivalent of taking the logical OR of the evaluated <code>readonly</code> property on the local and every ancestor node.</p></div><p>When <code>true</code>, this model item property indicates that the XForms Processor must not allow any direct changes to the content of the bound instance data node from constructs other than the model item property system (i.e. other than a <code>calculate</code>). Instance mutations performed by <code>submission</code>, form controls, DOM interface access, and XForms actions must not insert or copy a new node into a parent node that is readonly, delete or replace a node whose parent is readonly, nor change the value or content of a readonly node. A node that is readonly but whose parent is not readonly can be entirely deleted or replaced by a submission even though doing so indirectly results in deletion or replacement of readonly descendant nodes.</p><p>In addition to restricting value changes, the <code>readonly</code> model item property provides information to the XForms user interface about how bound form controls should be rendered. Form controls bound to instance data with the <code>readonly</code> model item property that evaluates to <code>true</code> should indicate that entering or changing the value is not allowed. This specification does not define any effect of the <code>readonly</code> model item property on visibility, focus, or navigation order. </p><div class="exampleOuter">
<div class="exampleHead">Attaching a readonly property</div><div class="exampleInner"><pre><instance>
<my:person-name>
<my:first-name>Roland</my:first-name>
<my:last-name/>
</my:person-name>
</instance>
<bind nodeset="/my:person-name/my:first-name" readonly="true()"/></pre></div><p>Here, we have associated a <code>readonly</code> property with an element.</p></div><p>The following example illustrates the ability to override the default <code>readonly</code> setting on calculated nodes.</p><div class="exampleOuter">
<div class="exampleHead">Setting a default value</div><div class="exampleInner"><pre><model>
<instance>
<my:data></my:data>
</instance>
<bind nodeset="/my:data" readonly="false()" calculate="choose(.='', 'default', .)"/>
<model>
<input ref="/my:data"> ...
</pre></div><p>The calculate on <code>my:data</code> is executed on any recalculate that follows a rebuild, including the form initialization, so the user initially sees the word 'default'. The user may make any change to <code>my:data</code> with the <code>input</code>, and the calculation will be executed again as a result. Therefore, if the user enters an empty value, then the calculate will change <code>my:data</code> back to 'default'.</p></div></div><div class="div3">
<h4><a name="model-prop-required" id="model-prop-required"></a>6.1.3 The required Property</h4><p>Description: describes whether a value is required before the instance data is submitted.</p><p>Computed Expression: Yes.</p><p>Legal Values: Any expression that is convertible to XPath <code>boolean</code> with <code>boolean()</code>. </p><p>Default Value: <code>false()</code>. </p><p>Inheritance Rules: does not inherit.</p><p>A form may <em>require</em> certain values, and this requirement may be dynamic. When evaluating to <code>true</code>, this model item property indicates that a non-empty instance data node is required before a submission of instance data can occur. Non-empty is defined as: The value of the bound instance data node must be convertible to an XPath <code>string</code> with a length greater than zero. </p><div class="note"><p class="prefix"><b>Note:</b></p><p>The XML Schema feature represented by <code>nillable</code> and <code>xsi:nil</code> is unrelated to the XForms <code>required</code> model item property. An element may have the <code>xsi:nil</code> attribute set to <code>true</code> to indicate that its empty content is schema valid, but if the <code>required</code> model item property for that element node is <code>true</code>, then the element violates the <code>required</code> constraint because a required node must be non-empty as defined above.</p></div><p>Except as noted below, the <code>required</code> model item property does not provide a hint to the XForms user interface regarding visibility, focus, or navigation order. XForms authors are strongly encouraged to make sure that form controls that accept <code>required</code> data are visible. An XForms Processor must provide an indication that a form control is required, and may provide immediate feedback, including limiting navigation. This model item property does not prevent form controls and XForms actions from setting empty strings into data nodes.
</p><div class="exampleOuter">
<div class="exampleHead">Attaching a required property</div><div class="exampleInner"><pre><instance>
<my:person-name>
<my:first-name>Roland</my:first-name>
<my:last-name />
</my:person-name>
</instance>
<bind nodeset="/my:person-name/my:last-name" required="true()"/></pre></div><p>Here, we have associated a <code>required</code> property with element <code>my:last-name</code> to indicate that a value must be supplied.</p></div><div class="note"><p class="prefix"><b>Note:</b></p><p>XML Schema has a similarly named concept with <code>use</code>=<code>"required|optional|prohibited"</code>. This is different than the XForms Model item property, in two ways: 1) <code>use</code> applies only to attributes, while XForms <code>required</code> applies to any node. 2) <code>use</code> is concerned with whether the entire attribute must be specified (without regard to value), while <code>required</code> determines whether a value is required of the node before submission. </p></div></div><div class="div3">
<h4><a name="model-prop-relevant" id="model-prop-relevant"></a>6.1.4 The relevant Property</h4><p>Description: indicates whether the model item is currently <em>relevant</em>. Instance data nodes with this property evaluating to <code>false</code> are <span>unavailable in the user interface and can be removed from submission serialization</span>.</p><p>Computed Expression: Yes.</p><p>Legal Values: Any expression that is convertible to XPath <code>boolean</code> with <code>boolean()</code>.</p><p>Default Value: <code>true()</code>.</p><p>Inheritance Rules: If any ancestor node evaluates to XPath <code>false</code>, this value is treated as <code>false</code>. Otherwise, the local value is used.</p><div class="note"><p class="prefix"><b>Note:</b></p><p>This is the equivalent of taking the logical AND of the evaluated <code>relevant</code> property on the local and every ancestor node.</p></div><p>Many forms have data entry sections that depend on other conditions. For example, a form might ask whether the respondent owns a car. It is only appropriate to ask for further information about their car if they have indicated that they own one.</p><p>Through single node UI bindings, the <code>relevant</code> model item property provides information to the XForms user interface regarding visibility, focus, and navigation order. In general, when <code>true</code>, associated form controls should be made <span>available for user interaction</span>. When <code>false</code>, associated form controls (and any children) and group and switch elements (including content) must be made unavailable, removed from the navigation order, and not allowed focus. Typically, non-relevant user interface content is not presented, or it may be styled as disabled. Elements other than form controls may also use a single node binding that selects a non-relevant node, but such elements are not made unavailable or non-operable due to the single node binding because it is not a <a title="UI binding expression" href="#def-ui-binding-expression">UI binding expression</a>. For example, actions such as <a href="#action-setvalue"><b>10.2 The setvalue Element</b></a> and <a href="#action-message"><b>10.16 The message Element</b></a> or the <a href="#submit-submission-element"><b>11.1 The submission Element</b></a> remain operable if their single node bindings select a non-relevant node. However, some such elements may indirectly be affected by the <code>relevant</code> model item property. For example, it is possible for non-relevant nodes to be excluded from the data of a submission. Similarly, non-relevance indirectly affects the running of actions because a non-relevant form control disables event handlers that listen for events targeted at the form control element. </p><div class="note"><p class="prefix"><b>Note:</b></p><p>A core form control, group or switch must express a single node binding in order to be associated with an instance node. Due to the definition of <a title="" href="#def-repeat-object">repeat object</a>, the <code>relevant</code> model item property of the node in the associated <a title="" href="#def-repeat-item">repeat item</a> affects the availability of the repeat object.</p></div><div class="exampleOuter">
<div class="exampleHead">Attaching a relevant property</div><div class="exampleInner"><pre><instance>
<my:order>
<my:item>
<my:amount />
<my:discount>100</my:discount>
</my:item>
</my:order>
</instance>
<bind nodeset="my:item/my:discount" readonly="true()"
relevant="../my:amount > 1000"/></pre></div><p>Here, we have associated a <code>relevant</code> property with element <code>my:discount</code> to indicate a discount is relevant when the order amount is greater than 1000.</p></div></div><div class="div3">
<h4><a name="model-prop-calculate" id="model-prop-calculate"></a>6.1.5 The calculate Property</h4><p>Description: supplies an expression used to calculate a string value for the associated instance data node.</p><p>Computed Expression: Yes.</p><p>Legal Values: Any XPath expression.</p><p>Default Value: none.</p><p>Inheritance Rules: does not inherit.</p><p>An XForms Model may include model items whose string values are computed from other values. For example, the sum over line items for quantity times unit price, or the amount of tax to be paid on an order. The formula for such a computed value can be expressed with a <code>calculate</code> property, whose XPath expression is evaluated, converted to a string with the XPath <code>string()</code> function, and stored as the value content of the calculated data node. Chapter <a href="#rpm"><b>4 Processing Model</b></a> contains details of when and how the calculation is performed.</p><div class="exampleOuter">
<div class="exampleHead">Attaching a calculate property</div><div class="exampleInner"><pre><instance>
<my:order>
<my:item>
<my:amount />
<my:discount />
</my:item>
</my:order>
</instance>
<bind nodeset="my:item/my:discount" calculate="../my:amount * 0.1"
relevant="../my:amount > 1000"/></pre></div><p>Here, we have associated a <code>relevant</code> property with element <code>my:discount</code> to indicate a discount of 10% is relevant when the order amount is greater than 1000.</p></div></div><div class="div3">
<h4><a name="model-prop-constraint" id="model-prop-constraint"></a>6.1.6 The constraint Property</h4><p>Description: specifies a predicate that needs to be satisfied for the associated instance data node to be considered valid.</p><p>Computed Expression: Yes.</p><p>Legal Values: Any expression that is convertible to XPath <code>boolean</code> with <code>boolean()</code>.</p><p>Default Value: <code>true()</code>.</p><p>Inheritance Rules: does not inherit.</p><p> When evaluating to XPath <code>false</code>, the associated model item is not valid; the converse is not necessarily true. This model item property does not prevent form controls and XForms actions from setting invalid values into data nodes. Chapter <a href="#rpm"><b>4 Processing Model</b></a> contains details of when and how the constraint is calculated as well as when validation is performed. This model item property contributes to the overall validity assessment of a node; the effect of validity state on bound form controls is described in Section <a href="#ui-processing"><b>8.1.1 Implementation Requirements Common to All Form Controls</b></a>.</p><div class="exampleOuter">
<div class="exampleHead">Attaching a constraint property</div><div class="exampleInner"><pre><instance>
<my:range>
<my:from />
<my:to />
</my:range>
</instance>
<bind nodeset="my:to" constraint=". > ../my:from" /></pre></div><p>Here, a <code>constraint</code> property associated with element <code>my:to</code> indicates that its value must be greater than that of element <code>my:from</code>.</p></div><div class="note"><p class="prefix"><b>Note:</b></p><p>Specifying minimum and maximum occurrences for nodes in the instance data can be achieved by using the <code>count()</code> function within a <code>constraint</code> property.</p></div></div><div class="div3">
<h4><a name="model-prop-p3ptype" id="model-prop-p3ptype"></a>6.1.7 The p3ptype Property</h4><p>Description: Attaches a P3P data element to an instance data node, indicating the specific kind of data collected there.</p><p>Computed Expression: No.</p><p>Legal Values: <code>xsd:string</code>.</p><p>Default Value: none</p><p>Inheritance Rules: does not inherit.</p><p>This model item property holds a description of the kind of data collected by the associated instance data node, based on the P3P datatype system <a href="#ref-p3p-1.0">[P3P 1.0]</a>. This information may be used to enhance the form-fill experience, for example by supplying previously-known data. </p><div class="exampleOuter">
<div class="exampleHead">Attaching a type constraint using Binding</div><div class="exampleInner"><pre><instance>
<my:person-name>
<my:first-name />
<my:last-name />
</my:person-name>
</instance>
<bind type="my:nonEmptyString" nodeset="my:first-name"
p3ptype="user.name.given"/></pre></div><p>Here, we have attached both XML Schema and P3P type information to element <code>first-name</code> via element <code>bind</code>.</p></div></div></div><div class="div2">
<h3><a name="model-using" id="model-using"></a>6.2 Schema Constraints</h3><p>Chapter <a href="#datatypes"><b>5 Datatypes</b></a> described how XForms uses the XML Schema datatype system to constrain the <a title="value space" href="#def-value-space">value space</a> of data values collected by an XForms Model. Such datatype constraints can be provided via an XML Schema. Alternatively, this section lists various mechanisms for attaching type constraints to instance data. Attributes <code>xsi:schemaLocation</code> and <code>xsi:noNamespaceSchemaLocation</code> are ignored for purposes for locating a Schema.</p><div class="div3">
<h4><a name="model-using-atomic" id="model-using-atomic"></a>6.2.1 Atomic Datatype</h4><p>The XForms Processing Model applies XML Schema facets as part of the validation process. At the simplest level, it is necessary to associate a set of facets (through an XML Schema datatype) with a model item. This has the effect of restricting the allowable values of the associated instance data node to valid representations of the lexical space of the datatype. </p><p>The set of facets associated with a model item must be determined by the following list, as if it were processed in the given order. When multiple datatype restrictions apply to the same model item, the combination of all given restrictions must apply. Note that it is possible to produce a combination of restrictions that is impossible to satisfy; authors are encouraged to avoid this practice.</p><ol class="enumar"><li><p>Applicable XML schema definitions (including those associated an external or an inline schema, or by <code>xsi:type</code>)</p></li><li><p>An XForms <code>type</code> constraint associated with the instance data node using <a title="binding" href="#def-binding">XForms binding</a>.</p></li><li><p>If no type constraint is provided, the instance data node defaults to <code>type="xsd:string"</code> (default to string rule).</p></li></ol><p>The following declares a datatype based on <code>xsd:string</code> with an additional constraining facet.</p><div class="exampleOuter">
<div class="exampleHead">Type Constraint Using XML Schema</div><div class="exampleInner"><pre><xs:simpleType name="nonEmptyString">
<xs:restriction base="xsd:string">
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType></pre></div><p>This new datatype would then be associated with one or more model items through one of the methods outlined here.</p></div><div class="exampleOuter">
<div class="exampleHead">Attaching A Type Constraint</div><div class="exampleInner"><pre><my:first-name xsi:type="my:nonEmptyString"/></pre></div><p>This defines element <code>first-name</code> to be of type <code>my:nonEmptyString</code>. </p></div><div class="exampleOuter">
<div class="exampleHead">Attaching Type Constraint Using XForms Binding</div><div class="exampleInner"><pre><instance>
<my:first-name />
</instance>
<bind type="my:nonEmptyString" nodeset="/my:first-name"/></pre></div><p> Here, we have attached type information to element <code>first-name</code> via element <code>bind</code>. Thus the XForms author can extend external schemas without having the ability to change them.</p></div></div></div></div><div class="div1">
<h2><a name="expr" id="expr"></a>7 XPath Expressions in XForms</h2><p> XForms uses XPath to address <a title="instance data item" href="#def-instance-data-node">instance data node</a>s in binding expressions, to express constraints, and to specify calculations. <span>XPath expressions in XForms are based on <a href="#ref-xpath-1.0">[XPath 1.0]</a>. A future version of XForms is expected to enable use of <a href="#ref-xpath-2.0">[XPath 2.0]</a>.</span> At the time of evaluation, an XPath expression must be syntactically correct. In addition, the namespaces the expression references must be in scope and the functions and variables it references must be defined. If any of these conditions is not satisfied, an exception (<a href="#evt-computeException"><b>4.5.2 The xforms-compute-exception Event</b></a>) is raised, except for binding expressions, which produce a different exception (<a href="#evt-bindingException"><b>4.5.1 The xforms-binding-exception Event</b></a>).</p><div class="div2">
<h3><a name="expr-datatypes" id="expr-datatypes"></a>7.1 XPath Datatypes</h3><p>XPath datatypes are used only in <a title="binding expression" href="#def-binding-expression">binding expression</a>s and <a title="computed expression" href="#def-computed-expression">computed expression</a>s. XForms uses XPath datatypes <code>boolean</code>, <code>string</code>, <code>number</code>, and <code>node-set</code>. Additionally, the type <code>object</code> is used to denote a parameter or return value that can be any one of the four XPath datatypes. A future version of XForms is expected to use XPath 2.0, which includes support for XML Schema datatypes. </p></div><div class="div2">
<h3><a name="expr-eval" id="expr-eval"></a>7.2 Evaluation Context</h3><p>Within XForms, the <b>default model</b> is the first <code>model</code> in document order. The <b>default instance</b> of any <code>model</code> is the first child <code>instance</code> in document order within that <code>model</code>. XPath expressions appearing in various XForms attributes are used to reference instance data. Every XPath expression requires an evaluation context consisting of a node, position, size, variable bindings, function set, and namespace context. For all evaluation contexts in XForms,</p><ol class="enumar"><li><p>No variable bindings are in place. </p></li><li><p> The available function library is defined below in <a href="#expr-lib"><b>7.5 The XForms Function Library</b></a>. </p></li><li><p> Any namespace declarations in scope for the attribute that defines the expression are applied to the expression. </p></li><li><p>The context node, position and size are determined according to rules described below.</p></li></ol><p>A <b>binding element</b> is any element that is explicitly allowed to have a binding expression attribute, and a <b>bound element</b> is any element that explicitly declares a binding expression attribute. A binding expression attribute contains an XPath expression that references zero or more nodes of instance data. Every XPath expression requires an evaluation context. The <b>in-scope evaluation context</b> of a binding element provides an evaluation context for the binding expression attribute. The following rules are used in determining the node, position and size of the in-scope evaluation context: </p><ol class="enumar"><li><p>A binding element is "<b>outermost</b>" if the element has no ancestor binding elements. If an outermost binding element is contained by a <code>model</code>, then the context node for the outermost binding element is the top-level document element node of the default instance of the containing <code>model</code> element. Otherwise, the context node for outermost binding elements is the top-level document element node of the default instance in the default model. For outermost binding elements, the context size and position are 1. </p></li><li><p>The context node, position and size for non-outermost binding elements is determined using the binding expression attribute or in-scope evaluation context of the nearest ancestor binding element. This is also referred to as "scoped resolution". For a non-outermost binding element:</p><ol class="enumla"><li><p>If the nearest ancestor binding element is not a bound element, then the in-scope evaluation context of the non-outermost binding element is equivalent to the in-scope evaluation context of the nearest ancestor binding element.</p></li><li><p>If the nearest ancestor binding element expresses a Single-Node binding, then the in-scope evaluation context of the non-outermost binding element has a context size and position of 1 and the context node is the one resulting from the Single-Node binding of the nearest ancestor binding element.</p></li><li><p>If the nearest ancestor binding element expresses a Node Set binding, then the XForms processor dynamically generates an occurrence of the non-outermost binding element for each of the nodes in the Node Set Binding of the nearest ancestor binding element. The <b>dynamic in-scope evaluation context</b> for each generated occurrence of the non-outermost binding element has a context size equal to the size of the nodeset identified by the Node Set Binding of the nearest ancestor binding element, the context node is the node for which the occurrence of the non-outermost binding element was generated, and the position is equal to the position of the generator node in the nodeset identified by the Node Set Binding of the nearest ancestor binding element.</p></li><li><p>If the nearest ancestor binding element expresses a Node Set binding, then the non-outermost binding element has its own in-scope evaluation context separately from those of its dynamically generated occurences described above. The in-scope evaluation context has a context position of 1, and the context node and size are set by the first node and the size of the nodeset identified by the Node Set binding of the nearest ancestor binding element.</p></li></ol></li><li><p>Once the context node of the in-scope evaluation context has been determined according to the rules above, if the binding element expresses a <code>model</code> attribute that refers to a <code>model</code> other than the one containing the context node, then the context node of the in-scope evaluation context is changed to be the top-level document element node of the default instance of the referenced <code>model</code>, and the context position and size are changed to 1.</p></li></ol><p>The <b>in-scope evaluation context</b> of an element that is not a binding element is the same as if the element were a binding element. For example, the in-scope evaluation context for the <code>setindex</code> action element is required to provide the context for evaluating the <code>index</code> attribute, so it is determined as if the element could contain a binding expression attribute.</p><p>XPath expressions also appear in model item property attributes of the <code>bind</code> element to define computed expressions. If the <code>bind</code> element does not express a Node Set binding, then the in-scope evaluation context for model item property attributes of the <code>bind</code> is equal to the in-scope evaluation context for the <code>bind</code>. Otherwise, the <code>bind</code> has a Node Set binding, and computed expressions for each model item property attribute are generated for each node. For each computed expression generated, the evaluation context node, position and size are determined by the same method as dynamic in-scope evaluation context rule above, except the computed expression is used in lieu of a binding expression attribute such that the <code>bind</code> element is the nearest ancestor binding element.</p><p>XPath expressions also appear in the special attributes of several other XForms elements, such as the <code>value</code> attribute on <code>setvalue</code> and <code>output</code>, the <code>at</code> attribute of <code>insert</code> and <code>delete</code>, or the <code>index</code> attribute of <code>setindex</code>. Generally, if the containing element does not express a Single Node Binding or Node Set Binding, then the special attribute is evaluated using the in-scope evaluation context. Special attributes may be evaluated using the in-scope evaluation context even if the containing element expresses a Single Node Binding or Node Set Binding. However, for some special attributes, the evaluation context node, position and size are based on the result of the Single Node Binding or Node set Binding. Each special attribute that contains an XPath expression describes how its evaluation context node, position and size are determined.</p><p> In the following example, the <code>group</code> has a binding expression of <code>level2/level3</code>. According to the rules above, this outermost element node would have a context node of <code>/level1</code>, which is the document element node of the instance data. The <code>select1</code> form control then inherits a context node from the parent group. </p><div class="exampleOuter">
<div class="exampleHead">Sample XML Instance Data</div><div class="exampleInner"><pre><level1>
<level2>
<level3 attr="xyz"/>
</level2>
</level1></pre></div></div><div class="exampleOuter">
<div class="exampleHead">Binding Expression Context Nodes</div><div class="exampleInner"><pre><group ref="level2/level3">
<select1 ref="@attr" ... >
<label>...</label>
</select1>
</group></pre></div></div><p>This section describes how the in-scope evaluation context of an element is determined, not whether the in-scope evaluation will be used. The Single-Node Binding or Node Set Binding of a non-outermost binding element is not evaluated if the in-scope evaluation context does not contain a context node. This can occur if the Single-Node Binding or Node Set Binding of the nearest ancestor bound element produces an empty nodeset. Also, if the Single-Node Binding or Node Set Binding of an element is expressed with the <code>bind</code> attribute, then the resulting node or nodeset is obtained from the referenced <code>bind</code> element. The <code>nodeset</code> attribute of a <code>bind</code> element is evaluated using the in-scope evaluation of the <code>bind</code> element, not the in-scope evaluation context of an element that references it with a <code>bind</code> attribute.</p></div><div class="div2">
<h3><a name="expr-dependencies" id="expr-dependencies"></a>7.3 References, Dependencies, and Dynamic Dependencies</h3><p id="defn-xpath-reference">An XPath expression <b>references</b> a node of instance data if the node is selected during the evaluation of the expression. A node is selected by matching an XPath <a href="http://www.w3.org/TR/xpath#NT-NodeTest">NodeTest</a> or by being returned by a function call. For examples, a node can match a name test, a wildcard test, a node type test, or it can be returned by or used as a parameter to a function, or it can appear in a filter expression (where all of the prior examples recursively apply). Once selected, a node is considered to be referenced even if a filter expression subsequently excludes the node from further participation in the expression evaluation. The <b>reference list</b> of an XPath expression is the set of instance nodes that it references.</p><div class="exampleOuter">
<div class="exampleHead">Example of References and Non-References</div><p>Given the following default instance:</p><div class="exampleInner"><pre>
<xforms:instance>
<data xmlns="">
<a attr="X">
<b attr="Y">
<c/>
</b>
<d/>
</a>
<a attr="Z">
<b attr="Z">
<c/>
</b>
<d/>
</a>
</data>
</xforms:instance>
</pre></div><p>and the following XPath expression:</p><div class="exampleInner"><pre>a[@attr='X']/b[@attr='X']/c</pre></div><p>Both nodes named <code>a</code> are referenced since both are matched by a NameTest. The <code>attr</code> attribute in each element <code>a</code>
is referenced during the evaluation of the filter expression. The filter expression rejects the second element <code>a</code>, but that element is still considered
to have been referenced because it was selected for further processing during the expression evaluation.</p><p>The element named <code>b</code> in the first element <code>a</code> is referenced, but element <code>b</code> in the second <code>a</code> is not referenced
because the expression evaluation did not proceed beyond the filter expression that rejected the second <code>a</code> element.</p><p>While performing the NameTest for element <code>b</code>, observe that an XPath expression evaluator may visit all the children of the first element <code>a</code>
in order to perform the NodeTest. However, a node is not referenced if it is only visited but fails the NodeTest. In this case, the NodeTest is a NameTest for <code>b</code>,
which the element <code>d</code> fails. Therefore, <code>d</code> is not referenced.</p><p>The filter expression test on <code>b</code> rejects the only element <code>b</code> that has been selected so far because the attribute value of <code>attr</code>
does not match the equality test. Still, <code>b</code> and its attribute <code>attr</code> have been referenced by this expression.</p><p>Element <code>c</code> is not considered to be referenced by this expression given this data. Although a NameTest for <code>c</code> appears in the expression,
the evaluation of the expression did not proceed to perform the NameTest due to the rejection of <code>b</code> by the filter expression. </p><p>Finally, note that an XPath expression can reference many nodes even if its final result is an empty nodeset.</p></div><div class="note"><p class="prefix"><b>Note:</b></p><p>Defining a <b>reference</b> in terms of matching a NodeTest was a deliberate design decision that creates more references than necessary in order to make the computation system more responsive to certain types of changes without needing a rebuild operation. When a leaf node is filtered from an expression by a predicate, the leaf node is still considered to be referenced so that if the condition changes such that the leaf node would be included in the result value of the expression, then the expression will be recalculated without needing a rebuild. However, once a node is rejected from an expression, further location steps are not evaluated relative to the rejected node, so references for that location step are only created based on its execution relative to accepted nodes. For example, if the above expression were in a <code>calculate</code>, and if the attribute of either <code>b</code> element changes to the value <code>X</code>, the expression would be recalculated but it still does not record a reference to any <code>c</code> elements until the references are obtained in the next rebuild operation. Moreover, the excess references created by the definition may cause some recalculation constructs to cease operation due to circular references that would not be created with a stricter definition of a reference. A future version of XForms may use a stricter version of referencing for recalculation and a less strict definition of referencing for the purpose of detecting and performing automatic rebuild operations.</p></div><p>The referencing of a repeat index by the <code>index()</code> function is handled as a special case. Implementations must behave as if each occurrence of a <code>repeat</code> is associated with an implicitly managed instance data node containing the repeat index. If a <code>repeat</code> identified as <code>R1</code> contains a <code>repeat</code> identified as <code>R2</code>, then a repeat index instance node is managed for each occurrence of <code>R2</code> that is generated by <code>R1</code>. An invocation of the function <code>index()</code> in an XPath expression is considered to reference the repeat index instance node corresponding to the repeat index value that it returns.</p><p id="defn-xpath-dependent">If an XPath expression references an instance node, then the expression result is <b>dependent</b> on the instance node. A <b>dependency list</b> for an instance node is the list of XPath expressions of a given category that are dependent upon the instance node. For example, in Section <a href="#evt-recalculate"><b>4.3.2 The xforms-recalculate Event</b></a>, the dependency list of computed expressions for each instance node helps establish the recalculation order for the computed expressions when the values of instance data nodes are changed.</p><p id="defn-dynamic-dependency">The references of an XPath expression may be altered by insertion of instance nodes since the new nodes may be referenced by the XPath expression if it is re-evaluated. Similarly, the references of an XPath expression may be altered by deletion of instance nodes that are being referenced by the XPath expression. An XPath expression is <b>dynamically dependent</b> on an instance node if its reference list is altered by inserting, deleting or changing the value of the instance node. An instance node is a <b>dynamic dependency</b> for an XPath expression if the expression is dynamically dependent on the instance node. If an XPath expression contains a dynamic dependency and the XForms processor is maintaining dependency lists for the category of the XPath expression, then changing the dynamic dependency implies a change to the dependency lists of instance nodes referenced by the XPath expression.</p><p>The computational dependency data structure described in Section <a href="#evt-recalculate"><b>4.3.2 The xforms-recalculate Event</b></a> essentially stores the dependency lists of instance nodes corresponding to all the references made by computed expressions (see Appendix <a href="#recalc"><b>C Recalculation Sequence Algorithm</b></a> for details). The computational dependency data structure is not reconstructed in response to a dynamic dependency change. Instead, the form author may request a rebuild of the computational dependency data structures using the <code>rebuild</code> action. Additionally, the <code>insert</code> and <code>delete</code> actions set a rebuild flag so that computational dependency data structures will be rebuild at the end of an action sequence.</p><p>Due to the rebuild flag setting on <code>insert</code> and <code>delete</code>, a form author can use many kinds of dynamic dependencies in model binding expressions and computed expressions without ever explicitly invoking the <code>rebuild</code> action. This includes the use of functions such as <code>position()</code>, <code>last()</code>, and <code>count()</code> on element and attribute nodes because the return values of the functions in these cases is fixed except when an <code>insert</code> or <code>delete</code> occurs. By comparison, functions such as <code>id()</code>, <code>instance()</code>, and <code>index()</code> can establish dynamic dependencies that can necessitate invoking a <code>rebuild</code> if they are used in model binding expressions or computed expressions because the results of the functions are affected by changing the values of instance nodes, not by inserting or deleting nodes. </p></div><div class="div2">
<h3><a name="expr-expression-categories" id="expr-expression-categories"></a>7.4 Expression Categories</h3><p>There are several different categories of XPath expressions used in XForms, and they are processed at different times depending on the category. A <a title="binding expression" href="#def-binding-expression">binding expression</a> is an XPath expression used to bind a <a title="model item property" href="#def-model-item-property">model item property</a> to one or more instance nodes, or to bind a form control to instance data, or to specify the node or node set for operation by an action. The evaluation schedule for binding expressions differs based on whether the binding expression is a model binding expression, UI binding expression, or a binding expression for an XForms action. XPath expressions are also used in various other attributes of XForms binds, actions, form controls, and <code>submission</code>s, and their descendant elements. These expressions follow one of the three schedules associated with binding expressions as described below.</p><div class="div3">
<h4><a name="expr-model-binding-expression-computed-expression" id="expr-model-binding-expression-computed-expression"></a>7.4.1 Model Binding Expressions and Computed Expressions</h4><p> A <a title="model binding expression" href="#def-model-binding-expression">model binding expression</a> is a kind of binding expression that can be used to declare model item properties, and is used in the Node-Set binding of the <code>bind</code> element. A <a title="computed expression" href="#def-computed-expression">computed expression</a> is an XPath expression used to determine the value of a <a title="model item property" href="#def-model-item-property">model item property</a> based on instance data. Several of the attributes of <code>bind</code> are computed expressions, including <code>calculate</code>, <code>readonly</code>, <code>relevant</code>, and <code>required</code>.</p><p>Dynamic dependencies in model binding expressions and computed expressions will require manual rebuilding of dependencies.</p><div class="note"><p class="prefix"><b>Note:</b></p><p>If the <code>index()</code> function is being invoked from a model binding expression or computed expression, it will be necessary to invoke <code>rebuild</code> manually. If the repeat index change occurs due to an implicit behavior such as a change to the focused form control, then the rebuild (along with recalculate, revalidate and refresh) can be invoked from a handler for <code>DOMFocusIn</code> attached to the <code>repeat</code> or each repeat object.</p></div></div><div class="div3">
<h4><a name="expr-actions-submissions" id="expr-actions-submissions"></a>7.4.2 Expressions in Actions and Submissions</h4><p>Binding expressions on XForms actions and XPath expressions appearing in other attributes of XForms actions are evaluated at the time the XForms action is performed. In some cases, XForms actions have child elements that allow the values of some of their attributes to be determined based on instance data. In these cases, the <code>value</code> attribute of the child element is evaluated at the time the corresponding attribute is needed in the processing model of the containing XForms action.</p><p>Similarly, XPath expressions used in the attributes of <code>submission</code> and its child elements (other than XForms actions) are evaluated as needed within the submission processing model.</p><p>Form authors can use dynamic dependencies in the XPath expressions of XForms Actions and Submissions without invoking any special data structure reconstruction actions because implementations must behave as if these expressions are evaluated as needed.</p></div><div class="div3">
<h4><a name="expr-ui-expressions" id="expr-ui-expressions"></a>7.4.3 UI Expressions</h4><p id="def-ui-expression">
A <a title="UI binding expression" href="#def-ui-binding-expression">UI Binding Expression</a> is a Single Node Binding or Node Set Binding in a form control.
A <b>UI expression</b> is a UI Binding Expression or an XPath expression appearing in a descendant element of a form control, except for XPath expressions in the categories described above (such as XForms action expressions). These include the Single Node Bindings and Node Set Bindings of the additional elements that contribute to the behavior of a form control (including <code>label</code>, <code>help</code>, <code>hint</code> and <code>alert</code>, <code>filename</code> and <code>mediatype</code>) and the selection helper elements (<code>itemset</code>, <code>label</code>, <code>value</code> and <code>copy</code>). This also includes the <code>value</code> attribute on <code>output</code> and <code>value</code> elements. </p><p>Form authors can use dynamic dependencies in UI Expressions without invoking any special data structure reconstruction actions because the state of the user interface at the end of processing <a title="" href="#evt-refresh">xforms-refresh</a> is required to reflect the instance data as if all UI Expressions had been re-evaluated.</p><div class="note"><p class="prefix"><b>Note:</b></p><p>Implementations may record UI Expression dependency lists on instance nodes to help streamline detection of the need to re-evaluate a UI Expression at the beginning of processing for <a title="" href="#evt-refresh">xforms-refresh</a>. Such implementations may determine that a UI Expression is stale (needs re-evaluation) when a node on which it depends has been changed. An implementation may also indicate that all UI Expressions are stale if a node of instance data is inserted, deleted or replaced, or the implementation may streamline detection of which UI Expressions may be affected by the insertion, deletion or replacement of an instance data node.</p></div></div><div class="div3">
<h4><a name="ui-binding-foreign" id="ui-binding-foreign"></a>7.4.4 UI Binding in other XML vocabularies</h4><p> The XForms binding mechanism allows other XML vocabularies to make single node bindings between custom user interface controls and XForms instance data. As an example, XForms binding attribute <code>bind</code> might be used within XHTML 1.x user interface controls as shown below. See <a href="#structure-attrs-single-node"><b>3.2.3 Single-Node Binding Attributes</b></a>. </p><div class="exampleOuter">
<div class="exampleHead">XForms Binding In XHTML 1.x User Interface Controls</div><div class="exampleInner"><pre><html:input type="text" name="..." xforms:bind="fn"/></pre></div></div></div><div class="div3">
<h4><a name="ui-binding-examples" id="ui-binding-examples"></a>7.4.5 Binding Examples</h4><p>Consider the following document with the one-and-only XForms model: </p><div class="exampleOuter"><div class="exampleInner"><pre><xforms:model id="orders">
<xforms:instance xmlns="">
<orderForm>
<shipTo>
<firstName>John</firstName>
</shipTo>
</orderForm>
</xforms:instance>
<xforms:bind nodeset="/orderForm/shipTo/firstName" id="fn" />
</xforms:model></pre></div></div><p>The following examples show three ways of binding user interface control <code>xforms:input</code> to instance element <code>firstName</code> declared in the model shown above. </p><div class="exampleOuter">
<div class="exampleHead">UI Binding Using Attribute <code>ref</code></div><div class="exampleInner"><pre><xforms:input ref="/orderForm/shipTo/firstName">...</pre></div></div><div class="exampleOuter">
<div class="exampleHead">UI Binding Using Attribute <code>bind</code></div><div class="exampleInner"><pre><xforms:input bind="fn">...</pre></div></div><div class="exampleOuter">
<div class="exampleHead">Specifies Model Containing The Instance Explicitly</div><div class="exampleInner"><pre><xforms:input model="orders" ref="/orderForm/shipTo/firstName">...</pre></div></div></div></div><div class="div2">
<h3><a name="expr-lib" id="expr-lib"></a>7.5 The XForms Function Library</h3><p> The XForms Function Library includes the entire <a href="#ref-xpath-1.0">[XPath 1.0]</a> Core Function Library, including operations on node-sets, strings, numbers, and booleans. </p><p> The following sections define additional required functions for use within XForms :
<a href="#expr-lib-bool"><b>7.6 Boolean Functions</b></a>, <a href="#expr-lib-num"><b>7.7 Number Functions</b></a>, <a href="#expr-lib-string"><b>7.8 String Functions</b></a>, <a href="#expr-lib-date"><b>7.9 Date and Time Functions</b></a>, <a href="#expr-lib-nodeset"><b>7.10 Node-set Functions</b></a> , and <a href="#expr-lib-object"><b>7.11 Object Functions</b></a>. </p><p>The function library provided by an XForms processor may also contain other extension functions as described in <a href="#expr-lib-extension"><b>7.12 Extension Functions</b></a>.</p><p>If an error occurs in an XPath function, then an <a href="#evt-computeException"><b>4.5.2 The xforms-compute-exception Event</b></a> or <a href="#evt-bindingException"><b>4.5.1 The xforms-binding-exception Event</b></a> occurs.. </p></div><div class="div2">
<h3><a name="expr-lib-bool" id="expr-lib-bool"></a>7.6 Boolean Functions</h3><div class="div3">
<h4><a name="fn-boolean-from-string" id="fn-boolean-from-string"></a>7.6.1 The boolean-from-string() Function</h4><p><em>boolean</em> <b>boolean-from-string</b>(<var>string</var>)</p><p> Function <code>boolean-from-string</code> returns <code>true</code> if the required parameter <code>string</code> is
"true" or "1", or <code>false</code> if parameter <code>string</code> is "false", or "0". This is useful when referencing a
Schema <code>xsd:boolean</code> datatype in an XPath expression. If the parameter string matches none of the above strings,
according to a case-insensitive comparison, the return value is <code>false</code>.</p></div><div class="div3">
<h4><a name="fn-is-card-number" id="fn-is-card-number"></a>7.6.2 The is-card-number() Function</h4><p><em>boolean</em> <b>is-card-number</b>(<var>string</var>?)</p><p>If the string parameter conforms to the pattern restriction of the <a title="" href="#dt-card-number">card-number</a> datatype, then this function applies the <code>Luhn</code> algorithm described in <a href="#ref-luhn">[Luhn Patent]</a> and returns true if the number satisfies the formula. Otherwise, false is returned. If the parameter is omitted, it defaults to the string-value of the current context node.</p><p>Examples (see also <a href="#dt-card-number"><b>5.2.7 xforms:card-number</b></a>):</p><div class="exampleOuter"><div class="exampleInner"><pre>is-card-number(.)</pre></div><p>returns <code>true</code> if and only if the context node contains a string that contains of zero or more digits and satisfies the formula.</p><div class="exampleInner"><pre>is-card-number('4111111111111111')</pre></div><p>returns <code>true</code>. Other examples of string constants that will return <code>true</code> are : <code>5431111111111111</code>, <code>341111111111111</code> and <code>6011601160116611</code>.</p><div class="exampleInner"><pre>is-card-number('123')</pre></div><p>returns <code>false</code>.</p></div></div></div><div class="div2">
<h3><a name="expr-lib-num" id="expr-lib-num"></a>7.7 Number Functions</h3><div class="div3">
<h4><a name="fn-avg" id="fn-avg"></a>7.7.1 The avg() Function</h4><p><em>number</em> <b>avg</b>(<var>node-set</var>)</p><p> Function <code>avg</code> returns the arithmetic average of the result of converting the string-values of each node in
the argument node-set to a number. The sum is computed with <code>sum()</code>, and divided with <code>div</code> by the
value computed with <code>count()</code>. If the parameter is an empty node-set, or if any of the nodes evaluate to <code>NaN</code>,
the return value is <code>NaN</code>. </p></div><div class="div3">
<h4><a name="fn-min" id="fn-min"></a>7.7.2 The min() Function</h4><p><em>number</em> <b>min</b>(<var>node-set</var>)</p><p> Function <code>min</code> returns the minimum value of the result of converting the string-values of each node in argument <code>node-set</code> to a number. "Minimum" is determined with the <code><</code> operator. If the parameter is an empty node-set, or if any of the nodes evaluate to <code>NaN</code>, the return value is <code>NaN</code>. </p></div><div class="div3">
<h4><a name="fn-max" id="fn-max"></a>7.7.3 The max() Function</h4><p><em>number</em> <b>max</b>(<var>node-set</var>)</p><p> Function <code>max</code> returns the maximum value of the result of converting the string-values of each node in argument <code>node-set</code> to a number. "Maximum" is determined with the <code><</code> operator. If the parameter is an empty node-set, or if any of the nodes evaluate to <code>NaN</code>, the return value is <code>NaN</code>. </p></div><div class="div3">
<h4><a name="fn-count-non-empty" id="fn-count-non-empty"></a>7.7.4 The count-non-empty() Function</h4><p><em>number</em> <b>count-non-empty</b>(<var>node-set</var>)</p><p> Function <code>count-non-empty</code> returns the number of non-empty nodes in argument <code>node-set</code>. A node is considered non-empty if it is convertible into a string with a greater-than zero length. </p></div><div class="div3">
<h4><a name="fn-index" id="fn-index"></a>7.7.5 The index() Function</h4><p><em>number</em> <b>index</b>(<var>string</var>)</p><p> Function <code>index</code> takes a string argument that is the <code>IDREF</code> of a <code>repeat</code> and returns the
current 1-based position of the repeat index for the identified <code>repeat</code>—see <a href="#ui-repeat"><b>9.3.1 The repeat Element</b></a> for details on
<code>repeat</code> and its associated repeat index. If the specified argument does not identify a <code>repeat</code>,
the function returns <code>NaN</code>.</p><div class="note"><p class="prefix"><b>Note:</b></p><p>The IDREF obtained from the function parameter may not uniquely identify
the desired <code>repeat</code> if the <code>repeat</code> element bearing the
matching ID resides
in a repeating construct such as element <code>repeat</code>.
The general method described in
<a href="#idref-resolve"><b>4.7 Resolving ID References in XForms</b></a>
is used to determine the desired run-time repeat object.</p></div><div class="exampleOuter">
<div class="exampleHead">index</div><div class="exampleInner"><pre><xforms:trigger>
<xforms:label>Add to Shopping Cart</xforms:label>
<xforms:insert ev:event="DOMActivate" position="after"
nodeset="items/item" at="index('cartUI')"/>
</xforms:trigger></pre></div></div></div><div class="div3">
<h4><a name="fn-power" id="fn-power"></a>7.7.6 The power() Function</h4><p><em>number</em> <b>power</b>(<var>number</var>, <var>number</var>)</p><p>Raises the first argument to the power of the second argument, returning the result. If
the calculation does not result in a real number, then <code>NaN</code> is returned.</p><p>Examples:</p><div class="exampleOuter"><div class="exampleInner"><pre>power(2, 3)</pre></div><p>returns <code>8</code></p><div class="exampleInner"><pre>power(-1, 0.5)</pre></div><p>returns <code>NaN</code>.</p><div class="exampleInner"><pre>if (prin>0 and dur>0 and rate>0, prin*rate/(1-power(1+rate, -dur)), 0)</pre></div><p>returns a compounded interest payment value given a non-zero principal (<code>prin</code>),
duration (<code>dur</code>) and periodic interest rate (<code>rate</code>).</p></div></div><div class="div3">
<h4><a name="fn-random" id="fn-random"></a>7.7.7 The random() Function</h4><p><em>number</em> <b>random</b>(<var>boolean</var>?)</p><p>This function generates and returns a uniformly distributed random or pseudorandom number in the
range from 0.0 up to but excluding 1.0.
This function accepts an author-optional boolean parameter that is <code>false</code> by default. If <code>true</code>, the
random number generator for this function is first seeded with a source of randomness before generating the return value.
A typical implementation may seed the random number generator with the current system time in milliseconds when
<code>random(true)</code> is invoked, and it may apply a linear congruential formula to generate return values on
successive invocations of the function. </p><p>Example:</p><div class="exampleOuter"><div class="exampleInner"><pre>random()</pre></div><p>could return <code>0.14159265358979</code></p></div></div><div class="div3">
<h4><a name="fn-compare" id="fn-compare"></a>7.7.8 The compare() Function</h4><p><em>number</em> <b>compare</b>(<var>string</var>, <var>string</var>)</p><p>This function returns -1, 0, or 1, depending on whether the value of the first argument is respectively less than, equal to, or greater than the value of second argument based on lexicographic comparison using Unicode code point values <a href="#ref-unicode-collation">[Unicode Collation Algorithm]</a>. </p><p>Example:</p><div class="exampleOuter"><div class="exampleInner"><pre>compare('apple', 'orange')</pre></div><p>returns <code>-1</code></p></div></div></div><div class="div2">
<h3><a name="expr-lib-string" id="expr-lib-string"></a>7.8 String Functions</h3><div class="div3">
<h4><a name="fn-if" id="fn-if"></a>7.8.1 The if() Function</h4><p><em>string</em> <b>if</b>(<var>boolean</var>, <var>string</var>, <var>string</var>)</p><p>Function <code>if</code> evaluates the first parameter as boolean, returning the second parameter when <code>true</code>, otherwise the third parameter. </p><div class="note"><p class="prefix"><b>Note:</b></p><p>This function is deprecated because a future version of XForms is expected to be based on <a href="#ref-xpath-2.0">[XPath 2.0]</a>, which contains an <code>if</code> construct that is incompatible with this function.Form authors and design tools are encouraged to use the function <code>choose()</code> from Section <a href="#fn-choose"><b>7.11.1 The choose() Function</b></a> instead of this function. </p></div></div><div class="div3">
<h4><a name="fn-property" id="fn-property"></a>7.8.2 The property() Function</h4><p><em>string</em> <b>property</b>(<var>string</var>)</p><p>This function accepts a string identifying a property name. If the property name is not recognized, empty string is returned. The property definitions for this function are as follows: </p><table border="1" summary="Property function parameters and return values"><tbody><tr><th rowspan="1" colspan="1">Property</th><th rowspan="1" colspan="1">Return Value</th></tr><tr><td rowspan="1" colspan="1"><code>version</code></td><td rowspan="1" colspan="1"><code>1.1</code></td></tr><tr><td rowspan="1" colspan="1"><code>conformance-level</code></td><td rowspan="1" colspan="1"><code>full</code>, <code>basic</code> or a string beginning with <code>full</code> or <code>basic</code></td></tr><tr><td rowspan="1" colspan="1">Any other <a href="http://www.w3.org/TR/REC-xml-names/#NT-NCName">NCName</a></td><td rowspan="1" colspan="1">Reserved. Their use results in an exception (see <a href="#expr-lib"><b>7.5 The XForms Function Library</b></a> for the exception type)</td></tr><tr><td rowspan="1" colspan="1"><a title="QNameButNotNCName" href="#def-QNameButNotNCName">QNameButNotNCName</a></td><td rowspan="1" colspan="1">An implementation-specific property value, such as a locale or timezone for the user agent. If the implementation does not support the property, then empty string is returned.</td></tr></tbody></table><p>Examples:</p><div class="exampleOuter"><div class="exampleInner"><pre>property('version')</pre></div><p>returns <code>1.1</code></p><div class="exampleInner"><pre>property('conformance-level')</pre></div><p>may return <code>full</code></p></div></div><div class="div3">
<h4><a name="fn-digest" id="fn-digest"></a>7.8.3 The digest() Function</h4><p><em>string</em> <b>digest</b>(<var>string</var>, <var>string</var>, <var>string</var>?)</p><p>This function accepts a string of data, a string indicating a cryptographic hashing algorithm, and an author-optional string indicating an encoding method.
The data string is serialized as UTF-8, the hash value is then computed using the indicated hash algorithm, and the hash value is then encoded by
the indicated method, and the result is returned by the function. The following table presents the keywords for the second string parameter and the
corresponding hash algorithms:</p><table border="1" summary="Hash algorithms for the digest() function"><tbody><tr><th rowspan="1" colspan="1">Keywords</th><th rowspan="1" colspan="1">Hash Algorithm</th><th rowspan="1" colspan="1">Status</th></tr><tr><td rowspan="1" colspan="1"><code>MD5</code></td><td rowspan="1" colspan="1">The MD5 hash algorithm defined in <a href="#ref-md5">[MD5]</a></td><td rowspan="1" colspan="1"><a title="" href="#intro-reading">Required</a></td></tr><tr><td rowspan="1" colspan="1"><code>SHA-1</code></td><td rowspan="1" colspan="1">The SHA-1 hash algorithm defined in <a href="#ref-sha2">[SHA2]</a> </td><td rowspan="1" colspan="1"><a title="" href="#intro-reading">Required</a></td></tr><tr><td rowspan="1" colspan="1"><code>SHA-256</code></td><td rowspan="1" colspan="1">The SHA-256 hash algorithm defined in <a href="#ref-sha2">[SHA2]</a></td><td rowspan="1" colspan="1"><a title="" href="#intro-reading">Required</a></td></tr><tr><td rowspan="1" colspan="1"><code>SHA-384</code></td><td rowspan="1" colspan="1">The SHA-384 hash algorithm defined in <a href="#ref-sha2">[SHA2]</a></td><td rowspan="1" colspan="1"><a title="" href="#intro-reading">Optional</a></td></tr><tr><td rowspan="1" colspan="1"><code>SHA-512</code></td><td rowspan="1" colspan="1">The SHA-512 hash algorithm defined in <a href="#ref-sha2">[SHA2]</a></td><td rowspan="1" colspan="1"><a title="" href="#intro-reading">Optional</a></td></tr><tr><td rowspan="1" colspan="1">Any other <a href="http://www.w3.org/TR/REC-xml-names/#NT-NCName">NCName</a></td><td rowspan="1" colspan="1">Reserved. Their use results in an exception (see <a href="#expr-lib"><b>7.5 The XForms Function Library</b></a> for the exception type)</td><td rowspan="1" colspan="1"><a title="" href="#intro-reading">Required</a></td></tr><tr><td rowspan="1" colspan="1"><a title="QNameButNotNCName" href="#def-QNameButNotNCName">QNameButNotNCName</a></td><td rowspan="1" colspan="1">An implementation-specific hash algorithm is used. If the implementation does not support the indicated hash algorithm, then an exception occurs
(see <a href="#expr-lib"><b>7.5 The XForms Function Library</b></a> for the exception type).</td><td rowspan="1" colspan="1"><a title="" href="#intro-reading">Required</a></td></tr></tbody></table><p>This recommendation defines the values <code>hex</code> and <code>base64</code> for the third string parameter that indicates
the encoding method. If the parameter is missing, then the default is <code>base64</code>. The <code>hex</code> and <code>base64</code>
encoding methods of this function correspond to the encodings defined in <a href="#ref-xschema-2">[XML Schema part 2]</a> for the datatypes <code>hexBinary</code>
and <code>base64Binary</code>, respectively. For the hexadecimal encoding, the digits 'a' through 'f'
are encoded with lower case letters. Any other string value given for the encoding method results in an exception
(see <a href="#expr-lib"><b>7.5 The XForms Function Library</b></a> for the exception type).</p><div class="exampleOuter"><div class="exampleInner"><pre>digest('abc', 'SHA-1', 'hex')</pre></div><p>returns <code>a9993e364706816aba3e25717850c26c9cd0d89d</code>.</p><div class="exampleInner"><pre>digest('abc', 'MD5', 'hex')</pre></div><p>returns <code>900150983cd24fb0d6963f7d28e17f72</code>.</p><div class="exampleInner"><pre>digest('abc', 'SHA-256', 'hex')</pre></div><p>returns <code>ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad</code></p></div></div><div class="div3">
<h4><a name="fn-hmac" id="fn-hmac"></a>7.8.4 The hmac() Function</h4><p><em>string</em> <b>hmac</b>(<var>string</var>, <var>string</var>, <var>string</var>, <var>string</var>?)</p><p>This function accepts a string for a key or shared secret, a string of data, a string indicating a cryptographic hashing algorithm, and an
author-optional string indicating an encoding method. The key and data strings are serialized as UTF-8, and they are subjected to the HMAC algorithm
defined in <a href="#ref-hmac">[HMAC]</a> and parameterized by the the hash algorithm indicated by the third parameter. The result is encoded with
the method indicated by the fourth parameter, and the result is returned by the function.</p><p>The following table presents the keywords for the third string parameter and the corresponding hash algorithms:</p><table border="1" summary="Hash algorithms for the hmac() function"><tbody><tr><th rowspan="1" colspan="1">Keywords</th><th rowspan="1" colspan="1">Hash Algorithm</th><th rowspan="1" colspan="1">Status</th></tr><tr><td rowspan="1" colspan="1"><code>MD5</code></td><td rowspan="1" colspan="1">The MD5 hash algorithm defined in <a href="#ref-md5">[MD5]</a></td><td rowspan="1" colspan="1"><a title="" href="#intro-reading">Required</a></td></tr><tr><td rowspan="1" colspan="1"><code>SHA-1</code></td><td rowspan="1" colspan="1">The SHA-1 hash algorithm defined in <a href="#ref-sha2">[SHA2]</a> </td><td rowspan="1" colspan="1"><a title="" href="#intro-reading">Required</a></td></tr><tr><td rowspan="1" colspan="1"><code>SHA-256</code></td><td rowspan="1" colspan="1">The SHA-256 hash algorithm defined in <a href="#ref-sha2">[SHA2]</a></td><td rowspan="1" colspan="1"><a title="" href="#intro-reading">Required</a></td></tr><tr><td rowspan="1" colspan="1"><code>SHA-384</code></td><td rowspan="1" colspan="1">The SHA-384 hash algorithm defined in <a href="#ref-sha2">[SHA2]</a></td><td rowspan="1" colspan="1"><a title="" href="#intro-reading">Optional</a></td></tr><tr><td rowspan="1" colspan="1"><code>SHA-512</code></td><td rowspan="1" colspan="1">The SHA-512 hash algorithm defined in <a href="#ref-sha2">[SHA2]</a></td><td rowspan="1" colspan="1"><a title="" href="#intro-reading">Optional</a></td></tr><tr><td rowspan="1" colspan="1">Any other <a href="http://www.w3.org/TR/REC-xml-names/#NT-NCName">NCName</a></td><td rowspan="1" colspan="1">Reserved. Their use results in an exception (see <a href="#expr-lib"><b>7.5 The XForms Function Library</b></a> for the exception type)</td><td rowspan="1" colspan="1"><a title="" href="#intro-reading">Required</a></td></tr><tr><td rowspan="1" colspan="1"><a title="QNameButNotNCName" href="#def-QNameButNotNCName">QNameButNotNCName</a></td><td rowspan="1" colspan="1">An implementation-specific hash algorithm is used. If the implementation does not support the indicated hash algorithm, then an
exception occurs (see <a href="#expr-lib"><b>7.5 The XForms Function Library</b></a> for the exception type).</td><td rowspan="1" colspan="1"><a title="" href="#intro-reading">Required</a></td></tr></tbody></table><p>This recommendation defines the values <code>hex</code> and <code>base64</code> for the fourth string parameter that indicates
the encoding method. If the parameter is missing, then the default is <code>base64</code>. The <code>hex</code> and <code>base64</code>
encoding methods of this function correspond to the encodings defined in <a href="#ref-xschema-2">[XML Schema part 2]</a> for the datatypes <code>hexBinary</code>
and <code>base64Binary</code>, respectively. For the hexadecimal encoding, the digits 'a' through 'f'
are encoded with lower case letters. Any other string value given for the encoding method results in an exception
(see <a href="#expr-lib"><b>7.5 The XForms Function Library</b></a> for the exception type).</p><div class="exampleOuter"><div class="exampleInner"><pre>hmac('Jefe', 'what do ya want for nothing?', 'SHA-1', 'hex')</pre></div><p>returns <code>effcdf6ae5eb2fa2d27416d5f184df9c259a7c79</code></p><div class="exampleInner"><pre>hmac('Jefe', 'what do ya want for nothing?', 'MD5', 'hex')</pre></div><p>returns <code>750c783e6ab0b503eaa86e310a5db738</code></p><div class="exampleInner"><pre>hmac('Jefe', 'what do ya want for nothing?', 'SHA-256', 'hex')</pre></div><p>returns <code>5bdcc146bf60754e6a042426089575c75a003f089d2739839dec58b964ec3843</code></p></div></div></div><div class="div2">
<h3><a name="expr-lib-date" id="expr-lib-date"></a>7.9 Date and Time Functions</h3><div class="note"><p class="prefix"><b>Note:</b></p><p>The following XML Schema datatypes do not have specific functions for manipulation within XForms expressions:
<code>xsd:time</code>, <code>xsd:gYearMonth</code>, <code>xsd:gYear</code>, <code>xsd:gMonthDay</code>,
<code>xsd:gDay</code>, <code>xsd:gMonth</code>. Extension functions (<a href="#expr-lib-extension"><b>7.12 Extension Functions</b></a>) may
be used to perform needed operations on these datatypes. </p></div><div class="div3">
<h4><a name="fn-local-date" id="fn-local-date"></a>7.9.1 The local-date() Function</h4><p><em>string</em> <b>local-date</b>()</p><p>This function returns a lexical <code>xsd:date</code> obtained as if by the following rules: the result of <code>now()</code> is
converted to a local date based on the user agent time zone information. If no time zone information is available, then the date portion
of the result of <code>now()</code> is returned.</p><p>Example:</p><div class="exampleOuter"><div class="exampleInner"><pre>local-date()</pre></div><p>could return <code>2006-10-13-07:00</code></p><div class="exampleInner"><pre>substring(local-date(), 1, 10)</pre></div><p>could return <code>2006-10-13</code></p><div class="exampleInner"><pre>days-to-date(days-from-date(local-date()) + 31) </pre></div><p>returns a date that is 31 days from today. For example, if <code>local-date()</code> returns <code>2006-10-13-07:00</code>, then the result is <code>2006-11-13</code>.</p></div></div><div class="div3">
<h4><a name="fn-local-dateTime" id="fn-local-dateTime"></a>7.9.2 The local-dateTime() Function</h4><p><em>string</em> <b>local-dateTime</b>()</p><p>This function returns a lexical <code>xsd:dateTime</code> obtained as if by the following rules: the result of <code>now()</code> is
converted to a local dateTime based on the user agent time zone information. If no time zone information is available, then the result of
<code>now()</code> is returned.</p><p>Example:</p><div class="exampleOuter"><div class="exampleInner"><pre>local-dateTime()</pre></div><p>could return <code>2006-10-13T16:04:17-07:00</code></p><div class="exampleInner"><pre>adjust-dateTime-to-timezone(seconds-to-dateTime(seconds-from-dateTime(local-dateTime()) + 7200))</pre></div><p>Adds two hours (7200 seconds) to the local date and time, returning the result in the local time zone. For example, if <code>local-dateTime()</code>
returns <code>2007-10-02T14:26:43-07:00</code>, then the above expression returns <code>2007-10-02T16:26:43-07:00</code></p></div></div><div class="div3">
<h4><a name="fn-now" id="fn-now"></a>7.9.3 The now() Function</h4><p><em>string</em> <b>now</b>()</p><p> The <code>now</code> function returns the current UTC date and time as a string value in the canonical
XML Schema <code>xsd:dateTime</code> format. If time zone information is available, it is used to convert the date and
time to UTC.
If no time zone information is available, then the date and time are assumed to be in UTC. </p><div class="note"><p class="prefix"><b>Note:</b></p><p>Attaching a calculation of "<code>now()</code>" to an instance data node would not result in a stream of continuous
recalculations of the XForms Model. </p><div class="exampleOuter"><div class="exampleInner"><pre>now()</pre></div><p> returns <code>2006-10-14T01:04:17Z</code> if <code>local-dateTime()</code> returns <code>2006-10-13T18:04:17-07:00</code></p><div class="exampleInner"><pre>seconds-to-dateTime(seconds-from-dateTime(now()) + 7200)</pre></div><p>Computes two hours from now, returning the result in UTC time. For example, if <code>now()</code>
returns <code>2007-10-02T21:26:43Z</code>, then the above expression returns <code>2007-10-02T23:26:43Z</code></p></div></div></div><div class="div3">
<h4><a name="fn-days-from-date" id="fn-days-from-date"></a>7.9.4 The days-from-date() Function</h4><p><em>number</em> <b>days-from-date</b>(<var>string</var>)</p><p>This function returns a whole number of days, according to the following rules: </p><p>If the string parameter represents a legal lexical <code>xsd:date</code> or <code>xsd:dateTime</code>, the return value
is equal to the number of days difference between the specified date or dateTime (normalized to UTC) and <code>1970-01-01</code>.
Hour, minute, and second components are ignored after normalization. Any other input parameter causes a return value of <code>NaN</code>. </p><div class="note"><p class="prefix"><b>Note:</b></p><p>If an <code>xsd:date</code> is given as the parameter, the timezone is ignored if provided because there is no way to normalize
to the date in the UTC timezone without both the time and timezone.</p></div><p>Examples:</p><div class="exampleOuter"><div class="exampleInner"><pre>days-from-date("2002-01-01")</pre></div><p>returns <code>11688</code></p><div class="exampleInner"><pre>days-from-date("2002-01-01-07:00")</pre></div><p>returns <code>11688</code></p><div class="exampleInner"><pre>days-from-date("1969-12-31")</pre></div><p>returns <code>-1</code></p></div></div><div class="div3">
<h4><a name="fn-days-to-date" id="fn-days-to-date"></a>7.9.5 The days-to-date() Function</h4><p><em>string</em> <b>days-to-date</b>(<var>number</var>)</p><p>This function returns a string containing a lexical <code>xsd:date</code> that corresponds to the number of days passed as the parameter according to the following rules: </p><p>The number parameter is rounded to the nearest whole number, and the result is interpreted as the difference between the desired date and
<code>1970-01-01</code>. An input parameter value of <code>NaN</code> results in output of the empty string.</p><p>Examples:</p><div class="exampleOuter"><div class="exampleInner"><pre>days-to-date(11688)</pre></div><p>returns <code>2002-01-01</code></p><div class="exampleInner"><pre>days-to-date(-1)</pre></div><p>returns <code>1969-12-31</code></p></div></div><div class="div3">
<h4><a name="fn-seconds-from-dateTime" id="fn-seconds-from-dateTime"></a>7.9.6 The seconds-from-dateTime() Function</h4><p><em>number</em> <b>seconds-from-dateTime</b>(<var>string</var>)</p><p>This function returns a possibly fractional number of seconds, according to the following rules: </p><p>If the string parameter represents a legal lexical <code>xsd:dateTime</code>, the return value is equal to the number of seconds difference
between the specified dateTime (normalized to UTC) and <code>1970-01-01T00:00:00Z</code>.
If no time zone is specified, UTC is used.
Any other input string parameter causes a return value of <code>NaN</code>.
This function does not support leap seconds.</p><p>Example:</p><div class="exampleOuter"><div class="exampleInner"><pre>seconds-from-dateTime('1970-01-01T00:00:00Z')</pre></div><p>returns <code>0</code></p><div class="exampleInner"><pre>seconds-from-dateTime('1970-01-01T00:00:00-08:00')</pre></div><p>returns <code>28800</code></p></div></div><div class="div3">
<h4><a name="fn-seconds-to-dateTime" id="fn-seconds-to-dateTime"></a>7.9.7 The seconds-to-dateTime() Function</h4><p><em>string</em> <b>seconds-to-dateTime</b>(<var>number</var>)</p><p>This function returns a string containing a lexical <code>xsd:dateTime</code> that corresponds to the number of seconds
passed as the parameter according to the following rules:</p><p>The number parameter is rounded to the nearest whole number, and the result is interpreted as the difference between
the desired UTC dateTime and <code>1970-01-01T00:00:00Z</code>.
An input parameter value of <code>NaN</code> results in output of the empty string.
This function does not support leap seconds.</p><p>Examples:</p><div class="exampleOuter"><div class="exampleInner"><pre>seconds-to-dateTime(0)</pre></div><p>returns <code>1970-01-01T00:00:00Z</code></p><div class="exampleInner"><pre>seconds-from-dateTime(28800)</pre></div><p>returns <code>1970-01-01T08:00:00Z</code></p><div class="exampleInner"><pre>seconds-to-dateTime(seconds-from-dateTime(now()) + 7200)</pre></div><p>Computes two hours from now, returning the result in UTC time. For example, if <code>now()</code>
returns <code>2007-10-02T21:26:43Z</code>, then the above expression returns <code>2007-10-02T23:26:43Z</code></p><div class="exampleInner"><pre>adjust-dateTime-to-timezone(seconds-to-dateTime(seconds-from-dateTime(now()) + 7200))</pre></div><p>Computes two hours from now, returning the result in the local time zone. For example, if <code>now()</code>
returns <code>2007-10-02T21:26:43Z</code> and the local date and time is <code>2007-10-02T14:26:43-07:00</code>, then the
above expression returns <code>2007-10-02T16:26:43-07:00</code></p></div></div><div class="div3">
<h4><a name="fn-adjust-dateTime-to-timezone" id="fn-adjust-dateTime-to-timezone"></a>7.9.8 The adjust-dateTime-to-timezone() Function</h4><p><em>string</em> <b>adjust-dateTime-to-timezone</b>(<var>string</var>)</p><p>This function adjusts a legal lexical <code>xsd:dateTime</code> received as the string parameter to the local time zone of the implementation,
and returns the result. If the string argument contains no time zone, then the result is the string argument with the local time zone as the
time zone component. If the implementation does not have access to time zone information, UTC is used.
The result is empty string if the string argument is the empty sequence or not a legal lexical <code>xsd:dateTime</code>. </p><p>Examples:</p><div class="exampleOuter"><div class="exampleInner"><pre>adjust-dateTime-to-timezone('2007-10-07T02:22:00')</pre></div><p>returns <code>2007-10-07T02:22:00-07:00</code> in the Pacific time zone since daylight savings time applies.</p><div class="exampleInner"><pre>adjust-dateTime-to-timezone('2007-10-02T21:26:43Z')</pre></div><p>returns <code>2007-10-02T14:26:43-07:00</code> in the Pacific time zone since daylight savings time applies.</p><div class="exampleInner"><pre>adjust-dateTime-to-timezone(seconds-to-dateTime(seconds-from-dateTime(now()) + 7200))</pre></div><p>Computes two hours from now, returning the result in the local time zone. For example, if <code>now()</code>
returns <code>2007-10-02T21:26:43Z</code> and the local date and time is <code>2007-10-02T14:26:43-07:00</code>, then the
above expression returns <code>2007-10-02T16:26:43-07:00</code></p></div></div><div class="div3">
<h4><a name="fn-seconds" id="fn-seconds"></a>7.9.9 The seconds() Function</h4><p><em>number</em> <b>seconds</b>(<var>string</var>)</p><p>This function returns a possibly fractional number of seconds, according to the following rules: </p><p>If the string parameter represents a legal lexical <code>xsd:duration</code>, the return value is equal to the number specified in the
seconds component plus 60 * the number specified in the minutes component, plus 60 * 60 * the number specified in the hours component,
plus 60 * 60 * 24 * the number specified in the days component. The sign of the result will match the sign of the duration. Year and month
components, if present, are ignored. Any other input parameter causes a return value of <code>NaN</code>. </p><div class="note"><p class="prefix"><b>Note:</b></p><p>Even though this function is defined based on a lexical <code>xsd:duration</code>, it is intended for use only with
derived-from-<code>xsd:duration</code> datatypes, specifically <code>xforms:dayTimeDuration</code>. </p></div><p>Examples: </p><div class="exampleOuter"><div class="exampleInner"><pre>seconds("P3DT10H30M1.5S")</pre></div><p>returns <code>297001.5</code> (3 days, 10 hours, 30 minutes, and 1.5 seconds)</p><div class="exampleInner"><pre>seconds("P1Y2M")</pre></div><p>returns <code>0</code> because the year and month parts of the duration are ignored and the remaining portions are unspecified and default to 0</p><div class="exampleInner"><pre>seconds("3")</pre></div><p>returns <code>NaN</code> because the parameter is not a lexically valid duration</p></div></div><div class="div3">
<h4><a name="fn-months" id="fn-months"></a>7.9.10 The months() Function</h4><p><em>number</em> <b>months</b>(<var>string</var>)</p><p>This function returns a whole number of months, according to the following rules: </p><p>If the string parameter represents a legal lexical <code>xsd:duration</code>, the return value is equal to the number specified in the
months component plus 12 * the number specified in the years component. The sign of the result will match the sign of the duration.
Day, hour, minute, and second components, if present, are ignored. Any other input parameter causes a return value of <code>NaN</code>. </p><div class="note"><p class="prefix"><b>Note:</b></p><p>Even though this function is defined based on a lexical <code>xsd:duration</code>, it is intended for use only with
derived-from-<code>xsd:duration</code> datatypes, specifically <code>xforms:yearMonthDuration</code>. </p></div><p>Examples: </p><p>Examples: </p><div class="exampleOuter"><div class="exampleInner"><pre>months("P1Y2M")</pre></div><p>returns <code>14</code> (1 year and 2 months) </p><div class="exampleInner"><pre>months("-P19M")</pre></div><p>returns <code>-19</code> because the duration is negative and expresses 0 years and 19 months </p></div></div></div><div class="div2">
<h3><a name="expr-lib-nodeset" id="expr-lib-nodeset"></a>7.10 Node-set Functions</h3><div class="div3">
<h4><a name="fn-instance" id="fn-instance"></a>7.10.1 The instance() Function</h4><p><em>node-set</em> <b>instance</b>(<var>string</var>?)</p><p>An XForms Model can contain more than one instance. This function allows access to instance data, within the same XForms Model,
but outside the instance data containing the context node. </p><p>If the argument is omitted or is equal to the empty string, then the root element node (also called the document element node)
is returned for the default instance in the model that contains the current context node.</p><p>Otherwise, the argument is converted to a string as if by a call to the <code>string</code> function.
This string is treated as an IDREF, which is matched against <code>instance</code> elements in the containing document. If a match is located,
and the matching instance data is associated with the same XForms Model as the current context node, this function returns a node-set
containing just the root element node (also called the document element node) of the referenced instance data. In all other cases,
an empty node-set is returned. </p><p>Example:</p><p>For instance data corresponding to this XML: </p><div class="exampleOuter"><div class="exampleInner"><pre><xforms:instance xmlns="" id="orderform">
<orderForm>
<shipTo>
<firstName>John</firstName>
</shipTo>
</orderForm>
</xforms:instance></pre></div></div><p>The following expression selects the <code>firstName</code> node. Note that the <code>instance</code> function returns an element node, effectively replacing the leftmost location step from the path: </p><div class="exampleOuter"><div class="exampleInner"><pre>ref="instance('orderform')/shipTo/firstName"</pre></div></div></div><div class="div3">
<h4><a name="fn-current" id="fn-current"></a>7.10.2 The current() Function</h4><p><em>node-set</em> <b>current</b>()</p><p>Returns the <a title="" href="#ref-xpath-1.0">context node</a> used to initialize the evaluation of the containing XPath expression.</p><p>Examples:</p><div class="exampleOuter"><p>For the following instance data:</p><div class="exampleInner"><pre><xforms:instance xmlns="">
<converter>
<amount>100</amount>
<currency>jpy</currency>
<convertedAmount></convertedAmount>
</converter>
</xforms:instance>
<xforms:instance xmlns="" id="convTable">
<convTable date="20040212" currency="cdn">
<rate currency="eur">0.59376</rate>
<rate currency="mxn">8.37597</rate>
<rate currency="jpy">80.23451</rate>
<rate currency="usd">0.76138</rate>
</convTable>
</xforms:instance></pre></div><p>and the following value calculation bind:</p><div class="exampleInner"><pre><bind nodeset="convertedAmount"
calculate="../amount *
instance('convTable')/rate[@currency=current()/../currency]"/></pre></div><p>the content value of <code>/converter/convertedAmount</code> is the product of <code>/converter/amount</code>
and the conversion table rate given by the <code>rate</code> element whose <code>currency</code> attribute value
matches the content of <code>/converter/currency</code>.</p></div><div class="exampleOuter"><p>For the following instance data:</p><div class="exampleInner"><pre><xforms:instance xmlns="" id="i1">
<months>
<mon>01</mon>
<mon>02</mon>
<mon>03</mon>
</months>
</xforms:instance>
<xforms:instance xmlns="" id="i2">
<months>
<month code="01">Jan</month>
<month code="02">Feb</month>
<month code="03">Mar</month>
</months>
</xforms:instance></pre></div><p>and the following repeat structure:</p><div class="exampleInner"><pre><repeat nodeset="mon">
<output value="instance('i2')/month[@code = current()]/>
</repeat>
</pre></div><p>the output should contain <code>Jan Feb Mar</code>.</p></div></div><div class="div3">
<h4><a name="fn-id" id="fn-id"></a>7.10.3 The id() Function</h4><p><em>node-set</em> <b>id</b>(<var>object</var>, <var>node-set</var>?)</p><p>The <code>object</code> parameter provides one or more IDREFs. This may be in the form of a string containing
a space-separated list of IDREFs or a node-set, each node of which contains an IDREF. The <code>node-set</code>
parameter provides nodes in one or more instance data documents to be searched.
If the node-set parameter is not given or is empty, then the instance data document to be
searched is the one containing the context node of the function call. For each node in the
node-set parameter (or its default), the set of element nodes are collected with IDs that match the IDREFs from the
<code>object</code> parameter. The result of this function is a node-set containing the union of the collected element
nodes from each string. An element node can be assigned an ID by means of an <code>xml:id</code> attribute or an
attribute that is assigned the type ID by a DTD or xsd:ID or any type derived from xsd:ID by an XML schema,
or the <code>type</code> model item property.</p><p>Example:</p><div class="exampleOuter"><div class="exampleInner"><pre>id('X Y', instance('Z'))</pre></div><p>Returns nodes identified by X or Y from the instance data document associated with the root element of the <code>instance</code> identified by Z.</p></div></div><div class="div3">
<h4><a name="fn-context" id="fn-context"></a>7.10.4 The context() Function</h4><p><em>node-set</em> <b>context</b>()</p><p>This function returns the in-scope evaluation context node of the nearest ancestor element of the node containing the XPath expression that invokes this function. The nearest ancestor element may have been created dynamically as part of the run-time expansion of repeated content as described in Section <a href="#idref-resolve"><b>4.7 Resolving ID References in XForms</b></a>.</p><p>Example:</p><div class="exampleOuter"><div class="exampleInner"><pre><setvalue ref="x" value="context()/y"/></pre></div><p>This action sets node <code>x</code> to the value of node <code>y</code>, where both nodes are children of the in-scope evaluation context node for the <code>setvalue</code> element.</p></div><div class="note"><p class="prefix"><b>Note:</b></p><p>An intended use of this function is in conjunction with the <code>repeat</code> element (Section <a href="#ui-repeat"><b>9.3.1 The repeat Element</b></a> and the <code>setvalue</code> action element (Section <a href="#action-setvalue"><b>10.2 The setvalue Element</b></a>). The intent is to provide form authors with a means of expressing a <code>value</code> attribute that is relative to the repeat context node when the Single Node Binding result is not.</p></div></div></div><div class="div2">
<h3><a name="expr-lib-object" id="expr-lib-object"></a>7.11 Object Functions</h3><div class="div3">
<h4><a name="fn-choose" id="fn-choose"></a>7.11.1 The choose() Function</h4><p><em>object</em> <b>choose</b>(<var>boolean</var>, <var>object</var>, <var>object</var>)</p><p>This function provides a conditional test that chooses an object to return based on the boolean parameter. If the boolean parameter is true, then the first object is returned, otherwise the second object is returned. Each of the object parameters can be of any XPath datatype as described in Section <a href="#expr-datatypes"><b>7.1 XPath Datatypes</b></a>, and this function does no type conversion of the parameter it chooses to return.
</p><div class="note"><p class="prefix"><b>Note:</b></p><p>All parameters of an XPath function are evaluated, so the parameter that is not returned by this function is still evaluated, and its result is discarded by this function.</p></div><div class="note"><p class="prefix"><b>Note:</b></p><p>Form authors and design tools are encouraged to use this function instead of the function <code>if()</code> described in Section <a href="#fn-if"><b>7.8.1 The if() Function</b></a>, which has been deprecated. Because this function returns an object instead of a string, migrating from <code>if()</code> to <code>choose()</code> may occasionally require conversion of the return result using the <code>string()</code> function.</p></div><p>Example:</p><div class="exampleOuter"><div class="exampleInner"><pre>choose(count(x) > 0, x, y)</pre></div><p>Returns the node-set of matching <code>x</code> if it is non-empty and the node-set matching <code>y</code> otherwise.</p><div class="exampleInner"><pre>choose(@x, @x, 0)</pre></div><p>If the context node of the function contains attribute <code>x</code>, then the nodeset containing that attribute is returned. Otherwise, the number <code>0</code> is returned.</p></div></div><div class="div3">
<h4><a name="fn-event" id="fn-event"></a>7.11.2 The event() Function</h4><p><em>object</em> <b>event</b>(<var>string</var>)</p><p>Function <code>event</code> returns context specific information determined by the <em>string</em>
argument. The returned context information is an XPath object whose type and content
depends upon the requested property. Each event describes what properties can be accessed by this function
and the type and value that will be returned as the result. </p><p>The event context properties available for each event are provided in the sections that describe the events.</p><p>This function is intended for use in the XPath expressions of XForms actions. If invoked for any other
XPath expression, such as a binding expression or model item property expression, this function returns
the empty string. If this function is invoked from an XPath expression for an XForms action, then event context
information is used from the most recently dispatched event whose action handler contains the XForms action.</p><p>Some properties defined for an event may be unavailable if certain prerequisite conditions were not met prior to the event being dispatched.
Implementations may also add custom properties. If the event context information does not contain the property indicated by the
<em>string</em> argument, then an empty node-set is returned.</p><p>Examples:</p><div class="exampleOuter"><div class="exampleInner"><pre>event('inserted-nodes')</pre></div><p>If called from an <code>xforms-insert</code> event handler, a nodeset is returned containing the instance data node or nodes inserted.</p></div></div></div><div class="div2">
<h3><a name="expr-lib-extension" id="expr-lib-extension"></a>7.12 Extension Functions</h3><p>XForms documents may use additional XPath extension functions beyond those described here. A number of useful community extensions are defined at <a href="#ref-exslt">[EXSLT]</a>. The names of any such extension functions must be declared in attribute <code>functions</code> on element <code>model</code>. Such declarations are used by the XForms Processor to check against available extension functions. XForms Processors perform this check at the time the document is loaded, and halt processing by signaling an exception (<a href="#evt-computeException"><b>4.5.2 The xforms-compute-exception Event</b></a>) if the XForms document declares an extension function for which the processor does not have an implementation. </p><div class="note"><p class="prefix"><b>Note:</b></p><p> Explicitly declaring extension functions enables XForms Processors to detect the use of unimplemented extension functions at document load-time, rather than throwing a fatal exception (<a href="#evt-bindingException"><b>4.5.1 The xforms-binding-exception Event</b></a> or <a href="#evt-computeException"><b>4.5.2 The xforms-compute-exception Event</b></a>) during user interaction. Failure by authors to declare extension functions will result in an XForms Processor potentially halting processing during user interaction with a fatal error. </p></div></div></div><div class="div1">
<h2><a name="controls" id="controls"></a>8 Core Form Controls</h2><p>This chapter covers the XForms view layer features for directly interacting with instance data and properties from the XForms Model.
This includes features that provide data from the model to the view layer as well as features of the view layer that commit data collected from the
user to the model.</p><div class="div2">
<h3><a name="N74868" id="N74868"></a>8.1 The XForms Core Form Controls Module</h3><p id="def-core-form-control"><a title="form control" href="#def-form-control">Form controls</a> are declared using markup elements, and their behavior refined via markup attributes. The core form controls are described in this module, including their attributes and their content models (their metadata elements). A <b>core form control</b> is an element that acts as a direct point of user interaction and often provides read, write, or read/write access to a node of instance data. See Section <a href="#ui"><b>9 Container Form Controls</b></a> for a description of <a title="" href="#def-container-form-control">container form controls</a>.</p><table border="1" summary="listing of XForms Core Form Control elements, their attributes and content models (their metadata elements)"><tbody><tr><th rowspan="1" colspan="1">Core Form Control Element</th><th rowspan="1" colspan="1">Attributes</th><th rowspan="1" colspan="1">Minimal Content Model</th></tr><tr><td rowspan="1" colspan="1"><a title="" href="#ui-input">input</a></td><td rowspan="1" colspan="1"><a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#attrs-ui-common">UI Common</a>, <a title="" href="#structure-attrs-single-node">Single Node Binding</a>, inputmode (xsd:string), incremental (xsd:boolean)</td><td rowspan="1" colspan="1">label, (<a title="" href="#elems-ui-common">UI Common</a>)*</td></tr><tr><td rowspan="1" colspan="1"><a title="" href="#ui-secret">secret</a></td><td rowspan="1" colspan="1"><a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#attrs-ui-common">UI Common</a>, <a title="" href="#structure-attrs-single-node">Single Node Binding</a>, inputmode (xsd:string), incremental (xsd:boolean)</td><td rowspan="1" colspan="1">label, (<a title="" href="#elems-ui-common">UI Common</a>)*</td></tr><tr><td rowspan="1" colspan="1"><a title="" href="#ui-textarea">textarea</a></td><td rowspan="1" colspan="1"><a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#attrs-ui-common">UI Common</a>, <a title="" href="#structure-attrs-single-node">Single Node Binding</a>, inputmode (xsd:string), incremental (xsd:boolean)</td><td rowspan="1" colspan="1">label, (<a title="" href="#elems-ui-common">UI Common</a>)*</td></tr><tr><td rowspan="1" colspan="1"><a title="" href="#ui-output">output</a></td><td rowspan="1" colspan="1"><a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#structure-attrs-single-node">Single Node Binding</a> (author-optional), appearance ("full"|"compact"|"minimal"|<a title="QNameButNotNCName" href="#def-QNameButNotNCName">QNameButNotNCName</a>), value (XPath Expression), mediatype (xsd:string)</td><td rowspan="1" colspan="1">label?, <a title="" href="#ui-output-mediatype">mediatype</a>?, (<a title="" href="#elems-ui-common">UI Common</a>)*</td></tr><tr><td rowspan="1" colspan="1"><a title="" href="#ui-upload">upload</a></td><td rowspan="1" colspan="1"><a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#attrs-ui-common">UI Common</a>, <a title="" href="#structure-attrs-single-node">Single Node Binding</a>, mediatype (xsd:string), incremental (xsd:boolean)</td><td rowspan="1" colspan="1">label, <a title="" href="#ui-upload-filename">filename</a>?, <a title="" href="#ui-upload-mediatype">mediatype</a>?, (<a title="" href="#elems-ui-common">UI Common</a>)*</td></tr><tr><td rowspan="1" colspan="1"><a title="" href="#ui-range">range</a></td><td rowspan="1" colspan="1"><a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#attrs-ui-common">UI Common</a>, <a title="" href="#structure-attrs-single-node">Single Node Binding</a>, start (xsd:string), end (xsd:string), step (xsd:string), incremental (xsd:boolean)</td><td rowspan="1" colspan="1">label, (<a title="" href="#elems-ui-common">UI Common</a>)*</td></tr><tr><td rowspan="1" colspan="1"> <a title="" href="#ui-trigger">trigger</a> </td><td rowspan="1" colspan="1"><a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#attrs-ui-common">UI Common</a>,
<a title="" href="#structure-attrs-single-node">Single Node Binding</a> (author-optional)</td><td rowspan="1" colspan="1">label, (<a title="" href="#elems-ui-common">UI Common</a>)*</td></tr><tr><td rowspan="1" colspan="1"><a title="" href="#ui-submit">submit</a></td><td rowspan="1" colspan="1"><a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#attrs-ui-common">UI Common</a>, <a title="" href="#structure-attrs-single-node">Single Node Binding</a> (author-optional), submission (xsd:IDREF)</td><td rowspan="1" colspan="1">label, (<a title="" href="#elems-ui-common">UI Common</a>)*</td></tr><tr><td rowspan="1" colspan="1"> <a title="" href="#ui-selectMany">select</a> </td><td rowspan="1" colspan="1"><a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#attrs-ui-common">UI Common</a>, <a title="" href="#structure-attrs-single-node">Single Node Binding</a>, selection ("open" | "closed"), incremental (xsd:boolean)</td><td rowspan="1" colspan="1">label, (<a title="" href="#elems-list-ui-common">List UI Common</a>)+, (<a title="" href="#elems-ui-common">UI Common</a>)*</td></tr><tr><td rowspan="1" colspan="1"> <a title="" href="#ui-selectOne">select1</a> </td><td rowspan="1" colspan="1"><a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#attrs-ui-common">UI Common</a>, <a title="" href="#structure-attrs-single-node">Single Node Binding</a>, selection ("open" | "closed"), incremental (xsd:boolean)</td><td rowspan="1" colspan="1">label, (<a title="" href="#elems-list-ui-common">List UI Common</a>)+, (<a title="" href="#elems-ui-common">UI Common</a>)*</td></tr></tbody></table><div class="note"><p class="prefix"><b>Note:</b></p><p>Unless bound to form controls, instance data nodes are not presented to the user; consequently, there is no need for a form control corresponding to HTML <code>input type="hidden"</code>. </p></div><p>The following table summarizes additional support elements for form controls.</p><table border="1" summary="listing of support elements for form controls, their attributes and their content models"><tbody><tr><th rowspan="1" colspan="1">Support Element</th><th rowspan="1" colspan="1">Attributes</th><th rowspan="1" colspan="1">Minimal Content Model</th></tr><tr><td rowspan="1" colspan="1"> <a title="" href="#ui-commonelems-label">label</a> </td><td rowspan="1" colspan="1"><a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#structure-attrs-single-node">Single Node Binding</a> (author-optional)</td><td rowspan="1" colspan="1">(PCDATA|(<a title="" href="#elems-inline">UI Content</a>))*</td></tr><tr><td rowspan="1" colspan="1"><a title="" href="#ui-commonelems-help">help</a></td><td rowspan="1" colspan="1"><a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#structure-attrs-single-node">Single Node Binding</a> (author-optional)</td><td rowspan="1" colspan="1">(PCDATA|(<a title="" href="#elems-inline">UI Content</a>))*</td></tr><tr><td rowspan="1" colspan="1"><a title="" href="#ui-commonelems-hint">hint</a></td><td rowspan="1" colspan="1"><a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#structure-attrs-single-node">Single Node Binding</a> (author-optional)</td><td rowspan="1" colspan="1">(PCDATA|(<a title="" href="#elems-inline">UI Content</a>))*</td></tr><tr><td rowspan="1" colspan="1"><a title="" href="#ui-commonelems-alert">alert</a></td><td rowspan="1" colspan="1"><a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#structure-attrs-single-node">Single Node Binding</a> (author-optional)</td><td rowspan="1" colspan="1">(PCDATA|(<a title="" href="#elems-inline">UI Content</a>))*</td></tr><tr><td rowspan="1" colspan="1"> <a title="" href="#ui-upload-filename">filename</a> (for <a title="" href="#ui-upload">upload</a>) </td><td rowspan="1" colspan="1"><a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#structure-attrs-single-node">Single Node Binding</a></td><td rowspan="1" colspan="1">EMPTY</td></tr><tr><td rowspan="1" colspan="1"> <a title="" href="#ui-upload-mediatype">mediatype</a> (for <a title="" href="#ui-upload">upload</a>) </td><td rowspan="1" colspan="1"><a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#structure-attrs-single-node">Single Node Binding</a></td><td rowspan="1" colspan="1">EMPTY</td></tr><tr><td rowspan="1" colspan="1"><a title="" href="#ui-output-mediatype">mediatype</a> (for <a title="" href="#ui-output">output</a>) </td><td rowspan="1" colspan="1"><a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#structure-attrs-single-node">Single Node Binding</a>, value (string XPath Expression) </td><td rowspan="1" colspan="1">EMPTY</td></tr><tr><td rowspan="1" colspan="1"><a title="" href="#ui-selection-commonelems-choices">choices (for selection controls)</a></td><td rowspan="1" colspan="1"> <a title="" href="#structure-attrs-common">Common</a> </td><td rowspan="1" colspan="1">label?, (<a title="" href="#elems-list-ui-common">List UI Common</a>)+ </td></tr><tr><td rowspan="1" colspan="1"><a title="" href="#ui-selection-commonelems-item">item</a> (for selection controls)</td><td rowspan="1" colspan="1"> <a title="" href="#structure-attrs-common">Common</a> </td><td rowspan="1" colspan="1">label, value, (<a title="" href="#elems-ui-common">UI Common</a>)*</td></tr><tr><td rowspan="1" colspan="1"><a title="" href="#ui-selection-commonelems-value">value (for selection controls)</a></td><td rowspan="1" colspan="1"><a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#structure-attrs-single-node">Single Node Binding</a> (author-optional)</td><td rowspan="1" colspan="1">PCDATA</td></tr></tbody></table><p>See also: <a href="#ui-selection-commonelems-itemset"><b>9.3.6 The itemset Element</b></a> (for selection controls) and <a href="#ui-selection-commonelems-copy"><b>9.3.7 The copy Element</b></a> (for selection controls).</p><p>The following attributes are common to many user-interface related XForms elements, here called the <code>UI Common</code> attribute group.</p><table border="1" id="attrs-ui-common" summary="listing of XForms Common UI attributes"><tbody><tr><th rowspan="1" colspan="1">Element</th><th rowspan="1" colspan="1">Attributes</th></tr><tr><td rowspan="1" colspan="1">(various)</td><td rowspan="1" colspan="1">appearance ("full"|"compact"|"minimal" | <a title="QNameButNotNCName" href="#def-QNameButNotNCName">QNameButNotNCName</a>)</td></tr></tbody></table><dl><dt class="label">appearance</dt><dd><p>Author-optional attribute to define an appearance hint. If absent, the user agent may freely choose any suitable rendering.</p></dd></dl><div class="note"><p class="prefix"><b>Note:</b></p><p>A host language is expected to add attributes such as <code>xml:lang</code> as well as an attribute, named <code>class</code>, that holds a list of strings that can be matched by CSS class selectors.</p><p>Further, a host language must provide a way to indicate overall navigation order among form controls and other elements included in the host language, as well as keyboard or direct access navigation to specific elements. One such proposal is to uses a pair of attributes named <code>navindex</code> and <code>accesskey</code>, defined as follows:</p><dl><dt class="label">navindex</dt><dd><p>This author-optional attribute is a non-negative integer in the range of 0-32767 used to define the navigation sequence. This gives the author control over the sequence in which <a title="form control" href="#def-form-control">form control</a>s are traversed. The default navigation order is specified in the chapter <a href="#rpm"><b>4 Processing Model</b></a>.</p></dd><dt class="label">accesskey</dt><dd><p>This author-optional attribute defines a shortcut for moving the input focus directly to a particular <a title="form control" href="#def-form-control">form control</a>. The value of this is a single character which when pressed together with a platform specific modifier key (e.g., the <em>alt</em> key) results in the focus being set to this <a title="form control" href="#def-form-control">form control</a>.</p><p>The user agent must provide a means of identifying the accesskeys that can be used in a presentation. This may be accomplished in different ways by different implementations, for example through direct interaction with the application or via the user's guide. The accesskey requested by the author might not be made available by the player (for example it may not exist on the device used, or it may be used by the player itself). Therefore the user agent should make the specified key available, but may map the accesskey to a different interaction behavior.</p></dd></dl></div><p>Additionally, this module defines the following content sets:</p><table border="1" summary="listing of XForms Core elements, attributes, and content models"><tbody><tr><th rowspan="1" colspan="1">Content Set</th><th rowspan="1" colspan="1">Minimal Content Model</th></tr><tr><td id="elems-ui-common" rowspan="1" colspan="1"><b>UI Common</b> </td><td rowspan="1" colspan="1">(help|hint|alert|<a title="" href="#action-content-set">Action</a>)* </td></tr><tr><td id="elems-list-ui-common" rowspan="1" colspan="1"><b>List UI Common</b> </td><td rowspan="1" colspan="1">(choices|item|itemset)+ </td></tr><tr><td id="elems-form-controls" rowspan="1" colspan="1"><b>Core Form Controls</b> </td><td rowspan="1" colspan="1">(input|secret|textarea|output|upload|range|trigger|submit|select|select1)* </td></tr><tr><td id="elems-inline" rowspan="1" colspan="1"><b>UI Content</b> </td><td rowspan="1" colspan="1">(output)*</td></tr></tbody></table><p>As shown above, the XML Events module adds the Actions content set into the UI Common content set. A host language may add markup to the <a title="" href="#elems-inline">UI Content</a> set. When the XForms Extension module is present, it too should be included in the UI Common content set.</p><div class="div3">
<h4><a name="ui-processing" id="ui-processing"></a>8.1.1 Implementation Requirements Common to All Form Controls</h4><p>XForms user interface controls are bound to the underlying instance data using <a title="binding" href="#def-binding">binding</a> attributes as defined in the chapter <a href="#model"><b>6 Model Item Properties</b></a>.</p><p>Form controls enable accessibility by taking a uniform approach to such features as labels, help text, navigation, and keyboard shortcuts. Internationalization issues are addressed by following the same design principles as in XHTML. All form controls are suitable for styling as aural or visual media.</p><p>Form controls encapsulate high-level semantics without sacrificing the ability to deliver real implementations. For instance, the form control <code>select</code> enables the user to <em>select items from a set</em>. These form controls distinguish the functional aspects of the underlying control from the presentational and behavioral aspects. This separation enables the expression of the intent underlying a particular form control—see <a href="#aui-conversational-gestures">[AUI97]</a> for a definition of such high-level user interaction primitives.</p><p> Form controls when rendered display the underlying data values to which they are bound. While the data presented to the user through a form control must directly correspond to the bound instance data, the display representation is not required to match the lexical space value of the bound instance data. For example, user agents should apply appropriate conventions to the display of dates, times, durations and numeric values including separator characters.</p><p>All form controls must meet the following implementation requirements:</p><ul><li><p>All form controls, including <a title="" href="#def-container-form-control">container form controls</a>, should have an inline layout by default (e.g. for a host language that supports <a title="" href="#ref-css2">CSS</a>, the default styling should be <code>display:inline</code>). By default, <a title="" href="#def-repeat-item">repeat items</a> should have a block layout (e.g. a default styling of <code>display:block</code> for host languages that support CSS).</p></li><li><p>If a form control violates its data binding restriction, an <code>xforms-binding-exception</code> must occur.</p><div class="note"><p class="prefix"><b>Note:</b></p><p>Form controls that read or write simpleContent produce this exception whenever and as soon as they are bound to an element node that has an element child node.</p></div></li><li><p>Form controls that write simpleContent to instance data must do so exactly as defined by the XForms Action <code>setvalue</code> (<a href="#action-setvalue"><b>10.2 The setvalue Element</b></a>).</p><div class="note"><p class="prefix"><b>Note:</b></p><p>If a form control binds to an element node, then regardless of how many child nodes the element has, the result of the form control writing to the bound element node is that it has either a single non-empty text node child, or no children if the simpleContent written is the empty string (which is in accord with the data model of <a href="#ref-xpath-1.0">[XPath 1.0]</a>).</p></div></li><li><p>All form controls that read simpleContent instance data must do so as follows:</p><ul><li><p>Element nodes: If element child nodes are present, then an <code>xforms-binding-exception</code> occurs. Otherwise,
return the string value of the node. </p></li><li><p>Attribute nodes: returns the string-value of the node.</p></li><li><p>Text nodes: returns the string-value of the node.</p></li><li><p>Namespace, processing instruction, and comment nodes: behavior is undefined (implementation-dependent).</p></li><li><p>the XPath root node: an <code>xforms-binding-exception</code> occurs.</p></li></ul></li><li><p id="def-non-relevant-form-control-conditions">Form controls are considered to be <b>relevant</b>
if none of the following apply and <b>non-relevant</b>
if any of the following apply: </p><ul><li><p>the Single Node Binding is expressed and resolves to empty nodeset,</p></li><li><p>the Single Node Binding is expressed and resolves to a non-relevant instance node,</p></li><li><p>the form control is contained by a non-relevant <code>switch</code> or <code>group</code> (which includes a non-relevant <code>repeat</code> item), or</p></li><li><p>the form control is contained by a non-selected <code>case</code> element of a <code>switch</code>.</p></li></ul><p>When a form control becomes non-relevant, it must receive event <code>xforms-disabled</code> and then the
XForms action handlers that are listening for events on the non-relevant form control must be disabled.</p><p>When a non-relevant form control changes to being relevant, the XForms action handlers that listen for
events on the form control must become enabled and then the form control must be updated to represent the
current value(s) and model item properties of the instance node(s) to which it is bound or to which it refers.
The following events must be dispatched to the form control: <code>xforms-enabled</code>, <code>xforms-value-changed</code>,
one of <code>xforms-valid</code> or <code>xforms-invalid</code>, one of <code>xforms-readonly</code> or <code>xforms-readwrite</code>,
one of <code>xforms-required</code> or <code>xforms-optional</code>, and one of <code>xforms-in-range</code> or <code>xforms-out-of-range</code>.</p></li><li><p>Except as noted, relevant form controls must distinguish rendering between being bound to a required node versus a non-required node. Exceptions are form controls that do not directly render the string value of the bound node (including <code>trigger</code> and the <a title="" href="#def-container-form-control">container form controls</a>). Control of this behavior should be made available to stylesheets.</p></li><li><p>Relevant form controls must distinguish rendering between valid and invalid states. Control of this behavior should be made available to stylesheets.</p></li><li><p>Relevant form controls must indicate when the bound instance data contains a value or content that the form control is not capable of rendering. Control of this behavior should be made available to stylesheets.</p></li><li><p>If a form control binds to a readonly node, then the form control must not allow the user to modify the node value. The relevant form control that is bound to a readonly node should render in a way which indicates that entering or changing the value is not allowed. Control of the render behavior should be made available to stylesheets.</p></li></ul><p> Sections in this chapter define the various form controls by specifying the following:</p><blockquote><p>Description<br>Common Attributes<br>Special Attributes<br>Examples<br>Data Binding Restrictions<br>Implementation Requirements</p></blockquote></div><div class="div3">
<h4><a name="ui-input" id="ui-input"></a>8.1.2 The input Element</h4><p>Description: This form control enables free-form data entry or a user interface component appropriate to the datatype of the bound node..</p><p>Common Attributes: <a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#attrs-ui-common">UI Common</a>, <a title="" href="#structure-attrs-single-node">Single Node Binding</a></p><p>Special Attributes:</p><dl><dt class="label">inputmode</dt><dd><p>Author-optional. This form control accepts an input mode hint. <a href="#mode"><b>E Input Modes</b></a>.</p></dd><dt class="label">incremental</dt><dd><p>Author-optional. When <code>true</code>, this form control will generate additional <code>xforms-value-changed</code> events. The default value for this attribute is <code>false</code>.</p></dd></dl><p>Data Binding Restrictions: Binds to any simpleContent (except <code>xsd:base64Binary</code>, <code>xsd:hexBinary</code> or any datatype derived from these).</p><div class="note"><p class="prefix"><b>Note:</b></p><p>This control cannot bind to element nodes that have element children. See <a href="#ui-processing"><b>8.1.1 Implementation Requirements Common to All Form Controls</b></a> for user interface processing rules common to all form controls.</p></div><p>Implementation Requirements: Must allow entry of a lexical value for the bound datatype. Implementations should provide a convenient means for entry of datatypes and take into account localization and internationalization issues such as representation of numbers. For example, an <code>input</code> bound to an instance data node of type <code>xsd:date</code> might provide a calendar control to enter dates; similarly, an input control bound to of type <code>boolean</code> might be rendered as a checkbox.</p><p>Examples:</p><div class="exampleOuter">
<div class="exampleHead">Simple Free-Form Data Entry</div><div class="exampleInner"><pre><input ref="order/shipTo/street" class="streetAddress">
<label>Street</label>
<hint>Please enter the number and street name</hint>
</input></pre></div><p> In the above, the <code>class</code> attribute can be used by a style sheet to specify the display size of the form control. Note that the constraints on how much text can be input are obtained from the underlying XForms Model definition and not from these display properties.</p><p>A graphical browser might render the above example as follows:</p><p> <img src="images/ui-input.png" alt="An average-looking text entry form control. The label, 'Street' has been aligned to the left"> </p></div><div class="exampleOuter">
<div class="exampleHead">Datatype-sensitive Data Entry</div><div class="exampleInner"><pre><input ref="order/shipDate">
<label>Ship By</label>
<hint>Please specify the ship date for this order.</hint>
</input></pre></div><p>A graphical browser might render the above example as follows:</p><p> <img src="images/calendar-picker-closed.png" alt="A text box for a date control, with a button to open into a calendar."> </p><p>The user can type a date into the text edit box, or press the button to open a calendar:</p><p> <img src="images/calendar-picker-open.png" alt="A calendar picker graphical widget."> </p></div><div class="exampleOuter">
<div class="exampleHead">Data Entry with Activation Behavior</div><div class="exampleInner"><pre><input ref="/search/expr">
<label>Search term(s):</label>
<send ev:event="DOMActivate" submission="doSearch" />
</input>
<submit submission="doSearch">
<label>Search</label>
</submit>
</pre></div><p>This example shows the <code>input</code> and <code>submit</code> form controls working together to provide the common user experience of a simple search.
The <code>input</code> collects the search term(s) and then automatically initiates the <code>submission</code> identified by <code>doSearch</code> if the user activates the
<code>input</code> control. Alternatively, the user initiate the <code>doSearch</code> <code>submission</code> by activating the <code>submit</code> control.</p></div><div class="note"><p class="prefix"><b>Note:</b></p><p>A graphical browser on a desktop device might activate form controls such as <code>input</code> in response to a special user action such as pressing the Enter key or either clicking or double-clicking with the mouse (depending on the type of form control).</p></div></div><div class="div3">
<h4><a name="ui-secret" id="ui-secret"></a>8.1.3 The secret Element</h4><p>Description: This form control is used to provide the user with the ability to supply information to the system in a manner that makes it difficult for someone, other than the user, who may be observing the process to discern the value that is being supplied. A common use is for password entry.</p><p>Common Attributes: <a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#attrs-ui-common">UI Common</a>, <a title="" href="#structure-attrs-single-node">Single Node Binding</a></p><p>Special Attributes:</p><dl><dt class="label">inputmode</dt><dd><p>Author-optional. This form control accepts an input mode hint. <a href="#mode"><b>E Input Modes</b></a>.</p></dd><dt class="label">incremental</dt><dd><p>Author-optional. When <code>true</code>, this form control will generate additional <code>xforms-value-changed</code> events. The default value for this attribute is <code>false</code>.</p></dd></dl><p>Data Binding Restrictions: Binds to any simpleContent (except <code>xsd:base64Binary</code>, <code>xsd:hexBinary</code> or any datatype derived from these).</p><div class="note"><p class="prefix"><b>Note:</b></p><p>This control cannot bind to element nodes that have element children. See <a href="#ui-processing"><b>8.1.1 Implementation Requirements Common to All Form Controls</b></a> for user interface processing rules common to all form controls.</p></div><p>Implementation Requirements: Implementations, including accessibility aids, must obscure the value being entered into this form control. One possible approach would be to render a "*" or similar character instead of the actual characters entered. Note that this provides only a casual level of security; truly sensitive information will require additional security measures outside the scope of XForms.</p><p>Example:</p><div class="exampleOuter">
<div class="exampleHead">Password Entry</div><div class="exampleInner"><pre><secret ref="/login/password">
<label>Password</label>
<hint>The password you enter will not be displayed.</hint>
</secret></pre></div><p>A graphical browser might render this form control as follows:</p><p><img src="images/ui-secret-with-hint.png" alt="A password entry form control, with '*' characters where the text would be expected and a hint box displaying hint text."> </p></div></div><div class="div3">
<h4><a name="ui-textarea" id="ui-textarea"></a>8.1.4 The textarea Element</h4><p>Description: This form control enables free-form data entry and is intended for use in entering multiline content, e.g., the body of an email message.</p><p>Common Attributes: <a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#attrs-ui-common">UI Common</a>, <a title="" href="#structure-attrs-single-node">Single Node Binding</a></p><p>Special Attributes:</p><dl><dt class="label">inputmode</dt><dd><p>Author-optional. This form control accepts an input mode hint. <a href="#mode"><b>E Input Modes</b></a>.</p></dd><dt class="label">incremental</dt><dd><p>Author-optional. When <code>true</code>, this form control will generate additional <code>xforms-value-changed</code> events. The default value for this attribute is <code>false</code>.</p></dd></dl><p>Data Binding Restrictions: Binds to any simpleContent (except <code>xsd:base64Binary</code>, <code>xsd:hexBinary</code> or any datatype derived from these).</p><div class="note"><p class="prefix"><b>Note:</b></p><p>This control cannot bind to element nodes that have element children. See <a href="#ui-processing"><b>8.1.1 Implementation Requirements Common to All Form Controls</b></a> for user interface processing rules common to all form controls.</p></div><p>Implementation Requirements: Must allow entry of a lexical value for the bound datatype, including multiple lines of text. </p><p>Example:</p><div class="exampleOuter">
<div class="exampleHead">Email Message Body</div><div class="exampleInner"><pre><textarea ref="message/body" class="messageBody">
<label>Message Body</label>
<hint>Enter the text of your message here</hint>
</textarea></pre></div><p> In the above, the <code>class</code> attribute can be used by a style sheet to specify the display size of the form control. Note that the constraints on how much text can be input are obtained from the underlying XForms Model definition and not from these display properties.</p><p>A graphical browser might render the above example as follows:</p><p> <img src="images/ui-textarea.png" alt="A larger-than-average text entry form control. The title, 'Message Body:' provides an additional hint that large amounts of text are allowed here."> </p></div></div><div class="div3">
<h4><a name="ui-output" id="ui-output"></a>8.1.5 The output Element</h4><p>Description: This form control renders content based in part on instance data, but it provides no means for entering or changing data. </p><p>Common Attributes: <a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#structure-attrs-single-node">Single Node Binding</a> (author-optional)</p><p>Special Attributes:</p><dl><dt class="label">appearance</dt><dd><p>This form control does not use the UI Common attribute group, but nevertheless still contains an author-optional <code>appearance</code> attribute, as defined above.</p></dd><dt class="label">value</dt><dd><p>Author-optional. An XPath expression to be evaluated. The string result of the evaluation is rendered by the form control.
If binding attributes are present to select a node, this attribute has no effect. The evaluation context is the same as would be applied to the evaluation
of the single node binding. This XPath expression is re-evaluated whenever there is a change in any node to which the expression refers.
An empty string is used if the XPath evaluation fails.</p></dd><dt class="label">mediatype</dt><dd><p id="ui-output-mediatype-attr">Author-optional attribute used to indicate that data obtained from the Single-Node Binding should be rendered (after decoding, if needed) according to a desired media type indicated by
the attribute value string, such as <code>image/*</code> for image rendition. If the <a title="" href="#ui-output-mediatype">mediatype</a> element appears as a child of
the <code>output</code>, then it overrides this attribute. If the media type is not specified by this attribute or by the <code>mediatype</code> element, then the the default is to present the
indicated data as plain text (with no decoding according to datatype). </p></dd></dl><p>Data Binding Restrictions: Binds to any simpleContent.</p><div class="note"><p class="prefix"><b>Note:</b></p><p>This control cannot bind to element nodes that have element children. See <a href="#ui-processing"><b>8.1.1 Implementation Requirements Common to All Form Controls</b></a> for user interface processing rules common to all form controls.</p></div><p>Implementation Requirements: Must allow display of a value for the bound datatype. Implementations should provide a convenient means for display of datatypes
and take into account localization and internationalization issues such as representation of numbers and dates.</p><p>Element <code>output</code> can be used to display the value of a particular instance node by using a Single-Node Binding; it can also be used to display the result of evaluating an XPath expression by specifying the XPath expression to be evaluated via attribute <code>value</code>. Note that the Single-Node Binding attributes and <code>value</code> on element <code>output</code> are mutually exclusive. </p><p>By default, the <code>output</code> element simply renders the plain text of the <code>value</code> attribute or the node indicated by the Single-Node Binding. However, if the Single-Node Binding indicates a non-empty data node, and the media type is specified based on the <a title="" href="#ui-output-mediatype-attr">mediatype attribute</a> or <a title="" href="#ui-output-mediatype">mediatype child element</a>, then the content of the data node <a title="" href="#intro-reading">must</a> be decoded or dereferenced according to its datatype, and the result <a title="" href="#intro-reading">should</a> be rendered according to the indicated media type if it is possible to do so (e.g. a voice-only device cannot render a digital image). </p><div class="note"><p class="prefix"><b>Note:</b></p><p>When the media type is specified, implementations <a title="" href="#intro-reading">may</a> handle the output content as presentation-only or as interactive content, and interactive content <a title="" href="#intro-reading">may</a> be isolated from or capable of accessing the enclosing document that contains the <code>output</code>. Further implementation experience and user feedback is required. For example, if the output content includes XForms user interface elements, it may be desirable for them to access a default XForms model in the output content or from the enclosing document.</p></div><p>If the Single Node Binding is absent or if it does not indicate a non-empty instance node, then the media type specification is ignored if given. Otherwise, if the Single Node Binding produces a non-empty node, and the media type is specified, then decoding or dereferencing of the instance node prior to rendition is performed by datatype as follows:</p><ul><li><p>If the instance node either is of type or is derived from type <code>xsd:base64Binary</code>, then the data is base-64 decoded.</p></li><li><p>If the instance node either is of type or is derived from type <code>xsd:hexBinary</code>, then the data is hex-binary decoded.</p></li><li><p>If the instance node either is of type or is derived from type <code>xsd:anyURI</code>, then the data is treated as a URI and dereferenced.</p></li><li><p>If the instance node is of any other type, then the data is used without modification.</p></li></ul><p>If the <code>output</code> rendition is based on the <code>value</code> attribute, then the rendition is updated if the nodes referenced by the <code>value</code> expression change or if the content of any of the referenced nodes changes. Otherwise, the rendition of an <code>output</code> is updated if the node referenced by the Single-Node Binding changes, if the content of the referenced node changes, or if the media type changes. The media type can change by a change to the <code>mediatype</code> element's referenced node or its content (a host language may also allow DOM mutation of the content of the <code>mediatype</code> attribute or element). A change to the label associated with the <code>output</code> causes an update to the rendition of the label (which may affect the layout position of the main output content).</p><p>Failure to render the content indicated by the <code>output</code> element <a title="" href="#intro-reading">should</a> result in an <a title="" href="#evt-output-error">xforms-output-error</a>,
a non-fatal error that does not halt XForms processing. Failures can occur on initial creation of the <code>output</code> or during user interface refresh (see Section <a href="#evt-refresh"><b>4.3.4 The xforms-refresh Event</b></a>). Failures can occur for many reasons, including </p><ul><li><p>Data to be decoded does not conform to the format of <code>xsd:base64Binary</code> or <code>xsd:hexBinary</code></p></li><li><p>An error dereferencing the URI in a node of or derived from type <code>xsd:anyURI</code></p></li><li><p>A data format error (e.g. invalid or unsupported image format)</p></li><li><p>An unrecognized media type identifier string</p></li></ul><p>The content model for the <code>output</code> element includes <a title="" href="#elems-ui-common">UI Common</a> in order to allow action handlers for the <a title="" href="#evt-output-error">xforms-output-error</a> as well as to allow more comprehensive behavior and information to be provided for the <code>output</code>, e.g. via the <code>hint</code> element.</p><p>Examples:</p><div class="exampleOuter">
<div class="exampleHead">Explanatory Message</div><div class="exampleInner"><pre>I charged you -
<output ref="order/totalPrice"/>
- and here is why:</pre></div><p>A graphical browser might render an output form control as follows:</p><p> <img src="images/ui-output.png" alt="Average-looking text, reading 'I charged you 100.0 - and here is why:'"> </p></div><div class="exampleOuter">
<div class="exampleHead">Displaying an image uploaded to instance data</div><div class="exampleInner"><pre><xforms:model>
<xforms:instance xmlns="">
<data></data>
</xforms:instance>
<xforms:bind nodeset="/data" type="xsd:base64Binary"/>
</xforms:model></pre></div><p>Given the <code>model</code> above, the following controls can upload an image to instance data and display it:</p><div class="exampleInner"><pre><xforms:upload ref="/data" mediatype="image/*">
<xforms:label>Press me to attach a picture</xforms:label>
</xforms:upload>
<xforms:output ref="/data" mediatype="image/*">
<xforms:hint>This is the image you attached to the form.</xforms:hint>
<xforms:message ev:event="xforms-output-error">Error attaching image data.</xforms:message>
</xforms:output></pre></div></div><div class="exampleOuter">
<div class="exampleHead">Output of node bound to xsd:date</div><div class="exampleInner"><pre><bind nodeset="birthdate"
type="xsd:date" />
...
<output ref="birthdate">
<label>Lexical: </label>
</output>
<output ref="birthdate" appearance="full">
<label>Full: </label>
</output>
<output ref="birthdate" appearance="minimal">
<label>Minimal: </label>
</output></pre></div></div><p>A graphical browser may take into account the <code>appearance</code> and the localization information from the host language and present the above output form controls as follows:</p><p>Lexical: 1998-01-19 Full: 19 janvier 1998 Minimal: 19/01/1998</p><div class="div4">
<h5><a name="ui-output-mediatype" id="ui-output-mediatype"></a>8.1.5.1 The mediatype Element (for output)</h5><p>Binding attributes on author-optional element <code>mediatype</code> specify the location in the instance of the string that indicates the desired media type rendition for the parent <code>output</code>.
If the binding attributes are not used, the <code>value</code> attribute must be used instead to specify the desired media type rendition.</p><p>Common Attributes: <a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#structure-attrs-single-node">Single Node Binding</a></p><p>Special Attributes:</p><dl><dt class="label">value</dt><dd><p>An XPath expression to be evaluated. The string result of the evaluation is used to specify the desired media type for output rendition.
If a single node binding is expressed, then this attribute has no effect.
The evaluation context is the same as would be applied to the evaluation of the single node binding.
An empty string is used if the XPath evaluation fails.</p></dd></dl></div></div><div class="div3">
<h4><a name="ui-upload" id="ui-upload"></a>8.1.6 The upload Element</h4><p>Description: This form control enables the common feature found on Web sites to upload a file from the local file system, as well as accepting input from various devices including microphones, pens, and digital cameras.</p><p>Common Attributes: <a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#attrs-ui-common">UI Common</a>, <a title="" href="#structure-attrs-single-node">Single Node Binding</a></p><p>Special Attributes:</p><dl><dt class="label">mediatype</dt><dd><p>Author-optional. Space-separated list of suggested media types, used by the XForms Processor to determine the possible sources of data to upload. </p></dd><dt class="label">incremental</dt><dd><p>Author-optional. When <code>true</code>, this form control will generate additional <code>xforms-value-changed</code> events. The default for this form control is <code>false</code>.</p></dd></dl><p>Data Binding Restrictions: This form control can only be bound to datatypes <code>xsd:anyURI</code>, <code>xsd:base64Binary</code> or <code>xsd:hexBinary</code>, or types derived by restriction from these.</p><div class="note"><p class="prefix"><b>Note:</b></p><p>This control cannot bind to element nodes that have element children. See <a href="#ui-processing"><b>8.1.1 Implementation Requirements Common to All Form Controls</b></a> for user interface processing rules common to all form controls.</p></div><p>Implementation Requirements: For base64Binary or hexBinary data binding:</p><ul><li><p>When bound to an instance data node of type <code>xsd:base64binary</code>, <code>xsd:hexBinary</code>, or a type derived by restriction thereof, on activation <code>upload</code> places the binary content in the content of the node with the indicated encoding.</p></li></ul><p>Implementation Requirements: For anyURI data binding:</p><ul><li><p>When bound to an instance data node of type <code>xsd:anyURI</code> (or a type derived by restriction thereof), on activation <code>upload</code> places a URI in the content of the node.</p><p>For security reasons, the XForms Processor must not dereference the URI bound to this form control without explicit user permission.</p><div class="note"><p class="prefix"><b>Note:</b></p><p>Implementors note that <code>upload</code> must associate the binary content, mediatype, and filename with that URI for <a href="#serialize-multipart"><b>11.9.6 Serialization as multipart/related</b></a> and <a href="#serialize-form-data"><b>11.9.7 Serialization as multipart/form-data</b></a> serialization. </p></div></li></ul><ul><li><p>Implementations with a file system should support <em>file upload</em>—selecting a specific file. The types of files presented by default should reflect the mediatype specified by attribute <code>mediatype</code>, for example defaulting to only audio file types in the file dialog when the mediatype is "audio/*". </p></li></ul><p>Implementation Requirements: For all data bindings:</p><ul><li><p>Implementations with specific pen/digitizer hardware should (and implementations with other pointing devices may) support <em>scribble</em>—allowing in-place creation of pen-based data. </p></li><li><p>Implementations with specific audio recording capabilities should support <em>record audio</em>—in-place recording of an audio clip. </p></li><li><p>Implementations with a digital camera, scanner interface or screen capture should support <em>acquire image</em>—in-place upload of images from an attached device. </p></li><li><p>Implementations with video recording capability should provide a <em>record video</em> option. </p></li><li><p>Implementations with 3d capabilities should provide a 3d interface option.</p></li><li><p>Implementations may provide proprietary implementations (for example, a mediatype of <code>text/rtf</code> could invoke an edit window with a proprietary word processing application)</p></li><li><p>Implementations are encouraged to support other input devices not mentioned here.</p></li><li><p>Implementations which cannot support upload for the given mediatype must make this apparent to the user.</p></li></ul><p>See the child elements <code>filename</code> (<a href="#ui-upload-filename"><b>8.1.6.1 The filename Element</b></a>) and <code>mediatype</code> (<a href="#ui-upload-mediatype"><b>8.1.6.2 The mediatype Element (for upload)</b></a>). </p><p>Example:</p><div class="exampleOuter">
<div class="exampleHead">Uploading An Image</div><div class="exampleInner"><pre><upload ref="mail/attachment" mediatype="image/*">
<label>Select image:</label>
<filename ref="@filename" />
<mediatype ref="@mediatype" />
</upload></pre></div><p>A graphical browser might render this form control as follows:</p><p> <img src="images/ui-upload.png" alt="A drop-down box; main display reads 'Select Image:' with a cute icon. The drop-down itself has three items: (icon)-From Scanner or Camera...; (icon)-Scribble...; Browse..."> </p><p>Implementation Requirements:</p><ul><li><p>On activation, if child element <code>filename</code> is present and a filename is available, <code>upload</code> places the filename of the data to upload in the instance at the node indicated by the binding attributes on child element <code>filename</code>.</p></li><li><p>On activation, if child element <code>mediatype</code> is present and a mediatype is available, <code>upload</code> places the mediatype of the data to upload in the instance at the node indicated by the binding attributes on child element <code>mediatype</code>. </p></li></ul></div><div class="div4">
<h5><a name="ui-upload-filename" id="ui-upload-filename"></a>8.1.6.1 The filename Element</h5><p>Binding attributes on author-optional element <code>filename</code> specify the location in the instance for the parent element <code>upload</code>, when activated, to place the filename for the chosen binary resource. For security reasons, <code>upload</code> must not take action due to any existing value of the node.</p><p>Common Attributes: <a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#structure-attrs-single-node">Single Node Binding</a></p><p>Content: EMPTY</p><p>In the following example, the user is prompted to select an image. When activated, <code>upload</code> places in <code>mail/attachment</code> either the binary data of the image or a URI for it, depending on the type declared for the <code>mail/attachment</code>. The filename, perhaps "<code>me.jpg</code>", is placed in the attribute node <code>mail/attachment/@filename</code>, and the mediatype, perhaps "<code>image/jpeg</code>" in the attribute node <code>mail/attachment/@mediatype</code>.</p><p>Example:</p><div class="exampleOuter"><div class="exampleInner"><pre><upload ref="mail/attachment" mediatype="image/*">
<label>Select an image to attach</label>
<filename ref="@filename"/>
<mediatype ref="@mediatype"/>
</upload></pre></div></div></div><div class="div4">
<h5><a name="ui-upload-mediatype" id="ui-upload-mediatype"></a>8.1.6.2 The mediatype Element (for upload)</h5><p>Binding attributes on author-optional element <code>mediatype</code> specify the location in the instance for the parent element <code>upload</code>, when activated, to place the mediatype of the chosen binary resource, if available.</p><p>Common Attributes: <a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#structure-attrs-single-node">Single Node Binding</a></p><p>Content: EMPTY</p></div></div><div class="div3">
<h4><a name="ui-range" id="ui-range"></a>8.1.7 The range Element</h4><p>Description: This form control allows selection from a sequential range of values.</p><p>Common Attributes: <a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#attrs-ui-common">UI Common</a>, <a title="" href="#structure-attrs-single-node">Single Node Binding</a></p><p>Special Attributes:</p><dl><dt class="label">start</dt><dd><p>Author-optional attribute containing a hint for the lexical starting bound for the range—a legal value for the underlying data. If provided, this value is used to further refine the constraints specified by the underlying model.</p></dd><dt class="label">end</dt><dd><p>Author-optional attribute containing a hint for the ending bound for the range—a legal value for the underlying data. If provided, this value is used to further refine the constraints specified by the underlying model.</p></dd><dt class="label">step</dt><dd><p>Author-optional attribute containing a delta-value to use for incrementing or decrementing the value. Must be of a type capable of expressing the difference between two legal values of the underlying data.</p></dd><dt class="label">incremental</dt><dd><p>Author-optional. When <code>true</code>, this form control will generate additional <code>xforms-value-changed</code> events. The default for this form control is <code>false</code>.</p></dd></dl><p>Data Binding Restrictions: Binds only the following list of datatypes, or datatypes derived by restriction from those in the list: <code>xsd:duration</code>, <code>xsd:date</code>, <code>xsd:time</code>, <code>xsd:dateTime</code>, <code>xsd:gYearMonth</code>, <code>xsd:gYear</code>, <code>xsd:gMonthDay</code>, <code>xsd:gDay</code>, <code>xsd:gMonth</code>, <code>xsd:float</code>, <code>xsd:double</code>, and <code>xsd:decimal</code>.</p><div class="note"><p class="prefix"><b>Note:</b></p><p>The above list of datatypes includes by derivation all of the integer datatypes (), all of the XForms datatypes defined in Section <a href="#datatypes-xforms"><b>5.2 XForms Datatypes</b></a> that correspond to the allowed XML schema datatypes, and the datatypes defined in <a href="#dt-dayTimeDuration"><b>5.2.4 xforms:dayTimeDuration</b></a> and <a href="#dt-yearMonthDuration"><b>5.2.5 xforms:yearMonthDuration</b></a>.</p></div><div class="note"><p class="prefix"><b>Note:</b></p><p>This control cannot bind to element nodes that have element children. See <a href="#ui-processing"><b>8.1.1 Implementation Requirements Common to All Form Controls</b></a> for user interface processing rules common to all form controls.</p></div><p>Implementation Requirements: Must allow input of a value corresponding to the bound datatype. Implementations should inform the user of the upper and lower bounds, as well as the step size, if any. If the instance data value is outside the upper or lower bounds, this form control must indicate an out-of-range condition. In graphical environments, this form control may be rendered as a "slider" or "rotary control".</p><p>In the event of overlapping restrictions between the underlying datatype and the <code>start</code> and <code>end</code> hints, the most restrictive range should be used.</p><p>Notice that the attributes of this element encapsulate sufficient metadata that in conjunction with the type information available from the XForms Model proves sufficient to produce meaningful prompts when using modalities such as speech, e.g., when using an accessibility aid. Thus, in the example below, an aural user agent might speak a prompt of the form <em>Please pick a date in the range January 1, 2001 through December 31, 2001.</em></p><p>Examples:</p><div class="exampleOuter">
<div class="exampleHead">Picking From A Range</div><div class="exampleInner"><pre><range ref="/stats/balance" start="-2.0" end="2.0" step="0.5">
<label>Balance</label>
</range></pre></div><p>A graphical browser might render this as follows:</p><p> <img src="images/ui-range.png" alt="a slider control, from -2 to +2"> </p></div><div class="exampleOuter">
<div class="exampleHead">Picking a date from a range</div><div class="exampleInner"><pre><range ref="/order/shipDate" start="2001-01-01" end="2001-12-31">
<label>Ship Date</label>
</range></pre></div></div></div><div class="div3">
<h4><a name="ui-trigger" id="ui-trigger"></a>8.1.8 The trigger Element</h4><p>Description: This form control is similar to the HTML element <code>button</code> and allows for user-triggered actions. This form control may also be used to construct other custom form controls.</p><p>Common Attributes: <a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#attrs-ui-common">UI Common</a>, <a title="" href="#structure-attrs-single-node">Single Node Binding</a> (author-optional)</p><p>Data Binding Restrictions: Binds to any node. This form control does not directly interact with form data, but is affected by model item properties of the bound node, thus binding attributes are not required.</p><p>Implementation Requirements: The user agent must provide a means to generate an <code>DOMActivate</code> event on the form control. Graphical implementations might render this form control as a push-button with the label on the button face. Style sheets can be used to style this form control as an image, hyperlink, or other presentation.</p><p>Although a <code>trigger</code> element receives events associated with model item properties of a bound node, such as <code>xforms-readonly</code> and <code>xforms-invalid</code>,
the XForms processor must not impart special behaviors on this control for model item properties other than the model item property <code>relevant</code> of a bound data node. For example, the <code>readonly</code>
model item property of a bound data node does not affect whether or not the <code>trigger</code> can be activated. </p><p>Typically, a style sheet would be used to determine the exact appearance of form controls, though a means is provided to suggest an appearance through attribute <code>appearance</code>.
Suggested renditions for the pre-defined values of this attribute are as follows: </p><blockquote><p>"full": visually rendered as a standard button control with border.<br>"compact": visually rendered as a standard button control without border<br>"minimal": rendered with no border, a transparent background and underline font effect. This rendition hint is meant to be analogous to the typical visual rendition of an XHTML anchor element.</p></blockquote><p>Example:</p><div class="exampleOuter">
<div class="exampleHead">Simple Trigger</div><div class="exampleInner"><pre><trigger>
<label>Click here</label>
</trigger></pre></div></div></div><div class="div3">
<h4><a name="ui-submit" id="ui-submit"></a>8.1.9 The submit Element</h4><p>Description: This form control initiates a submission .</p><p>Common Attributes: <a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#attrs-ui-common">UI Common</a>,
<a title="" href="#structure-attrs-single-node">Single Node Binding</a> (author-optional)</p><p>Special Attributes:</p><dl><dt class="label">submission</dt><dd><p>Author-optional attribute containing a reference to element <code>submission</code>. If this attribute is given but does not identify a <code>submission</code> element,
then activating the <code>submit</code> does not result in the dispatch of an <code>xforms-submit</code> event. If this attribute is omitted, then the first <code>submission</code> in document
order from the <code>model</code> associated with the in-scope evaluation context is used.</p></dd></dl><p>Data Binding Restrictions: Binds to any node. This form control does not directly interact with form data, but is affected by model item properties of the bound node, thus binding attributes are not required.</p><p>Implementation Requirements:
The default action for event <code>DOMActivate</code> is to dispatch
event <code>xforms-submit</code> to the <code>submission</code> element specified by
attribute <code>submission</code> (or its default).
Upon activation, this control must become unavailable for further activations until the submit process concludes with either an <code>xforms-submit-done</code>
or <code>xforms-submit-error</code> event.</p><p>Typically, a style sheet would be used to determine the exact appearance of form controls, though a means is provided to suggest an appearance through attribute <code>appearance</code>.
Suggested renditions for the pre-defined values of this attribute are the same as for <a title="" href="#ui-trigger">trigger</a>.</p><p>Example:</p><div class="exampleOuter">
<div class="exampleHead">Submit</div><div class="exampleInner"><pre><submit submission="timecard">
<label>Submit Timecard</label>
</submit></pre></div></div></div><div class="div3">
<h4><a name="ui-selectMany" id="ui-selectMany"></a>8.1.10 The select Element</h4><p>Description: This form control allows the user to make multiple selections from a set of choices.</p><p>Common Attributes: <a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#attrs-ui-common">UI Common</a>, <a title="" href="#structure-attrs-single-node">Single Node Binding</a></p><p>Special Attributes:</p><dl><dt class="label">selection</dt><dd><p>Author-optional attribute determining whether free entry is allowed in the list. Default is "closed".</p></dd><dt class="label">incremental</dt><dd><p>Author-optional. When <code>true</code>, this form control will generate additional <code>xforms-value-changed</code> events. The default for this form control is <code>true</code>.</p></dd></dl><p>Data Binding Restrictions: any simpleContent capable of holding a sequence. The restriction to binding simpleContent exists when the choices are authored as part of the user interface control as shown in this section. Element <code>itemset</code> (described in <a href="#ui-selection-commonelems-itemset"><b>9.3.6 The itemset Element</b></a>) creates dynamic selection items and allows the available choices to be obtained from an XForms Model. When <code>itemset</code> uses the <code>value</code> element, the restriction to binding simpleContent remains in effect. However, the <code>itemset</code> also allows for the selection and deselection of subtrees of instance data using the <code>copy</code> element, and when using that construct, the data binding restriction to simpleContent is relaxed, but the form control must bind to an element with no mixed content.</p><div class="note"><p class="prefix"><b>Note:</b></p><p>Except in the case described above where the simpleContent data binding restriction is relaxed, this control cannot bind to element nodes that have element children. See <a href="#ui-processing"><b>8.1.1 Implementation Requirements Common to All Form Controls</b></a> for user interface processing rules common to all form controls.</p></div><div class="note"><p class="prefix"><b>Note:</b></p><p>A limitation of the XML Schema list datatypes is that white space characters in the storage values (the <code>value</code> element) are always interpreted as separators between individual data values. Therefore, authors should avoid using white space characters within storage values with list simpleContent.</p><div class="exampleOuter">
<div class="exampleHead">Incorrect Type Declaration</div><div class="exampleInner"><pre><item>
<value>United States of America</value>
...
</item></pre></div></div><p>When selected, this item would introduce not one but four additional selection values: "America", "of", "States", and "United".</p></div><p>Implementation Requirements: The label for each choice must be presented, and the control must allow any number of selections, possibly none. When this form control uses the <code>value</code> element for selection, it stores the values corresponding to the selected choices in a space separated list in the location addressed by the binding attributes. The values to be stored for selected items are either directly specified as the contents of element <code>value</code>, or specified indirectly through binding attributes on element <code>value</code>. When this form control uses the <code>copy</code> element for selection, it stores copies of the subtrees corresponding to the selected choices in the location addressed by the binding attributes. </p><p>The datatype bound to this form control may include a non-enumerated value space, e.g., <code>xsd:string</code>, or a union of a enumeration and a non-enumerated datatype (called an open enumeration). In this case, control <code>select</code> may have attribute <code>selection="open"</code>. The form control must then allow free data entry, as described in <a href="#ui-input"><b>8.1.2 The input Element</b></a>. The form control may permit multiple values to be entered through free entry.</p><p><b>For closed selections:</b> If the instance data matches the storage data of one or more of the selection items, those items are selected. If there is no match, no items are initially selected. If any of the stored values or subtree copies do not correspond to an item with a matching storage value or subtree, the form control must indicate an out-of-range condition. If the form control switches to or from being out-of-range, then <code>xforms-out-of-range</code> or <code>xforms-in-range</code> must be dispatched to the form control.</p><p><b>For open selections:</b> When using dynamic selections with the <code>itemset</code> and <code>copy</code> elements, open selection has no effect. If the instance data matches the storage values specified by one or more of the selection items, then all such matching items are selected. If any instance data list values do not match the storage value specified by one or more of the items, all such non-matching values are retained, as if entered through free entry. Free entry text is handled the same as form control <code>input</code> (<a href="#ui-input"><b>8.1.2 The input Element</b></a>), possibly in multiplicity. </p><p>For both closed and open selections, any selection item with an empty storage data subtree or a storage value that is either empty or contains only white space characters must remain deselected.</p><p>For both closed and open selections, the above rules describe which items are considered to be selected and deselected by the control. The <code>select</code> form control changes the states of selected and deselected items on creation, refresh, and user selection or deselection of an item. Newly selected items receive the event <code>xforms-select</code> immediately after all newly deselected items receive the event <code>xforms-deselect</code>. The content of the instance node bound to the selection control must only be changed by the addition or deletion of storage data associated with items that have been selected or deselected. Content not associated with selection items is preserved. For selection controls that use the <code>value</code> element, the net effect of newly selected and deselected items is computed into a string, preserving content not associated with selection items, and the result is then committed to the bound instance node
by using the XForms Action <a href="#action-setvalue"><b>10.2 The setvalue Element</b></a>.
For selection controls that use the <code>copy</code> element, the individual subtrees associated with the newly selected and deselected items are added or removed individually by
using <a href="#action-insert"><b>10.3 The insert Element</b></a> and <a href="#action-delete"><b>10.4 The delete Element</b></a>.</p><p><b>Implementation Hints:</b> </p><p>
For closed selections, when the form control is created or refreshed to reflect bound instance data, behavior equivalent to the following steps occurs:
</p><ol class="enumar"><li><p>
The content parts (space-separated values or subtree copies) in the bound instance data node are compared with the form control items' storage data (values or subtree copies).
</p></li><li><p>
Each item with storage data (value or subtree copy) equal to an instance data content part becomes selected if it was not already selected.
</p></li><li><p>
Each item with storage data missing from the instance data content becomes deselected if it was not already deselected.
</p></li><li><p>
If there are instance data content parts for which there is no corresponding selection item, the form control indicates an out-of-range condition.
</p></li></ol><p>
When the user selects an item which was previously deselected, behavior equivalent to the following steps occurs:
</p><ol class="enumar"><li><p>
If the item's storage data (value or subtree copy) was not present in the bound instance data, the item's storage data is
inserted into the instance data content list. The exact location of the insertion is implementation-dependent.
Any other item having the same storage data becomes selected as well.
</p></li><li><p>
If the item's storage data was already present in the bound instance data, the bound instance data is left unchanged.
</p></li></ol><p>
When the user deselects an item which was previously selected, behavior equivalent to the following steps occurs:
</p><ol class="enumar"><li><p>
If the item's storage data was present in the bound instance data, the item's storage data is
removed from the instance data content list. Any other item having the same storage data
becomes deselected as well.
</p></li><li><p>
If the item's storage data was already absent from the bound instance data, the bound instance data is left unchanged.
</p></li></ol><p>
For open selections: when the form control is created or refreshed to reflect bound instance data, the behavior is the same as with closed
selection, except the form control never indicates an out-of-range condition.
</p><p>An accessibility aid might allow the user to browse through the available choices and leverage the grouping of choices in the markup to provide enhanced navigation through long lists of choices.</p><p>Typically, a style sheet would be used to determine the exact appearance of form controls, though a means is provided to suggest an appearance through attribute <code>appearance</code>.
The value of the attribute consists of one of the following values: </p><blockquote><p>"full": all choices should be rendered at all times.<br>"compact": a fixed number of choices should be rendered, with scrolling facilities as needed<br>"minimal": a minimum number of choices should be rendered, with a facility to temporarily render additional choices</p></blockquote><p>Example:</p><div class="exampleOuter">
<div class="exampleHead">Selecting Ice Cream Flavor</div><div class="exampleInner"><pre><select ref="my:flavors">
<label>Flavors</label>
<choices>
<item>
<label>Vanilla</label>
<value>v</value>
</item>
<item>
<label>Strawberry</label>
<value>s</value>
</item>
<item>
<label>Chocolate</label>
<value>c</value>
</item>
</choices>
</select></pre></div><p>In the above example, more than one flavor can be selected.</p><p>A graphical browser might render form control <code>select</code> as any of the following:</p><table border="1" summary="Selection controls"><tbody><tr><th rowspan="1" colspan="1"> <code>appearance="full"</code> </th><th rowspan="1" colspan="1"> <code>appearance="compact"</code> </th><th rowspan="1" colspan="1"> <code>appearance="minimal"</code> </th></tr><tr><td rowspan="1" colspan="1"> <img src="images/ui-selectMany-checkbox.png" alt="Check boxes for three choices: Vanilla, Strawberry, and Chocolate. Strawberry and Chocolate are selected.">
</td><td rowspan="1" colspan="1"> <img src="images/ui-selectMany-listbox.png" alt="A list box with three choices: Vanilla, Strawberry, and Chocolate visible. Strawberry and Chocolate are selected.">
</td><td rowspan="1" colspan="1"> <img src="images/menu.png" alt="A popup menu with three choices: Strawberry, Vanilla, and Chocolate. Strawberry and Chocolate are selected.">
</td></tr></tbody></table></div></div><div class="div3">
<h4><a name="ui-selectOne" id="ui-selectOne"></a>8.1.11 The select1 Element</h4><p>Description: This form control allows the user to make a single selection from multiple choices.</p><p>Common Attributes: <a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#attrs-ui-common">UI Common</a>, <a title="" href="#structure-attrs-single-node">Single Node Binding</a></p><p>Special Attributes:</p><dl><dt class="label">selection</dt><dd><p>Author-optional attribute determining whether free entry is allowed in the list. Default is "closed".</p></dd><dt class="label">incremental</dt><dd><p>Author-optional. When <code>true</code>, this form control will generate additional <code>xforms-value-changed</code> events. The default for this form control is <code>true</code>.</p></dd></dl><p>Data Binding Restrictions: Binds to any simpleContent. The restriction to binding simpleContent exists when the choices are authored as part of the user interface control as shown in this section. Element <code>itemset</code> (described in <a href="#ui-selection-commonelems-itemset"><b>9.3.6 The itemset Element</b></a>) creates dynamic selection items and allows the available choices to be obtained from an XForms Model. When <code>itemset</code> uses the <code>value</code> element, the restriction to binding simpleContent remains in effect. However, the <code>itemset</code> also allows for the selection and deselection of subtrees of instance data using the <code>copy</code> element, and when using that construct, the data binding restriction to simpleContent is relaxed, but the form control must bind to an element with no mixed content.</p><div class="note"><p class="prefix"><b>Note:</b></p><p>Except in the case described above where the simpleContent data binding restriction is relaxed, this control cannot bind to element nodes that have element children. See <a href="#ui-processing"><b>8.1.1 Implementation Requirements Common to All Form Controls</b></a> for user interface processing rules common to all form controls.</p></div><p>Implementation Requirements: The label for each choice must be presented, and the control must allow at all times exactly one selection. When this form control uses the <code>value</code> element for selection, it stores the value corresponding to the selected choice in the location addressed by the binding attributes. The value to be stored is either directly specified as the contents of element <code>value</code>, or specified indirectly through binding attributes on element <code>value</code>. When this form control uses the <code>copy</code> element for selection, it stores a copy of the subtree corresponding to the selected choice in the location addressed by the binding attributes. </p><p>The datatype bound to this form control may include a non-enumerated value space, e.g., <code>xsd:string</code>, or a union of a enumeration and a non-enumerated datatype (called an open enumeration). In this case, control <code>select1</code> may have attribute <code>selection="open"</code>. The form control must then allow free-form data entry, as described in <a href="#ui-input"><b>8.1.2 The input Element</b></a>. </p><p><b>For closed selections:</b> If the instance data matches the storage data of one of the selection items, that item is selected. If there is no match, no items are initially selected. If there is no match and the storage data is non-empty, the form control must indicate an out-of-range condition. If the form control switches to or from being out-of-range, then <code>xforms-out-of-range</code> or <code>xforms-in-range</code> must be dispatched to the form control.</p><p><b>For open selections:</b> When using dynamic selections with the <code>itemset</code> and <code>copy</code> elements, open selection has no effect. If the instance data matches the storage value specified by one of the selection items, then the first such matching item is selected. Otherwise, no items are selected and the instance data value is retained, as if entered through free text entry. Free entry text is handled the same as form control <code>input</code> (<a href="#ui-input"><b>8.1.2 The input Element</b></a>).</p><p>For both closed and open selections, any selection item with a storage value which is empty or which contains only white space characters must remain deselected.</p><p>For both closed and open selections, the above rules describe which items are considered to be selected by the control. Items that are not selected are considered to be deselected. The <code>select1</code> form control changes the states of selected and deselected items on creation, refresh, and user selection or deselection of an item. A newly selected item receives the event <code>xforms-select</code> immediately after all other items receive the event <code>xforms-deselect</code>. The content of the instance node bound to the selection control must only be changed by the addition or deletion of storage data associated with items that have been selected or deselected. Content not associated with selection items is preserved. For selection controls that use the <code>value</code> element, the net effect of newly selected and deselected items is computed into a string, preserving content not associated with selection items, and the result is then committed to the bound instance node
by using the XForms Action <a href="#action-setvalue"><b>10.2 The setvalue Element</b></a>.
For selection controls that use the <code>copy</code> element, the individual subtrees associated with the newly selected and deselected items are added or removed individually by
using <a href="#action-insert"><b>10.3 The insert Element</b></a> and <a href="#action-delete"><b>10.4 The delete Element</b></a>.</p><p><b>Implementation Hints:</b> </p><p>
For closed selections, when the form control is created or refreshed to reflect bound instance data, behavior equivalent to the following steps occurs:
</p><ol class="enumar"><li><p>
The bound instance data is compared with the items' storage data (values or subtree copies).
</p></li><li><p>
If no item with storage data (value or subtree copy) in the bound instance data node is selected, then the first item with storage data
in the instance data content, if any, becomes selected. Otherwise, if an item with storage data in the bound instance data node is selected,
then the first selected item remains selected, and any other items with storage data matching the selected item are deselected.
</p></li><li><p>
If there is a selected item, then all items with storage data not equal to the selected item are deselected, and their representative
storage data is removed from the bound instance node content.
</p></li><li><p>
If no item has storage data in the bound instance data node content and the instance data node content is not empty,
then the form control indicates an out-of-range condition.
</p></li></ol><p>
When the user selects an item which was previously deselected, behavior equivalent to the following steps occurs:
</p><ol class="enumar"><li><p>
All selected items other than the newly selected item are deselected, if any, and the storage data of any
deselected items whose storage data does not match the newly selected item are removed from the bound instance node data.
</p></li><li><p>
The newly selected item becomes selected. If its storage data (value or subtree copy) is not present in the bound instance data,
then the item's storage data is inserted into the instance data. The exact location of the insertion is implementation-dependent, but
the newly inserted data is not accompanied by any other data unless the data does not match any items for the selection control.
</p></li></ol><p>
When the user deselects an item which was previously selected, behavior equivalent to the following steps occurs:
</p><ol class="enumar"><li><p>
The item is deselected and its storage data is removed from the bound instance node data.
</p></li><li><p>
If the bound instance data node is not empty, then the form control indicates an out-of-range condition.
</p></li></ol><p>
For open selections: when the form control is created or refreshed to reflect bound instance data, the behavior is the same as with closed
selection, except the form control never indicates an out-of-range condition.
</p><p>An accessibility aid might allow the user to browse through the available choices and leverage the grouping of choices in the markup to provide enhanced navigation through long lists of choices.</p><p> User interfaces may choose to render this form control as a pulldown list or group of radio buttons, among other options. The <code>appearance</code> attribute offers a hint as to which rendering might be most appropriate, although any styling information (such as CSS) should take precedence.</p><p>Example:</p><div class="exampleOuter">
<div class="exampleHead">Pick A Flavor</div><div class="exampleInner"><pre><select1 ref="my:flavor">
<label>Flavor</label>
<item>
<label>Vanilla</label>
<value>v</value>
</item>
<item>
<label>Strawberry</label>
<value>s</value>
</item>
<item>
<label>Chocolate</label>
<value>c</value>
</item>
</select1></pre></div><p> In the above example, selecting one of the choices will result in the associated value given by element <code>value</code> on the selected item being set in the underlying instance data at the location <code>icecream/flavor</code>. </p><p>A graphical browser might render this form control as any of the following:</p><table summary="Selection controls"><tbody><tr><th rowspan="1" colspan="1">appearance="full"</th><th rowspan="1" colspan="1">appearance="compact"</th><th rowspan="1" colspan="1">appearance="minimal"</th></tr><tr><td rowspan="1" colspan="1"> <img src="images/ui-selectOne-radio.png" alt="Radio buttons for three choices: Vanilla, Strawberry, Chocolate. Strawberry is selected.">
</td><td rowspan="1" colspan="1"> <img src="images/ui-selectOne-listbox.png" alt="A list boxwith three choices: Vanilla, Strawberry, and Chocolate visible. Strawberry is selected.">
</td><td rowspan="1" colspan="1"> <img src="images/ui-selectOne-pulldown.png" alt="A collapsible pull-down list with the three choices. The list is collapsd, and Vanilla is selected.">
</td></tr></tbody></table></div></div></div><div class="div2">
<h3><a name="ui-commonelems" id="ui-commonelems"></a>8.2 Common Support Elements</h3><p> The child elements detailed below provide the ability to attach metadata to many form controls and other elements.</p><ul><li><p>Factoring all human readable messages to a separate resource XML file.</p></li><li><p>Using URIs into this XML resource bundle within individual <code>label</code> elements</p></li><li><p>Finally, an XForms implementation could use content negotiation to obtain the appropriate XML resource bundle, e.g., based on the <code>accept-language</code> headers from the client, to serve up the user interface with messages localized to the client's locale.</p></li></ul><div class="div3">
<h4><a name="ui-commonelems-label" id="ui-commonelems-label"></a>8.2.1 The label Element</h4><p>This element provides a descriptive label for the containing form control.
The descriptive label can be presented visually and made available to accessibility software so the visually-impaired user can
obtain a short description of form controls while navigating among them.</p><p>Common Attributes: <a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#structure-attrs-single-node">Single Node Binding</a> (author-optional)</p><p>Special Attributes: None</p><p>The label specified can exist in instance data or as inline text. If more than one source of label is specified in this element, the order of precedence is: single node binding attributes, inline text.</p><p>An accessibility aid might speak the metadata encapsulated here when the containing form control gets focus.</p></div><div class="div3">
<h4><a name="ui-commonelems-help" id="ui-commonelems-help"></a>8.2.2 The help Element</h4><p> The author-optional element <code>help</code> provides a convenient way to attach help information to a form control. </p><p>Common Attributes: <a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#structure-attrs-single-node">Single Node Binding</a> (author-optional)</p><p>Special Attributes: None</p><p>The message specified can exist in instance data or as inline text. If more than one source of message is specified in this element, the order of precedence is: single node binding attributes, inline text.</p><p>An example of this element is at <a href="#action-message"><b>10.16 The message Element</b></a>.</p></div><div class="div3">
<h4><a name="ui-commonelems-hint" id="ui-commonelems-hint"></a>8.2.3 The hint Element</h4><p> The author-optional element <code>hint</code> provides a convenient way to attach hint information to a form control. </p><p>Common Attributes: <a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#structure-attrs-single-node">Single Node Binding</a> (author-optional)</p><p>Special Attributes: None</p><p>The message specified can exist in instance data or as inline text. If more than one source of message is specified in this element, the order of precedence is: single node binding attributes, inline text.</p><p>An example of this element is at <a href="#action-message"><b>10.16 The message Element</b></a>.</p></div><div class="div3">
<h4><a name="ui-commonelems-alert" id="ui-commonelems-alert"></a>8.2.4 The alert Element</h4><p> The author-optional element <code>alert</code> provides a convenient way to attach alert or error information to a form control. Rendering of this element is implementation-defined, and there is no default <code>level</code> such as <code>modal</code> or <code>ephemeral</code> for the displayed message.</p><p>Common Attributes: <a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#structure-attrs-single-node">Single Node Binding</a> (author-optional)</p><p>Special Attributes: None</p><p>The message specified can exist in instance data or as inline text. If more than one source of message is specified in this element, the order of precedence is: single node binding attributes, inline text. See <a href="#style"><b>G XForms and Styling</b></a> for examples to see how this might be presented to the user.</p></div></div><div class="div2">
<h3><a name="ui-selection-commonelems" id="ui-selection-commonelems"></a>8.3 Common Markup for Selection Controls</h3><div class="div3">
<h4><a name="ui-selection-commonelems-choices" id="ui-selection-commonelems-choices"></a>8.3.1 The choices Element</h4><p>This element is used within selection form controls to group available choices. This provides the same functionality as element <code>optgroup</code> in HTML.</p><p>Common Attributes: <a title="" href="#structure-attrs-common">Common</a></p></div><div class="div3">
<h4><a name="ui-selection-commonelems-item" id="ui-selection-commonelems-item"></a>8.3.2 The item Element</h4><p> This element specifies the storage value and label to represent an item in a list. It is found within elements <code>select1</code> and <code>select</code>, or grouped in element <code>choices</code>.</p><p>Common Attributes: <a title="" href="#structure-attrs-common">Common</a></p></div><div class="div3">
<h4><a name="ui-selection-commonelems-value" id="ui-selection-commonelems-value"></a>8.3.3 The value Element</h4><p>This element provides a storage value to be used when an <code>item</code> is selected.
The storage value is determined by one of three methods, in order of precedence:</p><ol class="enumar"><li><p>the value of a node indicated by a single node binding expression, if specified</p></li><li><p>the result of evaluating an XPath expression appearing in attribute <code>value</code>, if specified</p></li><li><p>the inline content of the <code>value</code> element (when neither the single node binding nor the <code>value</code> attribute are expressed).</p></li></ol><p>Common Attributes: <a title="" href="#structure-attrs-common">Common</a>,
<a title="" href="#structure-attrs-single-node">Single Node Binding</a> (author-optional)</p><p>Special Attributes:</p><dl><dt class="label">value</dt><dd><p>Author-optional. An XPath expression to be evaluated. The string result of the evaluation is used as the storage value of the
<code>item</code> when it is selected. If a single node binding is expressed, then this attribute has no effect.
The evaluation context is the same as would be applied to the evaluation of the single node binding.
An empty string is used if the XPath evaluation fails.</p></dd></dl><p>Data Binding Restriction: All lexical values must be valid according to the datatype bound to the selection control. If the single node binding attributes are used and indicate a node in a model other than the bound node of the containing selection control, then an <code>xforms-binding-exception</code> must occur.</p></div></div></div><div class="div1">
<h2><a name="ui" id="ui"></a>9 Container Form Controls</h2><p id="def-container-form-control">This chapter covers XForms view layer features for combining <a title="" href="#def-core-form-control">core form controls</a> into user interfaces using <a title="form control" href="#def-form-control">container form controls</a>. All core form controls defined in <a href="#controls"><b>8 Core Form Controls</b></a> are treated as individual units for purposes of visual layout e.g., in XHTML processing. A <b>container form control</b> is a form control that provides the ability to combine other form controls in its content into user interfaces. </p><p>Aggregation of form controls with markup defined in this chapter provides semantics about the relationship among user interface controls; such knowledge can be useful in delivering a coherent UI to small devices. For example, if the user interface needs to be split up over several screens, controls appearing inside the same aggregation would typically be rendered on the same screen or page.</p><div class="div2">
<h3><a name="ui-group-module" id="ui-group-module"></a>9.1 The XForms Group Module</h3><p>A <code>group</code> element is a <a title="" href="#def-container-form-control">container form control</a> that allows a form author to aggregate other form controls into a single, aggregate user interface component. The elements and attributes included in this module are:</p><table border="1" summary="listing of XForms Group element and its attribute and content model"><tbody><tr><th rowspan="1" colspan="1">Element</th><th rowspan="1" colspan="1">Attributes</th><th rowspan="1" colspan="1">Minimal Content Model</th></tr><tr><td rowspan="1" colspan="1"><a title="" href="#ui-group">group</a></td><td rowspan="1" colspan="1"><a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#attrs-ui-common">UI Common</a>, <a title="" href="#structure-attrs-single-node">Single Node Binding</a> (author-optional)</td><td rowspan="1" colspan="1">label?, ((<a title="" href="#elems-form-controls">Core Form Controls</a>)|group|switch|repeat|<a title="" href="#elems-ui-common">UI Common</a>)*</td></tr></tbody></table><div class="div3">
<h4><a name="ui-group" id="ui-group"></a>9.1.1 The group Element</h4><p>The <code>group</code> element is used as a container for defining a hierarchy of form controls. Groups can be nested to create complex hierarchies.
The author-optional <code>label</code> element has special significance when it appears as the first element child of <code>group</code>, representing a label for the entire group.</p><p>Common Attributes: <a title="" href="#structure-attrs-common">Common</a>,
<a title="" href="#attrs-ui-common">UI Common</a>,
<a title="" href="#structure-attrs-single-node">Single Node Binding</a> (author-optional)</p><p>Although a <code>group</code> element receives events associated with model item properties of a bound node, such as <code>xforms-readonly</code> and <code>xforms-invalid</code>,
no special behavior is imparted by the <code>group</code> onto the content elements in the group as a direct result of any model item property. The model item property <code>relevant</code>
of a bound data node can indirectly affect the content of the group via its contribution to deciding whether the <code>group</code> is relevant or non-relevant.
A group is considered to be non-relevant if and only if:</p><ul><li><p>the Single Node Binding is expressed and resolves to empty nodeset,</p></li><li><p>the Single Node Binding is expressed and resolves to a non-relevant instance node,</p></li><li><p>the <code>group</code> is contained by a non-relevant <code>switch</code> or <code>group</code> (which includes a non-relevant <code>repeat</code> object), or</p></li><li><p>the <code>group</code> is contained by a non-selected <code>case</code> element of a <code>switch</code>.</p></li></ul><p>All content elements (e.g. core form controls, groups, switches, repeats and host language content) within a non-relevant group
are handled as non-relevant. When a <code>group</code> becomes non-relevant, it must receive event <code>xforms-disabled</code> and then the
XForms action handlers that are listening for events on the non-relevant <code>group</code> must be disabled. When a non-relevant <code>group</code>
changes to being relevant, the XForms action handlers that listen for events on the <code>group</code> must become enabled and then the <code>group</code>
must receive the event <code>xforms-enabled</code>.</p><div class="note"><p class="prefix"><b>Note:</b></p><p>If a group is non-relevant, then the rendering approach used to signify non-relevance is applied
to the entire content of the group.</p></div><p>Example:</p><div class="exampleOuter">
<div class="exampleHead">Grouping Related Controls</div><div class="exampleInner"><pre><group ref="address">
<label>Shipping Address</label>
<input ref="line_1">
<label>Address line 1</label>
</input>
<input ref="line_2">
<label>Address line 2</label>
</input>
<input ref="postcode">
<label>Postcode</label>
</input>
</group></pre></div></div><p>Setting the input focus on a group results in the focus being set to the first form control in the navigation order within that group.</p></div></div><div class="div2">
<h3><a name="ui-switch-module" id="ui-switch-module"></a>9.2 The XForms Switch Module</h3><p>A <code>switch</code> element is a <a title="" href="#def-container-form-control">container form control</a> that allows the creation of user interfaces where the user interface can be varied based on user actions and events. The elements and attributes included in this module are:</p><table border="1" summary="listing of XForms Switch elements, attributes, and content models"><tbody><tr><th rowspan="1" colspan="1">Element</th><th rowspan="1" colspan="1">Attributes</th><th rowspan="1" colspan="1">Minimal Content Model</th></tr><tr><td rowspan="1" colspan="1"><a title="" href="#ui-switch">switch</a></td><td rowspan="1" colspan="1"> <a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#attrs-ui-common">UI Common</a>, <a title="" href="#structure-attrs-single-node">Single Node Binding</a> (author-optional)</td><td rowspan="1" colspan="1">case+</td></tr><tr><td rowspan="1" colspan="1"><a title="" href="#ui-case">case</a></td><td rowspan="1" colspan="1"><a title="" href="#structure-attrs-common">Common</a>, selected (xsd:boolean)</td><td rowspan="1" colspan="1">label?, ((<a title="" href="#elems-form-controls">Core Form Controls</a>)|group|switch|repeat|<a title="" href="#action-content-set">Action</a>)*</td></tr><tr><td rowspan="1" colspan="1"><a title="" href="#action-toggle">toggle</a></td><td rowspan="1" colspan="1"><a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#action-xmlevents">Events</a>, <a title="" href="#attrs-action-common">Action Common</a>, case (xsd:IDREF)</td><td rowspan="1" colspan="1">case?</td></tr></tbody></table><div class="div3">
<h4><a name="ui-switch" id="ui-switch"></a>9.2.1 The switch Element</h4><p> This element contains one or more <code>case</code> elements, any one of which is rendered at a given time.</p><div class="note"><p class="prefix"><b>Note:</b></p><p>This is separate from XForms <code>relevant</code> processing (see <a href="#model-prop-relevant"><b>6.1.4 The relevant Property</b></a>), which is based on the current state of the XForms Model. As an example, portions of a questionnaire pertaining to the user's automobile may become relevant only if the user has answered in the affirmative to the question 'Do you own a car?'.</p></div><p>Common Attributes: <a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#attrs-ui-common">UI Common</a>, <a title="" href="#structure-attrs-single-node">Single Node Binding</a> (author-optional)</p><p>Although a <code>switch</code> element receives events associated with model item properties of a bound node, such as <code>xforms-readonly</code> and <code>xforms-invalid</code>,
no special behavior is imparted by the <code>switch</code> onto the content elements in the selected <code>case</code> as a direct result of any model item property. The model item property <code>relevant</code>
of a bound data node can indirectly affect the content of the selected <code>case</code> via its contribution to deciding whether the <code>switch</code> is relevant or non-relevant.
The non-relevance of a switch is determined in the same way as it is for <code>group</code> and similarly applies to the entire content. Also, as with <code>group</code>, when a <code>switch</code> becomes non-relevant,
it must receive event <code>xforms-disabled</code> and then the
XForms action handlers that are listening for events on the non-relevant <code>switch</code> must be disabled.
As well, when a non-relevant <code>switch</code> changes to being relevant, the XForms action handlers that listen
for events on the <code>switch</code> must become enabled and then the <code>switch</code> must receive the event
<code>xforms-enabled</code>.</p><p>Example:</p><div class="exampleOuter">
<div class="exampleHead">switch</div><div class="exampleInner"><pre><switch>
<case id="in" selected="true">
<input ref="yourname">
<label>Please tell me your name</label>
<toggle ev:event="DOMActivate" case="out"/>
</input>
</case>
<case id="out" selected="false">
<html:p>Hello <output ref="yourname" />
<trigger id="editButton">
<label>Edit</label>
<toggle ev:event="DOMActivate" case="in"/>
</trigger>
</html:p>
</case>
</switch></pre></div></div><p>The above results in the portion of the user interface contained in the first <code>case</code> being displayed initially. This prompts for the user's name; filling in a value and <em>activating</em> the control e.g., by pressing <code>enter</code> results switches to the alternate case, with a read-only <code>output</code> rendering. Activating the trigger labeled "Edit" in turn switches back to the original case.</p></div><div class="div3">
<h4><a name="ui-case" id="ui-case"></a>9.2.2 The case Element</h4><p>This element encloses markup to be conditionally rendered. The content elements (e.g. form controls,
groups, switches, repeats and host language elements) within a non-selected <code>case</code> behave as if they were in
a non-relevant <code>group</code> (see <a href="#ui-group"><b>9.1.1 The group Element</b></a>). Similarly, content elements in a <code>case</code> that becomes
selected behave as if they were in a <code>group</code> that has become relevant.
The attribute <code>selected</code> determines the initial selected state.</p><p>Common Attributes: <a title="" href="#structure-attrs-common">Common</a></p><p>Special Attributes:</p><dl><dt class="label">selected</dt><dd><p>Author-optional selection status for the case. The default value is <code>"false"</code>.</p></dd></dl><p>If multiple <code>case</code>s within a <code>switch</code> are marked as <code>selected="true"</code>, the first selected <code>case</code> remains and all others are deselected. If none are selected, the first becomes selected.</p></div></div><div class="div2">
<h3><a name="ui-repeat-module" id="ui-repeat-module"></a>9.3 The XForms Repeat Module</h3><p> The XForms specification allows the definition of repeating structures such as multiple items within a purchase order. When defining the XForms Model, such higher-level collections are constructed out of basic building blocks; similarly, this section defines a <a title="" href="#def-container-form-control">container form control</a> called <code>repeat</code> that can bind to data structures such as lists and collections and provide a user interface for each node of the list or collection.. The elements and attributes included in this module are:</p><table border="1" summary="listing of XForms Repeat elements, attributes, and content models"><tbody><tr><th rowspan="1" colspan="1">Element</th><th rowspan="1" colspan="1">Attributes</th><th rowspan="1" colspan="1">Minimal Content Model</th></tr><tr><td rowspan="1" colspan="1"><a title="" href="#ui-repeat">repeat</a></td><td rowspan="1" colspan="1"><a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#attrs-ui-common">UI Common</a>, <a title="" href="#structure-attrs-nodeset">Node Set Binding</a>, startindex (xsd:positiveInteger), number (xsd:nonNegativeInteger)</td><td rowspan="1" colspan="1">((<a title="" href="#elems-form-controls">Core Form Controls</a>)|group|switch|repeat|<a title="" href="#action-content-set">Action</a>)*</td></tr><tr><td rowspan="1" colspan="1"> <a title="" href="#action-setindex">setindex</a> </td><td rowspan="1" colspan="1"><a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#action-xmlevents">Events</a>, <a title="" href="#attrs-action-common">Action Common</a>, repeat (xsd:IDREF), index (number XPath Expression)</td><td rowspan="1" colspan="1">EMPTY</td></tr><tr><td rowspan="1" colspan="1"><a title="" href="#ui-selection-commonelems-itemset">itemset</a></td><td rowspan="1" colspan="1"><a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#structure-attrs-nodeset">Node Set Binding</a></td><td rowspan="1" colspan="1">label, (value|copy), (<a title="" href="#elems-ui-common">UI Common</a>)*</td></tr><tr><td rowspan="1" colspan="1"><a title="" href="#ui-selection-commonelems-copy">copy</a></td><td rowspan="1" colspan="1"><a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#structure-attrs-single-node">Single Node Binding</a> (author-optional)</td><td rowspan="1" colspan="1">EMPTY</td></tr><tr><td rowspan="1" colspan="1">(various)</td><td rowspan="1" colspan="1">[repeat-nodeset, repeat-bind, repeat-model] (Node Set Binding attributes), repeat-startindex (xsd:positiveInteger), repeat-number (xsd:nonNegativeInteger)</td><td rowspan="1" colspan="1">N/A</td></tr></tbody></table><div class="div3">
<h4><a name="ui-repeat" id="ui-repeat"></a>9.3.1 The repeat Element</h4><p id="defn-repeat-collection">This element defines a UI mapping over a node-set selected by Node Set Binding Attributes. This node-set is called a <b>repeat collection</b>. </p><p>For example:</p><div class="exampleOuter">
<div class="exampleHead">Shopping Cart</div><div class="exampleInner"><pre><repeat nodeset="/cart/items/item">
<input ref="." ...>
<label>...</label>
</input>
<html:br/>
</repeat></pre></div></div><p> Common Attributes: <a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#attrs-ui-common">UI Common</a>, <a title="" href="#structure-attrs-nodeset">Node Set Binding</a></p><p>Special Attributes:</p><dl><dt class="label">startindex</dt><dd><p>Author-optional 1-based initial value of the repeat index. The default value is 1.</p></dd><dt class="label">number</dt><dd><p>Author-optional hint to the XForms Processor as to how many elements from the collection to display. </p></dd></dl><p>This element operates over a <a title="" href="#defn-repeat-collection">repeat collection</a> by binding the encapsulated user interface controls to each element of the collection. If an element of the collection is non-relevant, then the rendering approach used to signify non-relevance is applied to the associated user interface controls. Attributes on this element specify how many members of the collection are presented to the user at any given time. XForms Actions <code>insert</code>, <code>delete</code>, and <code>setindex</code> can be used to operate on the collection—see <a href="#action"><b>10 XForms Actions</b></a>. Another way to view repeat processing (disregarding special user interface interactions) is to consider "unrolling" the repeat. The above example is similar to the following (given four <code>item</code> elements in the returned node-set):</p><div class="exampleOuter">
<div class="exampleHead">Repeat Unrolled</div><div class="exampleInner"><pre><!-- unrolled repeat -->
<input ref="/cart/items/item[1]"><label>...</label></input><html:br/>
<input ref="/cart/items/item[2]"><label>...</label></input><html:br/>
<input ref="/cart/items/item[3]"><label>...</label></input><html:br/>
<input ref="/cart/items/item[4]"><label>...</label></input><html:br/></pre></div></div><div class="exampleOuter">
<div class="exampleHead">Repeat Collection</div><div class="exampleInner"><pre><model>
<instance>
<my:lines>
<my:line name="a">
<my:price>3.00</my:price>
</my:line>
<my:line name="b">
<my:price>32.25</my:price>
</my:line>
<my:line name="c">
<my:price>132.99</my:price>
</my:line>
</my:lines>
</instance>
</model>
...
<repeat id="lineset" nodeset="/my:lines/my:line">
<input ref="my:price">
<label>Line Item</label>
</input>
<input ref="@name">
<label>Name</label>
</input>
</repeat>
<trigger>
<label>Insert a new item after the current one</label>
<action ev:event="DOMActivate">
<insert nodeset="/my:lines/my:line" at="index('lineset')"
position="after"/>
<setvalue ref="/my:lines/my:line[index('lineset')]/@name"/>
<setvalue ref="/my:lines/my:line[index('lineset')]/price">0.00</setvalue>
</action>
</trigger>
<trigger>
<label>remove current item</label>
<delete ev:event="DOMActivate" nodeset="/my:lines/my:line"
at="index('lineset')"/>
</trigger></pre></div></div></div><div class="div3">
<h4><a name="ui-nested-repeats" id="ui-nested-repeats"></a>9.3.2 Nested Repeats</h4><p> The form controls appearing inside <code>repeat</code> need to be suitable for populating individual items of the collection. A simple but powerful consequence of the above is that if the XForms Model specifies nested collections, then a corresponding user interface can nest <code>repeat</code> elements. </p><p> It is possible to nest repeat elements to create more powerful user interface for editing structured data. <a href="#bookmarks-in-x-smiles"><b>H.2 Editing Hierarchical Bookmarks Using XForms</b></a> is an example of a form using nested repeats to edit hierarchical data consisting of bookmarks within multiple sections. Consider the following <code>insert</code> statement that appears as part of that example. </p><div class="exampleOuter">
<div class="exampleHead">Repeat Index and Nested Repeats</div><div class="exampleInner"><pre><xforms:insert nodeset="/bookmarks/section[index('repeatSections')]/bookmark"
at="index('repeatBookmarks')"
position="after"/></pre></div></div><p> The above <code>insert</code> statement is used in that example to add new bookmark entries into the <em>currently selected</em> section. The inner (nested) repeat operates on bookmarks in this selected section; The index—as returned by XForms function <code>index</code>—for this inner repeat starts at <code>1</code>. Hence, after a new empty section of bookmarks is created and becomes <em>current</em>, the first <em>insert bookmark</em> operation adds the newly created bookmark at the front of the list.</p></div><div class="div3">
<h4><a name="ui-repeat-processing" id="ui-repeat-processing"></a>9.3.3 Repeat Processing</h4><p> The markup contained within the body of element <code>repeat</code> specifies the user interface to be generated for each <a title="" href="#def-repeat-item">repeat item</a> of the underlying repeat collection. During user interface initialization (see <a href="#evt-modelConstructDone"><b>4.2.2 The xforms-model-construct-done Event</b></a>), the following steps are performed for <code>repeat</code>:</p><ol class="enumar"><li><p>The Node Set Binding is evaluated to locate the <a title="" href="#defn-repeat-collection">repeat collection</a> to be operated on by this <code>repeat</code>.</p></li><li><p> The <em>index</em> for this repeating structure is initialized to the value of <code>startindex</code>. If the initial <code>startindex</code> is less than 1 it defaults to 1. If the index is greater than the initial node-set then it defaults to the size of the node-set.</p></li><li><p> User interface as specified by the <code>repeat</code> is generated for the requisite number of members of the collection as specified by attributes on element <code>repeat</code>. </p></li></ol><p id="def-repeat-item">For each node of the repeat collection, a <b>repeat item</b> is defined to be the aggregation of the node, its position, the size of the repeat collection, and a <a title="" href="#def-repeat-object">repeat object</a>.</p><p id="def-repeat-object">A <b>repeat object</b> is an implicitly generated <code>group</code> element that contains the set of run-time objects generated to represent the repeat template content for a single repeat item of the <a title="" href="#defn-repeat-collection">repeat collection</a>. These run-time objects are form controls, XForms actions and other host language elements that correspond to elements in the repeat template. </p><div class="note"><p class="prefix"><b>Note:</b></p><p>The capture and bubble phases of events dispatched to the run-time objects behave as if the
repeat object were a child of element <code>repeat</code>. The repeat template content, including
action handlers, is made unavailable to the host language processor. Copies of the repeat template content,
including Action handlers, are made available via the repeat objects.</p></div><div class="exampleOuter">
<div class="exampleHead">Example: Handling an Event Dispatched to a <code>repeat</code> Element</div><div class="exampleInner"><pre><repeat id="X" ... >
...
</repeat>
<action ev:event="xforms-scroll-first" ev:target="X" ev:observer="X">
...
</action></pre></div></div><p>A new repeat item is created dynamically at any time in the lifecycle of the form (i.e. any time after <code>xforms-model-construct-done</code>) whenever a new node is added to the <a title="" href="#defn-repeat-collection">repeat collection</a>. There are many ways to add new nodes to a <a title="" href="#defn-repeat-collection">repeat collection</a>, including but not limited to the following: </p><ul><li><p>An <code>insert</code> action can add one or more nodes that match the repeat nodeset;</p></li><li><p>The new instance data subtree created by a <code>submission</code> instance replacement may contain nodes that match the repeat nodeset;</p></li><li><p>A <code>setvalue</code> action or a <code>calculate</code> may change a value that causes one or more nodes to match the repeat nodeset.</p></li></ul><p>Any time a new repeat item is created, XML Event handlers declared within the corresponding repeat object are initialized, and the user interface form controls generated for the repeat object are initialized in the same manner as the user interface initialization that is performed during default processing of <code>xforms-model-construct-done</code>. For example, if the repeat object contains an inner <code>repeat</code> run-time object, then it is initialized according to the list of steps at the beginning of this section (<a href="#ui-repeat-processing"><b>9.3.3 Repeat Processing</b></a>).</p><p> The processing model for repeating structures includes an <em>index</em> that points to the <em>current</em> repeat item in the <a title="" href="#defn-repeat-collection">repeat collection</a> . This repeat index is accessed via XForms function <code>index</code> (<a href="#fn-index"><b>7.7.5 The index() Function</b></a>) and manipulated via XForms Action <code>setindex</code> (<a href="#action-setindex"><b>10.5 The setindex Element</b></a>). This index can be used as a reference point for <code>insert</code> and <code>delete</code> actions. Notice that the contained XForms form controls inside element <code>repeat</code> do not explicitly specify the index of the collection entry being populated. This is intentional; it keeps both authoring as well as the processing model simple.</p><p>If one or more nodes have been added to the repeat collection by an <code>insert</code> action, then the repeat items corresponding to the new nodes must be created and initialized, and the repeat index must be updated to indicate the repeat item corresponding to the last node added by the <code>insert</code>. </p><div class="note"><p class="prefix"><b>Note:</b></p><p>The change of index on a <code>repeat</code> does not cause the index of any <code>repeat</code> nested within it to be re-initialized.</p></div><p>The repeat item generation and repeat index update on insertion must behave as if it occurs in response to the <code>xforms-insert</code> event dispatched by the <code>insert</code> action. The index update must behave as if it occurs when the <code>xforms-insert</code> event reaches the parent of the target <code>instance</code> element in the capture phase.</p><div class="note"><p class="prefix"><b>Note:</b></p><p>An event handler that listens for <code>xforms-insert</code> on <code>instance</code> in the default phase has access to the updated index value via function <code>index()</code>. </p></div><p>A repeat item can also be destroyed dynamically at any time in the lifecycle of the form whenever a node is removed from the <a title="" href="#defn-repeat-collection">repeat collection</a>. When a repeat item is destroyed, the repeat object and all of its inner form controls are eliminated, including inner repeats, switches and groups, and all XML Event handlers created by the repeat object are eliminated. There are many ways to remove repeat items from a <a title="" href="#defn-repeat-collection">repeat collection</a>, including but not limited to the following: </p><ul><li><p>A <code>delete</code> action can remove nodes that matched the repeat nodeset;</p></li><li><p>The new instance data subtree created by a <code>submission</code> instance replacement may replace nodes that matched the repeat nodeset;</p></li><li><p>A <code>setvalue</code> action or a <code>calculate</code> may change a value that causes one or more nodes to stop matching the repeat nodeset.</p></li></ul><p>If one or more nodes have been removed from the repeat collection by a <code>delete</code> action, then the repeat items corresponding to the deleted nodes must be destroyed and the repeat index must be updated based on the rules below. </p><ol class="enumar"><li><p>
If, prior to node deletion, the repeat index indicated a repeat that is still contained in the repeat collection
after node deletion, then the index is adjusted, if necessary, to indicate that same repeat item.
</p></li><li><p>
Otherwise, if all repeat items in the collection have been destroyed, the repeat index is set to 0
.
</p></li><li><p>
Otherwise, if the repeat index was pointing to one of the deleted repeat items, and if the new size of the
collection is smaller than the index, the index is changed to the new size of the collection.
</p></li><li><p>
Otherwise, if the repeat index was pointing to one of the deleted repeat items, and if the new size of the
collection is equal to or greater than the index, the index is not changed.
</p></li></ol><div class="note"><p class="prefix"><b>Note:</b></p><p>The change of index on a <code>repeat</code> does not cause the index of any <code>repeat</code> nested within it to be re-initialized.</p></div><p>The repeat index update on deletion behaves as if it occurs in response to the <code>xforms-delete</code> event dispatched by the <code>delete</code> action. Specifically, the index update behaves as if it occurs when the <code>xforms-delete</code> event reaches the parent of the target <code>instance</code> element in the capture phase.</p></div><div class="div3">
<h4><a name="ui-repeat-ui" id="ui-repeat-ui"></a>9.3.4 User Interface Interaction</h4><p> Element <code>repeat</code> enables the binding of user interaction to a node-set, referred to as <a title="" href="#defn-repeat-collection">repeat collection</a>. The number of displayed items might be less than the total number available in the collection. In this case, the presentation would render only a portion of the repeating items at a given time. For example, a graphical user interface might present a scrolling table. The current item indicated by the repeat index should be made available to the user at all times, for example, not allowed to scroll out of view. The XForms Actions enumerated at <a href="#action"><b>10 XForms Actions</b></a> may be used within event listeners to manipulate the <a title="" href="#defn-repeat-collection">repeat collection</a> being populated by scrolling, inserting, and deleting entries. </p><p>Notice that the markup encapsulated by element <code>repeat</code> acts as the template for the user interface that is presented to the user. As a consequence, statically authored <code>IDREF</code> attributes must be interpreted based on a combination of repeat indexes and where the IDREF attributes appear relative to the element bearing the matching ID. Based on the IDREF resolution rules given in <a href="#idref-resolve"><b>4.7 Resolving ID References in XForms</b></a>, it is possible to toggle the <code>case</code> of a <code>switch</code> even when it is within one or more <code>repeat</code> elements. Similarly, it is possible to set the focus to controls and dispatch events to elements that are within one or more <code>repeat</code> elements.</p><p>If the focus is transferred to a form control within a <code>repeat</code> by any means, such as by an XForms action or by user interaction, the index of the <code>repeat</code> is updated to indicate the item of the <a title="" href="#defn-repeat-collection">repeat collection</a> that contains the control. If the repeat item containing the focused control contains any inner repeat objects, their indexes are not changed. However, the repeat index update is recursive for all outer repeats that contain the focused control; the index of each outer containing <code>repeat</code> is adjusted appropriately. These changes of repeat index occurs as if by invoking the <code>setindex</code> action.</p></div><div class="div3">
<h4><a name="ui.repeat.via.attrs" id="ui.repeat.via.attrs"></a>9.3.5 Creating Repeating Structures Via Attributes</h4><p> Element <code>repeat</code> enables the creation of user interfaces for populating repeating structures. When using XForms within host languages like XHTML, it is often necessary to create repeating structures within constructs such as <code>table</code>. Thus, one might wish to use element <code>repeat</code> within a <code>table</code> to create the rows of a table, where each row of the table binds to a distinct member of a <a title="" href="#defn-repeat-collection">repeat collection</a>. Since <code>html:table</code> doesn't (and perhaps never will) allow <code>xforms:repeat</code> elements as children, another syntax is needed.</p><div class="exampleOuter">
<div class="exampleHead">Tables And Repeating Structures</div><div class="exampleInner"><pre><table>
<repeat nodeset="...">
<tr>
<td>...</td>
...
</tr>
</repeat>
</table></pre></div></div><p>More generally, there is a need to integrate repeat behavior into host languages at points where the content model of the host language does not or cannot provide the appropriate extension hooks via modularization. To accommodate this, XForms defines an alternative syntax that is functionally equivalent to the <code>repeat</code> element, using the following attributes: </p><blockquote><p> <code>repeat-model</code> <br> <code>repeat-bind</code> <br> <code>repeat-nodeset</code> <br> <code>repeat-startindex</code> <br> <code>repeat-number </code> </p></blockquote><p> The above attributes are equivalent to the <code>repeat</code> attributes of the same name, but without the prefix <code>repeat-</code>. A host language can include these attributes in the appropriate places to enable repeating constructs. For example, a version of XHTML might use:</p><div class="exampleOuter">
<div class="exampleHead">Tables And Repeating Structures</div><div class="exampleInner"><pre><html:table xforms:repeat-nodeset="...">
<html:tr>
<html:td><xforms:output ref="..."/></html:td>
</html:tr>
</html:table></pre></div><p>Which could be validated against an appropriately configured XHTML Schema that includes the XForms Repeat module. Note that what gets repeated is the child elements of the element with the <code>repeat-</code> attributes.</p></div><p>Additionally, when using XForms Action <code>setindex</code>, attribute <code>repeat</code> of type <code>idref</code> can point to any element carrying the repeat attributes. Similarly, when using function <code>index</code> against a repeating structure created via the <code>repeat-</code>attributes, the <code>id</code> of that element can be used as the argument to function <code>index</code>.</p></div><div class="div3">
<h4><a name="ui-selection-commonelems-itemset" id="ui-selection-commonelems-itemset"></a>9.3.6 The itemset Element</h4><p>This element allows the creation of dynamic selections within controls <code>select</code> and <code>select1</code>, where the available choices are determined at run-time. The node-set that holds the available choices is specified via the Node Set Binding. Child elements <code>label</code> and <code>value</code> indirectly specify the label and storage values. Notice that the run-time effect of <code>itemset</code> is the same as using element <code>choices</code> with child <code>item</code> elements to statically author the available choices.</p><p>For each node of the Node Set Binding, an associated <code>item</code> element is created. XForms Actions appearing in the content of an <code>itemset</code> are created within each <code>item</code> element, and the in-scope evaluation context for these XForms Actions is based on the node for which the <code>item</code> was generated as described in Section <a href="#expr-eval"><b>7.2 Evaluation Context</b></a>. </p><div class="note"><p class="prefix"><b>Note:</b></p><p>As with the <code>repeat</code> element, the <code>itemset</code> template content, including XForms Actions, is made unavailable. Copies of the <code>itemset</code> template content, including XForms Actions, are made available via repeated <code>item</code> objects. </p></div><p>Common Attributes: <a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#structure-attrs-nodeset">Node Set Binding</a></p><div class="note"><p class="prefix"><b>Note:</b></p><p>Whenever a <code>refresh</code> event is dispatched the <code>nodeset</code> is re-evaluated to update the list of available choices.</p></div><p> The following example shows element <code>itemset</code> within control <code>select</code> to specify a dynamic list of ice cream flavors:</p><div class="exampleOuter">
<div class="exampleHead">Dynamic Choice Of Ice Cream Flavors</div><div class="exampleInner"><pre><model id="cone">
<instance>
<my:icecream>
<my:order/>
</my:icecream>
</instance>
</model>
<model id="flavors">
<instance>
<my:flavors>
<my:flavor type="v">
<my:description>Vanilla</my:description>
</my:flavor>
<my:flavor type="s">
<my:description>Strawberry</my:description>
</my:flavor>
<my:flavor type="c">
<my:description>Chocolate</my:description>
</my:flavor>
</my:flavors>
</instance>
</model>
<!-- user interaction markup -->
<select model="cone" ref="my:order">
<label>Flavors</label>
<itemset model="flavors" nodeset="/my:flavors/my:flavor">
<label ref="my:description"/>
<copy ref="my:description"/>
</itemset>
</select>
<!-- For all three items selected, this example produces instance data like
<my:icecream>
<my:order>
<my:description>Vanilla</my:description>
<my:description>Strawberry</my:description>
<my:description>Chocolate</my:description>
</my:order>
</my:icecream>
--></pre></div></div></div><div class="div3">
<h4><a name="ui-selection-commonelems-copy" id="ui-selection-commonelems-copy"></a>9.3.7 The copy Element</h4><p>Structurally, this element is similar to <a href="#ui-selection-commonelems-value"><b>8.3.3 The value Element</b></a>. It differs in that it can only be used within <code>itemset</code>, and that it works with subtrees of instance data rather than simple values. </p><p>Common Attributes: <a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#structure-attrs-single-node">Single Node Binding</a> (author-optional)</p><p>If the single node binding attributes indicate a node in a model other than the bound node of the containing selection control, then an <code>xforms-binding-exception</code> must occur.. When a <code>copy</code> item is selected, the following rules apply:</p><ul><li><p>The target node, selected by the binding attributes on the list form control, must be an element node, otherwise an exception results (<a href="#evt-bindingException"><b>4.5.1 The xforms-binding-exception Event</b></a>).</p></li><li><p>The element node associated with the <code>item</code>, selected by the binding attributes on <code>copy</code>, is deep copied as a child of the target node by using an <code>insert</code> action (<a href="#action-insert"><b>10.3 The insert Element</b></a>).</p></li><li><p>A full computational dependency rebuild is done, followed by recalculate, revalidate, and refresh.</p></li></ul><p>When a <code>copy</code> item is deselected, the following rules apply:</p><ul><li><p>The target node, selected by the binding attributes on the list form control, must be an element node, otherwise an exception results (<a href="#evt-bindingException"><b>4.5.1 The xforms-binding-exception Event</b></a>).</p></li><li><p>The child element node associated with the <code>item</code>, selected by the binding attributes on <code>copy</code>, is deleted by using a <code>delete</code> action (<a href="#action-delete"><b>10.4 The delete Element</b></a>).</p></li><li><p>A full computational dependency rebuild, followed by recalculate, revalidate, and refresh.</p></li></ul><div class="note"><p class="prefix"><b>Note:</b></p><p>If the target node of the <code>select</code> or <code>select1</code> is readonly, then the insertion or deletion associated with the copy operation is not performed.</p></div></div></div></div><div class="div1">
<h2><a name="action" id="action"></a>10 XForms Actions</h2><p>This chapter defines the controller layer of XForms, an XML Events-based <a href="#ref-xml-events">[XML Events]</a> common set of actions that can be invoked in response to events. </p><div class="note"><p class="prefix"><b>Note:</b></p><p>XForms itself defines no method for script-based event handling. The definition of such facilities is a responsibility of the hosting language.</p></div><p> All form controls as well as other elements defined in this specification have a set of common <em>behaviors</em> that encourage consistent authoring and look and feel for XForms-based applications. This consistency comes from attaching a common set of behaviors to the various form controls. In conjunction with the event binding mechanism provided by XML Events, these handlers provide a flexible means for forms authors to specify event processing at appropriate points within the XForms user interface. XForms Actions are declarative XML event handlers that capture high-level semantics. As a consequence, they significantly enhance the accessibility of XForms-based applications in comparison to previous Web technologies that relied exclusively on scripting.</p><p>The elements and attributes included in this module are:</p><table border="1" summary="listing of XForms action elements, attributes, and content models"><tbody><tr><th rowspan="1" colspan="1">Element</th><th rowspan="1" colspan="1">Attributes</th><th rowspan="1" colspan="1">Minimal Content Model</th></tr><tr><td rowspan="1" colspan="1"><a title="" href="#action-action">action</a></td><td rowspan="1" colspan="1"><a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#action-xmlevents">Events</a>, <a title="" href="#attrs-action-common">Action Common</a> </td><td rowspan="1" colspan="1">(<a title="" href="#action-content-set">Action</a>)*</td></tr><tr><td rowspan="1" colspan="1"><a title="" href="#action-setvalue">setvalue</a></td><td rowspan="1" colspan="1"><a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#action-xmlevents">Events</a>, <a title="" href="#attrs-action-common">Action Common</a>, <a title="" href="#structure-attrs-single-node">Single Node Binding</a>, value (string XPath Expression) </td><td rowspan="1" colspan="1">PCDATA</td></tr><tr><td rowspan="1" colspan="1"><a title="" href="#action-insert">insert</a></td><td rowspan="1" colspan="1"><a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#action-xmlevents">Events</a>, <a title="" href="#attrs-action-common">Action Common</a>, <a title="" href="#structure-attrs-nodeset">Node Set Binding</a>, context (node XPath Expresson), at (number XPath Expression), position ("before"|"after"), origin (nodeset XPath Expresson) </td><td rowspan="1" colspan="1">EMPTY</td></tr><tr><td rowspan="1" colspan="1"><a title="" href="#action-delete">delete</a></td><td rowspan="1" colspan="1"><a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#action-xmlevents">Events</a>, <a title="" href="#attrs-action-common">Action Common</a>, <a title="" href="#structure-attrs-nodeset">Node Set Binding</a>, context (node XPath Expresson), at (number XPath Expression)</td><td rowspan="1" colspan="1">EMPTY</td></tr><tr><td rowspan="1" colspan="1"> <a title="" href="#action-setindex">setindex</a> </td><td rowspan="1" colspan="1"><a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#action-xmlevents">Events</a>, <a title="" href="#attrs-action-common">Action Common</a>, repeat (xsd:IDREF), index (number XPath Expression)</td><td rowspan="1" colspan="1">EMPTY</td></tr><tr><td rowspan="1" colspan="1"><a title="" href="#action-toggle">toggle</a></td><td rowspan="1" colspan="1"><a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#action-xmlevents">Events</a>, <a title="" href="#attrs-action-common">Action Common</a>, case (xsd:IDREF)</td><td rowspan="1" colspan="1">case?</td></tr><tr><td rowspan="1" colspan="1"><a title="" href="#action-setfocus">setfocus</a></td><td rowspan="1" colspan="1"><a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#action-xmlevents">Events</a>, <a title="" href="#attrs-action-common">Action Common</a>, control (xsd:IDREF) </td><td rowspan="1" colspan="1">control?</td></tr><tr><td rowspan="1" colspan="1"><a title="" href="#action-dispatch">dispatch</a></td><td rowspan="1" colspan="1"><a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#action-xmlevents">Events</a>, <a title="" href="#attrs-action-common">Action Common</a>, name (xsd:NMTOKEN),
targetid (xsd:IDREF), delay (xsd:nonNegativeInteger), bubbles (xsd:boolean), cancelable (xsd:boolean) </td><td rowspan="1" colspan="1">name?, targetid?, delay? [in any order]</td></tr><tr><td rowspan="1" colspan="1"><a title="" href="#action-rebuild">rebuild</a></td><td rowspan="1" colspan="1"><a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#action-xmlevents">Events</a>, <a title="" href="#attrs-action-common">Action Common</a>, model (xsd:IDREF) </td><td rowspan="1" colspan="1">EMPTY</td></tr><tr><td rowspan="1" colspan="1"><a title="" href="#action-recalculate">recalculate</a></td><td rowspan="1" colspan="1"><a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#action-xmlevents">Events</a>, <a title="" href="#attrs-action-common">Action Common</a>, model (xsd:IDREF) </td><td rowspan="1" colspan="1">EMPTY</td></tr><tr><td rowspan="1" colspan="1"><a title="" href="#action-revalidate">revalidate</a></td><td rowspan="1" colspan="1"><a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#action-xmlevents">Events</a>, <a title="" href="#attrs-action-common">Action Common</a>, model (xsd:IDREF) </td><td rowspan="1" colspan="1">EMPTY</td></tr><tr><td rowspan="1" colspan="1"><a title="" href="#action-refresh">refresh</a></td><td rowspan="1" colspan="1"><a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#action-xmlevents">Events</a>, <a title="" href="#attrs-action-common">Action Common</a>, model (xsd:IDREF) </td><td rowspan="1" colspan="1">EMPTY</td></tr><tr><td rowspan="1" colspan="1"><a title="" href="#action-reset">reset</a></td><td rowspan="1" colspan="1"><a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#action-xmlevents">Events</a>, <a title="" href="#attrs-action-common">Action Common</a>, model (xsd:IDREF) </td><td rowspan="1" colspan="1">EMPTY</td></tr><tr><td rowspan="1" colspan="1"><a title="" href="#action-load">load</a></td><td rowspan="1" colspan="1"><a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#action-xmlevents">Events</a>, <a title="" href="#attrs-action-common">Action Common</a>, <a title="" href="#structure-attrs-single-node">Single Node Binding</a> (author-optional), resource (xsd:anyURI), show ("new" | "replace") </td><td rowspan="1" colspan="1">resource?</td></tr><tr><td rowspan="1" colspan="1"><a title="" href="#action-send">send</a></td><td rowspan="1" colspan="1"><a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#action-xmlevents">Events</a>, <a title="" href="#attrs-action-common">Action Common</a>, submission (xsd:IDREF) </td><td rowspan="1" colspan="1">EMPTY</td></tr><tr><td rowspan="1" colspan="1"><a title="" href="#action-message">message</a></td><td rowspan="1" colspan="1"><a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#action-xmlevents">Events</a>, <a title="" href="#attrs-action-common">Action Common</a>, <a title="" href="#structure-attrs-single-node">Single Node Binding</a> (author-optional), level ("ephemeral" | "modeless" | "modal"|<a title="QNameButNotNCName" href="#def-QNameButNotNCName">QNameButNotNCName</a>) </td><td rowspan="1" colspan="1">(PCDATA|<a title="" href="#elems-inline">UI Inline</a>)*</td></tr></tbody></table><p id="action-content-set">This module also defines the content set <b>"Action"</b>, which includes the following elements:</p><div class="exampleInner"><pre>(action|setvalue|insert|delete|setindex|toggle|setfocus|dispatch|rebuild|recalculate|revalidate|refresh|reset|
load||send|message)*</pre></div><p>The following group of attributes, here called <b>Action Common</b>, are available to all <a title="" href="#action-content-set">Action</a> elements:</p><table id="attrs-action-common" border="1" summary="listing of XForms Common Action attributes"><tbody><tr><th rowspan="1" colspan="1">Element</th><th rowspan="1" colspan="1">Attributes</th></tr><tr><td rowspan="1" colspan="1"><a title="" href="#action-content-set">Action</a></td><td rowspan="1" colspan="1">if (boolean XPath Expression), while (boolean XPath Expression)</td></tr></tbody></table><dl><dt class="label">if</dt><dd><p>Author-optional attribute defined in Section <a href="#action-conditional"><b>10.17 Conditional Execution of XForms Actions</b></a>.</p></dd><dt class="label">while</dt><dd><p>Author-optional attribute defined in Section <a href="#action-iterated"><b>10.18 Iteration of XForms Actions</b></a>.</p></dd></dl><p id="action-xmlevents">Additionally, this module defines the attribute group <b>"XML Events"</b>, which includes all of the "global" attributes defined in the <a href="#ref-xml-events">[XML Events]</a> specification.</p><p>The following example shows how events can be used:</p><div class="exampleOuter">
<div class="exampleHead">Action Syntax</div><div class="exampleInner"><pre><xforms:trigger>
<xforms:label>Reset</xforms:label>
<xforms:reset ev:event="DOMActivate" model="thismodel"/>
</xforms:trigger></pre></div></div><p>This example recreates the behavior of the HTML <em>reset</em> control, which this specification does not define as an independent form control.</p><p> For each built-in XForms Action, this chapter lists the following:</p><blockquote><p>Name<br>Common Attributes<br>Special Attributes<br>Description of behavior</p></blockquote><p>All elements defined in this chapter explicitly allow global attributes from the XML Events namespace, and apply the processing defined in that specification in section 2.3 <a href="#ref-xml-events">[XML Events]</a>.</p><p id="action-outermost-action">An <b>outermost action handler</b> is an action that is activated when the XForms processor is not executing any other action handlers.</p><p id="action-inner-action">An <b>inner action handler</b> is an action that is activated when the XForms processor is executing the declared actions of an <a title="" href="#action-outermost-action">outermost action handler</a>. An inner action handler may be within the content of the outermost action handler, or it may be executed as the response to an event dispatched while performing all of the actions initiated by the <a title="" href="#action-outermost-action">outermost action handler</a>.</p><p id="action-deferred-updates"><b>Deferred Updates</b>: Sequences of one or more XForms Actions have a deferred effect on XForms model and user interface processing. Implementations are free to use any strategy to accomplish deferred updates, but the end result must be as follows: Instance data changes performed by a set of actions do not result in immediate computation dependency rebuilding, recalculation, revalidate and form control refreshing until the termination of the <a title="" href="#action-outermost-action">outermost action handler</a>, as described here. Each XForms model can be thought of as having a set of deferred update Boolean flags, initially <code>false</code> at the start of an <a title="" href="#action-outermost-action">outermost action handler</a>, to indicate whether each of the actions <code>rebuild</code>, <code>recalculate</code>, <code>revalidate</code>, and <code>refresh</code> are required for that model upon termination of the <a title="" href="#action-outermost-action">outermost action handler</a>. </p><p>By default, the behavior of an action handler is performed one time when the action is encountered in the execution sequence. However, execution of an action handler may be conditional or iterated, as described in <a href="#action-conditional"><b>10.17 Conditional Execution of XForms Actions</b></a> and <a href="#action-iterated"><b>10.18 Iteration of XForms Actions</b></a>.</p><p>Execution of an <a title="" href="#action-outermost-action">outermost action handler</a> begins by setting the XForms processor into the state of executing an <a title="" href="#action-outermost-action">outermost action handler</a>. The <a title="" href="#action-outermost-action">outermost action handler</a> is then performed, which may include the execution of <a title="" href="#action-inner-action">inner action handlers</a>. Finally, the XForms processor is set into the state of not executing an <a title="" href="#action-outermost-action">outermost action handler</a> and then the deferred update is performed for each model. </p><p id="action-deferred-update-behavior">The <b>deferred update behavior</b> for a model consists of examining each deferred update Boolean flag in the order of <code>rebuild</code>, <code>recalculate</code>, <code>revalidate</code>, and <code>refresh</code>, and for each <code>true</code> flag, set the flag to <code>false</code> and then dispatch the proper event to the model for that deferred update flag (i.e. dispatch <code>xforms-rebuild</code> for a true <code>rebuild</code> flag, <code>xforms-recalculate</code> for a true <code>recalculate</code> flag, <code>xforms-revalidate</code> for a true <code>revalidate</code> flag, and <code>xforms-refresh</code> for a true <code>refresh</code> flag).</p><div class="note"><p class="prefix"><b>Note:</b></p><p>The XForms processor is not considered to be executing an <a title="" href="#action-outermost-action">outermost action handler</a> at the time that it performs deferred update behavior for XForms models. Therefore, event handlers for events dispatched to the user interface during the deferred refresh behavior are considered to be new <a title="" href="#action-outermost-action">outermost action handler</a>.</p></div><p>Actions that manipulate properties of the XForms view layer begin by invoking the <a title="" href="#action-deferred-update-behavior">deferred update behavior</a> so that the model and all data are up to date prior to performing the action. The XForms Actions in this category are:</p><blockquote><p><code>setfocus</code><br><code>toggle</code><br><code>setindex</code></p></blockquote><p>Actions that directly invoke rebuild, recalculate, revalidate, or refresh always have an immediate effect, and clear the corresponding deferred update flag. The XForms Actions in this category are:</p><blockquote><p><code>rebuild</code><br><code>recalculate</code><br><code>revalidate</code><br><code>refresh</code></p></blockquote><p>Similarly, if the default processing of any of the events <code>xforms-rebuild</code>, <code>xforms-recalculate</code>, <code>xforms-revalidate</code>, or <code>xforms-refresh</code> are performed, then the corresponding deferred update flag is cleared. The XForms Actions that can dispatch these events are: </p><blockquote><p><code>reset</code><br><code>dispatch</code></p></blockquote><p>XForms Actions that change the tree structure of instance data result in setting all four deferred update flags to <code>true</code> for the model over which they operate. The XForms Actions in this category are:</p><blockquote><p><code>insert</code><br><code>delete</code></p></blockquote><p>XForms Actions that change only the value of an instance node results in setting the deferred update flags for <code>recalculate</code>, <code>revalidate</code>, and <code>refresh</code> to <code>true</code> and making no change to the deferred update flag for <code>rebuild</code> for the model over which they operate. The XForms Actions in this category are:</p><blockquote><p>setvalue<br>setindex</p></blockquote><p>Finally, the XForms <code>submission</code> process can affect deferred update behavior. See Section <a href="#submit-evt-submit"><b>11.2 The xforms-submit Event</b></a> for details. XForms actions that are capable of initiating an XForms submission are:</p><blockquote><p>send<br>dispatch</p></blockquote><div class="div2">
<h3><a name="action-action" id="action-action"></a>10.1 The action Element</h3><p>This action causes its child actions to be invoked in the order that they are specified in the document.</p><p>Common Attributes: <a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#action-xmlevents">Events</a>, <a title="" href="#attrs-action-common">Action Common</a></p><div class="exampleOuter">
<div class="exampleHead">Grouping Actions</div><div class="exampleInner"><pre><trigger>
<label>Click me</label>
<action ev:event="DOMActivate">
<reset model="thismodel"/>
<setvalue ref="."/>
</action>
</trigger></pre></div></div></div><div class="div2">
<h3><a name="action-setvalue" id="action-setvalue"></a>10.2 The setvalue Element</h3><p>This action explicitly sets the value of the specified instance data node.
This action has no effect if the Single Node Binding does not select an instance data node or if a readonly instance data node is selected.
An <code>xforms-binding-exception</code> occurs if the Single Node Binding indicates a node
whose content is not simpleContent (i.e., a node that has element children).
</p><p>Common Attributes: <a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#action-xmlevents">Events</a>, <a title="" href="#attrs-action-common">Action Common</a>, <a title="" href="#structure-attrs-single-node">Single Node Binding</a></p><p>Special Attributes:</p><dl><dt class="label">value</dt><dd><p>Author-optional attribute containing an XPath expression to evaluate, with the result stored in the selected instance data node. The evaluation context for this XPath expression is the result from the Single Node Binding.
To obtain the value, the result of the expression is processed as if by call to the XPath <code>string</code> function.
An empty string is used if the XPath evaluation fails.</p></dd></dl><p>The element content of <code>setvalue</code> specifies the literal value to set; this is an alternative to specifying a computed value via attribute <code>value</code>. If neither a <code>value</code> attribute nor text content are present, the effect is to set the value of the selected node to the empty string (""). If both are present, the <code>value</code> attribute is used. The following examples contrast these approaches:</p><div class="exampleOuter">
<div class="exampleHead">setvalue with Expression</div><div class="exampleInner"><pre><setvalue bind="put-here" value="a/b/c"/></pre></div><p>This causes the string value at <code>a/b/c</code> in the instance data to be placed on the single node selected by the bind element with <code>id="put-here"</code>.</p></div><div class="exampleOuter">
<div class="exampleHead">setvalue with Literal</div><div class="exampleInner"><pre><setvalue bind="put-here">literal string</setvalue></pre></div><p>This causes the value "literal string" to be placed on the single node selected by the bind element with <code>id="put-here"</code>.</p></div><div class="note"><p class="prefix"><b>Note:</b></p><p>See Section <a href="#fn-context"><b>7.10.4 The context() Function</b></a> for an example in which the <code>context()</code> function is used to
provide the same initial evaluation context node to both the <code>ref</code> and <code>value</code> attributes.
See Appendix <a href="#data-mutation-patterns"><b>B Patterns for Data Mutations</b></a> for numerous further usage patterns for
<code>sevalue</code>, <code>insert</code> and <code>delete</code>.</p></div><p>All strings are inserted into the instance data as follows:</p><ul><li><p>Element nodes: If element child nodes are present, then an <code>xforms-binding-exception</code> occurs.
Otherwise, regardless of how many child nodes the element has, the result is that the string becomes the new content of the element.
In accord with the data model of <a href="#ref-xpath-1.0">[XPath 1.0]</a>, the element will have either a single non-empty text node child, or no children
string was empty. </p></li><li><p>Attribute nodes: The string-value of the attribute is replaced with a string corresponding to the new value.</p></li><li><p>Text nodes: The text node is replaced with a new one corresponding to the new value, or the text node is eliminated if the new value is the empty string.</p></li><li><p>Namespace, processing instruction, and comment nodes: behavior is undefined (implementation-dependent).</p></li><li><p>the XPath root node: an <code>xforms-binding-exception</code> occurs.</p></li></ul><div class="note"><p class="prefix"><b>Note:</b></p><p> This action affects <a title="" href="#action-deferred-updates">deferred updates</a> by setting the deferred update flags for recalculate, revalidate and refresh.</p></div></div><div class="div2">
<h3><a name="action-insert" id="action-insert"></a>10.3 The <code>insert</code> Element</h3><p>
The <code>insert</code> action is used to create one or more nodes of instance data by cloning one or more existing
instance nodes. Attributes of the <code>insert</code> action specify the node or nodes to be cloned and the
location within instance data where the clones will appear. The clones are deep copies of the original nodes
except the contents of nodes of type <code>xsd:ID</code> are modified to remain as unique values in the
instance data after the clones are inserted.
</p><p>Common Attributes: <a title="" href="#structure-attrs-common">Common</a>,
<a title="" href="#action-xmlevents">Events</a>,
<a title="" href="#attrs-action-common">Action Common</a>,
<a title="" href="#structure-attrs-nodeset">Node Set Binding</a> (author-optional)</p><p>Special Attributes:</p><dl><dt class="label">context</dt><dd><p>
Author-optional attribute containing an XPath expression evaluated using the in-scope evaluation context.
If the <code>model</code> attribute is present, then it is processed as described in <a href="#expr-eval"><b>7.2 Evaluation Context</b></a> before evaluating this attribute.
The Node Set Binding is required unless this attribute is present.
The result of the XPath expression is used to override the in-scope evaluation context.
If the result is an empty nodeset or not a nodeset, then the insert action is terminated with no
effect. Otherwise, the first node of the nodeset is used as the new in-scope evaluation context
node, and the context position and size are set to 1. By adjusting the in-scope evaluation context,
this attribute affects the subsequent evaluation of
many other attributes that can appear on <code>insert</code>,
including <code>if</code>, <code>while</code>, <code>nodeset</code> and <code>origin</code>.
</p></dd><dt class="label">origin</dt><dd><p>
Author-optional attribute containing an XPath expression evaluated using the in-scope evaluation context
, which may have been amended by the <code>context</code> attribute.
The <code>origin node-set</code> is the set of one or more nodes to be cloned by the
<code>insert</code> action. If this attribute is present and resolves to a non-empty nodeset, then the
result overrides the default setting of the <code>origin node-set</code> as described below in the
processing of the <code>insert</code> action.
</p></dd><dt class="label">at</dt><dd><p>
Author-optional attribute containing an XPath expression evaluated using the
Node Set Binding node-set to help determine the <code>insert location node</code>.
This attribute is ignored if the Node Set Binding is not specified or specifies an empty node-set.
The <code>insert location node</code> is a node within the Node Set Binding node-set that is used
to help determine where in the instance to insert each node cloned by the <code>insert</code>. If this
attribute is present, then its result is used to override the default setting of the <code>insert
location node</code> as described below in the processing of the <code>insert</code> action.
</p></dd><dt class="label">position</dt><dd><p>
Author-optional selector that indicates where to put the cloned node or nodes relative to the <code>insert
location node</code>. Valid values are <code>before</code> and <code>after</code>, and the latter
is the default. This attribute is ignored if the Node Set Binding node-set is not specified or
empty. If the node at the <code>insert location node</code> within the Node Set Binding node-set is
the document element of an instance, then this attribute is ignored.
</p></dd></dl><p>
Processing for the <code>insert</code> action is as follows:
</p><ol class="enumar"><li><p>
The <code>insert context</code> is determined.
If the <code>context</code> attribute is not given, the <code>insert context</code> is the in-scope evaluation
context. Otherwise, the XPath expression provided by the <code>context</code> attribute is evaluated
using the in-scope evaluation context, and the first node rule is applied to obtain the <code>insert
context</code>. The <code>insert</code> action is terminated with no effect if the <code>insert
context</code> is the empty node-set.
</p></li><li><p>
The Node Set Binding node-set is determined. If a <code>bind</code> attribute is present, it directly
determines the Node Set Binding node-set. If a <code>nodeset</code> attribute is present, it is evaluated
within the <code>insert context</code> to determine the Node Set Binding node-set. If the Node Set
Binding attributes are not present, then the Node Set Binding node-set is the empty node-set. The
<code>insert</code> action is terminated with no effect if any of the following conditions is true:
</p><ol class="enumla"><li><p>
The <code>context</code> attribute is not given and the Node Set Binding node-set is the empty
node-set.
</p></li><li><p>
The <code>context</code> attribute is given, the <code>insert context</code> does not evaluate
to an element node and the Node Set Binding node-set is the empty node-set.
</p></li></ol></li><li><p>
The <code>origin node-set</code> is determined. If the <code>origin</code> attribute is not given and the
Node Set Binding node-set is empty, then the <code>origin node-set</code> is the empty node-set.
Otherwise, if the <code>origin</code> attribute is not given, then the <code>origin node-set</code>
consists of the last node of the Node Set Binding node-set. If the <code>origin</code> attribute is
given, the <code>origin node-set</code> is the result of the evaluation of the <code>origin</code>
attribute in the <code>insert context</code>.
Namespace nodes and root nodes (parents of document elements) are
removed from the <code>origin node-set</code>.
The <code>insert</code> action is terminated with no effect if the <code>origin node-set</code> is the empty node-set.
</p></li><li><p>
The <code>insert location node</code> is determined. If the Node Set Binding node-set is not specified
or empty, the <code>insert location node</code> is the <code>insert context</code> node. Otherwise, if
the <code>at</code> attribute is not given, then the <code>insert location node</code> is the last node
of the Node Set Binding node-set. Otherwise, an <code>insert location node</code> is determined from the
<code>at</code> attribute as follows:
</p><ol class="enumla"><li><p>
The evaluation context node is the first node in document order from the Node Set Binding
node-set, the context size is the size of the Node Set Binding node-set, and the context
position is <code>1</code>.
</p></li><li><p>
The return value is processed according to the rules of the XPath function
<code>round()</code>. For example, the literal <code>1.5</code> becomes <code>2</code>, and
the literal <code>'string'</code> becomes <code>NaN</code>.
</p></li><li><p>
If the result is in the range 1 to the Node Set Binding node-set size, then the <code>insert
location</code> is equal to the result. If the result is non-positive, then the <code>insert
location</code> is <code>1</code>. Otherwise, the result is <code>NaN</code> or exceeds the
Node Set Binding node-set size, so the <code>insert location</code> is the Node Set Binding
node-set size.
</p></li><li><p>
The <code>insert location node</code> is the node in the Node Set Binding node-set at the
position given by the <code>insert location</code>.
</p></li></ol></li><li><p>The <code>insert</code> action is terminated with no effect if the insertion will create
nodes whose parent is readonly. This occurs if the <code>insert location node</code> is readonly
and the Node Set Binding node-set is not specified or empty, or otherwise if the parent of the
<code>insert location node</code> is readonly.</p></li><li><p>
Each node in the <code>origin node-set</code> is cloned in the order it appears in the <code>origin node-set</code>.
</p></li><li><p>
The <code>target location</code> of each of the cloned nodes is determined as follows:
</p><ol class="enumla"><li><p>
If the Node Set Binding node-set is not specified or empty, then the <code>insert location node</code> provided
by the <code>context</code> attribute is intended to be the parent of the cloned node.
The <code>target location</code> is dependent on the types of the cloned node and the
<code>insert location node</code> as follows:</p><ul><li><p>If the <code>insert location node</code> is not an element node or root node, then it cannot be the
parent of the cloned node, so the <code>target location</code> is undefined.</p></li><li><p>If the <code>insert location node</code> is the root node of an instance (which is the parent of the
root element), and the cloned node is an element, then the <code>target location</code> is the root element of
the instance.</p></li><li><p>If the <code>insert location node</code> is the root node of an instance (which is the parent of
the root element), and the cloned node is not an element, then the <code>target location</code> is before the
first child of the <code>insert location node</code>.</p></li><li><p>If the <code>insert location node</code> is an element, and the cloned node is an attribute, then
the <code>target location</code> is the attribute list of the <code>insert location node</code>.</p></li><li><p>If the <code>insert location node</code> is an element, and the cloned node is not an attribute, then
the <code>target location</code> is before the first child of the <code>insert location node</code>, or the
child list of the <code>insert location node</code> if it is empty.</p></li></ul></li><li><p>
Otherwise, the Node Set Binding node-set is specified and non-empty, so the <code>insert location node</code>
provided by the Node Set Binding and author-optional <code>at</code> attribute is intended to be the sibling of the cloned node.
If the <code>insert location node</code> is an attribute or root node, then the <code>target location</code> is undefined.
If the <code>insert location node</code> is not an attribute or root node, then the <code>target location</code> is
immediately before or after the <code>insert location node</code>, based on the <code>position</code> attribute setting or its default.
</p></li></ol></li><li><p>
The cloned node or nodes are inserted in the order they were cloned into their <code>target locations</code>
depending on their node type.
If the parent node of the target location is the instance root node (which is the parent of
the root document element of the instance), and if the cloned node is an element, then the instance root element
is deleted before the cloned node is inserted at the target location.
If the cloned node is a duplicate of another attribute in its parent element, then either
the duplicate attribute is first removed or the existing attribute value is updated.
If a cloned node cannot be placed at the <code>target location</code> due to a node type conflict
or because the <code>target location</code> is undefined, then the insertion for that particular cloned node is ignored.
Each cloned node that is inserted is added to the <code>inserted-nodes</code>
list that will be provided in the <code>xforms-insert</code> event context information. For each cloned node
used to update an existing attribute node, the existing attribute node is added to the list of
<code>inserted-nodes</code>.
</p><div class="note"><p class="prefix"><b>Note:</b></p><p>A node type conflict is a mismatch between the XPath node type and the <code>target location</code>.
For example, an attribute cannot be inserted as a sibling before or after an element. </p></div></li><li><p>If the list of <code>inserted-nodes</code> is empty, then the <code>insert</code> action
is terminated with no effect.</p></li><li><p>The XForms action system's deferred update flags for rebuild, recalculate, revalidate and refresh are set.</p></li><li><p>
The <code>insert</code> action is successfully completed by dispatching the <code>xforms-insert</code>
event with appropriate context information.
</p><div class="note"><p class="prefix"><b>Note:</b></p><p>A <code>repeat</code> updates its index in response to this event if its repeat collection changes size as a result of the insertion.
See Section <a href="#ui-repeat-processing"><b>9.3.3 Repeat Processing</b></a> for details.</p></div></li></ol><div class="note"><p class="prefix"><b>Note:</b></p><p> This action affects <a title="" href="#action-deferred-updates">deferred updates</a> by setting the deferred update flags for rebuild, recalculate, revalidate and refresh.</p></div><p>Examples:</p><div class="exampleOuter">
<div class="exampleHead">Inserting into a <code>repeat</code>, whether or not it is empty</div><p>When the <code>repeat</code> is empty, the <code>at</code> index is zero so a new <code>item</code> is prepended to the child elements of <code>purchaseOrder</code>.
When the <code>repeat</code> is non-empty, the new <code>item</code> is added after the node currently indexed by repeat <code>R</code>.</p><div class="exampleInner"><pre>
...
<xforms:instance>
<purchaseOrder xmlns="">
<subtotal/>
<tax/>
<total/>
</purchaseOrder>
</xforms:instance>
<xforms:instance id="prototypes">
<prototypes xmlns="">
...
<item>
<product/>
<quantity/>
<unitcost/>
<price/>
</item>
...
</prototypes>
</xforms:instance>
...
<repeat nodeset="/purchaseOrder/item" id="R">
...
</repeat>
...
<xforms:trigger>
<xforms:label>Add to purchase order</xforms:label>
<xforms:action ev:event="DOMActivate>
<xforms:insert context="/purchaseOrder" nodeset="item" at="index('R')" origin="instance('prototypes')/item"/>
<xforms:setfocus control="R"/>
</xforms:action>
</xforms:trigger>
</pre></div></div><div class="exampleOuter">
<div class="exampleHead">Insert and Read-Only Content</div><div class="exampleInner"><pre><model xmlns:my="http://example.org">
<instance>
<my:data>
<my:name>
<my:first-name>John</my:first-name>
<my:last-name>Doe</my:last-name>
</my:name>
<my:address>
<my:street>123 Main St.</my:street>
<my:city>Smallville</my:city>
</my:address>
</my:data>
</instance>
<bind nodeset="/my:data/my:name/" readonly="true()"/>
<bind nodeset="/my:data/my:address/my:street" readonly="true()"/>
<action ev:event="xforms-model-construct-done">
<insert id="I1" nodeset="my:name/*" ... />
<insert id="I2" nodeset="my:address/my:street" at="1" >
</action>
</model>
</pre></div><p>Insert I1 fails because it attempts to insert into the content of a readonly node (<code>my:name</code>).
Insert I2 succeeds even though the insert location is a readonly node because the new node is placed as a sibling into the content of the parent, which is not readonly.</p></div><p>See <a href="#action-delete"><b>10.4 The delete Element</b></a> for an example that uses <code>insert</code> and <code>delete</code> to make a <code>repeat</code> that always shows at least one repeat item. See Appendix <a href="#data-mutation-patterns"><b>B Patterns for Data Mutations</b></a> for numerous further usage patterns for <code>sevalue</code>, <code>insert</code> and <code>delete</code>.</p></div><div class="div2">
<h3><a name="action-delete" id="action-delete"></a>10.4 The <code>delete</code> Element</h3><p>This action deletes one or more nodes from instance data.</p><p>Common Attributes: <a title="" href="#structure-attrs-common">Common</a>,
<a title="" href="#action-xmlevents">Events</a>,
<a title="" href="#attrs-action-common">Action Common</a>,
<a title="" href="#structure-attrs-nodeset">Node Set Binding</a></p><p>Special Attributes:</p><dl><dt class="label">context</dt><dd><p>
Author-optional attribute containing an XPath expression evaluated using the in-scope evaluation context.
If the <code>model</code> attribute is present, then it is processed as described in <a href="#expr-eval"><b>7.2 Evaluation Context</b></a> before evaluating this attribute.
The Node Set Binding is required unless this attribute is present.
The result of the XPath expression is used to override the in-scope evaluation context. If the result is an empty nodeset or not a nodeset,
then the <code>delete</code> action is terminated with no effect. Otherwise, the first node of the
nodeset is used as the new in-scope evaluation context node, and the context position and size are
set to 1. By adjusting the in-scope evaluation context, this attribute affects the evaluation of
subsequent attributes that may appear on <code>delete</code>, including <code>if</code>,
<code>while</code>, and <code>nodeset</code>.
</p></dd><dt class="label">at</dt><dd><p>
Author-optional attribute containing an XPath expression evaluated using the Node Set Binding node-set to
determine the <code>delete location</code>. If the Node Set Binding node-set is empty, then this
attribute is ignored.
</p></dd></dl><p>
Processing for the <code>delete</code> action is as follows:
</p><ol class="enumar"><li><p>
The <code>delete context</code> is determined. It is set to the in-scope evaluation context, possibly
overridden by the <code>context</code> attribute if that attribute is present. The <code>delete</code>
action is terminated with no effect if the <code>delete context</code> is the empty node-set.
</p></li><li><p>
The Node Set Binding node-set is determined. If a <code>bind</code> attribute is present, it directly
determines the Node Set Binding node-set. If a <code>nodeset</code> attribute is present, it is evaluated
within the <code>delete context</code> to determine the Node Set Binding node-set.
The behavior of the <code>delete</code> action is undefined if the Node Set Binding
node-set contains nodes from more than one <code>instance</code>.
The <code>delete</code> action is terminated with no effect if the Node Set Binding
is expressed and the Node Set Binding node-set is the empty node-set.
Otherwise, the Node Set Binding is not expressed, so the Node Set Binding node-set
is set equal to the delete context node with a position and size of 1.
</p></li><li><p>
The <code>delete location</code> is determined. If the <code>at</code> attribute is not specified, there
is no <code>delete location</code>. Otherwise, the <code>delete location</code> is determined by
evaluating the XPath expression specified by the <code>at</code> attribute as follows:
</p><ol class="enumla"><li><p>
The evaluation context node is the first node in document order from the Node Set Binding
node-set, the context size is the size of the Node Set Binding node-set, and the context
position is <code>1</code>.
</p></li><li><p>
The return value is processed according to the rules of the XPath function
<code>round()</code>. For example, the literal <code>1.5</code> becomes <code>2</code>, and the
literal <code>'string'</code> becomes <code>NaN</code>.
</p></li><li><p>
If the result is in the range 1 to the Node Set Binding node-set size, then the <code>delete
location</code> is equal to the result. If the result is non-positive, then the <code>delete
location</code> is <code>1</code>. Otherwise, if the result is <code>NaN</code> or exceeds the
Node Set Binding node-set size, the <code>delete location</code> is the Node Set Binding
node-set size.
</p></li></ol></li><li><p>
If there is no <code>delete location</code>, each node in the Node Set Binding node-set is deleted,
except if the node is a readonly node, a namespace node, a root node, or
the root document element of an instance, then that particular node is not deleted.
Otherwise, if there is a <code>delete location</code>, the node at the <code>delete location</code>
in the Node Set Binding node-set is deleted, except if the node is the root document element of an instance
or has a readonly parent node, then that node is not deleted.
The delete action is terminated with no effect if no node is deleted.
</p></li><li><p>
The XForms action system's deferred update flags for rebuild, recalculate, revalidate and refresh are
set.
</p></li><li><p>
The <code>delete</code> action is successfully completed by dispatching the <code>xforms-delete</code>
event with appropriate context information.
</p></li></ol><div class="note"><p class="prefix"><b>Note:</b></p><p> This action affects <a title="" href="#action-deferred-updates">deferred updates</a> by setting the deferred update flags for rebuild, recalculate, revalidate and refresh.</p></div><p>Examples: </p><div class="exampleOuter">
<div class="exampleHead">Using <code>delete</code> and <code>insert</code> to Maintain a Non-empty repeat <code>repeat</code></div><p>In this example, the <code>trigger</code> is not in the <code>repeat</code>. When it is activated, the indexed <code>item</code> in the repeat is first deleted.
Next, if that was the last <code>item</code>, then a new prototypical <code>item</code> is inserted so that the <code>repeat</code> does not become empty.
The focus is then sent back to the <code>repeat</code> from the <code>trigger</code>.</p><div class="exampleInner"><pre>
...
<xforms:trigger>
<xforms:label>Delete from purchase order</xforms:label>
<xforms:action ev:event="DOMActivate">
<xforms:delete context="/purchaseOrder" nodeset="item" at="index('R')"/>
<xforms:insert context="/purchaseOrder" if="not(item)"
nodeset="item" origin="instance('prototypes')/item"/>
<xforms:setfocus control="R"/>
</xforms:action>
</xforms:trigger>
</pre></div><div class="note"><p class="prefix"><b>Note:</b></p><p>The form author could have written <code>nodeset="/purchaseOrder/item"</code> in
the <code>delete</code> action, but the <code>context</code> attribute was added for consistency
with the <code>insert</code> action.</p></div></div><div class="exampleOuter">
<div class="exampleHead">Delete and Read-Only Content</div><div class="exampleInner"><pre><model xmlns:my="http://example.org">
<instance>
<my:data>
<my:name>
<my:first-name>John</my:first-name>
<my:last-name>Doe</my:last-name>
</my:name>
<my:address>
<my:street>123 Main St.</my:street>
<my:city>Smallville</my:city>
</my:address>
</my:data>
</instance>
<bind nodeset="/my:data/my:name/" readonly="true()"/>
<bind nodeset="/my:data/my:address/my:street" readonly="true()"/>
<action ev:event="xforms-model-construct-done">
<delete id="D1" nodeset="my:name/*" ... />
<delete id="D2" nodeset="my:address/my:street" at="1" >
<delete id="D3" nodeset="my:address" at="1" >
</action>
</model>
</pre></div><p>Delete D1 fails because it attempts to delete from the content of a readonly node (<code>my:name</code>).
Delete D2 succeeds even though the node to delete is readonly because the node is not being changed, but rather removed from the content of the parent, which is not readonly.
Delete D3 succeeds even though it contains a readonly node because a node can be deleted if its parent is not readonly, and node deletion includes deletion of its attributes and content, regardless of whether or not the attributes or content nodes are readonly.</p></div><p>See Appendix <a href="#data-mutation-patterns"><b>B Patterns for Data Mutations</b></a> for numerous further usage patterns for <code>sevalue</code>, <code>insert</code> and <code>delete</code>.</p></div><div class="div2">
<h3><a name="action-setindex" id="action-setindex"></a>10.5 The setindex Element</h3><p>
This XForms Action begins by invoking the <a title="" href="#action-deferred-update-behavior">deferred update behavior</a>.
This action then marks a specific item as current in a repeating sequence (within <a href="#ui-repeat"><b>9.3.1 The repeat Element</b></a>).</p><p>Common Attributes: <a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#action-xmlevents">Events</a>, <a title="" href="#attrs-action-common">Action Common</a>
</p><p>Special Attributes:</p><dl><dt class="label">repeat</dt><dd><p>Required reference to a repeating element.</p></dd><dt class="label">index</dt><dd><p>Required XPath expression that evaluates to a 1-based offset into the sequence.
The evaluation context is determined in the same manner as
the evaluation context for a Single-Node Binding
(see <a href="#expr-eval"><b>7.2 Evaluation Context</b></a>).</p></dd></dl><p>If the selected index is 0 or less, an <code>xforms-scroll-first</code> event is dispatched and the index is set to 1. If the selected index is greater than the index of the last repeat item, an <code>xforms-scroll-last</code> event is dispatched and the index is set to that of the last item. If the index evaluates to NaN the action has no effect. </p><div class="note"><p class="prefix"><b>Note:</b></p><p>The IDREF from the <code>repeat</code> attribute may not uniquely identify the desired <a title="" href="#ui-repeat">repeat</a>
if the <code>repeat</code> element bearing the matching ID resides within the content of another <code>repeat</code>.
The general method described in <a href="#idref-resolve"><b>4.7 Resolving ID References in XForms</b></a> is used to determine the desired run-time repeat object.</p></div><div class="note"><p class="prefix"><b>Note:</b></p><p> This action affects <a title="" href="#action-deferred-updates">deferred updates</a> by performing deferred update in its initialization and by setting the deferred update flags for recalculate, revalidate and refresh.</p></div></div><div class="div2">
<h3><a name="action-toggle" id="action-toggle"></a>10.6 The toggle Element</h3><p>
This XForms Action begins by invoking the <a title="" href="#action-deferred-update-behavior">deferred update behavior</a>.
This action then selects one possible case from an exclusive list of alternatives in a <code>switch</code>.</p><p>This action performs the following:</p><ol class="enumar"><li><p>Dispatches an <code>xforms-deselect</code> event to the currently selected <code>case</code> in the <code>switch</code> containing the identified <code>case</code>.</p></li><li><p>Adjusts the <code>selected</code> states (not the attribute values) on the affected cases to reflect the new state of the <code>switch</code> containing the identified <code>case</code>.</p></li><li><p>Dispatches an <code>xform-select</code> event to the <code>case</code> just selected.</p></li></ol><p>Common Attributes: <a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#action-xmlevents">Events</a>, <a title="" href="#attrs-action-common">Action Common</a></p><p>Special Attributes:</p><dl><dt class="label">case</dt><dd><p>Author-optional reference to a <code>case</code> element. The <a title="" href="#ui-case">case</a> to select is specified by
this attribute or by the child element <a title="" href="#action-toggle-case">case</a>.</p></dd></dl><p>The <code>case</code> to be selected by the <code>switch</code> is identified by IDREF either by the attribute <code>case</code> or by a child <a title="" href="#action-toggle-case">case</a> element. If no <code>case</code> element contains the given identifier, then this action has no effect.</p><div class="note"><p class="prefix"><b>Note:</b></p><p>Whether the IDREF is obtained from the <code>case</code> attribute or element, the IDREF may not uniquely identify
the desired <a title="" href="#ui-case">case</a> if the <code>case</code> element bearing the matching ID resides
in a repeating construct such as element <code>repeat</code>.
The general method described in <a href="#idref-resolve"><b>4.7 Resolving ID References in XForms</b></a> is used to determine the desired run-time case object.</p></div><div class="note"><p class="prefix"><b>Note:</b></p><p> This action affects <a title="" href="#action-deferred-updates">deferred updates</a> by performing deferred update in its initialization.</p></div><div class="div3">
<h4><a name="action-toggle-case" id="action-toggle-case"></a>10.6.1 The case Element Child of the toggle Element</h4><p>This section defines a child element of <code>toggle</code> named <code>case</code> that is an alternate means of providing the identity of a
<a title="" href="#ui-case">case</a> element to select with a <a title="" href="#ui-switch">switch</a>.</p><p>Element: <code>case</code></p><p>Common attributes: None</p><p>Special Attributes:</p><dl><dt class="label">value</dt><dd><p>Author-optional attribute containing an XPath expression to evaluate using the in-scope evaluation context. To obtain the
<a title="" href="#ui-case">case</a> identity, the result of the expression is processed as if by call to the
XPath <code>string</code> function. An empty string is used if the XPath evaluation fails.</p></dd></dl><p>Content: PCDATA</p><p>The <a title="" href="#ui-case">case</a> to be selected by the <code>toggle</code> action is given by the
<code>case</code> attribute or the <code>case</code> element.
If both are given, the element takes precedence. Due to the addition of the element, the <code>case</code> attribute is no longer required,
but either the <code>case</code> attribute or the <code>case</code> element must appear.
The <code>case</code> element can provide the identity of a <a title="" href="#ui-case">case</a> with either its string content
or the <code>value</code> attribute. If both are given, then the <code>value</code> attribute takes precedence.</p><div class="exampleOuter"><div class="exampleInner"><pre><toggle>
<case value="concat('case_', ../addressBlockType)"/>
</toggle></pre></div></div></div></div><div class="div2">
<h3><a name="action-setfocus" id="action-setfocus"></a>10.7 The setfocus Element</h3><p>
This XForms Action begins by invoking the <a title="" href="#action-deferred-update-behavior">deferred update behavior</a>.
This action then dispatches an <code>xforms-focus</code> event (<a href="#evt-focus"><b>4.3.7 The xforms-focus Event</b></a>) to the element
identified by attribute <code>control</code> or child element <code>control</code>.
</p><p>Common Attributes: <a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#action-xmlevents">Events</a>, <a title="" href="#attrs-action-common">Action Common</a></p><p>Special Attributes:</p><dl><dt class="label">control</dt><dd><p>Author-optional reference to a <a title="form control" href="#def-form-control">form control</a>. The form control is specified by
this attribute or by the child element <a title="" href="#action-setfocus-control">control</a>.</p></dd></dl><p>The identity of the element to which the <code>setfocus</code> action dispatches <code>xforms-focus</code> is given by
the <code>control</code> attribute or the <a title="" href="#action-setfocus-control">control</a> element.
If no such element contains the given identifier, then this action has no effect.</p><div class="note"><p class="prefix"><b>Note:</b></p><p>Whether the IDREF is obtained from the <code>control</code> attribute or element, the IDREF may not uniquely identify
the desired form control if the element bearing the matching ID resides in a repeating construct such as element <code>repeat</code>.
The general method described in <a href="#idref-resolve"><b>4.7 Resolving ID References in XForms</b></a> is used to determine the desired form control.</p></div><div class="note"><p class="prefix"><b>Note:</b></p><p>Changing the focus to a form control within a repeat object may cause one or more repeat index values to be changed as described in Section <a href="#ui-repeat-ui"><b>9.3.4 User Interface Interaction</b></a>.</p></div><div class="div3">
<h4><a name="action-setfocus-control" id="action-setfocus-control"></a>10.7.1 The control Element Child of the setfocus Element</h4><p>This section defines a child element of <code>setfocus</code> named <code>control</code> that is an alternate means of providing the
element that receives the <code>xforms-focus</code> event.</p><p>Element: <code>control</code></p><p>Common attributes: None</p><p>Special Attributes:</p><dl><dt class="label">value</dt><dd><p>Author-optional attribute containing an XPath expression to evaluate using the in-scope evaluation context. To obtain the
desired element identifier, the result of the expression is processed as if by call to the XPath <code>string</code> function.
An empty string is used if the XPath evaluation fails.</p></dd></dl><p>Content: PCDATA</p><p>The identity of the element to which the <code>setfocus</code> action dispatches <code>xforms-focus</code> is given by
the <code>control</code> attribute or the <code>control</code> element.
If both are given, the element takes precedence. Due to the addition of the element, the <code>control</code> attribute is no longer required,
but either the <code>control</code> attribute or the <code>control</code> element must appear.
The <code>control</code> element can provide the desired element identifier with either its string content or the <code>value</code> attribute.
If both are given, then the <code>value</code> attribute takes precedence.</p><div class="exampleOuter"><div class="exampleInner"><pre><setfocus>
<control value="concat('input_', ../paymentType)"/>
</setfocus></pre></div></div></div></div><div class="div2">
<h3><a name="action-dispatch" id="action-dispatch"></a>10.8 The dispatch Element</h3><p>This action dispatches an XML Event to a specific target element. Two kinds of event can be dispatched: </p><ol class="enumar"><li><p>Predefined XForms events (i.e., xforms-<em>event-name</em>), in which case the <code>bubbles</code> and <code>cancelable</code> attributes are ignored and the standard semantics as defined in <a href="#rpm"><b>4 Processing Model</b></a> apply.</p></li><li><p>An event created by the XForms author with no predefined XForms semantics and as such not handled by default by the XForms Processor.</p></li></ol><p>Common Attributes: <a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#action-xmlevents">Events</a>, <a title="" href="#attrs-action-common">Action Common</a></p><p>Special Attributes:</p><dl><dt class="label">name</dt><dd><p>Author-optional attribute for specifying the name of the event to dispatch.</p></dd><dt class="label">targetid</dt><dd><p>Author-optional attribute for specifying the reference to the event target. </p></dd><dt class="label">delay</dt><dd><p>Author-optional attribute that indicates the minimum number of milliseconds to delay dispatching of the event to the target.
The default is the empty string, which indicates no delay.</p></dd><dt class="label">bubbles</dt><dd><p>Author-optional attribute containing a boolean indicating if this event bubbles—as defined in <a href="#ref-dom2-events">[DOM2 Events]</a>. The default value is <code>true</code> for a custom event. For predefined events, this attribute has no effect.</p></dd><dt class="label">cancelable</dt><dd><p>Author-optional attribute containing a boolean indicating if this event is cancelable—as defined in <a href="#ref-dom2-events">[DOM2 Events]</a>. The default value is <code>true</code> for a custom event. For predefined events, this attribute has no effect.</p></dd></dl><p>The event to be dispatched is given by the <code>name</code> attribute or the <a title="" href="#action-dispatch-name">name</a> child element.
Due to the addition of the <code>name</code> element, the <code>name</code> attribute is not required, but either the <code>name</code> attribute or the <code>name</code> element must appear.
If the event name is not specified or empty string, then this action has no effect.</p><p>The element to which the event is to be dispatched is identified by the <code>targetid</code> attribute or the
<a title="" href="#action-dispatch-targetid">targetid</a> chlid element. Due to the addition of the
<code>targetid</code> element, the <code>targetid</code> attribute is not required,
but this action has no effect unless the target identifier is specified by the element or attribute.
For backwards compatibility with documents created for earlier versions of the specification, the processor of the
<code>dispatch</code> element <a title="" href="#intro-reading">may</a> allow the attribute named <code>target</code> and the child element
<code>target</code> to be used. The attribute and element named <code>target</code> provide exactly the same behaviors as the
<code>targetid</code> attribute and element, except that the <code>target</code> attribute and element are ignored if the
<code>dispatch</code> element also bears a <code>targetid</code> attribute or contains a <code>targetid</code> child element.</p><div class="note"><p class="prefix"><b>Note:</b></p><p>Whether the IDREF is obtained from the <code>targetid</code> attribute or <code>targetid</code> element,
the IDREF may not uniquely identify the desired target object if the element bearing the matching ID resides in a repeating construct
such as element <code>repeat</code>. The general method described in <a href="#idref-resolve"><b>4.7 Resolving ID References in XForms</b></a> is used to determine the desired target object.</p></div><p>The event may be dispatched immediately or after a specified non-negative number of milliseconds of delay. The event delay is specified
the <code>delay</code> attribute or by the child element <a title="" href="#action-dispatch-delay">delay</a>.
If the delay is not specified or if the given value does not conform to <code>xsd:nonNegativeInteger</code>, then the event is dispatched
immediately as the result of the <code>dispatch</code> action.
Otherwise, the specified event is added to the delayed event queue
unless an event with the same name and target element already exists on the delayed event queue. The <code>dispatch</code>
action has no effect if the event delay is a non-negative integer and the specified event is already in the delayed event queue.</p><div class="note"><p class="prefix"><b>Note:</b></p><p>Since an element bearing a particular ID may be repeated, the delayed event queue may contain more than one
event with the same name and target IDREF. It is the name and the target <b>run-time element</b> that must be unique.</p></div><p>If a run-time element is destroyed, then any delayed events targeted at that element are removed from the delayed event queue.
A run-time element may be destroyed for a number of reasons, including shutdown of the form or removal of form controls
associated by a <code>repeat</code> with an instance data node that is destroyed.</p><p>As soon as possible after the specified delay in milliseconds has elapsed, the event is removed from the delayed event queue and then dispatched.
In the same manner used to handle user-generated events or the completion of an asynchronous submission, the dispatch and processing
of delayed events is done without interrupting the processing of another event and its event handlers.</p><div class="note"><p class="prefix"><b>Note:</b></p><p>Because the delayed event is first removed from the delayed event queue and then dispatched, a handler for a given
event may dispatch the event again with a delay. This can be used to perform simple polling and asynchronous looping
operations. Moreover, the <a title="" href="#action-conditional">if</a> attribute can be applied to the <code>dispatch</code> action to decide when to
discontinue the polling or looping based on a setting in instance data.</p></div><div class="div3">
<h4><a name="action-dispatch-name" id="action-dispatch-name"></a>10.8.1 The name Child Element</h4><p>This section defines a new child element of <code>dispatch</code> that provides an alternate
means of specifying the name of the event to dispatch.</p><p>Element: <code>name</code></p><p>Common attributes: None</p><p>Special Attributes:</p><dl><dt class="label">value</dt><dd><p>Author-optional attribute containing an XPath expression to evaluate using the in-scope evaluation context. To obtain the
event name, the result of the expression is processed as if by call to the XPath <code>string</code> function.
An empty string is used if the XPath evaluation fails.
</p></dd></dl><p>Content: PCDATA</p><p>The event name of the <code>dispatch</code> action is given by the <code>name</code> attribute or the <code>name</code> element.
If both are given, the element takes precedence.
The <code>name</code> element can provide the event name with either its string content or the <code>value</code> attribute.
If both are given, then the <code>value</code> attribute takes precedence.</p></div><div class="div3">
<h4><a name="action-dispatch-targetid" id="action-dispatch-targetid"></a>10.8.2 The targetid Child Element</h4><p>This section defines a new child element of <code>dispatch</code> that provides an alternate means of specifying the
target of the event to be dispatched.</p><p>Element: <code>targetid</code></p><p>Common attributes: None</p><p>Special Attributes:</p><dl><dt class="label">value</dt><dd><p>Author-optional attribute containing an XPath expression to evaluate using the in-scope evaluation context. To obtain the
event target, the result of the expression is processed as if by call to the XPath <code>string</code> function.
An empty string is used if the XPath evaluation fails.
</p></dd></dl><p>Content: PCDATA</p><p>The event target of the <code>dispatch</code> action is given by the <code>targetid</code> attribute or the
<code>targetid</code> element.
If both are given, the element takes precedence.
The <code>targetid</code> element can provide an IDREF for the event target with either its string content or
the <code>value</code> attribute. If both are given, then the <code>value</code> attribute takes precedence.</p></div><div class="div3">
<h4><a name="action-dispatch-delay" id="action-dispatch-delay"></a>10.8.3 The delay Child Element</h4><p>This section defines a new child element of <code>dispatch</code> that provides an alternate means of specifying the
delay imposed on the event to be dispatched.</p><p>Element: <code>delay</code></p><p>Common attributes: None</p><p>Special Attributes:</p><dl><dt class="label">value</dt><dd><p>Author-optional attribute containing an XPath expression to evaluate using the in-scope evaluation context. To obtain the
event delay, the result of the expression is processed as if by call to the XPath <code>string</code> function. If
the result does not conform lexically to <code>xsd:nonNegativeInteger</code>, then the result of empty string is used.
An empty string is used if the XPath evaluation fails.
</p></dd></dl><p>Content: PCDATA</p><p>The event delay of the <code>dispatch</code> action is given by the <code>delay</code> attribute or the <code>delay</code> element.
If both are given, the element takes precedence. The <code>delay</code> element can provide the delay with either its string content or the <code>value</code> attribute.
If both are given, then the <code>value</code> attribute takes precedence.</p></div></div><div class="div2">
<h3><a name="action-rebuild" id="action-rebuild"></a>10.9 The rebuild Element</h3><p>This action causes the default processing of <code>xforms-rebuild</code> to happen, bypassing the normal event flow (i.e. the behavior occurs without dispatching the <code>xforms-rebuild</code> event). This action results in the XForms Processor rebuilding any internal data structures used to track computational dependencies among instance data nodes —see <a href="#evt-rebuild"><b>4.3.1 The xforms-rebuild Event</b></a>.</p><p>Common Attributes: <a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#action-xmlevents">Events</a>, <a title="" href="#attrs-action-common">Action Common</a></p><p>Special Attributes:</p><dl><dt class="label">model</dt><dd><p>Author-optional XForms Model selector, as defined in <a href="#structure-attrs-single-node"><b>3.2.3 Single-Node Binding Attributes</b></a>. If this attribute is omitted, then the default is the
<code>model</code> associated with the in-scope evaluation context node.</p></dd></dl><div class="note"><p class="prefix"><b>Note:</b></p><p> This action affects <a title="" href="#action-deferred-updates">deferred updates</a>.</p></div></div><div class="div2">
<h3><a name="action-recalculate" id="action-recalculate"></a>10.10 The recalculate Element</h3><p>This action causes the default processing of <code>xforms-recalculate</code> to happen, bypassing the normal event flow (i.e. the behavior occurs without dispatching the <code>xforms-recalculate</code> event). As a result, instance data nodes whose values need to be recalculated are updated as specified in the processing model—see <a href="#evt-recalculate"><b>4.3.2 The xforms-recalculate Event</b></a>.</p><p>Common Attributes: <a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#action-xmlevents">Events</a>, <a title="" href="#attrs-action-common">Action Common</a></p><p>Special Attributes:</p><dl><dt class="label">model</dt><dd><p>Author-optional XForms Model selector, as defined in <a href="#structure-attrs-single-node"><b>3.2.3 Single-Node Binding Attributes</b></a>. If this attribute is omitted, then the default is the
<code>model</code> associated with the in-scope evaluation context node.</p></dd></dl><div class="note"><p class="prefix"><b>Note:</b></p><p> This action affects <a title="" href="#action-deferred-updates">deferred updates</a>.</p></div></div><div class="div2">
<h3><a name="action-revalidate" id="action-revalidate"></a>10.11 The revalidate Element</h3><p>This action causes the default processing of <code>xforms-revalidate</code> to happen, bypassing the normal event flow (i.e. the behavior occurs without dispatching the <code>xforms-revalidate</code> event). This results in the instance data being revalidated as specified by the processing model—see <a href="#evt-revalidate"><b>4.3.3 The xforms-revalidate Event</b></a>.</p><p>Common Attributes: <a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#action-xmlevents">Events</a>, <a title="" href="#attrs-action-common">Action Common</a></p><p>Special Attributes:</p><dl><dt class="label">model</dt><dd><p>Author-optional XForms Model selector, as defined in <a href="#structure-attrs-single-node"><b>3.2.3 Single-Node Binding Attributes</b></a>. If this attribute is omitted, then the default is the
<code>model</code> associated with the in-scope evaluation context node.</p></dd></dl><div class="note"><p class="prefix"><b>Note:</b></p><p>This action affects <a title="" href="#action-deferred-updates">deferred updates</a>.</p></div></div><div class="div2">
<h3><a name="action-refresh" id="action-refresh"></a>10.12 The refresh Element</h3><p>This action causes the default processing of <code>xforms-refresh</code> to happen, bypassing the normal event flow (i.e. the behavior occurs without dispatching the <code>xforms-refresh</code> event). This action results in the XForms user interface being <em>refreshed</em>, and the presentation of user interface controls being updated to reflect the state of the underlying instance data—see <a href="#evt-refresh"><b>4.3.4 The xforms-refresh Event</b></a>.</p><p>Common Attributes: <a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#action-xmlevents">Events</a>, <a title="" href="#attrs-action-common">Action Common</a></p><p>Special Attributes:</p><dl><dt class="label">model</dt><dd><p>Author-optional XForms Model selector, as defined in <a href="#structure-attrs-single-node"><b>3.2.3 Single-Node Binding Attributes</b></a>. If this attribute is omitted, then the default is the
<code>model</code> associated with the in-scope evaluation context node.</p></dd></dl><div class="note"><p class="prefix"><b>Note:</b></p><p> This action affects <a title="" href="#action-deferred-updates">deferred updates</a>.</p></div></div><div class="div2">
<h3><a name="action-reset" id="action-reset"></a>10.13 The reset Element</h3><p>This action initiates reset processing by dispatching an <code>xforms-reset</code> event to the specified <code>model</code>. Processing of event <code>xforms-reset</code> is defined in the processing model—see <a href="#evt-reset"><b>4.3.5 The xforms-reset Event</b></a>.</p><p>Common Attributes: <a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#action-xmlevents">Events</a>, <a title="" href="#attrs-action-common">Action Common</a></p><p>Special Attributes:</p><dl><dt class="label">model</dt><dd><p>Author-optional XForms Model selector, as defined in <a href="#structure-attrs-single-node"><b>3.2.3 Single-Node Binding Attributes</b></a>. If this attribute is omitted, then the default is the
<code>model</code> associated with the in-scope evaluation context node.</p></dd></dl><div class="note"><p class="prefix"><b>Note:</b></p><p> This action affects <a title="" href="#action-deferred-updates">deferred updates</a>.</p></div></div><div class="div2">
<h3><a name="action-load" id="action-load"></a>10.14 The load Element</h3><p>This action traverses the specified link.
</p><p>Common Attributes: <a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#action-xmlevents">Events</a>, <a title="" href="#attrs-action-common">Action Common</a>, <a title="" href="#structure-attrs-single-node">Single-Node Binding</a> (author-optional)</p><p>Special Attributes:</p><dl><dt class="label">resource</dt><dd><p>Author-optional attribute. Link to an external resource to load.</p></dd><dt class="label">show</dt><dd><p>Author-optional link behavior specifier. The allowed values are "replace" and "new". If this attribute is missing, a default value of "replace" is assumed.</p></dd></dl><p>The URI specifying the link to traverse may be pointed to by the Single Node Binding attributes, if given, or by the
<code>resource</code> attribute or the <a title="" href="#action-load-resource">name</a> child element.
Individually, the Single Node Binding, <code>resource</code> element and <code>resource</code> attribute are not required.
If none are given, the action has no effect. If the Single Node Binding is present and does not select an instance
data node, then this action has no effect. If the Single Node Binding is given in addition to one of the
<code>resource</code> attribute or <code>resource</code> element, then the action has no effect. </p><p>The URI obtained in this manner is treated as a link to an external resource, defined as an <a href="#ref-xlink-1.0">[XLink 1.0]</a> link between
the <code>load</code> element and the remote resource indicated. No XLink <code>actuate</code> value is defined, since control of actuation is
defined by XML Events. The XLink <code>show</code> value depends on the <code>show</code> attribute. </p><p>The link indidicated by the URI obtained above is traversed.
If the link traversal fails, then an implementation-specific means of conveying the link
traversal failure occurs.
Otherwise, processing for the document (or portion of the document) reached by traversing the link is specified by the <code>show</code> attribute.
The following are the possible values for the <code>show</code> attribute and the corresponding processing behaviors:</p><dl><dt class="label">new</dt><dd><p>The document is loaded into a new presentation context, e.g., a new window. Form processing in the original window continues.</p></dd><dt class="label">replace</dt><dd><p>The document is loaded into the current window. Form processing is interrupted, exactly as if the user had manually requested navigating to a new document.</p></dd></dl><div class="div3">
<h4><a name="action-load-resource" id="action-load-resource"></a>10.14.1 The resource Element child of load</h4><p>When it appears as the first child element of <code>load</code>, the <code>resource</code> element provides the URI of the link,
overriding the <code>resource</code> attribute. As stated above, the <code>load</code> action has no effect if
both a <code>resource</code> and a Single Node Binding are given.
This element allows the URI used by the <code>load</code> to be dynamically calculated based on instance data. </p><p>Common Attributes: None</p><p>Special Attributes:</p><dl><dt class="label">value</dt><dd><p>Author-optional attribute containing an XPath expression to evaluate using the in-scope evaluation context. To obtain the
URI, the result of the expression is processed as if by call to the XPath <code>string</code> function.
An empty string is used if the XPath evaluation fails.
</p></dd></dl><p>Content: PCDATA</p><p>The URI to be used by the <code>load</code> can be specified with either the <code>value</code> attribute or
the string content of the <code>resource</code> element. If both are specified, then the <code>value</code> attribute takes precedence.
If the <code>load</code> does not have a <code>resource</code> element as its first child, then the URI is obtained from
the <code>resource</code> attribute or the Single Node Binding, if given.</p></div></div><div class="div2">
<h3><a name="action-send" id="action-send"></a>10.15 The send Element</h3><p>This action initiates submit processing by dispatching an <code>xforms-submit</code> event. Processing of event <code>xforms-submit</code> is defined in the processing model—see <a href="#evt-submit"><b>4.3.9 The xforms-submit Event</b></a>.</p><p>Common Attributes: <a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#action-xmlevents">Events</a>, <a title="" href="#attrs-action-common">Action Common</a></p><p>Special Attributes:</p><dl><dt class="label">submission</dt><dd><p>Author-optional attribute containing a reference to a <code>submission</code> element. If this attribute is given but does not identify a <code>submission</code> element,
then the <code>send</code> action has no effect. If this attribute is omitted, then the first <code>submission</code> in document order from the <code>model</code> associated with the in-scope
evaluation context is used.</p></dd></dl></div><div class="div2">
<h3><a name="action-message" id="action-message"></a>10.16 The message Element</h3><p>
This action encapsulates a message to be displayed to the to the user.</p><p>Common Attributes: <a title="" href="#structure-attrs-common">Common</a>, <a title="" href="#action-xmlevents">Events</a>, <a title="" href="#attrs-action-common">Action Common</a>, <a title="" href="#structure-attrs-single-node">Single Node Binding</a> (author-optional)</p><p>Special Attributes:</p><dl><dt class="label">level</dt><dd><p>Author-optional attribute containing a message level identifier, one of ("ephemeral"|"modeless"|"modal"|<a title="QNameButNotNCName" href="#def-QNameButNotNCName">QNameButNotNCName</a>).
The default is "modal" if the attribute is not specified. This specification does not define behavior for <a title="QNameButNotNCName" href="#def-QNameButNotNCName">QNameButNotNCName</a> values.</p></dd></dl><p>The message specified can exist in instance data or as inline text. If more than one source of message is specified in this element, the order of precedence is: single node binding attributes, inline text.</p><p>The user interface for the <code>message</code> action is considered to be created at the time the action occurs. If the message is obtained from the inline content of the <code>message</code> action, then the output of any <code>output</code> controls in the <code>message</code> content is determined based on the instance data available when the <code>message</code> action occurs. For example, the following example displays the message <code>Hello, world!</code> as the form starts up:</p><div class="exampleInner"><pre><model>
<instance>
<data xmlns="">
<name>John</name>
</data>
</instance>
<action ev:event="xforms-ready">
<setvalue ref="name">world</setvalue>
<message level="modal">Hello, <output ref="name"/>!</message>
...</action>
</model></pre></div><p>In this example, the message includes the latest user input even though other form controls not in the <code>message</code> action are not guaranteed to be updated until the end of the <code>xforms-refresh</code> event processing:</p><div class="exampleInner"><pre><input ref="birthday">
<label>Enter birthday:</label>
<message ev:event="xforms-invalid"><output ref="."/> isn't a valid birthday</message>
</input>
</pre></div><div class="note"><p class="prefix"><b>Note:</b></p><p>Due to deferred update behavior, if a <code>message</code> action is preceded in an action sequence by other actions that change instance nodes, and the message references nodes that are computationally dependent on the changed nodes, then the form author should invoke the <code>recalculate</code> action before the <code>message</code> action. Moreover, if the computational dependencies involved nodes that were inserted or deleted, then the form author should invoke <code>rebuild</code> prior to the <code>recalculate</code>.</p></div><p>A graphical browser might render a modal message as follows:</p><div class="exampleInner"><pre><model>
<message level="modal" ev:event="xforms-ready">This is not a drill!</message>
...
</model></pre></div><p> <img src="images/ui-input-with-alert.png" alt="An alert popup, with a helpful error message."></p><p>A modeless message is the foundation for displaying a <code>help</code> message, which a graphical browser might render as follows: </p><div class="exampleInner"><pre><secret ref="/login/password">
<label>Password</label>
<help>Have you forgotten your password? Simply call 1-900-555-1212 and have
a major credit card handy.</help>
</secret></pre></div><p> <img src="images/ui-password-with-help.png" alt="A password entry form control, with a popup window below, displaying instructions for retrieving a forgotten password"></p><p>An ephemeral message is the foundation for displaying a <code>hint</code> message, which a graphical browser might render as follows: </p><div class="exampleInner"><pre><input ref="po/address/street1">
<label>Street</label>
<hint>Please enter the number and street name</hint>
</input></pre></div><p> <img src="images/ui-input-with-hint.png" alt="An average-looking text entry form control, with a mouse pointer visible and a tooltip below, reading 'Please enter the number and street name'"></p></div><div class="div2">
<h3><a name="action-conditional" id="action-conditional"></a>10.17 Conditional Execution of XForms Actions</h3><p>The <code>if</code> attribute can be added to any XForms action. It contains an <a href="#ref-xpath-1.0">[XPath 1.0]</a> expression
that is evaluated using the in-scope evaluation context before the action is executed. The result of the expression is
converted to a <code>boolean</code> as if converted with the <code>boolean()</code> function defined by the
<a href="#ref-xpath-1.0">[XPath 1.0]</a> specification.
If the converted result of the expression evaluates to <code>false</code>, then the action is not performed. If the
converted result is <code>true</code>, then the action is performed.</p><p>If this attribute is applied to an XForms <code>action</code> element and the converted result of evaluation is
<code>false</code>, then all of the actions within the <code>action</code> element are omitted from the execution
of the XForms action sequence that invoked the <code>action</code> element. If the result is <code>true</code>,
then the contained actions are performed according to the normal processing rules such as deferred update behavior
and applicability of conditional and iterative attributes.</p><div class="note"><p class="prefix"><b>Note:</b></p><p>In actions <code>insert</code> and <code>delete</code>, the attribute <code>context</code> is evaluated before the <code>if</code> attribute.</p></div><div class="exampleOuter">
<div class="exampleHead">Automatic Focus Advancement</div><p>The <code>setfocus</code> action in each input control is executed only if the node bound to the control
is a number of a particular length. The exacting form author could perform further validity tests.</p><div class="exampleInner"><pre>
...
<input ref="areaCode" id="AreaCodeControl" incremental="true">
<label>Area Code</label>
<setfocus ev:event="xforms-value-changed" control="ExchangeControl" if="string-length(.)=3 and . > 0"/>
</input>
<input ref="exchange" id="ExchangeControl" incremental="true">
<label>Exchange</label>
<setfocus ev:event="xforms-value-changed" control="LocalControl" if="string-length(.)=3 and . > 0"/>
</input>
<input ref="local" id="LocalControl" incremental="true">
<label>Local</label>
<setfocus ev:event="xforms-value-changed" control="ExtensionControl" if="string-length(.)=4 and . > 0"/>
</input>
...</pre></div></div><div class="exampleOuter">
<div class="exampleHead">Handling Focus for Empty Repeats</div><p>The trigger that performs a delete conditionally sets the focus to a control outside of the repeat if
the repeat becomes empty due to the deletion. The <code>setfocus</code> is called first because the
<code>delete</code> removes the context node.</p><div class="exampleInner"><pre>
...
<trigger id="InsertControl">
<label>Insert Row</label>
<action ev:event="DOMActivate">
<insert context="purchaseOrder/lines" nodeset="line"
at="index('PurchaseOrderRepeat')" origin="instance('prototype')"/>
<setfocus control="PurchaseOrderRepeat"/>
</action>
</trigger>
<repeat nodeset="purchaseOrder/lines/line" id="PurchaseOrderRepeat">
...
<trigger>
<label>Delete Row</label>
<action ev:event="DOMActivate">
<setfocus control="InsertControl" if="last()=1"/>
<delete nodeset="../line" at="index('PurchaseOrderRepeat')"/>
</action>
</trigger>
...
</repeat>
</pre></div></div></div><div class="div2">
<h3><a name="action-iterated" id="action-iterated"></a>10.18 Iteration of XForms Actions</h3><p>The <code>while</code> attribute can be added to any XForms action. It contains an <a href="#ref-xpath-1.0">[XPath 1.0]</a> expression
that is evaluated using the in-scope evaluation context before the action is executed. The result of the expression is
converted to a <code>boolean</code> as if converted with the <code>boolean()</code> function defined by the
<a href="#ref-xpath-1.0">[XPath 1.0]</a> specification.
If the converted result of the expression is <code>true</code>, then the XForms action is performed and then the
expression is re-evaluated. The XForms action is executed repeatedly until the converted result of the expression
evaluates to <code>false</code>.</p><p>If this attribute is applied to an XForms <code>action</code> element, then the sequence of XForms actions in its content are
executed repeatedly once for each time the immediately preceding evaluation of the expression yields a result of <code>true</code>.</p><p>When XForms actions are iteratively executed, they are still subject to the normal action processing rules such as deferred
update and applicability of conditional and iterative attributes.</p><p> An XForms action may be executed zero times due to this attribute. Furthermore, if an action bears this attribute and the
<code>if</code> attribute, then the expressions of both attributes must evaluate to <code>true</code> before each iterative
execution of the action. </p><div class="note"><p class="prefix"><b>Note:</b></p><p>In actions <code>insert</code> and <code>delete</code>, the attribute <code>context</code> is evaluated before the <code>while</code> attribute.
Therefore, <code>context</code> is re-evaluated before each iteration of the actions controlled by the <code>while</code> attribute.</p></div><div class="exampleOuter">
<div class="exampleHead">Summing Selected Results</div><p>Counter and accumlator variables are created in instance data to sum a selection of values chosen by the user</p><div class="exampleInner"><pre>
<trigger>
<label>Get Sum</label>
<action ev:event="DOMActivate">
<setvalue ref="instance('temps')/counter" value="1"/>
<setvalue ref="instance('temps')/accumulator" value="0"/>
<action while="instance('temps')/counter <= count(/some/nodes)">
<setvalue ref="instance('temps')/accumulator"
value=". + instance('default')/some/nodes[number(instance('temps')/counter)]"
if="boolean-from-string(/some/nodes[number(instance('temps')/counter)]/@selected)"/>
<setvalue ref="instance('temps')/counter" value=". + 1"/>
</action>
</action>
</trigger>
</pre></div></div></div><div class="div2">
<h3><a name="action-other" id="action-other"></a>10.19 Actions from Other Modules</h3><p> Of the action handlers detailed in this chapter, XForms defines some to be part of the XForms Switch and Repeat
modules: <a href="#action-toggle"><b>10.6 The toggle Element</b></a> and <a href="#action-setindex"><b>10.5 The setindex Element</b></a>.</p></div></div><div class="div1">
<h2><a name="submit" id="submit"></a>11 The XForms Submission Module</h2><p>XForms is designed to gather <a title="instance data" href="#def-instance-data">instance data</a>, serialize it into an external representation, and submit it with a protocol. XForms defines a set of options for serialization and submission. The following sections define the processing of instance data for submission, and the behavior for the serialization and submission options.</p><div class="div2">
<h3><a name="submit-submission-element" id="submit-submission-element"></a>11.1 The submission Element</h3><p>The <code>submission</code> element represents declarative instructions on what to submit, and how.</p><table border="1" summary="listing of XForms submission element attributes and content model"><tbody><tr><th rowspan="1" colspan="1">Element</th><th rowspan="1" colspan="1">Overview of Attributes</th><th rowspan="1" colspan="1">Overview of Content Model</th></tr><tr><td rowspan="1" colspan="1">submission</td><td rowspan="1" colspan="1">
<blockquote><p><a title="" href="#structure-attrs-common">Common</a><br>ref (<a title="binding expression" href="#def-binding-expression">binding-expression</a>)<br>bind (xsd:IDREF)<br>resource (xsd:anyURI)<br>action (xsd:anyURI) [deprecated]<br>mode ("asynchronous"|"synchronous")<br>method ("post"|"get"|"put"|"delete"|"multipart-post"|"form-data-post"|"urlencoded-post"|Any other <a href="http://www.w3.org/TR/REC-xml-names/#NT-NCName">NCName</a>|<a title="QNameButNotNCName" href="#def-QNameButNotNCName">QNameButNotNCName</a>)<br>validate (xsd:boolean)<br>relevant (xsd:boolean)<br>serialization ("application/xml"|"application/x-www-form-urlencoded"|"multipart/related"|"multipart/form-data"|"none")<br>version (xsd:NMTOKEN)<br>indent (xsd:boolean)<br>mediatype (xsd:string)<br>encoding (xsd:string)<br>omit-xml-declaration (xsd:boolean)<br>standalone (xsd:boolean)<br>cdata-section-elements (QNameList)<br>replace ("all"|"instance"|"text"|"none" | <a title="QNameButNotNCName" href="#def-QNameButNotNCName">QNameButNotNCName</a>)<br>instance (xsd:IDREF)<br>targetref (nodeset XPath Expression)<br>separator (';' | '&')<br>includenamespaceprefixes (xsd:NMTOKENS)</p></blockquote>
</td><td rowspan="1" colspan="1">(<a title="" href="#submit-resource-elem">resource</a> | <a title="" href="#submit-method-elem">method</a> | <a title="" href="#submit-header">header</a>)*, <a title="" href="#action-content-set">Action</a>*</td></tr></tbody></table><p>Below is a more detailed decription of each attribute whose name and datatype information appears above. </p><p>Common Attributes: <a title="" href="#structure-attrs-common">Common</a></p><p>Special Attributes:</p><dl><dt class="label">resource</dt><dd><p>Attribute indicating the destination URI for submitting instance data. This attribute is not author-optional unless the destination URI
is provided by the <code>resource</code> element, which can dynamically specify the URI based on instance data, or the <code>action</code> attribute.
This attribute should be used in place of the <code>action</code> attribute.
Behavior of relative URIs in links is determined by the host language, although <a href="#ref-xml-base">[XML Base]</a> processing is strongly recommended.</p></dd><dt class="label">action</dt><dd><p>Deprecated author-optional attribute indicating the destination URI for submitting instance data.
Behavior of relative URIs in links is determined by the host language, although <a href="#ref-xml-base">[XML Base]</a> processing is strongly recommended.
Due to the addition of the <code>resource</code> attribute, this attribute is deprecated and optional. However, the destination URI
must be specified by this attribute or by either the <code>resource</code> attribute or the <code>resource</code> element. </p></dd><dt class="label">ref</dt><dd><p>Author-optional selector <a title="binding expression" href="#def-binding-expression">binding expression</a> enabling submission of a portion of the instance data. The selected node, and all descendants, are selected for submission. The default value is "/".</p></dd><dt class="label">bind</dt><dd><p>Author-optional reference to a <code>bind</code> element. When present, the binding reference on this attribute is used in preference to any binding reference from the <code>ref</code> attribute.</p></dd><dt class="label">mode</dt><dd><p>Author-optional attribute defaulting to "asynchronous" and with legal values of "synchronous" and "asynchronous". This attribute
controls whether or not the submission response processing is performed as part of the default processing of event
<code>xforms-submit</code>. An asynchronous submission can complete default processing for this event before the
submission response is received; in this case, submission response is processed once it
is completely received asynchronously. For a "synchronous" submission, the submission response is
received and processed during the default processing of event <code>xforms-submit</code>.</p></dd><dt class="label">method</dt><dd><p>Author-optional attribute specifying the protocol operation to be used to transmit the serialized instance data. There is no default value because either the attribute <code>method</code> or the element <code>method</code> must be specified.
See Section <a href="#submit-options"><b>11.9 Submission Options</b></a> for information on how this attribute affects the default serialization of instance data and the HTTP method <a href="#ref-rfc-2616">[RFC 2616]</a>.</p></dd><dt class="label">validate</dt><dd><p>Author-optional boolean attribute that indicates whether or not the data validation checks of the submission are performed. The default value is "false" if the value of <code>serialization</code> is "none" and "true" otherwise.</p></dd><dt class="label">relevant</dt><dd><p>Author-optional boolean attribute that indicates whether or not the relevance pruning of the submission is performed. The default value is "false" if the value of <code>serialization</code> is "none" and "true" otherwise.</p></dd><dt class="label">serialization</dt><dd><p>Author-optional attribute that controls how and whether to serialize instance data as part of the submission.
The default value of this attribute is based on the submission <code>method</code> as described in Section <a href="#submit-options"><b>11.9 Submission Options</b></a>.
If the attribute value is "none", then instance data is not serialized as part of the submission.
This can be useful for requests that either require no data or that have the data already gathered in the URI.</p><div class="note"><p class="prefix"><b>Note:</b></p><p>Setting <code>serialization</code> to "none" will also have the default effect of preventing relevance pruning and validation.
However, the author is free to override this by setting <code>relevant</code> and/or <code>validate</code> attributes to "true".</p></div></dd><dt class="label">version</dt><dd><p>Author-optional attribute specifying the <code>version</code> of XML to be serialized. The default is "1.0".</p></dd><dt class="label">indent</dt><dd><p>Author-optional attribute specifying whether the serializer should add extra white space nodes for readability. The default is "false".</p></dd><dt class="label">mediatype</dt><dd><p>Author-optional attribute specifying the mediatype for XML serialization of instance data. Authors should ensure that the type specified is compatible with the data being submitted, such as <code>application/xml</code> for posted XML data. The default is "application/xml".</p><div class="note"><p class="prefix"><b>Note:</b></p><p>This attribute does not affect serialization and cannot be used to override the <code>serialization</code> attribute. It is only used to provide additional information about the submission data serialization when the serialization is <code>application/xml</code>. For example, this attribute could be used to indicate that the content type of the XML serialization is <code>text/xml</code>.</p></div></dd><dt class="label">encoding</dt><dd><p>Author-optional attribute specifying an encoding for serialization. The default is "UTF-8".</p></dd><dt class="label">omit-xml-declaration</dt><dd><p>Author-optional attribute specifying whether to omit the XML declaration on the serialized instance data. The default value is "false".</p></dd><dt class="label">standalone</dt><dd><p>Author-optional attribute specifying whether to include a standalone declaration in the serialized XML.If the <code>omit-xml-declaration</code> attribute has the value <code>true</code>, then this attribute is ignored. Otherwise, if this attribute is omitted, then the XML declaration does not include a standalone document declaration, and if this attribute is specified, then the XML declaration includes a standalone document declaration with the same value as this attribute.</p></dd><dt class="label">cdata-section-elements</dt><dd><p>Author-optional attribute specifying element names to be serialized with CDATA sections. The default is empty string.</p></dd><dt class="label">replace</dt><dd><p>Author-optional attribute specifying how the information returned after submit should be applied. In the absence of this attribute, "all" is assumed.
The legal values are "all", "instance", "text" and "none".</p></dd><dt class="label">instance</dt><dd><p>Author-optional attribute specifying the instance to replace when the <code>replace</code> attribute value is "instance".
When the attribute is absent, then the default is the instance that contains the submission data.
An xforms-binding-exception (<a href="#evt-bindingException"><b>4.5.1 The xforms-binding-exception Event</b></a>) occurs if this attribute does not
indicate an instance in the same model as the submission.</p></dd><dt class="label">targetref</dt><dd><p>Author-optional attribute containing an XPath expression that indicates the target node for data replacement.
The in-scope evaluation context of the <code>submission</code> element is used to evaluate the expression.
If <code>replace</code> is "instance", then the target node is replaced by the submission result.
If <code>replace</code> is "text", then the content of the target node is replaced by the submission result. For other values of
the <code>replace</code> attribute, this attribute is ignored. By default, the target node is the document element of the
instance indicated by the <code>instance</code> attribute.</p></dd><dt class="label">separator</dt><dd><p>Author-optional attribute specifying the separator character between name/value pairs in urlencoding.
The default value is '&'. To express the default,
character entity encoding is used: <code>separator='&amp;'</code>.</p></dd><dt class="label">includenamespaceprefixes</dt><dd><p>Author-optional attribute providing control over namespace serialization. If absent, all namespace nodes present in the instance data are considered for serialization. If present, specifies list of namespace prefixes to consider for serialization, in addition to those visibly utilized. As in <a href="#ref-Exc-C14N">[Exc-C14N]</a>, the special value <code>#default</code> specifies the default namespace.</p></dd></dl><p>The following examples show how various options on element <code>submission</code> can affect serialization as <code>application/xml</code>. Given the following XForms fragment:</p><div class="exampleInner"><pre><xforms:model xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:my="http://ns.example.org/2003">
<xforms:instance>
<qname xmlns="">my:sample</qname>
</xforms:instance>
<xforms:submission method="post" resource="..."/>
</xforms:model></pre></div><p>Note that the <code>includenamespaceprefixes</code> attribute is not present, which causes all namespace nodes to be serialized, resulting in the following serialized instance data:</p><div class="exampleInner"><pre><qname xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:my="http://ns.example.org/2003">my:sample</qname></pre></div><p>In particular, note that the XForms namespace has been serialized. To prevent this example from including the unneeded XForms namespace while maintaining the needed <code>my</code> prefix, <code>includenamespaceprefixes="my"</code> must be added to the submission element. When this attribute is present, the author takes responsibility to list all namespace prefixes not visibly utilized by the submitted instance data.</p><p>The following attributes correspond (in spelling, processing, and default values) to attributes on the <code>output</code> element of <a href="#ref-xslt">[XSLT 1.0]</a>, with the exception of using <code>xsd:boolean</code> to replace <code>"yes"|"no"</code>:</p><blockquote><p>version<br>indent<br>encoding<br>omit-xml-declaration<br>cdata-section-elements</p></blockquote><div class="note"><p class="prefix"><b>Note:</b></p><p>The following XSLT attributes have no counterpart in XForms:</p><blockquote><p>doctype-system<br>doctype-public</p></blockquote></div><p>The table below provides an overview of the child elements of the XForms <code>submission</code> element, including their attributes and content models. Elements defined in the XForms Actions module are also allowed in the content model of <code>submission</code>.</p><table border="1" summary="listing of child elements of the XForms submission element, and their attributes and content models"><tbody><tr><th rowspan="1" colspan="1">Element</th><th rowspan="1" colspan="1">Overview of Attributes</th><th rowspan="1" colspan="1">Overview of Content Model</th></tr><tr><td rowspan="1" colspan="1">resource</td><td rowspan="1" colspan="1">value (string XPath Expression)</td><td rowspan="1" colspan="1">PCDATA</td></tr><tr><td rowspan="1" colspan="1">method</td><td rowspan="1" colspan="1">value (string XPath Expression)</td><td rowspan="1" colspan="1">PCDATA</td></tr><tr><td rowspan="1" colspan="1">header</td><td rowspan="1" colspan="1">nodeset (nodeset XPath Expression)</td><td rowspan="1" colspan="1">name, value+</td></tr><tr><td rowspan="1" colspan="1"><a title="" href="#action-content-set">Action</a></td><td rowspan="1" colspan="1">various</td><td rowspan="1" colspan="1">various</td></tr></tbody></table></div><div class="div2">
<h3><a name="submit-evt-submit" id="submit-evt-submit"></a>11.2 The xforms-submit Event</h3><p>Target: <code>submission</code></p><p>Bubbles: Yes</p><p>Cancelable: Yes</p><p>Context Info: None</p><p>Under no circumstances <span>can</span> more than a single concurrent submit process be
under way for a particular
XForms submission. From the start of the default action of <code>xforms-submit</code> for a <code>submission</code>,
until immediately before <code>xforms-submit-done</code> or <code>xforms-submit-error</code> is dispatched to that
<code>submission</code>, the default action for subsequent <code>xforms-submit</code> events dispatched to that
<code>submission</code> is to dispatch <code>xforms-submit-error</code> to that submission with context
information containing an <code>error-type</code> of <code>submission-in-progress</code>.</p><p>Otherwise, the default action for this event results in the following steps:</p><ol class="enumar"><li><p>The data model is updated based on some of the flags defined for <a title="" href="#action-deferred-updates">deferred updates</a>..
Specifically, if the deferred update <code>rebuild</code> flag is set for the <code>model</code> containing this
<code>submission</code>, then the rebuild operation is performed without dispatching an event to invoke the operation. Then, if the deferred update
<code>recalculate</code> flag is set for the <code>model</code> containing this <code>submission</code>, then the recalculate operation is performed
without dispatching an event to invoke the operation.
This sequence of operations affects the <a title="" href="#action-deferred-update-behavior">deferred update behavior</a>
by clearing the deferred update flags associated with the operations performed.
</p></li><li><p> If the binding attributes of <code>submission</code> indicate an empty nodeset or a
<span>node other than an element or an instance document root node</span>, then
submission processing is stopped after dispatching event <code>xforms-submit-error</code>
with context information containing an <code>error-type</code> of <code>no-data</code>.
Otherwise, the binding attributes of <code>submission</code> indicate a node of instance data.
</p></li><li><p>The indicated node and all nodes for which it is an ancestor are selected. If the attribute <code>relevant</code> is <code>true</code>, whether by default or declaration, then any selected node which is not relevant as defined in <a href="#model-prop-relevant"><b>6.1.4 The relevant Property</b></a> is deselected (pruned). If all instance nodes are deselected, then
submission processing is stopped after dispatching event <code>xforms-submit-error</code>
with context information containing an <code>error-type</code> of <code>no-data</code>.
</p></li><li><p>If the attribute <code>validate</code> is <code>true</code>,whether by default or declaration, then
all selected instance data nodes are checked for validity according to the definition in
<a href="#evt-revalidate"><b>4.3.3 The xforms-revalidate Event</b></a>
(no notification events are marked for dispatching due to this operation).
Any selected instance data node that is found to
be invalid stops submission processing after dispatching event
<code>xforms-submit-error</code> with context information containing an
<code>error-type</code> of <code>validation-error</code>.</p></li><li><p>The <a title="" href="#submit-method">submission method</a> is determined.</p></li><li><p>The <a title="" href="#submit-resource">submission resource</a> is determined. If the resource is not specified, then submission processing stops after dispatching even <code>xforms-submit-error</code> with context information containing an <code>error-type</code> of <code>resource-error</code>.</p></li><li><p>If the <code>serialization</code> attribute value is <code>"none"</code>, then the submission
data serialization is the empty string. Otherwise, the submission data serialization
is determined as follows. The event <code>xforms-submit-serialize</code> is dispatched.
If the <code>submission-body</code> property of the event is changed from the initial value of empty string, then the content
of the <code>submission-body</code> property string is used as the <code>submission data serialization</code>.
Otherwise, the <code>submission data serialization</code> consists of a serialization of the selected instance data
according to the rules stated in <a href="#submit-options"><b>11.9 Submission Options</b></a>.</p></li><li><p>The <code>submission headers</code> are determined using the
header entries produced by the <code>header</code> element(s) in the submission and
the <code>mediatype</code> attribute or its default.</p></li><li><p>The submission is performed based on the <code>submission headers</code>,
<a title="" href="#submit-method">submission method</a>, <a title="" href="#submit-resource">submission resource</a>,
and <code>submission data serialization</code>. The exact rules of submission are based on the URI scheme and
the <a title="" href="#submit-method">submission method</a>, as defined in <a href="#submit-options"><b>11.9 Submission Options</b></a>.</p></li></ol><div class="note"><p class="prefix"><b>Note:</b></p><p>A <code>submission</code> with no resource specification can be used to test validity of data. If the
selected data is invalid, then the <code>xforms-submit-error</code> has an <code>error-type</code> of
<code>validation-error</code>. If the selected data is valid, then the <code>xforms-submit-error</code> has
an <code>error-type</code> of <code>resource-error</code>. </p></div><p>If the <code>mode</code> of the <code>submission</code> is <code>asynchronous</code>, then default processing for this event
ends after the above steps, and submission processing is resumed once the response from the submission is returned.
In the same manner used to handle user-generated events or the dispatch and processing of delayed events,
the processing of the asynchronous submission response is done without interrupting the processing of any other event and its event handlers.
If the <code>mode</code> of the <code>submission</code> is <code>synchronous</code>, then the XForms processor suspends user interaction with all form controls
of the document and action processing is blocked within the default processing for this event until the response from the submission is returned.</p><p>The response returned from the submission is applied as follows: </p><ul><li><p>For a success response including a body, when the value of the <code>replace</code> attribute on element <code>submission</code> is "<code>all</code>",
the event <code>xforms-submit-done</code> may be dispatched with appropriate context information, and
submit processing concludes with entire containing document being replaced with the returned body.</p></li><li><p>For a success response including a body of an XML media type (as defined by the content type specifiers in <a href="#ref-rfc-3023">[RFC 3023]</a>),
when the value of the <code>replace</code> attribute on element <code>submission</code> is "<code>instance</code>", the response is parsed as XML.
If the parse fails, then submission processing concludes
after dispatching <code>xforms-submit-error</code>
with appropriate context information, including an <code>error-type</code> of <code>parse-error</code>.
However, if the XML parse succeeds, then instance data replacement is performed according to
the rules specified in <a href="#submit-data-replacement"><b>11.10 Replacing Data with the Submission Response</b></a>. This operation may fail for a number of reasons, including
if processing of the <code>targetref</code> attribute yields a readonly node (if <code>replace="text"</code>) or a node that either has a readonly parent
or is not an element (if <code>replace="instance"</code>).
In this case, submission ends after dispatching event <code>xforms-submit-error</code> with appropriate
context information, including an <code>error-type</code> of <code>target-error</code>. Otherwise, the instance data replacement succeeds.
Submission processing then concludes after dispatching <code>xforms-submit-done</code> with appropriate context information.</p></li><li><p>For a success response including a body of a non-XML media type (i.e. with a content type not matching any of the specifiers in <a href="#ref-rfc-3023">[RFC 3023]</a>),
when the value of the <code>replace</code> attribute on element <code>submission</code> is "<code>instance</code>", nothing in the document is replaced and submission
processing concludes after dispatching <code>xforms-submit-error</code>
with appropriate context information, including an <code>error-type</code> of <code>resource-error</code>.</p></li><li><p>For a success response including a body of an XML media type (as defined by the content type specifiers in <a href="#ref-rfc-3023">[RFC 3023]</a>)
or a text media type (as defined by a content type of <code>text/*</code>), when the value of the <code>replace</code> attribute on element <code>submission</code>
is "<code>text</code>", the response is encoded as text. Then, the content replacement is performed according to the rules
specified in <a href="#submit-data-replacement"><b>11.10 Replacing Data with the Submission Response</b></a>.
If the processing of the <code>targetref</code> attribute (including its default) fails, then the submission processing
concludes after dispatching <code>xforms-submit-error</code> with appropriate context information, including an <code>error-type</code> of <code>target-error</code>.
Otherwise, submission processing then concludes after dispatching <code>xforms-submit-done</code> with appropriate context information.</p></li><li><p>For a success response including a body that is both a non-XML media type (i.e. with a content type not matching any of the specifiers in <a href="#ref-rfc-3023">[RFC 3023]</a>)
and a non-text type (i.e. with a content type not matching <code>text/*</code>),
when the value of the <code>replace</code> attribute on element <code>submission</code> is "<code>text</code>", nothing in the document is replaced and submission
processing concludes after dispatching <code>xforms-submit-error</code>
with appropriate context information, including an <code>error-type</code> of <code>resource-error</code>.</p></li><li><p>For a success response including a body, when the value of the <code>replace</code> attribute on element
<code>submission</code> is "<code>none</code>", submission
processing concludes after dispatching <code>xforms-submit-done</code> with appropriate context information.</p></li><li><p>For a success response not including a body, submission processing concludes after dispatching
<code>xforms-submit-done</code> with appropriate context information.</p></li><li><p>Behaviors of other possible values for attribute <code>replace</code> are not defined in this specification.</p></li><li><p>For an error response, when the value of the <code>replace</code> attribute on element <code>submission</code> is "<code>all</code>",
either the document is replaced with an implementation-specific indication of an error or
submission processing concludes after dispatching <code>xforms-submit-error</code>
with appropriate context information, including an <code>error-type</code> of <code>resource-error</code>.</p></li><li><p>For an error response, when the value of the <code>replace</code> attribute on element <code>submission</code> is not "<code>all</code>",
nothing in the document is replaced, and submission processing concludes after dispatching <code>xforms-submit-error</code>
with appropriate context information, including an <code>error-type</code> of <code>resource-error</code>.</p></li></ul><p>In addition to initiating a submission with its default processing, XForms actions can also provide handlers for the <code>xforms-submit</code> event to peform tasks such as data preparation.</p><p>Example: </p><div class="exampleOuter">
<div class="exampleHead">Preparing data for submission</div><div class="exampleInner"><pre><submission resource="http://example.com/searchDoctors" method="post" ref="instance('doctorSearchParams')"
replace="instance" targetref="instance('doctorList')" >
<action ev:event="xforms-submit">
<setvalue ref="diagnosis" value="instance('patientRecord')/malady"/>
<setvalue ref="city" value="instance('patientRecord')/city"/>
</action>
</submission></pre></div><p>The schema for the doctor search service requires certain portions of the patient record in order to provide a list of specialists who could treat the patient. The server-side module may perform database searches for doctors with the required specialties as well as implement business rules such as providing doctors that are within an acceptable distance of the given city. The resulting list is provided to a separate instance so it can be presented to the user for selection or used in subsequent availability searches.</p></div></div><div class="div2">
<h3><a name="submit-evt-submit-serialize" id="submit-evt-submit-serialize"></a>11.3 The xforms-submit-serialize Event</h3><p>Dispatched at the beginning of <code>submission</code> serialization (see <a href="#submit-evt-submit"><b>11.2 The xforms-submit Event</b></a>).</p><p>Target: <code>submission</code>
</p><p>Bubbles: Yes</p><p>Cancelable: No</p><p>Context Info:</p><table border="1" summary="Event context properties for xforms-compute-exception event"><tbody><tr><th rowspan="1" colspan="1">Property</th><th rowspan="1" colspan="1">Type</th><th rowspan="1" colspan="1">Value</th></tr><tr><td rowspan="1" colspan="1">submission-body</td><td rowspan="1" colspan="1">node-set</td><td rowspan="1" colspan="1">A document element node with a QName of <code>submission-body</code>. The node initially contains an empty string. Event handlers can write data into the node. If the string value of this node is non-empty, then the string value is used in the submission in lieu of the default instance data serialization.</td></tr></tbody></table><div class="note"><p class="prefix"><b>Note:</b></p><p>The <code>submission-body</code> property is a string, but the <code>event()</code> function encapsulates
the string in a text node so that the string can be modified by the <code>setvalue</code> action,
which sets a value into a node determined by its Single Node Binding.</p></div><div class="note"><p class="prefix"><b>Note:</b></p><p>Since the <code>submission-body</code> is a string, this feature may be used to submit non-XML data.</p></div><p>Default Action: If the event context <code>submission-body</code> property string is empty, then no operation is performed so that the <code>submission</code> will use the normal serialization data
(see <a href="#submit-evt-submit"><b>11.2 The xforms-submit Event</b></a>).
Otherwise, if the event context <code>submission-body</code> property string is non-empty, then the serialization data for the <code>submission</code> is set to be the content of the <code>submission-body</code> string.</p><p>Example: </p><div class="exampleOuter">
<div class="exampleHead">Submitting plain text</div><div class="exampleInner"><pre><submission resource="http://example.com/greeter" method="post" mediatype="text/plain">
<setvalue ev:event="xforms-submit-serialize" ref="event('submission-body')" value="my/text"/>
</submission></pre></div><p>The string value of the element <code>my/text</code> is placed into the node representing the submission body, so that is the text posted by the submission. In this example, the result returned by the submission replaces the document. This feature could be used to submit plain text, but it could also be used to allow a document to submit its serialization rather than just submitting instance data.</p></div></div><div class="div2">
<h3><a name="submit-evt-submit-done" id="submit-evt-submit-done"></a>11.4 The xforms-submit-done Event</h3><p>Dispatched as an indication of: successful completion of a submission process</p><p>Target: <code>submission</code></p><p>Bubbles: Yes</p><p>Cancelable: No</p><p>Context Info: </p><table border="1" summary="Event context properties for xforms-submit-done event"><tbody><tr><th rowspan="1" colspan="1">Property</th><th rowspan="1" colspan="1">Type</th><th rowspan="1" colspan="1">Value</th></tr><tr><td rowspan="1" colspan="1">resource-uri</td><td rowspan="1" colspan="1">string</td><td rowspan="1" colspan="1">The submission resource URI that succeeded (xsd:anyURI)</td></tr><tr><td rowspan="1" colspan="1">response-status-code</td><td rowspan="1" colspan="1">number</td><td rowspan="1" colspan="1">The protocol return code of the success response, or <code>NaN</code> if the submission did not receive a success response.</td></tr><tr><td rowspan="1" colspan="1">response-headers</td><td rowspan="1" colspan="1">node-set</td><td rowspan="1" colspan="1">Zero or more elements, each one representing a content header in the success response received by the submission. The returned node-set is empty if the submission did not receive a response or if there were no headers. Each element has a local name of <code>header</code> with no namespace URI and two child elements, <code>name</code> and <code>value</code>, whose string contents are the name and value of the header, respectively.</td></tr><tr><td rowspan="1" colspan="1">response-reason-phrase</td><td rowspan="1" colspan="1">string</td><td rowspan="1" colspan="1">The protocol response reason phrase of the success response. The string is empty if the submission did not receive a response or if the response did not contain a reason phrase.</td></tr></tbody></table><p>Default Action: None; notification event only.</p><p>Example: </p><div class="exampleOuter">
<div class="exampleHead">Submission Sequencing</div><div class="exampleInner"><pre><submission resource="https://example.com/getRecord" method="post" replace="instance" instance="record">
<send ev:event="xforms-submit-done" submission="chargeForRecord"/>
</submission>
<submission id="chargeForRecord" resource="https://example.com/chargeForRecord" method="get" serialization="none" replace="none"/>
</pre></div><p>The default instance data is submitted as the search criteria for a desired record. Only upon successful completion of the submission is a
second submission performed to charge the user's account for the record.</p></div></div><div class="div2">
<h3><a name="submit-evt-submit-error" id="submit-evt-submit-error"></a>11.5 The xforms-submit-error Event</h3><p>Dispatched as an indication of: failure of a submission process</p><p>Target: <code>submission</code></p><p>Bubbles: Yes</p><p>Cancelable: No</p><p>Context Info:</p><table border="1" summary="Event context properties for xforms-submit-error event"><tbody><tr><th rowspan="1" colspan="1">Property</th><th rowspan="1" colspan="1">Type</th><th rowspan="1" colspan="1">Value</th></tr><tr><td rowspan="1" colspan="1">error-type</td><td rowspan="1" colspan="1">string</td><td rowspan="1" colspan="1">One of the following: <code>submission-in-progress</code>, <code>no-data</code>, <code>validation-error</code>, <code>parse-error</code>, <code>resource-error</code>, <code>target-error</code>.</td></tr><tr><td rowspan="1" colspan="1">resource-uri</td><td rowspan="1" colspan="1">string</td><td rowspan="1" colspan="1">The submission resource URI that failed (xsd:anyURI)</td></tr><tr><td rowspan="1" colspan="1">response-status-code</td><td rowspan="1" colspan="1">number</td><td rowspan="1" colspan="1">The protocol return code of the error response, or <code>NaN</code> if the failed submission did not receive an error response.</td></tr><tr><td rowspan="1" colspan="1">response-headers</td><td rowspan="1" colspan="1">node-set</td><td rowspan="1" colspan="1">Zero or more elements, each one representing a content header in the error response received by a failed submission. The returned node-set is empty if the failed submission did not receive an error response or if there were no headers. Each element has a local name of <code>header</code> with no namespace URI and two child elements, <code>name</code> and <code>value</code>, whose string contents are the name and value of the header, respectively.</td></tr><tr><td rowspan="1" colspan="1">response-reason-phrase</td><td rowspan="1" colspan="1">string</td><td rowspan="1" colspan="1">The protocol response reason phrase of the error response. The string is empty if the failed submission did not receive an error response or if the error response did not contain a reason phrase.</td></tr><tr><td rowspan="1" colspan="1">response-body</td><td rowspan="1" colspan="1">object (string or node-set)</td><td rowspan="1" colspan="1">
When the error response specifies an XML media type as defined by <a href="#ref-rfc-3023">[RFC 3023]</a>,
the response body is parsed into
an XML document and the root element of the document is returned. If the parse fails, or if the error response
specifies a text media type (starting with <code>text/</code>), then the response body is returned as a
string. Otherwise, an empty string is returned.
</td></tr></tbody></table><p>Default Action: None; notification event only.</p><p>Example: </p><div class="exampleOuter">
<div class="exampleHead">Reporting a Submission Error</div><div class="exampleInner"><pre><submission resource="https://example.com/getRecord" method="post" replace="instance" instance="record">
<message ev:event="xforms-submit-error">A submission error (<output value="event('error-type')"/>) occurred.</message>
</submission>
</pre></div><p>The default instance data is submitted as the search criteria for a desired record. Only upon successful completion of the submission is a
second submission performed to charge the user's account for the record.</p></div></div><div class="div2">
<h3><a name="submit-resource" id="submit-resource"></a>11.6 The Submission Resource</h3><p>The <code>submission resource</code> is the URI for the submission. It is of type <code>xsd:anyURI</code>.</p><p>In XForms 1.0, the URI for submission was provided by the <code>action</code> attribute. For consistency, form authors should now
use the attribute <code>resource</code> of type <code>xsd:anyURI</code>, which deprecates the <code>action</code> attribute.
If both <code>action</code> and <code>resource</code> are present, then the <code>resource</code> attribute takes precedence.</p><p>The <code>resource</code> element provides the submission URI, overriding
the <code>resource</code> attribute and the <code>action</code> attribute. If a <code>submission</code> has more than one <code>resource</code> child element, the
first <code>resource</code> element child must be selected for use. Individually, the <code>resource</code> element, the <code>resource</code> attribute and
the <code>action</code> attribute are not required. However, one of the three is mandatory as there is no default submission resource. </p><div class="div3">
<h4><a name="submit-resource-elem" id="submit-resource-elem"></a>11.6.1 The resource Element</h4><p>The <code>resource</code> element allows the URI used for a submission to be dynamically calculated based on instance data. </p><p>Common Attributes: None</p><p>Special Attributes:</p><dl><dt class="label">value</dt><dd><p>Author-optional attribute containing an XPath expression to evaluate using the in-scope evaluation context. To obtain the
URI, the result of the expression is processed as if by call to the XPath <code>string</code> function.
An empty string is used if the XPath evaluation fails.
</p></dd></dl><p>Content: PCDATA</p><p>The URI to be used by the <code>submission</code> can be specified with either the <code>value</code> attribute or
the string content of the <code>resource</code> element. If both are specified, then the <code>value</code> attribute takes precedence.
If the <code>submission</code> does not have a <code>resource</code> child element,
then the submission URI is obtained from the <code>resource</code> attribute or the <code>action</code> attribute.</p><p>Example: </p><div class="exampleOuter">
<div class="exampleHead">Submitting the default instance to a location determined dynamically from an instance</div><div class="exampleInner"><pre><submission method="post">
<resource value="instance('params')/anyURI"/>
</submission></pre></div></div></div></div><div class="div2">
<h3><a name="submit-method" id="submit-method"></a>11.7 The Submission Method</h3><p>The <code>submission method</code> indicates the submission protocol operation to be performed.</p><p>The submission method may be specified by the <code>method</code> attribute. The <code>submission</code> element can
have a child element named <code>method</code>, which overrides the submission method setting obtained from the <code>method</code> attribute
if both are specified. If more than one <code>method</code> element is given, the first
occurrence in document order must be selected for use.
Individually, the <code>method</code> element and the <code>method</code> attribute are not required. However, one of the
two is mandatory as there is no default submission method.</p><div class="div3">
<h4><a name="submit-method-elem" id="submit-method-elem"></a>11.7.1 The method Element</h4><p>The <code>method</code> element allows the submission method to be dynamically calculated based on instance data.</p><p>Common Attributes: None</p><p>Special Attributes:</p><dl><dt class="label">value</dt><dd><p>Author-optional attribute containing an XPath expression to evaluate using the in-scope evaluation context. To obtain the
method, the result of the expression is processed as if by call to the XPath <code>string</code> function.
An empty string is used if the XPath evaluation fails.
</p></dd></dl><p>Content: PCDATA</p><p>The method to be used by the <code>submission</code> can be specified with either the <code>value</code> attribute or
the string content of the <code>method</code> element. If both are specified, then the <code>value</code> attribute takes precedence.
If the <code>submission</code> does not have a <code>method</code> child element, then the submission method is obtained from
the <code>method</code> attribute.</p></div></div><div class="div2">
<h3><a name="submit-header" id="submit-header"></a>11.8 The header Element</h3><p>The <code>header</code> element can be used to contribute information to the preamble of a submission in a
manner appropriate to the protocol. The <code>submission</code> element can contain zero or more <code>header</code> child elements.
Each produces zero or more header entries containing a name, a value, and a combination. The entries
are provided to the submission protocol in the specified order. It is the responsibility of the submission protocol implementation
to combine the entries and to serialize the result into submission protocol headers. Accordingly, entries may be re-ordered,
combined, or otherwise altered in accordance with the specific protocol implementation requirements.
</p><p>Common Attributes: None</p><p>Special Attributes:</p><dl><dt class="label">nodeset</dt><dd><p>Author-optional attribute containing an XPath expression to evaluate using the in-scope evaluation context.
One or more header entries are
generated for each node selected by this attribute.</p></dd><dt class="label">combine</dt><dd><p>Author-optional attribute defaulting to "append" and with legal values of "append", "prepend", and "replace".
This attribute controls the method of combination for entries produced by this element <code>header</code>
with other entries produced by other <code>header</code> elements. This attribute and its default also provide information for the protocol implementation, which may use some or all of the information to combine XForms submission headers with headers provided by the user agent.</p></dd></dl><p>Content: (<code>name</code>, <code>value</code>+) |
(<code>value</code>+, <code>name</code>) </p><p>If the <code>header</code> element does not contain a <code>nodeset</code> attribute, then one header
entry is created for each <code>value</code> element.
If the <code>header</code> element contains a <code>nodeset</code> attribute, then for each
selected node, one header entry is created for each <code>value</code> element.
The name and value of the header entry are obtained from the required child elements
<code>name</code> (<a href="#submit-header-name"><b>11.8.1 The name Element</b></a>) and <code>value</code> (<a href="#submit-header-value"><b>11.8.2 The value Element</b></a>).
If the name obtained from the <code>name</code> element is the empty string, then the header entry is
omitted.</p><p>
The header entry order is determined as follows:</p><ol class="enumar"><li><p>document order of <code>header</code> elements</p></li><li><p>node order of nodes in <code>nodeset</code> attribute</p></li><li><p>document order of <code>value</code> elements</p></li></ol><p>The application of this order information to header serialization is determined by the submission protocol.</p><p>If a <code>header</code> element defines the <code>Content-type</code> header, then this setting overrides a
<code>Content-type</code> set by the <code>mediatype</code> attribute.</p><p>In the case of a multipart submission, the header entries are
combined with those for the first part of the submission.</p><p>Example: </p><div class="exampleOuter">
<div class="exampleHead">Setting the Accept header</div><p>In the example below, the submission request uses the <code>header</code> element to replace the user agent's existing value of the HTTP Accept header with <code>application/sparql-results+xml</code>.</p><div class="exampleInner"><pre><submission id="loadConcepts"
resource="http://example.com/taxonomy/concepts" method="get"
ref="instance('conceptsList')" replace="instance">
<header combine="replace">
<name>Accept</name>
<value>application/sparql-results+xml</value>
</header>
</submission></pre></div></div><div class="div3">
<h4><a name="submit-header-name" id="submit-header-name"></a>11.8.1 The name Element</h4><p>When the <code>name</code> element appears as a child of element <code>header</code>, it is used to specify the name of a header
entry to be provided to the submission protocol.
</p><p>Common Attributes: None</p><p>Special Attributes:</p><dl><dt class="label">value</dt><dd><p>Author-optional attribute containing an XPath expression to evaluate using the in-scope evaluation context.
To obtain the header name, the result of the expression is processed as if by call to the XPath <code>string</code> function.
An empty string is used if the XPath evaluation fails.
</p></dd></dl><p>The header entry name may be given by the string content of the <code>name</code> element,
or by the result of the <code>value</code> attribute. If both are given, the result from the <code>value</code> attribute takes
precedence. If the resulting name is the empty string, then the
entry is considered to be void, and it is not
supplied to the submission protocol.</p></div><div class="div3">
<h4><a name="submit-header-value" id="submit-header-value"></a>11.8.2 The value Element</h4><p>When the <code>value</code> element appears as a child of element <code>header</code>, it is used to specify the value component
of a header entry to be supplied to the submission protocol
to be added to the preamble of a submission. The <code>value</code> element may be used more than once
in a given element <code>header</code>, in which case each value produces a new header entry.</p><p>Common Attributes: None</p><p>Special Attributes:</p><dl><dt class="label">value</dt><dd><p>Author-optional attribute containing an XPath expression to evaluate using the in-scope evaluation context.
To obtain the header entry value, the result of the expression is processed
as if by call to the XPath <code>string</code> function. An empty string is used if the XPath evaluation fails.
</p></dd></dl><p>The header entry value may be given by the string content of the <code>value</code> element,
or by the result of the <code>value</code> attribute. If both are given, the result from the <code>value</code> attribute
takes precedence. </p><div class="note"><p class="prefix"><b>Note:</b></p><p>
The XPath <code>string</code> function combines multiple nodes by concatenating them into a string separated with spaces.
As a result, a header value specified by a <code>value</code> element nodeset containing multiple nodes may not be
properly serialized in a submission protocol preamble. To assure proper delivery of individual header items
to the submission protocol, restrict use of XPath expressions producing nodesets for element <code>header</code>
with attribute <code>nodeset</code>, where each node will produce its own separate header entry, and use expressions
resulting in only a single node in element <code>value</code>.
</p></div></div></div><div class="div2">
<h3><a name="submit-options" id="submit-options"></a>11.9 Submission Options</h3><p>The XForms Model specifies a <code>submission</code> element containing the following attributes and child elements
that affect serialization and submission.
This section summarizes the behaviors for the allowable values of these attributes and child elements,
and presents subsections that define the behavior for submission and serialization. </p><ul><li><p>the <a title="" href="#submit-resource">submission resource</a></p></li><li><p>the <a title="" href="#submit-method">submission method</a></p></li><li><p>the <code>header</code> elements</p></li></ul><p>For the submission protocol obtained from the URI scheme in the <a title="" href="#submit-resource">submission resource</a>,
XForms normatively defines a binding to HTTP/1.1 <a href="#ref-rfc-2616">[RFC 2616]</a>.</p><div class="note"><p class="prefix"><b>Note:</b></p><p>Other bindings, in particular to the URI scheme "mailto:" may, and the schemes "https:" and "file:" should, be supported. Bindings to these schemes are not normatively defined in XForms. Implementations that choose to provide a binding to these schemes should pay particular attention to privacy and security concerns. Within the "http:" and "https:" schemes, form creators are encouraged to follow the finding of the W3C Technical Architecture Group on when to use the GET method: <a href="#ref-tag7">[TAG Finding 7]</a></p></div><p>The <a title="" href="#submit-method">submission method</a> determines the default data serialization format, and both the <a title="" href="#submit-method">submission method</a> and the URI scheme in the <a title="" href="#submit-resource">submission resource</a> determine the submission protocol operation, according to the following table:</p><table border="1" summary="Form Serialization and Submission Behaviors"><thead><tr><th rowspan="1" colspan="1">URI scheme</th><th rowspan="1" colspan="1"><a title="" href="#submit-method">Submission Method</a></th><th rowspan="1" colspan="1">Default Serialization</th><th rowspan="1" colspan="1">Submission Protocol Operation</th></tr></thead><tbody><tr><td rowspan="1" colspan="1">http https mailto</td><td rowspan="1" colspan="1">"post"</td><td rowspan="1" colspan="1"><code>application/xml</code></td><td rowspan="1" colspan="1">HTTP POST or equivalent</td></tr><tr><td rowspan="1" colspan="1">http https file</td><td rowspan="1" colspan="1">"get"</td><td rowspan="1" colspan="1"><code>application/x-www-form-urlencoded</code></td><td rowspan="1" colspan="1">HTTP GET or equivalent</td></tr><tr><td rowspan="1" colspan="1">http https file</td><td rowspan="1" colspan="1">"delete"</td><td rowspan="1" colspan="1"><code>application/x-www-form-urlencoded</code></td><td rowspan="1" colspan="1">HTTP DELETE or equivalent</td></tr><tr><td rowspan="1" colspan="1">http https file</td><td rowspan="1" colspan="1">"put"</td><td rowspan="1" colspan="1"><code>application/xml</code></td><td rowspan="1" colspan="1">HTTP PUT or equivalent</td></tr><tr><td rowspan="1" colspan="1">http https mailto</td><td rowspan="1" colspan="1">"multipart-post"</td><td rowspan="1" colspan="1"><code>multipart/related</code></td><td rowspan="1" colspan="1">HTTP POST or equivalent</td></tr><tr><td rowspan="1" colspan="1">http https mailto</td><td rowspan="1" colspan="1">"form-data-post"</td><td rowspan="1" colspan="1"><code>multipart/form-data</code></td><td rowspan="1" colspan="1">HTTP POST or equivalent</td></tr><tr><td rowspan="1" colspan="1">http https mailto</td><td rowspan="1" colspan="1">"urlencoded-post"</td><td rowspan="1" colspan="1"><code>application/x-www-form-urlencoded</code></td><td rowspan="1" colspan="1">HTTP POST or equivalent</td></tr><tr><td rowspan="1" colspan="1">(any)</td><td rowspan="1" colspan="1">Any other <a href="http://www.w3.org/TR/REC-xml-names/#NT-NCName">NCName</a></td><td rowspan="1" colspan="1"><code>application/xml</code></td><td rowspan="1" colspan="1">As given by the <a title="" href="#submit-method">Submission Method</a></td></tr><tr><td rowspan="1" colspan="1">(any)</td><td rowspan="1" colspan="1"><a title="QNameButNotNCName" href="#def-QNameButNotNCName">QNameButNotNCName</a></td><td rowspan="1" colspan="1">implementation-defined</td><td rowspan="1" colspan="1">implementation-defined</td></tr></tbody></table><div class="note"><p class="prefix"><b>Note:</b></p><p>Foreign-namespaced attribute values are allowed in the <a title="" href="#submit-method">Submission Method</a>, but no behavior is defined by XForms.</p></div><div class="div3">
<h4><a name="submit-get" id="submit-get"></a>11.9.1 The get Submission Method</h4><p>This submit method represents HTTP GET or the equivalent concept. The serialized form data is delivered as part of the URI that is requested during the submit process.</p><p>This method is not suitable for submission of forms that are intended to change state or cause other actions to take place at the server. See <a href="#ref-rfc-2616">[RFC 2616]</a> for recommended uses of HTTP GET.</p><p>The URI is constructed as follows:</p><ul><li><p>The submit URI is examined. If it does not already contain a <code>?</code> (question mark) character, one is appended. If it does already contain a question mark character and the serialized form data is non-empty, then a separator character from the attribute <code>separator</code> is appended.</p></li><li><p>The serialized form data, if any, is appended to the URI.</p></li></ul><p>No message body is sent with the request.</p><p>Examples: </p><div class="exampleOuter">
<div class="exampleHead">Simple search submission</div><div class="exampleInner"><pre><submission resource="http://example.com/search" method="get"/></pre></div><p>After doing relevance and validity checking on the data, the leaf nodes
of the default instance are submitted asynchronously, encoded as a URL
(<code>application/x-www-form-urlencoded</code>), to <code>http://example.com/search</code>.
The result replaces the whole page.</p></div><div class="exampleOuter">
<div class="exampleHead">Reading from a local file</div><div class="exampleInner"><pre><submission resource="file:data.xml" method="get" serialization="none" replace="instance" instance="data" /></pre></div><p>Replaces the instance 'data' with the content of the file data.xml. Serialization, and its associated validity and relevance processing, is not needed.
See the corresponding example for saving a file in Section <a href="#submit-put"><b>11.9.3 The put Submission Method</b></a>.
The user agent may restrict file access to a user-specific and domain-specific security zone in local storage.</p></div></div><div class="div3">
<h4><a name="submit-post" id="submit-post"></a>11.9.2 The post, multipart-post, form-data-post, and urlencoded-post Submission Methods</h4><p>These submit methods represent HTTP POST or the equivalent concept (such as a mail message). The serialized form data is delivered as the message body.</p><p>Examples:</p><div class="exampleOuter">
<div class="exampleHead">Posting instance data</div><div class="exampleInner"><pre><submission resource="https://example.com/jsp/orders" method="post" ref="/purchaseOrder" /></pre></div><p>Submits the XML for a purchase order to a secure server order processing system.</p></div><div class="exampleOuter">
<div class="exampleHead">Simple posted login</div><div class="exampleInner"><pre><submission resource="http://example.com/login" method="urlencoded-post"/></pre></div><p>After doing relevance pruning and validity checking on the login data, the leaf nodes
of the default instance are submitted asynchronously in the posted data, encoded based on the
<code>application/x-www-form-urlencoded</code> serialization, to <code>http://example.com/login</code>.
The result replaces the whole page.</p></div></div><div class="div3">
<h4><a name="submit-put" id="submit-put"></a>11.9.3 The put Submission Method</h4><p>This submit method represents HTTP PUT or the equivalent concept (such as writing to a local file). The serialized form data is delivered as the message body.</p><p>Example:</p><div class="exampleOuter">
<div class="exampleHead">Saving to a local file</div><div class="exampleInner"><pre><submission resource="file:data.xml" ref="instance('data')" method="put" validate="false" relevant="false" replace="none" /></pre></div><p>Saves the instance 'data' to the file data.xml without validation checking and relevance pruning.
See the corresponding example for reading from a local file in Section <a href="#submit-get"><b>11.9.1 The get Submission Method</b></a>.
The user agent may restrict file access to a user-specific and domain-specific security zone in local storage.</p></div></div><div class="div3">
<h4><a name="submit-delete" id="submit-delete"></a>11.9.4 The delete Submission Method</h4><p>This submit method represents HTTP DELETE or the equivalent concept (such as deleting a local file). The serialized form data is delivered in the same manner as
the <a title="" href="#submit-get">get</a> submission method (see <a href="#submit-get"><b>11.9.1 The get Submission Method</b></a>).</p></div><div class="div3">
<h4><a name="serialize-xml" id="serialize-xml"></a>11.9.5 Serialization as application/xml</h4><p>This format permits the expression of the instance data as XML that is straightforward to process with off-the-shelf XML processing tools. In addition, this format is capable of submission of binary content.</p><p>The steps for serialization are as follows:</p><ol class="enumar"><li><p>An XML document is produced following the rules of the XML output method defined in <a href="#ref-xslt">[XSLT 1.0]</a> section 16 and 16.1, using the values supplied as attributes of the <code>submission</code> element.</p><ol class="enumla"><li><p>Handling of namespace nodes: The default behavior is that every namespace node is serialized according to the rules of the XML output method, so that at least one namespace declaration appears in the serialized XML for each in-scope namespace. Additional inherited namespaces are declared on the root element of the serialized XML. If, however, attribute <code>includenamespaceprefixes</code> on element <code>submission</code> is present, then all namespace declarations not visibly utilized in the instance data (as defined in <a href="#ref-Exc-C14N">[Exc-C14N]</a>) and the default namespace if it is empty are excluded from the root element serialization, unless the corresponding namespace prefix is listed in the <code>includenamespaceprefixes</code> attribute. The special value <code>#default</code> represents the default namespace. </p></li><li><p>Mediatype: By default, the mediatype of the serialized XML instance is <code>application/xml</code>, but can be changed to a compatible type using element <code>submission</code> attribute <code>mediatype</code>. Authors should ensure that the type specified is compatible with <code>application/xml</code>.</p></li></ol></li></ol></div><div class="div3">
<h4><a name="serialize-multipart" id="serialize-multipart"></a>11.9.6 Serialization as multipart/related</h4><p>This format is intended for integration of XForms into environments that involve large amounts of binary data where the inclusion of the data as <code>xsd:base64Binary</code> or <code>xsd:hexBinary</code> is undesirable.</p><p>In this format, XML instance data is serialized as one part of the <a href="#ref-rfc-2387">[RFC 2387]</a> <code>multipart/related</code> message, using the rules as described in <a href="#serialize-xml"><b>11.9.5 Serialization as application/xml</b></a>. Binary content from <code>xsd:anyURI</code> instance nodes populated by the <code>upload</code> (see <a href="#ui-upload"><b>8.1.6 The upload Element</b></a>) control is serialized in separate parts of the <a href="#ref-rfc-2387">[RFC 2387]</a> <code>multipart/related</code> message.</p><p>This format follows the rules of <code>multipart/related</code> MIME data streams for in <a href="#ref-rfc-2387">[RFC 2387]</a>, with specific requirements of this serialization listed below:</p><ul><li><p><code>multipart/related</code> message header requirements:</p><ul><li><p>Must contain a <code>type</code> parameter of the mediatype of the serialized XML instance.</p></li><li><p>Must contain a <code>start</code> parameter referring to the Content-ID first body part (root).</p></li></ul></li><li><p>First body part (root) requirements:</p><ul><li><p>Must have <code>Content-Type</code> parameter of the type specified by the <code>submission</code> <code>mediatype</code> attribute.</p></li><li><p>Content is serialized by the rules at <a href="#serialize-xml"><b>11.9.5 Serialization as application/xml</b></a>.</p></li></ul></li><li><p>Subsequent part requirements:</p><ul><li><p>One part for each node with a datatype of <code>xsd:anyURI</code> populated by <code>upload</code> with:</p><ul><li><p>A <code>Content-Type</code> header that represents the type of the attachment if known, otherwise <code>application/octet-stream</code>.</p></li><li><p>A <code>Content-Transfer-Encoding</code> header.</p></li><li><p>A <code>Content-ID</code> header whose value matches the URI in the associated instance data node.</p></li><li><p>The binary content associated with the URI, serialized according to the <code>Content-Transfer-Encoding</code> heading.</p></li></ul></li></ul></li></ul><div class="exampleOuter">
<div class="exampleHead">multipart/related</div><div class="exampleInner"><pre><submission method="multipart-post" resource="http://example.com/photo" /></pre></div><p>Submits the instance data in <code>multipart/related</code>, along with the selected file as an attachment.</p><div class="exampleInner"><pre>POST /photo HTTP/1.0
Host: example.com
Content-Type: multipart/related; boundary=f93dcbA3; type=application/xml; start="<980119.X53GGT@example.com>"
Content-Length: xxx
--f93dcbA3
Content-Type: application/xml; charset=UTF-8
Content-ID: <980119.X53GGT@example.com>
<?xml version="1.0"?>
<uploadDocument>
<title>My Proposal</title>
<author>E. X. Ample</author>
<summary>A proposal for a new project.</summary>
<notes image="cid:980119.X17AXM@example.com">(see handwritten region)</notes>
<keywords>project proposal funding</keywords>
<readonly>false</readonly>
<filename>image.png</filename>
<content>cid:980119.X25MNC@example.com</content>
</uploadDocument>
--f93dcbA3
Content-Type: image/png
Content-Transfer-Encoding: binary
Content-ID: <980119.X25MNC@example.com>
...Binary data here...
--f93dcbA3
Content-Type: image/png
Content-Transfer-Encoding: binary
Content-ID: <980119.X17AXM@example.com>
...Binary data here...
--f93dcbA3--</pre></div></div></div><div class="div3">
<h4><a name="serialize-form-data" id="serialize-form-data"></a>11.9.7 Serialization as multipart/form-data</h4><p>This format is for legacy compatibility to permit the use of XForms clients with <a href="#ref-rfc-2388">[RFC 2388]</a> servers. This method is suitable for the persistence of binary content. Contextual path information, attribute values, namespaces and namespace prefixes are not preserved. As a result, different elements might serialize to the same name.</p><div class="note"><p class="prefix"><b>Note:</b></p><p>Existing HTML user agents fail to encode special characters (such as double quotes) and non-ASCII characters in the <code>Content-Disposition: form-data</code> <code>name</code> and <code>filename</code> parameters. Since this serialization method is supported for legacy applications only, new applications should use <code>application/xml</code> or <code>multipart/related</code>. </p></div><p>This format follows the rules for <code>multipart/form-data</code> MIME data streams in <a href="#ref-rfc-2388">[RFC 2388]</a>, with specific requirements of this serialization listed below:</p><ul><li><p>Each element node is visited in document order, except non-relevant elements are skipped if the <code>relevant</code> setting of the <code>submission</code> is <code>true</code>.</p></li><li><p>Each visited element that has no child element nodes (i.e., each leaf element node) is selected for inclusion, including those that have no value (no text node).</p></li><li><p>Element nodes selected for inclusion are encoded as <code>Content-Disposition: form-data</code> MIME parts as defined in <a href="#ref-rfc-2388">[RFC 2388]</a>, with the <code>name</code> parameter being the element local name.</p></li><li><p>Element nodes of any datatype populated by <code>upload</code> also have a <code>Content-Disposition</code> <code>filename</code> parameter, if the filename is available. </p></li><li><p>Element nodes of any datatype populated by <code>upload</code> are serialized as the specified binary content. In the case of <code>xsd:anyURI</code>
and derived types, the serialization content is obtained from the URI. For <code>xsd:base64Binary</code>, <code>xsd:hexBinary</code>, and derived types, the serialization content is obtained by decoding the element string value.</p></li><li><p>Element nodes of any datatype not populated by <code>upload</code> are serialized as the string value of the element (the concatenation of all text node children, or empty string if the element has no text node children).</p></li><li><p>The <code>Content-Type</code> must be <code>text/plain</code> except for <code>xsd:anyURI</code>, <code>xsd:base64Binary</code>, <code>xsd:hexBinary</code>, and derived types, in which case the header represents the media type of the attachment if known, otherwise <code>application/octet-stream</code>. If a character set is applicable, the <code>Content-Type</code> may have a <code>charset</code> parameter.</p></li></ul><p>Example:</p><div class="exampleOuter">
<div class="exampleHead">multipart/form-data</div><div class="exampleInner"><pre><submission method="form-data-post" resource="http://example.com/photo" /></pre></div><p>Submits the instance data in <code>multipart/form-data</code>, along with the selected file as a part.</p><div class="exampleInner"><pre>POST /photo HTTP/1.0
Host: example.com
Content-Type: multipart/form-data; boundary=AaB03x
Content-Length: xxx
--AaB03x
Content-Disposition: form-data; name="document"; filename="b.txt"
Content-Type: text/plain; charset=iso-8859-1
This is a file.
It has two lines.
--AaB03x
Content-Disposition: form-data; name="title"
A File
--AaB03x
Content-Disposition: form-data; name="summary"
This is my file
file test
--AaB03x--</pre></div></div></div><div class="div3">
<h4><a name="serialize-urlencode" id="serialize-urlencode"></a>11.9.8 Serialization as application/x-www-form-urlencoded</h4><p>This format represents an extension of the <a href="#ref-xhtml-1.0">[XHTML 1.0]</a> form content type <code>application/x-www-form-urlencoded</code> with specific rules for encoding non-ASCII and reserved characters.</p><p>This format is not suitable for the persistence of binary content. Therefore, it is recommended that forms capable of containing binary content use another serialization method.</p><p>The steps for serialization are as follows:</p><ol class="enumar"><li><p>Each element node is visited in document order, except non-relevant elements are skipped if the <code>relevant</code> setting of the <code>submission</code> is <code>true</code>. Each visited element that has no child element nodes (i.e., each leaf element node) is selected for inclusion, including those that have no value (no text node).
Note that attribute information is not preserved.</p></li><li><p>Element nodes selected for inclusion are encoded as <code>EltName=value</code>, where <code>=</code> is a literal character, <code>EltName</code> represents the element local name, and <code>value</code> represents the string value of the element (the concatenation of all text node children, or empty string if the element has no text node children). The separator character {sep} from the <code>separator</code> attribute on <code>submission</code> is used between pairs of encoded name/value pairs, e.g. <code>EltName1=value1{sep}EltName2=value2{sep}EltName3=value3</code>. Note that contextual path information is not preserved, nor are namespaces or namespace prefixes. As a result, different elements might serialize to the same name.</p><ul><li><p>The encoding of <code>EltName</code> and <code>value</code> are as follows: space characters are replaced by <code>+</code>, and then non-ASCII and reserved characters (as defined by <a href="#ref-rfc-2396">[RFC 2396]</a> as amended by subsequent documents in the IETF track) are escaped by replacing the character with one or more octets of the UTF-8 representation of the character, with each octet in turn replaced by <code>%HH</code>, where <code>HH</code> represents the uppercase hexadecimal notation for the octet value and <code>%</code> is a literal character. Line breaks are represented as "CR LF" pairs (i.e., <code>%0D%0A</code>). </p></li></ul></li><li><p>All such encodings are concatenated, maintaining document order.</p></li></ol><p>Example:</p><div class="exampleOuter">
<div class="exampleHead">application/x-www-form-urlencoded</div><div class="exampleInner"><pre>GivenName=Ren%C3%A9</pre></div><p>This format consists of simple name-value pairs.</p><div class="exampleInner"><pre><PersonName title="Mr">
<GivenName>René</GivenName>
</PersonName></pre></div><p>Here is the instance data for the above example. Note that very little of the data is preserved. Authors desiring greater data integrity should select a different serialization format.</p></div></div></div><div class="div2">
<h3><a name="submit-data-replacement" id="submit-data-replacement"></a>11.10 Replacing Data with the Submission Response</h3><p>The <code>submission</code> element allows an author-optional attribute named <code>targetref</code>. The attribute value is interpreted as
a <a title="binding expression" href="#def-binding-expression">binding expression</a> to which the first node rule is applied to obtain a <b>replacement target node</b> for the submission response.
This attribute is ignored unless the value of the <code>replace</code> attribute is "instance" or "text".</p><p>For backwards compatibility with documents created for earlier versions of the specification, the processor of the <code>submission</code> element
<a title="" href="#intro-reading">may</a> allow the author-optional attribute named <code>target</code> to be used. The <code>target</code> attribute provides exactly the
same behaviors as the <code>targetref</code> attribute except that the <code>target</code> attribute is ignored if the <code>submission</code> element also bears a
<code>targetref</code> attribute.</p><p>The default replacement target node is the document element node of the instance identified by the <code>instance</code> attribute, which
is equal to the default instance of the model if not specified. The evaluation context for this attribute is the in-scope evaluation context
for the <code>submission</code> element, except the context node is modified to be the document element of the instance identified by the
<code>instance</code> attribute if it is specified.</p><p>This attribute is evaluated only once a successful submission response has been received and if the <code>replace</code> attribute
value is "instance" or "text". The first node rule is applied to the result.</p><p>The processing of the <code>targetref</code> attribute (and its default) is considered to have failed if the result is any of the following:</p><ul><li><p>an empty nodeset</p></li><li><p>a readonly node, if <code>replace="text"</code></p></li><li><p>a non-element, if <code>replace="instance"</code></p></li><li><p>a node whose parent is readonly, if <code>replace="instance"</code></p></li></ul><p>If the processing of the <code>targetref</code> attribute fails, then submission processing ends after dispatching the
event <code>xforms-submit-error</code> with an <code>error-type</code> of <code>target-error</code>.</p><p>If the <code>replace</code> attribute contains the value "<code>text</code>" and the
submission response conforms to an XML mediatype (as defined by the content type specifiers in <a href="#ref-rfc-3023">[RFC 3023]</a>) or
a text media type (as defined by a content type specifier of <code>text/*</code>), then the response data is encoded as text and replaces the
content of the replacement target node. </p><p>If the <code>replace</code> attribute contains the value "<code>instance</code>" and the submission response conforms to an XML mediatype
(as defined by the content type specifiers in <a href="#ref-rfc-3023">[RFC 3023]</a>) and the XML parse of the submission response succeeds, then
the XML obtained from the submission response is used to replace the target node. The XML in the response may have comment
and processing instruction nodes before and after the document element. These nodes are discarded if the replacement target node
is not the document element of an instance. Otherwise, those processing instructions and comments replace any processing instructions
and comments that previously appeared outside of the document element of the instance being replaced.</p><p>In the case of text replacement of the content of the replacement target node, the replacement is performed by the XForms Action <code>setvalue</code> (<a href="#action-setvalue"><b>10.2 The setvalue Element</b></a>).
In the case of instance node replacement, the replacement is performed by an XForms action that performs some combination of node insertion and deletion operations that
are performed by the <code>insert</code> action (<a href="#action-insert"><b>10.3 The insert Element</b></a>) and the <code>delete</code> action (<a href="#action-delete"><b>10.4 The delete Element</b></a>).
If the <code>submission</code> has a <code>mode</code> of "<code>asynchronous</code>", then the text replacement action or the instance node replacement action is an outermost action handler, so the
<a title="" href="#action-deferred-update-behavior">deferred update behavior</a> occurs at the end of the action. If the <code>mode</code> is "<code>synchronous</code>", then
the text replacement action or the instance node replacement action is not outermost since occurs during the default processing of <code>xforms-submit</code>, so the
appropriate <a title="" href="#action-deferred-update-behavior">deferred update flags</a> are set based on whether the action was a <code>setvalue</code> or whether it performed
a series of <code>insert</code> and <code>delete</code> actions.</p><div class="note"><p class="prefix"><b>Note:</b></p><p>In an asynchronous submission, the deferred update behavior ensures that the user interface is up to date with the latest calculated values before the <code>xforms-submit-done</code>
event is dispatched. In a synchronous submission, the calculated values dependent on replaced text or data nodes can be made available to actions in the <code>xforms-submit-done</code> handler
by first invoking the <code>recalculate</code> action. A sequence of synchronous submissions performed with successive <code>send</code> actions can avoid refreshing the user interface until after the
completion of the last <code>send</code> action.</p></div><p>Examples:</p><div class="exampleOuter">
<div class="exampleHead">Replacing a subtree of instance data</div><div class="exampleInner"><pre><submission resource="http://example.com/jsp/prefill" method="post" ref="name" replace="instance" targetref="address"/></pre></div><p>This submission would be invoked after the user enters a value for <code>name</code>. Based on the name given, a simple server-side database
lookup is performed to get a last known address. The <code>address</code> element is replaced with the result, prefilling part of the form for the user.</p></div><div class="exampleOuter">
<div class="exampleHead">Replacing text in an instance</div><div class="exampleInner"><pre><submission resource="http://example.com/postalCodeSearch" method="get" ref="address" replace="text" targetref="address/postalCode"/></pre></div><p>The address information is past to a postal code search service that returns a textual result, which is placed into the <code>postalCode</code> element.</p></div><div class="exampleOuter">
<div class="exampleHead">Submission and Read-Only Content</div><div class="exampleInner"><pre><model xmlns:my="http://example.org">
<instance>
<my:data>
<my:name>
<my:first-name>John</my:first-name>
<my:last-name>Doe</my:last-name>
</my:name>
<my:address>
<my:street>123 Main St.</my:street>
<my:city>Smallville</my:city>
</my:address>
</my:data>
</instance>
<bind nodeset="/my:data/my:name/" readonly="true()"/>
<bind nodeset="/my:data/my:address/my:street" readonly="true()"/>
<submission id="S1" targetref="my:name" replace="instance" method="post" resource="..."/>
<submission id="S2" targetref="my:name/my:first-name" replace="instance" method="post" resource="..."/>
<submission id="S3" targetref="my:name/my:first-name" replace="text" method="post" resource="..."/>
<submission id="S4" targetref="my:address/my:street" replace="text" method="post" resource="..."/>
</model>
</pre></div><p>Submission S1 succeeds because a readonly node (<code>my:name</code>) can be replaced if its parent is not readonly.
Submission S2 fails because a node (<code>my:first-name</code>) cannot be replaced if its parent is readonly.
Submission S3 fails because the content of a readonly node cannot be replaced, even if it is readonly due to inheritance.
Submission S4 failse because the content of a readonly node cannot be replaced, even if the node's parent is not readonly.</p></div></div><div class="div2">
<h3><a name="SOAP" id="SOAP"></a>11.11 Integration with SOAP</h3><p>This section describes the integration of XForms submission with <a href="#SOAP-11">[SOAP 1.1]</a> and
<a href="#SOAP-12">[SOAP 1.2]</a></p><div class="div3">
<h4><a name="SOAP-envelope" id="SOAP-envelope"></a>11.11.1 Representation of SOAP Envelope</h4><p>The single-node binding of the <code>submission</code> element refers to the XML data to be submitted. In the case of a SOAP submission, the instance data includes the SOAP envelope and related SOAP tags.</p><div class="note"><p class="prefix"><b>Note:</b></p><p>The form author may choose to store the data payload in one instance and copy the data to the submission instance containing the SOAP envelope as part of an <code>xforms-submit</code> event handler. The form author is responsible for declaring the appropriate model item properties on both instances (e.g. the <code>relevant</code> declarations).</p></div></div><div class="div3">
<h4><a name="SOAP-mediatype" id="SOAP-mediatype"></a>11.11.2 Indicating a SOAP submission</h4><p>For a SOAP submission, the <code>mediatype</code> attribute of the <code>submission</code>
<a title="" href="#intro-reading">must</a> be set to the MIME type of <code>application/soap+xml</code>. The form author may append <code>charset</code> and <code>action</code> MIME parameters.</p><div class="note"><p class="prefix"><b>Note:</b></p><p>The <code>action</code> MIME parameter has no effect unless the submission <code>method</code> is "post" because the GET method implies no SOAP processing by the receiving SOAP node.</p></div><div class="note"><p class="prefix"><b>Note:</b></p><p>SOAP 1.1 does not support the HTTP GET operation.</p></div></div><div class="div3">
<h4><a name="SOAP-HTTP-Binding" id="SOAP-HTTP-Binding"></a>11.11.3 SOAP HTTP Binding</h4><p>The <code>method</code> attribute of the <code>submission</code>
<a title="" href="#intro-reading">must</a> be set to <code>get</code> or <code>post</code> in order to access the SOAP HTTP binding. </p><p>If <code>method="get"</code>, then the SOAP response message exchange pattern is used. The HTTP headers <a title="" href="#intro-reading">must</a> contain the Accept parameter with a value conforming to the following properties:</p><ul><li><p>
<a title="" href="#intro-reading">must</a> begin with <code>application/soap+xml</code>
</p></li><li><p>If the submission <code>mediatype</code> contains a <code>charset</code> MIME parameter, then it is appended to the <code>application/soap+xml</code> MIME type. Otherwise, a <code>charset</code> MIME parameter with same value as the <code>encoding</code> attribute (or its default) is appended to the <code>application/soap+xml</code> MIME type.</p></li><li><p>No other MIME parameters from the <code>mediatype</code> are copied to the <code>application/soap+xml</code> MIME type</p></li><li><p>The <code>q</code> MIME parameter <a title="" href="#intro-reading">must not</a> be specified in the <code>application/soap+xml</code> MIME type so that the default quality of 1 is used.</p></li></ul><p>If <code>method="post"</code>, then the SOAP request-response message exchange pattern is used. For SOAP 1.2, the current submission behavior of using the <code>mediatype</code> attribute value as the value of the <code>Content-type</code> parameter in the HTTP headers is sufficient. If the instance data being submitted has as its root element node a SOAP envelope in the SOAP 1.1 namespace (<code>http://schemas.xmlsoap.org/soap/envelope/</code>), then: </p><ul><li><p>the <code>Content-type</code> HTTP header is changed to <code>text/xml</code>
</p></li><li><p>the <code>charset</code> MIME parameter is appended . The charset parameter value from the <code>mediatype</code> attribute is used if it is specified. Otherwise, the value of the <code>encoding</code> attribute (or its default) is used.
</p></li><li><p>if the <code>action</code> MIME parameter appears in the <code>mediatype</code> then a SOAPAction HTTP header is added and given a value equal to the content of the <code>action</code> MIME parameter</p></li></ul><div class="note"><p class="prefix"><b>Note:</b></p><p>XForms 1.1 does not support the SOAP email binding, so method="post" with a <code>mailto:</code> scheme results in an <code>xforms-submit-error</code> event before any submit processing message is dispatched.</p></div><div class="note"><p class="prefix"><b>Note:</b></p><p>XForms 1.1 does not support the SOAP 1.1 binding to the HTTP Extension Framework.</p></div><p>Example:</p><div class="exampleOuter">
<div class="exampleHead">Consuming a SOAP 1.1 Request-Response Web Service</div><div class="exampleInner"><pre>
<xforms:model xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="http://www.webservice.net">
<xforms:instance id="data">
<data xmlns="">
<city>Victoria</city>
<country>Canada</country>
<weather>Mostly sunny and cool. High 12C. Low 3C.</weather>
</data>
</xforms:instance>
<xforms:instance id="GetWeatherSoapIn">
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetWeather xmlns="http://www.webservice.net">
<CityName>Victoria</CityName>
<CountryName>Canada</CountryName>
</GetWeather>
</soap:Body>
</soap:Envelope>
</xforms:instance>
<xforms:instance id="GetWeatherSoapOut">
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetWeatherResponse xmlns="http://www.webservice.net">
<GetWeatherResult>Mostly sunny and cool. High 12C. Low 3C.</GetWeatherResult>
</GetWeatherResponse>
</soap:Body>
</soap:Envelope>
</xforms:instance>
<xforms:submission id="GetWeather" resource="http://www.webservice.net/getweather.asmx" method="post"
ref="instance('GetWeatherSoapIn')" mediatype="application/soap+xml; action=http://www.webservice.net/GetWeather"
replace="instance" instance="GetWeatherSoapOut">
<xforms:action ev:event="xforms-submit">
<xforms:setvalue ref="instance('GetWeatherSoapOut')/soap:Body/tns:GetWeather/tns:CityName"
value="instance('data')/city"/>
<xforms:setvalue ref="instance('GetWeatherSoapOut')/soap:Body/tns:GetWeather/tns:CountryName"
value="instance('data')/country"/>
</xforms:action>
<xforms:action ev:event="xforms-submit-done">
<xforms:setvalue ref="instance('data')/weather"
value="instance('GetWeatherSoapOut')/soap:Body/tns:GetWeatherResponse/tns:GetWeatherResult"/>
</xforms:action>
</xforms:submission>
</xforms:model>
<xforms:input ref="city">
<xforms:label>City </xforms:label>
<xforms:send ev:event="xforms-value-changed" submission="GetWeather"/>
</xforms:input>
<xforms:input ref="country">
<xforms:label>Country </xforms:label>
<xforms:send ev:event="xforms-value-changed" submission="GetWeather"/>
</xforms:input>
<xforms:output ref="weather">
<xforms:label>The weather forecast is </xforms:label>
</xforms:output>
</pre></div><p>This form accepts input of a city name and country name from the user. When the user changes either value,
the 'GetWeather' web service is initiated. On <code>xforms-submit</code>, the user input is copied into the
request envelope. When the web service submission result is received, the <code>xforms-submit-done</code>
handler copies the weather forecast from the response envelope to the data instance.</p><p>The submission and the request and response instances correspond to the web service definition below:</p><div class="exampleInner"><pre>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://www.webservice.net" targetNamespace="http://www.webservice.net">
<wsdl:types>
<xs:schema elementFormDefault="qualified" targetNamespace="http://www.webservice.net">
<xs:element name="GetWeather">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1" name="CityName" type="xs:string" />
<xs:element minOccurs="0" maxOccurs="1" name="CountryName" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="GetWeatherResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1" name="GetWeatherResult" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
...
</wsdl:types>
<wsdl:message name="GetWeatherSoapIn">
<wsdl:part name="parameters" element="tns:GetWeather" />
</wsdl:message>
<wsdl:message name="GetWeatherSoapOut">
<wsdl:part name="parameters" element="tns:GetWeatherResponse" />
</wsdl:message>
...
<wsdl:portType name="GetWeatherSoap">
<wsdl:operation name="GetWeather">
<wsdl:input message="tns:GetWeatherSoapIn" />
<wsdl:output message="tns:GetWeatherSoapOut" />
</wsdl:operation>
...
</wsdl:portType>
...
<wsdl:binding name="GetWeatherSoap" type="tns:GetWeatherSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
<wsdl:operation name="GetWeather">
<soap:operation soapAction="http://www.webservice.net/GetWeather" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
...
</wsdl:binding>
<wsdl:service name="GetWeatherService">
<wsdl:port name="GetWeatherSoap" binding="tns:GetWeatherSoap">
<soap:address location="http://www.webservice.net/getweather.asmx" />
</wsdl:port>
...
</wsdl:service>
</wsdl:definitions></pre></div></div></div><div class="div3">
<h4><a name="SOAP-response" id="SOAP-response"></a>11.11.4 Handling the SOAP Response</h4><p>The XForms processor <a title="" href="#intro-reading">must</a> handle client authorization and redirection.</p><p>SOAP faults (400 and 500 level errors) are handled in the same manner as underlying HTTP errors, which is to say that an <code>xforms-submit-error</code> event is dispatched.</p><p>On successful completion, the results are consumed according to the XForms submission process, culminating in an <code>xforms-submit-done</code> event. The form author may capture this event and copy data from the target instance that receives the returned SOAP envelope to other instances that are designed to carry only data.</p></div></div></div><div class="div1">
<h2><a name="conform" id="conform"></a>12 Conformance</h2><div class="div2">
<h3><a name="conform-desc-documents" id="conform-desc-documents"></a>12.1 Conforming XForms Documents</h3><p>All XForms Containing Documents must conform to the following specifications, except as qualified below:</p><ul><li><p><a href="#ref-xml-1.0">[XML 1.0]</a></p></li><li><p><a href="#ref-xml-names">[XML Names]</a></p></li><li><p><a href="#ref-xpath-1.0">[XPath 1.0]</a></p></li><li><p><a href="#ref-xml-events">[XML Events]</a></p></li><li><p><a href="#ref-xschema-2">[XML Schema part 2]</a></p></li></ul><p>XForms elements are typically inserted into a containing document in multiple places. The root element for each individual fragment of XForms
<a title="" href="#intro-reading">must</a> be <code>model</code>, a <a title="" href="#elems-form-controls">core form control</a>, <code>group</code>, <code>repeat</code>, or <code>switch</code>. Individual XForms fragments
<a title="" href="#intro-reading">must</a> be schema-valid according to the Schema for XForms (<a href="#schema"><b>F Schema for XForms</b></a>), except that
the host language <a title="" href="#intro-reading">may</a> add elements of its own namespace to the content models of the following elements:
<code>group</code>, <code>repeat</code>, <code>case</code>, <code>label</code>, <code>help</code>, <code>hint</code>, <code>alert</code> and <code>message</code>. .</p><p>A <a title="host language" href="#def-host-language">host language</a> <a title="" href="#intro-reading">may</a> introduce additional conformance requirements.</p></div><div class="div2">
<h3><a name="conform-desc-generators" id="conform-desc-generators"></a>12.2 Conforming XForms Generators</h3><p>XForms generators <a title="" href="#intro-reading">should</a> generate conforming XForms documents.</p></div><div class="div2">
<h3><a name="xforms-base-tech" id="xforms-base-tech"></a>12.3 Base Technologies for XForms Processors</h3><p>The following are base technologies for XForms. An <a title="XForms Processor" href="#def-XForms-Processor">XForms Processor</a> therefore <a title="" href="#intro-reading">must</a>
conform to the following specifications, except as qualified below:</p><ul><li><p><a href="#ref-xml-1.0">[XML 1.0]</a></p></li><li><p><a href="#ref-xml-names">[XML Names]</a></p></li><li><p><a href="#ref-xpath-1.0">[XPath 1.0]</a></p></li><li><p><a href="#ref-xml-events">[XML Events]</a> (not all aspects are <a title="" href="#intro-reading">required</a>)</p></li><li><p><a href="#ref-xschema-2">[XML Schema part 2]</a></p></li></ul></div><div class="div2">
<h3><a name="conform-levels" id="conform-levels"></a>12.4 Conformance Levels</h3><p>XForms is a generalized XML processing language. Therefore, the XForms specification is intended for implementation on hardware platforms of all sizes,
from tiny hand-held devices to high-powered servers. This section describes two main levels of conformance that are useful in varied scenarios.</p><div class="div3">
<h4><a name="conform-levels-model" id="conform-levels-model"></a>12.4.1 XForms Model</h4><p>This conformance level is distinguished by the processor's <code>property()</code> function returning a string beginning with <code>"model"</code>
for the <code>conformance-level</code> property.</p><p>An XForms <code>model</code> can contain or reference XML schemas, XForms <code>instance</code> elements, XForms <code>bind</code> elements,
XForms <code>submission</code> elements, and XForms actions. XForms <code>submission</code> elements can also contain XForms actions.</p><p id="conform-model-processor">An <b>XForms Model Processor</b> is a reduced functionality <a title="XForms Processor" href="#def-XForms-Processor">XForms Processor</a>
with required, recommended and optional features described in this section. </p><p>An <a title="" href="#conform-model-processor">XForms Model Processor</a> <a title="" href="#intro-reading">must</a>
support all attributes of the <code>model</code> element. The processor <a title="" href="#intro-reading">must</a> support the valid attributes
and content of the <code>instance</code> element, and it <a title="" href="#intro-reading">should</a> support the notification events <code>xforms-insert</code>
and <code>xforms-delete</code>. The processor <a title="" href="#intro-reading">must</a> support all attributes, content and other
aspects of <code>bind</code> elements, except <code>p3ptype</code> support is <a title="" href="#intro-reading">optional</a>.
The processor <a title="" href="#intro-reading">must</a> fully support <a href="#ref-xpath-1.0">[XPath 1.0]</a>, including all XForms extension functions
(though the <code>index()</code> function <a title="" href="#intro-reading">may</a> return <code>1</code> if the processor has no
information about the identified <code>repeat</code> element). The processor <a title="" href="#intro-reading">must</a> make available the automatic
schema datatype information defined by XForms. The processor <a title="" href="#intro-reading">must</a> be able to parse inline and external
declared XML schema and consume their schema datatype information <a href="#ref-xschema-2">[XML Schema part 2]</a>, and the processor
<a title="" href="#intro-reading">should</a> consume all schema information available where appropriate in the XForms processing model.
An <a title="" href="#conform-model-processor">XForms Model Processor</a> <a title="" href="#intro-reading">may</a>
(and hence may not) support user interface creation and refresh behaviors described for <code>model</code> processing.
An <a title="" href="#conform-model-processor">XForms Model Processor</a> <a title="" href="#intro-reading">must</a>
support action handlers for the events <code>xforms-model-construct-done</code>, <code>xforms-ready</code>, <code>xforms-link-exception</code>
and <code>xforms-version-exception</code>. The processor <a title="" href="#intro-reading">may</a> support action handlers for the
<code>xforms-refresh</code> event, and it <a title="" href="#intro-reading">should</a> support all other events targetted at <code>model</code> elements.
The support for attributes and elements of <a href="#ref-xml-events">[XML Events]</a> is described below in the description of the support for XForms Actions.</p><p>An <a title="" href="#conform-model-processor">XForms Model Processor</a> <a title="" href="#intro-reading">should</a> support
the <a title="" href="#submit">XForms Submission module</a>. If it does, then all attributes, child elements, behaviors and
events <a title="" href="#intro-reading">must</a> be supported except as follows. The support for attributes and elements of <a href="#ref-xml-events">[XML Events]</a>
on action handlers for submission events is described below in the description of the support for XForms Actions.
All <a href="http://www.w3.org/TR/REC-xml-names/#NT-NCName">NCName</a> submission methods <a title="" href="#intro-reading">should</a> be supported, and the
following methods <a title="" href="#intro-reading">must</a> be supported: <code>get</code>, <code>post</code>, <code>put</code>, <code>delete</code>,
and <code>urlencoded-post</code>. The <code>mode</code> attribute <a title="" href="#intro-reading">should</a> be supported; at least
one of asynchronous or synchronous submission <a title="" href="#intro-reading">must</a> be supported. The
<code>http</code> submission scheme <a title="" href="#intro-reading">must</a> be supported. The <code>https</code> and <code>file</code>
schemes <a title="" href="#intro-reading">should</a> be supported. Other schemes <a title="" href="#intro-reading">may</a> be supported
such as <code>mailto</code> or <code>ftp</code>. XForms-defined submission headers <a title="" href="#intro-reading">may</a> be combined with those from the user agent in the manner specified by the <code>combine</code> attribute. </p><p>An <a title="" href="#conform-model-processor">XForms Model Processor</a> <a title="" href="#intro-reading">must</a> support
the following actions: <code>action</code>, <code>insert</code>, <code>delete</code>, <code>setvalue</code>, <code>reset</code>, <code>rebuild</code>, <code>recalculate</code>, <code>revalidate</code>, and
<code>dispatch</code>. The processor <a title="" href="#intro-reading">should</a> support <code>send</code> and <code>load</code>.
The processor <a title="" href="#intro-reading">may</a> support <code>refresh</code>, <code>setindex</code>, <code>setfocus</code>, <code>toggle</code>,
and <code>message</code>. For every supported action, the processor <a title="" href="#intro-reading">must</a> support all local attributes defined
for the action, including conditional and iteration attributes.
An <a title="" href="#conform-model-processor">XForms Model Processor</a> <a title="" href="#intro-reading">must</a> support the attribute
<code>ev:event</code> so that XForms action handlers can appear as children of either the target elements of the events they handle or ancestors of those
elements. The processor <a title="" href="#intro-reading">should</a> support the attribute <code>ev:target</code> so action handlers can identify the
events targetted at a particular descendant of the action handler's parent element (e.g. the <code>xforms-insert</code> or <code>xforms-delete</code>
event on a particular <code>instance</code> of the <code>model</code>). The processor <a title="" href="#intro-reading">may</a> support all other features of
<a href="#ref-xml-events">[XML Events]</a>.</p></div><div class="div3">
<h4><a name="conform-levels-full" id="conform-levels-full"></a>12.4.2 XForms Full</h4><p>This conformance level is distinguished by the processor's <code>property()</code> function returning a string beginning with <code>"full"</code>
for the <code>conformance-level</code> property.</p><p>An <b>XForms Full Processor</b> is an <a title="XForms Processor" href="#def-XForms-Processor">XForms Processor</a>
consisting of a conforming <a title="" href="#conform-model-processor">XForms Model Processor</a> along with the following additional required,
recommended and optional features: </p><ul><li><p>The processor <a title="" href="#intro-reading">must</a> support user interface creation and refresh behaviors described for
<code>model</code> processing. </p></li><li><p>The processor <a title="" href="#intro-reading">must</a> support all <a title="" href="#elems-form-controls">core form controls</a>, including all of their attributes
and child elements.</p></li><li><p>The processor <a title="" href="#intro-reading">must</a> support the actions <code>refresh</code>, <code>setfocus</code>,
and <code>message</code>.</p></li><li><p>The processor <a title="" href="#intro-reading">should</a> support the <a title="" href="#ui-group-module">XForms Group Module</a>.
If the processor does not support this module and a <code>group</code> element is encountered during user interface initialization, then the processor
<a title="" href="#intro-reading">must</a> terminate processing after dispatching <a title="" href="#evt-bindingException">xforms-binding-exception</a>.</p></li><li><p>The processor <a title="" href="#intro-reading">should</a> support the <code>toggle</code> action and the
<a title="" href="#ui-switch-module">XForms Switch Module</a>. If the processor does not support this module and a <code>switch</code> element is
encountered during user interface initialization, then the processor <a title="" href="#intro-reading">must</a> terminate processing after dispatching
<a title="" href="#evt-bindingException">xforms-binding-exception</a>.</p></li><li><p>The processor <a title="" href="#intro-reading">should</a> support the <code>setindex</code> action and the
<a title="" href="#ui-repeat-module">XForms Repeat Module</a>, except that support of the <code>repeat-*</code>
attributes is <a title="" href="#intro-reading">optional</a>. If the processor does not support this module and a <code>repeat</code> element is
encountered during user interface initialization, then the processor <a title="" href="#intro-reading">must</a> terminate processing after dispatching
<a title="" href="#evt-bindingException">xforms-binding-exception</a>.</p></li><li><p>The processor <a title="" href="#intro-reading">should</a> support all interaction and notification events targetted at basic form controls,
<code>group</code>, <code>switch</code>, <code>repeat</code>, and their descendant elements (e.g. <code>case</code> and <code>item</code>).</p></li><li><p>The processor <a title="" href="#intro-reading">may</a> support the Extension module. </p></li></ul></div></div></div><div class="div1">
<h2><a name="terms" id="terms"></a>13 Glossary Of Terms</h2><dl><dt class="label">Binding</dt><dd><p> [<a name="def-binding" id="def-binding" title="binding">Definition</a>: A "binding" connects an instance data node to a form control or to a model item property by using a binding expression as a locator.] </p></dd><dt class="label">Binding expression</dt><dd><p> [<a name="def-binding-expression" id="def-binding-expression" title="binding expression">Definition</a>: An <a href="#ref-xpath-1.0">[XPath 1.0]</a> expression used in a binding.] </p></dd><dt class="label">Compound Document</dt><dd><p>A <a href="#ref-cdrf-1.0">[CDRF 1.0]</a> Compound Document is a document that combines multiple document formats either by reference, by inclusion or both.</p></dd><dt class="label">Computed expression</dt><dd><p> [<a name="def-computed-expression" id="def-computed-expression" title="computed expression">Definition</a>: An <a href="#ref-xpath-1.0">[XPath 1.0]</a> expression used by model item properties such as relevant and calculate to include dynamic functionality in XForms.] </p></dd><dt class="label">Containing document</dt><dd><p> [<a name="def-containing-document" id="def-containing-document" title="containing document">Definition</a>: A specific document, for example an XHTML document, in which one or more <model> elements are found.] </p></dd><dt class="label">Datatype</dt><dd><p> [<a name="def-datatype" id="def-datatype" title="datatype">Definition</a>: From XML Schema <a href="#ref-xschema-2">[XML Schema part 2]</a>: A 3-tuple, consisting of a) a set of distinct values, called its value space, b) a set of lexical representations, called its lexical space, and c) a set of facets that characterize properties of the value space, individual values or lexical items.] </p></dd><dt class="label">Facet</dt><dd><p> [<a name="def-facet" id="def-facet" title="facet">Definition</a>: From XML Schema <a href="#ref-xschema-2">[XML Schema part 2]</a>: A single defining aspect of a value space. Generally speaking, each facet characterizes a value space along independent axes or dimensions.] </p></dd><dt class="label">First node rule</dt><dd><p> [<a name="def-first-node-rule" id="def-first-node-rule" title="first node rule">Definition</a>: When a UI Single-Node Binding attribute selects a node-set of size > 1, the first node in the node-set is used.]</p></dd><dt class="label">Form control</dt><dd><p> [<a name="def-form-control" id="def-form-control" title="form control">Definition</a>: An XForms user interface control that serves as a point of user interaction (a <a title="" href="#def-core-form-control">core form control</a>) or as a container for other form controls (a <a title="" href="#def-container-form-control">container form control</a>).] </p></dd><dt class="label">Host language</dt><dd><p> [<a name="def-host-language" id="def-host-language" title="host language">Definition</a>: An XML vocabulary, such as XHTML, into which XForms is embedded.] </p></dd><dt class="label">Instance data</dt><dd><p> [<a name="def-instance-data" id="def-instance-data" title="instance data">Definition</a>: An internal tree representation of the values and state of all the instance data nodes associated with a particular form.] </p></dd><dt class="label">Instance data node</dt><dd><p> [<a name="def-instance-data-node" id="def-instance-data-node" title="instance data item">Definition</a>: An <a href="#ref-xpath-1.0">[XPath 1.0]</a> node from the instance data.] </p></dd><dt class="label">Lax schema processing</dt><dd><p> [<a name="def-lax-processing" id="def-lax-processing" title="lax processing">Definition</a>: From XML Schema <a href="#ref-xschema-1">[XML Schema part 1]</a>: For an element or attributes Schema validity to be assessed, then the applicable schema must provide a definition of the item. If not, Schema validation makes no contribution to the validity test for the item.]</p></dd><dt class="label">Lexical space</dt><dd><p> [<a name="def-lexical-space" id="def-lexical-space" title="lexical space">Definition</a>: From XML Schema <a href="#ref-xschema-2">[XML Schema part 2]</a>: A lexical space is the set of valid literals for a datatype.] The XML serialization that may occur during submission expresses the instance data using lexical space literals.</p></dd><dt class="label">Model Binding expression</dt><dd><p> [<a name="def-model-binding-expression" id="def-model-binding-expression" title="model binding expression">Definition</a>: An <a href="#ref-xpath-1.0">[XPath 1.0]</a> expression used in the <code>nodeset</code> attribute of a <code>bind</code> element in an XForms model. Often, a <code>bind</code> also declares <a title="computed expression" href="#def-computed-expression">computed expressions</a> for model item properties of the nodes. ] </p></dd><dt class="label">Model item</dt><dd><p> [<a name="def-model-item" id="def-model-item" title="model item">Definition</a>: An instance data node with associated constraints.] </p></dd><dt class="label">Model item property</dt><dd><p> [<a name="def-model-item-property" id="def-model-item-property" title="model item property">Definition</a>: An XForms-specific annotation to an instance data node.] </p></dd><dt class="label">Non-relevant Form Control</dt><dd><p> [<a name="def-non-relevant-form-control" id="def-non-relevant-form-control" title="Non-relevant Form Control">Definition</a>: A form control satisfying at least one of the <a title="" href="#def-non-relevant-form-control-conditions">form control non-relevance conditions</a>.] </p></dd><dt class="label">QNameButNotNCName</dt><dd><p> [<a name="def-QNameButNotNCName" id="def-QNameButNotNCName" title="QNameButNotNCName">Definition</a>: A <a href="http://www.w3.org/TR/REC-xml-names/#NT-QName">QName</a> that is not an <a href="http://www.w3.org/TR/REC-xml-names/#NT-NCName">NCName</a>. In 2006, the W3C named this a <a href="http://www.w3.org/TR/REC-xml-names/#NT-PrefixedName">PrefixedName</a>. ] </p></dd><dt class="label">Relevant Form Control</dt><dd><p> [<a name="def-relevant-form-control" id="def-relevant-form-control" title="Relevant Form Control">Definition</a>: A form control satisfying none of the <a title="" href="#def-non-relevant-form-control-conditions">form control non-relevance conditions</a>.] </p></dd><dt class="label">Schema constraint</dt><dd><p> [<a name="def-Schema-constraint" id="def-Schema-constraint" title="Schema constraint">Definition</a>: A restriction, applied to form data, based on XML Schema datatypes.] </p></dd><dt class="label">Strict schema processing</dt><dd><p> [<a name="def-strict-processing" id="def-strict-processing" title="strict processing">Definition</a>: From XML Schema <a href="#ref-xschema-1">[XML Schema part 1]</a>: If the applicable schema does not provide a definition for an element or attribute, then Schema validation marks the item as invalid.]</p></dd><dt class="label">UI Binding Expression</dt><dd><p> [<a name="def-ui-binding-expression" id="def-ui-binding-expression" title="UI binding expression">Definition</a>: An <a href="#ref-xpath-1.0">[XPath 1.0]</a> expression used in binding a <a title="form control" href="#def-form-control">form control</a> to the instance.] </p></dd><dt class="label">Valid node</dt><dd><p> [<a name="def-valid-node" id="def-valid-node" title="valid">Definition</a>: An instance data node is valid if and only if the constraint model item property is true, the value is non-empty if the required model item property is true, and the node satisfies all applicable XML Schema definitions (including those associated byt the type model item property, by <code>xsi:type</code> or by an external or inline schema).]</p></dd><dt class="label">Value space</dt><dd><p> [<a name="def-value-space" id="def-value-space" title="value space">Definition</a>: From XML Schema <a href="#ref-xschema-2">[XML Schema part 2]</a>: A set of values for a given datatype. Each value in the value space of a datatype is denoted by one or more literals in its lexical space.] </p></dd><dt class="label">versionList</dt><dd><p>[<a name="def-versionList" id="def-versionList" title="versionList">Definition</a>: A list (<a href="#ref-xschema-2">[XML Schema part 2]</a>) with an atomic datatype (<a href="#ref-xschema-2">[XML Schema part 2]</a>) of <a title="versionNumber" href="#def-versionNumber">versionNumber</a>.]</p></dd><dt class="label">versionNumber</dt><dd><p>[<a name="def-versionNumber" id="def-versionNumber" title="versionNumber">Definition</a>: A string consisting of a non-zero digit (1 to 9) followed by zero or more digits (0 to 9), then a period character (.), and then one or more digits (0-9). A version number is derived from string by restriction based on the following pattern value (excluding the quote marks): <code>"[1-9]\d*\.\d+"</code>.]</p></dd><dt class="label">XForms Model</dt><dd><p> [<a name="def-XForms-Model" id="def-XForms-Model" title="XForms Model">Definition</a>: The non-visible definition of an XML form as specified by XForms. The XForms Model defines the individual model items and constraints and other run-time aspects of XForms.] </p></dd><dt class="label">XForms Processor</dt><dd><p> [<a name="def-XForms-Processor" id="def-XForms-Processor" title="XForms Processor">Definition</a>: A software application or program that implements and conforms to the XForms specification.] </p></dd></dl></div></div><div class="back"><div class="div1">
<h2><a name="references" id="references"></a>A References</h2><div class="div2">
<h3><a name="references-norm" id="references-norm"></a>A.1 Normative References</h3><dl><dt class="label"><a name="ref-Exc-C14N" id="ref-Exc-C14N"></a>Exc-C14N</dt><dd><a href="http://www.w3.org/TR/2002/REC-xml-exc-c14n-20020718/"><cite>Exclusive XML Canonicalization Version 1.0</cite></a>, J. Boyer, D. Eastlake 3rd, J. Reagle, 2002. W3C Recommendation available at http://www.w3.org/TR/2002/REC-xml-exc-c14n-20020718/.</dd><dt class="label"><a name="ref-hmac" id="ref-hmac"></a>HMAC</dt><dd>
<a href="http://www.ietf.org/rfc/rfc2104.txt"><cite>RFC 2104 - HMAC: Keyed-Hashing for Message Authentication</cite></a>, H. Krawczyk, M. Bellare, R. Canetti, 1997. Available at http://www.ietf.org/rfc/rfc2104.txt</dd><dt class="label"><a name="ref-luhn" id="ref-luhn"></a>Luhn Patent</dt><dd>
<cite>Computer for Verifying Numbers</cite>, H. P. Luhn, U.S. Patent 2,950,048, 1960.</dd><dt class="label"><a name="ref-md5" id="ref-md5"></a>MD5</dt><dd>
<a href="http://www.ietf.org/rfc/rfc1321.txt"><cite>RFC 1321: The MD5 Message-Digest Algorithm</cite></a>, R. Rivest, 1992. Available at http://www.ietf.org/rfc/rfc1321.txt</dd><dt class="label"><a name="ref-rfc-2119" id="ref-rfc-2119"></a>RFC 2119</dt><dd><a href="http://www.ietf.org/rfc/rfc2119.txt"><cite>RFC 2119: Key words for use in RFCs to Indicate Requirement Levels</cite></a>, S. Bradner, 1997. Available at http://www.ietf.org/rfc/rfc2119.txt.</dd><dt class="label"><a name="ref-rfc-2387" id="ref-rfc-2387"></a>RFC 2387</dt><dd> <a href="http://www.ietf.org/rfc/rfc2387.txt"><cite>RFC 2387: The MIME Multipart/Related Content-type</cite></a>, E. Levinson, 1998. Available at: http://www.ietf.org/rfc/rfc2387.txt.</dd><dt class="label"><a name="ref-rfc-2388" id="ref-rfc-2388"></a>RFC 2388</dt><dd> <a href="http://www.ietf.org/rfc/rfc2388.txt"><cite>RFC 2388: Returning Values from Forms: multipart/form-data</cite></a>, L. Masinter, 1998. Available at: http://www.ietf.org/rfc/rfc2388.txt.</dd><dt class="label"><a name="ref-rfc-2396" id="ref-rfc-2396"></a>RFC 2396</dt><dd> <a href="http://www.ietf.org/rfc/rfc2396.txt"><cite>RFC 2396: Uniform Resource Identifiers (URI): Generic Syntax</cite></a>, T. Berners-Lee, R. Fielding, L. Masinter, 1998. Available at: http://www.ietf.org/rfc/rfc2396.txt.</dd><dt class="label"><a name="ref-rfc-2616" id="ref-rfc-2616"></a>RFC 2616</dt><dd> <a href="http://www.ietf.org/rfc/rfc2616.txt"><cite>RFC 2616: Hypertext Transfer Protocol -- HTTP/1.1</cite></a>, R. Fielding, J. Gettys, J. Mogul, H. Frystyk, L. Masinter, P. Leach, T. Berners-Lee,1999. Available at: http://www.ietf.org/rfc/rfc2616.txt.</dd><dt class="label"><a name="ref-rfc-2822" id="ref-rfc-2822"></a>RFC 2822</dt><dd> <a href="http://www.ietf.org/rfc/rfc2822.txt"><cite>RFC 2822: Internet Message Format</cite></a>, P. Resnick, 2001. Available at: http://www.ietf.org/rfc/rfc2822.txt.</dd><dt class="label"><a name="ref-rfc-3023" id="ref-rfc-3023"></a>RFC 3023</dt><dd> <a href="http://www.ietf.org/rfc/rfc3023.txt"><cite>RFC 3023: XML Media Types</cite></a>, M Murata, S. St. Laurent, D. Kohn, 2001. Available at: http://www.ietf.org/rfc/rfc3023.txt.</dd><dt class="label"><a name="ref-sha2" id="ref-sha2"></a>SHA2</dt><dd>
<a href="http://csrc.nist.gov/publications/fips/fips180-2/fips180-2.pdf"><cite>SECURE HASH STANDARD. FIPS PUB 180-2</cite></a>, August 2002. Available at http://csrc.nist.gov/publications/fips/fips180-2/fips180-2.pdf</dd><dt class="label"><a name="SOAP-11" id="SOAP-11"></a>SOAP 1.1</dt><dd>
<a href="http://www.w3.org/TR/2000/NOTE-SOAP-20000508/"><cite>Simple Object Access Protocol (SOAP) 1.1
</cite></a>, D. Box, D. Ehnebuske, G. Kakivaya, A. Layman, N. Mendelsohn, H. F. Nielsen, S. Thatte, D. Winer, 2000. Available at: http://www.w3.org/TR/2000/NOTE-SOAP-20000508/.</dd><dt class="label"><a name="SOAP-12"></a>SOAP 1.2</dt><dd>
<a href="http://www.w3.org/TR/2007/REC-soap12-part1-20070427/"><cite>SOAP Version 1.2 Part 1: Messaging Framework</cite></a>, M. Gudgin, M. Hadley, N. Mendelsohn, J.-J. Moreau, H. F. Nielsen, A. Karmarkar, Y. Lafon, 2007. Available at: http://www.w3.org/TR/2007/REC-soap12-part1-20070427/.</dd><dt class="label"><a name="ref-unicode-collation" id="ref-unicode-collation"></a>Unicode Collation Algorithm</dt><dd> <a href="http://www.unicode.org/unicode/reports/tr10/"><cite>Unicode Technical Standard #10, Unicode Collation Algorithm</cite></a>, Available at: http://www.unicode.org/unicode/reports/tr10/.</dd><dt class="label"><a name="ref-xhtml-mod"></a>XHTML Modularization</dt><dd> <a href="http://www.w3.org/TR/2008/REC-xhtml-modularization-20081008"><cite>XHTML Modularization 1.1</cite></a>, D. Austin, S. Peruvemba, S. McCarron, M. Ishikawa, M. Birbeck, 2008. W3C Recommendation available at http://www.w3.org/TR/2008/REC-xhtml-modularization-20081008.</dd><dt class="label"><a name="ref-xml-base"></a>XML Base</dt><dd> <a href="http://www.w3.org/TR/2009/REC-xmlbase-20090128/"><cite>XML Base (Second Edition)</cite></a>, J. Marsh, R. Tobin, 2009. W3C Recommendation available at: http://www.w3.org/TR/2009/REC-xmlbase-20090128/.</dd><dt class="label"><a name="ref-xml-events" id="ref-xml-events"></a>XML Events</dt><dd> <a href="http://www.w3.org/TR/2003/REC-xml-events-20031014/"><cite>XML Events - An events syntax for XML</cite></a>, Steven Pemberton, T. V. Raman, Shane P. McCarron, 2003. W3C Recommendation available at: http://www.w3.org/TR/2003/REC-xml-events-20031014/.</dd><dt class="label"><a name="ref-xhtml-1.0" id="ref-xhtml-1.0"></a>XHTML 1.0</dt><dd> <a href="http://www.w3.org/TR/2002/REC-xhtml1-20020801/"><cite>XHTML 1.0: The Extensible HyperText Markup Language - A Reformulation of HTML 4 in XML 1.0</cite></a>, Steven Pemberton, et al., 2002. W3C Recommendation available at: http://www.w3.org/TR/2002/REC-xhtml1-20020801/.</dd><dt class="label"><a name="ref-xml-1.0" id="ref-xml-1.0"></a>XML 1.0</dt><dd> <a href="http://www.w3.org/TR/2006/REC-xml-20060816/"><cite>Extensible Markup Language (XML) 1.0 (Fourth Edition)</cite></a>, Tim Bray, Jean Paoli, C. M. Sperberg-McQueen, Eve Maler, 2006. W3C Recommendation available at: http://www.w3.org/TR/2006/REC-xml-20060816/</dd><dt class="label"><a name="ref-xml-names" id="ref-xml-names"></a>XML Names</dt><dd> <a href="http://www.w3.org/TR/2006/REC-xml-names-20060816/"><cite>Namespaces in XML (Second Edition)</cite></a>, Tim Bray, Dave Hollander, Andrew Layman, and Richard Tobin, 2006. W3C Recommendation available at: http://www.w3.org/TR/2006/REC-xml-names-20060816/.</dd><dt class="label"><a name="ref-xpath-1.0" id="ref-xpath-1.0"></a>XPath 1.0</dt><dd> <a href="http://www.w3.org/TR/1999/REC-xpath-19991116"><cite>XML Path Language (XPath) Version 1.0</cite></a>, James Clark, Steve DeRose, 1999. W3C Recommendation available at: http://www.w3.org/TR/1999/REC-xpath-19991116.</dd><dt class="label"><a name="ref-xschema-1" id="ref-xschema-1"></a>XML Schema part 1</dt><dd> <a href="http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/"><cite>XML Schema Part 1: Structures</cite></a>, Henry S. Thompson, David Beech, Murray Maloney, Noah Mendelsohn, 2004. W3C Recommendation available at: http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/.</dd><dt class="label"><a name="ref-xschema-2" id="ref-xschema-2"></a>XML Schema part 2</dt><dd> <a href="http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/"><cite>XML Schema Part 2: Datatypes</cite></a>, Paul V. Biron, Ashok Malhotra, 2004. W3C Recommendation available at: http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/.</dd><dt class="label"><a name="ref-xslt" id="ref-xslt"></a>XSLT 1.0</dt><dd> <a href="http://www.w3.org/TR/1999/REC-xslt-19991116"><cite>XSL Transformations (XSLT) Version 1.0</cite></a>, James Clark, 1999. W3C Recommendation available at: http://www.w3.org/TR/1999/REC-xslt-19991116.</dd></dl></div><div class="div2">
<h3><a name="references-inform" id="references-inform"></a>A.2 Informative References</h3><dl><dt class="label"><a name="ref-art" id="ref-art"></a>Algorithms</dt><dd> <cite>The Art of Computer Programming: Volume 1 Fundamental Algorithms</cite>, D. E. Knuth, Addison-Wesley, Reading, MA. 1968. Third edition, 1997. ISBN:0-2018-9683-4.</dd><dt class="label"><a name="aui-conversational-gestures" id="aui-conversational-gestures"></a>AUI97</dt><dd> <cite>Auditory User Interfaces--Toward The Speaking Computer</cite>, T. V. Raman, Kluwer Academic Publishers, 1997. ISBN:0-7923-9984-6.</dd><dt class="label"><a name="ref-cdrf-1.0" id="ref-cdrf-1.0"></a>CDRF 1.0</dt><dd> <a href="http://www.w3.org/TR/2007/CR-CDR-20070718/"><cite>Compound Document by Reference Framework 1.0</cite></a>, Timur Mehrvarz, Lasse Pajunen, Julien Quint, and Daniel Applequist, 2007. W3C Candidate Recommendation available at: http://www.w3.org/TR/2007/CR-CDR-20070718/.</dd><dt class="label"><a name="ref-css2" id="ref-css2"></a>CSS2</dt><dd> <a href="http://www.w3.org/TR/1998/REC-CSS2-19980512/"><cite>Cascading Style Sheets, level 2 (CSS2) Specification</cite></a>, Bert Bos, Håkon Wium Lie, Chris Lilley, Ian Jacobs, 1998. W3C Recommendation available at: http://www.w3.org/TR/1998/REC-CSS2-19980512/.</dd><dt class="label"><a name="ref-ddj" id="ref-ddj"></a>DDJ-ArrayDoubling</dt><dd> <cite>Resizable Arrays, Heaps and Hash Tables</cite>, John Boyer, Doctor Dobb's Journal, CMP Media LLC, January 1998 Issue.</dd><dt class="label"><a name="ref-dom2-core" id="ref-dom2-core"></a>DOM2 Core</dt><dd> <a href="http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/"><cite>Document Object Model (DOM) Level 2 Core Specification</cite></a>, Tom Pixley, 2000. W3C Recommendation available at: http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/.</dd><dt class="label"><a name="ref-dom2-events" id="ref-dom2-events"></a>DOM2 Events</dt><dd> <a href="http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/"><cite>Document Object Model (DOM) Level 2 Events Specification</cite></a>, Tom Pixley, 2000. W3C Recommendation available at: http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/.</dd><dt class="label"><a name="ref-exslt" id="ref-exslt"></a>EXSLT</dt><dd> <a href="http://www.exslt.org"><cite>EXSLT Web site</cite></a>. Available at http://www.exslt.org.</dd><dt class="label"><a name="ref-odf-1.1" id="ref-odf-1.1"></a>ODF 1.1</dt><dd> <a href="http://docs.oasis-open.org/office/v1.1/OS/OpenDocument-v1.1-html/OpenDocument-v1.1.html"><cite>Open Document Format for Office Applications (OpenDocument) v1.1</cite></a>, Patrick Durusau, Michael Brauer, and Lars Oppermann (editors), 2007. OASIS Standard available at: http://docs.oasis-open.org/office/v1.1/OS/OpenDocument-v1.1-html/OpenDocument-v1.1.html.</dd><dt class="label"><a name="ref-p3p-1.0" id="ref-p3p-1.0"></a>P3P 1.0</dt><dd> <a href="http://www.w3.org/TR/2002/REC-P3P-20020416/"><cite>The Platform for Privacy Preferences 1.0 (P3P1.0) Specification</cite></a>, Lorrie Cranor, Marc Langheinrich, Massimo Marchiori, Martin Presler-Marshall, Joseph Reagle, 2002. W3C Recommendation available at: http://www.w3.org/TR/2002/REC-P3P-20020416/.</dd><dt class="label"><a name="ref-RELAXNG"></a>RELAXNG</dt><dd> <a href="http://www.relaxng.org/spec-20011203.html"><cite>RELAXNG Specification</cite></a>, James Clark, MURATO Makoto, 2001. OASIS Committee Specification available at: http://www.relaxng.org/spec-20011203.html.</dd><dt class="label"><a name="ref-RELAXNG-Compact"></a>RELAXNG Compact</dt><dd> <a href="http://www.relaxng.org/compact-20021121.html"><cite>RELAXNG Compact Syntax</cite></a>, James Clark, 2002. OASIS Committee Specification available at: http://www.relaxng.org/compact-20021121.html.</dd><dt class="label"><a name="ref-svg11" id="ref-svg11"></a>SVG 1.1</dt><dd><a href="http://www.w3.org/TR/2003/REC-SVG11-20030114/"><cite>SVG 1.1</cite></a>, Jon Ferraiolo, FUJISAWA Jun, Dean Jackson, 2003. W3C Recommendation available at: http://www.w3.org/TR/2003/REC-SVG11-20030114/.</dd><dt class="label"><a name="ref-tag7" id="ref-tag7"></a>TAG Finding 7</dt><dd> <a href="http://www.w3.org/2001/tag/doc/whenToUseGet-20040321"><cite>TAG Finding: URIs, Addressability, and the use of HTTP GET</cite></a>, Ian Jacobs, 2004. Available at: http://www.w3.org/2001/tag/doc/whenToUseGet-20040321</dd><dt class="label"><a name="ref-unicode-script-names" id="ref-unicode-script-names"></a>Unicode Script Names</dt><dd>
<a href="http://unicode.org/iso15924/iso15924-codes.html"><cite>ISO 15924: Codes for the representation of names of scripts</cite></a>,
Available at: http://unicode.org/iso15924/iso15924-codes.html.
</dd><dt class="label"><a name="ref-uaag-1.0" id="ref-uaag-1.0"></a>UAAG 1.0</dt><dd><a href="http://www.w3.org/TR/UAAG10/"><cite>User Agent Accessibility Guidelines 1.0</cite></a>, Ian Jacobs, Jon Gunderson, Eric Hansen, 2002. Working Draft available at http://www.w3.org/TR/UAAG10/.</dd><dt class="label"><a name="ref-unicode-scripts" id="ref-unicode-scripts"></a>Unicode Scripts</dt><dd><a href="http://www.unicode.org/unicode/reports/tr24/"><cite> Script Names</cite></a>, Mark Davis, 2001. Unicode Technical Report #24 available at http://www.unicode.org/unicode/reports/tr24/.</dd><dt class="label"><a name="ref-xforms-1.0" id="ref-xforms-1.0"></a>XForms 1.0</dt><dd>
<a href="http://www.w3.org/TR/2007/REC-xforms-20071029/"><cite>XForms 1.0 Third Edition</cite></a>, John Boyer, 2007. W3C Recommendation available at: http://www.w3.org/TR/2007/REC-xforms-20071029/.</dd><dt class="label"><a name="ref-xforms-basic" id="ref-xforms-basic"></a>XForms Basic</dt><dd> <a href="http://www.w3.org/TR/2003/CR-xforms-basic-20031014/"><cite>XForms Basic Profile</cite></a>, Micah Dubinko, T. V. Raman, 2003. W3C Candidate Recommendation available at: http://www.w3.org/TR/2003/CR-xforms-basic-20031014/.</dd><dt class="label"><a name="ref-xlink-1.0" id="ref-xlink-1.0"></a>XLink 1.0</dt><dd> <a href="http://www.w3.org/TR/2001/REC-xlink-20010627/"><cite>XML Linking Language (XLink) Version 1.0</cite></a>, Steve DeRose, Eve Maler, David Orchard, 2001. W3C Recommendation available at: http://www.w3.org/TR/2001/REC-xlink-20010627/.</dd><dt class="label"><a name="ref-xpath-2.0" id="ref-xpath-2.0"></a>XPath 2.0</dt><dd> <a href="http://www.w3.org/TR/2007/REC-xpath20-20070123/"><cite>XML Path Language (XPath) 2.0</cite></a>, Anders Berglund, Scott Boag, Don Chamberlin, Mary F. Fernández, Michael Kay, Jonathan Robie, and Jérôme Siméon, 2007. W3C Recommendation available at: http://www.w3.org/TR/2007/REC-xpath20-20070123/.</dd><dt class="label"><a name="ref-xschema-0" id="ref-xschema-0"></a>XML Schema part 0</dt><dd> <a href="http://www.w3.org/TR/2004/REC-xmlschema-0-20041028/"><cite>XML Schema Part 0: Primer Second Edition</cite></a>, David C. Fallside and Priscilla Walmsley, 2004. W3C Recommendation available at: http://www.w3.org/TR/2004/REC-xmlschema-0-20041028/.</dd></dl></div></div><div class="div1">
<h2><a name="data-mutation-patterns" id="data-mutation-patterns"></a>B Patterns for Data Mutations</h2><p>This appendix provides several usage patterns for the <code>setvalue</code>, <code>insert</code> and <code>delete</code> actions that perform various kinds of mutations of instance data elements and attributes.</p><div class="div2">
<h3><a name="data-mutation-patterns-prepend-element" id="data-mutation-patterns-prepend-element"></a>B.1 Prepend Element Copy</h3><p>Pattern: <b><insert context="</b><em>parent of new element</em><b>" origin="</b><em>element to copy</em><b>"/></b></p><div class="note"><p class="prefix"><b>Note:</b></p><p>The <code>context</code> attribute is used so that this pattern will work whether or not the parent element is empty.
</p></div><div class="exampleOuter"><p><b>Operation</b>: Prepend a new, empty <code>person</code> element into a list of <code>people</code></p><div class="exampleInner"><pre>
<xforms:insert context="people" origin="instance('prototypes')/person"/>
</pre></div><p><b>Data Before Operation</b></p><div class="exampleInner"><pre>
<xforms:instance>
<data xmlns="">
<people>
<person>
<name>Jane Doe</name>
</person>
</people>
</data>
</xforms:instance>
<xforms:instance id="prototypes">
<prototypes xmlns="">
<person>
<name/>
</person>
</prototypes>
</xforms:instance>
</pre></div><p><b>Data After Operation</b></p><div class="exampleInner"><pre>
<xforms:instance>
<data xmlns="">
<people>
<b style="font-size: larger"><person></b>
<b style="font-size: larger"><name/></b>
<b style="font-size: larger"></person></b>
<person>
<name>Jane Doe</name>
</person>
</people>
</data>
</xforms:instance>
<xforms:instance id="prototypes">
<prototypes xmlns="">
<person>
<name/>
</person>
</prototypes>
</xforms:instance>
</pre></div></div></div><div class="div2">
<h3><a name="data-mutation-patterns-append-element" id="data-mutation-patterns-append-element"></a>B.2 Append Element Copy</h3><p>Pattern: <b><insert context="</b><em>parent of new element</em><b>" nodeset="*" origin="</b><em>element to copy</em><b>"/></b></p><div class="note"><p class="prefix"><b>Note:</b></p><p>The <code>context</code> attribute is used so that this pattern will work whether or not the parent element is empty.
</p></div><div class="exampleOuter"><p><b>Operation</b>: Append a new, empty <code>person</code> element into a list of <code>people</code></p><div class="exampleInner"><pre>
<xforms:insert context="people" nodeset="person" origin="instance('prototypes')/person"/>
</pre></div><p><b>Data Before Operation</b></p><div class="exampleInner"><pre>
<xforms:instance>
<data xmlns="">
<people>
<person>
<name>Jane Doe</name>
</person>
</people>
</data>
</xforms:instance>
<xforms:instance id="prototypes">
<prototypes xmlns="">
<person>
<name/>
</person>
</prototypes>
</xforms:instance>
</pre></div><p><b>Data After Operation</b></p><div class="exampleInner"><pre>
<xforms:instance>
<data xmlns="">
<people>
<person>
<name>Jane Doe</name>
</person>
<b style="font-size: larger"><person></b>
<b style="font-size: larger"><name/></b>
<b style="font-size: larger"></person></b>
</people>
</data>
</xforms:instance>
<xforms:instance id="prototypes">
<prototypes xmlns="">
<person>
<name/>
</person>
</prototypes>
</xforms:instance>
</pre></div></div></div><div class="div2">
<h3><a name="data-mutation-patterns-duplicate-element" id="data-mutation-patterns-duplicate-element"></a>B.3 Duplicate Element</h3><p>Pattern: <b><insert nodeset="</b><em>exact element to duplicate</em><b>"/></b></p><div class="note"><p class="prefix"><b>Note:</b></p><p>The <code>context</code> attribute is not used because this pattern assumes the ability to indicate an exact element to duplicate, so <code>nodeset</code> is used. If the element does not exist, the operation will have no effect.</p></div><div class="exampleOuter"><p><b>Operation</b>: Duplicate the selected element and place it as a following sibling</p><div class="exampleInner"><pre>
<xforms:insert nodeset="paragraph[2]"/>
</pre></div><p><b>Data Before Operation</b></p><div class="exampleInner"><pre>
<xforms:instance>
<document xmlns="">
<header>Lorem ipsum</header>
<paragraph>Lorem ipsum verterem voluptaria ...</paragraph>
<paragraph>Primis abhorreant delicatissimi ..</paragraph>
<header>Lorem ipsum</header>
<header>Lorem ipsum</header>
</document>
</xforms:instance>
</pre></div><p><b>Data After Operation</b></p><div class="exampleInner"><pre>
<xforms:instance>
<document xmlns="">
<header>Lorem ipsum</header>
<paragraph>Lorem ipsum verterem voluptaria ...</paragraph>
<paragraph>Primis abhorreant delicatissimi ...</paragraph>
<b style="font-size: larger"><paragraph>Primis abhorreant delicatissimi ...</paragraph></b>
<header>Lorem ipsum</header>
<header>Lorem ipsum</header>
</document>
</xforms:instance>
</pre></div></div></div><div class="div2">
<h3><a name="data-mutation-patterns-set-attribute" id="data-mutation-patterns-set-attribute"></a>B.4 Set Attribute</h3><p>Pattern: <b><insert context="</b><em>container element receiving attribute</em><b>" origin="</b><em>attribute to copy</em><b>"/></b></p><div class="note"><p class="prefix"><b>Note:</b></p><p>The <code>nodeset</code> attribute is not used because this pattern cannot indicate an exact attribute sibling of the attribute being inserted. This is true not only because attribute order is not guaranteed but also because the attribute being inserted may already exist, in which case the existing attribute is replaced. The <code>context</code> attribute is used when it is necessary to indicate the parent of the node being inserted.</p></div><div class="exampleOuter"><p><b>Operation</b>: Create or replace an attribute with a copy of a given attribute</p><div class="exampleInner"><pre>
<xforms:insert context="item[2]" origin="../item[1]/@rating"/>
<xforms:insert context="item[3]" origin="../item[1]/@rating"/>
</pre></div><p><b>Data Before Operation</b></p><div class="exampleInner"><pre>
<xforms:instance>
<items xmlns="">
<item key="23" rating="classified"/>
<item key="42"/>
<item key="68" rating="unknown"/>
</items>
</xforms:instance>
</pre></div><p><b>Data After Operation</b></p><div class="exampleInner"><pre>
<xforms:instance>
<items xmlns="">
<item key="23" rating="classified"/>
<item key="42" <b style="font-size: larger">rating="classified"</b>/>
<item key="68" rating="<b style="font-size: larger">classified</b>"/>
</items>
</xforms:instance>
</pre></div></div></div><div class="div2">
<h3><a name="data-mutation-patterns-remove-element" id="data-mutation-patterns-remove-element"></a>B.5 Remove Element</h3><p>Pattern: <b><delete nodeset="</b><em>exact element to remove</em><b>"/></b></p><div class="note"><p class="prefix"><b>Note:</b></p><p>The <code>context</code> attribute is not used because this pattern assumes the ability to indicate an exact element to remove, so <code>nodeset</code> is used. If the element does not exist, the operation will have no effect.</p></div><div class="exampleOuter"><p><b>Operation</b>: Remove <code>item</code> element in case it exists</p><div class="exampleInner"><pre>
<xforms:delete nodeset="item[2]"/>
</pre></div><p><b>Data Before Operation</b></p><div class="exampleInner"><pre>
<xforms:instance>
<shoppingcart xmlns="">
<item>
<product>SKU-0815</product>
<quantity>1</quantity>
<unitcost>29.99</unitcost>
<price>29.99</price>
</item>
<b style="font-size: larger"><item></b>
<b style="font-size: larger"><product>SKU-4711</product></b>
<b style="font-size: larger"><quantity>3</quantity></b>
<b style="font-size: larger"><unitcost>7.49</unitcost></b>
<b style="font-size: larger"><price>22.47</price></b>
<b style="font-size: larger"></item></b>
</shoppingcart>
</xforms:instance>
</pre></div><p><b>Data After Operation</b></p><div class="exampleInner"><pre>
<xforms:instance>
<shoppingcart xmlns="">
<item>
<product>SKU-0815</product>
<quantity>1</quantity>
<unitcost>29.99</unitcost>
<price>29.99</price>
</item>
</shoppingcart>
</xforms:instance>
</pre></div></div></div><div class="div2">
<h3><a name="data-mutation-patterns-remove-attribute" id="data-mutation-patterns-remove-attribute"></a>B.6 Remove Attribute</h3><p>Pattern: <b><delete nodeset="</b><em>exact attribute to remove</em><b>"/></b></p><div class="note"><p class="prefix"><b>Note:</b></p><p>The <code>context</code> attribute is not used because this pattern assumes the ability to indicate an exact attribute to remove, so <code>nodeset</code> is used. If the attribute does not exist, the operation will have no effect.</p></div><div class="exampleOuter"><p><b>Operation</b>: Remove <code>rating</code> attribute in case it exists</p><div class="exampleInner"><pre>
<xforms:delete nodeset="item/@rating"/>
</pre></div><p><b>Data Before Operation</b></p><div class="exampleInner"><pre>
<xforms:instance>
<items xmlns="">
<item key="23" <b style="font-size: larger">rating="classified"</b>/>
</items>
</xforms:instance>
</pre></div><p><b>Data After Operation</b></p><div class="exampleInner"><pre>
<xforms:instance>
<items xmlns="">
<item key="23"/>
</items>
</xforms:instance>
</pre></div></div></div><div class="div2">
<h3><a name="data-mutation-patterns-remove-nodeset" id="data-mutation-patterns-remove-nodeset"></a>B.7 Remove Nodeset</h3><p>Pattern: <b><delete nodeset="</b><em>nodeset to remove</em><b>"/></b></p><div class="note"><p class="prefix"><b>Note:</b></p><p>The <code>context</code> attribute is not used because this pattern assumes the ability to indicate a nodeset to remove, so <code>nodeset</code> is used. If the nodeset does not exist, the operation will have no effect.</p></div><div class="exampleOuter"><p><b>Operation</b>: Remove <code>track</code> nodeset in case it exists</p><div class="exampleInner"><pre>
<xforms:delete nodeset="track"/>
</pre></div><p><b>Data Before Operation</b></p><div class="exampleInner"><pre>
<xforms:instance>
<playlist xmlns="">
<name>Music for Airports</name>
<b style="font-size: larger"><track id="382"/></b>
<b style="font-size: larger"><track id="461"/></b>
<b style="font-size: larger"><track id="629"/></b>
</playlist>
</xforms:instance>
</pre></div><p><b>Data After Operation</b></p><div class="exampleInner"><pre>
<xforms:instance>
<playlist xmlns="">
<name>Music for Airports</name>
</playlist>
</xforms:instance>
</pre></div></div></div><div class="div2">
<h3><a name="data-mutation-patterns-copy-nodeset" id="data-mutation-patterns-copy-nodeset"></a>B.8 Copy Nodeset</h3><p>Pattern: <b><insert context="</b><em>parent of new nodeset</em><b>" nodeset="*" origin="</b><em>nodeset to copy</em><b>"/></b></p><div class="note"><p class="prefix"><b>Note:</b></p><p>The <code>context</code> attribute is used so that this pattern will work whether or not the parent element is empty.</p></div><div class="exampleOuter"><p><b>Operation</b>: Append a <code>person</code> nodeset into a list of <code>people</code> </p><div class="exampleInner"><pre>
<xforms:insert context="people" nodeset="person" origin="instance('prototypes')/person"/>
</pre></div><p><b>Data Before Operation</b></p><div class="exampleInner"><pre>
<xforms:instance>
<data xmlns="">
<people/>
</data>
</xforms:instance>
<xforms:instance id="prototypes">
<prototypes xmlns="">
<person>
<name>Jane Doe</name>
</person>
<person>
<name>John Doe</name>
</person>
<person>
<name>Joe Sixpack</name>
</person>
</prototypes>
</xforms:instance>
</pre></div><p><b>Data After Operation</b></p><div class="exampleInner"><pre>
<xforms:instance>
<data xmlns="">
<people>
<b style="font-size: larger"><person></b>
<b style="font-size: larger"><name>Jane Doe</name></b>
<b style="font-size: larger"></person></b>
<b style="font-size: larger"><person></b>
<b style="font-size: larger"><name>John Doe</name></b>
<b style="font-size: larger"></person></b>
<b style="font-size: larger"><person></b>
<b style="font-size: larger"><name>Joe Sixpack</name></b>
<b style="font-size: larger"></person></b>
</people>
</data>
</xforms:instance>
<xforms:instance id="prototypes">
<prototypes xmlns="">
<person>
<name>Jane Doe</name>
</person>
<person>
<name>John Doe</name>
</person>
<person>
<name>Joe Sixpack</name>
</person>
</prototypes>
</xforms:instance>
</pre></div></div></div><div class="div2">
<h3><a name="data-mutation-patterns-copy-attributelist" id="data-mutation-patterns-copy-attributelist"></a>B.9 Copy Attribute List</h3><p>Pattern: <b><insert context="</b><em>exact element receiving attribute list</em><b>" origin="</b><em>attribute list to copy</em><b>"/></b></p><div class="exampleOuter"><p><b>Operation</b>: Copy attribute list from one <code>item</code> to another</p><div class="exampleInner"><pre>
<xforms:insert context="item[2]" origin="../item[1]/@*"/>
</pre></div><p><b>Data Before Operation</b></p><div class="exampleInner"><pre>
<xforms:instance>
<items xmlns="">
<item key="0" rating="classified"/>
<item/>
</items>
</xforms:instance>
</pre></div><p><b>Data After Operation</b></p><div class="exampleInner"><pre>
<xforms:instance>
<items xmlns="">
<item key="0" rating="classified"/>
<item <b style="font-size: larger">key="0" rating="classified"</b>/>
</prototypes>
</xforms:instance>
</pre></div></div></div><div class="div2">
<h3><a name="data-mutation-patterns-replace-element" id="data-mutation-patterns-replace-element"></a>B.10 Replace Element</h3><p>
Pattern: <b><insert nodeset="</b><em>exact element to replace</em><b>" origin="</b><em>element to copy</em><b>"/></b>
<b><delete nodeset="</b><em>exact element to replace</em><b>"/></b>
</p><div class="note"><p class="prefix"><b>Note:</b></p><p>The <code>context</code> attribute is not used because this pattern assumes the ability to indicate an exact element to replace, so <code>nodeset</code> is used. If the element does not exist, both insert and delete operation will have no effect.</p></div><div class="exampleOuter"><p><b>Operation</b>: Replace a <code>person</code> element by copying a new one and removing the old one</p><div class="exampleInner"><pre>
<xforms:insert nodeset="person[1]" origin="instance('prototypes')/person"/>
<xforms:delete nodeset="person[1]"/>
</pre></div><p><b>Data Before Operation</b></p><div class="exampleInner"><pre>
<xforms:instance>
<people xmlns="">
<person>
<name>John Doe</name>
</person>
</people>
</xforms:instance>
<xforms:instance id="prototypes">
<prototypes xmlns="">
<person>
<name/>
</person>
</prototypes>
</xforms:instance>
</pre></div><p><b>Data After Operation</b></p><div class="exampleInner"><pre>
<xforms:instance>
<people xmlns="">
<person>
<b style="font-size: larger"><name/></b>
</person>
</people>
</xforms:instance>
<xforms:instance id="prototypes">
<prototypes xmlns="">
<person>
<name/>
</person>
</prototypes>
</xforms:instance>
</pre></div></div></div><div class="div2">
<h3><a name="data-mutation-patterns-replace-attribute" id="data-mutation-patterns-replace-attribute"></a>B.11 Replace Attribute</h3><p>Pattern: <b><setvalue ref="</b><em>exact attribute to replace</em><b>" value="</b><em>attribute to copy</em><b>"/></b></p><div class="note"><p class="prefix"><b>Note:</b></p><p>If the attribute does not exist, the operation will have no effect.</p></div><div class="exampleOuter"><p><b>Operation</b>: Replace an attribute with the copy of a given attribute</p><div class="exampleInner"><pre>
<xforms:setvalue ref="item[2]/@key" value="../../item[1]/@key"/>
</pre></div><p><b>Data Before Operation</b></p><div class="exampleInner"><pre>
<xforms:instance >
<items xmlns="">
<item key="0"/>
<item key="4711"/>
</items>
</xforms:instance>
</pre></div><p><b>Data After Operation</b></p><div class="exampleInner"><pre>
<xforms:instance >
<items xmlns="">
<item key="0"/>
<item <b style="font-size: larger">key="0"</b>/>
</items>
</xforms:instance>
</pre></div></div></div><div class="div2">
<h3><a name="data-mutation-patterns-replace-instance" id="data-mutation-patterns-replace-instance"></a>B.12 Replace Instance with Insert</h3><p>Pattern: <b><insert nodeset="</b><em>root node of instance to replace</em><b>" origin="</b><em>element to copy</em><b>"/></b></p><div class="note"><p class="prefix"><b>Note:</b></p><p>The <code>context</code> attribute is not used because this pattern assumes the ability to indicate an instance root node to replace, so <code>nodeset</code> is used. Since an instance cannot be empty, <code>nodeset</code> will always be non-empty. Insert implements special handling for instance root nodes, thus a delete operation is not necessary.</p></div><div class="exampleOuter"><p><b>Operation</b>: Replace instance root node with an empty <code>shoppingcart</code> element</p><div class="exampleInner"><pre>
<xforms:insert nodeset="." origin="instance('prototypes')/shoppingcart"/>
</pre></div><p><b>Data Before Operation</b></p><div class="exampleInner"><pre>
<xforms:instance>
<shoppingcart xmlns="">
<b style="font-size: larger"><item></b>
<b style="font-size: larger"><product>SKU-0815</product></b>
<b style="font-size: larger"><quantity>1</quantity></b>
<b style="font-size: larger"><unitcost>29.99</unitcost></b>
<b style="font-size: larger"><price>29.99</price></b>
<b style="font-size: larger"></item></b>
<b style="font-size: larger"><item></b>
<b style="font-size: larger"><product>SKU-4711</product></b>
<b style="font-size: larger"><quantity>3</quantity></b>
<b style="font-size: larger"><unitcost>7.49</unitcost></b>
<b style="font-size: larger"><price>22.47</price></b>
<b style="font-size: larger"></item></b>
</shoppingcart>
</xforms:instance>
<xforms:instance id="prototypes">
<prototypes xmlns="">
<shoppingcart/>
</prototypes>
</xforms:instance>
</pre></div><p><b>Data After Operation</b></p><div class="exampleInner"><pre>
<xforms:instance>
<shoppingcart xmlns=""/>
</xforms:instance>
<xforms:instance>
<prototypes xmlns="">
<shoppingcart/>
</prototypes>
</xforms:instance>
</pre></div></div></div><div class="div2">
<h3><a name="data-mutation-patterns-move-element" id="data-mutation-patterns-move-element"></a>B.13 Move Element</h3><p>
Pattern: <b><insert context="</b><em>new parent of element</em><b>" nodeset="*" origin="</b><em>exact element to move</em><b>"/></b>
<b><delete nodeset="</b><em>exact element to move</em><b>"/></b>
</p><div class="note"><p class="prefix"><b>Note:</b></p><p>The <code>context</code> attribute is used for insert so that this pattern will work whether or not the new parent element is empty. For delete the <code>nodeset</code> attribute is used instead because this pattern assumes the ability to indicate an exact element to move. If the element to be moved does not exist, both insert and delete operation will have no effect.
</p></div><div class="exampleOuter"><p><b>Operation</b>: Copy an existing element to a new parent and remove the original</p><div class="exampleInner"><pre>
<xforms:insert context="playlist[2]" nodeset="track" origin="../playlist[1]/track[2]"/>
<xforms:delete nodeset="playlist[1]/track[2]"/>
</pre></div><p><b>Data Before Operation</b></p><div class="exampleInner"><pre>
<xforms:instance>
<library xmlns="">
<playlist>
<name>Music for Airports</name>
<track id="382"/>
<b style="font-size: larger"><track id="461"/></b>
<track id="629"/>
</playlist>
<playlist>
<name>Lullabies</name>
<track id="251"/>
<track id="331"/>
</playlist>
</library>
</xforms:instance>
</pre></div><p><b>Data After Operation</b></p><div class="exampleInner"><pre>
<xforms:instance>
<library xmlns="">
<playlist>
<name>Music for Airports</name>
<track id="382"/>
<track id="629"/>
</playlist>
<playlist>
<name>Lullabies</name>
<track id="251"/>
<track id="331"/>
<b style="font-size: larger"><track id="461"/></b>
</playlist>
</library>
</xforms:instance>
</pre></div></div></div><div class="div2">
<h3><a name="data-mutation-patterns-move-attribute" id="data-mutation-patterns-move-attribute"></a>B.14 Move Attribute</h3><p>
Pattern: <b><insert context="</b><em>exact element receiving attribute</em><b>" origin="</b><em>exact attribute to move</em><b>"/></b>
<b><delete nodeset="</b><em>exact attribute to move</em><b>"/></b>
</p><div class="note"><p class="prefix"><b>Note:</b></p><p>If the attribute to be moved does not exist, both insert and delete operation will have no effect.</p></div><div class="exampleOuter"><p><b>Operation</b>: Copy an existing attribute to a new element and remove the original</p><div class="exampleInner"><pre>
<xforms:insert context="item[2]" origin="../item[1]/@rating"/>
<xforms:delete nodeset="item[1]/@rating"/>
</pre></div><p><b>Data Before Operation</b></p><div class="exampleInner"><pre>
<xforms:instance>
<items xmlns="">
<item key="23" <b style="font-size: larger">rating="classified"</b>/>
<item key="42"/>
</items>
</xforms:instance>
</pre></div><p><b>Data After Operation</b></p><div class="exampleInner"><pre>
<xforms:instance>
<items xmlns="">
<item key="23"/>
<item key="42" <b style="font-size: larger">rating="classified"</b>/>
</items>
</xforms:instance>
</pre></div></div></div><div class="div2">
<h3><a name="data-mutation-patterns-insert-arbitrary" id="data-mutation-patterns-insert-arbitrary"></a>B.15 Insert Element into Non-Contiguous, Heterogeneous Nodeset</h3><p>
Pattern: <b><insert nodeset="</b><em>non-contiguous, heterogeneous nodeset</em><b>" origin="</b><em>element to copy</em><b>" at="</b><em>insert location</em><b>"/></b>
</p><div class="note"><p class="prefix"><b>Note:</b></p><p>The <code>context</code> attribute is not used because it adheres to the first node rule and therefore would not allow to select a non-contiguous nodeset. The <code>nodeset</code> attribute is used instead to select a nodeset consisting of nodes with different names and different parents. The parent of the new node is the same as the parent of the insert location node selected by the combination of <code>nodeset</code> and <code>at</code>.</p></div><div class="exampleOuter"><p><b>Operation</b>: Copy an existing element into a non-contiguous, heterogeneous nodeset at a specified position</p><div class="exampleInner"><pre>
<xforms:insert nodeset="chapter/*" origin="instance('prototypes')/paragraph" at="7" position="before"/>
</pre></div><p><b>Data Before Operation</b></p><div class="exampleInner"><pre>
<xforms:instance>
<document xmlns="">
<chapter>
<header>Lorem ipsum</header>
<paragraph>Lorem ipsum verterem voluptaria ...</paragraph>
<diagram>Exemplum 1</diagram>
<diagram>Exemplum 2</diagram>
<paragraph>Primis abhorreant delicatissimi ...</paragraph>
</chapter>
<chapter>
<header>Lorem ipsum</header>
<diagram>Exemplum 3</diagram>
</chapter>
</document>
</xforms:instance>
<xforms:instance id="prototypes">
<prototypes xmlns="">
<chapter/>
<header/>
<paragraph/>
<diagram/>
</prototypes>
</xforms:instance>
</pre></div><p><b>Data After Operation</b></p><div class="exampleInner"><pre>
<xforms:instance>
<document xmlns="">
<chapter>
<header>Lorem ipsum</header>
<paragraph>Lorem ipsum verterem voluptaria ...</paragraph>
<diagram>Exemplum 1</diagram>
<diagram>Exemplum 2</diagram>
<paragraph>Primis abhorreant delicatissimi ...</paragraph>
</chapter>
<chapter>
<header>Lorem ipsum</header>
<b style="font-size: larger"><paragraph/></b>
<diagram>Exemplum 3</diagram>
</chapter>
</document>
</xforms:instance>
<xforms:instance id="prototypes">
<prototypes xmlns="">
<chapter/>
<paragraph/>
<diagram/>
</prototypes>
</xforms:instance>
</pre></div></div></div></div><div class="div1">
<h2><a name="recalc" id="recalc"></a>C Recalculation Sequence Algorithm</h2><p>XForms Processors are free (and encouraged) to skip or optimize any steps in this algorithm, as long as the end result is the same. The XForms recalculation algorithm considers model items and model item properties to be vertices in a directed graph. Edges between the vertices represent computational dependencies between vertices.</p><p>Following is the default handling for a <code>recalculate</code> action. Action <code>recalculate</code> is defined in <a href="#action-recalculate"><b>10.10 The recalculate Element</b></a>.</p><ol class="enumar"><li><p>A master dependency directed graph is created as detailed in <a href="#rpm-processing-recalc-mddg"><b>C.1 Details on Creating the Master Dependency Directed Graph</b></a>.</p></li><li><p>To provide consistent behavior, implementations must reduce the number of vertices to be processed by computing a pertinent dependency subgraph consisting only of vertices and edges that are reachable from nodes that require recomputation. This is detailed in <a href="#rpm-processing-recalc-pds"><b>C.2 Details on Creating the Pertinent Dependency Subgraph</b></a>. Note that on a first recomputation (such as on form load), the pertinent dependency subgraph will be the same as the master dependency directed graph.</p></li><li><p>A topological sort is performed on the vertices of the pertinent dependency subgraph, resulting in an order of evaluation in which each vertex is evaluated only after those vertices on which it depends and before all vertices which depend on it. The topological sort algorithm is discussed at <a href="#ref-art">[Algorithms]</a>.</p></li><li><p>The <code>recalculate</code> process completes.</p></li></ol><div class="div2">
<h3><a name="rpm-processing-recalc-mddg" id="rpm-processing-recalc-mddg"></a>C.1 Details on Creating the Master Dependency Directed Graph</h3><p>The master dependency directed graph can be considered an array with one record for each vertex, each having the following fields:</p><blockquote><p><b>InstanceNode</b>: a reference to the associated instance data node<br><b>type</b>: indicates the aspect of the instance node represented by the vertex (the text content or a model item property such as readOnly or required)<br><b>depList</b>: a list of vertices that refer to this vertex<br><b>in-degree</b>: the number of vertices on which this vertex depends<br><b>visited</b>: a flag used to ensure vertices are not added to a subgraph multiple times<br><b>index</b>: an association between vertices in the master dependency directed graph and a subgraph</p></blockquote><p>The <code>depList</code> for each vertex is assigned based on the referenced XML nodes of instance nodes, which are obtained by parsing the computed expression bound to the node (e.g., by calculate, relevant, readonly, or required). Any expression violating any Binding Expression Constraint causes an exception (<a href="#evt-computeException"><b>4.5.2 The xforms-compute-exception Event</b></a>), terminating the <code>recalculate</code> process.</p><p>Specifically, the <code>depList</code> for a vertex <code>v</code> is assigned to be the vertices other than <code>v</code> whose computational expressions reference <code>v</code> (described below). Vertex <code>v</code> is excluded from its own <code>depList</code> to allow self-references to occur without causing a circular reference exception.</p><p>A computational expression appearing in a <code>calculate</code> attribute controls the text content (value) of one or more instance nodes. A vertex exists for each instance node to represent the expression in the context of the node. Likewise, computational expressions for model item properties such as <code>readOnly</code> and <code>required</code> are applied to one or more instance nodes, and vertices are created to represent such expressions in the context of each applicable node. The computational expression of each vertex must be examined to determine the XML nodes to which it refers. Any expression violating any Binding Expression Constraint causes an exception (<a href="#evt-computeException"><b>4.5.2 The xforms-compute-exception Event</b></a>), terminating the <code>recalculate</code> process. A computation expression refers to a vertex <code>v</code> if a subexpression indicates the InstanceNode for <code>v</code> and <code>v</code> represents the instance node text content (its value). In this version of XForms, model item properties such as <code>readOnly</code> and <code>required</code> cannot be referenced in an expression.</p></div><div class="div2">
<h3><a name="rpm-processing-recalc-pds" id="rpm-processing-recalc-pds"></a>C.2 Details on Creating the Pertinent Dependency Subgraph</h3><p>If all calculations must be performed, which is the case on form load, then the pertinent dependency subgraph is simply a duplicate of the master dependency directed graph. If the recalculation algorithm is invoked with a list of changed instance data nodes since the last recalculation, then the pertinent dependency subgraph is obtained by exploring the paths of edges and vertices in the computational dependency directed graph that are reachable from each vertex in the change list. The method of path exploration can be depth first search, a suitable version of which appears in the pseudo-code below.</p><div class="exampleOuter">
<div class="exampleHead">Sample Algorithm to Create the Pertinent Dependency Subgraph</div><p>This algorithm creates a pertinent dependency subgraph <code>S</code> from a list of changed instance data nodes <code>L<sub>c</sub></code>. Variables such as <code>v</code> and <code>w</code> represent vertices in the master dependency directed graph. The same variables ending with <code>S</code> indicate vertices in the pertinent dependency subgraph <code>S</code>.</p><div class="exampleInner"><pre>
// Use depth-first search to explore master digraph subtrees rooted at
// each changed vertex. A 'visited' flag is used to stop exploration
// at the boundaries of previously explored subtrees (because subtrees
// can overlap in directed graphs).
for each vertex <em>r</em> in <em>Lc</em>
if <em>r</em> is not visited
{
Push the pair (NIL, <em>r</em>) onto a stack
while the stack is not empty
{
(<em>v</em>, <em>w</em>) = pop dependency pair from stack
if <em>w</em> is not visited
{
Set the visited flag of <em>w</em> to true
Create a vertex <em>wS</em> in S to represent <em>w</em>
Set the index of <em>w</em> equal to the array location of <em>wS</em>
Set the index of <em>wS</em> equal to the array location of <em>w</em>
Set the InstanceNode of <em>wS</em> equal to the InstanceNode of <em>w</em>
Set the type of <em>wS</em> equal to the type of <em>w</em>
For each dependency node <em>x</em> of <em>w</em>
Push the pair (<em>w</em>, <em>x</em>) onto the stack
}
else Obtain <em>wS</em> from index of <em>w</em>
if <em>v</em> is not NIL
{
Obtain <em>vS</em> from index of <em>v</em>
Add dependency node for <em>wS</em> to <em>vS</em>
Increment inDegree of <em>wS</em>
}
}
}
// Now clear the visited flags set in the loop above
for each vertex <em>vS</em> in S
{
Obtain <em>v</em> from index of <em>vS</em>
Assign false to the visited flag of <em>v</em>
}</pre></div></div><p>Note that the number of vertices and dependency nodes in the pertinent dependency subgraph is not known beforehand, but a method such as array doubling (see <a href="#ref-ddj">[DDJ-ArrayDoubling]</a>) can be used to ensure that building the subgraph is performed in time linear in the size of <code>S</code>.</p></div><div class="div2">
<h3><a name="rpm-processing-recalc-compute" id="rpm-processing-recalc-compute"></a>C.3 Details on Computing Individual Vertices</h3><p>The following steps process vertices, resulting in a recalculated form:</p><ol class="enumar"><li><p>A vertex with inDegree of 0 is selected for evaluation and removed from the pertinent dependency subgraph. In the case where more than one vertex has inDegree zero, no particular ordering is specified. If the pertinent dependency subgraph contains vertices, but none have an inDegree of 0, then the calculation structure of the form has a loop, and an exception (<a href="#evt-computeException"><b>4.5.2 The xforms-compute-exception Event</b></a>) must be thrown, terminating processing.</p></li><li><p>If the vertex corresponds to a computed item, computed expressions are evaluated as follows:</p><ol class="enumla"><li><p><code>calculate</code>: If the value of the model item changes, the corresponding instance data is updated and the dirty flag is set.</p></li><li><p><code>relevant</code>, <code>readonly</code>, <code>required</code>, <code>constraint</code>: If any or all of these computed properties change, the new settings are placed into effect for associated form controls.</p></li></ol></li><li><p>For each vertex in the <code>depList</code> of the removed vertex, decrement the inDegree by 1.</p></li><li><p>If no vertices remain in the pertinent dependency subgraph, then the calculation has successfully completed. Otherwise, repeat this sequence from step 1.</p></li></ol></div><div class="div2">
<h3><a name="rpm-processing-recalc-example" id="rpm-processing-recalc-example"></a>C.4 Example of Calculation Processing</h3><p>For example, consider six vertices <code>a</code>, <code>b</code>, <code>v</code>, <code>w</code>, <code>x</code>, and <code>y</code>. Let <code>a</code> and <code>b</code> represent the text content of instance nodes that will be set by a binding from user input controls. Let <code>v</code> and <code>w</code> be vertices representing the calculated value and the validity property of a third instance node <code>c</code>. These vertices would result from a <code>bind</code> element <code>B</code> with <code>calculate</code> and <code>constraint</code> attributes and a <code>nodeset</code> attribute that indicates <code>c</code>. Suppose that the value of <code>c</code> is the product of <code>a</code> and <code>b</code> and that the value is only valid if it does not exceed 100. Likewise, suppose <code>x</code> and <code>y</code> are vertices representing the calculated value and the validity property of a fourth instance node <code>d</code>. Let the value of <code>d</code> be the sum of <code>a</code> and <code>b</code>, and let <code>d</code> be valid if the value does not exceed 20. The figure below depicts the dependency digraph for this example.</p><p> <img src="images/depdigraph.gif" alt="Dependency graph"> </p><p>Vertices <code>a</code> and <code>b</code> have edges leading to <code>v</code> and <code>x</code> because these vertices represent the calculate expressions of <code>c</code> and <code>d</code>, which reference <code>a</code> and <code>b</code> to compute their product and sum, respectively. Similarly, <code>v</code> and <code>x</code> have directed edges to <code>w</code> and <code>y</code>, respectively, because <code>w</code> and <code>y</code> represent the <code>constraint</code> expressions of <code>c</code> and <code>d</code>, which reference the values of <code>c</code> and <code>d</code> to compare them with boundary values.</p><p>If <code>a</code> and <code>b</code> are initially equal to 10, and the user changes <code>a</code> to 11, then it is necessary to first recalculate <code>v</code> (the value of <code>c</code>) then recalculate <code>w</code> (the validity property of the value of <code>c</code>). Likewise, <code>x</code> (the value of <code>d</code>) must be recalculated before recalculating <code>y</code> (the validity property of the value of <code>d</code>). In both cases, the validity of the value does not change to <code>false</code> until after the new product and sum are computed based on the change to <code>a</code>. However, there are no interdependencies between <code>v</code> and <code>x</code>, so the product and sum could be computed in either order.</p><p>The pertinent subgraph excludes <code>b</code> and only vertex <code>a</code> has in-degree of zero. The vertex <code>a</code> is processed first. It is not a computed vertex, so no recalculation occurs on <code>a</code>, but its removal causes <code>v</code> and <code>x</code> to have in-degree zero. Vertex <code>v</code> is processed second. Its value changes to 121, and its removal drops the in-degree of vertex <code>w</code> to zero. Vertex <code>x</code> is processed next, changing value to 21. When <code>x</code> is removed, its neighbor <code>y</code> drops to in-degree zero. The fourth and fifth iterations of this process recalculate the validity of <code>w</code> and <code>y</code>, both of which change to false.</p></div></div><div class="div1">
<h2><a name="privsec" id="privsec"></a>D Privacy Considerations</h2><div class="div2">
<h3><a name="N89295" id="N89295"></a>D.1 Using P3P with XForms</h3><p>P3P privacy policies may be associated with any forms transmitted over HTTP that have URIs associated with them. In the future, mechanisms may be specified for associating P3P policies with content transmitted over other protocols. </p><p>P3P allows for policies to be associated with an individual URI or a set of URIs. By associating a separate policy with each URI a site can declare a very precise policy that addresses exactly what data is collected with a particular HTTP request and how that data will be used. However, site management is substantially easier for many sites if they declare a single policy that covers many URIs, or even their entire Web presence. </p><p>The P3P specification specifies several methods for referencing a P3P policy reference file, which in turn associates P3P policies with URIs and cookies. XForms can be P3P enabled using any of the methods that are appropriate for the Web site in which they are embedded. Some special considerations regarding forms are addressed in the P3P Specification. <a href="#ref-p3p-1.0">[P3P 1.0]</a> </p><p>Different P3P policies may be applied to the representation of a form embedded in a containing document to that which is associated with the data submitted via that form. If the form representation is served from a different server than the form is submitted to, it is likely that separate P3P policy reference files and policies will be needed. Typically the form representation causes only <em>clickstream</em> data (as defined in <a href="#ref-p3p-1.0">[P3P 1.0]</a> section 5.6.4) to be transferred, while a form submission causes much more data to be transferred. </p></div></div><div class="div1">
<h2><a name="mode" id="mode"></a>E Input Modes (Non-Normative)</h2><p>The attribute <code>inputmode</code> provides a <em>hint</em> to the user agent to select an appropriate input mode for the text input expected in an associated form control. The input mode may be a keyboard configuration, an input method editor (also called front end processor) or any other setting affecting input on the device(s) used. </p><p>Using <code>inputmode</code>, the author can give hints to the agent that make form input easier for the user. Authors should provide <code>inputmode</code> attributes wherever possible, making sure that the values used cover a wide range of devices.</p><div class="div2">
<h3><a name="mode-syntax" id="mode-syntax"></a>E.1 <code>inputmode</code> Attribute Value Syntax</h3><p>The value of the <code>inputmode</code> attribute is a white space separated list of tokens. Tokens are either sequences of alphabetic letters or absolute URIs. The later can be distinguished from the former by noting that absolute URIs contain a ':'. Tokens are case-<span>in</span>sensitive. All the tokens consisting of alphabetic letters only are defined in this specification, in <a href="#mode-values"><b>E.3 List of Tokens</b></a> (or a successor of this specification).</p><p>This specification does not define any URIs for use as tokens, but allows others to define such URIs for extensibility. This may become necessary for devices with input modes that cannot be covered by the tokens provided here. The URI should dereference to a human-readable description of the input mode associated with the use of the URI as a token. This description should describe the input mode indicated by this token, and whether and how this token modifies other tokens or is modified by other tokens.</p></div><div class="div2">
<h3><a name="mode-ua-behavior" id="mode-ua-behavior"></a>E.2 User Agent Behavior</h3><p>Upon entering an empty form control with an <code>inputmode</code> attribute, the user agent should select the input mode indicated by the <code>inputmode</code> attribute value. User agents should not use the <code>inputmode</code> attribute to set the input mode when entering a form control with text already present. To set the appropriate input mode when entering a form control that already contains text, user agents should rely on platform-specific conventions.</p><p>User agents should make available all the input modes which are supported by the (operating) system/device(s) they run on/have access to, and which are installed for regular use by the user. This is typically only a small subset of the input modes that can be described with the tokens defined here.</p><div class="note"><p class="prefix"><b>Note:</b></p><p>Additional guidelines for user agent implementation are found at <a href="#ref-uaag-1.0">[UAAG 1.0]</a>. </p></div><p>The following simple algorithm is used to define how user agents match the values of an <code>inputmode</code> attribute to the input modes they can provide. This algorithm does not have to be implemented directly; user agents just have to behave as if they used it. The algorithm is not designed to produce "obvious" or "desirable" results for every possible combination of tokens, but to produce correct behavior for frequent token combinations and predictable behavior in all cases.</p><p>First, each of the input modes available is represented by one or more lists of tokens. An input mode may correspond to more than one list of tokens; as an example, on a system set up for a Greek user, both "greek upperCase" and "user upperCase" would correspond to the same input mode. No two lists will be the same.</p><p>Second, the <code>inputmode</code> attribute is scanned from front to back. For each token <var>t</var> in the <code>inputmode</code> attribute, if in the remaining list of tokens representing available input modes there is any list of tokens that contains <var>t</var>, then all lists of tokens representing available input modes that do not contain <var>t</var> are removed. If there is no remaining list of tokens that contains <var>t</var>, then <var>t</var> is ignored.</p><p>Third, if one or more lists of tokens are left, and they all correspond to the same input mode, then this input mode is chosen. If no list is left (meaning that there was none at the start) or if the remaining lists correspond to more than one input mode, then no input mode is chosen.</p><div class="exampleOuter"><p>Example: Assume the list of lists of tokens representing the available input modes is: {"cyrillic upperCase", "cyrillic lowerCase", "cyrillic", "latin", "user upperCase", "user lowerCase"}, then the following <code>inputmode</code> values select the following input modes: "cyrillic title" selects "cyrillic", "cyrillic lowerCase" selects "cyrillic lowerCase", "lowerCase cyrillic" selects "cyrillic lowerCase", "latin upperCase" selects "latin", but "upperCase latin" does select "cyrillic upperCase" or "user upperCase" if they correspond to the same input mode, and does not select any input mode if "cyrillic upperCase" and "user upperCase" do not correspond to the same input mode.</p></div></div><div class="div2">
<h3><a name="mode-values" id="mode-values"></a>E.3 List of Tokens</h3><p>Tokens defined in this specification are separated into two categories: <em>Script tokens</em> and <em>modifiers</em>. In <code>inputmode</code> attributes, script tokens should always be listed before modifiers.</p><div class="div3">
<h4><a name="mode-scripts" id="mode-scripts"></a>E.3.1 Script Tokens</h4><p>Script tokens provide a general indication of the set of characters that
is covered by an input mode. In most cases, script tokens correspond
directly to <a href="#ref-unicode-scripts">[Unicode Scripts]</a>. However, this neither means that an
input mode has to allow input for all the characters in the script,
nor that an input mode is limited to only characters from that
specific script. As an example, a "latin" keyboard doesn't cover all
the characters in the Latin script, and includes punctuation which is
not assigned to the Latin script.</p><p>The script tokens that are allowed are listed in <a href="#ref-unicode-script-names">[Unicode Script Names]</a>,
"codes for the representations of scripts". The allowable values are those listed
in the column "Property Value Alias" with the underscore character (_) removed,
and excluding the two values "Common", and "Unknown". At the time of writing, these values are:</p><ul><li><p><code>Arabic</code></p></li><li><p><code>Armenian</code></p></li><li><p><code>Balinese</code></p></li><li><p><code>Bengali</code></p></li><li><p><code>Bopomofo</code></p></li><li><p><code>Braille</code></p></li><li><p><code>Buginese</code></p></li><li><p><code>Buhid</code></p></li><li><p><code>CanadianAboriginal</code></p></li><li><p><code>Carian</code></p></li><li><p><code>Cherokee</code></p></li><li><p><code>Coptic</code></p></li><li><p><code>Cuneiform</code></p></li><li><p><code>Cypriot</code></p></li><li><p><code>Cyrillic</code></p></li><li><p><code>Deseret</code></p></li><li><p><code>Devanagari</code></p></li><li><p><code>Ethiopic</code></p></li><li><p><code>Georgian</code></p></li><li><p><code>Glagolitic</code></p></li><li><p><code>Gothic</code></p></li><li><p><code>Greek</code></p></li><li><p><code>Gujarati</code></p></li><li><p><code>Gurmukhi</code></p></li><li><p><code>Han</code></p></li><li><p><code>Hangul</code></p></li><li><p><code>Hanunoo</code></p></li><li><p><code>Hebrew</code></p></li><li><p><code>Hiragana</code></p></li><li><p><code>Kannada</code></p></li><li><p><code>Katakana</code></p></li><li><p><code>KatakanaOrHiragana</code></p></li><li><p><code>KayahLi</code></p></li><li><p><code>Kharoshthi</code></p></li><li><p><code>Khmer</code></p></li><li><p><code>Lao</code></p></li><li><p><code>Latin</code></p></li><li><p><code>Lepcha</code></p></li><li><p><code>Limbu</code></p></li><li><p><code>LinearB</code></p></li><li><p><code>Lycian</code></p></li><li><p><code>Lydian</code></p></li><li><p><code>Malayalam</code></p></li><li><p><code>Mongolian</code></p></li><li><p><code>Myanmar</code></p></li><li><p><code>NewTaiLue</code></p></li><li><p><code>Nko</code></p></li><li><p><code>Ogham</code></p></li><li><p><code>OlChiki</code></p></li><li><p><code>OldItalic</code></p></li><li><p><code>OldPersian</code></p></li><li><p><code>Oriya</code></p></li><li><p><code>Osmanya</code></p></li><li><p><code>PhagsPa</code></p></li><li><p><code>Phoenician</code></p></li><li><p><code>Rejang</code></p></li><li><p><code>Runic</code></p></li><li><p><code>Saurashtra</code></p></li><li><p><code>Shavian</code></p></li><li><p><code>Sinhala</code></p></li><li><p><code>Sundanese</code></p></li><li><p><code>SylotiNagri</code></p></li><li><p><code>Syriac</code></p></li><li><p><code>Tagalog</code></p></li><li><p><code>Tagbanwa</code></p></li><li><p><code>TaiLe</code></p></li><li><p><code>Tamil</code></p></li><li><p><code>Telugu</code></p></li><li><p><code>Thaana</code></p></li><li><p><code>Thai</code></p></li><li><p><code>Tibetan</code></p></li><li><p><code>Tifinagh</code></p></li><li><p><code>Ugaritic</code></p></li><li><p><code>Vai</code></p></li><li><p><code>Yi</code></p></li></ul><p>Seven other values are allowed:</p><table border="2" frame="border" summary="a list of additional allowed values for the inputmode attribute"><thead><tr><th rowspan="1" colspan="1">Input Mode Token</th><th rowspan="1" colspan="1">Comments</th></tr></thead><tbody><tr><td rowspan="1" colspan="1"><code>ipa</code></td><td rowspan="1" colspan="1">International Phonetic Alphabet</td></tr><tr><td rowspan="1" colspan="1"><code>hanja</code></td><td rowspan="1" colspan="1">Subset of 'han' used in writing Korean</td></tr><tr><td rowspan="1" colspan="1"><code>kanji</code></td><td rowspan="1" colspan="1">subset of 'han' used in writing Japanese</td></tr><tr><td rowspan="1" colspan="1"><code>math</code></td><td rowspan="1" colspan="1">mathematical symbols and related characters, representing the <a href="#ref-unicode-script-names">[Unicode Script Names]</a> code "Zmth"</td></tr><tr><td rowspan="1" colspan="1"><code>simplifiedHanzi</code></td><td rowspan="1" colspan="1">representing the <a href="#ref-unicode-script-names">[Unicode Script Names]</a> code "Hans"</td></tr><tr><td rowspan="1" colspan="1"><code>traditionalHanzi</code></td><td rowspan="1" colspan="1">representing the <a href="#ref-unicode-script-names">[Unicode Script Names]</a> code "Hant"</td></tr><tr><td rowspan="1" colspan="1"><code>user</code></td><td rowspan="1" colspan="1">special value denoting the 'native' input of the user according to the system environment</td></tr></tbody></table></div><div class="div3">
<h4><a name="mode-modifiers" id="mode-modifiers"></a>E.3.2 Modifier Tokens</h4><p>Modifier tokens can be added to the scripts they apply in order to more closely specify the kind of characters expected in the form control. Traditional PC keyboards do not need most modifier tokens (indeed, users on such devices would be quite confused if the software decided to change case on its own; CAPS lock for upperCase may be an exception). However, modifier tokens can be very helpful to set input modes for small devices.</p><table border="2" frame="border" summary="list of modifier tokens for attribute inputmode"><thead><tr><th rowspan="1" colspan="1">Input Mode Token</th><th rowspan="1" colspan="1">Comments</th></tr></thead><tbody><tr><td rowspan="1" colspan="1"><code>lowerCase</code></td><td rowspan="1" colspan="1">lowercase (for bicameral scripts)</td></tr><tr><td rowspan="1" colspan="1"><code>upperCase</code></td><td rowspan="1" colspan="1">uppercase (for bicameral scripts)</td></tr><tr><td rowspan="1" colspan="1"><code>titleCase</code></td><td rowspan="1" colspan="1">title case (for bicameral scripts): words start with an upper case letter</td></tr><tr><td rowspan="1" colspan="1"><code>startUpper</code></td><td rowspan="1" colspan="1">start input with one uppercase letter, then continue with lowercase letters</td></tr><tr><td rowspan="1" colspan="1"><code>digits</code></td><td rowspan="1" colspan="1">digits of a particular script (e.g. inputmode='thai digits')</td></tr><tr><td rowspan="1" colspan="1"><code>symbols</code></td><td rowspan="1" colspan="1">symbols, punctuation (suitable for a particular script)</td></tr><tr><td rowspan="1" colspan="1"><code>predictOn</code></td><td rowspan="1" colspan="1">text prediction switched on (e.g. for running text)</td></tr><tr><td rowspan="1" colspan="1"><code>predictOff</code></td><td rowspan="1" colspan="1">text prediction switched off (e.g. for passwords)</td></tr><tr><td rowspan="1" colspan="1"><code>halfWidth</code></td><td rowspan="1" colspan="1">half-width compatibility forms (e.g. Katakana; deprecated)</td></tr></tbody></table></div></div><div class="div2">
<h3><a name="mode-patterns" id="mode-patterns"></a>E.4 Relationship to XML Schema pattern facets</h3><p>User agents may use information available in an XML Schema pattern facet to set the input mode. Note that a pattern facet is a hard restriction on the lexical value of an instance data node, and can specify different restrictions for different parts of the data item. Attribute <code>inputmode</code> is a soft hint about the kinds of characters that the user may most probably start to input into the form control. Attribute <code>inputmode</code> is provided in addition to pattern facets for the following reasons:</p><ol class="enumar"><li><p>The set of allowable characters specified in a pattern may be so wide that it is not possible to deduce a reasonable input mode setting. Nevertheless, there frequently is a kind of characters that will be input by the user with high probability. In such a case, <code>inputmode</code> allows to set the input mode for the user's convenience.</p></li><li><p>In some cases, it would be possible to derive the input mode setting from the pattern because the set of characters allowed in the pattern closely corresponds to a set of characters covered by an <code>inputmode</code> attribute value. However, such a derivation would require a lot of data and calculations on the user agent.</p></li><li><p>Small devices may leave the checking of patterns to the server, but will easily be able to switch to those input modes that they support. Being able to make data entry for the user easier is of particular importance on small devices.</p></li></ol></div><div class="div2">
<h3><a name="mode-examples" id="mode-examples"></a>E.5 Examples</h3><div class="exampleOuter"><p>This is an example of <span> the user interface markup for </span> a form for user input in Japanese. .</p><div class="exampleInner"><pre>
<xf:input ref="name" inputmode="kanji">
<xf:label>Family name:</xf:label>
</xf:input>
<xf:input ref="nameKana" inputmode="katakana">
<xf:label>Family name in kana:</xf:label>
</xf:input>
<xf:input ref="given" inputmode="kanji">
<xf:label>Given name:</xf:label>
</xf:input>
<xf:input ref="givenKana" inputmode="katakana">
<xf:label>Given name in kana:</xf:label>
</xf:input>
<xf:input ref="email" inputmode="latin lowerCase">
<xf:label>Email:</xf:label>
</xf:input>
<xf:input ref="phone" inputmode="latin digits">
<xf:label>Telephone:</xf:label>
</xf:input>
<xf:textarea ref="comments" inputmode="user predictOn">
<xf:label>Comments:</xf:label>
</xf:textarea>
<xf:submit submission="sendit">
<xf:label>Send It</xf:label>
</xf:submit>
</pre></div></div></div></div><div class="div1">
<h2><a name="schema" id="schema"></a>F Schema for XForms (Non-Normative)</h2><p>The XML Schema for XForms, which has a target namespace <code>http://www.w3.org/2002/xforms</code>, is located at
<a href="http://www.w3.org/MarkUp/Forms/2007/XForms-11-Schema.xsd">http://www.w3.org/MarkUp/Forms/2007/XForms-11-Schema.xsd</a>.
</p><p>The RELAXNG (<a href="#ref-RELAXNG">[RELAXNG]</a>, <a href="#ref-RELAXNG-Compact">[RELAXNG Compact]</a>) Schema for XForms, which includes the target namespace <code>http://www.w3.org/2002/xforms</code> as well as the version suitable for import to a host language namespace, is located at
<a href="http://www.w3.org/MarkUp/Forms/2007/XForms-11-RELAXNG.zip">http://www.w3.org/MarkUp/Forms/2007/XForms-11-RELAXNG.zip</a>.
</p><div class="div2">
<h3><a name="schema-events" id="schema-events"></a>F.1 Schema for XML Events</h3><p>This XML Schema for XML Events is referenced by the XML Schema for
XForms, and located at
<a href="http://www.w3.org/TR/2003/REC-xml-events-20031014/#a_schema_attribs">
http://www.w3.org/TR/2003/REC-xml-events-20031014/#a_schema_attribs</a>.</p></div></div><div class="div1">
<h2><a name="style" id="style"></a>G XForms and Styling (Non-Normative)</h2><p>This informative section provides a broad outline of new and existing CSS features needed to style XForms content. A future Recommendation from the CSS Working Group will fully develop the specification of these features.</p><div class="div2">
<h3><a name="N90079" id="N90079"></a>G.1 Pseudo-classes</h3><p>A CSS pseudo-class is used to select elements for styling based on information that lies outside of the document tree or that cannot be expressed using the other selectors.</p><table border="1" summary="suggested pseudo-classes for styling forms"><tbody><tr><th rowspan="1" colspan="1">Name</th><th rowspan="1" colspan="1">Defined in:</th><th rowspan="1" colspan="1">Relationship to XForms</th></tr><tr><td rowspan="1" colspan="1"><code>:enabled</code> & <code>:disabled</code></td><td rowspan="1" colspan="1">[CSS3]</td><td rowspan="1" colspan="1">Selects any form control that is <a title="Relevant Form Control" href="#def-relevant-form-control">relevant</a> or <a title="Non-relevant Form Control" href="#def-non-relevant-form-control">non-relevant</a> (respectively).</td></tr><tr><td rowspan="1" colspan="1"><code>:required</code> & <code>:optional</code></td><td rowspan="1" colspan="1">TBD</td><td rowspan="1" colspan="1">Selects any core form control bound to a node with the model item property <code>required</code> evaluating to true or false (respectively).</td></tr><tr><td rowspan="1" colspan="1"><code>:valid</code> & <code>:invalid</code></td><td rowspan="1" colspan="1">TBD</td><td rowspan="1" colspan="1">Selects any core form control bound to a node that is currently valid or invalid (respectively), as defined by XForms. </td></tr><tr><td rowspan="1" colspan="1"><code>:read-only</code> & <code>:read-write</code></td><td rowspan="1" colspan="1">TBD</td><td rowspan="1" colspan="1">Selects any core form control bound to a node with the model item property <code>readonly</code> evaluating to true or false (respectively).</td></tr><tr><td rowspan="1" colspan="1"><code>:out-of-range</code> & <code>:in-range</code></td><td rowspan="1" colspan="1">TBD</td><td rowspan="1" colspan="1">Selects any core form control bound to a node that contains a value the form control is not or is capable of rendering, (respectively).</td></tr><tr><td rowspan="1" colspan="1"><code>:value-empty</code> & <code>:value-non-empty</code></td><td rowspan="1" colspan="1">TBD</td><td rowspan="1" colspan="1">Selects any core form control bound to a node whose content is the empty string or not the empty string (respectively).</td></tr></tbody></table><p>This list is not exhaustive; other pseudo-classes may be defined.</p></div><div class="div2">
<h3><a name="N90219" id="N90219"></a>G.2 Pseudo-elements</h3><p>Pseudo-elements are abstractions about the document tree beyond those specified by the document language. Pseudo-elements do not appear in the DOM; they are used only for purposes of styling.</p><table border="1" summary="suggested pseudo-elements for styling forms"><tbody><tr><th rowspan="1" colspan="1">Name</th><th rowspan="1" colspan="1">Defined in:</th><th rowspan="1" colspan="1">Relationship to XForms</th></tr><tr><td rowspan="1" colspan="1"><code>::value</code> </td><td rowspan="1" colspan="1">TBD</td><td rowspan="1" colspan="1">Represents the "active" area of a form control excluding the label; this corresponds in HTML to <code>input</code> and other form control elements. This pseudo-element is a child of the form control element, and appears immediately after the required <code>label</code> element.</td></tr><tr><td rowspan="1" colspan="1"><code>::repeat-item</code></td><td rowspan="1" colspan="1">TBD</td><td rowspan="1" colspan="1">Represents a single item from a repeating sequence. Its position is as a parent to all the elements in a single repeating item. Each <code>::repeat-item</code> is associated with a particular instance data node, and is affected by the model item properties (e.g. '<code>relevant</code>') found there, as the related style properties will cascade to the child elements. </td></tr><tr><td rowspan="1" colspan="1"><code>::repeat-index</code></td><td rowspan="1" colspan="1">TBD</td><td rowspan="1" colspan="1">Represents the current item of a repeating sequence. Its position is as a parent of all the elements in the index repeating item (and as a child to the <code>::repeat-item</code> pseudo-element), thus any style declarations applying to this pseudo-element override those on the parent <code>::repeat-item</code>.</td></tr></tbody></table><p>This list is not exhaustive; other pseudo-elements may be defined.</p></div><div class="div2">
<h3><a name="N90304" id="N90304"></a>G.3 Examples</h3><p>The following examples collects together styling recommendations from this document, expressing them with a CSS notation.
Throughout the examples, the following namespace declaration is assumed:</p><div class="exampleInner"><pre>
@namespace xf url('http://www.w3.org/2002/xforms');
</pre></div><p>From <a href="#ui-processing"><b>8.1.1 Implementation Requirements Common to All Form Controls</b></a>:
"All form controls, including <a title="" href="#def-container-form-control">container form controls</a>,
should have an inline layout by default... By default, <a title="" href="#def-repeat-item">repeat items</a>
should have a block layout." Hence, if the display property is not set via CSS, it should default to the following:</p><div class="exampleInner"><pre>
xf|input:enabled, xf|secret:enabled, xf|textarea:enabled, xf|output:enabled,
xf|upload:enabled, xf|range:enabled, xf|trigger:enabled, xf|submit:enabled,
xf|select:enabled, xf|select1:enabled { display: inline; }
xf|output:enabled { display: inline; }
xf|group:enabled, xf|switch:enabled { display: inline; }
xf|repeat:enabled { display: inline; }
::repeat-item:enabled { display:block; }
</pre></div><p>From <a href="#model-prop-relevant"><b>6.1.4 The relevant Property</b></a>:
"Typically, non-relevant content is not
presented, or it may be styled as disabled."
If the display property is not set via CSS, it should default to the following:</p><div class="exampleInner"><pre>
xf|input:disabled, xf|secret:disabled, xf|textarea:disabled,
xf|output:disabled, xf|upload:disabled, xf|range:disabled,
xf|trigger:disabled, xf|submit:disabled, xf|select:disabled,
xf|select1:disabled
{
display: none;
}
xf|output:disabled { display: none; }
xf|group:disabled, xf|switch:disabled { display: none; }
::repeat-item:disabled { display: none; }
</pre></div><p>Below is an example of how a form author can override
the default display:none styling of :disabled. Note that the
implementation must also implement the behavior of not
accepting user input in the disabled control.</p><div class="exampleInner"><pre>
xf|input.authorization:disabled {
display: inline; background-color: #bbbbbb
}
</pre></div><p>From <a href="#ui-processing"><b>8.1.1 Implementation Requirements Common to All Form Controls</b></a>:
"The readonly form control should render in a way which indicates that
entering or changing the value is not allowed."
Below is an example of one way to indicate this information.
CSS does not have a way to provide readonly behavior, so
this example merely changes the background color.
An implementation could use this style by default, and an author would
only need to use styling to override the default.</p><div class="exampleInner"><pre>
xf|input:enabled:readonly::value
{
display: inline; background-color: #888888
}
</pre></div><p>From <a href="#ui-processing"><b>8.1.1 Implementation Requirements Common to All Form Controls</b></a>:
"Except as noted, relevant form controls must distinguish
rendering between being bound to a required node versus a
non-required node. Exceptions are form controls that do not directly
render the string value of the bound node (including trigger and the
container form controls)."
Below is an example styling form controls bound to required nodes
with a soft yellow background. An implementation could use this style
by default, and an author would only need to use styling to override the default.</p><div class="exampleInner"><pre>
xf|input:enabled:required, xf|secret:enabled:required,
xf|textarea:enabled:required, xf|output:enabled:required,
xf|upload:enabled:required, xf|range:enabled:required,
xf|trigger:enabled:required, xf|submit:enabled:required,
xf|select:enabled:required, xf|select1:enabled:required
{
background-color: #FFFFD0
}
</pre></div><p>From <a href="#ui-processing"><b>8.1.1 Implementation Requirements Common to All Form Controls</b></a>:
Relevant form controls must distinguish rendering between valid and
"invalid states. Control of this behavior should be made available to
stylesheets."
Below is an example styling input controls bound to non-empty but
invalid nodes with a reddish background. An implementation could use this style
by default, and an author would only need to use styling to override the default.</p><div class="exampleInner"><pre>
xf|input:enabled:invalid:value-non-empty {
background-color: #ff8080;
}
</pre></div><p>From <a href="#ui-processing"><b>8.1.1 Implementation Requirements Common to All Form Controls</b></a>:
"Relevant form controls must indicate when the bound instance data
contains a value or content that the form control is not capable of
rendering. Control of this behavior should be made available to
stylesheets".
In this example, select, select1, and range controls bound nodes
whose values are not presentable by the controls are styled with
in red. An implementation could use this style
by default, and an author would only need to use styling to override the default.</p><div class="exampleInner"><pre>
xf|select1:enabled:out-of-range, xf|select1:enabled:out-of-range,
xf|range:enabled:out-of-range {
color: red;
}
</pre></div></div></div><div class="div1">
<h2><a name="xforms-examples" id="xforms-examples"></a>H Complete XForms Examples (Non-Normative)</h2><p> This section presents complete XForms examples. These and additional examples are maintained at <a href="http://www.w3.org/MarkUp/Forms/2002/Examples/">http://www.w3.org/MarkUp/Forms/2002/Examples</a>.</p><div class="div2">
<h3><a name="xforms-in-xhtml-00" id="xforms-in-xhtml-00"></a>H.1 XForms in XHTML</h3><div class="exampleInner">
<!-- converted by xmlverbatim.xsl 1.0.2, (c) O. Becker -->
<div class="xmlverb-default"><<span class="xmlverb-element-name">html</span><span class="xmlverb-ns-name"> xmlns</span>="<span class="xmlverb-ns-uri">http://www.w3.org/1999/xhtml</span>"<span class="xmlverb-ns-name"> xmlns:ev</span>="<span class="xmlverb-ns-uri">http://www.w3.org/2001/xml-events</span>"<span class="xmlverb-ns-name"> xmlns:my</span>="<span class="xmlverb-ns-uri">http://commerce.example.com/payment</span>" <span class="xmlverb-attr-name">xml:lang</span>="<span class="xmlverb-attr-content">en</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">head</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">title</span>><span class="xmlverb-text">XForms in XHTML</span></<span class="xmlverb-element-name">title</span>><span class="xmlverb-text"><br>
<br>
</span><<span class="xmlverb-element-name">model</span><span class="xmlverb-ns-name"> xmlns</span>="<span class="xmlverb-ns-uri">http://www.w3.org/2002/xforms</span>" <span class="xmlverb-attr-name">schema</span>="<span class="xmlverb-attr-content">payschema.xsd</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">instance</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">my</span>:<span class="xmlverb-element-name">payment</span> <span class="xmlverb-attr-name">as</span>="<span class="xmlverb-attr-content">credit</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">my</span>:<span class="xmlverb-element-name">cc</span> /><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">my</span>:<span class="xmlverb-element-name">exp</span> /><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-nsprefix">my</span>:<span class="xmlverb-element-name">payment</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-name">instance</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">submission</span> <span class="xmlverb-attr-name">action</span>="<span class="xmlverb-attr-content">http://www.example.com/buy.rb</span>" <span class="xmlverb-attr-name">method</span>="<span class="xmlverb-attr-content">post</span>" <span class="xmlverb-attr-name">id</span>="<span class="xmlverb-attr-content">s00</span>" /><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">bind</span> <span class="xmlverb-attr-name">nodeset</span>="<span class="xmlverb-attr-content">my:cc</span>" <span class="xmlverb-attr-name">relevant</span>="<span class="xmlverb-attr-content">../@as='credit'</span>" <span class="xmlverb-attr-name">required</span>="<span class="xmlverb-attr-content">true()</span>" /><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">bind</span> <span class="xmlverb-attr-name">nodeset</span>="<span class="xmlverb-attr-content">my:exp</span>" <span class="xmlverb-attr-name">relevant</span>="<span class="xmlverb-attr-content">../@as='credit'</span>" <span class="xmlverb-attr-name">required</span>="<span class="xmlverb-attr-content">true()</span>" /><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-name">model</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-name">head</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">body</span>><span class="xmlverb-text"><br>
...<br>
</span><<span class="xmlverb-element-name">group</span><span class="xmlverb-ns-name"> xmlns</span>="<span class="xmlverb-ns-uri">http://www.w3.org/2002/xforms</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">select1</span> <span class="xmlverb-attr-name">ref</span>="<span class="xmlverb-attr-content">@as</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">label</span>><span class="xmlverb-text">Select Payment Method</span></<span class="xmlverb-element-name">label</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">item</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">label</span>><span class="xmlverb-text">Cash</span></<span class="xmlverb-element-name">label</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">value</span>><span class="xmlverb-text">cash</span></<span class="xmlverb-element-name">value</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">message</span> <span class="xmlverb-attr-name">level</span>="<span class="xmlverb-attr-content">modeless</span>" <span class="xmlverb-attr-name">ev:event</span>="<span class="xmlverb-attr-content">xforms-select</span>"><span class="xmlverb-text"><br>
Please do not mail cash.</span></<span class="xmlverb-element-name">message</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-name">item</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">item</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">label</span>><span class="xmlverb-text">Credit</span></<span class="xmlverb-element-name">label</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">value</span>><span class="xmlverb-text">credit</span></<span class="xmlverb-element-name">value</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-name">item</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-name">select1</span>><span class="xmlverb-text"><br>
<br>
</span><<span class="xmlverb-element-name">input</span> <span class="xmlverb-attr-name">ref</span>="<span class="xmlverb-attr-content">my:cc</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">label</span>><span class="xmlverb-text">Credit Card Number</span></<span class="xmlverb-element-name">label</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">alert</span>><span class="xmlverb-text">Please specify a valid credit card number<br>
(use spaces or hyphens between digit groups)</span></<span class="xmlverb-element-name">alert</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-name">input</span>><span class="xmlverb-text"><br>
<br>
</span><<span class="xmlverb-element-name">input</span> <span class="xmlverb-attr-name">ref</span>="<span class="xmlverb-attr-content">my:exp</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">label</span>><span class="xmlverb-text">Expiration Date</span></<span class="xmlverb-element-name">label</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-name">input</span>><span class="xmlverb-text"><br>
<br>
</span><<span class="xmlverb-element-name">submit</span> <span class="xmlverb-attr-name">submission</span>="<span class="xmlverb-attr-content">s00</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">label</span>><span class="xmlverb-text">Buy</span></<span class="xmlverb-element-name">label</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-name">submit</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-name">group</span>><span class="xmlverb-text"><br>
...<br>
</span></<span class="xmlverb-element-name">body</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-name">html</span>><br>
</div>
</div><p>Schema file <code>payschema.xsd</code>:</p><div class="exampleInner">
<!-- converted by xmlverbatim.xsl 1.0.2, (c) O. Becker -->
<div class="xmlverb-default"><!--<span class="xmlverb-comment"> payschema.xsd </span>--><br>
<<span class="xmlverb-element-nsprefix">xs</span>:<span class="xmlverb-element-name">schema</span><span class="xmlverb-ns-name"> xmlns:my</span>="<span class="xmlverb-ns-uri">http://commerce.example.com/payment</span>"<span class="xmlverb-ns-name"> xmlns:xs</span>="<span class="xmlverb-ns-uri">http://www.w3.org/2001/XMLSchema</span>"<span class="xmlverb-ns-name"> xmlns:xsd</span>="<span class="xmlverb-ns-uri">http://www.w3.org/2001/XMLSchema</span>" <span class="xmlverb-attr-name">targetNamespace</span>="<span class="xmlverb-attr-content">http://commerce.example.com/payment</span>" <span class="xmlverb-attr-name">elementFormDefault</span>="<span class="xmlverb-attr-content">qualified</span>"><span class="xmlverb-text"><br>
<br>
</span><<span class="xmlverb-element-nsprefix">xs</span>:<span class="xmlverb-element-name">element</span> <span class="xmlverb-attr-name">name</span>="<span class="xmlverb-attr-content">payment</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xs</span>:<span class="xmlverb-element-name">complexType</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xs</span>:<span class="xmlverb-element-name">sequence</span> <span class="xmlverb-attr-name">minOccurs</span>="<span class="xmlverb-attr-content">0</span>" <span class="xmlverb-attr-name">maxOccurs</span>="<span class="xmlverb-attr-content">unbounded</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xs</span>:<span class="xmlverb-element-name">choice</span>><span class="xmlverb-text"> <br>
</span><<span class="xmlverb-element-nsprefix">xs</span>:<span class="xmlverb-element-name">element</span> <span class="xmlverb-attr-name">ref</span>="<span class="xmlverb-attr-content">my:cc</span>" /><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xs</span>:<span class="xmlverb-element-name">element</span> <span class="xmlverb-attr-name">ref</span>="<span class="xmlverb-attr-content">my:exp</span>" /><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-nsprefix">xs</span>:<span class="xmlverb-element-name">choice</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-nsprefix">xs</span>:<span class="xmlverb-element-name">sequence</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xs</span>:<span class="xmlverb-element-name">attribute</span> <span class="xmlverb-attr-name">name</span>="<span class="xmlverb-attr-content">as</span>" <span class="xmlverb-attr-name">type</span>="<span class="xmlverb-attr-content">my:paymentAs</span>" /><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-nsprefix">xs</span>:<span class="xmlverb-element-name">complexType</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-nsprefix">xs</span>:<span class="xmlverb-element-name">element</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xs</span>:<span class="xmlverb-element-name">element</span> <span class="xmlverb-attr-name">name</span>="<span class="xmlverb-attr-content">cc</span>" <span class="xmlverb-attr-name">type</span>="<span class="xmlverb-attr-content">my:cc</span>" /><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xs</span>:<span class="xmlverb-element-name">element</span> <span class="xmlverb-attr-name">name</span>="<span class="xmlverb-attr-content">exp</span>" <span class="xmlverb-attr-name">type</span>="<span class="xmlverb-attr-content">xsd:gYearMonth</span>" /><span class="xmlverb-text"><br>
<br>
</span><<span class="xmlverb-element-nsprefix">xs</span>:<span class="xmlverb-element-name">simpleType</span> <span class="xmlverb-attr-name">name</span>="<span class="xmlverb-attr-content">cc</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xs</span>:<span class="xmlverb-element-name">restriction</span> <span class="xmlverb-attr-name">base</span>="<span class="xmlverb-attr-content">xsd:string</span>"><span class="xmlverb-text"> <br>
</span><<span class="xmlverb-element-nsprefix">xs</span>:<span class="xmlverb-element-name">minLength</span> <span class="xmlverb-attr-name">value</span>="<span class="xmlverb-attr-content">12</span>" /><span class="xmlverb-text"> <br>
</span><<span class="xmlverb-element-nsprefix">xs</span>:<span class="xmlverb-element-name">maxLength</span> <span class="xmlverb-attr-name">value</span>="<span class="xmlverb-attr-content">19</span>" /><span class="xmlverb-text"> <br>
</span><<span class="xmlverb-element-nsprefix">xs</span>:<span class="xmlverb-element-name">pattern</span> <span class="xmlverb-attr-name">value</span>="<span class="xmlverb-attr-content">[0-9]+</span>" /><span class="xmlverb-text"> <br>
</span></<span class="xmlverb-element-nsprefix">xs</span>:<span class="xmlverb-element-name">restriction</span>><span class="xmlverb-text"> <br>
</span></<span class="xmlverb-element-nsprefix">xs</span>:<span class="xmlverb-element-name">simpleType</span>><span class="xmlverb-text"><br>
<br>
</span><<span class="xmlverb-element-nsprefix">xs</span>:<span class="xmlverb-element-name">simpleType</span> <span class="xmlverb-attr-name">name</span>="<span class="xmlverb-attr-content">paymentAs</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xs</span>:<span class="xmlverb-element-name">restriction</span> <span class="xmlverb-attr-name">base</span>="<span class="xmlverb-attr-content">xsd:string</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xs</span>:<span class="xmlverb-element-name">enumeration</span> <span class="xmlverb-attr-name">value</span>="<span class="xmlverb-attr-content">cash</span>" /><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xs</span>:<span class="xmlverb-element-name">enumeration</span> <span class="xmlverb-attr-name">value</span>="<span class="xmlverb-attr-content">credit</span>" /><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-nsprefix">xs</span>:<span class="xmlverb-element-name">restriction</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-nsprefix">xs</span>:<span class="xmlverb-element-name">simpleType</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-nsprefix">xs</span>:<span class="xmlverb-element-name">schema</span>><br>
</div>
</div></div><div class="div2">
<h3><a name="bookmarks-in-x-smiles" id="bookmarks-in-x-smiles"></a>H.2 Editing Hierarchical Bookmarks Using XForms</h3><div class="exampleInner">
<!-- converted by xmlverbatim.xsl 1.0.2, (c) O. Becker -->
<div class="xmlverb-default"><<span class="xmlverb-element-name">html</span><span class="xmlverb-ns-name"> xmlns</span>="<span class="xmlverb-ns-uri">http://www.w3.org/2002/06/xhtml2</span>"<span class="xmlverb-ns-name"> xmlns:xforms</span>="<span class="xmlverb-ns-uri">http://www.w3.org/2002/xforms</span>"<span class="xmlverb-ns-name"> xmlns:xsd</span>="<span class="xmlverb-ns-uri">http://www.w3.org/2001/XMLSchema</span>"<span class="xmlverb-ns-name"> xmlns:my</span>="<span class="xmlverb-ns-uri">http://commerce.example.com/payment</span>"<span class="xmlverb-ns-name"> xmlns:ev</span>="<span class="xmlverb-ns-uri">http://www.w3.org/2001/xml-events</span>" <span class="xmlverb-attr-name">xml:lang</span>="<span class="xmlverb-attr-content">en</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">head</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">style</span> <span class="xmlverb-attr-name">type</span>="<span class="xmlverb-attr-content">text/css</span>"><span class="xmlverb-text"><br>
xforms|input.editField {<br>
font-weight:bold; font-size:20px; width:500px<br>
}<br>
xforms|label.sectionLabel {<br>
font-weight:bold; color:white; background-color:blue<br>
}<br>
xforms|submit {<br>
font-family: Arial; font-size: 20px; font-style: bold; color: red<br>
}<br>
</span></<span class="xmlverb-element-name">style</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">title</span>><span class="xmlverb-text">Editing Hierarchical Bookmarks In X-Smiles </span></<span class="xmlverb-element-name">title</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">model</span> <span class="xmlverb-attr-name">id</span>="<span class="xmlverb-attr-content">bookmarks</span>" <span class="xmlverb-attr-name">version</span>="<span class="xmlverb-attr-content">1.1</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">instance</span> <span class="xmlverb-attr-name">resource</span>="<span class="xmlverb-attr-content">bookmarks.xml</span>" /><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">submission</span> <span class="xmlverb-attr-name">id</span>="<span class="xmlverb-attr-content">s01</span>" <span class="xmlverb-attr-name">method</span>="<span class="xmlverb-attr-content">post</span>" <span class="xmlverb-attr-name">action</span>="<span class="xmlverb-attr-content">http://examples.com/</span>" /><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">model</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-name">head</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">body</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">repeat</span> <span class="xmlverb-attr-name">nodeset</span>="<span class="xmlverb-attr-content">section</span>" <span class="xmlverb-attr-name">id</span>="<span class="xmlverb-attr-content">repeatSections</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">input</span> <span class="xmlverb-attr-name">ref</span>="<span class="xmlverb-attr-content">@name</span>" <span class="xmlverb-attr-name">class</span>="<span class="xmlverb-attr-content">editField</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">label</span> <span class="xmlverb-attr-name">class</span>="<span class="xmlverb-attr-content">sectionLabel</span>"><span class="xmlverb-text">Section</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">label</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">input</span>><span class="xmlverb-text"><br>
</span><!--<span class="xmlverb-comment"> BOOKMARK REPEAT START </span>--><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">repeat</span> <span class="xmlverb-attr-name">nodeset</span>="<span class="xmlverb-attr-content">bookmark</span>" <span class="xmlverb-attr-name">id</span>="<span class="xmlverb-attr-content">repeatBookmarks</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">input</span> <span class="xmlverb-attr-name">ref</span>="<span class="xmlverb-attr-content">@name</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">label</span>><span class="xmlverb-text">Bookmark name</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">label</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">input</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">input</span> <span class="xmlverb-attr-name">ref</span>="<span class="xmlverb-attr-content">@href</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">label</span>><span class="xmlverb-text">URL</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">label</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">input</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">repeat</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">repeat</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">p</span>><span class="xmlverb-text"><br>
</span><!--<span class="xmlverb-comment"> INSERT BOOKMARK BUTTON </span>--><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">trigger</span> <span class="xmlverb-attr-name">id</span>="<span class="xmlverb-attr-content">insertbutton</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">label</span>><span class="xmlverb-text">Insert bookmark</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">label</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">insert</span> <span class="xmlverb-attr-name">nodeset</span>="<span class="xmlverb-attr-content">section[index('repeatSections')]/bookmark</span>" <span class="xmlverb-attr-name">at</span>="<span class="xmlverb-attr-content">index('repeatBookmarks')</span>" <span class="xmlverb-attr-name">position</span>="<span class="xmlverb-attr-content">after</span>" <span class="xmlverb-attr-name">ev:event</span>="<span class="xmlverb-attr-content">DOMActivate</span>" /><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">trigger</span>><span class="xmlverb-text"><br>
</span><!--<span class="xmlverb-comment"> DELETE BOOKMARK BUTTON </span>--><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">trigger</span> <span class="xmlverb-attr-name">id</span>="<span class="xmlverb-attr-content">delete</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">label</span>><span class="xmlverb-text">Delete bookmark</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">label</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">delete</span> <span class="xmlverb-attr-name">nodeset</span>="<span class="xmlverb-attr-content">section[index('repeatSections')]/bookmark</span>" <span class="xmlverb-attr-name">at</span>="<span class="xmlverb-attr-content">index('repeatBookmarks')</span>" <span class="xmlverb-attr-name">ev:event</span>="<span class="xmlverb-attr-content">DOMActivate</span>" /><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">trigger</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-name">p</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">p</span>><span class="xmlverb-text"><br>
</span><!--<span class="xmlverb-comment"> INSERT SECTION BUTTON </span>--><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">trigger</span> <span class="xmlverb-attr-name">id</span>="<span class="xmlverb-attr-content">insertsectionbutton</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">label</span>><span class="xmlverb-text">Insert section</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">label</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">insert</span> <span class="xmlverb-attr-name">nodeset</span>="<span class="xmlverb-attr-content">section</span>" <span class="xmlverb-attr-name">at</span>="<span class="xmlverb-attr-content">index('repeatSections')</span>" <span class="xmlverb-attr-name">position</span>="<span class="xmlverb-attr-content">after</span>" <span class="xmlverb-attr-name">ev:event</span>="<span class="xmlverb-attr-content">DOMActivate</span>" /><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">trigger</span>><span class="xmlverb-text"><br>
</span><!--<span class="xmlverb-comment"> DELETE SECTION BUTTON </span>--><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">trigger</span> <span class="xmlverb-attr-name">id</span>="<span class="xmlverb-attr-content">deletesectionbutton</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">label</span>><span class="xmlverb-text">Delete section</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">label</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">delete</span> <span class="xmlverb-attr-name">nodeset</span>="<span class="xmlverb-attr-content">section</span>" <span class="xmlverb-attr-name">at</span>="<span class="xmlverb-attr-content">index('repeatSections')</span>" <span class="xmlverb-attr-name">ev:event</span>="<span class="xmlverb-attr-content">DOMActivate</span>" /><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">trigger</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-name">p</span>><span class="xmlverb-text"><br>
</span><!--<span class="xmlverb-comment"> SUBMIT BUTTON </span>--><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">submit</span> <span class="xmlverb-attr-name">submission</span>="<span class="xmlverb-attr-content">s01</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">label</span>><span class="xmlverb-text">Save</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">label</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">hint</span>><span class="xmlverb-text">Click to submit</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">hint</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">submit</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-name">body</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-name">html</span>><br>
</div>
</div><p>Initial instance file <code>bookmarks.xml</code>:</p><div class="exampleInner">
<!-- converted by xmlverbatim.xsl 1.0.2, (c) O. Becker -->
<div class="xmlverb-default"><!--<span class="xmlverb-comment">This is the bookmarks.xml file </span>--><br>
<<span class="xmlverb-element-name">bookmarks</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">section</span> <span class="xmlverb-attr-name">name</span>="<span class="xmlverb-attr-content">main</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">bookmark</span> <span class="xmlverb-attr-name">href</span>="<span class="xmlverb-attr-content">http://www.example.com/xforms.xml</span>" <span class="xmlverb-attr-name">name</span>="<span class="xmlverb-attr-content">Main page</span>" /><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-name">section</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">section</span> <span class="xmlverb-attr-name">name</span>="<span class="xmlverb-attr-content">demos</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">bookmark</span> <span class="xmlverb-attr-name">href</span>="<span class="xmlverb-attr-content">http://www.example.com/demo/images.fo</span>" <span class="xmlverb-attr-name">name</span>="<span class="xmlverb-attr-content">images</span>" /><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">bookmark</span> <span class="xmlverb-attr-name">href</span>="<span class="xmlverb-attr-content">http://www.example.com/demo/xf-ecma.xml</span>" <span class="xmlverb-attr-name">name</span>="<span class="xmlverb-attr-content">ecma</span>" /><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">bookmark</span> <span class="xmlverb-attr-name">href</span>="<span class="xmlverb-attr-content">http://www.example.com/demo/sip.fo</span>" <span class="xmlverb-attr-name">name</span>="<span class="xmlverb-attr-content">sip</span>" /><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-name">section</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">section</span> <span class="xmlverb-attr-name">name</span>="<span class="xmlverb-attr-content">XForms</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">bookmark</span> <span class="xmlverb-attr-name">href</span>="<span class="xmlverb-attr-content">file:///C/source/xmlevents.xml</span>" <span class="xmlverb-attr-name">name</span>="<span class="xmlverb-attr-content">XML events</span>" /><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">bookmark</span> <span class="xmlverb-attr-name">href</span>="<span class="xmlverb-attr-content">file:///C/source/model3.xml</span>" <span class="xmlverb-attr-name">name</span>="<span class="xmlverb-attr-content">model3</span>" /><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">bookmark</span> <span class="xmlverb-attr-name">href</span>="<span class="xmlverb-attr-content">file:///C/source/repeat.fo</span>" <span class="xmlverb-attr-name">name</span>="<span class="xmlverb-attr-content">repeat</span>" /><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-name">section</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-name">bookmarks</span>><br>
</div>
</div></div><div class="div2">
<h3><a name="N90418" id="N90418"></a>H.3 Survey Using XForms and SVG</h3><p>The following example shows one possible way of integrating XForms with <a href="#ref-svg11">[SVG 1.1]</a>. Note that the complete set of rules for integrating XForms and SVG are not fully specified at the time this specification was published. Future versions of the XForms, SVG, or other W3C specifications might define more complete rules for integrating XForms and SVG which might not be compatible with the example below.</p><p>Note that the example below does not use SVG's <code>switch</code> and <code>requiredExtensions</code> features, which are commonly used in conjunction with <code>foreignObject</code>.</p><div class="exampleInner">
<!-- converted by xmlverbatim.xsl 1.0.2, (c) O. Becker -->
<div class="xmlverb-default"><!--<span class="xmlverb-comment"> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" <br>
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> </span>--><br>
<<span class="xmlverb-element-name">svg</span><span class="xmlverb-ns-name"> xmlns</span>="<span class="xmlverb-ns-uri">http://www.w3.org/2000/svg</span>"<span class="xmlverb-ns-name"> xmlns:xlink</span>="<span class="xmlverb-ns-uri">http://www.w3.org/1999/xlink</span>"<span class="xmlverb-ns-name"> xmlns:xforms</span>="<span class="xmlverb-ns-uri">http://www.w3.org/2002/xforms</span>"<span class="xmlverb-ns-name"> xmlns:ev</span>="<span class="xmlverb-ns-uri">http://www.w3.org/2001/xml-events</span>"<span class="xmlverb-ns-name"> xmlns:s</span>="<span class="xmlverb-ns-uri">http://example.com/survey</span>" <span class="xmlverb-attr-name">width</span>="<span class="xmlverb-attr-content">700px</span>" <span class="xmlverb-attr-name">height</span>="<span class="xmlverb-attr-content">600px</span>" <span class="xmlverb-attr-name">viewBox</span>="<span class="xmlverb-attr-content">0 0 700 600</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">defs</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">polygon</span> <span class="xmlverb-attr-name">id</span>="<span class="xmlverb-attr-content">bullet</span>" <span class="xmlverb-attr-name">points</span>="<span class="xmlverb-attr-content">-30,-30, -10,-10, -20,10</span>" <span class="xmlverb-attr-name">fill</span>="<span class="xmlverb-attr-content">#007138</span>" /><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">model</span> <span class="xmlverb-attr-name">id</span>="<span class="xmlverb-attr-content">form1</span>" <span class="xmlverb-attr-name">schema</span>="<span class="xmlverb-attr-content">surveyschema.xsd</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">instance</span> <span class="xmlverb-attr-name">id</span>="<span class="xmlverb-attr-content">instance1</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">s</span>:<span class="xmlverb-element-name">survey</span><span class="xmlverb-ns-name"> xmlns</span>="<span class="xmlverb-ns-uri">http://example.com/survey</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">s</span>:<span class="xmlverb-element-name">drink</span>><span class="xmlverb-text">none</span></<span class="xmlverb-element-nsprefix">s</span>:<span class="xmlverb-element-name">drink</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">s</span>:<span class="xmlverb-element-name">espressoPrefs</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">s</span>:<span class="xmlverb-element-name">numberPerWeek</span>><span class="xmlverb-text">0</span></<span class="xmlverb-element-nsprefix">s</span>:<span class="xmlverb-element-name">numberPerWeek</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">s</span>:<span class="xmlverb-element-name">sugar</span>><span class="xmlverb-text">0</span></<span class="xmlverb-element-nsprefix">s</span>:<span class="xmlverb-element-name">sugar</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">s</span>:<span class="xmlverb-element-name">lemon</span>><span class="xmlverb-text">Always</span></<span class="xmlverb-element-nsprefix">s</span>:<span class="xmlverb-element-name">lemon</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-nsprefix">s</span>:<span class="xmlverb-element-name">espressoPrefs</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-nsprefix">s</span>:<span class="xmlverb-element-name">survey</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">instance</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">submission</span> <span class="xmlverb-attr-name">id</span>="<span class="xmlverb-attr-content">submit1</span>" <span class="xmlverb-attr-name">method</span>="<span class="xmlverb-attr-content">post</span>" <span class="xmlverb-attr-name">action</span>="<span class="xmlverb-attr-content">http://www.example.org/surveyhandler</span>" /><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">model</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-name">defs</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">title</span>><span class="xmlverb-text">Espresso survey</span></<span class="xmlverb-element-name">title</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">desc</span>><span class="xmlverb-text">Sample SVG and XForms - espresso customer survey</span></<span class="xmlverb-element-name">desc</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">g</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">text</span> <span class="xmlverb-attr-name">x</span>="<span class="xmlverb-attr-content">50</span>" <span class="xmlverb-attr-name">y</span>="<span class="xmlverb-attr-content">70</span>" <span class="xmlverb-attr-name">font-size</span>="<span class="xmlverb-attr-content">40</span>" <span class="xmlverb-attr-name">font-family</span>="<span class="xmlverb-attr-content">Arial Black, sans-serif</span>" <span class="xmlverb-attr-name">font-weight</span>="<span class="xmlverb-attr-content">900</span>"><span class="xmlverb-text">Customer Survey: Espresso</span></<span class="xmlverb-element-name">text</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">g</span> <span class="xmlverb-attr-name">font-family</span>="<span class="xmlverb-attr-content">Arial, Helvetica, sans-serif</span>" <span class="xmlverb-attr-name">font-size</span>="<span class="xmlverb-attr-content">18</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">foreignObject</span> <span class="xmlverb-attr-name">x</span>="<span class="xmlverb-attr-content">80</span>" <span class="xmlverb-attr-name">y</span>="<span class="xmlverb-attr-content">150</span>" <span class="xmlverb-attr-name">width</span>="<span class="xmlverb-attr-content">250</span>" <span class="xmlverb-attr-name">height</span>="<span class="xmlverb-attr-content">40</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">select1</span> <span class="xmlverb-attr-name">appearance</span>="<span class="xmlverb-attr-content">minimal</span>" <span class="xmlverb-attr-name">model</span>="<span class="xmlverb-attr-content">form1</span>" <span class="xmlverb-attr-name">ref</span>="<span class="xmlverb-attr-content">s:drink</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">label</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">g</span> <span class="xmlverb-attr-name">transform</span>="<span class="xmlverb-attr-content">translate(80, 140)</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">use</span> <span class="xmlverb-attr-name">xlink:href</span>="<span class="xmlverb-attr-content">#bullet</span>" /><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">text</span>><span class="xmlverb-text">Your usual coffee drink is:</span></<span class="xmlverb-element-name">text</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-name">g</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">label</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">item</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">label</span>><span class="xmlverb-text">Rich, dark espresso</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">label</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">value</span>><span class="xmlverb-text">espresso</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">value</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">item</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">item</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">label</span>><span class="xmlverb-text">Creamy cappuccino</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">label</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">value</span>><span class="xmlverb-text">cappuccino</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">value</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">item</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">item</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">label</span>><span class="xmlverb-text">Long, milky latte</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">label</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">value</span>><span class="xmlverb-text">latte</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">value</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">item</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">item</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">label</span>><span class="xmlverb-text">Don't like coffee!</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">label</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">value</span>><span class="xmlverb-text">none</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">value</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">item</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">select1</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-name">foreignObject</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">foreignObject</span> <span class="xmlverb-attr-name">x</span>="<span class="xmlverb-attr-content">80</span>" <span class="xmlverb-attr-name">y</span>="<span class="xmlverb-attr-content">240</span>" <span class="xmlverb-attr-name">width</span>="<span class="xmlverb-attr-content">250</span>" <span class="xmlverb-attr-name">height</span>="<span class="xmlverb-attr-content">40</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">range</span> <span class="xmlverb-attr-name">model</span>="<span class="xmlverb-attr-content">form1</span>" <span class="xmlverb-attr-name">start</span>="<span class="xmlverb-attr-content">0</span>" <span class="xmlverb-attr-name">end</span>="<span class="xmlverb-attr-content">30</span>" <span class="xmlverb-attr-name">step</span>="<span class="xmlverb-attr-content">5</span>" <span class="xmlverb-attr-name">ref</span>="<span class="xmlverb-attr-content">s:espressoPrefs/s:numberPerWeek</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">label</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">g</span> <span class="xmlverb-attr-name">transform</span>="<span class="xmlverb-attr-content">translate(80, 230)</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">use</span> <span class="xmlverb-attr-name">xlink:href</span>="<span class="xmlverb-attr-content">#bullet</span>" /><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">text</span>><span class="xmlverb-text">Shots of espresso per week:</span></<span class="xmlverb-element-name">text</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-name">g</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">label</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">range</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-name">foreignObject</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">foreignObject</span> <span class="xmlverb-attr-name">x</span>="<span class="xmlverb-attr-content">80</span>" <span class="xmlverb-attr-name">y</span>="<span class="xmlverb-attr-content">350</span>" <span class="xmlverb-attr-name">width</span>="<span class="xmlverb-attr-content">250</span>" <span class="xmlverb-attr-name">height</span>="<span class="xmlverb-attr-content">40</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">select</span> <span class="xmlverb-attr-name">model</span>="<span class="xmlverb-attr-content">form1</span>" <span class="xmlverb-attr-name">ref</span>="<span class="xmlverb-attr-content">s:espressoPrefs/s:sugar</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">label</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">g</span> <span class="xmlverb-attr-name">transform</span>="<span class="xmlverb-attr-content">translate(80, 340)</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">use</span> <span class="xmlverb-attr-name">xlink:href</span>="<span class="xmlverb-attr-content">#bullet</span>" /><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">text</span>><span class="xmlverb-text">Sugar?</span></<span class="xmlverb-element-name">text</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-name">g</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">label</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">item</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">label</span>><span class="xmlverb-text">Yes</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">label</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">value</span>><span class="xmlverb-text">X</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">value</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">item</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">select</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-name">foreignObject</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">foreignObject</span> <span class="xmlverb-attr-name">x</span>="<span class="xmlverb-attr-content">80</span>" <span class="xmlverb-attr-name">y</span>="<span class="xmlverb-attr-content">420</span>" <span class="xmlverb-attr-name">width</span>="<span class="xmlverb-attr-content">250</span>" <span class="xmlverb-attr-name">height</span>="<span class="xmlverb-attr-content">90</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">select1</span> <span class="xmlverb-attr-name">appearance</span>="<span class="xmlverb-attr-content">full</span>" <span class="xmlverb-attr-name">model</span>="<span class="xmlverb-attr-content">form1</span>" <span class="xmlverb-attr-name">ref</span>="<span class="xmlverb-attr-content">s:espressoPrefs/s:lemon</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">label</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">g</span> <span class="xmlverb-attr-name">transform</span>="<span class="xmlverb-attr-content">translate(80, 410)</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">use</span> <span class="xmlverb-attr-name">xlink:href</span>="<span class="xmlverb-attr-content">#bullet</span>" /><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">text</span>><span class="xmlverb-text">Lemon?</span></<span class="xmlverb-element-name">text</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-name">g</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">label</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">item</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">label</span>><span class="xmlverb-text">Required for the full experience</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">label</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">value</span>><span class="xmlverb-text">Always</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">value</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">item</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">item</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">label</span>><span class="xmlverb-text">Whatever</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">label</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">value</span>><span class="xmlverb-text">Indifferent</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">value</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">item</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">item</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">label</span>><span class="xmlverb-text">Keep that citrus to yourself</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">label</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">value</span>><span class="xmlverb-text">Never</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">value</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">item</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">select1</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-name">foreignObject</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-name">g</span>><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">use</span> <span class="xmlverb-attr-name">xlink:href</span>="<span class="xmlverb-attr-content">#bullet</span>" <span class="xmlverb-attr-name">x</span>="<span class="xmlverb-attr-content">101</span>" <span class="xmlverb-attr-name">y</span>="<span class="xmlverb-attr-content">64</span>" <span class="xmlverb-attr-name">transform</span>="<span class="xmlverb-attr-content">scale(7,3)</span>" /><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">foreignObject</span> <span class="xmlverb-attr-name">y</span>="<span class="xmlverb-attr-content">150</span>" <span class="xmlverb-attr-name">x</span>="<span class="xmlverb-attr-content">500</span>" <span class="xmlverb-attr-name">height</span>="<span class="xmlverb-attr-content">60</span>" <span class="xmlverb-attr-name">width</span>="<span class="xmlverb-attr-content">100</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">submit</span> <span class="xmlverb-attr-name">model</span>="<span class="xmlverb-attr-content">form1</span>"><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">label</span>><span class="xmlverb-text">Send survey</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">label</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-nsprefix">xforms</span>:<span class="xmlverb-element-name">submit</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-name">foreignObject</span>><span class="xmlverb-text"><br>
</span><!--<span class="xmlverb-comment">- keep the graphics data out of this example listing </span>--><span class="xmlverb-text"><br>
</span><<span class="xmlverb-element-name">image</span> <span class="xmlverb-attr-name">xlink:href</span>="<span class="xmlverb-attr-content">espresso.svg</span>" <span class="xmlverb-attr-name">x</span>="<span class="xmlverb-attr-content">400</span>" <span class="xmlverb-attr-name">y</span>="<span class="xmlverb-attr-content">230</span>" <span class="xmlverb-attr-name">width</span>="<span class="xmlverb-attr-content">280</span>" <span class="xmlverb-attr-name">height</span>="<span class="xmlverb-attr-content">270</span>" /><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-name">g</span>><span class="xmlverb-text"><br>
</span></<span class="xmlverb-element-name">svg</span>><br>
</div>
</div></div></div><div class="div1">
<h2><a name="acks" id="acks"></a>I Acknowledgements (Non-Normative)</h2><p>This document was produced with the participation of Forms Working Group participants<span>, including</span>:</p><ul><li>John M. Boyer, IBM (<i>Chair, Editor</i>) </li><li>Steven Pemberton, W3C/CWI (<i>Activity Lead, W3C Team Contact<span>, Chair until 2007</span></i>) </li><li>Blake Jones, DAISY Consortium and ViewPlus Technologies</li><li>Ulrich Nicolas Lissé, DreamLab</li><li>Sebastian Schnitzenbaumer, DreamLab (<i>Co-chair until 2003</i>) </li><li>Joern Turner, DreamLab</li><li>T. V. Raman, Google</li><li>Keith Wells, IBM</li><li>Charlie Wiecha, IBM</li><li>Nick Van den Bleeken, Inventive Designers n.v.</li><li>Erik Bruchez, Orbeon</li><li>Mark Seaborne, Origo, PicoForms</li><li>Kenneth Sklander, PicoForms</li><li>Susan Borgrink, Progeny Systems</li><li>Rafael Benito Ruiz de Villa, SATEC</li><li>Rogelio Pérez Cano, SATEC</li><li>Lars Oppermann, Sun Microsystems</li><li>Mark Birbeck, <span>Backplane Ltd.</span> (<i>Invited Expert</i>) </li><li>Leigh L. Klotz, Jr., Xerox Corporation</li></ul></div><div class="div1">
<h2><a name="prod-notes" id="prod-notes"></a>J Production Notes (Non-Normative)</h2><p>This document was encoded in the XMLspec DTD v2.6. The XML sources were transformed using diffspec and xmlspec stylesheets, version 2.6. The XML Schema portion of the Appendix was rendered into HTML with the <a href="http://www.informatik.hu-berlin.de/~obecker/XSLT/">xmlverbatim XSLT</a> stylesheet (used with permission). The primary tool used for editing was XMLSpy. The XML was transformed using the XSLT processor in Java 6. The editor(s) use the W3C CVS repository and the W3C IRC server for collaborative authoring.</p></div></div></body></html>