forked from w3c/qtspecs
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathxmlspec-2016.xsl
2886 lines (2610 loc) · 88.3 KB
/
xmlspec-2016.xsl
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
<?xml version="1.0"?>
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:f="http://www.w3.org/2016/local-functions"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs f"
version="2.0">
<!--
DO NOT EDIT THIS FILE. DO NOT EDIT THIS FILE. DO NOT EDIT THIS FILE.
DO NOT EDIT THIS FILE. DO NOT EDIT THIS FILE. DO NOT EDIT THIS FILE.
DO NOT EDIT THIS FILE. DO NOT EDIT THIS FILE. DO NOT EDIT THIS FILE.
DO NOT EDIT THIS FILE. DO NOT EDIT THIS FILE. DO NOT EDIT THIS FILE.
DO NOT EDIT THIS FILE. DO NOT EDIT THIS FILE. DO NOT EDIT THIS FILE.
DO NOT EDIT THIS FILE. DO NOT EDIT THIS FILE. DO NOT EDIT THIS FILE.
Revised Nov 2016 to generate HTML5
====================================================================== -->
<xsl:preserve-space elements="*"/>
<xsl:strip-space elements="
abstract arg attribute authlist author back bibref blist body case col
colgroup component constant constraint constraintnote copyright def
definitions descr div div1 div2 div3 div4 div5 ednote enum enumerator
example exception footnote front gitem glist graphic group header
htable htbody inform-div1 interface issue item itemizedlist langusage
listitem member method module note notice ol olist orderedlist orglist
param parameters prod prodgroup prodrecap proto pubdate pubstmt raises
reference resolution returns revisiondesc scrap sequence slist
sourcedesc spec specref status struct table tbody tfoot thead tr
typedef ul ulist union vc vcnote wfc wfcnote"/>
<xsl:param name="validity.hacks" select="1"/>
<xsl:param name="show.diff.markup.string" select="'0'" as="xs:string"/>
<xsl:param name="show.diff.markup" select="xs:integer($show.diff.markup.string)" as="xs:integer"/>
<xsl:param name="additional.css"/>
<xsl:param name="additional.css.2"/>
<!-- 2010-12-23: Jim added the following inclusion of $additional.css.diff,
which will be non-empty only when diffs are being done -->
<xsl:param name="additional.css.diff"/>
<xsl:param name="additional.title"/>
<xsl:param name="called.by.diffspec" select="0" as="xs:integer"/>
<xsl:param name="show.ednotes" select="1"/>
<xsl:param name="tabular.examples" select="0"/>
<xsl:param name="toc.level" select="5"/>
<xsl:param name="use-local-css" select="0"/>
<xsl:param name="back.to.top.link" select="0"/>
<xsl:key name="ids" match="*[@id]" use="@id"/>
<xsl:key name="specrefs" match="specref" use="@ref"/>
<xsl:output method="html" version="5.0" encoding="UTF-8" indent="yes" />
<!--
<xsl:output method="html"
encoding="utf-8"
doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
indent="no"/>
-->
<!-- not handled:
attribute: unhandled IDL stuff
case: unhandled IDL stuff
component: unhandled IDL stuff
constant: unhandled IDL stuff
copyright: boilerplate notice always used instead
definitions: unhandled IDL stuff
descr: unhandled IDL stuff
enum: unhandled IDL stuff
enumerator: unhandled IDL stuff
exception: unhandled IDL stuff
group: unhandled IDL stuff
interface: unhandled IDL stuff
method: unhandled IDL stuff
module: unhandled IDL stuff
param: unhandled IDL stuff
parameters: unhandled IDL stuff
raises: unhandled IDL stuff
reference: unhandled IDL stuff
returns: unhandled IDL stuff
sequence: unhandled IDL stuff
struct: unhandled IDL stuff
typedef: unhandled IDL stuff
typename: unhandled IDL stuff
union: unhandled IDL stuff
Warning!
Only handles statuses of NOTE, WD, and REC.
-->
<!-- Output a warning for unhandled elements! -->
<xsl:template match="*">
<xsl:message>
<xsl:text>No template matches </xsl:text>
<xsl:value-of select="name(.)"/>
<xsl:text>.</xsl:text>
</xsl:message>
<span style="font-color:red" disallowed="fix-this"> <!-- Deliberately invalid HTML, to be picked up if anyone tries to publish this -->
<xsl:text><</xsl:text>
<xsl:value-of select="name(.)"/>
<xsl:text>></xsl:text>
<xsl:apply-templates/>
<xsl:text></</xsl:text>
<xsl:value-of select="name(.)"/>
<xsl:text>></xsl:text>
</span>
</xsl:template>
<!-- Template for the root node. Creation of <html> element could
go here, but that doesn't feel right. -->
<xsl:template match="/">
<xsl:comment>
<xsl:text>{xmlspec} </xsl:text>
<xsl:text>XSLT Processor: </xsl:text>
<xsl:value-of select="system-property('xsl:vendor')"/>
<xsl:if test="system-property('xsl:version') = '2.0'">
<xsl:value-of select="system-property('xsl:product-name')"/>
<xsl:value-of select="system-property('xsl:product-version')"/>
</xsl:if>
<!--
<xsl:comment>$show.diff.markup = <xsl:value-of select="$show.diff.markup"/></xsl:comment>
<xsl:message>$show.diff.markup = <xsl:value-of select="$show.diff.markup"/></xsl:message>
-->
</xsl:comment>
<xsl:if test="//prod[@num] and //prod[not(@num)]">
<xsl:message terminate="yes">
<xsl:text>Manually and automatically numbered productions </xsl:text>
<xsl:text>cannot coexist.</xsl:text>
</xsl:message>
</xsl:if>
<xsl:apply-templates/>
</xsl:template>
<!-- abstract: appears only in header -->
<!-- format as a second-level div -->
<!-- called in enforced order from header's template -->
<xsl:template match="abstract">
<div>
<xsl:text> </xsl:text>
<h2>
<xsl:call-template name="anchor">
<xsl:with-param name="conditional" select="0"/>
<xsl:with-param name="default.id" select="'abstract'"/>
</xsl:call-template>
<xsl:text>Abstract</xsl:text>
</h2>
<xsl:apply-templates/>
</div>
</xsl:template>
<!-- affiliation: follows a name in author and member -->
<!-- put it in parens with a leading space -->
<xsl:template match="affiliation">
<xsl:text>, </xsl:text>
<xsl:apply-templates/>
</xsl:template>
<!-- arg: appears only in proto -->
<!-- argument in function prototype -->
<!-- output argument type, italicized as placeholder; separate the
list with commas and spaces -->
<xsl:template match="arg">
<xsl:if test="preceding-sibling::arg">
<xsl:text>, </xsl:text>
</xsl:if>
<var>
<xsl:value-of select="@type"/>
</var>
<xsl:if test="@occur = 'opt'">
<xsl:text>?</xsl:text>
</xsl:if>
</xsl:template>
<!-- att: attribute name -->
<!-- used lots of places -->
<!-- format as monospaced code -->
<xsl:template match="att">
<code><xsl:apply-templates/></code>
</xsl:template>
<!-- attribute: -->
<!-- IDL stuff isn't handled yet -->
<!-- attval: attribute name -->
<!-- used lots of places -->
<!-- format as quoted string -->
<xsl:template match="attval">
<xsl:text>"</xsl:text>
<xsl:apply-templates/>
<xsl:text>"</xsl:text>
</xsl:template>
<!-- authlist: list of authors (editors, really) -->
<!-- called in enforced order from header's template, in <dl>
context -->
<xsl:template match="authlist">
<dt>
<xsl:text>Editor</xsl:text>
<xsl:if test="count(author) > 1">
<xsl:text>s</xsl:text>
</xsl:if>
<xsl:text>:</xsl:text>
</dt>
<xsl:apply-templates/>
</xsl:template>
<!-- author: an editor of a spec -->
<!-- only appears in authlist -->
<!-- called in <dl> context -->
<xsl:template match="author">
<!--
<xsl:comment>xmlspec, match="author"</xsl:comment>
-->
<dd>
<xsl:apply-templates/>
<xsl:if test="@role = '2e'">
<xsl:text> - Second Edition</xsl:text>
</xsl:if>
</dd>
</xsl:template>
<!-- back: back matter for the spec -->
<!-- make a <div> for neatness -->
<!-- affects numbering of div1 children -->
<xsl:template match="back">
<div class="back">
<xsl:apply-templates/>
<xsl:call-template name="autogenerated-appendices"/>
</div>
</xsl:template>
<!-- bibl: bibliographic entry -->
<!-- only appears in blist -->
<!-- called with <dl> context -->
<!-- if there's a key, use it in the <dt>, otherwise use the ID -->
<!-- if there's an href, add a ref in parens at the end of the text -->
<xsl:template match="bibl">
<dt class="label">
<xsl:if test="@id">
<a id="{@id}"/>
</xsl:if>
<xsl:choose>
<xsl:when test="@key">
<xsl:value-of select="@key"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@id"/>
</xsl:otherwise>
</xsl:choose>
</dt>
<dd>
<xsl:apply-templates/>
<xsl:if test="@href">
<xsl:text> (See </xsl:text>
<xsl:value-of select="@href"/>
<xsl:text>.)</xsl:text>
</xsl:if>
</dd>
</xsl:template>
<!-- bibref: reference to a bibliographic entry -->
<!-- make a link to the bibl -->
<!-- if the bibl has a key, put it in square brackets; otherwise use
the bibl's ID -->
<xsl:template match="bibref">
<a>
<xsl:attribute name="href">
<xsl:call-template name="href.target">
<xsl:with-param name="target" select="key('ids', @ref)"/>
</xsl:call-template>
</xsl:attribute>
<xsl:text>[</xsl:text>
<xsl:choose>
<xsl:when test="key('ids', @ref)/@key">
<xsl:value-of select="key('ids', @ref)/@key"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@ref"/>
</xsl:otherwise>
</xsl:choose>
<xsl:text>]</xsl:text>
</a>
</xsl:template>
<!-- blist: list of bibliographic entries -->
<!-- set up the list and process children -->
<xsl:template match="blist">
<dl>
<xsl:apply-templates/>
</dl>
</xsl:template>
<!-- bnf: un-marked-up BNF productions -->
<!-- preformatted within a table cell -->
<!-- scrap provides <table> context -->
<xsl:template match="bnf">
<tbody>
<tr>
<td>
<xsl:if test="@diff and $show.diff.markup != 0">
<xsl:attribute name="class">
<xsl:text>diff-</xsl:text>
<xsl:value-of select="@diff"/>
</xsl:attribute>
</xsl:if>
<pre>
<xsl:apply-templates/>
</pre>
</td>
</tr>
</tbody>
</xsl:template>
<!-- body: the meat of the spec -->
<!-- create a TOC and then go to work -->
<!-- (don't forget the TOC for the back matter and a pointer to end
notes) -->
<xsl:template match="body">
<xsl:if test="$toc.level > 0">
<nav id="toc">
<xsl:text> </xsl:text>
<xsl:call-template name="finder"/> <!-- Used for F+O spec -->
<h2>
<xsl:call-template name="anchor">
<xsl:with-param name="conditional" select="0"/>
<xsl:with-param name="default.id" select="'contents'"/>
</xsl:call-template>
<xsl:text>Table of Contents</xsl:text>
</h2>
<ol class="toc">
<xsl:apply-templates select="div1|../back/inform-div1|../back/div1" mode="toc"/>
<xsl:call-template name="autogenerated-appendices-toc"/>
</ol>
<xsl:if test="//footnote[not(ancestor::table)]">
<p class="toc">
<a href="#endnotes">
<xsl:text>End Notes</xsl:text>
</a>
</p>
</xsl:if>
</nav>
<hr/>
</xsl:if>
<div class="body">
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template name="finder">
<!-- overridden in F+O spec -->
</xsl:template>
<xsl:template name="autogenerated-appendices">
<!-- there are none by default -->
</xsl:template>
<xsl:template name="autogenerated-appendices-toc">
<!-- there are none by default -->
</xsl:template>
<!-- caption: see table -->
<!-- case: -->
<!-- IDL stuff isn't handled yet -->
<!-- code: generic computer code -->
<!-- output as HTML <code> for monospaced formatting -->
<xsl:template match="code">
<code><xsl:apply-templates/></code>
</xsl:template>
<!-- col: see table -->
<!-- colgroup: see table -->
<!-- com: formal production comment -->
<!-- can appear in prod or rhs -->
<xsl:template match="com">
<xsl:choose>
<xsl:when test="preceding-sibling::*[1][name()='rhs']">
<td>
<xsl:if test="ancestor-or-self::*/@diff and $show.diff.markup != 0">
<xsl:attribute name="class">
<xsl:text>diff-</xsl:text>
<xsl:value-of select="ancestor-or-self::*/@diff"/>
</xsl:attribute>
</xsl:if>
<i>
<xsl:text>/* </xsl:text>
<xsl:apply-templates/>
<xsl:text> */</xsl:text>
</i>
</td>
</xsl:when>
<xsl:otherwise>
<tr style="vertical-align:baseline;">
<td/><td/><td/><td/>
<td>
<xsl:if test="ancestor-or-self::*/@diff and $show.diff.markup != 0">
<xsl:attribute name="class">
<xsl:text>diff-</xsl:text>
<xsl:value-of select="ancestor-or-self::*/@diff"/>
</xsl:attribute>
</xsl:if>
<i>
<xsl:text>/* </xsl:text>
<xsl:apply-templates/>
<xsl:text> */</xsl:text>
</i>
</td>
</tr>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- this could probably be handled better, but given that rhs can
have arbitrary text and com mixed in, I don't feel like
spending enough time to figure out how -->
<xsl:template match="rhs/com">
<i>
<xsl:text>/* </xsl:text>
<xsl:apply-templates/>
<xsl:text> */</xsl:text>
</i>
</xsl:template>
<!-- component: -->
<!-- IDL stuff isn't handled yet -->
<!-- constant: -->
<!-- IDL stuff isn't handled yet -->
<!-- constraint: a note in a formal production -->
<!-- refers to a constraint note -->
<xsl:template match="constraint">
<xsl:choose>
<xsl:when test="preceding-sibling::*[1][name()='rhs']">
<td>
<xsl:if test="@diff and $show.diff.markup != 0">
<xsl:attribute name="class">
<xsl:text>diff-</xsl:text>
<xsl:value-of select="@diff"/>
</xsl:attribute>
</xsl:if>
<a>
<xsl:attribute name="href">
<xsl:call-template name="href.target">
<xsl:with-param name="target" select="key('ids', @def)"/>
</xsl:call-template>
</xsl:attribute>
<xsl:text>[Constraint: </xsl:text>
<xsl:apply-templates select="key('ids', @def)/head" mode="text"/>
<xsl:text>]</xsl:text>
</a>
</td>
</xsl:when>
<xsl:otherwise>
<tr style="vertical-align:baseline;">
<td/><td/><td/><td/>
<td>
<xsl:if test="@diff and $show.diff.markup != 0">
<xsl:attribute name="class">
<xsl:text>diff-</xsl:text>
<xsl:value-of select="@diff"/>
</xsl:attribute>
</xsl:if>
<a>
<xsl:attribute name="href">
<xsl:call-template name="href.target">
<xsl:with-param name="target" select="key('ids', @def)"/>
</xsl:call-template>
</xsl:attribute>
<xsl:text>[Constraint: </xsl:text>
<xsl:apply-templates select="key('ids', @def)/head" mode="text"/>
<xsl:text>]</xsl:text>
</a>
</td>
</tr>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- constraintnote: note constraining a formal production -->
<!-- see also constraintnote/head -->
<xsl:template match="constraintnote">
<div class="constraint">
<xsl:apply-templates/>
</div>
</xsl:template>
<!-- copyright: notice for this document-->
<!-- right now, a boilerplate copyright notice is inserted by the
template for header; this may need to be changed -->
<!-- day: day of month of spec -->
<!-- only used in pudate; called directly from header template -->
<xsl:template match="day">
<xsl:apply-templates/>
</xsl:template>
<!-- def: glossary definition -->
<!-- already in <dl> context from glist -->
<xsl:template match="def">
<dd>
<xsl:apply-templates/>
</dd>
</xsl:template>
<!-- definitions: -->
<!-- IDL stuff isn't handled yet -->
<!-- descr: -->
<!-- IDL stuff isn't handled yet -->
<!-- div[n]: structural divisions -->
<!-- make an HTML div -->
<!-- see also div[n]/head -->
<xsl:template match="div1">
<div class="div1">
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template match="div2">
<div class="div2">
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template match="div3">
<div class="div3">
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template match="div4">
<div class="div4">
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template match="div5">
<div class="div5">
<xsl:apply-templates/>
</div>
</xsl:template>
<!-- ednote: editors' note -->
<xsl:template match="ednote">
<xsl:if test="$show.ednotes != 0">
<table style="border: 1px;">
<xsl:attribute name="caption">
<xsl:text>Editorial note</xsl:text>
<xsl:if test="name">
<xsl:text>: </xsl:text>
<xsl:value-of select="name"/>
</xsl:if>
</xsl:attribute>
<tr>
<td style="text-align: left; vertical-align:top; width: 50%;">
<b>
<xsl:text>Editorial note</xsl:text>
<xsl:if test="name">
<xsl:text>: </xsl:text>
<xsl:apply-templates select="name"/>
</xsl:if>
</b>
</td>
<td style="text-align: right; vertical-align:top; width: 50%;">
<xsl:choose>
<xsl:when test="date">
<xsl:apply-templates select="date"/>
</xsl:when>
<xsl:otherwise> </xsl:otherwise>
</xsl:choose>
</td>
</tr>
<tr style="text-align: left; vertical-align: top;">
<td colspan="2">
<xsl:apply-templates select="edtext"/>
</td>
</tr>
</table>
</xsl:if>
</xsl:template>
<xsl:template match="date">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="edtext">
<xsl:apply-templates/>
</xsl:template>
<!-- edtext: text of an editors' note -->
<!-- ednote is currently hidden -->
<!-- el: an XML element -->
<!-- present as preformatted text, no markup -->
<!-- Chris's personal preference is to put pointy-brackets around
this, but he seems to be in the minority -->
<xsl:template match="el">
<code><xsl:apply-templates/></code>
</xsl:template>
<!-- email: an email address for an editor -->
<!-- only occurs in author -->
<xsl:template match="email">
<xsl:text> </xsl:text>
<a href="{@href}">
<xsl:text><</xsl:text>
<xsl:apply-templates/>
<xsl:text>></xsl:text>
</a>
</xsl:template>
<!-- emph: in-line emphasis -->
<!-- equates to HTML <em> -->
<!-- the role attribute could be used for multiple kinds of
emphasis, but that would not be kind -->
<xsl:template match="emph">
<em><xsl:apply-templates/></em>
</xsl:template>
<!-- rfc2119: identifies RFC 2119 keywords -->
<xsl:template match="rfc2119">
<strong><xsl:apply-templates/></strong>
</xsl:template>
<!-- enum: -->
<!-- IDL stuff isn't handled yet -->
<!-- enumerator: -->
<!-- IDL stuff isn't handled yet -->
<!-- example: what it seems -->
<!-- block-level with title -->
<!-- see also example/head -->
<xsl:template match="example">
<xsl:variable name="class">
<xsl:choose>
<xsl:when test="$tabular.examples = 0">exampleOuter</xsl:when>
<xsl:otherwise>example</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<div class="{$class}">
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template match="example/head">
<xsl:text> </xsl:text>
<xsl:choose>
<xsl:when test="$tabular.examples = 0">
<div class="exampleHeader">
<xsl:call-template name="anchor">
<xsl:with-param name="node" select=".."/>
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:text>Example: </xsl:text>
<xsl:apply-templates/>
</div>
</xsl:when>
<xsl:otherwise>
<h5>
<xsl:call-template name="anchor">
<xsl:with-param name="node" select=".."/>
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:text>Example: </xsl:text>
<xsl:apply-templates/>
</h5>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- eg: a literal example -->
<!-- present as preformatted text -->
<xsl:template match="eg">
<xsl:param name="pre.class" select="()" as="xs:string?"/>
<xsl:variable name="content">
<xsl:call-template name="anchor"/>
<pre>
<xsl:if test="$pre.class">
<xsl:attribute name="class" select="$pre.class"/>
</xsl:if>
<xsl:if test="@diff and $show.diff.markup != 0">
<xsl:attribute name="class">
<xsl:text>diff-</xsl:text>
<xsl:value-of select="@diff"/>
</xsl:attribute>
</xsl:if>
<xsl:apply-templates/>
</pre>
</xsl:variable>
<xsl:choose>
<xsl:when test="$tabular.examples = 0">
<div class="exampleInner">
<xsl:copy-of select="$content"/>
</div>
</xsl:when>
<xsl:otherwise>
<table class="eg" cellpadding="5" border="1"
bgcolor="#99ffff" width="100%">
<caption>Example</caption>
<tr>
<td>
<xsl:copy-of select="$content"/>
</td>
</tr>
</table>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- exception: -->
<!-- IDL stuff isn't handled yet -->
<!-- footnote: format as endnote, actually -->
<xsl:template match="footnote">
<xsl:variable name="this-note-id">
<xsl:choose>
<xsl:when test="@id">
<xsl:value-of select="@id"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="generate-id(.)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<sup>
<xsl:text>[</xsl:text>
<a id="FN-ANCH-{$this-note-id}"
href="#{$this-note-id}">
<xsl:apply-templates select="." mode="number-simple"/>
</a>
<xsl:text>]</xsl:text>
</sup>
</xsl:template>
<!-- front: front matter for the spec -->
<!-- make a div for cleanliness -->
<xsl:template match="front">
<div class="front">
<xsl:apply-templates/>
</div>
</xsl:template>
<!-- function: name of a function -->
<!-- format as HTML <code> for monospaced presentation -->
<xsl:template match="function">
<code><xsl:apply-templates/></code>
</xsl:template>
<!-- gitem: glossary list entry -->
<!-- just pass children through for <dd>/<dt> formatting -->
<xsl:template match="gitem">
<xsl:apply-templates/>
</xsl:template>
<!-- glist: glossary list -->
<!-- create <dl> and handle children -->
<xsl:template match="glist">
<xsl:if test="$validity.hacks = 1 and local-name(..) = 'p'">
<xsl:text disable-output-escaping="yes"></p></xsl:text>
</xsl:if>
<dl>
<xsl:apply-templates/>
</dl>
<xsl:if test="$validity.hacks = 1 and local-name(..) = 'p'">
<xsl:text disable-output-escaping="yes"><p></xsl:text>
</xsl:if>
</xsl:template>
<!-- graphic: external illustration -->
<!-- reference external graphic file with alt text -->
<xsl:template match="graphic">
<img src="{@source}">
<xsl:if test="@alt">
<xsl:attribute name="alt">
<xsl:value-of select="@alt"/>
</xsl:attribute>
</xsl:if>
</img>
</xsl:template>
<!-- group: -->
<!-- IDL stuff isn't handled yet -->
<!-- head: title for a variety of constructs -->
<!-- constraintnotes have different types, but they're
non-enumerated; nothing is done with them right now -->
<xsl:template match="constraintnote/head">
<p class="prefix">
<xsl:if test="../@id">
<a id="{../@id}"/>
</xsl:if>
<b><xsl:text>Constraint: </xsl:text><xsl:apply-templates/></b>
</p>
</xsl:template>
<xsl:template match="div1/head">
<xsl:text> </xsl:text>
<h2>
<xsl:call-template name="anchor">
<xsl:with-param name="conditional" select="0"/>
<xsl:with-param name="node" select=".."/>
</xsl:call-template>
<xsl:apply-templates select=".." mode="divnum"/>
<xsl:apply-templates/>
</h2>
</xsl:template>
<xsl:template match="div2/head">
<xsl:text> </xsl:text>
<h3>
<xsl:call-template name="anchor">
<xsl:with-param name="conditional" select="0"/>
<xsl:with-param name="node" select=".."/>
</xsl:call-template>
<xsl:apply-templates select=".." mode="divnum"/>
<xsl:apply-templates/>
</h3>
</xsl:template>
<xsl:template match="div3/head">
<xsl:text> </xsl:text>
<h4>
<xsl:call-template name="anchor">
<xsl:with-param name="conditional" select="0"/>
<xsl:with-param name="node" select=".."/>
</xsl:call-template>
<xsl:apply-templates select=".." mode="divnum"/>
<xsl:apply-templates/>
</h4>
</xsl:template>
<xsl:template match="div4/head">
<xsl:text> </xsl:text>
<h5>
<xsl:call-template name="anchor">
<xsl:with-param name="conditional" select="0"/>
<xsl:with-param name="node" select=".."/>
</xsl:call-template>
<xsl:apply-templates select=".." mode="divnum"/>
<xsl:apply-templates/>
</h5>
</xsl:template>
<xsl:template match="div5/head">
<xsl:text> </xsl:text>
<h6>
<xsl:call-template name="anchor">
<xsl:with-param name="conditional" select="0"/>
<xsl:with-param name="node" select=".."/>
</xsl:call-template>
<xsl:apply-templates select=".." mode="divnum"/>
<xsl:apply-templates/>
</h6>
</xsl:template>
<xsl:template match="inform-div1/head">
<xsl:text> </xsl:text>
<h2>
<xsl:call-template name="anchor">
<xsl:with-param name="conditional" select="0"/>
<xsl:with-param name="node" select=".."/>
</xsl:call-template>
<xsl:apply-templates select=".." mode="divnum"/>
<xsl:apply-templates/>
<xsl:text> (Non-Normative)</xsl:text>
</h2>
</xsl:template>
<xsl:template match="issue/head">
<p class="prefix">
<b><xsl:apply-templates/></b>
</p>
</xsl:template>
<xsl:template match="scrap/head[child::node()]">
<xsl:text> </xsl:text>
<h5>
<xsl:call-template name="anchor">
<xsl:with-param name="node" select=".."/>
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
<xsl:apply-templates/>
</h5>
</xsl:template>
<xsl:template match="scrap/head[not(child::node())]">
<xsl:text> </xsl:text>
<xsl:call-template name="anchor">
<xsl:with-param name="node" select=".."/>
<xsl:with-param name="conditional" select="0"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="vcnote/head">
<p class="prefix">
<xsl:if test="../@id">
<a id="{../@id}"/>
</xsl:if>
<b><xsl:text>Validity constraint: </xsl:text><xsl:apply-templates/></b>
</p>
</xsl:template>
<xsl:template match="wfcnote/head">
<p class="prefix">
<xsl:if test="../@id">
<a id="{../@id}"/>
</xsl:if>
<b><xsl:text>Well-formedness constraint: </xsl:text><xsl:apply-templates/></b>
</p>
</xsl:template>
<!-- header: metadata about the spec -->
<!-- pull out information into standard W3C layout -->
<xsl:template match="header">
<div class="head">
<xsl:if test="not(/spec/@role='editors-copy')">
<p>
<a href="https://www.w3.org/">
<img src="https://www.w3.org/StyleSheets/TR/2016/logos/W3C"
alt="W3C" height="48" width="72"/>
</a>
<xsl:choose>
<xsl:when test="/spec/@w3c-doctype='memsub'">
<a href='https://www.w3.org/Submission/'>
<img alt='Member Submission'
src='https://www.w3.org/Icons/member_subm'/>
</a>
</xsl:when>
<xsl:when test="/spec/@w3c-doctype='teamsub'">
<a href='https://www.w3.org/2003/06/TeamSubmission'>
<img alt='Team Submission'
src='https://www.w3.org/Icons/team_subm'/>
</a>
</xsl:when>
</xsl:choose>
</p>
</xsl:if>
<xsl:text> </xsl:text>
<h1>
<xsl:call-template name="anchor">
<xsl:with-param name="node" select="title[1]"/>
<xsl:with-param name="conditional" select="0"/>
<xsl:with-param name="default.id" select="'title'"/>
</xsl:call-template>
<xsl:apply-templates select="title"/>
<xsl:if test="version">
<xsl:text> </xsl:text>
<xsl:apply-templates select="version"/>
</xsl:if>
</h1>
<xsl:if test="subtitle">
<xsl:text> </xsl:text>
<h2>
<xsl:call-template name="anchor">
<xsl:with-param name="node" select="subtitle[1]"/>
<xsl:with-param name="conditional" select="0"/>
<xsl:with-param name="default.id" select="'subtitle'"/>
</xsl:call-template>
<xsl:apply-templates select="subtitle"/>
</h2>
</xsl:if>
<xsl:text> </xsl:text>
<h2>
<xsl:call-template name="anchor">
<xsl:with-param name="node" select="w3c-doctype[1]"/>
<xsl:with-param name="conditional" select="0"/>
<xsl:with-param name="default.id" select="'w3c-doctype'"/>
</xsl:call-template>
<xsl:apply-templates select="w3c-doctype"/>
<xsl:text> </xsl:text>
<xsl:if test="pubdate/day">
<xsl:apply-templates select="pubdate/day"/>
<xsl:text> </xsl:text>
</xsl:if>
<xsl:apply-templates select="pubdate/month"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="pubdate/year"/>
</h2>
<dl>
<xsl:apply-templates select="publoc"/>
<xsl:apply-templates select="latestloc"/>
<xsl:apply-templates select="prevlocs"/>
<xsl:apply-templates select="latestloc-major"/>
<xsl:apply-templates select="latestloc-tech"/>