File: draft-mrose-writing-rfcs.txt

package info (click to toggle)
xml2rfc 1.36-5
  • links: PTS
  • area: non-free
  • in suites: wheezy
  • size: 7,416 kB
  • sloc: xml: 25,141; sh: 14,496; tcl: 2,189; makefile: 142; perl: 99
file content (2352 lines) | stat: -rw-r--r-- 63,230 bytes parent folder | download | duplicates (2)
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



                                                                 M. Rose
                                            Dover Beach Consulting, Inc.
                                                       February 28, 2008


               Writing I-Ds and RFCs using XML (revised)













































Rose                                                            [Page 1]

                Writing I-Ds and RFCs using XML (revised)  February 2008


Abstract

   This memo presents a technique for using XML (Extensible Markup
   Language) as a source format for documents in the Internet-Drafts
   (I-Ds) and Request for Comments (RFC) series.  This memo is an
   upwards-compatible revision to RFC 2629.


Table of Contents

   1.  Introduction . . . . . . . . . . . . . . . . . . . . . . . . .  3
   2.  Using the DTD to Write I-Ds and RFCs . . . . . . . . . . . . .  4
     2.1.  XML basics . . . . . . . . . . . . . . . . . . . . . . . .  4
     2.2.  Front matter . . . . . . . . . . . . . . . . . . . . . . .  6
       2.2.1.  The title Element  . . . . . . . . . . . . . . . . . .  6
       2.2.2.  The author Element . . . . . . . . . . . . . . . . . .  7
       2.2.3.  The date Element . . . . . . . . . . . . . . . . . . .  8
       2.2.4.  Meta Data Elements . . . . . . . . . . . . . . . . . .  8
       2.2.5.  The abstract Element . . . . . . . . . . . . . . . . .  9
       2.2.6.  The note Element . . . . . . . . . . . . . . . . . . .  9
       2.2.7.  Status, Copyright Notice, Table of Contents  . . . . .  9
       2.2.8.  Everything in the Front  . . . . . . . . . . . . . . . 11
     2.3.  The Middle . . . . . . . . . . . . . . . . . . . . . . . . 12
       2.3.1.  The section Element  . . . . . . . . . . . . . . . . . 12
       2.3.2.  The appendix Element . . . . . . . . . . . . . . . . . 22
     2.4.  Back matter  . . . . . . . . . . . . . . . . . . . . . . . 22
       2.4.1.  The references Element . . . . . . . . . . . . . . . . 22
       2.4.2.  Appendices . . . . . . . . . . . . . . . . . . . . . . 23
       2.4.3.  Copyright Status . . . . . . . . . . . . . . . . . . . 24
   3.  Processing the XML Source File . . . . . . . . . . . . . . . . 25
     3.1.  Editing  . . . . . . . . . . . . . . . . . . . . . . . . . 25
       3.1.1.  Checking . . . . . . . . . . . . . . . . . . . . . . . 25
     3.2.  Converting to Text Format  . . . . . . . . . . . . . . . . 26
     3.3.  Converting to HTML Format  . . . . . . . . . . . . . . . . 26
     3.4.  Searching  . . . . . . . . . . . . . . . . . . . . . . . . 26
   Appendix A.  The rfc Element . . . . . . . . . . . . . . . . . . . 27
   Appendix B.  The DTD . . . . . . . . . . . . . . . . . . . . . . . 28
   Appendix C.  Changes from RFC 2629 . . . . . . . . . . . . . . . . 35
   Appendix D.  Conformance with RFC 2026 or RFC 3667 (Historic)  . . 37
   Appendix E.  Acknowledgements  . . . . . . . . . . . . . . . . . . 38
   4.  Security Considerations  . . . . . . . . . . . . . . . . . . . 39
   5.  References . . . . . . . . . . . . . . . . . . . . . . . . . . 40
   Index  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
   Author's Address . . . . . . . . . . . . . . . . . . . . . . . . . 42







Rose                                                            [Page 2]

                Writing I-Ds and RFCs using XML (revised)  February 2008


1.  Introduction

   This memo describes how to write a document for the I-D and RFC
   series using the Extensible Markup Language [1] (XML).  This memo has
   three goals:

   1.  To describe a simple XML Document Type Definition (DTD) that is
       powerful enough to handle the simple formatting requirements of
       RFC-like documents whilst allowing for meaningful markup of
       descriptive qualities.

   2.  To describe software that processes XML source files, including a
       tool that produces documents conforming to RFC 2223 [2], HTML
       format, and so on.

   3.  To provide the proof-of-concept for the first two goals (this
       memo was written using this DTD and produced using that
       software).

   It is beyond the scope of this memo to discuss the political
   ramifications of using XML as a source format for RFC-like documents.
   Rather, it is simply noted that adding minimal markup to plain text:

   o  allows the traditional production of textual RFC-like documents
      using familiar editors;

   o  requires some, albeit minimal, additions to existing software
      environments; and,

   o  permits information to be organized, searched, and retrieved using
      both unstructured and structured mechanisms.




















Rose                                                            [Page 3]

                Writing I-Ds and RFCs using XML (revised)  February 2008


2.  Using the DTD to Write I-Ds and RFCs

   We do not provide a formal or comprehensive description of XML.
   Rather, this section discusses just enough XML to use a Document Type
   Declaration (DTD) to write RFC-like documents.

   If you're already familiar with XML, skip to Appendix B to look at
   the DTD.

2.1.  XML basics

   There are very few rules when writing in XML, as the syntax is
   (deceptively) simple.  There are five terms you'll need to know:

   1.  An "element" usually refers to a start tag, an end tag, and all
       the characters in between, e.g., "<example>text and/or nested
       elements</example>".

   2.  An "empty element" combines the start tag and the end tag, e.g.,
       "<empty/>".  For readability, I prefer to write this as "<empty
       />" -- both are legal XML.  You don't find empty elements in
       HTML.

   3.  An "attribute" is part of an element.  If present, they occur in
       the start tag, e.g., "<example name='value'>".  Of course, they
       can also appear in empty elements, e.g., "<empty name='value'
       />".

   4.  An "entity" is a textual macro that starts with "&".  Usually,
       you'll only use them whenever you want to put a "&" or a "<" in
       your text.

   5.  A "token" is a string of characters.  The first character is
       either a letter or an underscore ("_").  Any characters that
       follow are either letters, numbers, an underscore, or a period
       (".").

   First, start your source file with an XML declaration, a reference to
   the DTD, and the rfc element:

       <?xml version='1.0' ?>
       <!DOCTYPE rfc SYSTEM 'rfcXXXX.dtd'>
       <rfc>
           ...
       </rfc>

   Ignore the first two lines -- the declaration and the reference --
   and simply treat them as opaque strings.  Nothing else should be



Rose                                                            [Page 4]

                Writing I-Ds and RFCs using XML (revised)  February 2008


   present after the </rfc> tag.

   Second, make sure that all elements are properly matched and nested.
   A properly matched element that starts with "<example>" is eventually
   followed with "</example>".  (Empty elements are always matched.)
   Elements are properly nested when they don't overlap.

   For example,

       <outer>
           ...
           <inner>
               ...
           </inner>
           ...
       </outer>

   is properly nested.

   However,

       <outer>
           ...
           <inner>
               ...
           </outer>
           ...
       </inner>

   overlaps, so the elements aren't properly nested.

   Third, never use "<" or "&" in your text.  Instead, use either "&lt;"
   or "&amp;", respectively.

   Fourth, there are two quoting characters in XML, apostrophe (') and
   quotation (").  Make sure that all attributes values are quoted,
   e.g., "<example name='value'>".  If the value contains one of the
   quoting characters, then use the other to quote the value, e.g.,
   "<example name='"'>", If the value contains both quoting characters,
   then use one of them to quote the value, and replace occurrences of
   that character in the attribute value with either "&apos;"
   (apostrophe) or "&quot;" (quotation), e.g., "<example
   name='"&apos;"'>".

   If you want to put a comment in your source file, here's the syntax:

           <!-- comments can be multiline,
            if you wish -->



Rose                                                            [Page 5]

                Writing I-Ds and RFCs using XML (revised)  February 2008


   Finally, XML is case sensitive, which means that "<foo>" is different
   from "<Foo>".

2.2.  Front matter

   Immediately following the <rfc> tag is the front element:

       <?xml version='1.0'?>
       <!DOCTYPE rfc SYSTEM 'rfcXXXX.dtd'>
       <rfc>
           <front>
               <title ...>
               <author ...>
               <author ...>
               <date ...>
               <area ...>
               <workgroup ...>
               <keyword ...>
               <keyword ...>
               <abstract ...>
               <note ...>
           </front>
           ...
       </rfc>

   (Note that in all examples, indentation is used only for expository
   purposes.)

   The front element consists of a title element, one or more author
   elements, a date element, one or more optional area elements, one or
   more optional workgroup elements, one or more optional keyword
   elements, an optional abstract element. and, one or more optional
   note elements.

2.2.1.  The title Element

   The title element identifies the title of the document.  Because the
   title will be used in the headers of the document when formatted
   according to [2], if the title is more than 42 characters, then an
   abbreviation should also be provided, e.g.,

       <title abbrev='Much Ado about Nothing'>
       The IETF's Discussion on "Source Format of RFC Documents"
       </title>







Rose                                                            [Page 6]

                Writing I-Ds and RFCs using XML (revised)  February 2008


2.2.2.  The author Element

   Each author element identifies a document author.  Since a document
   may have more than one author, more than one author element may be
   present.  If the author is a person, then three attributes must be
   present in the <author> tag, initials, surname, and fullname, e.g.,

       <author initials='F.J.' surname='Flintstone'
               fullname='Frederick Flintstone'>

   There is also an optional role attribute, which, if present, must
   take the value "editor".

   The author element itself consists of an organization element, and,
   an optional address element.

   The organization element is similar to the title element, in that an
   abbreviation may be paired with a long organization name using the
   abbrev attribute, e.g.,

       <organization abbrev='ISI'>
           USC/Information Sciences Institute
       </organization>

   The address element consists of an optional postal element, an
   optional phone element, an optional facsimile element, an optional
   email element, and, an optional uri element.

   The postal element contains one or more street elements, followed by
   any combination of city, region (state or province), code (zipcode or
   postal code), and country elements, e.g.,

       <postal>
           <street>660 York Street</street>
           <street>M/S 40</street>
           <city>San Francisco</city> <region>CA</region>
           <code>94110</code>
           <country>US</country>
       </postal>

   This flexibility is provided to allow for different national formats
   for postal addresses.  Note however, that although the order of the
   city, region, code, and country elements isn't specified, at most one
   of each may be present.  Regardless, these elements must not be re-
   ordered during processing by an XML application (e.g., display
   applications must preserve the ordering of the information contained
   in these elements).  Finally, the value of the country element should
   be a two-letter code from ISO 3166.



Rose                                                            [Page 7]

                Writing I-Ds and RFCs using XML (revised)  February 2008


   The phone, facsimile, email, and uri elements are simple, e.g.,

       <phone>+1 916 555 1234</phone>
       <email>fred@example.com</email>
       <uri>http://example.com/</uri>

2.2.3.  The date Element

   The date element identifies the publication date of the document.  It
   consists of a month and a year, e.g.,

       <date month='February' year='1999' />

   The date element also has an optional day attribute.  (Actually, due
   to popular demand, all three attributes are optional.)

2.2.4.  Meta Data Elements

   The front element may contain meta data -- the content of these
   elements does not appear in printed versions of the document.

   A document has one or more optional area, workgroup, and keyword
   elements, e.g.,

       <area>General</area>
       <workgroup>RFC Beautification Working Group</workgroup>
       <keyword>RFC</keyword>
       <keyword>Request for Comments</keyword>
       <keyword>I-D</keyword>
       <keyword>Internet-Draft</keyword>
       <keyword>XML</keyword>
       <keyword>Extensible Markup Language</keyword>

   The area elements identify a general category for the document (e.g.,
   one of "Applications", "General", "Internet", "Management",
   "Operations", "Routing", "Security", "Transport", or "User"), while
   the workgroup elements identify the IETF working groups that produced
   the document, and the keyword elements identify useful search terms.













Rose                                                            [Page 8]

                Writing I-Ds and RFCs using XML (revised)  February 2008


2.2.5.  The abstract Element

   A document may have an abstract element, which contains one or more t
   elements (Section 2.3.1.1).  In general, only a single t element is
   present, e.g.,

       <abstract>
           <t>This memo presents a technique for using XML
           (Extensible Markup Language) as a source format
           for documents in the Internet-Drafts (I-Ds) and
           Request for Comments (RFC) series.</t>
       </abstract>

2.2.6.  The note Element

   A document may have one or more note elements, each of which contains
   one or more t elements (Section 2.3.1.1).  There is a mandatory title
   attribute.  In general, the note element contains text from the IESG,
   e.g.,

       <note title='IESG Note'>
           <t>The IESG has something to say.</t>
       </note>

2.2.7.  Status, Copyright Notice, Table of Contents

   Note that text relating to the memo's status, copyright notice, or
   table of contents is not included in the document's markup -- this is
   automatically inserted by an XML application when it produces either
   a text or HTML version of the document.

2.2.7.1.  Conformance with RFC 3978

   If an Internet-Draft is being produced, then the ipr attribute should
   be present in the "<rfc>" tag at the beginning of the file.  The
   value of the attribute should be one of: "full3978",
   "noModification3978", or "noDerivatives3978".  For the latter two
   options, an additional attribute, iprExtract, will be consulted.  If
   present, its value is an anchor that is used to cross-reference the
   section of the document that may be extracted as-is for separate use.

   Consult [3] for further details.

   If the Internet-Draft is being submitted to an automated process,
   then the docName attribute should be present in the <rfc> tag at the
   beginning of the file.  The value of this attribute contains the
   document (not file) name associated with this Internet-Draft, e.g.,




Rose                                                            [Page 9]

                Writing I-Ds and RFCs using XML (revised)  February 2008


       <rfc ipr='full3978' docName='draft-mrose-writing-rfcs-01'>
           ...
       </rfc>

   Finally, an xml:lang attribute may be present to indicate that the
   document is written in some language other than English (for writing
   things other than RFCs).












































Rose                                                           [Page 10]

                Writing I-Ds and RFCs using XML (revised)  February 2008


2.2.8.  Everything in the Front

   So, putting it all together, we have, e.g.,

       <front>
           <title>Writing I-Ds and RFCs using XML</title>

           <author initials='F.J.' surname='Flintstone'
                   fullname='Frederick Flintstone'>
               <organization>Slate Construction, Inc.</organization>

               <address>
                   <postal>
                       <street>660 York Street</street>
                       <street>M/S 40</street>
                       <city>San Francisco</city> <region>CA</region>
                       <code>94110</code>
                       <country>US</country>
                   </postal>

                   <phone>+1 916 555 1234</phone>
                   <email>fred@example.com</email>
                   <uri>http://example.com/</uri>
               </address>
           </author>

           <date month='February' year='1999' />

           <area>General</area>
           <workgroup>RFC Beautification Working Group</workgroup>
           <keyword>RFC</keyword>
           <keyword>Request for Comments</keyword>
           <keyword>I-D</keyword>
           <keyword>Internet-Draft</keyword>
           <keyword>XML</keyword>
           <keyword>Extensible Markup Language</keyword>
           <abstract>
               <t>This memo presents a technique for using XML
               (Extensible Markup Language) as a source format
               for documents in the Internet-Drafts (I-Ds) and
               Request for Comments (RFC) series.</t>
           </abstract>
       </front>








Rose                                                           [Page 11]

                Writing I-Ds and RFCs using XML (revised)  February 2008


2.3.  The Middle

   Note well:  Although this draft refers to the appendix element, the
               text referring to that element is entirely speculative
               (until such time as this advisory is removed).

   The middle element contains all the sections of the document except
   for the bibliography and the boilerplate:

       ...
       </front>
       <middle>
           <section ...>
           <section ...>
           <section ...>
           <appendix ...>
           <appendix ...>
       </middle>
       <back>
       ...

   The middle element consists of one or more section elements,
   optionally followed by one or more appendix elements, optionally
   followed by one or more section elements.

2.3.1.  The section Element

   Each section element contains a section of the document.  There is a
   mandatory attribute, title, that identifies the title of the section.
   There are also two optional attributes, anchor, that is used for
   cross-referencing with the xref element (Section 2.3.1.5), e.g.,

       <section anchor='intro' title='Introduction'>
           ...
       </section>


   and the toc attribute, which is used to indicate whether the section
   should appear in the table of contents.  (The choices are "exclude",
   "include", and "default").











Rose                                                           [Page 12]

                Writing I-Ds and RFCs using XML (revised)  February 2008


   The section element is recursive -- each contains any number and
   combination of t, figure, texttable, iref, and section elements,
   e.g.,

       <section title='The Middle'>
           ...
           <section title='The section Element'>
               ...
               <section title='The t Element'>...</section>
               <section title='The list Element'>...</section>
               <section title='The figure Element'>...</section>
               <section title='The texttable Element'>...</section>
               <section title='The xref Element'>...</section>
               <section title='The eref Element'>...</section>
               <section title='The iref Element'>...</section>
               <section title='The cref Element'>...</section>
               <section title='The spanx Element'>...</section>
               <section title='The vspace Element'>...</section>
           </section>
       </section>

   Note that the section element is tail-recursive.

2.3.1.1.  The t Element

   Paragraphs are contained in t elements.  A paragraph can consist of
   text, lists, figures, and other t element-delimited paragraphs, in
   any number or combination.

   If a cross-reference is needed to a section, figure, table, or
   reference, the xref element (Section 2.3.1.5) is used; similarly, if
   an external-reference is needed, the eref element (Section 2.3.1.6)
   is used.  Indexing of text is provided by the the iref element
   (Section 2.3.1.7).

   Note well:  Although RFC2629 allows the figure element to be nested
               within the t element, authors are strongly encouraged to
               avoid this usage -- it is always preferable to place the
               figure element as a direct subordinate of the section
               element.











Rose                                                           [Page 13]

                Writing I-Ds and RFCs using XML (revised)  February 2008


2.3.1.2.  The list Element

   The list element contains one or more items.  Each item is a t
   element, allowing for recursion, e.g.,

       <list style='numbers'>
           <t>The first item.</t>
           <t>The second item, which contains two bulleted sub-items:
               <list style='symbols'>
                   <t>The first sub-item.</t>
                   <t>The second sub-item.</t>
               </list>
           </t>
       </list>

   The list element has an optional attribute, style, having the value
   "numbers" (for numeric lists), "letters" (for alphabetic lists),
   "symbols" (for bulleted lists), "hanging" (for hanging lists),
   "format" (for auto-formatted lists), or, "empty" (for indented text).
   If a list element is nested, the default value is taken from its
   closest parent; otherwise, the default value is "empty".

   When nested within a hanging list element, the t element has an
   optional attribute, hangText that specifies the text to be inserted,
   e.g.,

       <list style='hanging'>
           <t hangText="counter:">the "counting designation" is
           rendered
           (e.g., "2.1" or "A.2");</t>

           <t hangText="title:">the title attribute of the
           corresponding element is rendered
           (e.g., "XML Basics");</t>

           <t hangText="none:">no additional designation is rendered;
           or,</t>

           <t hangText="default:">a suitable designation is rendered,
           e.g., "Section 2.1" or
           "&lt;a href='#xml_basics'>XML Basics&lt;/a>"
           (the default).</t>
       </list>








Rose                                                           [Page 14]

                Writing I-Ds and RFCs using XML (revised)  February 2008


   The style attribute value for an auto-formatted list starts with the
   seven letters "format ", and is followed by a string which must
   contain exactly one instance of "%d" and "%c".  Hanging text is
   automatically generated for each nested t element, e.g.,

       <list style='format R%d:'>
           <t>Text for R1.</t>

           <t>Text for R2.</t>
       </list>
       ...
       <list style='format Directive %c:'>
           <t>Text for Directive A.</t>

           <t>Text for Directive B.</t>
       </list>
       ...
       <list style='format R%d:'>
           <t>Text for R3.</t>
       </list>

   If the list is auto-formatted, then the optional counter attribute is
   consulted, which controls the numbering.  By default, the value of
   this attribute is the same as the formatting string, e.g.,

       <list style='format R%d:' counter='Requirements'>
           <t>Text for R1.</t>

           <t>Text for R2.</t>
       </list>
       ...
       <list style='format Directive %c:' counter='Directives'>
           <t>Text for Directive A.</t>

           <t>Text for Directive B.</t>
       </list>
       ...
       <list style='format R%d:' counter='Requirements'>
           <t>Text for R3.</t>
       </list>











Rose                                                           [Page 15]

                Writing I-Ds and RFCs using XML (revised)  February 2008


   If the style attribute has the value "hanging" or "format", then a
   second, optional, attribute called hangIndent is consulted.  This
   overrides the default indentation used for the text of each t
   element, ensuring that each t element has the same indentation, e.g.,

       <list style='format R%d:' hangIndent='5'>
           <t>Text for R1.</t>

           <t>Text for R2.</t>

           ...

           <t>Text for R12.</t>
       </list>

   The final item will read "R12: Text for R12."

2.3.1.3.  The figure Element

   The figure element groups an optional preamble element, an artwork
   element, and an optional postamble element together.  The figure
   element also has an optional anchor attribute that is used for cross-
   referencing with the xref element (Section 2.3.1.5).  There is also
   an optional title attribute that identifies the title of the figure.

   The preamble and postamble elements, if present, are simply text.  If
   a cross-reference is needed to a section, figure, table, or
   reference, the xref element (Section 2.3.1.5) is used; similarly, if
   an external-reference is needed, the eref element (Section 2.3.1.6)
   is used.  Indexing of text is provided by the the iref element
   (Section 2.3.1.7).

   The artwork element, which must be present, contains "ASCII artwork".
   Unlike text contained in the t, preamble, or postamble elements, both
   horizontal and vertical whitespace is significant in the artwork
   element.















Rose                                                           [Page 16]

                Writing I-Ds and RFCs using XML (revised)  February 2008


   So, putting it all together, we have, e.g.,

       <figure anchor='figure_example'>
           <preamble>So,
           putting it all together, we have, e.g.,</preamble>
           <artwork>
               ascii artwork goes here...

               be sure to use "&lt;" or "&amp;" instead of "<" and "&",
               respectively!
           </artwork>
           <postamble>which is a very simple example.</postamble>
       </figure>

   which is a very simple example.

   If you have artwork with a lot of "<" characters, then there's an XML
   trick you can use:

       <figure>
           <preamble>If you have artwork with a lot of "&lt;"
           characters, then there's an XML trick you can
           use:</preamble>
           <artwork><![CDATA[
               ascii artwork goes here...

               just don't use "]]" in your artwork!
           ]]></artwork>
           <postamble>The "&lt;![CDATA[ ... ]]>" construct is called
           a CDATA block -- everything between the innermost brackets
           is left alone by the XML application.</postamble>
       </figure>

   The <![CDATA[ ... ]]> construct is called a CDATA block -- everything
   between the innermost brackets is left alone by the XML application.

   Because the figure element represents a logical grouping of text and
   artwork, an XML application producing a text version of the document
   should attempt to keep these elements on the same page.  Because RFC
   2223 [2] allows no more than 69 characters by 49 lines of content on
   each page, XML applications should be prepared to prematurely
   introduce page breaks to allow for better visual grouping.

   Finally, the artwork element has two optional attributes: name and
   type.  The former is used to suggest a filename to use when storing
   the content of the artwork element, whilst the latter contains a
   suggestive data-typing for the content.




Rose                                                           [Page 17]

                Writing I-Ds and RFCs using XML (revised)  February 2008


2.3.1.4.  The texttable Element

   The texttable element groups an optional preamble element, one or
   more ttcol elements, zero or more c elements, and an optional
   postamble element together.  The texttable element also has an
   optional anchor attribute that is used for cross-referencing with the
   xref element (Section 2.3.1.5).  There is also an optional title
   attribute that identifies the title of the table.

   The preamble and postamble elements have already been described in
   Section 2.3.1.3.

   The ttcol element, of which at least one must be present, defines a
   column header for the table, along with the desired width and
   alignment for the column:

   o  the optional width attribute, if present, indicates the desired
      amount of horizontal space taken by the column, and is expressed
      as a percentage (e.g., "30%"), and the remaining space is divided
      equally among all columns for which the width is unspecified; and,

   o  the optional align attribute, if present indicates whether the
      column should be justified to the "left", "center", or "right".

   The c element, is present for each cell in the table, and contains
   text along with the usual cross-reference and indexing elements.

   So, putting it all together, we have, e.g.,

       <texttable anchor='table_example'>
           <preamble>So,
           putting it all together, we have, e.g.,</preamble>
           <ttcol align='center'>ttcol #1</ttcol>
           <ttcol align='center'>ttcol #2</ttcol>
           <c>c #1</c>
           <c>c #2</c>
           <c>c #3</c>
           <c>c #4</c>
           <c>c #5</c>
           <c>c #6</c>
           <postamble>which is a very simple example.</postamble>
       </texttable>

   which is a very simple example.







Rose                                                           [Page 18]

                Writing I-Ds and RFCs using XML (revised)  February 2008


                So, putting it all together, we have, e.g.,

                          +----------+----------+
                          | ttcol #1 | ttcol #2 |
                          +----------+----------+
                          |   c #1   |   c #2   |
                          |          |          |
                          |   c #3   |   c #4   |
                          |          |          |
                          |   c #5   |   c #6   |
                          +----------+----------+

                      which is a very simple example.

   As with the figure element, the texttable element represents a
   logical grouping of text, hence an XML application producing a text
   version of the document should attempt to keep these elements on the
   same page.

2.3.1.5.  The xref Element

   The xref element is used to cross-reference sections, figures,
   tables, and references.  The mandatory target attribute is used to
   link back to the anchor attribute of the section, figure, and
   reference elements.  The value of the anchor and target attributes
   should be formatted according to the token syntax in Section 2.1.

   If used as an empty element, e.g.,

       according to the token syntax in <xref target='xml_basics' />.

   then the XML application inserts an appropriate phrase during
   processing.

   What's "appropriate" depends on the value of the optional format
   attribute.  There are four possible values:

   counter:  the "counting designation" is rendered (e.g., "2.1" or
      "A.2");

   title:  the title attribute of the corresponding element is rendered
      (e.g., "XML Basics");

   none:  no additional designation is rendered; or,







Rose                                                           [Page 19]

                Writing I-Ds and RFCs using XML (revised)  February 2008


   default:  a suitable designation is rendered, e.g., "Section 2.1" or
      "<a href='#xml_basics'>XML Basics</a>" (the default).

   If used with content, e.g.,

       conforming to <xref target='RFC2223'>RFC 2223</xref>.

   then the XML application inserts an appropriate designation during
   processing, such as "RFC 2223[2]" or "<a href='#refs.RFC2223'>RFC
   2223</a>".  Although the XML application decides what "an appropriate
   designation" might be, its choice is consistent throughout the
   processing of the document.

2.3.1.6.  The eref Element

   The eref element is used to reference external documents.  The
   mandatory target attribute is a URI [6], e.g.,

       <eref target='http://www.ibiblio.org/xml/'>Cafe con Leche</eref>

   Note that while the target attribute is always present, the eref
   element may be empty, e.g.,

       <eref target='http://example.com/' />

   and the XML application inserts an appropriate designation during
   processing such as "[9]" or "<a
   href='http://example.com/'>http://example.com/</a>".

2.3.1.7.  The iref Element

   The iref element is used to add information to an index, typically
   rendered at the end of the document.  The mandatory item attribute is
   the primary key the information is stored under, whilst the optional
   subitem attribute is the secondary key, e.g.,

       <iref item='indexing' subitem='how to' />

   The optional primary attribute can be used to indicate that this
   particular indexing entry should be considered "primary".

   Finally, note that the iref element is always empty -- it never
   contains any text.

2.3.1.8.  The cref Element

   The cref element is used to add commentary information to a draft
   being written, typically rendered at the end of the document.  The



Rose                                                           [Page 20]

                Writing I-Ds and RFCs using XML (revised)  February 2008


   element's character data contains the comment, and the optional
   source attribute can be used for attribute.

   One or more processing directives are used to indicate whether the
   commentary information should be rendered, and if so, whether it
   should be rendered inline or in a separate section at the end of the
   document.

2.3.1.9.  The spanx Element

   The spanx element, which may occur only inside the t element, is used
   by the author to provide formatting guidance to the XML application.
   There is an attribute, style, that indicates how the text inside the
   element should be rendered.  (Note that leading and trailing
   whitespace is significant.)

   At this time, the list of possible values for the style isn't
   enumerated, but implementations should, at a minimum, support:

         emph:  indicates emphasis;

       strong:  indicates stronger emphasis; and,

         verb:  indicates sample input for programs.

2.3.1.10.  The vspace Element

   The vspace element, which may occur only inside the t element, is
   used by the author to provide formatting guidance to the XML
   application.  There is an attribute, blankLines, that indicates the
   number of blank lines that should be inserted.  A physical linebreak
   is specified by using the default value, "0".

   In addition, the vspace element can be used to force a new physical
   paragraph within a list item, e.g.,

       <list style='numbers'>
           <t>This is list item.
              <vspace blankLines='1' />
              This is part of the same list item,
              although when displayed, it appears
              as a separate physical paragraph.</t>
       </list>

   An XML application producing a text version of the document should
   exercise care when encountering a value for blankLines that causes a
   pagebreak -- in particular, if a vspace element causes a pagebreak,
   then no further blank lines should be inserted.  This allows authors



Rose                                                           [Page 21]

                Writing I-Ds and RFCs using XML (revised)  February 2008


   to "force" a pagebreak by using an arbitrarily large value, e.g.,
   "blankLines='100'".

   Finally, note that the vspace element is always empty -- it never
   contains any text.

2.3.2.  The appendix Element

   The appendix element is identical to the the section element
   (Section 2.3.1).  It has the same attributes (the mandatory title and
   the optional anchor).

   As with the section element, it is tail-recursive -- each appendix
   element contains any number and combination of t, figure, texttable,
   iref, and appendix elements.

2.4.  Back matter

   Finally, the back element is used for references:

           ...
           </middle>
           <back>
               <references>
                   <reference ...>
                   <reference ...>
               </references>
               <section ...>
               <section ...>
           </back>
       </rfc>

   The back element consists of zero or more references elements, and,
   one or more optional section elements.  The back element itself is
   optional, if your document doesn't have any references or appendices,
   you don't have to include it.

2.4.1.  The references Element

   The references element contains the document's bibliography.  The
   optional title attribute defaults to "References", if not present.
   This element contains one or more reference elements.

   Each reference element contains a front element, one or more optional
   seriesInfo elements, one or more optional format elements, and one or
   more optional annotation elements.

   We've already discussed the front element back in Section 2.2.



Rose                                                           [Page 22]

                Writing I-Ds and RFCs using XML (revised)  February 2008


   The seriesInfo element has two attributes, name and value that
   identify the document series and series entry, respectively.

   The reference element has an optional anchor attribute that is used
   for cross-referencing with the xref element (Section 2.3.1.5), e.g.,

       <reference anchor='RFC2200'>
           <front>
               <title>Internet Official Protocol Standards</title>
               <author initials='J.' surname='Postel'
                       fullname='Jon Postel'>
                   <organization abbrev='ISI'>
                   USC/Information Sciences Institute
                   </organization>
               </author>

               <date month='June' year='1997' />
           </front>
           <seriesInfo name='RFC' value='2200' />
           <seriesInfo name='STD' value='1' />
           <format type='TXT' octets='94506'
                   target='ftp://ftp.isi.edu/in-notes/rfc2200.txt' />
       </reference>

   The format element has a mandatory type attribute (typically having
   the value "TXT"), and two optional elements

   o  octets, which indicates the size in octets of the formatted
      document; and,

   o  target, which is an external to the formatted document.

   The reference element also has an optional target attribute that is
   used for external references (c.f., Section 2.3.1.6).  The XML
   application, if producing an HTML version of the document will use
   the target attribute accordingly; however, if the name attribute of
   the seriesInfo element has the value "RFC", then the XML application
   should automatically provide an appropriate default for the target
   attribute (e.g., "http://example.com/in-notes/rfc2200.txt").

   Finally, the annotation element may be used to annotate a citation.
   Zero or more annotations may be present, and each contains text along
   with the usual cross-reference and indexing elements.

2.4.2.  Appendices

   To include appendices after the bibliography, simply add more section
   elements.



Rose                                                           [Page 23]

                Writing I-Ds and RFCs using XML (revised)  February 2008


2.4.3.  Copyright Status

   The copyright status for the document is not included in the
   document's markup -- this is automatically inserted by an XML
   application that produces either a text or HTML version of the
   document.













































Rose                                                           [Page 24]

                Writing I-Ds and RFCs using XML (revised)  February 2008


3.  Processing the XML Source File

   This section concerns itself with applications that operate on an XML
   source file.  A lot of XML tools are available, as are many lists of
   XML resources, e.g., Cafe con Leche [9].

   There are two kinds of XML tools: validating and non-validating.
   Both check that the source file conforms to the rules given in
   Section 2.1.  However, in addition to making sure that the source
   file is well-formed, a validating tool also reads the DTD referenced
   by the source file to make sure that they match.  There are a number
   of both validating and non-validating tools available.

3.1.  Editing

   There are several XML editors available.  Ideally, you want an editor
   that validates.  This has two advantages:

   o  the editor provides guidance in fleshing-out the document
      structure; and,

   o  the editor validates that the source file matches the rules in the
      DTD.

   There are three major modes in Emacs that support XML: nxml [10],
   tdtd [11], and psgml [12].  The author uses nxml mode, which has a
   built in XML validator.  The psgml mode allows you to validate the
   source file (by calling an external program).  If you visit the
   source file in Emacs and the major mode isn't "SGML" or "XML", then
   usually all it takes is adding these lines to your ".emacs" file:

       (setq auto-mode-alist
             (cons (cons "\\.xml$" 'sgml-mode) auto-mode-alist))

   and then restarting Emacs.  If this doesn't work, try one of the
   sources above.

   The author uses both sgml-mode in Emacs, and a commercial validating
   editor, XML Spy [13], when editing source files.

3.1.1.  Checking

   If your editor doesn't validate, then you should run a program to
   validate the source file.

   The author uses the AlphaWorks XML parser [14] for this purpose.  It
   requires that your system have a Java virtual machine.  In addition
   to Java, there are validating parsers written in C, Perl, Python, and



Rose                                                           [Page 25]

                Writing I-Ds and RFCs using XML (revised)  February 2008


   Tcl.

3.2.  Converting to Text Format

   The author has written the xml2rfc tool [15], which reads the source
   file and produces both text, HTML, and nroff versions of the
   document.  (This memo was produced using the xml2rfc tool.)  The
   xml2rfc tool doesn't validate; however, a web-based service is also
   available at the same location, which runs a validator prior to
   invoking the tool.

3.3.  Converting to HTML Format

   Extensible Style Language [7] (XSLT) is used to describe
   transformations from the source file into some other structured file.
   So, you can use an XSLT-capable formatter to convert an XML source
   file to HTML.

   Julian Reschke has written an XSLT file [16] for the format described
   in this memo.  It requires one of the MSXML, Saxon, or Xalan
   extensions to XSLT.  For example, by including the line:

   <?xml-stylesheet type='text/xsl'
                href='http://xml.resource.org/authoring/rfc2629.xslt' ?>

   after the XML declaration in your source file, IE6 will render the
   file as HTML.

3.4.  Searching

   As with text editors, any text-oriented search tool (e.g., grep) can
   be used on the source file.  However, there are search tools
   available that understand structured source.

   The author uses sgrep version 1.9 [17] for this purpose, e.g.

       sgrep -g xml 'ELEMENTS("title") not in ELEMENTS("back")' \
           writing-rfcs.xml

   which extracts the title element from the source file.











Rose                                                           [Page 26]

                Writing I-Ds and RFCs using XML (revised)  February 2008


Appendix A.  The rfc Element

   The <rfc> tag at the beginning of the file, with only an ipr
   attribute (Section 2.2.7.1), produces an Internet-Draft.  However,
   when other attributes are added to this tag by the RFC editor, an RFC
   is produced, e.g.,

       <rfc number='2200'
            obsoletes='2000, 1920, 1880, 1800, ...'
            category='std'
            seriesNo='1'>

   At a minimum, the number attribute should be present.

   The other attributes are:

   o  obsoletes, having a comma-separated list of RFC numbers, that the
      document obsoletes;

   o  updates, having a comma-separated list of RFC numbers, that the
      document updates;

   o  category, having one of these values:

      1.  "std", for a Standards-Track document;

      2.  "bcp", for a Best Current Practices document;

      3.  "exp", for an Experimental Protocol document;

      4.  "historic", for a historic document; or,

      5.  "info", the default, for an Informational document.

   o  seriesNo, having the corresponding number in the STD ("std"), BCP
      ("bcp"), or FYI ("info") series.

   Finally, a special entity, "&rfc.number;", is available.  Authors
   preparing an RFC should use this entity whenever they want to
   reference the number of the RFC within the document itself.  In
   printed versions of the document, the appropriate substitution (or
   "XXXX") will occur.









Rose                                                           [Page 27]

                Writing I-Ds and RFCs using XML (revised)  February 2008


Appendix B.  The DTD

<!--
  revised DTD for the RFC document series, draft of 2008-02-01
  -->


<!--
  Typical invocation:
      <!DOCTYPE rfc PUBLIC "-//IETF//DTD RFC 2629//EN"
                "http://xml.resource.org/authoring/rfc2629.dtd" [
        ... dtd subset ...
      ]>
    or
      <!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
        ... dtd subset ...
      ]>
  -->


<!--
  Contents

    Character entities

    DTD data types

    The top-level

    Front matter

    The Body

    Back matter
  -->


<!--
  Character entities
  -->


<!ENTITY % rfc2629-xhtml
         PUBLIC "-//IETF//ENTITIES XHTML subset for RFC 2629//EN"
                "rfc2629-xhtml.ent">
%rfc2629-xhtml;

<!ENTITY % rfc2629-other



Rose                                                           [Page 28]

                Writing I-Ds and RFCs using XML (revised)  February 2008


         PUBLIC "-//IETF//ENTITIES Other for RFC 2629//EN"
                "rfc2629-other.ent">
%rfc2629-other;


<!--
  DTD data types:

        entity        description
        ======        ===============================================
        NUMBER        [0-9]+
        NUMBERS       a comma-separated list of NUMBER

        DAY           the day of the month, e.g., "1"
        MONTH         the month of the year, e.g., "January"
        YEAR          a four-digit year, e.g., "1999"

        URI           e.g., "http://invisible.net/"

        ATEXT/CTEXT   printable ASCII text (no line-terminators)

        TEXT          character data
  -->


<!ENTITY % NUMBER     "CDATA">
<!ENTITY % NUMBERS    "CDATA">

<!ENTITY % DAY        "CDATA">
<!ENTITY % MONTH      "CDATA">
<!ENTITY % YEAR       "CDATA">

<!ENTITY % URI        "CDATA">

<!ENTITY % ATEXT      "CDATA">
<!ENTITY % CTEXT      "#PCDATA">

<!ENTITY % TEXT       "#PCDATA">

<!ENTITY   rfc.number "XXXX">


<!--
  The top-level
  -->


<!--



Rose                                                           [Page 29]

                Writing I-Ds and RFCs using XML (revised)  February 2008


  attributes for the "rfc" element are supplied by the RFC
  editor. when preparing drafts, authors should leave them blank.

  the "seriesNo" attribute is used if the category is, e.g., BCP.
  -->
<!ELEMENT rfc         (front,middle,back?)>
<!ATTLIST rfc
          number      %NUMBER;           #IMPLIED
          obsoletes   %NUMBERS;          ""
          updates     %NUMBERS;          ""
          category    (std|bcp|info|exp|historic)
                                         #IMPLIED
          seriesNo    %NUMBER;           #IMPLIED
          ipr         (full2026|noDerivativeWorks2026|none
                      |full3667|noModification3667|noDerivatives3667
                      |full3978|noModification3978|noDerivatives3978)
                                         #IMPLIED
          iprExtract  IDREF              #IMPLIED
          submissionType
                      (IETF|independent) "IETF"
          docName     %ATEXT;            #IMPLIED
          xml:lang    %ATEXT;            "en">


<!--
  Front matter
  -->


<!ELEMENT front       (title,author+,date,area*,workgroup*,keyword*,
                       abstract?,note*)>

<!-- the "abbrev" attribute is used for headers, etc. -->
<!ELEMENT title       (%CTEXT;)>
<!ATTLIST title
          abbrev      %ATEXT;            #IMPLIED>

<!ELEMENT author      (organization,address?)>
<!ATTLIST author
          initials    %ATEXT;            #IMPLIED
          surname     %ATEXT;            #IMPLIED
          fullname    %ATEXT;            #IMPLIED
          role        (editor)           #IMPLIED>

<!ELEMENT organization
                      (%CTEXT;)>
<!ATTLIST organization
          abbrev      %ATEXT;            #IMPLIED>



Rose                                                           [Page 30]

                Writing I-Ds and RFCs using XML (revised)  February 2008


<!ELEMENT address     (postal?,phone?,facsimile?,email?,uri?)>

<!-- this content model should be more strict:
     at most one of each the city, region, code, and country
     elements may be present -->
<!ELEMENT postal      (street+,(city|region|code|country)*)>
<!ELEMENT street      (%CTEXT;)>
<!ELEMENT city        (%CTEXT;)>
<!ELEMENT region      (%CTEXT;)>
<!ELEMENT code        (%CTEXT;)>
<!ELEMENT country     (%CTEXT;)>
<!ELEMENT phone       (%CTEXT;)>
<!ELEMENT facsimile   (%CTEXT;)>
<!ELEMENT email       (%CTEXT;)>
<!ELEMENT uri         (%CTEXT;)>

<!ELEMENT date        EMPTY>
<!ATTLIST date
          day         %DAY;              #IMPLIED
          month       %MONTH;            #IMPLIED
          year        %YEAR;             #IMPLIED>

<!-- meta-data... -->
<!ELEMENT area        (%CTEXT;)>
<!ELEMENT workgroup   (%CTEXT;)>
<!ELEMENT keyword     (%CTEXT;)>

<!ELEMENT abstract    (t)+>
<!ELEMENT note        (t)+>
<!ATTLIST note
          title       %ATEXT;            #REQUIRED>


<!--
  The body
  -->


<!-- later on, may be (section+,appendix*,section*) -->
<!ELEMENT middle      (section+)>

<!ELEMENT section     ((t|figure|texttable|iref)*,section*)>
<!ATTLIST section
          anchor      ID                 #IMPLIED
          title       %ATEXT;            #REQUIRED
          toc         (include|exclude|default)
                                         "default">




Rose                                                           [Page 31]

                Writing I-Ds and RFCs using XML (revised)  February 2008


<!--
<!ELEMENT appendix    ((t|figure|texttable|iref)*,appendix*)>
<!ATTLIST appendix
          anchor      ID                 #IMPLIED
          title       %ATEXT;            #REQUIRED
          toc         (include|exclude|default)
                                         "default">
  -->

<!-- use of <figure/> is deprecated... -->
<!ELEMENT t      (%TEXT;|list|figure|xref|eref|iref|cref|spanx|vspace)*>
<!ATTLIST t
          anchor      ID                 #IMPLIED
          hangText    %ATEXT;            #IMPLIED>

<!-- the value of the style attribute is inherited from the closest
     parent -->
<!ELEMENT list        (t+)>
<!ATTLIST list
          style       %ATEXT;            #IMPLIED
          hangIndent  %NUMBER;           #IMPLIED
          counter     %ATEXT;            #IMPLIED>

<!ELEMENT xref        (%CTEXT;)>
<!ATTLIST xref
          target      IDREF              #REQUIRED
          pageno      (true|false)       "false"
          format      (counter|title|none|default)
                                         "default">

<!ELEMENT eref        (%CTEXT;)>
<!ATTLIST eref
          target      %URI;              #REQUIRED>

<!ELEMENT iref        EMPTY>
<!ATTLIST iref
          item        %ATEXT;            #REQUIRED
          subitem     %ATEXT;            ""
          primary    (true|false)       "false">

<!ELEMENT cref        (%CTEXT;)>
<!ATTLIST cref
          anchor      ID                 #IMPLIED
          source      %ATEXT;            #IMPLIED>

<!ELEMENT spanx       (%CTEXT;)>
<!ATTLIST spanx
          xml:space   (default|preserve) "preserve"



Rose                                                           [Page 32]

                Writing I-Ds and RFCs using XML (revised)  February 2008


          style       %ATEXT;            "emph">

<!ELEMENT vspace      EMPTY>
<!ATTLIST vspace
          blankLines  %NUMBER;           "0">

<!ELEMENT figure      (iref*,preamble?,artwork,postamble?)>
<!ATTLIST figure
          anchor      ID                 #IMPLIED
          title       %ATEXT;            ""
          suppress-title (true|false)    "false"
          src         %URI;              #IMPLIED
          align       (left|center|right) "left"
          alt         %ATEXT;            ""
          width       %ATEXT;            ""
          height      %ATEXT;            "">

<!ELEMENT preamble    (%TEXT;|xref|eref|iref|cref|spanx)*>
<!ELEMENT artwork     (%TEXT;)*>
<!ATTLIST artwork
          xml:space   (default|preserve) "preserve"
          name        %ATEXT;            ""
          type        %ATEXT;            ""
          src         %URI;              #IMPLIED
          align       (left|center|right) "left"
          alt         %ATEXT;            ""
          width       %ATEXT;            ""
          height      %ATEXT;            "">

<!ELEMENT postamble   (%TEXT;|xref|eref|iref|cref|spanx)*>

<!ELEMENT texttable   (preamble?,ttcol+,c*,postamble?)>
<!ATTLIST texttable
          anchor      ID                 #IMPLIED
          title       %ATEXT;            ""
          suppress-title (true|false)    "false"
          align       (left|center|right) "center"
          style       (all|none|headers|full) "full">
<!ELEMENT ttcol       (%CTEXT;)>
<!ATTLIST ttcol
          width       %ATEXT;            #IMPLIED
          align       (left|center|right) "left">
<!ELEMENT c           (%TEXT;|xref|eref|iref|cref|spanx)*>


<!--
  Back matter
  -->



Rose                                                           [Page 33]

                Writing I-Ds and RFCs using XML (revised)  February 2008


<!-- sections, if present, are appendices -->
<!ELEMENT back        (references*,section*)>

<!ELEMENT references  (reference+)>
<!ATTLIST references
          title       %ATEXT;            "References">
<!ELEMENT reference   (front,seriesInfo*,format*,annotation*)>
<!ATTLIST reference
          anchor      ID                 #IMPLIED
          target      %URI;              #IMPLIED>
<!ELEMENT seriesInfo  EMPTY>
<!ATTLIST seriesInfo
          name        %ATEXT;            #REQUIRED
          value       %ATEXT;            #REQUIRED>
<!ELEMENT format      EMPTY>
<!ATTLIST format
          target      %URI;              #IMPLIED
          type        %ATEXT;            #REQUIRED
          octets      %NUMBER;           #IMPLIED>
<!ELEMENT annotation  (%TEXT;|xref|eref|iref|cref|spanx)*>































Rose                                                           [Page 34]

                Writing I-Ds and RFCs using XML (revised)  February 2008


Appendix C.  Changes from RFC 2629

   The following changes were made from the format originally defined in
   RFC 2629 [8]:

   o  New elements:

      *  spanx

      *  texttable, ttcol, and c

      *  annotation

      *  cref

   o  New choices for enumerated attributes:

      rfc ipr:   "full3978", "noModification3978", and
         "noDerivatives3978"

      list style:   "letters"

      list style:   formatted (starts with "format")

   o  Previously mandatory attributes, now optional:

      date:   month, year

   o  New, optional attributes:

               rfc:   xml:lang, iprextract

            author:   role

            section:   toc

            list:   hangIndent (when "hanging" or formatted)

            list:   counter (when formatted)

          figure:   suppress-title

         artwork:   name, type

      references:   title






Rose                                                           [Page 35]

                Writing I-Ds and RFCs using XML (revised)  February 2008


            xref:   format

            iref:   primary

   o  Content model changes:

         section:  is now tail-recursive

      references:  may occur more than once in the back element (e.g.,
                   for normative and non-normative references)

          format:  may occur zero or more times in the reference element

          figure:  should not appear within a t element

            iref:  may appear directly within section and figure
                   elements


































Rose                                                           [Page 36]

                Writing I-Ds and RFCs using XML (revised)  February 2008


Appendix D.  Conformance with RFC 2026 or RFC 3667 (Historic)

   If an Internet-Draft is being produced in conformance with RFC 2026
   or RFC 3667, then the ipr attribute should be present in the "<rfc>"
   tag at the beginning of the file, and the value of the attribute
   should be one of:

   full2026:  indicating that the document is in full conformance with
      all the provisions of Section 10 of RFC 2026;

   noDerivativeWorks2026:  indicating that the document is in full
      conformance with all the provisions of Section 10 of RFC 2026
      except that the right to produce derivative works is not granted

   none:  indicating that the document is NOT offered in accordance with
      Section 10 of RFC 2026, and the author does not provide the IETF
      with any rights other than to publish as an Internet-Draft;

   full3667:  indicating that the document conforms with Section 5.1 of
      RFC 3667;

   noModification3667:  indicating that the document conforms with
      Sections 5.1 and 5.2(a) of RFC 3667; or,

   noDerivatives3667:  indicating that the document conforms with
      Sections 5.1 and 5.2(b) of RFC 3667.

   In the "none" case, a copyright notice will not be automatically
   inserted during processing by an XML application.

   Consult [4] and [5] for further details.




















Rose                                                           [Page 37]

                Writing I-Ds and RFCs using XML (revised)  February 2008


Appendix E.  Acknowledgements

   The author gratefully acknowledges the contributions of: Alan
   Barrett, Steven M. Bellovin, Scott Brim, Brad Burdick, Brian
   Carpenter, Steve Deering, Patrik Faltstrom, Jim Gettys, Charles
   Levert, Henrik Levkowetz, Carl Malamud, Chris Newman, Julian Reschke,
   Kurt Starsinic, and, Frank Strauss.












































Rose                                                           [Page 38]

                Writing I-Ds and RFCs using XML (revised)  February 2008


4.  Security Considerations

   According to [2], your document should contain a section near the end
   that discusses the security considerations of the protocol or
   procedures that are the main topic of your document, e.g.,

       <middle>
           ...
           <section title='Security Considerations'>
               <t>According to <xref target='RFC2223' />,
               your document should contain a section near the end
               that discusses the security considerations of the
               protocol or procedures that are the main topic of your
               document.</t>
           </section>
       </middle>

   The name attribute of the artwork element allows an author to suggest
   a filename to use when storing the element's content.  Any software
   processing this attribute must ensure that if it uses this filename
   that its contents will not be stored or interpreted, without the user
   explicitly initiating that action.  Accordingly, implementors must be
   aware to the potential hazards on their target systems.




























Rose                                                           [Page 39]

                Writing I-Ds and RFCs using XML (revised)  February 2008


5.  References

   [1]  Paoli, J., Maler, E., Bray, T., and C. Sperberg-McQueen,
        "Extensible Markup Language (XML) 1.0 (Second Edition)", World
        Wide Web Consortium FirstEdition REC-xml-20001006, October 2000,
        <http://www.w3.org/TR/2000/REC-xml-20001006>.

   [2]  Postel, J. and J. Reynolds, "Instructions to RFC Authors",
        RFC 2223, October 1997.

   [3]  Bradner, S., "IETF Rights in Contributions", BCP 78, RFC 3978,
        March 2005.

   [4]  Bradner, S., "The Internet Standards Process -- Revision 3",
        BCP 9, RFC 2026, October 1996.

   [5]  Bradner, S., "IETF Rights in Contributions", RFC 3667,
        February 2004.

   [6]  Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform
        Resource Identifiers (URI): Generic Syntax", RFC 2396,
        August 1998.

   [7]  Clark, J., "XSL Transformations (XSLT) Version 1.0", World Wide
        Web Consortium Recommendation REC-xslt-19991116, November 1999,
        <http://www.w3.org/TR/1999/REC-xslt-19991116>.

   [8]  Rose, M., "Writing I-Ds and RFCs using XML", RFC 2629,
        June 1999.

   [9]   <http://www.ibiblio.org/xml/>

   [10]  <http://www.thaiopensource.com/download/>

   [11]  <http://www.menteith.com/tdtd/>

   [12]  <http://www.lysator.liu.se/projects/about_psgml.html>

   [13]  <http://www.xmlspy.com/>

   [14]  <http://www.alphaworks.ibm.com/xml>

   [15]  <http://xml.resource.org/>

   [16]  <http://xml.resource.org/authoring/rfc2629.xslt>

   [17]  <http://www.cs.Helsinki.FI/u/jjaakkol/sgrep.html>




Rose                                                           [Page 40]

                Writing I-Ds and RFCs using XML (revised)  February 2008


Index

   I
      indexing
         how to  20














































Rose                                                           [Page 41]

                Writing I-Ds and RFCs using XML (revised)  February 2008


Author's Address

   Marshall T. Rose
   Dover Beach Consulting, Inc.
   POB 255268
   Sacramento, CA  95865-5268
   US

   Phone: +1 916 483 8878
   Email: mrose@dbc.mtview.ca.us









































Rose                                                           [Page 42]