-
Notifications
You must be signed in to change notification settings - Fork 11
/
xmlspec.xsl
2555 lines (2301 loc) · 79.9 KB
/
xmlspec.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:saxon="http://icl.com/saxon"
exclude-result-prefixes="saxon"
version="1.0">
<!-- ====================================================================== -->
<!-- xmlspec.xsl: An HTML XSL[1] Stylesheet for XML Spec V2.1[2] markup
Version: $Id: xmlspec.xsl,v 1.15 2015/06/21 10:53:30 dcarlis Exp $
URI: http://dev.w3.org/cvsweb/spec-prod/html/xmlspec.xsl
Authors: Norman Walsh ([email protected])
Chris Maden ([email protected])
Ben Trafford ([email protected])
Eve Maler ([email protected])
Henry S. Thompson ([email protected])
Date: Created 07 September 1999
Last updated $Date: 2015/06/21 10:53:30 $ by $Author: dcarlis $
Copyright (C) 2000, 2001, 2002 Sun Microsystems, Inc. All Rights Reserved.
This document is governed by the W3C Software License[3] as
described in the FAQ[4].
[1] http://www.w3.org/TR/xslt
[2] http://www.w3.org/XML/1998/06/xmlspec-report-v21.htm
[3] http://www.w3.org/Consortium/Legal/copyright-software-19980720
[4] http://www.w3.org/Consortium/Legal/IPR-FAQ-20000620.html#DTD
Notes:
This stylesheet attempts to implement the XML Specification V2.1
DTD. Documents conforming to earlier DTDs may not be correctly
transformed.
ChangeLog: (See also: CVS ChangeLog)
15 August 2002: Norman Walsh, <[email protected]>
- Version 1.3 released at http://www.w3.org/2002/xmlspec/html/1.3/xmlspec.xsl
There have never been any "official" releases before, so the version number
is arbitrary.
15 August 2001: Hugo Haas <[email protected]>
- Slightly modified the status sentence introducing editors'
copies.
- Now using role to distinguish editors' copies: e.g.
<spec w3c-doctype="wd" role="editors-copy">
14 August 2001: Hugo Haas <[email protected]>
- If w3c-doctype is not a W3C TR, do not use a Note style
sheet, use <http://www.w3.org/StyleSheets/TR/base.css>
instead.
- If the other-doctype is "editors-copy", do not use the W3C
logo and mark the document as such in the status section.
12 Jun 2001: ([email protected])
- Support non-tabular examples. If tabular.examples is non-zero,
tables will be used for examples, otherwise nested divs and
CSS will be used. tabular.examples is *zero* by default.
06 Jun 2001: ([email protected])
- Support copyright element in header; use the content of that
element if it is present, otherwise use the auto-generated
copyright statement.
15 May 2001: ([email protected])
- Changed copyright link to point to dated IPR statement:
http://www.w3.org/Consortium/Legal/ipr-notice-20000612
25 Sep 2000: ([email protected])
- Sync'd with Eve's version:
o Concatenated each inline element's output all on one line
to avoid spurious spaces in the output. (This is really an
IE bug, but...) (15 Sep 2000)
o Updated crism's email address in header (7 Sep 2000)
o Changed handling of affiliation to use comma instead of
parentheses (9 Aug 2000)
14 Aug 2000: ([email protected])
- Added additional.title param (for diffspec.xsl to change)
- Fixed URI of W3C home icon
- Made CSS stylesheet selection depend on the w3c-doctype attribute
of spec instead of the w3c-doctype element in the header
26 Jul 2000: ([email protected])
- Improved semantics of specref. Added xsl:message for unsupported
cases. (I'm by no means confident that I've covered the whole
list.)
- Support @role on author.
- Make lhs/rhs "code" in EBNF.
- Fixed bug in ID/IDREF linking.
- More effectively disabled special markup for showing @diffed
versions
21 Jul 2000: ([email protected])
- Added support for @diff change tracking, primarily through
the auxiliary stylesheet diffspec.xsl. However, it was
impractical to handle some constructions, such as DLs and TABLEs,
in a completely out-of-band manner. So there is some inline
support for @diff markup.
- Added $additional.css to allow downstream stylesheets to add
new markup to the <style> element.
- Added required "type" attribute to the <style> element.
- Fixed pervasive problem with nested <a> elements.
- Added doctype-public to xsl:output.
- Added $validity.hacks. If "1", then additional disable-output-escaping
markup may be inserted in some places to attempt to get proper,
valid HTML. For example, if a <glist> appears inside a <p> in the
xmlspec source, this creates a nested <dl> inside a <p> in the
HTML, which is not valid. If $validity.hacks is "1", then an
extra </p>, <p> pair is inserted around the <dl>.
5 June 2001, Henry S. Thompson ([email protected])
- Fixed a link in copyright boilerplate to be dated
-->
<!-- ====================================================================== -->
<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">1</xsl:param>
<xsl:param name="show.diff.markup">0</xsl:param>
<xsl:param name="additional.css"></xsl:param>
<xsl:param name="additional.title"></xsl:param>
<xsl:param name="called.by.diffspec">0</xsl:param>
<xsl:param name="show.ednotes">1</xsl:param>
<xsl:param name="show.issues">1</xsl:param>
<xsl:param name="tabular.examples">0</xsl:param>
<xsl:param name="toc.level" select="5"/>
<xsl:key name="ids" match="*[@id]" use="@id"/>
<xsl:key name="specrefs" match="specref" use="@ref"/>
<xsl:output method="html"
encoding="utf-8"
doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
indent="no"/>
<xsl:strip-space elements="author"/>
<!-- 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>
<font color="red">
<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>
</font>
</xsl:template>
<!-- Template for the root node. Creation of <html> element could
go here, but that doesn't feel right. -->
<xsl:template match="/">
<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">
<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/>
</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 name="{@id}" 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:choose>
<xsl:when test="@href">
<a href="{@href}">
<xsl:apply-templates/>
</a>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
<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='1'">
<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">
<div class="toc">
<xsl:text> </xsl:text>
<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>
<p class="toc">
<xsl:apply-templates select="div1" mode="toc"/>
</p>
<xsl:if test="../back">
<xsl:text> </xsl:text>
<h3>
<xsl:call-template name="anchor">
<xsl:with-param name="conditional" select="0"/>
<xsl:with-param name="default.id" select="'appendices'"/>
</xsl:call-template>
<xsl:text>Appendi</xsl:text>
<xsl:choose>
<xsl:when test="count(../back/div1 | ../back/inform-div1) > 1">
<xsl:text>ces</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>x</xsl:text>
</xsl:otherwise>
</xsl:choose>
</h3>
<p class="toc">
<xsl:apply-templates mode="toc"
select="../back/div1 | ../back/inform-div1"/>
</p>
</xsl:if>
<xsl:if test="//footnote[not(ancestor::table)]">
<p class="toc">
<a href="#endnotes">
<xsl:text>End Notes</xsl:text>
</a>
</p>
</xsl:if>
</div>
<hr/>
</xsl:if>
<div class="body">
<xsl:apply-templates/>
</div>
</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='1'">
<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 valign="baseline">
<td/><td/><td/><td/>
<td>
<xsl:if test="ancestor-or-self::*/@diff and $show.diff.markup='1'">
<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='1'">
<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 valign="baseline">
<td/><td/><td/><td/>
<td>
<xsl:if test="@diff and $show.diff.markup='1'">
<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 border="1">
<xsl:attribute name="summary">
<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 align="left" valign="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 align="right" valign="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>
<td colspan="2" align="left" valign="top">
<xsl:apply-templates select="edtext"/>
</td>
</tr>
</table>
</xsl:if>
</xsl:template>
<xsl:template match="date">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="ednote/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>
<!-- 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="exampleHead">
<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:variable name="content">
<pre>
<xsl:if test="@diff and $show.diff.markup='1'">
<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%"
summary="Example">
<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 name="FN-ANCH-{$this-note-id}" 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 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 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 name="{../@id}" 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="scrap/head">
<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="vcnote/head">
<p class="prefix">
<xsl:if test="../@id">
<a name="{../@id}" 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 name="{../@id}" 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($editors-copy='yes' or /spec/@role='editors-copy')">
<p>
<a href="http://www.w3.org/">
<img src="http://www.w3.org/Icons/w3c_home"
alt="W3C" height="48" width="72"/>