Tag
Hash :
249d7bbe
Author :
Date :
2003-03-19T21:02:29
attempt to cope with ID/IDREF(S) declared both in the DTD and in the * valid.c xmlschemastypes.c: attempt to cope with ID/IDREF(S) declared both in the DTD and in the Schemas <grin/> * relaxng.c: more debug, added a big optimization for <mixed> * test/relaxng/testsuite.xml: augmented the testsuite * test/relaxng/ result/relaxng: added the RelaxNG spec and a DocBook example to the regression tests Daniel
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
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE article [
<!-- ELEMENT declarations work around MSXML bug. -->
<!ELEMENT section ANY>
<!ATTLIST section id ID #IMPLIED>
<!ELEMENT appendix ANY>
<!ATTLIST appendix id ID #IMPLIED>
<!ELEMENT bibliomixed ANY>
<!ATTLIST bibliomixed id ID #IMPLIED>
]>
<article status="Committee Specification" xmlns:p="http://relaxng.org/ns/proofsystem">
<articleinfo>
<releaseinfo>$Id: spec.xml,v 1.159 2001/12/02 12:12:12 jjc Exp $</releaseinfo>
<title>RELAX NG Specification</title>
<authorgroup>
<editor>
<firstname>James</firstname><surname>Clark</surname>
<affiliation>
<address><email>jjc@jclark.com</email></address>
</affiliation>
</editor>
<editor>
<surname>MURATA</surname><firstname>Makoto</firstname>
<affiliation>
<address><email>EB2M-MRT@asahi-net.or.jp</email></address>
</affiliation>
</editor>
</authorgroup>
<pubdate>3 December 2001</pubdate>
<releaseinfo role="meta">
$Id: spec.xml,v 1.159 2001/12/02 12:12:12 jjc Exp $
</releaseinfo>
<copyright><year>2001</year><holder>OASIS</holder></copyright>
<legalnotice>
<para>Copyright © The Organization for the Advancement of
Structured Information Standards [OASIS] 2001. All Rights
Reserved.</para>
<para>This document and translations of it may be copied and furnished
to others, and derivative works that comment on or otherwise explain
it or assist in its implementation may be prepared, copied, published
and distributed, in whole or in part, without restriction of any kind,
provided that the above copyright notice and this paragraph are
included on all such copies and derivative works. However, this
document itself may not be modified in any way, such as by removing
the copyright notice or references to OASIS, except as needed for the
purpose of developing OASIS specifications, in which case the
procedures for copyrights defined in the OASIS Intellectual Property
Rights document must be followed, or as required to translate it into
languages other than English.</para>
<para>The limited permissions granted above are perpetual and will not
be revoked by OASIS or its successors or assigns.</para>
<para>This document and the information contained herein is provided
on an <quote>AS IS</quote> basis and OASIS DISCLAIMS ALL WARRANTIES,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE
USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY
IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR
PURPOSE.</para>
</legalnotice>
<legalnotice role="status"><title>Status of this Document</title>
<para>This Committee Specification was approved for publication by the
OASIS RELAX NG technical committee. It is a stable document which
represents the consensus of the committee. Comments on this document
may be sent to <ulink
url="mailto:relax-ng-comment@lists.oasis-open.org"
>relax-ng-comment@lists.oasis-open.org</ulink>.</para>
<para>A list of known errors in this document is available at <ulink
url="http://www.oasis-open.org/committees/relax-ng/spec-20011203-errata.html"
>http://www.oasis-open.org/committees/relax-ng/spec-20011203-errata.html</ulink
>.</para>
</legalnotice>
<abstract>
<para>This is the definitive specification of RELAX NG, a simple
schema language for XML, based on <xref linkend="relax"/> and <xref
linkend="trex"/>. A RELAX NG schema specifies a pattern for the
structure and content of an XML document. A RELAX NG schema is itself
an XML document.</para>
</abstract>
<revhistory>
<revision>
<revnumber>Committee Specification</revnumber>
<date>3 December 2001</date>
</revision>
<revision>
<revnumber>Committee Specification</revnumber>
<date>11 August 2001</date>
</revision>
</revhistory>
</articleinfo>
<section>
<title>Introduction</title>
<para>This document specifies</para>
<itemizedlist>
<listitem><para>when an XML document is a correct RELAX NG
schema</para></listitem>
<listitem><para>when an XML document is valid with respect to a
correct RELAX NG schema</para></listitem>
</itemizedlist>
<para>An XML document that is being validated with respect to a RELAX NG
schema is referred to as an instance.</para>
<para>The structure of this document is as follows. <xref
linkend="data-model"/> describes the data model, which is the
abstraction of an XML document used throughout the rest of the
document. <xref linkend="full-syntax"/> describes the syntax of a
RELAX NG schema; any correct RELAX NG schema must conform to this
syntax. <xref linkend="simplification"/> describes a sequence of
transformations that are applied to simplify a RELAX NG schema;
applying the transformations also involves checking certain
restrictions that must be satisfied by a correct RELAX NG
schema. <xref linkend="simple-syntax"/> describes the syntax that
results from applying the transformations; this simple syntax is a
subset of the full syntax. <xref linkend="semantics"/> describes the
semantics of a correct RELAX NG schema that uses the simple syntax;
the semantics specify when an element is valid with respect to a RELAX
NG schema. <xref linkend="restriction"/> describes restrictions in
terms of the simple syntax; a correct RELAX NG schema must be such
that, after transformation into the simple form, it satisfies these
restrictions. Finally, <xref linkend="conformance"/> describes
conformance requirements for RELAX NG validators.</para>
<para>A tutorial is available separately (see <xref
linkend="tutorial"/>).</para>
</section>
<section id="data-model">
<title>Data model</title>
<para>RELAX NG deals with XML documents representing both schemas and
instances through an abstract data model. XML documents representing
schemas and instances must be well-formed in conformance with <xref
linkend="xml-rec"/> and must conform to the constraints of <xref
linkend="xml-names"/>.</para>
<para>An XML document is represented by an element. An element consists
of</para>
<itemizedlist>
<listitem><para>a name</para></listitem>
<listitem><para>a context</para></listitem>
<listitem><para>a set of attributes</para></listitem>
<listitem><para>an ordered sequence of zero or more children; each
child is either an element or a non-empty string; the sequence never contains
two consecutive strings</para></listitem>
</itemizedlist>
<para>A name consists of</para>
<itemizedlist>
<listitem><para>a string representing the namespace URI; the empty
string has special significance, representing the absence of any
namespace</para></listitem>
<listitem><para>a string representing the local name; this string matches the NCName
production of <xref linkend="xml-names"/></para></listitem>
</itemizedlist>
<para>A context consists of</para>
<itemizedlist>
<listitem><para>a base URI</para></listitem>
<listitem><para>a namespace map; this maps prefixes to namespace URIs,
and also may specify a default namespace URI (as declared
by the <literal>xmlns</literal> attribute)</para></listitem>
</itemizedlist>
<para>An attribute consists of</para>
<itemizedlist>
<listitem><para>a name</para></listitem>
<listitem><para>a string representing the value</para></listitem>
</itemizedlist>
<para>A string consists of a sequence of zero or more characters,
where a character is as defined in <xref linkend="xml-rec"/>.</para>
<para>The element for an XML document is constructed from an instance
of the <xref linkend="infoset"/> as follows. We use the notation
[<replaceable>x</replaceable>] to refer to the value of the
<replaceable>x</replaceable> property of an information item. An
element is constructed from a document information item by
constructing an element from the [document element]. An element is
constructed from an element information item by constructing the name
from the [namespace name] and [local name], the context from the [base
URI] and [in-scope namespaces], the attributes from the [attributes],
and the children from the [children]. The attributes of an element
are constructed from the unordered set of attribute information items
by constructing an attribute for each attribute information item. The
children of an element are constructed from the list of child
information items first by removing information items other than
element information items and character information items, and then by
constructing an element for each element information item in the list
and a string for each maximal sequence of character information items.
An attribute is constructed from an attribute information item by
constructing the name from the [namespace name] and [local name], and
the value from the [normalized value]. When constructing the name of
an element or attribute from the [namespace name] and [local name], if
the [namespace name] property is not present, then the name is
constructed from an empty string and the [local name]. A string is
constructed from a sequence of character information items by
constructing a character from the [character code] of each character
information item.</para>
<para>It is possible for there to be multiple distinct infosets for a
single XML document. This is because XML parsers are not required to
process all DTD declarations or expand all external parsed general
entities. Amongst these multiple infosets, there is exactly one
infoset for which [all declarations processed] is true and which does
not contain any unexpanded entity reference information items. This
is the infoset that is the basis for defining the RELAX NG data
model.</para>
<section id="data-model-example">
<title>Example</title>
<para>Suppose the document
<literal>http://www.example.com/doc.xml</literal> is as
follows:</para>
<programlisting><![CDATA[<?xml version="1.0"?>
<foo><pre1:bar1 xmlns:pre1="http://www.example.com/n1"/><pre2:bar2
xmlns:pre2="http://www.example.com/n2"/></foo>
]]></programlisting>
<para>The element representing this document has</para>
<itemizedlist>
<listitem><para>a name which has</para>
<itemizedlist>
<listitem><para>the empty string as the namespace URI, representing
the absence of any namespace</para></listitem>
<listitem><para><literal>foo</literal> as the local
name</para></listitem>
</itemizedlist>
</listitem>
<listitem><para>a context which has</para>
<itemizedlist>
<listitem><para><literal>http://www.example.com/doc.xml</literal> as the base
URI</para></listitem>
<listitem><para>a namespace map which</para>
<itemizedlist>
<listitem><para>maps the prefix <literal>xml</literal> to the
namespace URI
<literal>http://www.w3.org/XML/1998/namespace</literal>
(the <literal>xml</literal> prefix is implicitly declared
by every XML document)</para></listitem>
<listitem><para>specifies the empty string as the default namespace
URI</para></listitem>
</itemizedlist>
</listitem>
</itemizedlist>
</listitem>
<listitem><para>an empty set of attributes</para></listitem>
<listitem><para>a sequence of children consisting
of an element which has</para>
<itemizedlist>
<listitem><para>a name which has</para>
<itemizedlist>
<listitem><para><literal>http://www.example.com/n1</literal> as the
namespace URI</para></listitem>
<listitem><para><literal>bar1</literal> as the local
name</para></listitem>
</itemizedlist>
</listitem>
<listitem><para>a context which has</para>
<itemizedlist>
<listitem><para><literal>http://www.example.com/doc.xml</literal> as the base
URI</para></listitem>
<listitem><para>a namespace map which</para>
<itemizedlist>
<listitem><para>maps the prefix <literal>pre1</literal> to the
namespace URI
<literal>http://www.example.com/n1</literal></para></listitem>
<listitem><para>maps the prefix <literal>xml</literal> to the
namespace URI
<literal>http://www.w3.org/XML/1998/namespace</literal></para></listitem>
<listitem><para>specifies the empty string as the default namespace
URI</para></listitem>
</itemizedlist>
</listitem>
</itemizedlist>
</listitem>
<listitem><para>an empty set of attributes</para></listitem>
<listitem><para>an empty sequence of children</para></listitem>
</itemizedlist>
<para>followed by an element which has</para>
<itemizedlist>
<listitem><para>a name which has</para>
<itemizedlist>
<listitem><para><literal>http://www.example.com/n2</literal> as the
namespace URI</para></listitem>
<listitem><para><literal>bar2</literal> as the local
name</para></listitem>
</itemizedlist>
</listitem>
<listitem><para>a context which has</para>
<itemizedlist>
<listitem><para><literal>http://www.example.com/doc.xml</literal> as the base
URI</para></listitem>
<listitem><para>a namespace map which</para>
<itemizedlist>
<listitem><para>maps the prefix <literal>pre2</literal> to the
namespace URI
<literal>http://www.example.com/n2</literal></para></listitem>
<listitem><para>maps the prefix <literal>xml</literal> to the
namespace URI
<literal>http://www.w3.org/XML/1998/namespace</literal></para></listitem>
<listitem><para>specifies the empty string as the default namespace
URI</para></listitem>
</itemizedlist>
</listitem>
</itemizedlist>
</listitem>
<listitem><para>an empty set of attributes</para></listitem>
<listitem><para>an empty sequence of children</para></listitem>
</itemizedlist>
</listitem>
</itemizedlist>
</section>
</section>
<section id="full-syntax">
<title>Full syntax</title>
<para>The following grammar summarizes the syntax of RELAX NG.
Although we use a notation based on the XML representation of an RELAX
NG schema as a sequence of characters, the grammar must be understood
as operating at the data model level. For example, although the
syntax uses <literal><![CDATA[<text/>]]></literal>, an instance or
schema can use <literal><![CDATA[<text></text>]]></literal> instead,
because they both represent the same element at the data model level.
All elements shown in the grammar are qualified with the namespace
URI:</para>
<programlisting>http://relaxng.org/ns/structure/1.0</programlisting>
<para>The symbols QName and NCName are defined in <xref
linkend="xml-names"/>. The anyURI symbol has the same meaning as the
anyURI datatype of <xref linkend="xmlschema-2"/>: it indicates a
string that, after escaping of disallowed values as described in
Section 5.4 of <xref linkend="xlink"/>, is a URI reference as defined
in <xref linkend="rfc2396"/> (as modified by <xref
linkend="rfc2732"/>). The symbol string matches any string.</para>
<para>In addition to the attributes shown explicitly, any element can
have an <literal>ns</literal> attribute and any element can have a
<literal>datatypeLibrary</literal> attribute. The
<literal>ns</literal> attribute can have any value. The value of the
<literal>datatypeLibrary</literal> attribute must match the anyURI
symbol as described in the previous paragraph; in addition, it must
not use the relative form of URI reference and must not have a
fragment identifier; as an exception to this, the value may be the
empty string.</para>
<para>Any element can also have foreign attributes in addition to the
attributes shown in the grammar. A foreign attribute is an attribute
with a name whose namespace URI is neither the empty string nor the
RELAX NG namespace URI. Any element that cannot have string children
(that is, any element other than <literal>value</literal>, <literal>param</literal>
and <literal>name</literal>) may have foreign child elements in addition
to the child elements shown in the grammar. A foreign element is an
element with a name whose namespace URI is not the RELAX NG namespace
URI. There are no constraints on the relative position of foreign
child elements with respect to other child elements.</para>
<para>Any element can also have as children strings that consist
entirely of whitespace characters, where a whitespace character is one
of #x20, #x9, #xD or #xA. There are no constraints on the relative
position of whitespace string children with respect to child
elements.</para>
<para>Leading and trailing whitespace is allowed for value of each
<literal>name</literal>, <literal>type</literal> and
<literal>combine</literal> attribute and for the content of each
<literal>name</literal> element.</para>
<grammarref src="full.rng"/>
<section id="full-syntax-example">
<title>Example</title>
<para>Here is an example of a schema in the full syntax for the
document in <xref linkend="data-model-example"/>.</para>
<programlisting><![CDATA[<?xml version="1.0"?>
<element name="foo"
xmlns="http://relaxng.org/ns/structure/1.0"
xmlns:a="http://relaxng.org/ns/annotation/1.0"
xmlns:ex1="http://www.example.com/n1"
xmlns:ex2="http://www.example.com/n2">
<a:documentation>A foo element.</a:document>
<element name="ex1:bar1">
<empty/>
</element>
<element name="ex2:bar2">
<empty/>
</element>
</element>]]></programlisting>
</section>
</section>
<section id="simplification">
<title>Simplification</title>
<para>The full syntax given in the previous section is transformed
into a simpler syntax by applying the following transformation rules
in order. The effect must be as if each rule was applied to all
elements in the schema before the next rule is applied. A
transformation rule may also specify constraints that must be
satisfied by a correct schema. The transformation rules are applied
at the data model level. Before the transformations are applied, the
schema is parsed into an instance of the data model.</para>
<section>
<title>Annotations</title>
<para>Foreign attributes and elements are removed.</para>
<note><para>It is safe to remove <literal>xml:base</literal>
attributes at this stage because <literal>xml:base</literal>
attributes are used in determining the [base URI] of an element
information item, which is in turn used to construct the base URI of
the context of an element. Thus, after a document has been parsed
into an instance of the data model, <literal>xml:base</literal>
attributes can be discarded.</para></note>
</section>
<section>
<title>Whitespace</title>
<para>For each element other than <literal>value</literal> and
<literal>param</literal>, each child that is a string containing only
whitespace characters is removed.</para>
<para>Leading and trailing whitespace characters are removed from the
value of each <literal>name</literal>, <literal>type</literal> and
<literal>combine</literal> attribute and from the content of each
<literal>name</literal> element.</para>
</section>
<section>
<title><literal>datatypeLibrary</literal> attribute</title>
<para>The value of each <literal>datatypeLibary</literal> attribute is
transformed by escaping disallowed characters as specified in Section
5.4 of <xref linkend="xlink"/>.</para>
<para>For any <literal>data</literal> or <literal>value</literal>
element that does not have a <literal>datatypeLibrary</literal>
attribute, a <literal>datatypeLibrary</literal> attribute is
added. The value of the added <literal>datatypeLibrary</literal>
attribute is the value of the <literal>datatypeLibrary</literal>
attribute of the nearest ancestor element that has a
<literal>datatypeLibrary</literal> attribute, or the empty string if
there is no such ancestor. Then, any <literal>datatypeLibrary</literal>
attribute that is on an element other than <literal>data</literal> or
<literal>value</literal> is removed.</para>
</section>
<section>
<title><literal>type</literal> attribute of <literal>value</literal> element</title>
<para>For any <literal>value</literal> element that does not have a
<literal>type</literal> attribute, a <literal>type</literal> attribute
is added with value <literal>token</literal> and the value of the
<literal>datatypeLibrary</literal> attribute is changed to the empty
string.</para>
</section>
<section id="href">
<title><literal>href</literal> attribute</title>
<para>The value of the <literal>href</literal> attribute on an
<literal>externalRef</literal> or <literal>include</literal> element
is first transformed by escaping disallowed characters as specified in
Section 5.4 of <xref linkend="xlink"/>. The URI reference is then
resolved into an absolute form as described in section 5.2 of <xref
linkend="rfc2396"/> using the base URI from the context of the element
that bears the <literal>href</literal> attribute.</para>
<para>The value of the <literal>href</literal> attribute will be used
to construct an element (as specified in <xref
linkend="data-model"/>). This must be done as follows. The URI
reference consists of the URI itself and an optional fragment
identifier. The resource identified by the URI is retrieved. The
result is a MIME entity: a sequence of bytes labeled with a MIME
media type. The media type determines how an element is constructed
from the MIME entity and optional fragment identifier. When the media
type is <literal>application/xml</literal> or
<literal>text/xml</literal>, the MIME entity must be parsed as an XML
document in accordance with the applicable RFC (at the term of writing
<xref linkend="rfc3023"/>) and an element constructed from the result
of the parse as specified in <xref linkend="data-model"/>. In
particular, the <literal>charset</literal> parameter must be handled
as specified by the RFC. This specification does not define the
handling of media types other than <literal>application/xml</literal>
and <literal>text/xml</literal>. The <literal>href</literal> attribute
must not include a fragment identifier unless the registration of the
media type of the resource identified by the attribute defines the
interpretation of fragment identifiers for that media type.</para>
<note><para><xref linkend="rfc3023"/> does not define the
interpretation of fragment identifiers for
<literal>application/xml</literal> or
<literal>text/xml</literal>.</para></note>
</section>
<section>
<title><literal>externalRef</literal> element</title>
<para>An <literal>externalRef</literal> element is transformed as
follows. An element is constructed using the URI reference that is
the value of <literal>href</literal> attribute as specified in <xref
linkend="href"/>. This element must match the syntax for pattern. The
element is transformed by recursively applying the rules from this
subsection and from previous subsections of this section. This must
not result in a loop. In other words, the transformation of the
referenced element must not require the dereferencing of an
<literal>externalRef</literal> attribute with an
<literal>href</literal> attribute with the same value.</para>
<para>Any <literal>ns</literal> attribute on the
<literal>externalRef</literal> element is transferred to the
referenced element if the referenced element does not already have an
<literal>ns</literal> attribute. The <literal>externalRef</literal>
element is then replaced by the referenced element.</para>
</section>
<section>
<title><literal>include</literal> element</title>
<para>An <literal>include</literal> element is transformed as follows.
An element is constructed using the URI reference that is the value of
<literal>href</literal> attribute as specified in <xref
linkend="href"/>. This element must be a <literal>grammar</literal>
element, matching the syntax for grammar.</para>
<para>This <literal>grammar</literal> element is transformed by
recursively applying the rules from this subsection and from previous
subsections of this section. This must not result in a loop. In other
words, the transformation of the <literal>grammar</literal> element
must not require the dereferencing of an <literal>include</literal>
attribute with an <literal>href</literal> attribute with the same
value.</para>
<para>Define the <firstterm>components</firstterm> of an element to
be the children of the element together with the components of any
<literal>div</literal> child elements. If the
<literal>include</literal> element has a <literal>start</literal>
component, then the <literal>grammar</literal> element must have a
<literal>start</literal> component. If the <literal>include</literal>
element has a <literal>start</literal> component, then all
<literal>start</literal> components are removed from the
<literal>grammar</literal> element. If the <literal>include</literal>
element has a <literal>define</literal> component, then the
<literal>grammar</literal> element must have a
<literal>define</literal> component with the same name. For every
<literal>define</literal> component of the <literal>include</literal>
element, all <literal>define</literal> components with the same name
are removed from the <literal>grammar</literal> element.</para>
<para>The <literal>include</literal> element is transformed into a
<literal>div</literal> element. The attributes of the
<literal>div</literal> element are the attributes of the
<literal>include</literal> element other than the
<literal>href</literal> attribute. The children of the
<literal>div</literal> element are the <literal>grammar</literal>
element (after the removal of the <literal>start</literal> and
<literal>define</literal> components described by the preceding
paragraph) followed by the children of the <literal>include</literal>
element. The <literal>grammar</literal> element is then renamed to
<literal>div</literal>.</para>
</section>
<section>
<title><literal>name</literal> attribute of <literal>element</literal>
and <literal>attribute</literal> elements</title>
<para>The <literal>name</literal> attribute on an
<literal>element</literal> or <literal>attribute</literal> element is
transformed into a <literal>name</literal> child element.</para>
<para>If an <literal>attribute</literal> element has a
<literal>name</literal> attribute but no <literal>ns</literal>
attribute, then an <literal>ns=""</literal> attribute is added to the
<literal>name</literal> child element.</para>
</section>
<section>
<title><literal>ns</literal> attribute</title>
<para>For any <literal>name</literal>, <literal>nsName</literal> or
<literal>value</literal> element that does not have an
<literal>ns</literal> attribute, an <literal>ns</literal> attribute is
added. The value of the added <literal>ns</literal> attribute is the
value of the <literal>ns</literal> attribute of the nearest ancestor
element that has an <literal>ns</literal> attribute, or the empty
string if there is no such ancestor. Then, any <literal>ns</literal>
attribute that is on an element other than <literal>name</literal>,
<literal>nsName</literal> or <literal>value</literal> is
removed.</para>
<note><para>The value of the <literal>ns</literal> attribute is
<emphasis role="strong">not</emphasis> transformed either by escaping
disallowed characters, or in any other way, because the value of the
<literal>ns</literal> attribute is compared against namespace URIs in
the instance, which are not subject to any
transformation.</para></note>
<note><para>Since <literal>include</literal> and
<literal>externalRef</literal> elements are resolved after
<literal>datatypeLibrary</literal> attributes are added but before
<literal>ns</literal> attributes are added, <literal>ns</literal>
attributes are inherited into external schemas but
<literal>datatypeLibrary</literal> attributes are not.</para></note>
</section>
<section>
<title>QNames</title>
<para>For any <literal>name</literal> element containing a prefix, the
prefix is removed and an <literal>ns</literal> attribute is added
replacing any existing <literal>ns</literal> attribute. The value of
the added <literal>ns</literal> attribute is the value to which the
namespace map of the context of the <literal>name</literal> element
maps the prefix. The context must have a mapping for the
prefix.</para>
</section>
<section>
<title><literal>div</literal> element</title>
<para>Each <literal>div</literal> element is replaced by its
children.</para>
</section>
<section id="number-child-elements">
<title>Number of child elements</title>
<para>A <literal>define</literal>, <literal>oneOrMore</literal>,
<literal>zeroOrMore</literal>, <literal>optional</literal>, <literal>list</literal> or
<literal>mixed</literal> element is transformed so that it has exactly
one child element. If it has more than one child element, then its
child elements are wrapped in a <literal>group</literal>
element. Similarly, an <literal>element</literal> element is transformed so
that it has exactly two child elements, the first being a name class
and the second being a pattern. If it has more than two child elements,
then the child elements other than the first are wrapped in a
<literal>group</literal> element.</para>
<para>A <literal>except</literal> element is transformed
so that it has exactly one child element. If it has more
than one child element, then its child elements are wrapped
in a <literal>choice</literal> element.</para>
<para>If an <literal>attribute</literal> element has only one child
element (a name class), then a <literal>text</literal> element is
added.</para>
<para>A <literal>choice</literal>, <literal>group</literal> or
<literal>interleave</literal> element is transformed so that it has
exactly two child elements. If it has one child element, then it is
replaced by its child element. If it has more than two child
elements, then the first two child elements are combined into a new
element with the same name as the parent element and with the first
two child elements as its children. For example,</para>
<programlisting><choice> <replaceable>p1</replaceable> <replaceable>p2</replaceable> <replaceable>p3</replaceable> </choice></programlisting>
<para>is transformed to</para>
<programlisting><choice> <choice> <replaceable>p1</replaceable> <replaceable>p2</replaceable> </choice> <replaceable>p3</replaceable> </choice></programlisting>
<para>This reduces the number of child elements by one. The
transformation is applied repeatedly until there are exactly two child
elements.</para>
</section>
<section>
<title><literal>mixed</literal> element</title>
<para>A <literal>mixed</literal> element is transformed into an
interleaving with a <literal>text</literal> element:</para>
<programlisting><mixed> <replaceable>p</replaceable> </mixed></programlisting>
<para>is transformed into</para>
<programlisting><interleave> <replaceable>p</replaceable> <text/> </interleave></programlisting>
</section>
<section>
<title><literal>optional</literal> element</title>
<para>An <literal>optional</literal> element is transformed into
a choice with <literal>empty</literal>:</para>
<programlisting><optional> <replaceable>p</replaceable> </optional></programlisting>
<para>is transformed into</para>
<programlisting><choice> <replaceable>p</replaceable> <empty/> </choice></programlisting>
</section>
<section>
<title><literal>zeroOrMore</literal> element</title>
<para>A <literal>zeroOrMore</literal> element is transformed into a choice
between <literal>oneOrMore</literal> and
<literal>empty</literal>:</para>
<programlisting><zeroOrMore> <replaceable>p</replaceable> </zeroOrMore></programlisting>
<para>is transformed into</para>
<programlisting><choice> <oneOrMore> <replaceable>p</replaceable> </oneOrMore> <empty/> </choice></programlisting>
</section>
<section id="constraints">
<title>Constraints</title>
<para>In this rule, no transformation is performed, but various
constraints are checked.</para>
<note><para>The constraints in this section, unlike the constraints
specified in <xref linkend="restriction"/>, can be checked without
resolving any <literal>ref</literal> elements, and are accordingly
applied even to patterns that will disappear during later stages of
simplification because they are not reachable (see <xref
linkend="define-ref"/>) or because of <literal>notAllowed</literal>
(see <xref linkend="notAllowed"/>).</para></note>
<para>An <literal>except</literal> element that is a child of an
<literal>anyName</literal> element must not have any
<literal>anyName</literal> descendant elements. An
<literal>except</literal> element that is a child of an
<literal>nsName</literal> element must not have any
<literal>nsName</literal> or <literal>anyName</literal> descendant
elements.</para>
<para>A <literal>name</literal> element that occurs as the first child
of an <literal>attribute</literal> element or as the descendant of the
first child of an <literal>attribute</literal> element and that has an
<literal>ns</literal> attribute with value equal to the empty string
must not have content equal to <literal>xmlns</literal>.</para>
<para>A <literal>name</literal> or <literal>nsName</literal> element
that occurs as the first child of an <literal>attribute</literal>
element or as the descendant of the first child of an
<literal>attribute</literal> element must not have an
<literal>ns</literal> attribute with value
<literal>http://www.w3.org/2000/xmlns</literal>.</para>
<note><para>The <xref linkend="infoset"/> defines the namespace URI of
namespace declaration attributes to be
<literal>http://www.w3.org/2000/xmlns</literal>.</para></note>
<para>A <literal>data</literal> or <literal>value</literal> element
must be correct in its use of datatypes. Specifically, the
<literal>type</literal> attribute must identify a datatype within the
datatype library identified by the value of the
<literal>datatypeLibrary</literal> attribute. For a
<literal>data</literal> element, the parameter list must be one that
is allowed by the datatype (see <xref
linkend="data-pattern"/>).</para>
</section>
<section>
<title><literal>combine</literal> attribute</title>
<para>For each <literal>grammar</literal> element, all
<literal>define</literal> elements with the same name are combined
together. For any name, there must not be more than one
<literal>define</literal> element with that name that does not have a
<literal>combine</literal> attribute. For any name, if there is a
<literal>define</literal> element with that name that has a
<literal>combine</literal> attribute with the value
<literal>choice</literal>, then there must not also be a
<literal>define</literal> element with that name that has a
<literal>combine</literal> attribute with the value
<literal>interleave</literal>. Thus, for any name, if there is more
than one <literal>define</literal> element with that name, then there
is a unique value for the <literal>combine</literal> attribute for
that name. After determining this unique value, the
<literal>combine</literal> attributes are removed. A pair of
definitions</para>
<programlisting><define name="<replaceable>n</replaceable>">
<replaceable>p1</replaceable>
</define>
<define name="<replaceable>n</replaceable>">
<replaceable>p2</replaceable>
</define></programlisting>
<para>is combined into</para>
<programlisting><define name="<replaceable>n</replaceable>">
<<replaceable>c</replaceable>>
<replaceable>p1</replaceable>
<replaceable>p2</replaceable>
</<replaceable>c</replaceable>>
</define></programlisting>
<para>where <replaceable>c</replaceable> is the value of the
<literal>combine</literal> attribute. Pairs of definitions are
combined until there is exactly one <literal>define</literal> element
for each name.</para>
<para>Similarly, for each <literal>grammar</literal> element all
<literal>start</literal> elements are combined together. There must
not be more than one <literal>start</literal> element that does not
have a <literal>combine</literal> attribute. If there is a
<literal>start</literal> element that has a <literal>combine</literal>
attribute with the value <literal>choice</literal>, there must not
also be a <literal>start</literal> element that has a
<literal>combine</literal> attribute with the value
<literal>interleave</literal>.</para>
</section>
<section>
<title><literal>grammar</literal> element</title>
<para>In this rule, the schema is transformed so that its top-level
element is <literal>grammar</literal> and so that it has no other
<literal>grammar</literal> elements.</para>
<para>Define the <firstterm>in-scope grammar</firstterm> for an
element to be the nearest ancestor <literal>grammar</literal> element. A
<literal>ref</literal> element <firstterm>refers to</firstterm> a
<literal>define</literal> element if the value of their
<literal>name</literal> attributes is the same and their in-scope
grammars are the same. A <literal>parentRef</literal> element
<firstterm>refers to</firstterm> a <literal>define</literal> element
if the value of their <literal>name</literal> attributes is the same
and the in-scope grammar of the in-scope grammar of the
<literal>parentRef</literal> element is the same as the in-scope
grammar of the <literal>define</literal> element. Every
<literal>ref</literal> or <literal>parentRef</literal> element must
refer to a <literal>define</literal> element. A
<literal>grammar</literal> must have a <literal>start</literal> child
element.</para>
<para>First, transform the top-level pattern
<replaceable>p</replaceable> into
<literal><grammar><start><replaceable>p</replaceable></start></grammar></literal>.
Next, rename <literal>define</literal> elements so that no two
<literal>define</literal> elements anywhere in the schema have the
same name. To rename a <literal>define</literal> element, change the
value of its <literal>name</literal> attribute and change the value of
the <literal>name</literal> attribute of all <literal>ref</literal>
and <literal>parentRef</literal> elements that refer to that
<literal>define</literal> element. Next, move all
<literal>define</literal> elements to be children of the top-level
<literal>grammar</literal> element, replace each nested
<literal>grammar</literal> element by the child of its
<literal>start</literal> element and rename each
<literal>parentRef</literal> element to <literal>ref</literal>.</para>
</section>
<section id="define-ref">
<title><literal>define</literal> and <literal>ref</literal> elements</title>
<para>In this rule, the grammar is transformed so that every
<literal>element</literal> element is the child of a
<literal>define</literal> element, and the child of every
<literal>define</literal> element is an <literal>element</literal>
element.</para>
<para>First, remove any <literal>define</literal> element that is not
<firstterm>reachable</firstterm>. A <literal>define</literal> element
is reachable if there is reachable <literal>ref</literal> element
referring to it. A <literal>ref</literal> element is reachable if it
is the descendant of the <literal>start</literal> element or of a
reachable <literal>define</literal> element. Now, for
each <literal>element</literal> element that is not the child of a
<literal>define</literal> element, add a <literal>define</literal>
element to the <literal>grammar</literal> element, and replace the
<literal>element</literal> element by a <literal>ref</literal> element
referring to the added <literal>define</literal> element. The value of
the <literal>name</literal> attribute of the added
<literal>define</literal> element must be different from value of the
<literal>name</literal> attribute of all other
<literal>define</literal> elements. The child of the added
<literal>define</literal> element is the <literal>element</literal>
element.</para>
<para>Define a <literal>ref</literal> element to be
<firstterm>expandable</firstterm> if it refers to a
<literal>define</literal> element whose child is not an
<literal>element</literal> element. For each <literal>ref</literal>
element that is expandable and is a descendant of a
<literal>start</literal> element or an <literal>element</literal>
element, expand it by replacing the <literal>ref</literal> element by
the child of the <literal>define</literal> element to which it refers and
then recursively expanding any expandable <literal>ref</literal>
elements in this replacement. This must not result in a loop.
In other words expanding the replacement of a
<literal>ref</literal> element having a <literal>name</literal> with
value <replaceable>n</replaceable> must not require the expansion of
<literal>ref</literal> element also having a <literal>name</literal>
with value <replaceable>n</replaceable>. Finally, remove any
<literal>define</literal> element whose child is not an
<literal>element</literal> element.</para>
</section>
<section id="notAllowed">
<title><literal>notAllowed</literal> element</title>
<para>In this rule, the grammar is transformed so that a
<literal>notAllowed</literal> element occurs only as the child of
a <literal>start</literal> or <literal>element</literal> element. An
<literal>attribute</literal>, <literal>list</literal>,
<literal>group</literal>, <literal>interleave</literal>,
or <literal>oneOrMore</literal> element that has a
<literal>notAllowed</literal> child element is transformed into a
<literal>notAllowed</literal> element. A <literal>choice</literal>
element that has two <literal>notAllowed</literal> child elements is
transformed into a <literal>notAllowed</literal> element. A
<literal>choice</literal> element that has one
<literal>notAllowed</literal> child element is transformed into its
other child element. An <literal>except</literal> element that has a
<literal>notAllowed</literal> child element is removed.
The preceding transformations are applied
repeatedly until none of them is applicable any more.
Any <literal>define</literal> element that is no longer reachable
is removed.</para>
</section>
<section>
<title><literal>empty</literal> element</title>
<para>In this rule, the grammar is transformed so that an
<literal>empty</literal> element does not occur as a child of a
<literal>group</literal>, <literal>interleave</literal>, or
<literal>oneOrMore</literal> element or as the second child of
a <literal>choice</literal> element. A <literal>group</literal>,
<literal>interleave</literal> or <literal>choice</literal> element
that has two <literal>empty</literal> child elements is transformed
into an <literal>empty</literal> element. A <literal>group</literal>
or <literal>interleave</literal> element that has one
<literal>empty</literal> child element is transformed into its other
child element. A <literal>choice</literal> element whose
second child element is an <literal>empty</literal> element is
transformed by interchanging its two child elements. A
<literal>oneOrMore</literal> element that has an
<literal>empty</literal> child element is transformed into an
<literal>empty</literal> element. The preceding transformations are applied
repeatedly until none of them is applicable any more.</para>
</section>
</section>
<section id="simple-syntax">
<title>Simple syntax</title>
<para>After applying all the rules in <xref
linkend="simplification"/>, the schema will match the following
grammar:</para>
<grammarref src="simple.rng"/>
<para>With this grammar, no elements or attributes are allowed other
than those explicitly shown.</para>
<section id="simple-syntax-example">
<title>Example</title>
<para>The following is an example of how the schema in <xref
linkend="full-syntax-example"/> can be transformed into the simple
syntax:</para>
<programlisting><![CDATA[<?xml version="1.0"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
<start>
<ref name="foo.element"/>
</start>
<define name="foo.element">
<element>
<name ns="">foo</name>
<group>
<ref name="bar1.element"/>
<ref name="bar2.element"/>
</group>
</element>
</define>
<define name="bar1.element">
<element>
<name ns="http://www.example.com/n1">bar1</name>
<empty/>
</element>
</define>
<define name="bar2.element">
<element>
<name ns="http://www.example.com/n2">bar2</name>
<empty/>
</element>
</define>
</grammar>]]></programlisting>
<note><para>Strictly speaking, the result of simplification is an
instance of the data model rather than an XML document. For
convenience, we use an XML document to represent an instance of the
data model.</para></note>
</section>
</section>
<section id="semantics">
<title>Semantics</title>
<para>In this section, we define the semantics of a correct RELAX NG
schema that has been transformed into the simple syntax. The
semantics of a RELAX NG schema consist of a specification of what XML
documents are valid with respect to that schema. The semantics are
described formally. The formalism uses axioms and inference rules.
Axioms are propositions that are provable unconditionally. An
inference rule consists of one or more antecedents and exactly one
consequent. An antecedent is either positive or negative. If all the
positive antecedents of an inference rule are provable and none of the
negative antecedents are provable, then the consequent of the
inference rule is provable. An XML document is valid with respect to a
RELAX NG schema if and only if the proposition that it is valid is
provable in the formalism specified in this section.</para>
<note><para>This kind of formalism is similar to a proof system.
However, a traditional proof system only has positive
antecedents.</para></note>
<para>The notation for inference rules separates the antecedents from
the consequent by a horizontal line: the antecedents are above the
line; the consequent is below the line. If an antecedent is of the
form not(<replaceable>p</replaceable>), then it is a negative
antecedent; otherwise, it is a positive antecedent. Both axioms and
inferences
rules may use variables. A variable has a name and optionally a
subscript. The name of a variable is italicized. Each variable has a
range that is determined by its name. Axioms and inference rules are
implicitly universally quantified over the variables they contain. We
explain this further below.</para>
<para>The possibility that an inference rule or axiom may contain more
than one occurrence of a particular variable requires that an identity
relation be defined on each kind of object over which a variable can
range. The identity relation for all kinds of object is value-based.
Two objects of a particular kind are identical if the constituents of
the objects are identical. For example, two attributes are considered
the same if they have the same name and the same value. Two characters
are identical if their Unicode character codes are the same.</para>
<section id="name-classes">
<title>Name classes</title>
<para>The main semantic concept for name classes is that of a name
belonging to a name class. A name class is an element that matches the
production nameClass. A name is as defined in <xref
linkend="data-model"/>: it consists of a namespace URI and a local
name.</para>
<para>We use the following notation:</para>
<variablelist>
<varlistentry><term><p:var range="name"/></term><listitem><para>is a variable
that ranges over names</para></listitem></varlistentry>
<varlistentry><term><p:var range="nameClass"/></term><listitem><para>ranges over name classes</para></listitem></varlistentry>
<varlistentry><term><p:judgement name="belongs">
<p:var range="name"/>
<p:var range="nameClass"/>
</p:judgement></term><listitem><para>
asserts that name <p:var range="name"/> is a member of name class <p:var range="nameClass"/>
</para></listitem></varlistentry>
</variablelist>
<para>We are now ready for our first axiom, which is called "anyName
1":</para>
<p:proofSystem>
<p:rule name="anyName 1">
<p:judgement name="belongs">
<p:var range="name"/>
<p:element name="anyName"/>
</p:judgement>
</p:rule>
</p:proofSystem>
<para>This says for any name <p:var range="name"/>, <p:var
range="name"/> belongs to the name class <p:element name="anyName"/>,
in other words <p:element name="anyName"/> matches any name. Note the
effect of the implicit universal quantification over the variables in
the axiom: this is what makes the axiom apply for any name <p:var
range="name"/>.</para>
<para>Our first inference rule is almost as simple:</para>
<p:proofSystem>
<p:rule name="anyName 2">
<p:not>
<p:judgement name="belongs">
<p:var range="name"/>
<p:var range="nameClass"/>
</p:judgement>
</p:not>
<p:judgement name="belongs">
<p:var range="name"/>
<p:element name="anyName">
<p:element name="except">
<p:var range="nameClass"/>
</p:element>
</p:element>
</p:judgement>
</p:rule>
</p:proofSystem>
<para>This says that for any name <p:var range="name"/>
and for any name class <p:var range="nameClass"/>,
if <p:var range="name"/> does not belong to <p:var range="nameClass"/>,
then <p:var range="name"/> belongs to
<p:element name="anyName">
<p:element name="except">
<p:var range="nameClass"/>
</p:element>
</p:element>. In other words, <p:element name="anyName">
<p:element name="except">
<p:var range="nameClass"/>
</p:element>
</p:element> matches any name that does not match <p:var range="nameClass"/>.</para>
<para>We now need the following additional notation:</para>
<variablelist>
<varlistentry><term><p:var range="ncname"/></term>
<listitem><para>ranges over local names; a local name is a string that
matches the NCName production of <xref linkend="xml-names"/>, that is,
a name with no colons</para></listitem>
</varlistentry>
<varlistentry><term><p:var range="uri"/></term><listitem><para>ranges over URIs</para></listitem></varlistentry>
<varlistentry>
<term>
<p:function name="name">
<p:var range="uri"/>
<p:var range="ncname"/>
</p:function>
</term>
<listitem><para>constructs a name with URI <p:var range="uri"/> and local
name <p:var range="ncname"/></para></listitem>
</varlistentry>
</variablelist>
<para>The remaining axioms and inference rules for name classes are as
follows:</para>
<p:proofSystem>
<p:rule name="nsName 1">
<p:judgement name="belongs">
<p:function name="name">
<p:var range="uri"/>
<p:var range="ncname"/>
</p:function>
<p:element name="nsName">
<p:attribute name="ns">
<p:var range="uri"/>
</p:attribute>
</p:element>
</p:judgement>
</p:rule>
<p:rule name="nsName 2">
<p:not>
<p:judgement name="belongs">
<p:function name="name">
<p:var range="uri"/>
<p:var range="ncname"/>
</p:function>
<p:var range="nameClass"/>
</p:judgement>
</p:not>
<p:judgement name="belongs">
<p:function name="name">
<p:var range="uri"/>
<p:var range="ncname"/>
</p:function>
<p:element name="nsName">
<p:attribute name="ns">
<p:var range="uri"/>
</p:attribute>
<p:element name="except">
<p:var range="nameClass"/>
</p:element>
</p:element>
</p:judgement>
</p:rule>
<p:rule name="name">
<p:judgement name="belongs">
<p:function name="name">
<p:var range="uri"/>
<p:var range="ncname"/>
</p:function>
<p:element name="name">
<p:attribute name="ns">
<p:var range="uri"/>
</p:attribute>
<p:var range="ncname"/>
</p:element>
</p:judgement>
</p:rule>
<p:rule name="name choice 1">
<p:judgement name="belongs">
<p:var range="name"/>
<p:var range="nameClass" sub="1"/>
</p:judgement>
<p:judgement name="belongs">
<p:var range="name"/>
<p:element name="choice">
<p:var range="nameClass" sub="1"/>
<p:var range="nameClass" sub="2"/>
</p:element>
</p:judgement>
</p:rule>
<p:rule name="name choice 2">
<p:judgement name="belongs">
<p:var range="name"/>
<p:var range="nameClass" sub="2"/>
</p:judgement>
<p:judgement name="belongs">
<p:var range="name"/>
<p:element name="choice">
<p:var range="nameClass" sub="1"/>
<p:var range="nameClass" sub="2"/>
</p:element>
</p:judgement>
</p:rule>
</p:proofSystem>
</section>
<section>
<title>Patterns</title>
<para>The axioms and inference rules for patterns use the following
notation:</para>
<variablelist>
<varlistentry><term><p:var range="context"/></term><listitem><para>ranges
over contexts (as defined in <xref
linkend="data-model"/>)</para></listitem></varlistentry>
<varlistentry><term><p:var range="att"/></term><listitem><para>ranges over
sets of attributes; a set with a single member
is considered the same as that member</para></listitem></varlistentry>
<varlistentry><term><p:var
range="mixed"/></term><listitem><para>ranges over sequences of
elements and strings; a sequence with a single member is considered
the same as that member; the sequences ranged over by <p:var
range="mixed"/> may contain consecutive strings and may contain strings
that are empty; thus, there are sequences ranged over by <p:var
range="mixed"/> that cannot occur as the children of an
element</para></listitem></varlistentry>
<varlistentry><term><p:var range="pattern"/></term><listitem><para>ranges
over patterns (elements matching the pattern
production)</para></listitem></varlistentry>
<varlistentry><term><p:judgement name="match">
<p:var range="context"/>
<p:var range="att"/>
<p:var range="mixed"/>
<p:var range="pattern"/>
</p:judgement></term><listitem><para>
asserts that with respect to context <p:var range="context"/>, the
attributes <p:var range="att"/> and the sequence of elements and
strings <p:var range="mixed"/> matches the pattern <p:var
range="pattern"/></para></listitem></varlistentry>
</variablelist>
<section id="choice-pattern">
<title><literal>choice</literal> pattern</title>
<para>The semantics of the <literal>choice</literal> pattern are as follows:</para>
<p:proofSystem>
<p:rule name="choice 1">
<p:judgement name="match">
<p:var range="context"/>
<p:var range="att"/>
<p:var range="mixed"/>
<p:var range="pattern" sub="1"/>
</p:judgement>
<p:judgement name="match">
<p:var range="context"/>
<p:var range="att"/>
<p:var range="mixed"/>
<p:element name="choice">
<p:var range="pattern" sub="1"/>
<p:var range="pattern" sub="2"/>
</p:element>
</p:judgement>
</p:rule>
<p:rule name="choice 2">
<p:judgement name="match">
<p:var range="context"/>
<p:var range="att"/>
<p:var range="mixed"/>
<p:var range="pattern" sub="2"/>
</p:judgement>
<p:judgement name="match">
<p:var range="context"/>
<p:var range="att"/>
<p:var range="mixed"/>
<p:element name="choice">
<p:var range="pattern" sub="1"/>
<p:var range="pattern" sub="2"/>
</p:element>
</p:judgement>
</p:rule>
</p:proofSystem>
</section>
<section>
<title><literal>group</literal> pattern</title>
<para>We use the following additional notation:</para>
<variablelist>
<varlistentry><term><p:function name="append">
<p:var range="mixed" sub="1"/>
<p:var range="mixed" sub="2"/>
</p:function></term><listitem>
<para>represents the concatenation of the sequences <p:var range="mixed" sub="1"/> and <p:var range="mixed" sub="2"/>
</para></listitem></varlistentry>
<varlistentry><term><p:function name="union">
<p:var range="att" sub="1"/>
<p:var range="att" sub="2"/>
</p:function></term><listitem>
<para>represents the union of <p:var range="att" sub="1"/>
and <p:var range="att" sub="2"/></para>
</listitem>
</varlistentry>
</variablelist>
<para>The semantics of the <literal>group</literal> pattern are as follows:</para>
<p:proofSystem>
<p:rule name="group">
<p:judgement name="match">
<p:var range="context"/>
<p:var range="att" sub="1"/>
<p:var range="mixed" sub="1"/>
<p:var range="pattern" sub="1"/>
</p:judgement>
<p:judgement name="match">
<p:var range="context"/>
<p:var range="att" sub="2"/>
<p:var range="mixed" sub="2"/>
<p:var range="pattern" sub="2"/>
</p:judgement>
<p:judgement name="match">
<p:var range="context"/>
<p:function name="union">
<p:var range="att" sub="1"/>
<p:var range="att" sub="2"/>
</p:function>
<p:function name="append">
<p:var range="mixed" sub="1"/>
<p:var range="mixed" sub="2"/>
</p:function>
<p:element name="group">
<p:var range="pattern" sub="1"/>
<p:var range="pattern" sub="2"/>
</p:element>
</p:judgement>
</p:rule>
</p:proofSystem>
<note><para>The restriction in <xref linkend="attribute-restrictions"/>
ensures that the set of attributes constructed in the consequent will
not have multiple attributes with the same name.</para></note>
</section>
<section id="empty-pattern">
<title><literal>empty</literal> pattern</title>
<para>We use the following additional notation:</para>
<variablelist>
<varlistentry><term><p:function name="emptySequence"/></term><listitem><para>represents an empty sequence</para></listitem></varlistentry>
<varlistentry><term><p:function name="emptySet"/></term><listitem><para>represents an empty set</para></listitem></varlistentry>
</variablelist>
<para>The semantics of the <literal>empty</literal> pattern are as follows:</para>
<p:proofSystem>
<p:rule name="empty">
<p:judgement name="match">
<p:var range="context"/>
<p:function name="emptySet"/>
<p:function name="emptySequence"/>
<p:element name="empty"></p:element>
<p:function name="emptySet"/>
<p:function name="emptySet"/>
</p:judgement>
</p:rule>
</p:proofSystem>
</section>
<section id="text-pattern">
<title><literal>text</literal> pattern</title>
<para>We use the following additional notation:</para>
<variablelist>
<varlistentry><term><p:var range="string"/></term><listitem><para>ranges
over strings</para></listitem></varlistentry>
</variablelist>
<para>The semantics of the <literal>text</literal> pattern are as follows:</para>
<p:proofSystem>
<p:rule name="text 1">
<p:judgement name="match">
<p:var range="context"/>
<p:function name="emptySet"/>
<p:function name="emptySequence"/>
<p:element name="text"></p:element>
<p:function name="emptySet"/>
<p:function name="emptySet"/>
</p:judgement>
</p:rule>
<p:rule name="text 2">
<p:judgement name="match">
<p:var range="context"/>
<p:function name="emptySet"/>
<p:var range="mixed"/>
<p:element name="text"></p:element>
<p:function name="emptySet"/>
<p:function name="emptySet"/>
</p:judgement>
<p:judgement name="match">
<p:var range="context"/>
<p:function name="emptySet"/>
<p:function name="append">
<p:var range="mixed"/>
<p:var range="string"/>
</p:function>
<p:element name="text"></p:element>
<p:function name="emptySet"/>
<p:function name="emptySet"/>
</p:judgement>
</p:rule>
</p:proofSystem>
<para>The effect of the above rule is that a <literal>text</literal>
element matches zero or more strings.</para>
</section>
<section>
<title><literal>oneOrMore</literal> pattern</title>
<para>We use the following additional notation:</para>
<variablelist>
<varlistentry><term><p:judgement name="disjoint">
<p:var range="att" sub="1"/>
<p:var range="att" sub="2"/>
</p:judgement></term><listitem><para>
asserts that there is no name that is
the name of both an attribute in <p:var range="att" sub="1"/>
and of an attribute in <p:var range="att" sub="2"/>
</para></listitem></varlistentry>
</variablelist>
<para>The semantics of the <literal>oneOrMore</literal> pattern are as follows:</para>
<p:proofSystem>
<p:rule name="oneOrMore 1">
<p:judgement name="match">
<p:var range="context"/>
<p:var range="att"/>
<p:var range="mixed"/>
<p:var range="pattern"/>
</p:judgement>
<p:judgement name="match">
<p:var range="context"/>
<p:var range="att"/>
<p:var range="mixed"/>
<p:element name="oneOrMore">
<p:var range="pattern"/>
</p:element>
</p:judgement>
</p:rule>
<p:rule name="oneOrMore 2">
<p:judgement name="match">
<p:var range="context"/>
<p:var range="att" sub="1"/>
<p:var range="mixed" sub="1"/>
<p:var range="pattern"/>
</p:judgement>
<p:judgement name="match">
<p:var range="context"/>
<p:var range="att" sub="2"/>
<p:var range="mixed" sub="2"/>
<p:element name="oneOrMore">
<p:var range="pattern"/>
</p:element>
</p:judgement>
<p:judgement name="disjoint">
<p:var range="att" sub="1"/>
<p:var range="att" sub="2"/>
</p:judgement>
<p:judgement name="match">
<p:var range="context"/>
<p:function name="union">
<p:var range="att" sub="1"/>
<p:var range="att" sub="2"/>
</p:function>
<p:function name="append">
<p:var range="mixed" sub="1"/>
<p:var range="mixed" sub="2"/>
</p:function>
<p:element name="oneOrMore">
<p:var range="pattern"/>
</p:element>
</p:judgement>
</p:rule>
</p:proofSystem>
</section>
<section>
<title><literal>interleave</literal> pattern</title>
<para>We use the following additional notation:</para>
<variablelist>
<varlistentry><term><p:judgement name="interleave">
<p:var range="mixed" sub="1"/>
<p:var range="mixed" sub="2"/>
<p:var range="mixed" sub="3"/>
</p:judgement></term><listitem><para>
asserts that <p:var range="mixed" sub="1"/>
is an interleaving of <p:var range="mixed" sub="2"/>
and <p:var range="mixed" sub="3"/>
</para></listitem></varlistentry>
</variablelist>
<para>The semantics of interleaving are defined by the following rules.</para>
<p:proofSystem>
<p:rule name="interleaves 1">
<p:judgement name="interleave">
<p:function name="emptySequence"/>
<p:function name="emptySequence"/>
<p:function name="emptySequence"/>
</p:judgement>
</p:rule>
<p:rule name="interleaves 2">
<p:judgement name="interleave">
<p:var range="mixed" sub="1"/>
<p:var range="mixed" sub="2"/>
<p:var range="mixed" sub="3"/>
</p:judgement>
<p:judgement name="interleave">
<p:function name="append">
<p:var range="mixed" sub="4"/>
<p:var range="mixed" sub="1"/>
</p:function>
<p:function name="append">
<p:var range="mixed" sub="4"/>
<p:var range="mixed" sub="2"/>
</p:function>
<p:var range="mixed" sub="3"/>
</p:judgement>
</p:rule>
<p:rule name="interleaves 3">
<p:judgement name="interleave">
<p:var range="mixed" sub="1"/>
<p:var range="mixed" sub="2"/>
<p:var range="mixed" sub="3"/>
</p:judgement>
<p:judgement name="interleave">
<p:function name="append">
<p:var range="mixed" sub="4"/>
<p:var range="mixed" sub="1"/>
</p:function>
<p:var range="mixed" sub="2"/>
<p:function name="append">
<p:var range="mixed" sub="4"/>
<p:var range="mixed" sub="3"/>
</p:function>
</p:judgement>
</p:rule>
</p:proofSystem>
<para>For example, the interleavings of
<literal><![CDATA[<a/><a/>]]></literal> and
<literal><![CDATA[<b/>]]></literal> are
<literal><![CDATA[<a/><a/><b/>]]></literal>,
<literal><![CDATA[<a/><b/><a/>]]></literal>, and
<literal><![CDATA[<b/><a/><a/>]]></literal>.</para>
<para>The semantics of the <literal>interleave</literal> pattern are
as follows:</para>
<p:proofSystem>
<p:rule name="interleave">
<p:judgement name="match">
<p:var range="context"/>
<p:var range="att" sub="1"/>
<p:var range="mixed" sub="1"/>
<p:var range="pattern" sub="1"/>
</p:judgement>
<p:judgement name="match">
<p:var range="context"/>
<p:var range="att" sub="2"/>
<p:var range="mixed" sub="2"/>
<p:var range="pattern" sub="2"/>
</p:judgement>
<p:judgement name="interleave">
<p:var range="mixed" sub="3"/>
<p:var range="mixed" sub="1"/>
<p:var range="mixed" sub="2"/>
</p:judgement>
<p:judgement name="match">
<p:var range="context"/>
<p:function name="union">
<p:var range="att" sub="1"/>
<p:var range="att" sub="2"/>
</p:function>
<p:var range="mixed" sub="3"/>
<p:element name="interleave">
<p:var range="pattern" sub="1"/>
<p:var range="pattern" sub="2"/>
</p:element>
</p:judgement>
</p:rule>
</p:proofSystem>
<note><para>The restriction in <xref linkend="attribute-restrictions"/>
ensures that the set of attributes constructed in the consequent will
not have multiple attributes with the same name.</para></note>
</section>
<section id="element-pattern">
<title><literal>element</literal> and <literal>attribute</literal> pattern</title>
<para>The value of an attribute is always a single string, which may
be empty. Thus, the empty sequence is not a possible attribute value.
On the hand, the children of an element can be an empty sequence and
cannot consist of an empty string. In order to ensure that validation
handles attributes and elements consistently, we introduce a variant
of matching called <firstterm>weak matching</firstterm>. Weak
matching is used when matching the pattern for the value of an
attribute or for the attributes and children of an element. We use
the following notation to define weak matching.</para>
<variablelist>
<varlistentry><term><p:function
name="emptyString"/></term><listitem><para>represents an empty
string</para></listitem></varlistentry>
<varlistentry><term><p:var
range="whiteSpace"/></term><listitem><para>ranges over the empty
sequence and strings that consist entirely of
whitespace</para></listitem></varlistentry>
<varlistentry><term><p:judgement name="weakMatch">
<p:var range="context"/>
<p:var range="att"/>
<p:var range="mixed"/>
<p:var range="pattern"/>
</p:judgement></term><listitem><para>
asserts that with respect to context <p:var range="context"/>, the
attributes <p:var range="att"/> and the sequence of elements and
strings <p:var range="mixed"/> weakly matches the pattern <p:var
range="pattern"/></para></listitem></varlistentry>
</variablelist>
<para>The semantics of weak matching are as follows:</para>
<p:proofSystem>
<p:rule name="weak match 1">
<p:judgement name="match">
<p:var range="context"/>
<p:var range="att"/>
<p:var range="mixed"/>
<p:var range="pattern"/>
</p:judgement>
<p:judgement name="weakMatch">
<p:var range="context"/>
<p:var range="att"/>
<p:var range="mixed"/>
<p:var range="pattern"/>
</p:judgement>
</p:rule>
<p:rule name="weak match 2">
<p:judgement name="match">
<p:var range="context"/>
<p:var range="att"/>
<p:function name="emptySequence"/>
<p:var range="pattern"/>
</p:judgement>
<p:judgement name="weakMatch">
<p:var range="context"/>
<p:var range="att"/>
<p:var range="whiteSpace"/>
<p:var range="pattern"/>
</p:judgement>
</p:rule>
<p:rule name="weak match 3">
<p:judgement name="match">
<p:var range="context"/>
<p:var range="att"/>
<p:function name="emptyString"/>
<p:var range="pattern"/>
</p:judgement>
<p:judgement name="weakMatch">
<p:var range="context"/>
<p:var range="att"/>
<p:function name="emptySequence"/>
<p:var range="pattern"/>
</p:judgement>
</p:rule>
</p:proofSystem>
<para>We use the following additional notation:</para>
<variablelist>
<varlistentry><term><p:function name="attribute">
<p:var range="name"/>
<p:var range="string"/>
</p:function></term><listitem><para>
constructs an attribute with name <p:var range="name"/>
and value <p:var range="string"/>
</para></listitem></varlistentry>
<varlistentry><term><p:function name="element">
<p:var range="name"/>
<p:var range="context"/>
<p:var range="att"/>
<p:var range="mixed"/>
</p:function></term><listitem><para>
constructs an element with name <p:var range="name"/>,
context <p:var range="context"/>,
attributes <p:var range="att"/>
and mixed sequence <p:var range="mixed"/> as children
</para></listitem></varlistentry>
<varlistentry><term><p:judgement name="okAsChildren">
<p:var range="mixed"/>
</p:judgement></term><listitem><para>
asserts that the mixed sequence <p:var range="mixed"/> can occur as
the children of an element: it does not contain any member that is an
empty string, nor does it contain two consecutive members that are
both strings</para></listitem></varlistentry>
<varlistentry><term><p:judgement name="bind">
<p:var range="ncname"/>
<p:var range="nameClass"/>
<p:var range="pattern"/>
</p:judgement></term><listitem><para>
asserts that the grammar contains
<p:element name="define">
<p:attribute name="name">
<p:var range="ncname"/>
</p:attribute>
<p:element name="element">
<p:var range="nameClass"/>
<p:var range="pattern"/>
</p:element>
</p:element>
</para></listitem></varlistentry>
</variablelist>
<para>The semantics of the <literal>attribute</literal> pattern are as follows:</para>
<p:proofSystem>
<p:rule name="attribute">
<p:judgement name="weakMatch">
<p:var range="context"/>
<p:function name="emptySet"/>
<p:var range="string"/>
<p:var range="pattern"/>
</p:judgement>
<p:judgement name="belongs">
<p:var range="name"/>
<p:var range="nameClass"/>
</p:judgement>
<p:judgement name="match">
<p:var range="context"/>
<p:function name="attribute">
<p:var range="name"/>
<p:var range="string"/>
</p:function>
<p:function name="emptySequence"/>
<p:element name="attribute">
<p:var range="nameClass"/>
<p:var range="pattern"/>
</p:element>
</p:judgement>
</p:rule>
</p:proofSystem>
<para>The semantics of the <literal>element</literal> pattern are as follows:</para>
<p:proofSystem>
<p:rule name="element">
<p:judgement name="weakMatch">
<p:var range="context" sub="1"/>
<p:var range="att"/>
<p:var range="mixed"/>
<p:var range="pattern"/>
</p:judgement>
<p:judgement name="belongs">
<p:var range="name"/>
<p:var range="nameClass"/>
</p:judgement>
<p:judgement name="okAsChildren">
<p:var range="mixed"/>
</p:judgement>
<p:judgement name="bind">
<p:var range="ncname"/>
<p:var range="nameClass"/>
<p:var range="pattern"/>
</p:judgement>
<p:judgement name="match">
<p:var range="context" sub="2"/>
<p:function name="emptySet"/>
<p:function name="append">
<p:var range="whiteSpace" sub="1"/>
<p:function name="element">
<p:var range="name"/>
<p:var range="context" sub="1"/>
<p:var range="att"/>
<p:var range="mixed"/>
</p:function>
<p:var range="whiteSpace" sub="2"/>
</p:function>
<p:element name="ref">
<p:attribute name="name">
<p:var range="ncname"/>
</p:attribute>
</p:element>
</p:judgement>
</p:rule>
</p:proofSystem>
</section>
<section id="data-pattern">
<title><literal>data</literal> and <literal>value</literal> pattern</title>
<para>RELAX NG relies on datatype libraries to perform datatyping.
A datatype library is identified by a URI. A datatype within a
datatype library is identified by an NCName. A datatype library
provides two services.</para>
<itemizedlist>
<listitem><para>It can determine whether a string is a legal
representation of a datatype. This service accepts a list of zero or
more parameters. For example, a string datatype might have a parameter
specifying the length of a string. The datatype library determines
what parameters are applicable for each datatype.</para></listitem>
<listitem><para>It can determine whether two strings represent the
same value of a datatype. This service does not have any
parameters.</para></listitem>
</itemizedlist>
<para>Both services may make use of the context of a string. For
example, a datatype representing a QName would use the namespace
map.</para>
<para>We use the following additional notation:</para>
<variablelist>
<varlistentry><term><p:judgement name="datatypeAllows">
<p:var range="uri"/>
<p:var range="ncname"/>
<p:var range="params"/>
<p:var range="string"/>
<p:var range="context"/>
</p:judgement></term><listitem><para>
asserts that in the datatype library identified by URI <p:var range="uri"/>, the string <p:var range="string"/> interpreted with
context <p:var range="context"/> is a legal
value of datatype <p:var range="ncname"/> with parameters <p:var range="params"/></para></listitem></varlistentry>
<varlistentry><term><p:judgement name="datatypeEqual">
<p:var range="uri"/>
<p:var range="ncname"/>
<p:var range="string" sub="1"/>
<p:var range="context" sub="1"/>
<p:var range="string" sub="2"/>
<p:var range="context" sub="2"/>
</p:judgement></term><listitem><para>
asserts that in the datatype library identified by URI <p:var range="uri"/>, string <p:var range="string" sub="1"/> interpreted with
context <p:var range="context" sub="1"/> represents the same value of
the datatype <p:var range="ncname"/> as the string <p:var range="string" sub="2"/> interpreted in the context of <p:var range="context" sub="2"/>
</para></listitem></varlistentry>
<varlistentry><term><p:var range="params"/></term><listitem><para>ranges over sequences of parameters</para></listitem></varlistentry>
<varlistentry><term><p:context>
<p:var range="context"/>
</p:context></term><listitem><para>
within the start-tag of a pattern refers to the context
of the pattern element
</para></listitem></varlistentry>
<varlistentry>
<term>
<p:function name="context">
<p:var range="uri"/>
<p:var range="context"/>
</p:function>
</term>
<listitem><para>constructs a context which is the same as <p:var range="context"/>
except that the default namespace is <p:var range="uri"/>; if <p:var
range="uri"/> is the empty string, then there is no default namespace
in the constructed context</para></listitem></varlistentry>
</variablelist>
<para>The datatypeEqual function must be reflexive, transitive
and symmetric, that is, the following inference rules must hold:</para>
<p:proofSystem>
<p:rule name="datatypeEqual reflexive">
<p:judgement name="datatypeAllows">
<p:var range="uri"/>
<p:var range="ncname"/>
<p:var range="params"/>
<p:var range="string"/>
<p:var range="context"/>
</p:judgement>
<p:judgement name="datatypeEqual">
<p:var range="uri"/>
<p:var range="ncname"/>
<p:var range="string"/>
<p:var range="context"/>
<p:var range="string"/>
<p:var range="context"/>
</p:judgement>
</p:rule>
<p:rule name="datatypeEqual transitive">
<p:judgement name="datatypeEqual">
<p:var range="uri"/>
<p:var range="ncname"/>
<p:var range="string" sub="1"/>
<p:var range="context" sub="1"/>
<p:var range="string" sub="2"/>
<p:var range="context" sub="2"/>
</p:judgement>
<p:judgement name="datatypeEqual">
<p:var range="uri"/>
<p:var range="ncname"/>
<p:var range="string" sub="2"/>
<p:var range="context" sub="3"/>
<p:var range="string" sub="3"/>
<p:var range="context" sub="3"/>
</p:judgement>
<p:judgement name="datatypeEqual">
<p:var range="uri"/>
<p:var range="ncname"/>
<p:var range="string" sub="1"/>
<p:var range="context" sub="1"/>
<p:var range="string" sub="3"/>
<p:var range="context" sub="3"/>
</p:judgement>
</p:rule>
<p:rule name="datatypeEqual symmetric">
<p:judgement name="datatypeEqual">
<p:var range="uri"/>
<p:var range="ncname"/>
<p:var range="string" sub="1"/>
<p:var range="context" sub="1"/>
<p:var range="string" sub="2"/>
<p:var range="context" sub="2"/>
</p:judgement>
<p:judgement name="datatypeEqual">
<p:var range="uri"/>
<p:var range="ncname"/>
<p:var range="string" sub="2"/>
<p:var range="context" sub="2"/>
<p:var range="string" sub="1"/>
<p:var range="context" sub="1"/>
</p:judgement>
</p:rule>
</p:proofSystem>
<para>The semantics of the <literal>data</literal> and
<literal>value</literal> patterns are as follows:</para>
<p:proofSystem>
<p:rule name="value">
<p:judgement name="datatypeEqual">
<p:var range="uri" sub="1"/>
<p:var range="ncname"/>
<p:var range="string" sub="1"/>
<p:var range="context" sub="1"/>
<p:var range="string" sub="2"/>
<p:function name="context">
<p:var range="uri" sub="2"/>
<p:var range="context" sub="2"/>
</p:function>
</p:judgement>
<p:judgement name="match">
<p:var range="context" sub="1"/>
<p:function name="emptySet"/>
<p:var range="string" sub="1"/>
<p:element name="value">
<p:attribute name="datatypeLibrary">
<p:var range="uri" sub="1"/>
</p:attribute>
<p:attribute name="type">
<p:var range="ncname"/>
</p:attribute>
<p:attribute name="ns">
<p:var range="uri" sub="2"/>
</p:attribute>
<p:context>
<p:var range="context" sub="2"/>
</p:context>
<p:var range="string" sub="2"/>
</p:element>
<p:function name="emptySet"/>
<p:function name="emptySet"/>
</p:judgement>
</p:rule>
<p:rule name="data 1">
<p:judgement name="datatypeAllows">
<p:var range="uri"/>
<p:var range="ncname"/>
<p:var range="params"/>
<p:var range="string"/>
<p:var range="context"/>
</p:judgement>
<p:judgement name="match">
<p:var range="context"/>
<p:function name="emptySet"/>
<p:var range="string"/>
<p:element name="data">
<p:attribute name="datatypeLibrary">
<p:var range="uri"/>
</p:attribute>
<p:attribute name="type">
<p:var range="ncname"/>
</p:attribute>
<p:var range="params"/>
</p:element>
<p:function name="emptySet"/>
<p:function name="emptySet"/>
</p:judgement>
</p:rule>
<p:rule name="data 2">
<p:judgement name="datatypeAllows">
<p:var range="uri"/>
<p:var range="ncname"/>
<p:var range="params"/>
<p:var range="string"/>
<p:var range="context"/>
</p:judgement>
<p:not>
<p:judgement name="match">
<p:var range="context"/>
<p:var range="att"/>
<p:var range="string"/>
<p:var range="pattern"/>
</p:judgement>
</p:not>
<p:judgement name="match">
<p:var range="context"/>
<p:function name="emptySet"/>
<p:var range="string"/>
<p:element name="data">
<p:attribute name="datatypeLibrary">
<p:var range="uri"/>
</p:attribute>
<p:attribute name="type">
<p:var range="ncname"/>
</p:attribute>
<p:var range="params"/>
<p:element name="except">
<p:var range="pattern"/>
</p:element>
</p:element>
<p:function name="emptySet"/>
<p:function name="emptySet"/>
</p:judgement>
</p:rule>
</p:proofSystem>
</section>
<section id="built-in-datatype">
<title>Built-in datatype library</title>
<para>The empty URI identifies a special built-in datatype library.
This provides two datatypes, <literal>string</literal> and
<literal>token</literal>. No parameters are allowed for either of
these datatypes.</para>
<variablelist>
<varlistentry><term>
<p:judgement name="equal">
<p:var range="string" sub="1"/>
<p:var range="string" sub="2"/>
</p:judgement></term>
<listitem><para>asserts that <p:var range="string" sub="1"/>
and <p:var range="string" sub="2"/> are identical</para></listitem>
</varlistentry>
<varlistentry><term>
<p:function name="normalizeWhiteSpace">
<p:var range="string"/>
</p:function>
</term>
<listitem><para>returns the string <p:var range="string"/>,
with leading and trailing whitespace characters removed,
and with each other maximal sequence of whitespace characters
replaced by a single space character </para></listitem>
</varlistentry>
</variablelist>
<para>The semantics of the two built-in datatypes are as
follows:</para>
<p:proofSystem>
<p:rule name="string allows">
<p:judgement name="datatypeAllows">
<p:function name="emptyString"/>
<p:string>string</p:string>
<p:function name="emptySequence"/>
<p:var range="string"/>
<p:var range="context"/>
</p:judgement>
</p:rule>
<p:rule name="string equal">
<p:judgement name="datatypeEqual">
<p:function name="emptyString"/>
<p:string>string</p:string>
<p:var range="string"/>
<p:var range="context" sub="1"/>
<p:var range="string"/>
<p:var range="context" sub="2"/>
</p:judgement>
</p:rule>
<p:rule name="token allows">
<p:judgement name="datatypeAllows">
<p:function name="emptyString"/>
<p:string>token</p:string>
<p:function name="emptySequence"/>
<p:var range="string"/>
<p:var range="context"/>
</p:judgement>
</p:rule>
<p:rule name="token equal">
<p:judgement name="equal">
<p:function name="normalizeWhiteSpace">
<p:var range="string" sub="1"/>
</p:function>
<p:function name="normalizeWhiteSpace">
<p:var range="string" sub="2"/>
</p:function>
</p:judgement>
<p:judgement name="datatypeEqual">
<p:function name="emptyString"/>
<p:string>token</p:string>
<p:var range="string" sub="1"/>
<p:var range="context" sub="1"/>
<p:var range="string" sub="2"/>
<p:var range="context" sub="2"/>
</p:judgement>
</p:rule>
</p:proofSystem>
</section>
<section>
<title><literal>list</literal> pattern</title>
<para>We use the following additional notation:</para>
<variablelist>
<varlistentry><term><p:function name="split">
<p:var range="string"/>
</p:function></term><listitem><para>
returns a sequence of strings one for each whitespace delimited token
of <p:var range="string"/>; each string in the returned sequence will
be non-empty and will not contain any
whitespace</para></listitem></varlistentry>
</variablelist>
<para>The semantics of the <literal>list</literal> pattern are as follows:</para>
<p:proofSystem>
<p:rule name="list">
<p:judgement name="match">
<p:var range="context"/>
<p:function name="emptySet"/>
<p:function name="split">
<p:var range="string"/>
</p:function>
<p:var range="pattern"/>
</p:judgement>
<p:judgement name="match">
<p:var range="context"/>
<p:function name="emptySet"/>
<p:var range="string"/>
<p:element name="list">
<p:var range="pattern"/>
</p:element>
</p:judgement>
</p:rule>
</p:proofSystem>
<note><para>It is crucial in the above inference rule that the
sequence that is matched against a pattern can contain consecutive
strings.</para></note>
</section>
</section>
<section id="validity">
<title>Validity</title>
<para>Now we can define when an element is valid with respect to a
schema. We use the following additional notation:</para>
<variablelist>
<varlistentry><term><p:var range="element"/></term><listitem><para>ranges over elements</para></listitem></varlistentry>
<varlistentry><term><p:judgement name="valid">
<p:var range="element"/>
</p:judgement></term><listitem><para>
asserts that the element <p:var range="element"/> is valid with
respect to the grammar</para></listitem></varlistentry>
<varlistentry><term><p:judgement name="start">
<p:var range="pattern"/>
</p:judgement></term><listitem><para>
asserts that the grammar contains
<p:element name="start"><p:var range="pattern"/> </p:element></para></listitem></varlistentry>
</variablelist>
<para>An element is valid if together with an empty set of attributes
it matches the <literal>start</literal> pattern of the grammar.</para>
<p:proofSystem>
<p:rule name="valid">
<p:judgement name="start">
<p:var range="pattern"/>
</p:judgement>
<p:judgement name="match">
<p:var range="context"/>
<p:function name="emptySet"/>
<p:var range="element"/>
<p:var range="pattern"/>
</p:judgement>
<p:judgement name="valid">
<p:var range="element"/>
</p:judgement>
</p:rule>
</p:proofSystem>
</section>
<section>
<title>Example</title>
<para>Let <p:var range="element" sub="0"/> be</para>
<p:formula>
<p:function name="element">
<p:function name="name">
<p:function name="emptyString"/>
<p:string>foo</p:string>
</p:function>
<p:var range="context" sub="0"/>
<p:function name="emptySet"/>
<p:var range="mixed"/>
</p:function>
</p:formula>
<para>where <p:var range="mixed"/> is</para>
<p:formula>
<p:function name="append">
<p:var range="element" sub="1"/>
<p:var range="element" sub="2"/>
</p:function>
</p:formula>
<para>and <p:var range="element" sub="1"/> is</para>
<p:formula>
<p:function name="element">
<p:function name="name">
<p:string>http://www.example.com/n1</p:string>
<p:string>bar1</p:string>
</p:function>
<p:var range="context" sub="1"/>
<p:function name="emptySet"/>
<p:function name="emptySequence"/>
</p:function>
</p:formula>
<para>and <p:var range="element" sub="2"/> is</para>
<p:formula>
<p:function name="element">
<p:function name="name">
<p:string>http://www.example.com/n2</p:string>
<p:string>bar2</p:string>
</p:function>
<p:var range="context" sub="2"/>
<p:function name="emptySet"/>
<p:function name="emptySequence"/>
</p:function>
</p:formula>
<para>Assuming appropriate definitions of <p:var range="context"
sub="0"/>, <p:var range="context" sub="1"/> and <p:var range="context"
sub="2"/>, this represents the document in <xref
linkend="data-model-example"/>.</para>
<para>We now show how <p:var range="element" sub="0"/> can be shown to
be valid with respect to the schema in <xref
linkend="simple-syntax-example"/>. The schema is equivalent to the
following propositions:</para>
<p:formula>
<p:judgement name="start">
<p:element name="ref">
<p:attribute name="name"><p:string>foo</p:string></p:attribute>
</p:element>
</p:judgement>
</p:formula>
<p:formula>
<p:judgement name="bind">
<p:string>foo.element</p:string>
<p:element name="name">
<p:attribute name="ns"><p:function name="emptyString"/></p:attribute>
<p:string>foo</p:string>
</p:element>
<p:element name="group">
<p:element name="ref">
<p:attribute name="name">
<p:string>bar1</p:string>
</p:attribute>
</p:element>
<p:element name="ref">
<p:attribute name="name">
<p:string>bar2</p:string>
</p:attribute>
</p:element>
</p:element>
</p:judgement>
</p:formula>
<p:formula>
<p:judgement name="bind">
<p:string>bar1.element</p:string>
<p:element name="name">
<p:attribute name="ns">
<p:string>http://www.example.com/n1</p:string>
</p:attribute>
<p:string>bar1</p:string>
</p:element>
<p:element name="empty"/>
</p:judgement>
</p:formula>
<p:formula>
<p:judgement name="bind">
<p:string>bar2.element</p:string>
<p:element name="name">
<p:attribute name="ns">
<p:string>http://www.example.com/n2</p:string>
</p:attribute>
<p:string>bar2</p:string>
</p:element>
<p:element name="empty"/>
</p:judgement>
</p:formula>
<para>Let name class <p:var range="nameClass" sub="1"/> be</para>
<p:formula>
<p:element name="name">
<p:attribute name="ns">
<p:string>http://www.example.com/n1</p:string>
</p:attribute>
<p:string>bar1</p:string>
</p:element>
</p:formula>
<para>and let <p:var range="nameClass" sub="2"/> be</para>
<p:formula>
<p:element name="name">
<p:attribute name="ns">
<p:string>http://www.example.com/n2</p:string>
</p:attribute>
<p:string>bar2</p:string>
</p:element>
</p:formula>
<para>Then, by the inference rule (name) in <xref
linkend="name-classes"/>, we have</para>
<p:formula>
<p:judgement name="belongs">
<p:function name="name">
<p:string>http://www.example.com/n1</p:string>
<p:string>bar1</p:string>
</p:function>
<p:var range="nameClass" sub="1"/>
</p:judgement>
</p:formula>
<para>and</para>
<p:formula>
<p:judgement name="belongs">
<p:function name="name">
<p:string>http://www.example.com/n2</p:string>
<p:string>bar2</p:string>
</p:function>
<p:var range="nameClass" sub="2"/>
</p:judgement>
</p:formula>
<para>By the inference rule (empty) in <xref linkend="empty-pattern"/>,
we have</para>
<p:formula>
<p:judgement name="match">
<p:var range="context" sub="1"/>
<p:function name="emptySet"/>
<p:function name="emptySequence"/>
<p:element name="empty"></p:element>
</p:judgement>
</p:formula>
<para>and</para>
<p:formula>
<p:judgement name="match">
<p:var range="context" sub="2"/>
<p:function name="emptySet"/>
<p:function name="emptySequence"/>
<p:element name="empty"></p:element>
</p:judgement>
</p:formula>
<para>Thus by the inference rule (element) in <xref
linkend="element-pattern"/>, we have</para>
<p:formula>
<p:judgement name="match">
<p:var range="context" sub="0"/>
<p:function name="emptySet"/>
<p:var range="element" sub="1"/>
<p:element name="ref">
<p:attribute name="name">
<p:string>bar1</p:string>
</p:attribute>
</p:element>
</p:judgement>
</p:formula>
<para>Note that we have chosen <p:var
range="context" sub="0"/>, since any context is allowed.</para>
<para>Likewise, we have</para>
<p:formula>
<p:judgement name="match">
<p:var range="context" sub="0"/>
<p:function name="emptySet"/>
<p:var range="element" sub="2"/>
<p:element name="ref">
<p:attribute name="name">
<p:string>bar2</p:string>
</p:attribute>
</p:element>
</p:judgement>
</p:formula>
<para>By the inference rule (group) in <xref
linkend="choice-pattern"/>, we have</para>
<p:formula>
<p:judgement name="match">
<p:var range="context" sub="0"/>
<p:function name="emptySet"/>
<p:function name="append">
<p:var range="element" sub="1"/>
<p:var range="element" sub="2"/>
</p:function>
<p:element name="group">
<p:element name="ref">
<p:attribute name="name">
<p:string>bar1</p:string>
</p:attribute>
</p:element>
<p:element name="ref">
<p:attribute name="name">
<p:string>bar2</p:string>
</p:attribute>
</p:element>
</p:element>
</p:judgement>
</p:formula>
<para>By the inference rule (element) in <xref
linkend="element-pattern"/>, we have</para>
<p:formula>
<p:judgement name="match">
<p:var range="context" sub="3"/>
<p:function name="emptySet"/>
<p:function name="element">
<p:function name="name">
<p:function name="emptyString"/>
<p:string>foo</p:string>
</p:function>
<p:var range="context" sub="0"/>
<p:function name="emptySet"/>
<p:var range="mixed"/>
</p:function>
<p:element name="ref">
<p:attribute name="name">
<p:string>foo</p:string>
</p:attribute>
</p:element>
</p:judgement>
</p:formula>
<para>Here <p:var range="context" sub="3"/> is an arbitrary
context.</para>
<para>Thus we can apply the inference rule (valid) in <xref
linkend="validity"/> and obtain</para>
<p:formula>
<p:judgement name="valid">
<p:var range="element" sub="0"/>
</p:judgement>
</p:formula>
</section>
</section>
<section id="restriction">
<title>Restrictions</title>
<para>The following constraints are all checked after the grammar has
been transformed to the simple form described in <xref
linkend="simple-syntax"/>. The purpose of these restrictions is to
catch user errors and to facilitate implementation.</para>
<section id="contextual-restriction">
<title>Contextual restrictions</title>
<para>In this section we describe restrictions on where elements are
allowed in the schema based on the names of the ancestor elements. We
use the concept of a <firstterm>prohibited path</firstterm> to
describe these restrictions. A path is a sequence of NCNames separated
by <literal>/</literal> or <literal>//</literal>.</para>
<itemizedlist>
<listitem><para>An element matches a path
<replaceable>x</replaceable>, where <replaceable>x</replaceable> is an
NCName, if and only if the local name of the element is
<replaceable>x</replaceable></para></listitem>
<listitem><para>An element matches a path
<replaceable>x</replaceable><literal>/</literal><replaceable>p</replaceable>,
where <replaceable>x</replaceable> is an NCName and
<replaceable>p</replaceable> is a path, if and only if the local name
of the element is <replaceable>x</replaceable> and the element has a
child that matches <replaceable>p</replaceable></para></listitem>
<listitem><para>An element matches a path
<replaceable>x</replaceable><literal>//</literal><replaceable>p</replaceable>,
where <replaceable>x</replaceable> is an NCName and
<replaceable>p</replaceable> is a path, if and only if the local name
of the element is <replaceable>x</replaceable> and the element has a
descendant that matches <replaceable>p</replaceable></para></listitem>
</itemizedlist>
<para>For example, the element</para>
<programlisting><![CDATA[<foo>
<bar>
<baz/>
</bar>
</foo>]]></programlisting>
<para>matches the paths <literal>foo</literal>,
<literal>foo/bar</literal>, <literal>foo//bar</literal>,
<literal>foo//baz</literal>, <literal>foo/bar/baz</literal>,
<literal>foo/bar//baz</literal> and <literal>foo//bar/baz</literal>,
but not <literal>foo/baz</literal> or
<literal>foobar</literal>.</para>
<para>A correct RELAX NG schema must be such that, after
transformation to the simple form, it does not contain any element
that matches a prohibited path.</para>
<section>
<title><literal>attribute</literal> pattern</title>
<para>The following paths are prohibited:</para>
<itemizedlist>
<listitem><para><literal>attribute//ref</literal></para></listitem>
<listitem><para><literal>attribute//attribute</literal></para></listitem>
</itemizedlist>
</section>
<section>
<title><literal>oneOrMore</literal> pattern</title>
<para>The following paths are prohibited:</para>
<itemizedlist>
<listitem><para><literal>oneOrMore//group//attribute</literal></para></listitem>
<listitem><para><literal>oneOrMore//interleave//attribute</literal></para></listitem>
</itemizedlist>
</section>
<section id="list-restrictions">
<title><literal>list</literal> pattern</title>
<para>The following paths are prohibited:</para>
<itemizedlist>
<listitem><para><literal>list//list</literal></para></listitem>
<listitem><para><literal>list//ref</literal></para></listitem>
<listitem><para><literal>list//attribute</literal></para></listitem>
<listitem><para><literal>list//text</literal></para></listitem>
<listitem><para><literal>list//interleave</literal></para></listitem>
</itemizedlist>
</section>
<section id="context-data-except">
<title><literal>except</literal> in <literal>data</literal> pattern</title>
<para>The following paths are prohibited:</para>
<itemizedlist>
<listitem><para><literal>data/except//attribute</literal></para></listitem>
<listitem><para><literal>data/except//ref</literal></para></listitem>
<listitem><para><literal>data/except//text</literal></para></listitem>
<listitem><para><literal>data/except//list</literal></para></listitem>
<listitem><para><literal>data/except//group</literal></para></listitem>
<listitem><para><literal>data/except//interleave</literal></para></listitem>
<listitem><para><literal>data/except//oneOrMore</literal></para></listitem>
<listitem><para><literal>data/except//empty</literal></para></listitem>
</itemizedlist>
<note><para>This implies that an <literal>except</literal> element
with a <literal>data</literal> parent can contain only
<literal>data</literal>, <literal>value</literal> and
<literal>choice</literal> elements.</para></note>
</section>
<section id="context-start">
<title><literal>start</literal> element</title>
<para>The following paths are prohibited:</para>
<itemizedlist>
<listitem><para><literal>start//attribute</literal></para></listitem>
<listitem><para><literal>start//data</literal></para></listitem>
<listitem><para><literal>start//value</literal></para></listitem>
<listitem><para><literal>start//text</literal></para></listitem>
<listitem><para><literal>start//list</literal></para></listitem>
<listitem><para><literal>start//group</literal></para></listitem>
<listitem><para><literal>start//interleave</literal></para></listitem>
<listitem><para><literal>start//oneOrMore</literal></para></listitem>
<listitem><para><literal>start//empty</literal></para></listitem>
</itemizedlist>
</section>
</section>
<section id="string-sequences">
<title>String sequences</title>
<para>RELAX NG does not allow a pattern such as:</para>
<programlisting><![CDATA[<element name="foo">
<group>
<data type="int"/>
<element name="bar">
<empty/>
</element>
</group>
</element>]]></programlisting>
<para>Nor does it allow a pattern such as:</para>
<programlisting><![CDATA[<element name="foo">
<group>
<data type="int"/>
<text/>
</group>
</element>]]></programlisting>
<para>More generally, if the pattern for the content of an element or
attribute contains</para>
<itemizedlist>
<listitem><para>a pattern that can match a child
(that is, an <literal>element</literal>, <literal>data</literal>,
<literal>value</literal>, <literal>list</literal> or
<literal>text</literal> pattern), and</para></listitem>
<listitem><para>a pattern that matches a single string (that is, a
<literal>data</literal>, <literal>value</literal> or
<literal>list</literal> pattern),</para></listitem>
</itemizedlist>
<para>then the two patterns must be alternatives to each other.</para>
<para>This rule does not apply to patterns occurring within a
<literal>list</literal> pattern.</para>
<para>To formalize this, we use the concept of a content-type. A
pattern that is allowable as the content of an element has one of
three content-types: empty, complex and simple. We use the following
notation.</para>
<variablelist>
<varlistentry>
<term><p:function name="empty"/></term>
<listitem><para>returns the empty content-type</para></listitem>
</varlistentry>
<varlistentry>
<term><p:function name="complex"/></term>
<listitem><para>returns the complex content-type</para></listitem>
</varlistentry>
<varlistentry>
<term><p:function name="simple"/></term>
<listitem><para>returns the simple content-type</para></listitem>
</varlistentry>
<varlistentry><term><p:var range="contentType"/></term>
<listitem><para>ranges over content-types</para></listitem>
</varlistentry>
<varlistentry><term>
<p:judgement name="groupable">
<p:var range="contentType" sub="1"/>
<p:var range="contentType" sub="2"/>
</p:judgement>
</term>
<listitem><para>asserts that the content-types <p:var
range="contentType" sub="1"/> and <p:var range="contentType" sub="2"/>
are groupable</para></listitem>
</varlistentry>
</variablelist>
<para>The empty content-type is groupable with anything. In addition,
the complex content-type is groupable with the complex content-type. The
following rules formalize this.</para>
<p:proofSystem>
<p:rule name="group empty 1">
<p:judgement name="groupable">
<p:function name="empty"/>
<p:var range="contentType"/>
</p:judgement>
</p:rule>
<p:rule name="group empty 2">
<p:judgement name="groupable">
<p:var range="contentType"/>
<p:function name="empty"/>
</p:judgement>
</p:rule>
<p:rule name="group complex">
<p:judgement name="groupable">
<p:function name="complex"/>
<p:function name="complex"/>
</p:judgement>
</p:rule>
</p:proofSystem>
<para>Some patterns have a content-type. We use the following
additional notation.</para>
<variablelist>
<varlistentry><term>
<p:judgement name="contentType">
<p:var range="pattern"/>
<p:var range="contentType"/>
</p:judgement>
</term>
<listitem><para>asserts that pattern <p:var range="pattern"/> has
content-type <p:var range="contentType"/></para></listitem>
</varlistentry>
<varlistentry><term>
<p:function name="max">
<p:var range="contentType" sub="1"/>
<p:var range="contentType" sub="2"/>
</p:function>
</term>
<listitem><para>returns the maximum of <p:var range="contentType"
sub="1"/> and <p:var range="contentType" sub="2"/> where the
content-types in increasing order are <p:function name="empty"/>,
<p:function name="complex"/>, <p:function
name="simple"/></para></listitem>
</varlistentry>
</variablelist>
<para>The following rules define when a pattern has a content-type and,
if so, what it is.</para>
<p:proofSystem>
<p:rule name="value">
<p:judgement name="contentType">
<p:element name="value">
<p:attribute name="datatypeLibrary">
<p:var range="uri" sub="1"/>
</p:attribute>
<p:attribute name="type">
<p:var range="ncname"/>
</p:attribute>
<p:attribute name="ns">
<p:var range="uri" sub="2"/>
</p:attribute>
<p:var range="string"/>
</p:element>
<p:function name="simple"/>
</p:judgement>
</p:rule>
<p:rule name="data 1">
<p:judgement name="contentType">
<p:element name="data">
<p:attribute name="datatypeLibrary">
<p:var range="uri"/>
</p:attribute>
<p:attribute name="type">
<p:var range="ncname"/>
</p:attribute>
<p:var range="params"/>
</p:element>
<p:function name="simple"/>
</p:judgement>
</p:rule>
<p:rule name="data 2">
<p:judgement name="contentType">
<p:var range="pattern"/>
<p:var range="contentType"/>
</p:judgement>
<p:judgement name="contentType">
<p:element name="data">
<p:attribute name="datatypeLibrary">
<p:var range="uri"/>
</p:attribute>
<p:attribute name="type">
<p:var range="ncname"/>
</p:attribute>
<p:var range="params"/>
<p:element name="except">
<p:var range="pattern"/>
</p:element>
</p:element>
<p:function name="simple"/>
</p:judgement>
</p:rule>
<p:rule name="list">
<p:judgement name="contentType">
<p:element name="list">
<p:var range="pattern"/>
</p:element>
<p:function name="simple"/>
</p:judgement>
</p:rule>
<p:rule name="text">
<p:judgement name="contentType">
<p:element name="text"/>
<p:function name="complex"/>
</p:judgement>
</p:rule>
<p:rule name="ref">
<p:judgement name="contentType">
<p:element name="ref">
<p:attribute name="name">
<p:var range="ncname"/>
</p:attribute>
</p:element>
<p:function name="complex"/>
</p:judgement>
</p:rule>
<p:rule name="empty">
<p:judgement name="contentType">
<p:element name="empty"/>
<p:function name="empty"/>
</p:judgement>
</p:rule>
<p:rule name="attribute">
<p:judgement name="contentType">
<p:var range="pattern"/>
<p:var range="contentType"/>
</p:judgement>
<p:judgement name="contentType">
<p:element name="attribute">
<p:var range="nameClass"/>
<p:var range="pattern"/>
</p:element>
<p:function name="empty"/>
</p:judgement>
</p:rule>
<p:rule name="group">
<p:judgement name="contentType">
<p:var range="pattern" sub="1"/>
<p:var range="contentType" sub="1"/>
</p:judgement>
<p:judgement name="contentType">
<p:var range="pattern" sub="2"/>
<p:var range="contentType" sub="2"/>
</p:judgement>
<p:judgement name="groupable">
<p:var range="contentType" sub="1"/>
<p:var range="contentType" sub="2"/>
</p:judgement>
<p:judgement name="contentType">
<p:element name="group">
<p:var range="pattern" sub="1"/>
<p:var range="pattern" sub="2"/>
</p:element>
<p:function name="max">
<p:var range="contentType" sub="1"/>
<p:var range="contentType" sub="2"/>
</p:function>
</p:judgement>
</p:rule>
<p:rule name="interleave">
<p:judgement name="contentType">
<p:var range="pattern" sub="1"/>
<p:var range="contentType" sub="1"/>
</p:judgement>
<p:judgement name="contentType">
<p:var range="pattern" sub="2"/>
<p:var range="contentType" sub="2"/>
</p:judgement>
<p:judgement name="groupable">
<p:var range="contentType" sub="1"/>
<p:var range="contentType" sub="2"/>
</p:judgement>
<p:judgement name="contentType">
<p:element name="interleave">
<p:var range="pattern" sub="1"/>
<p:var range="pattern" sub="2"/>
</p:element>
<p:function name="max">
<p:var range="contentType" sub="1"/>
<p:var range="contentType" sub="2"/>
</p:function>
</p:judgement>
</p:rule>
<p:rule name="oneOrMore">
<p:judgement name="contentType">
<p:var range="pattern"/>
<p:var range="contentType"/>
</p:judgement>
<p:judgement name="groupable">
<p:var range="contentType"/>
<p:var range="contentType"/>
</p:judgement>
<p:judgement name="contentType">
<p:element name="oneOrMore">
<p:var range="pattern"/>
</p:element>
<p:var range="contentType"/>
</p:judgement>
</p:rule>
<p:rule name="choice">
<p:judgement name="contentType">
<p:var range="pattern" sub="1"/>
<p:var range="contentType" sub="1"/>
</p:judgement>
<p:judgement name="contentType">
<p:var range="pattern" sub="2"/>
<p:var range="contentType" sub="2"/>
</p:judgement>
<p:judgement name="contentType">
<p:element name="choice">
<p:var range="pattern" sub="1"/>
<p:var range="pattern" sub="2"/>
</p:element>
<p:function name="max">
<p:var range="contentType" sub="1"/>
<p:var range="contentType" sub="2"/>
</p:function>
</p:judgement>
</p:rule>
</p:proofSystem>
<note><para>The antecedent in the (data 2) rule above is in fact
redundant because of the prohibited paths in <xref
linkend="context-data-except"/>.</para></note>
<para>Now we can describe the restriction. We use the following
notation.</para>
<variablelist>
<varlistentry><term>
<p:judgement name="incorrectSchema"/>
</term>
<listitem><para>asserts that the schema is incorrect</para></listitem>
</varlistentry>
</variablelist>
<para>All patterns occurring as the content of an element pattern must
have a content-type.</para>
<p:proofSystem>
<p:rule name="element">
<p:judgement name="bind">
<p:var range="ncname"/>
<p:var range="nameClass"/>
<p:var range="pattern"/>
</p:judgement>
<p:not>
<p:judgement name="contentType">
<p:var range="pattern"/>
<p:var range="contentType"/>
</p:judgement>
</p:not>
<p:judgement name="incorrectSchema"/>
</p:rule>
</p:proofSystem>
</section>
<section id="attribute-restrictions">
<title>Restrictions on attributes</title>
<para>Duplicate attributes are not allowed. More precisely, for a
pattern <literal><group> <replaceable>p1</replaceable>
<replaceable>p2</replaceable> </group></literal> or
<literal><interleave> <replaceable>p1</replaceable>
<replaceable>p2</replaceable> </interleave></literal>, there must
not be a name that belongs to both the name class of an
<literal>attribute</literal> pattern occurring in
<replaceable>p1</replaceable> and the name class of an
<literal>attribute</literal> pattern occurring in
<replaceable>p2</replaceable>. A pattern <replaceable>p1</replaceable>
is defined to <firstterm>occur in</firstterm> a pattern
<replaceable>p2</replaceable> if</para>
<itemizedlist>
<listitem><para><replaceable>p1</replaceable> is
<replaceable>p2</replaceable>, or</para></listitem>
<listitem><para><replaceable>p2</replaceable> is a
<literal>choice</literal>, <literal>interleave</literal>,
<literal>group</literal> or <literal>oneOrMore</literal> element and
<replaceable>p1</replaceable> occurs in one or more children of
<replaceable>p2</replaceable>.</para></listitem>
</itemizedlist>
<para>Attributes using infinite name classes must be repeated. More
precisely, an <literal>attribute</literal> element that has an
<literal>anyName</literal> or <literal>nsName</literal> descendant
element must have a <literal>oneOrMore</literal> ancestor
element.</para>
<note><para>This restriction is necessary for closure under
negation.</para></note>
</section>
<section id="interleave-restrictions">
<title>Restrictions on <literal>interleave</literal></title>
<para>For a pattern <literal><interleave>
<replaceable>p1</replaceable> <replaceable>p2</replaceable>
</interleave></literal>,</para>
<itemizedlist>
<listitem><para>there must not be a name that belongs to both the name
class of an <literal>element</literal> pattern referenced by a
<literal>ref</literal> pattern occurring in
<replaceable>p1</replaceable> and the name class of an
<literal>element</literal> pattern referenced by a
<literal>ref</literal> pattern occurring in
<replaceable>p2</replaceable>, and</para></listitem>
<listitem><para>a <literal>text</literal> pattern must not occur in
both <replaceable>p1</replaceable> and
<replaceable>p2</replaceable>.</para></listitem>
</itemizedlist>
<para><xref linkend="attribute-restrictions"/> defines when one
pattern is considered to occur in another pattern.</para>
</section>
</section>
<section id="conformance">
<title>Conformance</title>
<para>A conforming RELAX NG validator must be able to determine for
any XML document whether it is a correct RELAX NG schema. A
conforming RELAX NG validator must be able to determine for any XML
document and for any correct RELAX NG schema whether the document is
valid with respect to the schema.</para>
<para>However, the requirements in the preceding paragraph do not
apply if the schema uses a datatype library that the validator does
not support. A conforming RELAX NG validator is only required to
support the built-in datatype library described in <xref
linkend="built-in-datatype"/>. A validator that claims conformance to
RELAX NG should document which datatype libraries it supports. The
requirements in the preceding paragraph also do not apply if the
schema includes <literal>externalRef</literal> or
<literal>include</literal> elements and the validator is unable to
retrieve the resource identified by the URI or is unable to construct
an element from the retrieved resource. A validator that claims
conformance to RELAX NG should document its capabilities for handling
URI references.</para>
</section>
<appendix>
<title>RELAX NG schema for RELAX NG</title>
<rngref src="relaxng.rng"/>
</appendix>
<appendix>
<title>Changes since version 0.9</title>
<para>The changes in this version relative to version 0.9
are as follows:</para>
<itemizedlist>
<listitem><para>in the namespace URI, <literal>0.9</literal> has been
changed to <literal>1.0</literal></para></listitem>
<listitem><para><literal>data/except//empty</literal> has been added
as a prohibited path (see <xref
linkend="context-data-except"/>)</para></listitem>
<listitem><para><literal>start//empty</literal> has been added
as a prohibited path (see <xref
linkend="context-start"/>)</para></listitem>
<listitem><para><xref linkend="number-child-elements"/> now specifies how a
<literal>list</literal> element with more than one child element is
transformed</para></listitem>
<listitem><para><xref linkend="notAllowed"/> now specifies how a
<literal>notAllowed</literal> element occurring in an
<literal>except</literal> element is transformed</para></listitem>
<listitem><para>although a relative URI is not allowed as the value of
the <literal>ns</literal> and <literal>datatypeLibrary</literal>
attributes, an empty string is allowed (see <xref
linkend="full-syntax"/>)</para></listitem>
<listitem><para>the removal of unreachable definitions in <xref
linkend="define-ref"/> is now correctly specified</para></listitem>
<listitem><para><xref linkend="notAllowed"/> now specifies that
<literal>define</literal> elements that are no longer reachable are
removed</para></listitem>
<listitem><para><xref linkend="constraints"/> has been added; the
restrictions on the contents of <literal>except</literal> in name
classes that are now specified in the newly added section were
previously specified in a subsection of <xref
linkend="contextual-restriction"/>, which has been
removed</para></listitem>
<listitem><para>the treatment of element and attribute values that
consist only of whitespace has been refined (see <xref
linkend="element-pattern"/> and <xref
linkend="data-pattern"/>)</para></listitem>
<listitem><para>attributes with infinite name classes are now required
to be repeated (see <xref
linkend="attribute-restrictions"/>)</para></listitem>
<listitem><para>restrictions have been imposed on
<literal>interleave</literal> (see <xref
linkend="interleave-restrictions"/>); <literal>list//interleave</literal>
has been added as a prohibited path (see <xref
linkend="list-restrictions"/>)</para></listitem>
<listitem><para>some of the prohibited paths in <xref
linkend="contextual-restriction"/> have been corrected to use
<literal>ref</literal> rather than
<literal>element</literal></para></listitem>
<listitem><para>an error in the inference rule (text 1) in <xref
linkend="text-pattern"/> has been corrected</para></listitem>
<listitem><para>the value of the <literal>ns</literal> attribute is
now unconstrained (see <xref
linkend="full-syntax"/>)</para></listitem>
</itemizedlist>
</appendix>
<appendix>
<title>RELAX NG TC (Non-Normative)</title>
<para>This specification was prepared and approved for publication by
the RELAX NG TC. The current members of the TC are:</para>
<itemizedlist>
<listitem><para>Fabio Arciniegas</para></listitem>
<listitem><para>James Clark</para></listitem>
<listitem><para>Mike Fitzgerald</para></listitem>
<listitem><para>KAWAGUCHI Kohsuke</para></listitem>
<listitem><para>Josh Lubell</para></listitem>
<listitem><para>MURATA Makoto</para></listitem>
<listitem><para>Norman Walsh</para></listitem>
<listitem><para>David Webber</para></listitem>
</itemizedlist>
</appendix>
<bibliography><title>References</title>
<bibliodiv><title>Normative</title>
<bibliomixed id="xml-rec"><abbrev>XML 1.0</abbrev>Tim Bray,
Jean Paoli, and
C. M. Sperberg-McQueen, Eve Maler, editors.
<citetitle><ulink url="http://www.w3.org/TR/REC-xml">Extensible Markup
Language (XML) 1.0 Second Edition</ulink></citetitle>.
W3C (World Wide Web Consortium), 2000.</bibliomixed>
<bibliomixed id="xml-names"><abbrev>XML Namespaces</abbrev>Tim Bray,
Dave Hollander,
and Andrew Layman, editors.
<citetitle><ulink url="http://www.w3.org/TR/REC-xml-names/">Namespaces in
XML</ulink></citetitle>.
W3C (World Wide Web Consortium), 1999.</bibliomixed>
<bibliomixed id="xlink"><abbrev>XLink</abbrev>Steve DeRose, Eve Maler
and David Orchard, editors.
<citetitle><ulink url="http://www.w3.org/TR/xlink/">XML Linking
Language (XLink) Version 1.0</ulink></citetitle>.
W3C (World Wide Web Consortium), 2001.</bibliomixed>
<bibliomixed id="infoset"><abbrev>XML Infoset</abbrev>John Cowan, Richard Tobin,
editors.
<citetitle><ulink url="http://www.w3.org/TR/xml-infoset/">XML
Information Set</ulink></citetitle>.
W3C (World Wide Web Consortium), 2001.</bibliomixed>
<bibliomixed id="rfc2396"><abbrev>RFC 2396</abbrev>T. Berners-Lee, R. Fielding, L. Masinter.
<citetitle><ulink url="http://www.ietf.org/rfc/rfc2396.txt" >RFC 2396:
Uniform Resource Identifiers (URI): Generic
Syntax</ulink></citetitle>.
IETF (Internet Engineering Task Force). 1998.</bibliomixed>
<bibliomixed id="rfc2732"><abbrev>RFC 2732</abbrev>R. Hinden, B. Carpenter, L. Masinter.
<citetitle><ulink url="http://www.ietf.org/rfc/rfc2732.txt">RFC 2732: Format for Literal IPv6 Addresses in URL's</ulink></citetitle>.
IETF (Internet Engineering Task Force), 1999.</bibliomixed>
<bibliomixed id="rfc3023"><abbrev>RFC 3023</abbrev> M. Murata,
S. St.Laurent, D. Kohn. <citetitle><ulink
url="http://www.ietf.org/rfc/rfc3023.txt">RFC 3023: XML Media
Types</ulink></citetitle>. IETF (Internet Engineering Task Force),
2001.</bibliomixed>
</bibliodiv>
<bibliodiv><title>Non-Normative</title>
<bibliomixed id="xmlschema-2"><abbrev>W3C XML Schema Datatypes</abbrev>Paul V. Biron, Ashok Malhotra, editors.
<citetitle><ulink url="http://www.w3.org/TR/xmlschema-2/">XML Schema Part 2: Datatypes</ulink></citetitle>.
W3C (World Wide Web Consortium), 2001.</bibliomixed>
<bibliomixed id="trex"><abbrev>TREX</abbrev>James Clark.
<citetitle><ulink url="http://www.thaiopensource.com/trex/">TREX - Tree Regular Expressions for XML</ulink></citetitle>.
Thai Open Source Software Center, 2001.</bibliomixed>
<bibliomixed id="relax"><abbrev>RELAX</abbrev>MURATA Makoto.
<citetitle><ulink url="http://www.xml.gr.jp/relax/">RELAX (Regular
Language description for XML)</ulink></citetitle>. INSTAC
(Information Technology Research and Standardization Center), 2001.</bibliomixed>
<bibliomixed id="xsfd"><abbrev>XML Schema Formal</abbrev>Allen Brown,
Matthew Fuchs, Jonathan Robie, Philip Wadler, editors.
<citetitle><ulink url="http://www.w3.org/TR/xmlschema-formal/">XML Schema: Formal Description</ulink></citetitle>.
W3C (World Wide Web Consortium), 2001.</bibliomixed>
<bibliomixed id="tutorial"><abbrev>Tutorial</abbrev>James Clark,
Makoto MURATA, editors. <citetitle><ulink
url="http://www.oasis-open.org/committees/relax-ng/tutorial.html">RELAX
NG Tutorial</ulink></citetitle>. OASIS, 2001.</bibliomixed>
</bibliodiv>
</bibliography>
</article>