-
Notifications
You must be signed in to change notification settings - Fork 0
/
rfc2629.xslt
executable file
·3001 lines (2535 loc) · 107 KB
/
rfc2629.xslt
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
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:exslt="http://exslt.org/common"
xmlns:myns="mailto:julian.reschke@greenbytes.de?subject=rcf2629.xslt"
xmlns:ed="http://greenbytes.de/2002/rfcedit"
exclude-result-prefixes="msxsl exslt myns ed"
>
<!--
XSLT transformation from RFC2629 XML format to HTML
Copyright (c) 2001-2004 Julian F. Reschke (julian.reschke@greenbytes.de)
placed into the public domain
change history:
2001-03-28 julian.reschke@greenbytes.de
Code rearranged, generate numbered section anchors for paragraphs (t)
as well. Fixes in index handling.
2001-04-12 julian.reschke@greenbytes.de
Moved HTML output into XHTML namespace.
2001-10-02 julian.reschke@greenbytes.de
Fixed default location for RFCs and numbering of section references.
Support ?rfc editing processing instruction.
2001-10-07 julian.reschke@greenbytes.de
Made telephone number links active.
2001-10-08 julian.reschke@greenbytes.de
Support for vspace element.
2001-10-09 julian.reschke@greenbytes.de
Experimental support for rfc-issue PI.
2001-11-11 julian.reschke@greenbytes.de
Support rfc private PI. Removed bogus code reporting the WG in the header.
2001-12-17 julian.reschke@greenbytes.de
Support title attribute on references element
2002-01-05 julian.reschke@greenbytes.de
Support for list/@style="@format"
2002-01-09 julian.reschke@greenbytes.de
Display "closed" RFC issues as deleted
2002-01-14 julian.reschke@greenbytes.de
Experimentally and optionally parse XML encountered in artwork elements
(requires MSXSL).
2002-01-27 julian.reschke@greenbytes.de
Some cleanup. Moved RFC issues from PIs into namespaced elements.
2002-01-29 julian.reschke@greenbytes.de
Added support for sortrefs PI. Added support for figure names.
2002-02-07 julian.reschke@greenbytes.de
Highlight parts of artwork which are too wide (72 characters).
2002-02-12 julian.reschke@greenbytes.de
Code rearrangement for static texts. Fixes for section numbering.
TOC generation rewritten.
2002-02-15 julian.reschke@greenbytes.de
Support for irefs in sections; support iref @primary=true
2002-03-03 julian.reschke@greenbytes.de
Moved anchor prefix into a constant. Added sanity checks on user anchor
names.
2002-03-23 julian.reschke@greenbytes.de
Bugfix in detection of matching org names when creating the header. Fixed
sorting in subitems.
2002-04-02 julian.reschke@greenbytes.de
Fix TOC link HTML generation when no TOC is generated (created broken
HTML table code).
2002-04-03 julian.reschke@greenbytes.de
Made rendering of references more tolerant re: missing parts.
2002-04-08 julian.reschke@greenbytes.de
Fixed reference numbering when references are split into separate sections.
2002-04-16 julian.reschke@greenbytes.de
Fix default namespace (shouldn't be set for HTML output method).
2002-04-19 julian.reschke@greenbytes.de
Lowercase internal CSS selectors for Mozilla compliance. Do not put TOC
into ul element.
2002-04-21 julian.reschke@greenbytes.de
Make numbered list inside numbered lists use alphanumeric numbering.
2002-05-05 julian.reschke@greenbytes.de
Updated issue/editing support.
2002-05-15 julian.reschke@greenbytes.de
Bugfix for section numbering after introduction of ed:replace
2002-06-21 julian.reschke@greenbytes.de
When producing private documents, do not include document status, copyright etc.
2002-07-08 julian.reschke@greenbytes.de
Fix xrefs to Appendices.
2002-07-19 fielding
Make artwork lightyellow for easier reading.
2002-10-09 fielding
Translate references title to anchor name to avoid non-uri characters.
2002-10-13 julian.reschke@greenbytes.de
Support for tocdepth PI.
2002-11-03 julian.reschke@greenbytes.de
Added temporariry workaround for Mozilla/Transformiix result tree fragment problem.
(search for 'http://bugzilla.mozilla.org/show_bug.cgi?id=143668')
2002-12-25 julian.reschke@greenbytes.de
xref code: attempt to uppercase "section" and "appendix" when at the start
of a sentence.
2003-02-02 julian.reschke@greenbytes.de
fixed code for vspace blankLines="0", enhanced display for list with "format" style,
got rid of HTML blockquote elements, added support for "hangIndent"
2003-04-10 julian.reschke@greenbytes.de
experimental support for appendix and spanx elements
2003-04-19 julian.reschke@greenbytes.de
fixed counting of list numbers in "format %" styles (one counter
per unique format string). Added more spanx styles.
2003-05-02 julian.reschke@greenbytes.de
experimental texttable support
2003-05-02 fielding
Make mailto links optional (default = none) (jre: default and PI name changed)
2003-05-04 julian.rechke@greenbytes.de
experimental support for HTML link elements; fix default for table header
alignment default
2003-05-06 julian.rechke@greenbytes.de
support for "background" PI.
2003-05-11 julian.reschke@greenbytes.de
change %c format to lowercase alphabetic. add support for keyword
elements (generate META tag). fix various HTML conformance problems.
added experimental support for role attribute. do not number paragraphs
in unnumbered sections. update boilerplate texts. support for
"iprnotified" PI. bugfix list numbering. strip whitespace when
building tel: URIs.
2003-05-12 julian.reschke@greenbytes.de
more conformance fixes (layout moved into CSS, move lists and figures
out of para content, do not use tables for list formatting)
2003-05-13 julian.reschke@greenbytes.de
add DC.Creator meta tag, refactoring
2003-05-16 julian.reschke@greenbytes.de
put nbsps between "section" and section number (xref).
2003-05-18 julian.reschke@greenbytes.de
author summary: add missing comma.
2003-06-06 julian.reschke@greenbytes.de
fix index generation bug (transposed characters in key generation). Enhance
sentence start detection (xref starting a section was using lowercase
"section").
2003-06-22 julian.reschke@greenbytes.de
exp. support for xref/@format. Add missing support for eref w/o content.
exp. support for annotations in reference elements. Code cleanup
reference table formatting.
2003-07-09 julian.reschke@greenbytes.de
Another fix for DC.Creator meta tag creation based on RFC2731
2003-07-24 julian.reschke@greenbytes.de
Fix namespace name for DC.Creator.
2003-08-06 julian.reschke@greenbytes.de
Cleanup node-set support (only use exslt (saxon, xalan, libxslt) extension
functions; remove Transformix workarounds that stopped to work in Moz 1.4)
2003-08-09 julian.reschke@greenbytes.de
Generate HTML lang tag.
2003-08-10 julian.reschke@greenbytes.de
Map spanx/verb to HTML "samp" element. Fix author name display in
references (reverse surname/initials for last author), add "Ed.".
Fix internal bookmark generation.
2003-08-17 julian.reschke@greenbytes.de
Add DCMI dates, identifiers and abstract. Add PI to suppress DCMI
generation. Do not add TOC entry to Copyright Statement when there is
none. Align RFC2629 PI names and parameter names. Change style for
inline URIs generated by eref. Add header and footer support.
Enhance CSS paging properties. Support topblock PI. Added hooks for
proper XHTML generation through separate XSLT. Enhance warning and
error messages. Add support for artwork image display. Table formatting
fixes (borders, thead continuation).
2003-08-18 julian.reschke@greenbytes.de
Add workaround for MSXML4 node-set and Mozilla node-set issues (fallback
just displays are warning).
2003-10-06 julian.reschke@greenbytes.de
Add workaround for broken pre/ins handling in Mozilla
(see <http://bugzilla.mozilla.org/show_bug.cgi?id=204401>). Make use
of cite attribute on ed:replace. CSS cleanup.
2003-10-08 julian.reschke@greenbytes.de
Fix minor issue detecting the same org for the header (caused by IE's
non-standard whitespace handling). Fix default handling for /rfc/@category.
2003-11-09 julian.reschke@greenbytes.de
Inherit ed:entered-by from ancestor elements. Change CSS color for inserted
text to green. Generate issues-list anchor. Do not complain about missing
targets when the xref element is below ed:del. Remove code that attempted
to distinguish section/Section when producing links - always use
uppercase. Fix date rendering for issue resolutions.
2003-11-29 julian.reschke@greenbytes.de
Fix color values for table backgrounds for issue rendering. Change
rendering of issue links to use inline-styles. Add colored issue markers to
issues.
2003-12-13 julian.reschke@greenbytes.de
Fix inheritance of ed:entered-by attribute. Display note elements inside
change tracking as well.
2004-01-18 julian.reschke@greenbytes.de
When PI compact = 'yes', make most CSS print page breaks conditional.
2004-02-20 julian.reschke@greenbytes.de
Support for RFC3667 IPR changes (xml2rfc 1.22); see
<http://lists.xml.resource.org/pipermail/xml2rfc/2004-February/001088.html>.
2004-03-11 julian.reschke@greenbytes.de
Add "(if approved)" to "updates" and "obsoletes" unless the document has
an RFC number.
2004-04-01 julian.reschke@greenbytes.de
Fix RFC3667 output, see <http://lists.xml.resource.org/pipermail/xml2rfc/2004-April/001208.html>
-->
<xsl:output method="html" encoding="iso-8859-1" version="4.0" doctype-public="-//W3C//DTD HTML 4.01//EN" />
<!-- process some of the processing instructions supported by Marshall T. Rose's
xml2rfc sofware, see <http://xml.resource.org/> -->
<!-- rfc compact PI -->
<xsl:param name="xml2rfc-compact"
select="substring-after(
translate(/processing-instruction('rfc')[contains(.,'compact=')], '" ', ''),
'compact=')"
/>
<!-- rfc footer PI -->
<xsl:param name="xml2rfc-footer"
select="substring-after(
translate(/processing-instruction('rfc')[contains(.,'footer=')], '" ', ''),
'footer=')"
/>
<!-- rfc header PI -->
<xsl:param name="xml2rfc-header"
select="substring-after(
translate(/processing-instruction('rfc')[contains(.,'header=')], '" ', ''),
'header=')"
/>
<!-- include a table of contents if a processing instruction <?rfc?>
exists with contents toc="yes". Can be overriden by an XSLT parameter -->
<xsl:param name="xml2rfc-toc"
select="substring-after(
translate(/processing-instruction('rfc')[contains(.,'toc=')], '" ', ''),
'toc=')"
/>
<!-- optional tocdepth-->
<xsl:param name="xml2rfc-tocdepth"
select="substring-after(
translate(/processing-instruction('rfc')[contains(.,'tocdepth=')], '" ', ''),
'tocdepth=')"
/>
<xsl:variable name="parsedTocDepth">
<xsl:choose>
<xsl:when test="$xml2rfc-tocdepth='1'">1</xsl:when>
<xsl:when test="$xml2rfc-tocdepth='2'">2</xsl:when>
<xsl:when test="$xml2rfc-tocdepth='3'">3</xsl:when>
<xsl:when test="$xml2rfc-tocdepth='4'">4</xsl:when>
<xsl:when test="$xml2rfc-tocdepth='5'">5</xsl:when>
<xsl:otherwise>99</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- suppress top block if a processing instruction <?rfc?>
exists with contents tocblock="no". Can be overriden by an XSLT parameter -->
<xsl:param name="xml2rfc-topblock"
select="substring-after(
translate(/processing-instruction('rfc')[contains(.,'topblock=')], '" ', ''),
'topblock=')"
/>
<!-- use symbolic reference names instead of numeric ones if a processing instruction <?rfc?>
exists with contents symrefs="yes". Can be overriden by an XSLT parameter -->
<xsl:param name="xml2rfc-symrefs"
select="substring-after(
translate(/processing-instruction('rfc')[contains(.,'symrefs=')], '" ', ''),
'symrefs=')"
/>
<!-- sort references if a processing instruction <?rfc?>
exists with contents sortrefs="yes". Can be overriden by an XSLT parameter -->
<xsl:param name="xml2rfc-sortrefs"
select="substring-after(
translate(/processing-instruction('rfc')[contains(.,'sortrefs=')], '" ', ''),
'sortrefs=')"
/>
<!-- insert editing marks if a processing instruction <?rfc?>
exists with contents editing="yes". Can be overriden by an XSLT parameter -->
<xsl:param name="xml2rfc-editing"
select="substring-after(
translate(/processing-instruction('rfc')[contains(.,'editing=')], '" ', ''),
'editing=')"
/>
<!-- make it a private paper -->
<xsl:param name="xml2rfc-private"
select="substring-after(
translate(/processing-instruction('rfc')[contains(.,'private=')], '"', ''),
'private=')"
/>
<!-- background image? -->
<xsl:param name="xml2rfc-background"
select="substring-after(
translate(/processing-instruction('rfc')[contains(.,'background=')], '"', ''),
'background=')"
/>
<!-- extension for XML parsing in artwork -->
<xsl:param name="parse-xml-in-artwork"
select="substring-after(
translate(/processing-instruction('rfc-ext')[contains(.,'parse-xml-in-artwork=')], '" ', ''),
'parse-xml-in-artwork=')"
/>
<!-- extension for exclusing DCMI properties in meta tag (RFC2731) -->
<xsl:param name="xml2rfc-ext-support-rfc2731"
select="substring-after(
translate(/processing-instruction('rfc-ext')[contains(.,'support-rfc2731=')], '" ', ''),
'support-rfc2731=')"
/>
<!-- choose whether or not to do mailto links -->
<xsl:param name="xml2rfc-linkmailto"
select="substring-after(
translate(/processing-instruction('rfc')[contains(.,'linkmailto=')], '"', ''),
'linkmailto=')"
/>
<!-- iprnotified switch -->
<xsl:param name="xml2rfc-iprnotified"
select="substring-after(
translate(/processing-instruction('rfc')[contains(.,'iprnotified=')], '"', ''),
'iprnotified=')"
/>
<!-- URL prefix for RFCs. -->
<xsl:param name="rfcUrlPrefix" select="'http://www.ietf.org/rfc/rfc'" />
<!-- warning re: absent node-set ext. function -->
<xsl:variable name="node-set-warning">
This stylesheet requires either an XSLT-1.0 processor with node-set()
extension function, or an XSLT-2.0 processor. Therefore, parts of the
document couldn't be displayed.
</xsl:variable>
<!-- build help keys for indices -->
<xsl:key name="index-first-letter"
match="iref"
use="translate(substring(@item,1,1),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')" />
<xsl:key name="index-item"
match="iref"
use="@item" />
<xsl:key name="index-item-subitem"
match="iref"
use="concat(@item,'..',@subitem)" />
<!-- character translation tables -->
<xsl:variable name="lcase" select="'abcdefghijklmnopqrstuvwxyz'" />
<xsl:variable name="ucase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
<xsl:variable name="plain" select="' #/ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
<xsl:variable name="touri" select="'___abcdefghijklmnopqrstuvwxyz'" />
<!-- prefix for automatically generated anchors -->
<xsl:variable name="anchor-prefix" select="'rfc'" />
<!-- IPR version switch -->
<xsl:variable name="ipr-rfc3667" select="(/rfc/@number > 3708) or not((/rfc/@ipr = 'full2026') or
(/rfc/@ipr = 'noDerivativeWorks2026') or (/rfc/@ipr = 'noDerivativeWorksNow') or (/rfc/@ipr = 'none'))" />
<!-- Templates for the various elements of rfc2629.dtd -->
<xsl:template match="abstract">
<h1><a name="{$anchor-prefix}.abstract"/>Abstract</h1>
<xsl:apply-templates />
</xsl:template>
<msxsl:script language="JScript" implements-prefix="myns">
function parseXml(str) {
var doc = new ActiveXObject ("MSXML2.DOMDocument");
doc.async = false;
if (doc.loadXML (str)) return "";
return doc.parseError.reason + "\n" + doc.parseError.srcText + " (" + doc.parseError.line + "/" + doc.parseError.linepos + ")";
}
</msxsl:script>
<xsl:template match="artwork">
<xsl:if test="not(ancestor::ed:del) and $parse-xml-in-artwork='yes' and function-available('myns:parseXml')">
<xsl:if test="contains(.,'<?xml')">
<xsl:variable name="body" select="substring-after(substring-after(.,'<?xml'),'?>')" />
<xsl:if test="$body!='' and myns:parseXml($body)!=''">
<table style="background-color: red; border-width: thin; border-style: solid; border-color: black;">
<tr><td>
XML PARSE ERROR:
<pre><xsl:value-of select="myns:parseXml($body)" /></pre>
</td></tr></table>
</xsl:if>
</xsl:if>
<xsl:if test="@ed:parse-xml-after">
<xsl:if test="myns:parseXml(string(.))!=''">
<table style="background-color: red; border-width: thin; border-style: solid; border-color: black;">
<tr><td>
XML PARSE ERROR:
<pre><xsl:value-of select="myns:parseXml(string(.))" /></pre>
</td></tr></table>
</xsl:if>
</xsl:if>
</xsl:if>
<pre>
<xsl:call-template name="insertInsDelClass" />
<!--<xsl:value-of select="." />--><xsl:call-template name="showArtwork">
<xsl:with-param name="mode" select="'html'" />
<xsl:with-param name="text" select="." />
<xsl:with-param name="initial" select="'yes'" />
</xsl:call-template></pre>
</xsl:template>
<xsl:template match="artwork[@src and starts-with(@type,'image/')]">
<img src="{@src}" alt="{.}">
<xsl:copy-of select="@width|@height"/>
</img>
</xsl:template>
<xsl:template match="author">
<tr>
<td> </td>
<td>
<xsl:value-of select="@fullname" />
<xsl:if test="@role">
(<xsl:value-of select="@role" />)
</xsl:if>
</td>
</tr>
<tr>
<td> </td>
<td><xsl:value-of select="organization" /></td>
</tr>
<xsl:if test="address/postal/street!=''">
<tr>
<td> </td>
<td><xsl:for-each select="address/postal/street"><xsl:value-of select="." /><br /></xsl:for-each></td>
</tr>
</xsl:if>
<xsl:if test="address/postal/city|address/postal/region|address/postal/code">
<tr>
<td> </td>
<td>
<xsl:if test="address/postal/city"><xsl:value-of select="address/postal/city" />, </xsl:if>
<xsl:if test="address/postal/region"><xsl:value-of select="address/postal/region" /> </xsl:if>
<xsl:if test="address/postal/code"><xsl:value-of select="address/postal/code" /></xsl:if>
</td>
</tr>
</xsl:if>
<xsl:if test="address/postal/country">
<tr>
<td> </td>
<td><xsl:value-of select="address/postal/country" /></td>
</tr>
</xsl:if>
<xsl:if test="address/phone">
<tr>
<td class="right"><b>Phone: </b></td>
<td><a href="tel:{translate(address/phone,' ','')}"><xsl:value-of select="address/phone" /></a></td>
</tr>
</xsl:if>
<xsl:if test="address/facsimile">
<tr>
<td class="right"><b>Fax: </b></td>
<td><a href="fax:{translate(address/facsimile,' ','')}"><xsl:value-of select="address/facsimile" /></a></td>
</tr>
</xsl:if>
<xsl:if test="address/email">
<tr>
<td class="right"><b>EMail: </b></td>
<td>
<a>
<xsl:if test="$xml2rfc-linkmailto!='no'">
<xsl:attribute name="href">mailto:<xsl:value-of select="address/email" /></xsl:attribute>
</xsl:if>
<xsl:value-of select="address/email" />
</a>
</td>
</tr>
</xsl:if>
<xsl:if test="address/uri">
<tr>
<td class="right"><b>URI: </b></td>
<td><a href="{address/uri}"><xsl:value-of select="address/uri" /></a></td>
</tr>
</xsl:if>
<tr>
<td> </td>
<td />
</tr>
</xsl:template>
<xsl:template match="back">
<!-- add references section first, no matter where it appears in the
source document -->
<xsl:apply-templates select="references" />
<!-- next, add information about the document's authors -->
<xsl:call-template name="insertAuthors" />
<!-- add all other top-level sections under <back> -->
<xsl:apply-templates select="*[not(self::references)]" />
<xsl:if test="not($xml2rfc-private)">
<!-- copyright statements -->
<xsl:variable name="copyright"><xsl:call-template name="insertCopyright" /></xsl:variable>
<!-- emit it -->
<xsl:choose>
<xsl:when test="function-available('msxsl:node-set')">
<xsl:apply-templates select="msxsl:node-set($copyright)" />
</xsl:when>
<xsl:when test="function-available('exslt:node-set')">
<xsl:apply-templates select="exslt:node-set($copyright)" />
</xsl:when>
<xsl:otherwise>
<xsl:message><xsl:value-of select="$node-set-warning"/></xsl:message>
<p class="error"><xsl:value-of select="$node-set-warning"/></p>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
<!-- insert the index if index entries exist -->
<xsl:if test="//iref">
<xsl:call-template name="insertIndex" />
</xsl:if>
</xsl:template>
<xsl:template match="eref[node()]">
<a href="{@target}"><xsl:apply-templates /></a>
</xsl:template>
<xsl:template match="eref[not(node())]">
<xsl:text><</xsl:text>
<a href="{@target}"><xsl:value-of select="@target" /></a>
<xsl:text>></xsl:text>
</xsl:template>
<xsl:template match="figure">
<xsl:if test="@anchor!=''">
<div><a name="{@anchor}" /></div>
</xsl:if>
<xsl:choose>
<xsl:when test="@title!='' or @anchor!=''">
<xsl:variable name="n"><xsl:number level="any" count="figure[@title!='' or @anchor!='']" /></xsl:variable>
<div><a name="{$anchor-prefix}.figure.{$n}" /></div>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="n"><xsl:number level="any" count="figure[not(@title!='' or @anchor!='')]" /></xsl:variable>
<div><a name="{$anchor-prefix}.figure.u.{$n}" /></div>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates />
<xsl:if test="@title!='' or @anchor!=''">
<xsl:variable name="n"><xsl:number level="any" count="figure[@title!='' or @anchor!='']" /></xsl:variable>
<p class="figure">Figure <xsl:value-of select="$n"/><xsl:if test="@title!=''">: <xsl:value-of select="@title" /></xsl:if></p>
</xsl:if>
</xsl:template>
<xsl:template match="front">
<xsl:if test="$xml2rfc-topblock!='no'">
<xsl:call-template name="insertTocLink">
<xsl:with-param name="includeTitle" select="true()" />
</xsl:call-template>
<!-- collect information for left column -->
<xsl:variable name="leftColumn">
<xsl:call-template name="collectLeftHeaderColumn" />
</xsl:variable>
<!-- collect information for right column -->
<xsl:variable name="rightColumn">
<xsl:call-template name="collectRightHeaderColumn" />
</xsl:variable>
<!-- insert the collected information -->
<table summary="header information" class="header" border="0" cellpadding="1" cellspacing="1">
<xsl:choose>
<xsl:when test="function-available('msxsl:node-set')">
<xsl:call-template name="emitheader">
<xsl:with-param name="lc" select="msxsl:node-set($leftColumn)" />
<xsl:with-param name="rc" select="msxsl:node-set($rightColumn)" />
</xsl:call-template>
</xsl:when>
<xsl:when test="function-available('exslt:node-set')">
<xsl:call-template name="emitheader">
<xsl:with-param name="lc" select="exslt:node-set($leftColumn)" />
<xsl:with-param name="rc" select="exslt:node-set($rightColumn)" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:message><xsl:value-of select="$node-set-warning"/></xsl:message>
<p class="error"><xsl:value-of select="$node-set-warning"/></p>
</xsl:otherwise>
</xsl:choose>
</table>
</xsl:if>
<p class="title">
<!-- main title -->
<xsl:value-of select="title"/>
<xsl:if test="/rfc/@docName">
<br/>
<span class="filename"><xsl:value-of select="/rfc/@docName"/></span>
</xsl:if>
</p>
<xsl:if test="not($xml2rfc-private)">
<!-- Get status info formatted as per RFC2629-->
<xsl:variable name="preamble"><xsl:call-template name="insertPreamble" /></xsl:variable>
<!-- emit it -->
<xsl:choose>
<xsl:when test="function-available('msxsl:node-set')">
<xsl:apply-templates select="msxsl:node-set($preamble)" />
</xsl:when>
<xsl:when test="function-available('exslt:node-set')">
<xsl:apply-templates select="exslt:node-set($preamble)" />
</xsl:when>
<xsl:otherwise>
<xsl:message><xsl:value-of select="$node-set-warning"/></xsl:message>
<p class="error"><xsl:value-of select="$node-set-warning"/></p>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
<xsl:apply-templates select="abstract" />
<xsl:apply-templates select="note" />
<!-- show notes inside change tracking as well -->
<xsl:apply-templates select="ed:replace[.//note]" />
<xsl:if test="$xml2rfc-toc='yes'">
<xsl:apply-templates select="/" mode="toc" />
<xsl:call-template name="insertTocAppendix" />
</xsl:if>
</xsl:template>
<xsl:template match="iref">
<a><xsl:attribute name="name"><xsl:value-of select="$anchor-prefix"/>.iref.<xsl:number level="any"/></xsl:attribute></a>
</xsl:template>
<!-- list templates depend on the list style -->
<xsl:template match="list[@style='empty' or not(@style)]">
<dl>
<xsl:call-template name="insertInsDelClass"/>
<xsl:apply-templates />
</dl>
</xsl:template>
<xsl:template match="list[starts-with(@style,'format ')]">
<dl>
<xsl:call-template name="insertInsDelClass"/>
<xsl:apply-templates />
</dl>
</xsl:template>
<xsl:template match="list[@style='hanging']">
<dl>
<xsl:call-template name="insertInsDelClass"/>
<xsl:apply-templates />
</dl>
</xsl:template>
<xsl:template match="list[@style='numbers']">
<ol>
<xsl:call-template name="insertInsDelClass"/>
<xsl:apply-templates />
</ol>
</xsl:template>
<!-- numbered list inside numbered list -->
<xsl:template match="list[@style='numbers']/t/list[@style='numbers']" priority="9">
<ol style="list-style-type: lower-alpha">
<xsl:call-template name="insertInsDelClass"/>
<xsl:apply-templates />
</ol>
</xsl:template>
<xsl:template match="list[@style='symbols']">
<ul>
<xsl:call-template name="insertInsDelClass"/>
<xsl:apply-templates />
</ul>
</xsl:template>
<!-- same for t(ext) elements -->
<xsl:template match="list[@style='empty' or not(@style)]/t">
<dd style="margin-top: .5em">
<xsl:apply-templates />
</dd>
</xsl:template>
<xsl:template match="list[@style='numbers' or @style='symbols']/t">
<li>
<xsl:apply-templates />
</li>
</xsl:template>
<xsl:template match="list[@style='hanging']/t">
<dt style="margin-top: .5em">
<xsl:value-of select="@hangText" />
</dt>
<dd>
<!-- if hangIndent present, use 0.7 of the specified value (1em is the width of the "m" character -->
<xsl:if test="../@hangIndent and ../@hangIndent!='0'">
<xsl:attribute name="style">margin-left: <xsl:value-of select="../@hangIndent * 0.7"/>em</xsl:attribute>
</xsl:if>
<xsl:apply-templates />
</dd>
</xsl:template>
<xsl:template match="list[starts-with(@style,'format ') and (contains(@style,'%c') or contains(@style,'%d'))]/t">
<xsl:variable name="list" select=".." />
<xsl:variable name="format" select="substring-after(../@style,'format ')" />
<xsl:variable name="pos">
<xsl:choose>
<xsl:when test="$list/@counter">
<xsl:number level="any" count="list[@counter=$list/@counter or (not(@counter) and @style=concat('format ',$list/@counter))]/t" />
</xsl:when>
<xsl:otherwise>
<xsl:number level="any" count="list[concat('format ',@counter)=$list/@style or (not(@counter) and @style=$list/@style)]/t" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<dt>
<xsl:choose>
<xsl:when test="contains($format,'%c')">
<xsl:value-of select="substring-before($format,'%c')"/><xsl:number value="$pos" format="a" /><xsl:value-of select="substring-after($format,'%c')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="substring-before($format,'%d')"/><xsl:number value="$pos" format="1" /><xsl:value-of select="substring-after($format,'%d')"/>
</xsl:otherwise>
</xsl:choose>
</dt>
<dd>
<xsl:apply-templates />
</dd>
</xsl:template>
<xsl:template match="middle">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="note">
<xsl:variable name="num"><xsl:number/></xsl:variable>
<h1><a name="{$anchor-prefix}.note.{$num}"/><xsl:value-of select="@title" /></h1>
<xsl:apply-templates />
</xsl:template>
<xsl:template match="postamble">
<p>
<xsl:call-template name="editingMark" />
<xsl:apply-templates />
</p>
</xsl:template>
<xsl:template match="preamble">
<p>
<xsl:call-template name="editingMark" />
<xsl:apply-templates />
</p>
</xsl:template>
<xsl:template match="reference">
<xsl:variable name="target">
<xsl:choose>
<xsl:when test="@target"><xsl:value-of select="@target" /></xsl:when>
<xsl:when test="seriesInfo/@name='RFC'"><xsl:value-of select="concat($rfcUrlPrefix,seriesInfo[@name='RFC']/@value,'.txt')" /></xsl:when>
<xsl:when test="seriesInfo[starts-with(.,'RFC')]">
<xsl:variable name="rfcRef" select="seriesInfo[starts-with(.,'RFC')]" />
<xsl:value-of select="concat($rfcUrlPrefix,substring-after (normalize-space($rfcRef), ' '),'.txt')" />
</xsl:when>
<xsl:otherwise />
</xsl:choose>
</xsl:variable>
<tr>
<td class="topnowrap">
<b>
<a name="{@anchor}">
<xsl:call-template name="referencename">
<xsl:with-param name="node" select="." />
</xsl:call-template>
</a>
</b>
</td>
<td class="top">
<xsl:for-each select="front/author">
<xsl:choose>
<xsl:when test="@surname and @surname!=''">
<xsl:variable name="displayname">
<!-- surname/initials is reversed for last author except when it's the only one -->
<xsl:choose>
<xsl:when test="position()=last() and position()!=1">
<xsl:value-of select="concat(@initials,' ',@surname)" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat(@surname,', ',@initials)" />
</xsl:otherwise>
</xsl:choose>
<xsl:if test="@role='editor'">
<xsl:text>, Ed.</xsl:text>
</xsl:if>
</xsl:variable>
<xsl:choose>
<xsl:when test="address/email">
<a>
<xsl:if test="$xml2rfc-linkmailto!='no'">
<xsl:attribute name="href">mailto:<xsl:value-of select="address/email" /></xsl:attribute>
</xsl:if>
<xsl:if test="organization/text()">
<xsl:attribute name="title"><xsl:value-of select="organization/text()"/></xsl:attribute>
</xsl:if>
<xsl:value-of select="$displayname" />
</a>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$displayname" />
</xsl:otherwise>
</xsl:choose>
<xsl:if test="position()!=last() - 1">, </xsl:if>
<xsl:if test="position()=last() - 1"> and </xsl:if>
</xsl:when>
<xsl:when test="organization/text()">
<xsl:choose>
<xsl:when test="address/uri">
<a href="{address/uri}"><xsl:value-of select="organization" /></a>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="organization" />
</xsl:otherwise>
</xsl:choose>
<xsl:if test="position()!=last() - 1">, </xsl:if>
<xsl:if test="position()=last() - 1"> and </xsl:if>
</xsl:when>
<xsl:otherwise />
</xsl:choose>
</xsl:for-each>
<xsl:choose>
<xsl:when test="string-length($target) > 0">
<xsl:text>"</xsl:text><a href="{$target}"><xsl:value-of select="front/title" /></a><xsl:text>"</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>"</xsl:text><xsl:value-of select="front/title" /><xsl:text>"</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:for-each select="seriesInfo">
<xsl:text>, </xsl:text>