-
Notifications
You must be signed in to change notification settings - Fork 62
/
rfc2629.xslt
4981 lines (4139 loc) · 165 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
<!--
XSLT transformation from RFC2629 XML format to HTML
Copyright (c) 2006-2007, Julian Reschke ([email protected])
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of Julian Reschke nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:ed="http://greenbytes.de/2002/rfcedit"
xmlns:exslt="http://exslt.org/common"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:myns="mailto:[email protected]?subject=rcf2629.xslt"
xmlns:saxon="http://icl.com/saxon"
xmlns:x="http://purl.org/net/xml2rfc/ext"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
exclude-result-prefixes="ed exslt msxsl myns saxon x xhtml"
>
<xsl:strip-space elements="back front list middle rfc section"/>
<xsl:output method="html" encoding="iso-8859-1" version="4.0" doctype-public="-//W3C//DTD HTML 4.01//EN" indent="no"/>
<!-- process some of the processing instructions supported by Marshall T. Rose's
xml2rfc sofware, see <http://xml.resource.org/> -->
<!-- delimiters in PIs -->
<xsl:variable name="quote-chars">"'</xsl:variable>
<!-- rfc comments PI -->
<xsl:param name="xml2rfc-comments"
select="substring-after(
translate(/processing-instruction('rfc')[contains(.,'comments=')], concat($quote-chars,' '), ''),
'comments=')"
/>
<!-- rfc compact PI -->
<xsl:param name="xml2rfc-compact"
select="substring-after(
translate(/processing-instruction('rfc')[contains(.,'compact=')], concat($quote-chars,' '), ''),
'compact=')"
/>
<!-- rfc footer PI -->
<xsl:param name="xml2rfc-footer"
select="substring-after(
translate(/processing-instruction('rfc')[contains(.,'footer=')], concat($quote-chars,' '), ''),
'footer=')"
/>
<!-- rfc header PI -->
<xsl:param name="xml2rfc-header"
select="substring-after(
translate(/processing-instruction('rfc')[contains(.,'header=')], concat($quote-chars,' '), ''),
'header=')"
/>
<!-- rfc inline PI -->
<xsl:param name="xml2rfc-inline"
select="substring-after(
translate(/processing-instruction('rfc')[contains(.,'inline=')], concat($quote-chars,' '), ''),
'inline=')"
/>
<!-- rfc strict PI -->
<xsl:param name="xml2rfc-strict"
select="substring-after(
translate(/processing-instruction('rfc')[contains(.,'strict=')], concat($quote-chars,' '), ''),
'strict=')"
/>
<!-- 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=')], concat($quote-chars,' '), ''),
'toc=')"
/>
<!-- optional tocdepth-->
<xsl:param name="xml2rfc-tocdepth"
select="substring-after(
translate(/processing-instruction('rfc')[contains(.,'tocdepth=')], concat($quote-chars,' '), ''),
'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=')], concat($quote-chars,' '), ''),
'topblock=')"
/>
<!-- use symbolic reference names instead of numeric ones unless a processing instruction <?rfc?>
exists with contents symrefs="no". Can be overriden by an XSLT parameter -->
<xsl:param name="xml2rfc-symrefs"
select="substring-after(
translate(/processing-instruction('rfc')[contains(.,'symrefs=')], concat($quote-chars,' '), ''),
'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=')], concat($quote-chars,' '), ''),
'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=')], concat($quote-chars,' '), ''),
'editing=')"
/>
<!-- make it a private paper -->
<xsl:param name="xml2rfc-private"
select="substring-after(
translate(/processing-instruction('rfc')[contains(.,'private=')], $quote-chars, ''),
'private=')"
/>
<!-- background image? -->
<xsl:param name="xml2rfc-background"
select="substring-after(
translate(/processing-instruction('rfc')[contains(.,'background=')], $quote-chars, ''),
'background=')"
/>
<!-- extension for XML parsing in artwork -->
<xsl:param name="xml2rfc-ext-parse-xml-in-artwork"
select="substring-after(
translate(/processing-instruction('rfc-ext')[contains(.,'parse-xml-in-artwork=')], concat($quote-chars,' '), ''),
'parse-xml-in-artwork=')"
/>
<!-- extension for excluding DCMI properties in meta tag (RFC2731) -->
<xsl:param name="xml2rfc-ext-support-rfc2731"
select="substring-after(
translate(/processing-instruction('rfc-ext')[contains(.,'support-rfc2731=')], concat($quote-chars,' '), ''),
'support-rfc2731=')"
/>
<!-- extension for allowing markup inside artwork -->
<xsl:param name="xml2rfc-ext-allow-markup-in-artwork"
select="substring-after(
translate(/processing-instruction('rfc-ext')[contains(.,'allow-markup-in-artwork=')], concat($quote-chars,' '), ''),
'allow-markup-in-artwork=')"
/>
<!-- extension for including references into index -->
<xsl:param name="xml2rfc-ext-include-references-in-index"
select="substring-after(
translate(/processing-instruction('rfc-ext')[contains(.,'include-references-in-index=')], concat($quote-chars,' '), ''),
'include-references-in-index=')"
/>
<!-- position of author's section -->
<xsl:param name="xml2rfc-ext-authors-section"
select="substring-after(
translate(/processing-instruction('rfc-ext')[contains(.,'authors-section=')], concat($quote-chars,' '), ''),
'authors-section=')"
/>
<!-- justification? -->
<xsl:param name="xml2rfc-ext-justification"
select="substring-after(
translate(/processing-instruction('rfc-ext')[contains(.,'justification=')], concat($quote-chars,' '), ''),
'justification=')"
/>
<!-- trailing dots in section numbers -->
<xsl:param name="xml2rfc-ext-sec-no-trailing-dots"
select="substring-after(
translate(/processing-instruction('rfc-ext')[contains(.,'sec-no-trailing-dots=')], concat($quote-chars,' '), ''),
'sec-no-trailing-dots=')"
/>
<!-- choose whether or not to do mailto links -->
<xsl:param name="xml2rfc-linkmailto"
select="substring-after(
translate(/processing-instruction('rfc')[contains(.,'linkmailto=')], concat($quote-chars,' '), ''),
'linkmailto=')"
/>
<!-- iprnotified switch -->
<xsl:param name="xml2rfc-iprnotified"
select="substring-after(
translate(/processing-instruction('rfc')[contains(.,'iprnotified=')], concat($quote-chars,' '), ''),
'iprnotified=')"
/>
<!-- URL templates for RFCs and Internet Drafts. -->
<!-- Reference the authorative ASCII versions
<xsl:param name="rfcUrlPrefix" select="'http://www.ietf.org/rfc/rfc'" />
<xsl:param name="rfcUrlPostfix" select="'.txt'" />
-->
<!-- Reference the marked up versions over on http://tools.ietf.org/html. -->
<xsl:param name="rfcUrlPrefix" select="'http://tools.ietf.org/html/rfc'" />
<xsl:param name="rfcUrlPostfix" select="''" />
<xsl:param name="rfcUrlFrag" select="'section-'" />
<xsl:param name="internetDraftUrlPrefix" select="'http://tools.ietf.org/html/'" />
<xsl:param name="internetDraftUrlPostfix" select="''" />
<xsl:param name="internetDraftUrlFrag" select="'section-'" />
<!-- 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>
<!-- 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'" />
<!-- build help keys for indices -->
<xsl:key name="index-first-letter"
match="iref|reference"
use="translate(substring(concat(@anchor,@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)" />
<xsl:key name="index-xref"
match="xref[@x:sec]"
use="concat(@target,'..',@x:sec)" />
<!-- 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') or
(/rfc/@ipr = '') or
not(/rfc/@ipr)
)" />
<xsl:variable name="ipr-rfc4748" select="(
$ipr-rfc3667 and
(
(/rfc/@number > 4671) or
(/rfc/front/date/@year > 2006) or
(/rfc/front/date/@year > 2005 and (/rfc/front/date/@month='November' or /rfc/front/date/@month='December'))
)
)" />
<!-- will document have an index -->
<xsl:variable name="has-index" select="//iref or (//xref and $xml2rfc-ext-include-references-in-index='yes')" />
<!-- Templates for the various elements of rfc2629.dtd -->
<xsl:template match="text()[not(ancestor::artwork)]">
<xsl:variable name="starts-with-ws" select="translate(substring(.,1,1),'	  ','')"/>
<xsl:variable name="ends-with-ws" select="translate(substring(.,string-length(.),1),'	  ','')"/>
<!--<xsl:message> Orig: "<xsl:value-of select="."/>"</xsl:message>
<xsl:message>Start: "<xsl:value-of select="$starts-with-ws"/>"</xsl:message>
<xsl:message> End: "<xsl:value-of select="$ends-with-ws"/>"</xsl:message> -->
<xsl:if test="$starts-with-ws='' and preceding-sibling::node()">
<xsl:text> </xsl:text>
</xsl:if>
<xsl:value-of select="normalize-space(.)"/>
<xsl:if test="$ends-with-ws='' and following-sibling::node()">
<xsl:text> </xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="abstract">
<h1 id="{$anchor-prefix}.abstract"><a href="#{$anchor-prefix}.abstract">Abstract</a></h1>
<xsl:apply-templates />
</xsl:template>
<msxsl:script language="JScript" implements-prefix="myns">
function parseXml(str) {
try {
var doc = new ActiveXObject("MSXML2.DOMDocument");
doc.async = false;
if (doc.loadXML(str)) {
return "";
}
else {
return doc.parseError.reason + "\n" + doc.parseError.srcText + " (" + doc.parseError.line + "/" + doc.parseError.linepos + ")";
}
}
catch(e) {
return "";
}
}
</msxsl:script>
<xsl:template name="add-artwork-class">
<xsl:choose>
<xsl:when test="@type='abnf' or @type='abnf2616' or @type='application/xml-dtd' or @type='inline' or @type='application/relax-ng-compact-syntax'">
<xsl:attribute name="class">inline</xsl:attribute>
</xsl:when>
<xsl:when test="starts-with(@type,'message/http') and contains(@type,'msgtype="request"')">
<xsl:attribute name="class">text2</xsl:attribute>
</xsl:when>
<xsl:when test="starts-with(@type,'message/http')">
<xsl:attribute name="class">text</xsl:attribute>
</xsl:when>
<xsl:when test="starts-with(@type,'drawing')">
<xsl:attribute name="class">drawing</xsl:attribute>
</xsl:when>
<xsl:when test="starts-with(@type,'text/plain') or @type='example' or @type='code'">
<xsl:attribute name="class">text</xsl:attribute>
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:template>
<xsl:template match="artwork">
<xsl:if test="not(ancestor::ed:del) and $xml2rfc-ext-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; parsed the body below:
<pre>
<xsl:value-of select="$body"/>
</pre>
resulting in:
<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>
<xsl:variable name="display">
<xsl:choose>
<xsl:when test="$xml2rfc-ext-allow-markup-in-artwork='yes'">
<xsl:apply-templates/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="@align='right'">
<div style="display:table; margin-left: auto; margin-right: 0pt;">
<pre style="margin-left: 0em;">
<xsl:call-template name="add-artwork-class"/>
<xsl:call-template name="insertInsDelClass"/>
<xsl:copy-of select="$display"/>
</pre>
</div>
</xsl:when>
<xsl:when test="@align='center'">
<div style="display:table; margin-left: auto; margin-right: auto;">
<pre style="margin-left: 0em;">
<xsl:call-template name="add-artwork-class"/>
<xsl:call-template name="insertInsDelClass"/>
<xsl:copy-of select="$display"/>
</pre>
</div>
</xsl:when>
<xsl:otherwise>
<pre>
<xsl:call-template name="add-artwork-class"/>
<xsl:call-template name="insertInsDelClass"/>
<xsl:copy-of select="$display"/>
</pre>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="check-artwork-width">
<xsl:with-param name="content"><xsl:apply-templates/></xsl:with-param>
</xsl:call-template>
</xsl:template>
<!-- special case for first text node in artwork -->
<xsl:template match="artwork/text()[1]">
<xsl:choose>
<xsl:when test="starts-with(.,' ')">
<!-- reduce leading whitespace -->
<xsl:value-of select="substring(.,2)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="check-artwork-width">
<xsl:param name="content"/>
<xsl:choose>
<xsl:when test="not(contains($content,' '))">
<xsl:if test="string-length($content) > 69">
<xsl:message>artwork line too long: <xsl:value-of select="$content"/></xsl:message>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="start" select="substring-before($content,' ')"/>
<xsl:variable name="end" select="substring-after($content,' ')"/>
<xsl:if test="string-length($start) > 69">
<xsl:message>WARNING: artwork line too long: <xsl:value-of select="$start"/><xsl:call-template name="lineno"/></xsl:message>
</xsl:if>
<xsl:call-template name="check-artwork-width">
<xsl:with-param name="content" select="$end"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</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">
<address class="vcard">
<span class="vcardline">
<span class="fn">
<xsl:value-of select="@fullname" />
</span>
<xsl:if test="@role">
(<xsl:value-of select="@role" />)
</xsl:if>
<!-- components of name (hidden from display -->
<span class="n hidden">
<span class="family-name"><xsl:value-of select="@surname"/></span>
<!-- given-name family-name -->
<xsl:if test="@surname=substring(@fullname,1 + string-length(@fullname) - string-length(@surname))">
<span class="given-name"><xsl:value-of select="normalize-space(substring(@fullname,1,string-length(@fullname) - string-length(@surname)))"/></span>
</xsl:if>
<!-- family-name given-name -->
<xsl:if test="starts-with(@fullname,@surname)">
<span class="given-name"><xsl:value-of select="normalize-space(substring-after(@fullname,@surname))"/></span>
</xsl:if>
</span>
</span>
<xsl:if test="normalize-space(organization) != ''">
<span class="org vcardline">
<xsl:value-of select="organization" />
</span>
</xsl:if>
<xsl:if test="address/postal">
<span class="adr">
<xsl:if test="address/postal/street!=''">
<xsl:for-each select="address/postal/street">
<span class="street-address vcardline">
<xsl:value-of select="." />
</span>
</xsl:for-each>
</xsl:if>
<xsl:if test="address/postal/city|address/postal/region|address/postal/code">
<span class="vcardline">
<xsl:if test="address/postal/city"><span class="locality"><xsl:value-of select="address/postal/city" /></span>, </xsl:if>
<xsl:if test="address/postal/region"><span class="region"><xsl:value-of select="address/postal/region" /></span> </xsl:if>
<xsl:if test="address/postal/code"><span class="postal-code"><xsl:value-of select="address/postal/code" /></span></xsl:if>
</span>
</xsl:if>
<xsl:if test="address/postal/country">
<span class="country-name vcardline"><xsl:value-of select="address/postal/country" /></span>
</xsl:if>
</span>
</xsl:if>
<xsl:if test="address/phone">
<span class="vcardline tel">
<xsl:text>Phone: </xsl:text>
<a href="tel:{translate(address/phone,' ','')}"><span class="value"><xsl:value-of select="address/phone" /></span></a>
</span>
</xsl:if>
<xsl:if test="address/facsimile">
<span class="vcardline tel">
<span class="type">Fax</span><xsl:text>: </xsl:text>
<a href="fax:{translate(address/facsimile,' ','')}"><span class="value"><xsl:value-of select="address/facsimile" /></span></a>
</span>
</xsl:if>
<xsl:if test="address/email">
<span class="vcardline">
<xsl:text>EMail: </xsl:text>
<a>
<xsl:if test="$xml2rfc-linkmailto!='no'">
<xsl:attribute name="href">mailto:<xsl:value-of select="address/email" /></xsl:attribute>
</xsl:if>
<span class="email"><xsl:value-of select="address/email" /></span>
</a>
</span>
</xsl:if>
<xsl:if test="address/uri">
<span class="vcardline">
<xsl:text>URI: </xsl:text>
<a href="{address/uri}" class="url"><xsl:value-of select="address/uri" /></a>
</span>
</xsl:if>
</address>
</xsl:template>
<xsl:template match="back">
<!-- add references section first, no matter where it appears in the
source document -->
<!-- as of April 2004, process from middle section
<xsl:apply-templates select="references" />
-->
<!-- add editorial comments -->
<xsl:if test="//cref and $xml2rfc-comments='yes' and $xml2rfc-inline!='yes'">
<xsl:call-template name="insertComments" />
</xsl:if>
<!-- next, add information about the document's authors -->
<xsl:if test="$xml2rfc-ext-authors-section!='end'">
<xsl:call-template name="insertAuthors" />
</xsl:if>
<!-- add all other top-level sections under <back> -->
<xsl:apply-templates select="*[not(self::references) and not(self::ed:replace and .//references)]" />
<xsl:if test="$xml2rfc-ext-authors-section='end'">
<xsl:call-template name="insertAuthors" />
</xsl:if>
<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="$has-index">
<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 id="{@anchor}"/>
</xsl:if>
<xsl:variable name="anch">
<xsl:call-template name="get-figure-anchor"/>
</xsl:variable>
<div id="{$anch}" />
<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'">
<!-- 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:apply-templates select="title"/>
<xsl:if test="/rfc/@docName">
<br/>
<span class="filename"><xsl:value-of select="/rfc/@docName"/></span>
<xsl:if test="contains(/rfc/@docName,'.')">
<xsl:call-template name="warning">
<xsl:with-param name="msg">The @docName attribute should contain the base name, not the filename (thus no file extension).</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:if>
</p>
<!-- insert notice about update -->
<xsl:variable name="published-as" select="/*/x:link[@rel='Alternate' and starts-with(@title,'RFC')]"/>
<xsl:if test="$published-as">
<p style="color: green; text-align: center; font-size: 14pt; background-color: yellow;">
<b>Note:</b> a later version of this document has been published as <a href="{$published-as/@href}"><xsl:value-of select="$published-as/@title"/></a>.
</p>
</xsl:if>
<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">
<xsl:variable name="anchor"><xsl:call-template name="compute-iref-anchor"/></xsl:variable>
<xsl:choose>
<xsl:when test="ancestor::t|ancestor::figure">
<span id="{$anchor}"/>
</xsl:when>
<xsl:otherwise>
<div id="{$anchor}"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="compute-iref-anchor">
<xsl:variable name="first" select="translate(substring(@item,1,1),$ucase,$lcase)"/>
<xsl:variable name="nkey" select="translate($first,$lcase,'')"/>
<xsl:choose>
<xsl:when test="$nkey=''">
<xsl:value-of select="$anchor-prefix"/>.iref.<xsl:value-of select="$first"/>.<xsl:number level="any" count="iref[starts-with(translate(@item,$ucase,$lcase),$first)]"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$anchor-prefix"/>.iref.<xsl:number level="any" count="iref[translate(substring(@item,1,1),concat($lcase,$ucase),'')='']"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- list templates depend on the list style -->
<xsl:template match="list[@style='empty' or not(@style)]">
<dl class="empty">
<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='letters']">
<ol style="list-style-type: lower-alpha">
<xsl:call-template name="insertInsDelClass"/>
<xsl:apply-templates />
</ol>
</xsl:template>
<!-- nested lettered list uses uppercase -->
<xsl:template match="list//t//list[@style='letters']" priority="9">
<ol style="list-style-type: upper-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 | list[@style='empty' or not(@style)]/ed:replace/ed:*/t">
<!-- Inherited through CSS now <dd style="margin-top: .5em">-->
<dd>
<xsl:call-template name="insertInsDelClass"/>
<xsl:if test="@anchor"><xsl:attribute name="id"><xsl:value-of select="@anchor"/></xsl:attribute></xsl:if>
<xsl:apply-templates />
</dd>
</xsl:template>
<xsl:template match="list[@style='numbers' or @style='symbols' or @style='letters']/x:lt">
<li>
<xsl:if test="@anchor"><xsl:attribute name="id"><xsl:value-of select="@anchor"/></xsl:attribute></xsl:if>
<xsl:apply-templates select="t" />
</li>
</xsl:template>
<xsl:template match="list[@style='numbers' or @style='symbols' or @style='letters']/t | list[@style='numbers' or @style='symbols' or @style='letters']/ed:replace/ed:*/t">
<li>
<xsl:call-template name="insertInsDelClass"/>
<xsl:for-each select="../..">
<xsl:call-template name="insert-issue-pointer"/>
</xsl:for-each>
<xsl:if test="@anchor"><xsl:attribute name="id"><xsl:value-of select="@anchor"/></xsl:attribute></xsl:if>
<xsl:apply-templates />
</li>
</xsl:template>
<xsl:template match="list[@style='hanging']/x:lt">
<xsl:if test="@hangText!=''">
<dt>
<xsl:call-template name="insertInsDelClass"/>
<xsl:variable name="del-node" select="ancestor::ed:del"/>
<xsl:variable name="rep-node" select="ancestor::ed:replace"/>
<xsl:variable name="deleted" select="$del-node and ($rep-node/ed:ins)"/>
<xsl:for-each select="../..">
<xsl:call-template name="insert-issue-pointer">
<xsl:with-param name="deleted-anchor" select="$deleted"/>
</xsl:call-template>
</xsl:for-each>
<xsl:if test="@anchor"><xsl:attribute name="id"><xsl:value-of select="@anchor"/></xsl:attribute></xsl:if>
<xsl:value-of select="@hangText" />
</dt>
</xsl:if>
<dd>
<xsl:call-template name="insertInsDelClass"/>
<!-- 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 select="t" />
</dd>
</xsl:template>
<xsl:template match="list[@style='hanging']/t | list[@style='hanging']/ed:replace/ed:*/t">
<xsl:if test="@hangText!=''">
<dt>
<xsl:call-template name="insertInsDelClass"/>
<xsl:if test="count(preceding-sibling::t)=0">
<xsl:variable name="del-node" select="ancestor::ed:del"/>
<xsl:variable name="rep-node" select="ancestor::ed:replace"/>
<xsl:variable name="deleted" select="$del-node and ($rep-node/ed:ins)"/>
<xsl:for-each select="../..">
<xsl:call-template name="insert-issue-pointer">
<xsl:with-param name="deleted-anchor" select="$deleted"/>
</xsl:call-template>
</xsl:for-each>
</xsl:if>
<xsl:if test="@anchor"><xsl:attribute name="id"><xsl:value-of select="@anchor"/></xsl:attribute></xsl:if>
<xsl:value-of select="@hangText" />
</dt>
</xsl:if>
<xsl:variable name="dd-content">
<xsl:apply-templates/>
</xsl:variable>
<xsl:if test="$dd-content!=''">
<dd>
<xsl:call-template name="insertInsDelClass"/>
<!-- 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:if>
</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>