index.html
72.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="EN" lang="EN">
<head>
<meta name="generator" content="HTML Tidy for Linux/x86 (vers 1st July 2003), see www.w3.org" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>XPath Requirements Version 2.0</title>
<style type="text/css">
/*<![CDATA[*/
.req-must { font-weight: bold; color: red; text-decoration: underline; }
.req-should { font-weight: bold; color: blue; text-decoration: underline; }
span.title { font-weight: bold; text-decoration: underline; }
.satisfied { font-weight: bold; color: green; }
.notsatisfied { font-weight: bold; color: #FF00FF; }
td.item { padding-top: 10px; margin-top: 10px; }
/*]]>*/
</style>
<link rel="stylesheet" type="text/css" href=
"http://www.w3.org/StyleSheets/TR/W3C-WD.css" />
</head>
<body bgcolor="#ffffff">
<div class="head">
<a href="http://www.w3.org/"><img src=
"http://www.w3.org/Icons/w3c_home" alt="W3C" height="48" width="72" /></a>
<h1><a name="title" id="title"></a>XPath Requirements
Version 2.0</h1>
<h2>W3C Working Draft 3 June 2005</h2>
<dl>
<dt>This version:</dt>
<dd><a href="http://www.w3.org/TR/2005/WD-xpath20req-20050603/">http://www.w3.org/TR/2005/WD-xpath20req-20050603/</a></dd>
<dt>Latest version:</dt>
<dd><a href="http://www.w3.org/TR/xpath20req/">http://www.w3.org/TR/xpath20req/</a></dd>
<dt>Previous versions:</dt>
<dd><a href="http://www.w3.org/TR/2003/WD-xpath20req-20030822">http://www.w3.org/TR/2003/WD-xpath20req-20030822</a></dd>
<dd><a href="http://www.w3.org/TR/2001/WD-xpath20req-20010214">http://www.w3.org/TR/2001/WD-xpath20req-20010214</a></dd>
<dt>Editors:</dt>
<dd>Mary Fernandez (AT&T) <a href="mailto:mff@research.att.com">mff@research.att.com</a></dd>
<dd>K Karun (Oracle) <a href="mailto:K.Karun@oracle.com">K.Karun@oracle.com</a></dd>
<dd>Mark Scardina (Oracle) <a href="mailto:Mark.Scardina@oracle.com">Mark.Scardina@oracle.com</a></dd>
</dl>
<p class="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2005 <a href="http://www.w3.org/"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup>
(<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>,
<a href="http://www.ercim.org/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>,
<a href="http://www.keio.ac.jp/">Keio</a>), All Rights
Reserved. W3C <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>, and
<a href="http://www.w3.org/Consortium/Legal/copyright-documents">document
use</a> rules apply.</p>
<hr title="Separator for header" />
</div>
<h2><a name="abstract" id="abstract">Abstract</a></h2>
<p>This document describes the requirements for the XPath 2.0
specification and is annotated with their resolution in <a href="#XPath2">[XPath 2.0]</a> or <a href="#XPathFO">[XQuery 1.0 and
XPath 2.0 Functions and Operators]</a> and the <a href="#XQDM">[XQuery 1.0 and XPath 2.0 Data Model]</a>
specifications.</p>
<h2><a name="status" id="status">Status of this document</a></h2>
<p><em>This section describes the status of this document at the
time of its publication. Other documents may supersede this
document. A list of current W3C publications and the latest
revision of this technical report can be found in the <a href="http://www.w3.org/TR/">W3C technical reports index</a> at
http://www.w3.org/TR/.</em></p>
<p>This document includes, for each
requirement, a corresponding status, indicating the current situation
of the requirement in the XPath 2.0 family of specifications at the
time that they are being issued as Last Call Working Drafts in April, 2005.</p>
<p>This is a W3C Working Draft for review by W3C Members and
other interested parties. Publication as a Working Draft does not
imply endorsement by the W3C Membership. This is a draft document
and may be updated, replaced or obsoleted by other documents at
any time. It is inappropriate to cite this document as other than
work in progress.</p>
<p>This document has been defined jointly by the <a href="http://www.w3.org/Style/XSL/">XSL Working Group</a> and the
<a href="http://www.w3.org/XML/Query">XML Query Working Group</a>
(both part of the <a href="http://www.w3.org/XML/Activity.html">XML Activity</a>).</p>
<p>Comments on this document should be sent to the W3C mailing
list <a href="mailto:public-qt-comments@w3.org">public-qt-comments@w3.org</a>
(archived at <a href="http://lists.w3.org/Archives/Public/public-qt-comments/">http://lists.w3.org/Archives/Public/public-qt-comments/</a>).</p>
<p>As of this publication, the Working Group expects to eventually
publish this document as a Working Group Note. It is not expected to
become a W3C Recommendation, and therefore it has no associated <a
href="http://www.w3.org/Consortium/Patent-Policy-20040205">W3C
Patent Policy licensing</a> obligations.</p>
<p>A list of current W3C Recommendations and other technical
documents can be found at <a href="http://www.w3.org/TR/">http://www.w3.org/TR/</a>.</p>
<h2><a name="contents" id="contents">Table of contents</a></h2>1
<a href="http://www.w3.org/TR/xpath20req#section-Goals">Goals</a><br />
2 <a href="http://www.w3.org/TR/xpath20req#section-Requirements">Requirements</a><br />
3 <a href="http://www.w3.org/TR/xpath20req#section-References">References</a><br />
<h3><a name="appendices" id="appendices"></a>Appendices</h3>
<hr />
<h2><a name="section-Goals" id="section-Goals"></a>1 Goals</h2>
<p>XPath 2.0 has the following goals:</p>
<ul>
<li>Simplify manipulation of XML Schema-typed content</li>
<li>Simplify manipulation of string content</li>
<li>Support related XML standards</li>
<li>Improve ease of use</li>
<li>Improve interoperability</li>
<li>Improve i18n support</li>
<li>Maintain backward compatibility</li>
<li>Enable improved processor efficiency</li>
</ul>
<h2><a name="section-Requirements" id="section-Requirements"></a>2 Requirements</h2>
<table summary="Presentation" border="0" cellspacing="0" width="100%">
<tbody>
<tr class="r1">
<td class="item" align="right" valign="top"><b>1</b></td>
<td colspan="3" class="item">
<span class="req-must">Must Support the XML "Family"
of Standards</span><br />
<p>As part of the evolving family of XML standards, XPath
2.0 MUST support the W3C XML architecture by integrating
well with other standards in the family.</p>
</td>
</tr>
<tr class="r0">
<td class="item" valign="top"> </td>
<td class="item" align="right" valign="top"><b>1.1</b></td>
<td colspan="2" class="item">
<span class="req-must">Must Express Data model in
Terms of the Infoset</span><br />
<p>XPath 2.0 data model MUST be expressed in terms of the
<a href="#Infoset">XML Infoset</a>, including Post Schema
Validation Infoset contributions. Ideally, XSLT, XPath,
and XML Query should share a common data model.</p>
<p class="satisfied">Satisfied by the <a href="http://www.w3.org/TR/xpath-datamodel/#intro">Introduction</a>
section in <a href="#XQDM">[XQuery 1.0 and XPath 2.0 Data
Model]</a>.</p>
</td>
</tr>
<tr class="r1">
<td class="item" valign="top">
</td>
<td class="item" align="right" valign="top"><b>1.2</b></td>
<td colspan="2" class="item">
<span class="req-must">Must Provide Common Core
Syntax and Semantics for XSLT 2.0 and XML Query
1.0</span><br />
<p>XSLT 2.0 contains an expression language which is
"XPath 2.0 plus XSLT 2.0 extensions". XML Query 1.0
contains an expression language which we believe should
be "XPath 2.0 plus XML Query 1.0 extensions." The scope
of XPath 2.0 must be the set of common functionality
between the expression language of XSLT 2.0 and the
expression language of XML Query 1.0. This will guarantee
for Web developers and users that any common
functionality are implemented with identical syntax and
semantics.</p>
<p class="satisfied">Satisfied by <a href="http://www.w3.org/TR/xpath20/#id-introduction">Introduction</a>
in <a href="#XPath2">[XPath 2.0]</a>.</p>
</td>
</tr>
<tr class="r0">
<td class="item" valign="top">
</td>
<td class="item" align="right" valign="top"><b>1.3</b></td>
<td colspan="2" class="item">
<span class="req-must">Must Support Explicit "For
Any" or "For All" Comparison and Equality
Semantics</span><br />
<p>It MUST be possible for boolean expressions involving
node-sets to explicitly use "for any" or "for all"
semantics, otherwise known as explicit existential
quantification and explicit universal quantification,
respectively. Any <i>implicit</i> quantification should
be explained in terms of these explicit semantics.</p>
<p class="satisfied">Satisfied by section <a href="http://www.w3.org/TR/xpath20/#id-quantified-expressions">Quantified Expressions</a> in <a href="#XPath2">[XPath 2.0]</a>.</p>
<table summary="Presentation" border="0">
<tbody>
<tr>
<td><span class="title"><b>Use Case</b></span></td>
</tr>
<tr>
<td>
<p>The following examples illustrate limitations
of XPath 1.0 that can be addressed by the
addition of existential and universal quantifiers
to XPath 2.0:</p>
<ol>
<li>In XPath 1.0, the expression <code>5 >
$ns</code> evaluates to true if <code>5</code>
is greater than the <code>number()</code> value
of at least one node in the <code>$ns</code>
node set. There is no way to test whether
<code>5</code> is greater than the
<code>number()</code> values of all nodes in
<code>$ns</code>.</li>
<li>In XPath 1.0, the expression <code>$ns1
> $ns2</code> evaluates to true if the
<code>number()</code> value of at least one
node in <code>$ns1</code> is greater than the
<code>number()</code> value of at least one
node in the <code>$ns2</code> node set. There
is no way to test whether the
<code>number()</code> values of all of the
nodes in <code>$ns1</code> are greater than all
the <code>number()</code> values of all nodes
in <code>$ns2</code>.</li>
<li>In XPath 1.0, the expression <code>5 =
$ns</code> evaluates to true if <code>5</code>
equals the <code>number()</code> value of at
least one node in the <code>$ns</code> node
set. There is no way to test whether
<code>5</code> equals the <code>number()</code>
value of all nodes in <code>$ns</code>.</li>
<li>In XPath 1.0, the expression <code>$ns1 =
$ns2</code> evaluates to true if the
<code>number()</code> value of at least one
node in <code>$ns1</code> equals the
<code>number()</code> value of at least one
node in the <code>$ns2</code> node set. There
is no way to test whether the
<code>number()</code> values of all of the
nodes in <code>$ns1</code> are greater than all
the <code>number()</code> values of all nodes
in <code>$ns2</code>.</li>
<li>In XPath 1.0, the expression <code>0 +
LineItem/@UnitPrice > 40</code> is
equivalent to <code>0 +
number(OrderDetail/@UnitPrice) > 40</code>
which will be true if the <i>first</i>
<code>LineItem</code> element's
<code>UnitPrice</code> attribute is greater
than 40. However, the expression
<code>LineItem/@UnitPrice > 40</code> is
true if <i>any</i> of the <code>LineItem</code>
elements' <code>UnitPrice</code> attributes is
greater than 40. This difference in behavior
could be resolved through explicit
quantification.</li>
</ol>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr class="r1">
<td class="item" valign="top">
</td>
<td class="item" align="right" valign="top"><b>1.4</b></td>
<td colspan="2" class="item">
<span class="req-must">Must Extend Set of
Aggregation Functions</span><br />
<p>XPath 1.0 currently supports <code>sum()</code> and
<code>count()</code>. XSLT users have frequently
requested the addition of <code>min()</code> and
<code>max()</code>. XPath 2.0 MUST address this by
extending its basic set of aggegration functions by
adopting some or all of the ones defined for XML
Query.</p>
<p class="satisfied">Satisfied by section <a href="http://www.w3.org/TR/xpath-functions/#aggregate.functions">Aggregate Functions</a> in <a href="#XPathFO">[XQuery 1.0 and XPath
2.0 Functions and Operators]</a>.</p>
</td>
</tr>
<tr class="r0">
<td class="item" valign="top">
</td>
<td class="item" align="right" valign="top"><b>1.5</b></td>
<td colspan="2" class="item">
<span class="req-should">Should Maintain Backwards
Compatibility with XPath 1.0</span><br />
<p>Any valid XPath 1.0 expression SHOULD also be a valid
XPath 2.0 expression, and have the same semantics when
operating in the absence of XML Schema type information.
If not possible to achieve due to other requirements,
XPath 2.0 should minimize the number of changes to the
XPath 2.0 syntax to maximize backward compatibility with
XPath 1.0.</p>
<p class="satisfied">Satisfied by <a href="http://www.w3.org/TR/xpath20/#id-backwards-compatibility">Backwards Compatibility with XPath 1.0</a> in <a href="#XPath2">[XPath 2.0]</a>.</p>
</td>
</tr>
<tr class="r1">
<td class="item" valign="top">
</td>
<td class="item" align="right" valign="top"><b>1.6</b></td>
<td colspan="2" class="item">
<span class="req-should">Should Provide Intersection
and Difference Functions</span><br />
<p>XPath 1.0 supports the union of two node sets. Set
functionality in XPath 2.0 SHOULD be expanded to include
intersection and difference functions, and should be
compatible with equivalent functions supported by XML
Query.</p>
<p class="satisfied">Satisfied by <em>union</em>,
<em>intersect</em>, and <em>except in</em> section
<a href="http://www.w3.org/TR/xpath20/#combining_seq">
Combining Node Sequences</a> in <a href="#XPath2">[XPath
2.0]</a>.</p>
<table summary="Presentation" border="0">
<tbody>
<tr>
<td><span class="title"><b>Use Case</b></span></td>
</tr>
<tr>
<td>
<ol>
<li>
<p>Given an XML document like:</p>
<div class="java-class">
<hr><br />
<teams><br />
<team
id="t1"><br />
<members
ref="e101 e103"/><br />
</team><br />
<team
id="t2"><br />
<members
ref="e102"/><br />
</team><br />
</teams><br />
<departments><br />
<department><br />
<employee
id="e101" name="Steve"
teams="t1"/><br />
<employee
id="e102" name="Jonathan"
teams="t2"/><br />
<employee
id="e103" name="James"
teams="t1"/><br />
</department><br />
</departments><br />
</hr>
</div><br />
<p>Format the list of employees that work in
the same department as the
<code>employee</code> with <code>id</code> =
<code>e101</code> and that are on the same
teams as that employee. To accomplish
this:</p>
<ul>
<li>
<p>Select the list of all employees in
the employee's department:</p>
<div class="java-class">
id('e101')/parent::department/employee
</div><br />
</li>
<li>
<p>Intersect that set with the list of
all employees who are members of the
current employee's teams:</p>
<div class="java-class">
id('e101')/id(id(@teams)/members/@ref)
</div><br />
</li>
<li>
<p>Difference that set with the list
containing the current employee so they
don't appear in their own list of team
members:</p>
<div class="java-class">
id('e101')
</div><br />
</li>
</ul>
<p>The result should be the employee
"James".</p>
</li>
<li>
<p>Given an XML document full of book
information, a book with multiple authors
appears like this:</p>
<div class="java-class">
<books><br />
<book><br />
<title>Exciting
New Book</title><br />
<author>Kay</author><br />
<author>Muench</author><br />
</book><br />
<book><br />
<title>Building
Oracle XML Applications</title><br />
<author>Muench</author><br />
</book><br />
<book><br />
<title>XSLT
Programmer's Reference</title><br />
<author>Kay</author><br />
</book><br />
</books>
</div><br />
<p>Assuming an XSLT key is defined as
follows:</p>
<div class="java-class">
<xsl:key name="auth" match="book"
use="author"/>
</div><br />
<p>then, to find the list of books that have
both Muench and Kay among their authors, you
need to select the intersection of
<code>key('auth','Muench')</code> and
<code>key('auth','Kay')</code>.</p>
<p>To find books authored by Muench but
<i>not</i> by Kay, you need to select the
difference of
<code>key('auth','Muench')</code> and
<code>key('auth','Kay')</code>.</p>
</li>
</ol>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr class="r0">
<td class="item" valign="top">
</td>
<td class="item" align="right" valign="top"><b>1.7</b></td>
<td colspan="2" class="item">
<span class="req-should">Should Support Unary Plus
Operator</span><br />
<p>XML Schema allows decimals to have a leading plus. To
align better with this, XPath 2.0 SHOULD allow this by
providing a unary plus operator.</p>
<blockquote>
<p><b>Ed. Note:</b> There's a potential though rather
remote problem if there are nodes in the source
document containing a number with a leading plus sign.
Currently the defined behavior is to convert these
values to <code>NaN</code>, and this will change. A
stylesheet that is looking for phone-numbers beginning
with "+" might rely on this.</p>
</blockquote>
<p class="satisfied">Satisfied by section <a href="http://www.w3.org/TR/xpath-functions/#func-numeric-unary-plus">op:numeric-unary-plus</a> in <a href="#XPathFO">[XQuery 1.0 and XPath 2.0 Functions and Operators]</a>.</p>
</td>
</tr>
<tr class="r1">
<td class="item" align="right" valign="top"><b>2</b></td>
<td colspan="3" class="item">
<span class="req-must">Must Improve Ease of
Use</span><br />
<p>Users of XPath 1.0 have requested enhancements to
simplify expression of common XPath use cases. XPath 2.0
MUST address these frequently requested enhancements.</p>
</td>
</tr>
<tr class="r0">
<td class="item" valign="top">
</td>
<td class="item" align="right" valign="top"><b>2.1</b></td>
<td colspan="2" class="item">
<span class="req-must">Must Loosen Restrictions on
Location Steps</span><br />
<p>To better align with <a href="#XPointer">XPointer</a>
and to simplify the use of XPath expressions in which
multiple alternatives are allowed for a given location
step, XPath 2.0 MUST relax current restrictions for what
can appear after a '<code>/</code>' in an XPath
expression. Neither unions nor node-set functions are
allowed to appear after a '<code>/</code>' in XPath
1.0.</p>
<p class="satisfied">Satisfied by section <a href="http://www.w3.org/TR/xpath20/#id-steps">Steps</a> which allow union and node-set functions in
<a href="#XPath2">[XPath 2.0]</a>.</p>
<table summary="Presentation" border="0">
<tbody>
<tr>
<td><span class="title"><b>Use Case</b></span></td>
</tr>
<tr>
<td>
<ol>
<li>
<p>An XPointer's expression can use node-set
functions on the right of the
'<code>/</code>' in a path:</p>
<div class="java-class">
id("chap1")/range-to(id("chap2"))
</div><br />
</li>
<li>
<p>Allowing unions in a location step would
allow expressions like:</p>
<div class="java-class">
/foo/(xxx|yyy)/li/(p|eg)
</div><br />
<p>instead of the more cumbersome:</p>
<div class="java-class">
/foo/xxx/li/p |<br />
/foo/xxx/li/eg |<br />
/foo/yyy/li/p |<br />
/foo/yyy/li/eg
</div><br />
</li>
<li>
<p>Allowing node-set functions to appear in a
location step would allow expressions
like:</p>
<div class="java-class">
document("otherdoc.xml")/id("foo")/a/b
</div><br />
<p>and</p>
<div class="java-class">
document("otherdoc.xml")/key("x","foo")/a/b
</div><br />
</li>
</ol>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr class="r1">
<td class="item" valign="top">
</td>
<td class="item" align="right" valign="top"><b>2.2</b></td>
<td colspan="2" class="item">
<span class="req-must">Must Provide a Conditional
Expression</span><br />
<p>Many users have requested the ability to return a
conditional value based on a boolean expression. XPath
2.0 MUST provide a conditional expression which takes
three expressions:</p>
<ol>
<li><i>expression1 (boolean)</i></li>
<li><i>expression2</i></li>
<li><i>expression3</i></li>
</ol>
<p>and evaluates to <i>expression2</i> if
<i>expression1</i> is <code>true</code> and to
<i>expression3</i> if <code>expression1</code> is
<code>false</code>. Only <i>expression1</i> and the
expression to be returned must be evaluated.</p>
<p class="satisfied">Satisfied by section <a href="http://www.w3.org/TR/xpath20/#id-conditionals">Conditional Expressions</a> in <a href="#XPath2">[XPath
2.0]</a>.</p>
<table summary="Presentation" border="0">
<tbody>
<tr>
<td><span class="title"><b>Use Case</b></span></td>
</tr>
<tr>
<td>
<p><b>XSLT Use Cases</b></p>
<ol>
<li>In a template, construct a
<code><table></code> element with a
<code>border</code> attribute whose value is
provided by an <i>attribute value template</i>
and is conditional depending on the value of
the <code>frame</code> attribute of the current
node. If <code>@frame = 'none'</code>, then the
value of <code>border</code> should be
<code>0</code>, otherwise the value of
<code>border</code> should be
<code>1</code>.</li>
<li>Assign an XSLT variable a conditional value
based on whether the current node has any
<code><test></code> element children. If
it does, assign the value "<code>is</code>" to
the variable, otherwise assign the value
"<code>is not</code>".</li>
<li>
<p>Given a source XML document like this:</p>
<div class="java-class">
<Emps><br />
<Emp><br />
<LastName>Smith</LastName><br />
</Emp><br />
<Emp><br />
<CommonName>Scott</CommonName><br />
</Emp><br />
</Emps>
</div><br />
<p>provide an <code><xsl:sort></code>
select expression to sort the list of
employees on the value of their
<code><LastName></code> if it's
present, otherwise on the value of their
<code><CommonName></code> element.</p>
</li>
</ol>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr class="r0">
<td class="item" valign="top">
</td>
<td class="item" align="right" valign="top"><b>2.3</b></td>
<td colspan="2" class="item">
<span class="req-must">Must Define Consistent
Implicit Semantics for Collection-Valued
Subexpressions</span><br />
<p>In XPath 1.0, the use of a collection-valued
subexpression can introduce an implicit existential
quantification or choose-first-member operation into the
containing expression's semantics. XPath 2.0 MUST define
a consistent implicit semantics for expressions that have
collection-valued subexpressions. This may require that
XPath 2.0 expressions use explicit quantification or
indexing expressions to achieve the same implicit
semantics provided in XPath 1.0.</p>
<p class="satisfied">Satisfied by inclusion of implicit
existential quantification in <a href="http://www.w3.org/TR/xpath20/#id-general-comparisons">General Comparisons</a> in <a href="#XPath2">[XPath
2.0]</a>. Note that it is not included in Value
Comparisons. The first member semantics were dropped
except for Backwards Compatibility mode.</p>
<table summary="Presentation" border="0">
<tbody>
<tr>
<td><span class="title"><b>Use Case</b></span></td>
</tr>
<tr>
<td>
<ol>
<li>In XPath 1.0, the expression
<code>a[b=5]</code> returns
<code><a></code> elements that have ANY
<code><b></code> element child with value
5, where as the expression
<code>a[b+1=6]</code> returns
<code><a></code> elements whose FIRST
<code><b></code> element child has value
5. These results should be consistent for XPath
2.0.
<p class="satisfied">In 2.0 a[b+1=6] will
return an error if more than one b where in
1.0 it will ignore the other b's. This
produces a less surprising result for our
users.</p>
</li>
<li>Assume for this use case that the
typed-value of an element or attribute is
referenced using the syntax
<code>typed-value(elt)</code> and
<code>typed-value(@attr)</code>, respectively.
In XPath 2.0, when working with the typed value
of an element or attribute with
<code>boolean</code> type, the expression
<code>a[typed-value(b) = false()]</code> should
return <code><a></code> elements having
at least one <code><b></code> element
child with <code>boolean</code> value
<code>false</code>. Similarly, the expression
<code>a[typed-value(@b) = false()]</code>
should return <a> elements having a
boolean attribute <code>b</code> with value
<code>false</code>.</li>
</ol>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr class="r1">
<td class="item" valign="top">
</td>
<td class="item" align="right" valign="top"><b>2.4</b></td>
<td colspan="2" class="item">
<span class="req-should">Should Support Additional
String Functions</span><br />
<p>Users of XSLT 1.0 have requested additional string
manipulation functions. Common requests include string
padding (with spaces, dashes, or other characters),
string replacement, and converting strings to upper and
lower case. XPath 2.0 SHOULD provide additional string
functions. As with any string functions,
internationalization issues need to be addressed to
insure that the functionality is as broadly useful as
possible.</p>
</td>
</tr>
<tr class="r0">
<td class="item" valign="top">
</td>
<td class="item" valign="top">
</td>
<td class="item" align="right" valign="top">
<b>2.4.1</b></td>
<td class="item">
<span class="req-should">Should Simplify String
Replacement</span><br />
<p>XPath 1.0 provides the <code>translate()</code>
function that allows each single character in a source
string to be translated to another single character in
the result string, or to be removed. Users of XPath 1.0
frequently want to replace <i>sequences</i> of
consecutive characters with other sequences of
characters, which <code>translate()</code> does not
support. XPath 2.0 SHOULD support a more flexible string
replacement function.</p>
<p class="satisfied">Satisfied by section <a href="http://www.w3.org/TR/xpath-functions/#string.match">String Functions that Use Pattern Matching</a> in <a href="#XPathFO">[XQuery 1.0 and
XPath 2.0 Functions and Operators]</a>.</p>
<table summary="Presentation" border="0">
<tbody>
<tr>
<td><span class="title"><b>Use Case</b></span></td>
</tr>
<tr>
<td>
<p>Replace each occurrence of "<code>foo</code>"
in a string with "<code>foobar</code>".</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr class="r1">
<td class="item" valign="top">
</td>
<td class="item" valign="top">
</td>
<td class="item" align="right" valign="top">
<b>2.4.2</b></td>
<td class="item">
<span class="req-should">Should Simplify String
Padding</span><br />
<p>Often string values need to be padded on the left or
right to make the value occupy a fixed length. XPath 2.0
SHOULD support a string padding function that permits any
character as a padding character.</p>
<p class="satisfied">Satisfied by <a href="http://www.w3.org/TR/xpath-functions/#string-pad">eg:string-pad</a> in <a href="#XPathFO">[XQuery 1.0 and
XPath 2.0 Functions and Operators]</a>.</p>
<table summary="Presentation" border="0">
<tbody>
<tr>
<td><span class="title"><b>Use Case</b></span></td>
</tr>
<tr>
<td>
<ol>
<li>Pad the value of a string on the right to
ensure a length of 10 characters using
spaces</li>
<li>Pad the value of a string on the left to 10
characters using asterisks</li>
<li>Output a string containing as many dashes
as the length of a section title</li>
</ol>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr class="r0">
<td class="item" valign="top">
</td>
<td class="item" valign="top">
</td>
<td class="item" align="right" valign="top">
<b>2.4.3</b></td>
<td class="item">
<span class="req-should">Should Simplify String Case
Conversions</span><br />
<p>XPath 2.0 SHOULD provide the ability to convert the
case of text to upper or lower case for presentation
and/or comparison.</p>
<p class="satisfied">Satisfied by section <a href="http://www.w3.org/TR/xpath-functions/#func-upper-case">fn:upper-case</a> and <a href="http://www.w3.org/TR/xpath-functions/#func-lower-case">fn:lower-case</a> in <a href="#XPathFO">[XQuery 1.0 and
XPath 2.0 Functions and Operators]</a>.</p>
</td>
</tr>
<tr class="r1">
<td class="item" valign="top">
</td>
<td class="item" align="right" valign="top"><b>2.5</b></td>
<td colspan="2" class="item">
<span class="req-should">Should Support Aggregation
Functions Over Collection-Valued Expressions</span><br />
<p>Users of XPath 1.0 frequently request the ability to
apply an aggregate function, like <code>sum()</code>, to
the values of expressions applied to a node set. XPath
2.0 SHOULD support aggregation functions over expressions
applied to node sets.</p>
<p class="satisfied">Satisfied by <a href="http://www.w3.org/TR/xpath20/#id-for-expressions">For
Expressions</a> in <a href="#XPath2">[XPath2.0]</a>.</p>
<table summary="Presentation" border="0">
<tbody>
<tr>
<td><span class="title"><b>Use Case</b></span></td>
</tr>
<tr>
<td>
<ol>
<li>
<p>Given a document like</p>
<div class="java-class">
<sect title="Plan"><br />
<sect
title="Overview"><br />
<sect
title="Competitors"><br />
<sect
title="SuperSoft"/><br />
<sect
title="BarnWare"/><br />
</sect><br />
</sect><br />
<sect
title="Details"><br />
<sect
title="Summary"/><br />
</sect><br />
</sect>
</div><br />
<p>Calculate the maximum depth of the nesting
of <code><sect></code> elements. The
nodeset is identified by the expression
<code>//sect</code> and the expression to
maximize would be
<code>count(ancestor-or-self::sect)</code>.</p>
</li>
<li>Given the same document above, calculate
the average string length of section titles.
The nodeset is identified by
<code>//section/@title</code> and the
expression to sum would be
<code>string-length(.)</code>, divided by the
<code>count(//section/@title)</code></li>
<li>Given an XML document containing a purchase
order and its line <code><item></code>
elements, calculate the total amount of the
purchase order by summing the price times the
quantity of each item. The nodeset is
identified by <code>item</code>, and the
expression to sum would be <code>price *
quantity</code>.</li>
</ol>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr class="r0">
<td class="item" align="right" valign="top"><b>3</b></td>
<td colspan="3" class="item">
<span class="req-must">Must Support String Matching
Using Regular Expressions</span><br />
<p>Regular expressions provide a powerful way to specify
string pattern matching and now play an important role in
XML Schema as the mechanism by which pattern facets are
specified. XPath 2.0 MUST support regular expressions for
matching against strings using the regular expression
notation established in <a href="#XSchemaData">XML
Schema: Datatypes</a>.</p>
<p class="satisfied">Satisfied by section <a href="http://www.w3.org/TR/xpath-functions/#regex-syntax">Regular Expression Syntax</a> in <a href="#XPathFO">[XQuery 1.0 and XPath 2.0 Functions and
Operators]</a>.</p>
<table summary="Presentation" border="0">
<tbody>
<tr>
<td><span class="title"><b>Use Case</b></span></td>
</tr>
<tr>
<td>
<ol>
<li>
<p>Given XML like:</p>
<div class="java-class">
<Data><br />
<EmpRow><br />
:<br />
</EmpRow><br />
<DeptRow><br />
<Deptno>10</Deptno><br />
<Employees><br />
<EmpRow><br />
<Empno>1000</Empno><br />
<Ename>1000</Ename><br />
</Emprow><br />
</Employees><br />
</DeptRow><br />
</Data>
</div><br />
<p>match elements that "end with
<code>Row</code> or <code>row</code>"</p>
<div class="java-class">
*[local-name() =~ ".*[rR]ow"]
</div><br />
</li>
<li>
<p>Match phone numbers like 123-456-7890</p>
<div class="java-class">
field[ . =~ "\d\d\d-\d\d\d\-\d\d\d\d"]
</div><br />
</li>
<li>
<p>Match any element name with the string
"Addr" contained within the name
(case-insensitively)</p>
<div class="java-class">
*[local-name() =~ ".*[Aa][Dd][Dd][Rr].*"]
</div><br />
</li>
<li>
<p>Match a string from a dynamic regular
expression</p>
<div class="java-class">
Department[Code =~
concat("[0-9][0-9]",$v,".*")]
</div><br />
</li>
</ol>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr class="r1">
<td class="item" align="right" valign="top"><b>4</b></td>
<td colspan="3" class="item">
<span class="req-must">Must Add Support for XML
Schema Primitive Datatypes</span><br />
<p><a href="#XSchemaData">[XML Schema: Datatypes]</a>
defines a set of primitive datatypes. In addition to the
types supported by the XPath 1.0 data model,
<code>string</code>, <code>number</code>,
<code>boolean</code>, and <code>node-set</code>, the
XPath 2.0 data model MUST support XML Schema primitive
types. XPath 2.0 will extend the XPath data model to
accommodate working with elements and attribute values
having an XML Schema primitive type.</p>
</td>
</tr>
<tr class="r0">
<td class="item" valign="top">
</td>
<td class="item" align="right" valign="top"><b>4.1</b></td>
<td colspan="2" class="item">
<span class="req-must">Must Define the Operator
Matrix and Conversions</span><br />
<p>XPath 2.0 MUST support the operators and type-coercion
rules defined by the joint XSLT/Schema/Query task force
on operators.</p>
<p class="satisfied">Satisfied by sections</p>
<ul class="satisfied">
<li><a href="http://www.w3.org/TR/xpath-functions/#numeric-functions">Functions and Operators on Numerics</a></li>
<li><a href="http://www.w3.org/TR/xpath-functions/#d1e3606">Functions and Operators on Boolean Values</a></li>
<li><a href="http://www.w3.org/TR/xpath-functions/#durations-dates-times">Functions and Operators on Durations, Dates and
Times</a></li>
<li><a href="http://www.w3.org/TR/xpath-functions/#QName-funcs">Functions Related to QNames</a></li>
</ul>
<p class="satisfied">in <a href="#XPathFO">[XQuery 1.0
and XPath 2.0 Functions and Operators]</a>.</p>
<table summary="Presentation" border="0">
<tbody>
<tr>
<td><span class="title"><b>Use Case</b></span></td>
</tr>
<tr>
<td>
<ul>
<li>
<p><b>General</b></p>
<ol>
<li>Use and create the type information of
any datatype</li>
<li>Do not require the user to respecify
the datatype (i.e. number and boolean)</li>
<li>Maintain the facet constraints of
primitive datatypes while manipulating the
value. For example, take a 14.4 number plus
a 14.4 number and return a 14.4
number.</li>
</ol>
</li>
<li>
<p><b>For DateTime</b></p>
<ol>
<li>Compare dates of documents and return a
boolean</li>
<li>Add a time or date interval and return
the same type</li>
<li>Add a scalar value to a time or date
and return the same type</li>
<li>
<p>Calculate an end time from a start
time+duration. For example, given:</p>
<div class="java-class">
<appointment
time="20001224-16:00:00"
duration="1:00"/>
</div>
<p>Produce the end-time:</p>
<div class="java-class">
End time: <xsl:value-of
select="@time + @duration"/>
</div><br />
</li>
<li>
<p>Detect intersections between datetime
durations</p>
<div class="java-class">
<appointment
time="20001224-16:00:00"
duration="2:00" reminder="0:15"/>
</div><br />
<div class="java-class">
<appointment
time="20001224-17:00:00"
duration="1:00" reminder="0:15"/>
</div><br />
</li>
</ol>
</li>
<li>
<p><b>For Boolean</b></p>
<p>Perform pattern matching on "yes" and
"no"</p>
</li>
<li>
<p><b>For QName</b></p>
<ol>
<li>Build a Namespace element from a
QName</li>
<li>Compare a Namespace URI from a QName
with a string</li>
</ol>
</li>
</ul>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr class="r1">
<td class="item" valign="top">
</td>
<td class="item" align="right" valign="top"><b>4.2</b></td>
<td colspan="2" class="item">
<span class="req-must">Must Allow Scientific
Notation for Numbers</span><br />
<p>XML Schema specifies a lexical representation for
doubles and floats that includes scientific notation as
well as <code>INF</code>, <code>-INF</code> or
<code>NaN</code>. XPath 2.0 MUST support the lexical
representations of floats and doubles supported by XML
Schema.</p>
<p class="satisfied">Satisfied by section <a href="http://www.w3.org/TR/xpath-functions/#d1e1156">Numeric Types</a> in <a href="#XPathFO">[XQuery 1.0 and XPath 2.0 Functions and
Operators]</a>.</p>
</td>
</tr>
<tr class="r0">
<td class="item" valign="top">
</td>
<td class="item" align="right" valign="top"><b>4.3</b></td>
<td colspan="2" class="item">
<span class="req-must">Must Define Appropriate Cast
and Constructor Functions</span><br />
<p>XPath 2.0 MUST define an appropriate set of functions
to allow users to cast and construct instances of XML
Schema primitive types. At a minimum, this set MUST
include cast and constructor functions for URI and
date/time types.</p>
<p class="satisfied">Satisfied by section <a href="http://www.w3.org/TR/xpath-functions/#constructor-functions">Constructor Functions</a> and <a href="http://www.w3.org/TR/xpath-functions/#casting">Casting</a> in <a href="#XPathFO">[XQuery 1.0 and XPath
2.0 Functions and Operators]</a>.</p>
<table summary="Presentation" border="0">
<tbody>
<tr>
<td><span class="title"><b>Use Case</b></span></td>
</tr>
<tr>
<td>
<p>Be able to compare an element or attribute
with an XML Schema date or time type with a
constant date or time value.</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr class="r1">
<td class="item" valign="top">
</td>
<td class="item" align="right" valign="top"><b>4.4</b></td>
<td colspan="2" class="item">
<span class="req-should">Should Add List Data Type
to the Type System of the Expression
Langauge</span><br />
<p>XML Schema allows the definition of simple types
derived by list, including lists of unions of non-list
simple types. XPath 2.0 SHOULD support an ordered list of
simple-typed values.</p>
<p class="satisfied">Satisfied by section <a href="http://www.w3.org/TR/xpath-datamodel/#sequences">Sequences</a> in <a href="#XQDM">[XQuery 1.0 and
XPath 2.0 Data Model]</a>.</p>
<table summary="Presentation" border="0">
<tbody>
<tr>
<td><span class="title"><b>Use Case</b></span></td>
</tr>
<tr>
<td>
<p>Create an XSLT transformation that converts an
element structure like this:</p>
<div class="java-class">
<xdr:attribute name="a1"
dt:type="enumeration" dt:values="a1 a2 a3"/>
</div><br />
<p>into an alternative structure like this:</p>
<div class="java-class">
<xsd:attribute name="a1"><br />
<xsd:simpleType><br />
<xsd:restriction
base="NMTOKEN"><br />
<xsd:enumeration
value="a1"/><br />
<xsd:enumeration
value="a2"/><br />
<xsd:enumeration
value="a3"/><br />
</xsd:restriction><br />
</xsd:simpleType><br />
</xsd:attribute>
</div><br />
<p>This requires the ability in XPath to select
the list of NMTOKENS values of the
<code>dt:values</code> attribute for
processing.</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr class="r0">
<td class="item" valign="top">
</td>
<td class="item" align="right" valign="top"><b>4.5</b></td>
<td colspan="2" class="item">
<span class="req-must">Must Support Accessing
Simple-Typed Value of Elements and
Attributes</span><br />
<p>The XPath 1.0 type system supports the
<code>number</code>, <code>string</code>,
<code>boolean</code>, and <code>node-set</code> types.
<a href="#XSchemaData">XML Schema: Datatypes</a>
introduces many new types. XPath 1.0 supports conversion
of the simple-typed values of elements and attributes to
strings. In addition to this functionality, XPath 2.0
MUST support access to the native, simple-typed value of
an element or attribute.</p>
<p class="satisfied">Satisfied by <a href="http://www.w3.org/TR/xpath20/#id-typed-value">Typed Value and String Value</a>
in <a href="#XPath2">[XPath 2.0]</a>.</p>
</td>
</tr>
<tr class="r1">
<td class="item" valign="top">
</td>
<td class="item" align="right" valign="top"><b>4.6</b></td>
<td colspan="2" class="item">
<span class="req-must">Must Define Behavior of
Operators for Null Arguments</span><br />
<p>Since the typed value of an element can be
<code>null</code>, XPath 2.0 MUST define how the behavior
of operations applies to null values.</p>
<p class="satisfied">Satisfied by the Empty Sequence
supported through the <a href="#XPath2">[XPath
2.0]</a> language.</p>
<table summary="Presentation" border="0">
<tbody>
<tr>
<td><span class="title"><b>Use Case</b></span></td>
</tr>
<tr>
<td>
<p>Assuming the typed value of an element is
addressed using a syntax like
<code>typed-value(elementname)</code>, XPath
needs to specify what <code>1.20 *
typed-value(salary)</code> evaluates to when the
typed value of the <code><salary></code> is
<code>null</code>.</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr class="r0">
<td class="item" align="right" valign="top"><b>5</b></td>
<td colspan="3" class="item">
<span class="req-should">Should Add Support for XML
Schema: Structures</span><br />
<p><a href="#XSchemaStruc">XML Schema: Structures</a>
enables users to define structured types and associate
them to elements in a schema. XPath 2.0 SHOULD provide
support for the common operations needed for navigation
and selection of typed elements.</p>
</td>
</tr>
<tr class="r1">
<td class="item" valign="top">
</td>
<td class="item" align="right" valign="top"><b>5.1</b></td>
<td colspan="2" class="item">
<span class="req-should">Should Select
Elements/Attributes Based on an Explicit XML Schema
Type</span><br />
<p>XML Schema : Structures provides the ability to define
the type of an element or attribute. XPath 2.0 SHOULD be
able to test whether an element or attribute is an
instance of a given type.</p>
<p class="satisfied">Satisfied by <a href="http://www.w3.org/TR/xpath20/#id-sequencetype-matching">SequenceType
Matching</a> in <a href="#XPath2">[XPath 2.0]</a>.</p>
<table summary="Presentation" border="0">
<tbody>
<tr>
<td><span class="title"><b>Use Case</b></span></td>
</tr>
<tr>
<td>
<ol>
<li>Select all elements that are instances of
the complex type <code>Address</code>.</li>
<li>Select all attributes that are instances of
the simple-type <code>xsd:integer</code>.</li>
<li>Select elements of type
<code>Address</code> indicated in the instance
with <code>xsi:type="Address"</code></li>
</ol>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr class="r0">
<td class="item" valign="top">
</td>
<td class="item" align="right" valign="top"><b>5.2</b></td>
<td colspan="2" class="item">
<span class="req-should">Should Select
Elements/Attributes Based on XML Schema Type
Hierarchy</span><br />
<p>XML Schema : Structures provides the ability to define
a hierarchy of types by derivation. XPath 2.0 SHOULD be
able to selects elements or attributes that are instances
of a type, also matching any types derived from it by
restriction or extension.</p>
<blockquote>
<p><b>Ed. Note:</b> This introduces some interesting
precedence decisions about how matches for an explicit
type would need to take precedence over matches for
compatible types. In other words, given a template
matching elements with types compatible to
<code>Address</code> and another template explicitly
matching type <code>USAddress</code>, one would expect
the explicit type match to take precedence. Also
consider the case where two templates exist, one that
matches the <code>Address</code> type and one that
matches the <code>USAddress</code> type. If an element
of type RuralRouteAddress (further derived from
USAddress) is considered for matching, one would expect
the template for the "closest inherited ancestor", that
is <code>USAddress</code>, to take precendence over a
template matching the type of a "more distant inherited
ancestor" like <code>Address</code>.</p>
</blockquote>
<p class="satisfied">Satisfied by <a href="http://www.w3.org/TR/xpath20/#id-sequencetype-matching">SequenceType
Matching</a> in <a href="#XPath2">[XPath 2.0]</a>.</p>
<table summary="Presentation" border="0">
<tbody>
<tr>
<td><span class="title"><b>Use Case</b></span></td>
</tr>
<tr>
<td>
<p><b>Derivation by Restriction</b></p>
<p>The <a href="#XSchemaPri">[XML Schema:
Primer]</a> defines the <code>Items</code> type
and the <code>ConfirmedItems</code> type which is
derived by restriction from <code>Items</code>.
Select purchase orders whose
<code><items></code> member element is an
instance of the <code>ConfirmedItems</code> type,
which restricts the minimum number of
<code><item></code> elements that can
appear to be at least one.</p>
<p><b>Derivation by Extension</b></p>
<p>The <a href="#XSchemaPri">[XML Schema:
Primer]</a> defines the <code>Address</code> type
and the <code>UKAddress</code> and
<code>USAddress</code> types which is derived by
extension from <code>Address</code>, adding
additional element content in the subtypes.</p>
<ol>
<li>Select all elements that are instances of
complex type <code>Address</code>, matching
elements of type <code>USAddress</code> and
elements of type <code>UKAddress</code> as
well.</li>
<li>Select all elements that are instances of
complex type <code>Address</code>, without
selecting elements of types derived from
<code>Address</code>.</li>
<li>Select all attributes that are instances of
the simple-type <code>xsd:integer</code>,
matching attribute of type
<code>SKU-Number</code> which derives from
<code>xsd:integer</code>.</li>
</ol>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr class="r1">
<td class="item" valign="top">
</td>
<td class="item" align="right" valign="top"><b>5.3</b></td>
<td colspan="2" class="item">
<span class="req-should">Should Select Elements
Based on XML Schema Substitution Groups</span><br />
<p><a href="#XSchemaData">[XML Schema: Datatypes]</a>
provides the ability to include two or more element names
in a substitution group. XPath 2.0 SHOULD be able to test
whether an element is a member of an XML Schema
substitution group.</p>
<p class="satisfied">Satisfied by <a href="http://www.w3.org/TR/xpath20/#id-sequencetype-matching">SequenceType
Matching</a> in <a href="#XPath2">[XPath 2.0]</a>.</p>
<table summary="Presentation" border="0">
<tbody>
<tr>
<td><span class="title"><b>Use Case</b></span></td>
</tr>
<tr>
<td>
<p>The <a href="#XSchemaPri">[XML Schema:
Primer]</a> defines the global
<code><ipo:comment></code> element as the
head of a substitution group, whose substitutible
member elements include
<code><ipo:customerComment></code> and
<code><ipo:shipComment></code>. Select the
list of all elements that are
<code><ipo:comment></code> elements,
including any elements that are substitutible for
<code><ipo:comment></code> through this
substitution group.</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr class="r0">
<td class="item" valign="top">
</td>
<td class="item" align="right" valign="top"><b>5.4</b></td>
<td colspan="2" class="item">
<span class="req-should">Should Support Lookups
Based on Schema Unique Constraints and Keys</span><br />
<p><a href="#XSchemaData">[XML Schema: Datatypes]</a>
supports named, multi-part keys. XPath 2.0 SHOULD support
a mechanism for looking up the element to which a Schema
key refers. Similar mechanisms already exist, such as the
<code>id()</code> function in XPath 1.0 and the
<code>key()</code> function in XSLT.</p>
<p class="notsatisfied">Not Satisfied due to lack of use
cases and existing functionality in host languages to
create keys.</p>
</td>
</tr>
</tbody>
</table>
<div class="div2">
<h2><a name="section-References" id="section-References"></a>3
References</h2>
<dl>
<dt class="label"><a id="XQDM" name="XQDM"></a>XQuery 1.0 and
XPath 2.0 Data Model</dt>
<dd>World-Wide Web Consortium <em>XQuery 1.0 and XPath 2.0
Data Model</em>. See <a href="http://www.w3.org/TR/xpath-datamodel/">http://www.w3.org/TR/xpath-datamodel/</a></dd>
<dt class="label"><a id="XPath" name="XPath"></a>XPath
1.0</dt>
<dd>World-Wide Web Consortium <em>XML Path Language
(XPath)</em>: Version 1.0. November, 1999. See <a href="http://www.w3.org/TR/xpath">http://www.w3.org/TR/xpath</a>.</dd>
<dt class="label"><a id="XPathReq" name="XPathReq"></a>XPath
Requirements Version 2.0</dt>
<dd>World Wide Web Consortium, <em>XPath Requirements Version
2.0</em>. See <a href="http://www.w3.org/TR/xpath20req">http://www.w3.org/TR/xpath20req</a>.</dd>
<dt class="label"><a id="XPath2" name="XPath2"></a>XPath
2.0</dt>
<dd>World-Wide Web Consortium <em>XML Path Language
(XPath)</em>: Version 2.0. See <a href="http://www.w3.org/TR/xpath20/">http://www.w3.org/TR/xpath20/</a>.</dd>
<dt class="label"><a id="XSLT2" name="XSLT2"></a>XSLT
2.0</dt>
<dd>World Wide Web Consortium, <em>XSL Transformations
Language (XSLT)</em>: Version 2.0. See <a href="http://www.w3.org/TR/xslt20/">http://www.w3.org/TR/xslt20/</a>.</dd>
<dt class="label"><a id="XQWG" name="XQWG"></a>XML Query
Working Group</dt>
<dd>World Wide Web Consortium, <em>XML Query Working
Group</em>. Home page: <a href="http://www.w3.org/XML/Query">http://www.w3.org/XML/Query</a>.</dd>
<dt class="label"><a id="XSLWG" name="XSLWG"></a>XSL Working
Group</dt>
<dd>World Wide Web Consortium, <em>XSL Working Group</em>.
Home page: <a href="http://www.w3.org/Style/XSL/">http://www.w3.org/Style/XSL/</a>.</dd>
<dt class="label"><a id="XQuery" name="XQuery"></a>XQuery
1.0: A Query Language for XML</dt>
<dd>World Wide Web Consortium, <em>XQuery 1.0: A Query
Language for XML</em>. See <a href="http://www.w3.org/TR/xquery/">http://www.w3.org/TR/xquery/</a>.</dd>
<dt class="label"><a id="XQueryReq" name="XQueryReq"></a>XML
Query Requirements</dt>
<dd>World Wide Web Consortium, <em>XML Query
Requirements</em>. See <a href="http://www.w3.org/TR/2005/WD-xquery-requirements-20050603/">http://www.w3.org/TR/2005/WD-xquery-requirements-20050603/</a>.</dd>
<dt class="label"><a id="XPointer" name="XPointer"></a>XPointer</dt>
<dd>World Wide Web Consortium, <em>XPointer xpointer()
Scheme</em>. See <a href="http://www.w3.org/TR/xptr-xpointer/">http://www.w3.org/TR/xptr-xpointer/</a>.</dd>
<dt class="label"><a id="XSchemaPri" name="XSchemaPri"></a>XML Schema: Primer</dt>
<dd>World Wide Web Consortium, <em>XML Schema Part 0:
Primer</em>. See <a href="http://www.w3.org/TR/xmlschema-0/">http://www.w3.org/TR/xmlschema-0/</a>.</dd>
<dt class="label"><a id="XSchemaStruc" name="XSchemaStruc"></a>XML Schema: Structures</dt>
<dd>World Wide Web Consortium, <em>XML Schema Part 1:
Structures</em>. See <a href="http://www.w3.org/TR/xmlschema-1/">http://www.w3.org/TR/xmlschema-1/</a>.</dd>
<dt class="label"><a id="XSchemaData" name="XSchemaData"></a>XML Schema: Datatypes</dt>
<dd>World Wide Web Consortium, <em>XML Schema Part 2:
Datatypes</em>. See <a href="http://www.w3.org/TR/xmlschema-2/">http://www.w3.org/TR/xmlschema-2/</a>.</dd>
<dt><a id="Infoset" name="Infoset"></a>XML Information
Set</dt>
<dd>World Wide Web Consortium, <em>XML Information Set</em>.
See <a href="http://www.w3.org/TR/xml-infoset/">http://www.w3.org/TR/xml-infoset/</a>.</dd>
<dt><a id="XPathFO" name="XPathFO"></a>XQuery 1.0 and XSLT
2.0 Functions and Operators</dt>
<dd>World Wide Web Consortium, <em>XQuery 1.0 and XSLT 2.0
Functions and Operators</em>. See <a href="http://www.w3.org/TR/xpath-functions/">http://www.w3.org/TR/xpath-functions/</a>.</dd>
<dt> </dt>
<dt> </dt>
<dt><a href="http://www.w3.org/TR/xptr-xpointer/"></a></dt>
</dl>
</div>
</body></html>