• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
2                version="1.0"
3
4                xmlns:msxsl="urn:schemas-microsoft-com:xslt"
5                xmlns:exslt="http://exslt.org/common"
6                xmlns:myns="mailto:julian.reschke@greenbytes.de?subject=rcf2629.xslt"
7                xmlns:ed="http://greenbytes.de/2002/rfcedit"
8
9                exclude-result-prefixes="msxsl exslt myns ed"
10                >
11<!--
12    XSLT transformation from RFC2629 XML format to HTML
13
14    Copyright (c) 2001-2004 Julian F. Reschke (julian.reschke@greenbytes.de)
15
16    placed into the public domain
17
18    change history:
19
20    2001-03-28  julian.reschke@greenbytes.de
21
22    Code rearranged, generate numbered section anchors for paragraphs (t)
23    as well. Fixes in index handling.
24
25    2001-04-12  julian.reschke@greenbytes.de
26
27    Moved HTML output into XHTML namespace.
28
29    2001-10-02  julian.reschke@greenbytes.de
30
31    Fixed default location for RFCs and numbering of section references.
32    Support ?rfc editing processing instruction.
33
34    2001-10-07  julian.reschke@greenbytes.de
35
36    Made telephone number links active.
37
38    2001-10-08  julian.reschke@greenbytes.de
39
40    Support for vspace element.
41
42    2001-10-09  julian.reschke@greenbytes.de
43
44    Experimental support for rfc-issue PI.
45
46    2001-11-11  julian.reschke@greenbytes.de
47
48    Support rfc private PI. Removed bogus code reporting the WG in the header.
49
50    2001-12-17  julian.reschke@greenbytes.de
51
52    Support title attribute on references element
53
54    2002-01-05  julian.reschke@greenbytes.de
55
56    Support for list/@style="@format"
57
58    2002-01-09  julian.reschke@greenbytes.de
59
60    Display "closed" RFC issues as deleted
61
62    2002-01-14  julian.reschke@greenbytes.de
63
64    Experimentally and optionally parse XML encountered in artwork elements
65    (requires MSXSL).
66
67    2002-01-27  julian.reschke@greenbytes.de
68
69    Some cleanup. Moved RFC issues from PIs into namespaced elements.
70
71    2002-01-29  julian.reschke@greenbytes.de
72
73    Added support for sortrefs PI. Added support for figure names.
74
75    2002-02-07  julian.reschke@greenbytes.de
76
77    Highlight parts of artwork which are too wide (72 characters).
78
79    2002-02-12  julian.reschke@greenbytes.de
80
81    Code rearrangement for static texts. Fixes for section numbering.
82    TOC generation rewritten.
83
84    2002-02-15  julian.reschke@greenbytes.de
85
86    Support for irefs in sections; support iref @primary=true
87
88    2002-03-03  julian.reschke@greenbytes.de
89
90    Moved anchor prefix into a constant. Added sanity checks on user anchor
91    names.
92
93    2002-03-23  julian.reschke@greenbytes.de
94
95    Bugfix in detection of matching org names when creating the header. Fixed
96    sorting in subitems.
97
98    2002-04-02  julian.reschke@greenbytes.de
99
100    Fix TOC link HTML generation when no TOC is generated (created broken
101    HTML table code).
102
103    2002-04-03  julian.reschke@greenbytes.de
104
105    Made rendering of references more tolerant re: missing parts.
106
107    2002-04-08  julian.reschke@greenbytes.de
108
109    Fixed reference numbering when references are split into separate sections.
110
111    2002-04-16  julian.reschke@greenbytes.de
112
113    Fix default namespace (shouldn't be set for HTML output method).
114
115    2002-04-19  julian.reschke@greenbytes.de
116
117    Lowercase internal CSS selectors for Mozilla compliance. Do not put TOC
118    into ul element.
119
120    2002-04-21  julian.reschke@greenbytes.de
121
122    Make numbered list inside numbered lists use alphanumeric numbering.
123
124    2002-05-05  julian.reschke@greenbytes.de
125
126    Updated issue/editing support.
127
128    2002-05-15  julian.reschke@greenbytes.de
129
130    Bugfix for section numbering after introduction of ed:replace
131
132    2002-06-21  julian.reschke@greenbytes.de
133
134    When producing private documents, do not include document status, copyright etc.
135
136    2002-07-08  julian.reschke@greenbytes.de
137
138    Fix xrefs to Appendices.
139
140    2002-07-19  fielding
141
142    Make artwork lightyellow for easier reading.
143
144    2002-10-09  fielding
145
146    Translate references title to anchor name to avoid non-uri characters.
147
148    2002-10-13  julian.reschke@greenbytes.de
149
150    Support for tocdepth PI.
151
152    2002-11-03  julian.reschke@greenbytes.de
153
154    Added temporariry workaround for Mozilla/Transformiix result tree fragment problem.
155    (search for 'http://bugzilla.mozilla.org/show_bug.cgi?id=143668')
156
157    2002-12-25  julian.reschke@greenbytes.de
158
159    xref code: attempt to uppercase "section" and "appendix" when at the start
160    of a sentence.
161
162    2003-02-02  julian.reschke@greenbytes.de
163
164    fixed code for vspace blankLines="0", enhanced display for list with "format" style,
165    got rid of HTML blockquote elements, added support for "hangIndent"
166
167    2003-04-10  julian.reschke@greenbytes.de
168
169    experimental support for appendix and spanx elements
170
171    2003-04-19  julian.reschke@greenbytes.de
172
173    fixed counting of list numbers in "format %" styles (one counter
174    per unique format string). Added more spanx styles.
175
176    2003-05-02  julian.reschke@greenbytes.de
177
178    experimental texttable support
179
180    2003-05-02  fielding
181
182    Make mailto links optional (default = none) (jre: default and PI name changed)
183
184    2003-05-04  julian.rechke@greenbytes.de
185
186    experimental support for HTML link elements; fix default for table header
187    alignment default
188
189    2003-05-06  julian.rechke@greenbytes.de
190
191    support for "background" PI.
192
193    2003-05-11  julian.reschke@greenbytes.de
194
195    change %c format to lowercase alphabetic. add support for keyword
196    elements (generate META tag). fix various HTML conformance problems.
197    added experimental support for role attribute. do not number paragraphs
198    in unnumbered sections. update boilerplate texts. support for
199    "iprnotified" PI. bugfix list numbering. strip whitespace when
200    building tel: URIs.
201
202    2003-05-12  julian.reschke@greenbytes.de
203
204    more conformance fixes (layout moved into CSS, move lists and figures
205    out of para content, do not use tables for list formatting)
206
207    2003-05-13  julian.reschke@greenbytes.de
208
209    add DC.Creator meta tag, refactoring
210
211    2003-05-16  julian.reschke@greenbytes.de
212
213    put nbsps between "section" and section number (xref).
214
215    2003-05-18  julian.reschke@greenbytes.de
216
217    author summary: add missing comma.
218
219    2003-06-06  julian.reschke@greenbytes.de
220
221    fix index generation bug (transposed characters in key generation). Enhance
222    sentence start detection (xref starting a section was using lowercase
223    "section").
224
225    2003-06-22  julian.reschke@greenbytes.de
226
227    exp. support for xref/@format. Add missing support for eref w/o content.
228    exp. support for annotations in reference elements. Code cleanup
229    reference table formatting.
230
231    2003-07-09  julian.reschke@greenbytes.de
232
233    Another fix for DC.Creator meta tag creation based on RFC2731
234
235    2003-07-24  julian.reschke@greenbytes.de
236
237    Fix namespace name for DC.Creator.
238
239    2003-08-06  julian.reschke@greenbytes.de
240
241    Cleanup node-set support (only use exslt (saxon, xalan, libxslt) extension
242    functions; remove Transformix workarounds that stopped to work in Moz 1.4)
243
244    2003-08-09  julian.reschke@greenbytes.de
245
246    Generate HTML lang tag.
247
248    2003-08-10  julian.reschke@greenbytes.de
249
250    Map spanx/verb to HTML "samp" element. Fix author name display in
251    references (reverse surname/initials for last author), add "Ed.".
252    Fix internal bookmark generation.
253
254    2003-08-17  julian.reschke@greenbytes.de
255
256    Add DCMI dates, identifiers and abstract. Add PI to suppress DCMI
257    generation.  Do not add TOC entry to Copyright Statement when there is
258    none. Align RFC2629 PI names and parameter names. Change style for
259    inline URIs generated by eref. Add header and footer support.
260    Enhance CSS paging properties. Support topblock PI. Added hooks for
261    proper XHTML generation through separate XSLT. Enhance warning and
262    error messages. Add support for artwork image display. Table formatting
263    fixes (borders, thead continuation).
264
265    2003-08-18  julian.reschke@greenbytes.de
266
267    Add workaround for MSXML4 node-set and Mozilla node-set issues (fallback
268    just displays are warning).
269
270    2003-10-06  julian.reschke@greenbytes.de
271
272    Add workaround for broken pre/ins handling in Mozilla
273    (see <http://bugzilla.mozilla.org/show_bug.cgi?id=204401>). Make use
274    of cite attribute on ed:replace. CSS cleanup.
275
276    2003-10-08  julian.reschke@greenbytes.de
277
278    Fix minor issue detecting the same org for the header (caused by IE's
279    non-standard whitespace handling). Fix default handling for /rfc/@category.
280
281    2003-11-09  julian.reschke@greenbytes.de
282
283    Inherit ed:entered-by from ancestor elements. Change CSS color for inserted
284    text to green. Generate issues-list anchor. Do not complain about missing
285    targets when the xref element is below ed:del. Remove code that attempted
286    to distinguish section/Section when producing links - always use
287    uppercase. Fix date rendering for issue resolutions.
288
289    2003-11-29  julian.reschke@greenbytes.de
290
291    Fix color values for table backgrounds for issue rendering. Change
292    rendering of issue links to use inline-styles. Add colored issue markers to
293    issues.
294
295    2003-12-13  julian.reschke@greenbytes.de
296
297    Fix inheritance of ed:entered-by attribute. Display note elements inside
298    change tracking as well.
299
300    2004-01-18  julian.reschke@greenbytes.de
301
302    When PI compact = 'yes', make most CSS print page breaks conditional.
303
304    2004-02-20  julian.reschke@greenbytes.de
305
306    Support for RFC3667 IPR changes (xml2rfc 1.22); see
307    <http://lists.xml.resource.org/pipermail/xml2rfc/2004-February/001088.html>.
308
309    2004-03-11  julian.reschke@greenbytes.de
310
311    Add "(if approved)" to "updates" and "obsoletes" unless the document has
312    an RFC number.
313
314    2004-04-01  julian.reschke@greenbytes.de
315
316    Fix RFC3667 output, see <http://lists.xml.resource.org/pipermail/xml2rfc/2004-April/001208.html>
317-->
318
319
320<xsl:output method="html" encoding="iso-8859-1" version="4.0" doctype-public="-//W3C//DTD HTML 4.01//EN" />
321
322
323<!-- process some of the processing instructions supported by Marshall T. Rose's
324     xml2rfc sofware, see <http://xml.resource.org/> -->
325
326
327<!-- rfc compact PI -->
328
329<xsl:param name="xml2rfc-compact"
330  select="substring-after(
331      translate(/processing-instruction('rfc')[contains(.,'compact=')], '&quot; ', ''),
332        'compact=')"
333/>
334
335<!-- rfc footer PI -->
336
337<xsl:param name="xml2rfc-footer"
338  select="substring-after(
339      translate(/processing-instruction('rfc')[contains(.,'footer=')], '&quot; ', ''),
340        'footer=')"
341/>
342
343<!-- rfc header PI -->
344
345<xsl:param name="xml2rfc-header"
346  select="substring-after(
347      translate(/processing-instruction('rfc')[contains(.,'header=')], '&quot; ', ''),
348        'header=')"
349/>
350
351<!-- include a table of contents if a processing instruction <?rfc?>
352     exists with contents toc="yes". Can be overriden by an XSLT parameter -->
353
354<xsl:param name="xml2rfc-toc"
355  select="substring-after(
356      translate(/processing-instruction('rfc')[contains(.,'toc=')], '&quot; ', ''),
357        'toc=')"
358/>
359
360<!-- optional tocdepth-->
361
362<xsl:param name="xml2rfc-tocdepth"
363  select="substring-after(
364      translate(/processing-instruction('rfc')[contains(.,'tocdepth=')], '&quot; ', ''),
365        'tocdepth=')"
366/>
367
368<xsl:variable name="parsedTocDepth">
369  <xsl:choose>
370    <xsl:when test="$xml2rfc-tocdepth='1'">1</xsl:when>
371    <xsl:when test="$xml2rfc-tocdepth='2'">2</xsl:when>
372    <xsl:when test="$xml2rfc-tocdepth='3'">3</xsl:when>
373    <xsl:when test="$xml2rfc-tocdepth='4'">4</xsl:when>
374    <xsl:when test="$xml2rfc-tocdepth='5'">5</xsl:when>
375    <xsl:otherwise>99</xsl:otherwise>
376  </xsl:choose>
377</xsl:variable>
378
379<!-- suppress top block if a processing instruction <?rfc?>
380     exists with contents tocblock="no". Can be overriden by an XSLT parameter -->
381
382<xsl:param name="xml2rfc-topblock"
383  select="substring-after(
384      translate(/processing-instruction('rfc')[contains(.,'topblock=')], '&quot; ', ''),
385        'topblock=')"
386/>
387
388<!-- use symbolic reference names instead of numeric ones if a processing instruction <?rfc?>
389     exists with contents symrefs="yes". Can be overriden by an XSLT parameter -->
390
391<xsl:param name="xml2rfc-symrefs"
392  select="substring-after(
393      translate(/processing-instruction('rfc')[contains(.,'symrefs=')], '&quot; ', ''),
394        'symrefs=')"
395/>
396
397<!-- sort references if a processing instruction <?rfc?>
398     exists with contents sortrefs="yes". Can be overriden by an XSLT parameter -->
399
400<xsl:param name="xml2rfc-sortrefs"
401  select="substring-after(
402      translate(/processing-instruction('rfc')[contains(.,'sortrefs=')], '&quot; ', ''),
403        'sortrefs=')"
404/>
405
406<!-- insert editing marks if a processing instruction <?rfc?>
407     exists with contents editing="yes". Can be overriden by an XSLT parameter -->
408
409<xsl:param name="xml2rfc-editing"
410  select="substring-after(
411      translate(/processing-instruction('rfc')[contains(.,'editing=')], '&quot; ', ''),
412        'editing=')"
413/>
414
415<!-- make it a private paper -->
416
417<xsl:param name="xml2rfc-private"
418  select="substring-after(
419      translate(/processing-instruction('rfc')[contains(.,'private=')], '&quot;', ''),
420        'private=')"
421/>
422
423<!-- background image? -->
424
425<xsl:param name="xml2rfc-background"
426  select="substring-after(
427      translate(/processing-instruction('rfc')[contains(.,'background=')], '&quot;', ''),
428        'background=')"
429/>
430
431<!-- extension for XML parsing in artwork -->
432
433<xsl:param name="parse-xml-in-artwork"
434  select="substring-after(
435      translate(/processing-instruction('rfc-ext')[contains(.,'parse-xml-in-artwork=')], '&quot; ', ''),
436        'parse-xml-in-artwork=')"
437/>
438
439<!-- extension for exclusing DCMI properties in meta tag (RFC2731) -->
440
441<xsl:param name="xml2rfc-ext-support-rfc2731"
442  select="substring-after(
443      translate(/processing-instruction('rfc-ext')[contains(.,'support-rfc2731=')], '&quot; ', ''),
444        'support-rfc2731=')"
445/>
446
447<!-- choose whether or not to do mailto links -->
448
449 <xsl:param name="xml2rfc-linkmailto"
450   select="substring-after(
451       translate(/processing-instruction('rfc')[contains(.,'linkmailto=')], '&quot;', ''),
452         'linkmailto=')"
453 />
454
455
456<!-- iprnotified switch -->
457
458 <xsl:param name="xml2rfc-iprnotified"
459   select="substring-after(
460       translate(/processing-instruction('rfc')[contains(.,'iprnotified=')], '&quot;', ''),
461         'iprnotified=')"
462 />
463
464
465<!-- URL prefix for RFCs. -->
466
467<xsl:param name="rfcUrlPrefix" select="'http://www.ietf.org/rfc/rfc'" />
468
469<!-- warning re: absent node-set ext. function -->
470<xsl:variable name="node-set-warning">
471  This stylesheet requires either an XSLT-1.0 processor with node-set()
472  extension function, or an XSLT-2.0 processor. Therefore, parts of the
473  document couldn't be displayed.
474</xsl:variable>
475
476<!-- build help keys for indices -->
477<xsl:key name="index-first-letter"
478  match="iref"
479    use="translate(substring(@item,1,1),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')" />
480
481<xsl:key name="index-item"
482  match="iref"
483    use="@item" />
484
485<xsl:key name="index-item-subitem"
486  match="iref"
487    use="concat(@item,'..',@subitem)" />
488
489<!-- character translation tables -->
490<xsl:variable name="lcase" select="'abcdefghijklmnopqrstuvwxyz'" />
491<xsl:variable name="ucase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
492
493<xsl:variable name="plain" select="' #/ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
494<xsl:variable name="touri" select="'___abcdefghijklmnopqrstuvwxyz'" />
495
496<!-- prefix for automatically generated anchors -->
497<xsl:variable name="anchor-prefix" select="'rfc'" />
498
499<!-- IPR version switch -->
500<xsl:variable name="ipr-rfc3667" select="(/rfc/@number &gt; 3708) or not((/rfc/@ipr = 'full2026') or
501  (/rfc/@ipr = 'noDerivativeWorks2026') or (/rfc/@ipr = 'noDerivativeWorksNow') or (/rfc/@ipr = 'none'))" />
502
503
504<!-- Templates for the various elements of rfc2629.dtd -->
505
506<xsl:template match="abstract">
507  <h1><a name="{$anchor-prefix}.abstract"/>Abstract</h1>
508  <xsl:apply-templates />
509</xsl:template>
510
511<msxsl:script language="JScript" implements-prefix="myns">
512  function parseXml(str) {
513    var doc = new ActiveXObject ("MSXML2.DOMDocument");
514    doc.async = false;
515    if (doc.loadXML (str)) return "";
516    return doc.parseError.reason + "\n" + doc.parseError.srcText + " (" + doc.parseError.line + "/" + doc.parseError.linepos + ")";
517  }
518</msxsl:script>
519
520<xsl:template match="artwork">
521  <xsl:if test="not(ancestor::ed:del) and $parse-xml-in-artwork='yes' and function-available('myns:parseXml')">
522    <xsl:if test="contains(.,'&lt;?xml')">
523      <xsl:variable name="body" select="substring-after(substring-after(.,'&lt;?xml'),'?>')" />
524      <xsl:if test="$body!='' and myns:parseXml($body)!=''">
525        <table style="background-color: red; border-width: thin; border-style: solid; border-color: black;">
526        <tr><td>
527        XML PARSE ERROR:
528        <pre><xsl:value-of select="myns:parseXml($body)" /></pre>
529        </td></tr></table>
530      </xsl:if>
531    </xsl:if>
532    <xsl:if test="@ed:parse-xml-after">
533      <xsl:if test="myns:parseXml(string(.))!=''">
534        <table style="background-color: red; border-width: thin; border-style: solid; border-color: black;">
535        <tr><td>
536        XML PARSE ERROR:
537        <pre><xsl:value-of select="myns:parseXml(string(.))" /></pre>
538        </td></tr></table>
539      </xsl:if>
540    </xsl:if>
541  </xsl:if>
542  <pre>
543    <xsl:call-template name="insertInsDelClass" />
544    <!--<xsl:value-of select="." />--><xsl:call-template name="showArtwork">
545    <xsl:with-param name="mode" select="'html'" />
546    <xsl:with-param name="text" select="." />
547    <xsl:with-param name="initial" select="'yes'" />
548  </xsl:call-template></pre>
549</xsl:template>
550
551<xsl:template match="artwork[@src and starts-with(@type,'image/')]">
552  <img src="{@src}" alt="{.}">
553    <xsl:copy-of select="@width|@height"/>
554  </img>
555</xsl:template>
556
557<xsl:template match="author">
558  <tr>
559    <td>&#0160;</td>
560    <td>
561      <xsl:value-of select="@fullname" />
562      <xsl:if test="@role">
563        (<xsl:value-of select="@role" />)
564      </xsl:if>
565    </td>
566  </tr>
567  <tr>
568    <td>&#0160;</td>
569    <td><xsl:value-of select="organization" /></td>
570  </tr>
571  <xsl:if test="address/postal/street!=''">
572    <tr>
573      <td>&#0160;</td>
574      <td><xsl:for-each select="address/postal/street"><xsl:value-of select="." /><br /></xsl:for-each></td>
575    </tr>
576  </xsl:if>
577  <xsl:if test="address/postal/city|address/postal/region|address/postal/code">
578    <tr>
579      <td>&#0160;</td>
580      <td>
581        <xsl:if test="address/postal/city"><xsl:value-of select="address/postal/city" />, </xsl:if>
582        <xsl:if test="address/postal/region"><xsl:value-of select="address/postal/region" />&#160;</xsl:if>
583        <xsl:if test="address/postal/code"><xsl:value-of select="address/postal/code" /></xsl:if>
584      </td>
585    </tr>
586  </xsl:if>
587  <xsl:if test="address/postal/country">
588    <tr>
589      <td>&#0160;</td>
590      <td><xsl:value-of select="address/postal/country" /></td>
591    </tr>
592  </xsl:if>
593  <xsl:if test="address/phone">
594    <tr>
595      <td class="right"><b>Phone:&#0160;</b></td>
596      <td><a href="tel:{translate(address/phone,' ','')}"><xsl:value-of select="address/phone" /></a></td>
597    </tr>
598  </xsl:if>
599  <xsl:if test="address/facsimile">
600    <tr>
601      <td class="right"><b>Fax:&#0160;</b></td>
602      <td><a href="fax:{translate(address/facsimile,' ','')}"><xsl:value-of select="address/facsimile" /></a></td>
603    </tr>
604  </xsl:if>
605  <xsl:if test="address/email">
606    <tr>
607      <td class="right"><b>EMail:&#0160;</b></td>
608      <td>
609        <a>
610          <xsl:if test="$xml2rfc-linkmailto!='no'">
611            <xsl:attribute name="href">mailto:<xsl:value-of select="address/email" /></xsl:attribute>
612          </xsl:if>
613          <xsl:value-of select="address/email" />
614        </a>
615      </td>
616    </tr>
617  </xsl:if>
618  <xsl:if test="address/uri">
619    <tr>
620      <td class="right"><b>URI:&#0160;</b></td>
621      <td><a href="{address/uri}"><xsl:value-of select="address/uri" /></a></td>
622    </tr>
623  </xsl:if>
624  <tr>
625    <td>&#0160;</td>
626    <td />
627  </tr>
628</xsl:template>
629
630<xsl:template match="back">
631
632  <!-- add references section first, no matter where it appears in the
633    source document -->
634  <xsl:apply-templates select="references" />
635
636  <!-- next, add information about the document's authors -->
637  <xsl:call-template name="insertAuthors" />
638
639  <!-- add all other top-level sections under <back> -->
640  <xsl:apply-templates select="*[not(self::references)]" />
641
642  <xsl:if test="not($xml2rfc-private)">
643    <!-- copyright statements -->
644    <xsl:variable name="copyright"><xsl:call-template name="insertCopyright" /></xsl:variable>
645
646    <!-- emit it -->
647    <xsl:choose>
648      <xsl:when test="function-available('msxsl:node-set')">
649        <xsl:apply-templates select="msxsl:node-set($copyright)" />
650      </xsl:when>
651      <xsl:when test="function-available('exslt:node-set')">
652        <xsl:apply-templates select="exslt:node-set($copyright)" />
653      </xsl:when>
654      <xsl:otherwise>
655        <xsl:message><xsl:value-of select="$node-set-warning"/></xsl:message>
656        <p class="error"><xsl:value-of select="$node-set-warning"/></p>
657      </xsl:otherwise>
658    </xsl:choose>
659  </xsl:if>
660
661  <!-- insert the index if index entries exist -->
662  <xsl:if test="//iref">
663    <xsl:call-template name="insertIndex" />
664  </xsl:if>
665
666</xsl:template>
667
668<xsl:template match="eref[node()]">
669  <a href="{@target}"><xsl:apply-templates /></a>
670</xsl:template>
671
672<xsl:template match="eref[not(node())]">
673  <xsl:text>&lt;</xsl:text>
674  <a href="{@target}"><xsl:value-of select="@target" /></a>
675  <xsl:text>&gt;</xsl:text>
676</xsl:template>
677
678<xsl:template match="figure">
679  <xsl:if test="@anchor!=''">
680    <div><a name="{@anchor}" /></div>
681  </xsl:if>
682  <xsl:choose>
683    <xsl:when test="@title!='' or @anchor!=''">
684      <xsl:variable name="n"><xsl:number level="any" count="figure[@title!='' or @anchor!='']" /></xsl:variable>
685      <div><a name="{$anchor-prefix}.figure.{$n}" /></div>
686    </xsl:when>
687    <xsl:otherwise>
688      <xsl:variable name="n"><xsl:number level="any" count="figure[not(@title!='' or @anchor!='')]" /></xsl:variable>
689      <div><a name="{$anchor-prefix}.figure.u.{$n}" /></div>
690    </xsl:otherwise>
691  </xsl:choose>
692  <xsl:apply-templates />
693  <xsl:if test="@title!='' or @anchor!=''">
694    <xsl:variable name="n"><xsl:number level="any" count="figure[@title!='' or @anchor!='']" /></xsl:variable>
695    <p class="figure">Figure <xsl:value-of select="$n"/><xsl:if test="@title!=''">: <xsl:value-of select="@title" /></xsl:if></p>
696  </xsl:if>
697</xsl:template>
698
699<xsl:template match="front">
700
701  <xsl:if test="$xml2rfc-topblock!='no'">
702    <xsl:call-template name="insertTocLink">
703      <xsl:with-param name="includeTitle" select="true()" />
704    </xsl:call-template>
705
706    <!-- collect information for left column -->
707
708    <xsl:variable name="leftColumn">
709      <xsl:call-template name="collectLeftHeaderColumn" />
710    </xsl:variable>
711
712    <!-- collect information for right column -->
713
714    <xsl:variable name="rightColumn">
715      <xsl:call-template name="collectRightHeaderColumn" />
716    </xsl:variable>
717
718    <!-- insert the collected information -->
719    <table summary="header information" class="header" border="0" cellpadding="1" cellspacing="1">
720      <xsl:choose>
721        <xsl:when test="function-available('msxsl:node-set')">
722          <xsl:call-template name="emitheader">
723            <xsl:with-param name="lc" select="msxsl:node-set($leftColumn)" />
724            <xsl:with-param name="rc" select="msxsl:node-set($rightColumn)" />
725          </xsl:call-template>
726        </xsl:when>
727        <xsl:when test="function-available('exslt:node-set')">
728          <xsl:call-template name="emitheader">
729            <xsl:with-param name="lc" select="exslt:node-set($leftColumn)" />
730            <xsl:with-param name="rc" select="exslt:node-set($rightColumn)" />
731          </xsl:call-template>
732        </xsl:when>
733        <xsl:otherwise>
734          <xsl:message><xsl:value-of select="$node-set-warning"/></xsl:message>
735          <p class="error"><xsl:value-of select="$node-set-warning"/></p>
736        </xsl:otherwise>
737      </xsl:choose>
738    </table>
739  </xsl:if>
740
741  <p class="title">
742    <!-- main title -->
743    <xsl:value-of select="title"/>
744    <xsl:if test="/rfc/@docName">
745      <br/>
746      <span class="filename"><xsl:value-of select="/rfc/@docName"/></span>
747    </xsl:if>
748  </p>
749
750  <xsl:if test="not($xml2rfc-private)">
751    <!-- Get status info formatted as per RFC2629-->
752    <xsl:variable name="preamble"><xsl:call-template name="insertPreamble" /></xsl:variable>
753
754    <!-- emit it -->
755    <xsl:choose>
756      <xsl:when test="function-available('msxsl:node-set')">
757        <xsl:apply-templates select="msxsl:node-set($preamble)" />
758      </xsl:when>
759      <xsl:when test="function-available('exslt:node-set')">
760        <xsl:apply-templates select="exslt:node-set($preamble)" />
761      </xsl:when>
762      <xsl:otherwise>
763        <xsl:message><xsl:value-of select="$node-set-warning"/></xsl:message>
764        <p class="error"><xsl:value-of select="$node-set-warning"/></p>
765      </xsl:otherwise>
766    </xsl:choose>
767  </xsl:if>
768
769  <xsl:apply-templates select="abstract" />
770  <xsl:apply-templates select="note" />
771  <!-- show notes inside change tracking as well -->
772  <xsl:apply-templates select="ed:replace[.//note]" />
773
774  <xsl:if test="$xml2rfc-toc='yes'">
775    <xsl:apply-templates select="/" mode="toc" />
776    <xsl:call-template name="insertTocAppendix" />
777  </xsl:if>
778
779</xsl:template>
780
781
782<xsl:template match="iref">
783  <a><xsl:attribute name="name"><xsl:value-of select="$anchor-prefix"/>.iref.<xsl:number level="any"/></xsl:attribute></a>
784</xsl:template>
785
786<!-- list templates depend on the list style -->
787
788<xsl:template match="list[@style='empty' or not(@style)]">
789  <dl>
790    <xsl:call-template name="insertInsDelClass"/>
791    <xsl:apply-templates />
792  </dl>
793</xsl:template>
794
795<xsl:template match="list[starts-with(@style,'format ')]">
796  <dl>
797    <xsl:call-template name="insertInsDelClass"/>
798    <xsl:apply-templates />
799  </dl>
800</xsl:template>
801
802<xsl:template match="list[@style='hanging']">
803  <dl>
804    <xsl:call-template name="insertInsDelClass"/>
805    <xsl:apply-templates />
806  </dl>
807</xsl:template>
808
809<xsl:template match="list[@style='numbers']">
810  <ol>
811    <xsl:call-template name="insertInsDelClass"/>
812    <xsl:apply-templates />
813  </ol>
814</xsl:template>
815
816<!-- numbered list inside numbered list -->
817<xsl:template match="list[@style='numbers']/t/list[@style='numbers']" priority="9">
818  <ol style="list-style-type: lower-alpha">
819    <xsl:call-template name="insertInsDelClass"/>
820    <xsl:apply-templates />
821  </ol>
822</xsl:template>
823
824<xsl:template match="list[@style='symbols']">
825  <ul>
826    <xsl:call-template name="insertInsDelClass"/>
827    <xsl:apply-templates />
828  </ul>
829</xsl:template>
830
831<!-- same for t(ext) elements -->
832
833<xsl:template match="list[@style='empty' or not(@style)]/t">
834  <dd style="margin-top: .5em">
835    <xsl:apply-templates />
836  </dd>
837</xsl:template>
838
839<xsl:template match="list[@style='numbers' or @style='symbols']/t">
840  <li>
841    <xsl:apply-templates />
842  </li>
843</xsl:template>
844
845<xsl:template match="list[@style='hanging']/t">
846  <dt style="margin-top: .5em">
847    <xsl:value-of select="@hangText" />
848  </dt>
849  <dd>
850    <!-- if hangIndent present, use 0.7 of the specified value (1em is the width of the "m" character -->
851    <xsl:if test="../@hangIndent and ../@hangIndent!='0'">
852      <xsl:attribute name="style">margin-left: <xsl:value-of select="../@hangIndent * 0.7"/>em</xsl:attribute>
853    </xsl:if>
854    <xsl:apply-templates />
855  </dd>
856</xsl:template>
857
858<xsl:template match="list[starts-with(@style,'format ') and (contains(@style,'%c') or contains(@style,'%d'))]/t">
859  <xsl:variable name="list" select=".." />
860  <xsl:variable name="format" select="substring-after(../@style,'format ')" />
861  <xsl:variable name="pos">
862    <xsl:choose>
863      <xsl:when test="$list/@counter">
864        <xsl:number level="any" count="list[@counter=$list/@counter or (not(@counter) and @style=concat('format ',$list/@counter))]/t" />
865      </xsl:when>
866      <xsl:otherwise>
867        <xsl:number level="any" count="list[concat('format ',@counter)=$list/@style or (not(@counter) and @style=$list/@style)]/t" />
868      </xsl:otherwise>
869    </xsl:choose>
870  </xsl:variable>
871  <dt>
872    <xsl:choose>
873      <xsl:when test="contains($format,'%c')">
874        <xsl:value-of select="substring-before($format,'%c')"/><xsl:number value="$pos" format="a" /><xsl:value-of select="substring-after($format,'%c')"/>
875      </xsl:when>
876      <xsl:otherwise>
877        <xsl:value-of select="substring-before($format,'%d')"/><xsl:number value="$pos" format="1" /><xsl:value-of select="substring-after($format,'%d')"/>
878      </xsl:otherwise>
879    </xsl:choose>
880  </dt>
881  <dd>
882    <xsl:apply-templates />
883  </dd>
884</xsl:template>
885
886<xsl:template match="middle">
887  <xsl:apply-templates />
888</xsl:template>
889
890<xsl:template match="note">
891  <xsl:variable name="num"><xsl:number/></xsl:variable>
892  <h1><a name="{$anchor-prefix}.note.{$num}"/><xsl:value-of select="@title" /></h1>
893    <xsl:apply-templates />
894</xsl:template>
895
896<xsl:template match="postamble">
897  <p>
898    <xsl:call-template name="editingMark" />
899    <xsl:apply-templates />
900  </p>
901</xsl:template>
902
903<xsl:template match="preamble">
904  <p>
905    <xsl:call-template name="editingMark" />
906    <xsl:apply-templates />
907  </p>
908</xsl:template>
909
910
911<xsl:template match="reference">
912
913  <xsl:variable name="target">
914    <xsl:choose>
915      <xsl:when test="@target"><xsl:value-of select="@target" /></xsl:when>
916      <xsl:when test="seriesInfo/@name='RFC'"><xsl:value-of select="concat($rfcUrlPrefix,seriesInfo[@name='RFC']/@value,'.txt')" /></xsl:when>
917      <xsl:when test="seriesInfo[starts-with(.,'RFC')]">
918        <xsl:variable name="rfcRef" select="seriesInfo[starts-with(.,'RFC')]" />
919        <xsl:value-of select="concat($rfcUrlPrefix,substring-after (normalize-space($rfcRef), ' '),'.txt')" />
920      </xsl:when>
921      <xsl:otherwise />
922    </xsl:choose>
923  </xsl:variable>
924
925  <tr>
926    <td class="topnowrap">
927      <b>
928        <a name="{@anchor}">
929          <xsl:call-template name="referencename">
930            <xsl:with-param name="node" select="." />
931          </xsl:call-template>
932        </a>
933      </b>
934    </td>
935
936    <td class="top">
937      <xsl:for-each select="front/author">
938        <xsl:choose>
939          <xsl:when test="@surname and @surname!=''">
940            <xsl:variable name="displayname">
941              <!-- surname/initials is reversed for last author except when it's the only one -->
942              <xsl:choose>
943                <xsl:when test="position()=last() and position()!=1">
944                  <xsl:value-of select="concat(@initials,' ',@surname)" />
945                </xsl:when>
946                <xsl:otherwise>
947                  <xsl:value-of select="concat(@surname,', ',@initials)" />
948                </xsl:otherwise>
949              </xsl:choose>
950              <xsl:if test="@role='editor'">
951                <xsl:text>, Ed.</xsl:text>
952              </xsl:if>
953            </xsl:variable>
954            <xsl:choose>
955               <xsl:when test="address/email">
956                <a>
957                  <xsl:if test="$xml2rfc-linkmailto!='no'">
958                    <xsl:attribute name="href">mailto:<xsl:value-of select="address/email" /></xsl:attribute>
959                  </xsl:if>
960                  <xsl:if test="organization/text()">
961                    <xsl:attribute name="title"><xsl:value-of select="organization/text()"/></xsl:attribute>
962                  </xsl:if>
963                  <xsl:value-of select="$displayname" />
964                </a>
965              </xsl:when>
966              <xsl:otherwise>
967                <xsl:value-of select="$displayname" />
968              </xsl:otherwise>
969            </xsl:choose>
970
971            <xsl:if test="position()!=last() - 1">,&#0160;</xsl:if>
972            <xsl:if test="position()=last() - 1"> and </xsl:if>
973          </xsl:when>
974          <xsl:when test="organization/text()">
975            <xsl:choose>
976              <xsl:when test="address/uri">
977                <a href="{address/uri}"><xsl:value-of select="organization" /></a>
978              </xsl:when>
979              <xsl:otherwise>
980                <xsl:value-of select="organization" />
981              </xsl:otherwise>
982            </xsl:choose>
983            <xsl:if test="position()!=last() - 1">,&#0160;</xsl:if>
984            <xsl:if test="position()=last() - 1"> and </xsl:if>
985          </xsl:when>
986          <xsl:otherwise />
987        </xsl:choose>
988      </xsl:for-each>
989
990      <xsl:choose>
991        <xsl:when test="string-length($target) &gt; 0">
992          <xsl:text>"</xsl:text><a href="{$target}"><xsl:value-of select="front/title" /></a><xsl:text>"</xsl:text>
993        </xsl:when>
994        <xsl:otherwise>
995          <xsl:text>"</xsl:text><xsl:value-of select="front/title" /><xsl:text>"</xsl:text>
996        </xsl:otherwise>
997      </xsl:choose>
998
999      <xsl:for-each select="seriesInfo">
1000        <xsl:text>, </xsl:text>
1001        <xsl:choose>
1002          <xsl:when test="not(@name) and not(@value) and ./text()"><xsl:value-of select="." /></xsl:when>
1003          <xsl:otherwise><xsl:value-of select="@name" /><xsl:if test="@value!=''">&#0160;<xsl:value-of select="@value" /></xsl:if></xsl:otherwise>
1004        </xsl:choose>
1005      </xsl:for-each>
1006
1007      <xsl:if test="front/date/@year != '' and front/date/@year != '???'">
1008        <xsl:text>, </xsl:text>
1009        <xsl:if test="front/date/@month and front/date/@month!='???'"><xsl:value-of select="front/date/@month" />&#0160;</xsl:if>
1010        <xsl:value-of select="front/date/@year" />
1011      </xsl:if>
1012
1013      <xsl:text>.</xsl:text>
1014
1015      <xsl:for-each select="annotation">
1016        <br />
1017        <xsl:apply-templates />
1018      </xsl:for-each>
1019
1020    </td>
1021  </tr>
1022
1023
1024</xsl:template>
1025
1026
1027<xsl:template match="references">
1028
1029  <xsl:call-template name="insertTocLink">
1030    <xsl:with-param name="rule" select="true()" />
1031  </xsl:call-template>
1032
1033  <xsl:variable name="name">
1034    <xsl:choose>
1035      <xsl:when test="not(preceding::references)" />
1036      <xsl:otherwise>
1037        <xsl:text>.</xsl:text><xsl:number/>
1038      </xsl:otherwise>
1039    </xsl:choose>
1040  </xsl:variable>
1041
1042  <h1>
1043    <!-- force page break before first reference section -->
1044    <xsl:if test="$name=''">
1045      <xsl:call-template name="insert-conditional-pagebreak"/>
1046    </xsl:if>
1047
1048    <a name="{$anchor-prefix}.references{$name}">
1049      <xsl:choose>
1050        <xsl:when test="not(@title) or @title=''">References</xsl:when>
1051        <xsl:otherwise><xsl:value-of select="@title"/></xsl:otherwise>
1052      </xsl:choose>
1053    </a>
1054  </h1>
1055
1056  <table summary="{@title}" border="0" cellpadding="2">
1057    <xsl:choose>
1058      <xsl:when test="$xml2rfc-sortrefs='yes'">
1059        <xsl:apply-templates>
1060          <xsl:sort select="@anchor" />
1061        </xsl:apply-templates>
1062      </xsl:when>
1063      <xsl:otherwise>
1064        <xsl:apply-templates />
1065      </xsl:otherwise>
1066    </xsl:choose>
1067  </table>
1068
1069</xsl:template>
1070
1071<xsl:template match="rfc">
1072
1073  <xsl:variable name="lang">
1074    <xsl:call-template name="get-lang" />
1075  </xsl:variable>
1076
1077  <html lang="{$lang}">
1078    <head>
1079      <title><xsl:value-of select="front/title" /></title>
1080      <style type="text/css" title="Xml2Rfc (sans serif)">
1081        <xsl:call-template name="insertCss" />
1082      </style>
1083      <!-- <link rel="alternate stylesheet" type="text/css" media="screen" title="Plain (typewriter)" href="rfc2629tty.css" /> -->
1084
1085      <!-- link elements -->
1086      <xsl:if test="$xml2rfc-toc='yes'">
1087        <link rel="Contents" href="#{$anchor-prefix}.toc" />
1088      </xsl:if>
1089      <link rel="Author" href="#{$anchor-prefix}.authors" />
1090      <xsl:if test="not($xml2rfc-private)">
1091        <link rel="Copyright" href="#{$anchor-prefix}.copyright" />
1092      </xsl:if>
1093      <xsl:if test="//iref">
1094        <link rel="Index" href="#{$anchor-prefix}.index" />
1095      </xsl:if>
1096      <xsl:apply-templates select="/" mode="links" />
1097      <xsl:for-each select="/rfc/ed:link">
1098        <link><xsl:copy-of select="@*" /></link>
1099      </xsl:for-each>
1100      <xsl:if test="/rfc/@number">
1101        <link rel="Alternate" title="Authorative ASCII version" href="http://www.ietf.org/rfc/rfc{/rfc/@number}" />
1102      </xsl:if>
1103
1104      <!-- generator -->
1105      <xsl:variable name="gen">
1106        <xsl:call-template name="get-generator" />
1107      </xsl:variable>
1108      <meta name="generator" content="{$gen}" />
1109
1110      <!-- keywords -->
1111      <xsl:if test="front/keyword">
1112        <xsl:variable name="keyw">
1113          <xsl:call-template name="get-keywords" />
1114        </xsl:variable>
1115        <meta name="keywords" content="{$keyw}" />
1116      </xsl:if>
1117
1118      <xsl:if test="$xml2rfc-ext-support-rfc2731!='no'">
1119        <!-- Dublin Core Metadata -->
1120        <link rel="schema.DC" href="http://purl.org/dc/elements/1.1/" />
1121
1122        <!-- DC creator, see RFC2731 -->
1123        <xsl:for-each select="/rfc/front/author">
1124          <meta name="DC.Creator" content="{concat(@surname,', ',@initials)}" />
1125        </xsl:for-each>
1126
1127        <xsl:if test="not($xml2rfc-private)">
1128          <xsl:choose>
1129            <xsl:when test="/rfc/@number">
1130              <meta name="DC.Identifier" content="urn:ietf:rfc:{/rfc/@number}" />
1131            </xsl:when>
1132            <xsl:when test="/rfc/@docName">
1133              <meta name="DC.Identifier" content="urn:ietf:id:{/rfc/@docName}" />
1134            </xsl:when>
1135            <xsl:otherwise/>
1136          </xsl:choose>
1137          <xsl:variable name="month"><xsl:call-template name="get-month-as-num"/></xsl:variable>
1138          <meta name="DC.Date.Issued" scheme="ISO8601" content="{/rfc/front/date/@year}-{$month}" />
1139
1140          <xsl:if test="/rfc/@obsoletes!=''">
1141            <xsl:call-template name="rfclist-for-dcmeta">
1142              <xsl:with-param name="list" select="/rfc/@obsoletes"/>
1143            </xsl:call-template>
1144          </xsl:if>
1145        </xsl:if>
1146
1147        <xsl:if test="/rfc/front/abstract">
1148          <meta name="DC.Description.Abstract" content="{normalize-space(/rfc/front/abstract)}" />
1149        </xsl:if>
1150      </xsl:if>
1151    </head>
1152    <body>
1153      <!-- insert diagnostics -->
1154      <xsl:call-template name="insert-diagnostics"/>
1155
1156      <xsl:apply-templates select="front" />
1157      <xsl:apply-templates select="middle" />
1158      <xsl:apply-templates select="back" />
1159    </body>
1160  </html>
1161</xsl:template>
1162
1163
1164<xsl:template match="t">
1165  <xsl:variable name="paraNumber">
1166    <xsl:call-template name="sectionnumberPara" />
1167  </xsl:variable>
1168
1169  <xsl:if test="string-length($paraNumber) &gt; 0">
1170    <div><a name="{$anchor-prefix}.section.{$paraNumber}" /></div>
1171  </xsl:if>
1172
1173  <xsl:apply-templates mode="t-content" select="node()[1]" />
1174</xsl:template>
1175
1176
1177
1178<!-- for t-content, dispatch to default templates if it's block-level content -->
1179<xsl:template mode="t-content" match="list|figure|texttable">
1180  <!-- <xsl:comment>t-content block-level</xsl:comment>  -->
1181  <xsl:apply-templates select="." />
1182  <xsl:apply-templates select="following-sibling::node()[1]" mode="t-content" />
1183</xsl:template>
1184
1185<!-- ... otherwise group into p elements -->
1186<xsl:template mode="t-content" match="*|node()">
1187  <p>
1188    <xsl:call-template name="insertInsDelClass"/>
1189    <xsl:call-template name="editingMark" />
1190    <xsl:apply-templates mode="t-content2" select="." />
1191  </p>
1192  <xsl:apply-templates mode="t-content" select="following-sibling::*[self::list or self::figure or self::texttable][1]" />
1193</xsl:template>
1194
1195<xsl:template mode="t-content2" match="*|node()">
1196  <xsl:apply-templates select="." />
1197  <xsl:if test="not(following-sibling::node()[1] [self::list or self::figure or self::texttable])">
1198    <xsl:apply-templates select="following-sibling::node()[1]" mode="t-content2" />
1199  </xsl:if>
1200</xsl:template>
1201
1202<xsl:template match="section|appendix">
1203
1204  <xsl:variable name="sectionNumber">
1205    <xsl:choose>
1206      <xsl:when test="@myns:unnumbered"></xsl:when>
1207      <xsl:otherwise><xsl:call-template name="get-section-number" /></xsl:otherwise>
1208    </xsl:choose>
1209  </xsl:variable>
1210
1211  <xsl:if test="not(ancestor::section) and not(@myns:notoclink)">
1212    <xsl:call-template name="insertTocLink">
1213      <xsl:with-param name="rule" select="true()" />
1214    </xsl:call-template>
1215  </xsl:if>
1216
1217  <xsl:variable name="elemtype">
1218    <xsl:choose>
1219      <xsl:when test="count(ancestor::section) = 0">h1</xsl:when>
1220      <xsl:when test="count(ancestor::section) = 1">h2</xsl:when>
1221      <xsl:otherwise>h3</xsl:otherwise>
1222    </xsl:choose>
1223  </xsl:variable>
1224
1225  <xsl:element name="{$elemtype}">
1226    <xsl:choose>
1227      <xsl:when test="$sectionNumber='1'">
1228        <!-- pagebreak, this the first section -->
1229        <xsl:attribute name="class">np</xsl:attribute>
1230      </xsl:when>
1231      <xsl:when test="not(ancestor::section) and not(@myns:notoclink)">
1232        <xsl:call-template name="insert-conditional-pagebreak"/>
1233      </xsl:when>
1234      <xsl:otherwise/>
1235    </xsl:choose>
1236    <xsl:call-template name="insertInsDelClass" />
1237
1238    <!-- generate anchors for irefs that are immediate childs of this section -->
1239    <xsl:apply-templates select="iref"/>
1240    <xsl:if test="$sectionNumber!=''">
1241      <a name="{$anchor-prefix}.section.{$sectionNumber}"><xsl:value-of select="$sectionNumber" /></a>&#0160;
1242    </xsl:if>
1243    <xsl:choose>
1244      <xsl:when test="@anchor">
1245        <a name="{@anchor}"><xsl:value-of select="@title" /></a>
1246      </xsl:when>
1247      <xsl:otherwise>
1248        <xsl:value-of select="@title" />
1249      </xsl:otherwise>
1250    </xsl:choose>
1251  </xsl:element>
1252  <xsl:apply-templates select="*[not(self::iref)]" />
1253</xsl:template>
1254
1255<xsl:template match="spanx[@style='emph' or not(@style)]">
1256  <em><xsl:apply-templates /></em>
1257</xsl:template>
1258
1259<xsl:template match="spanx[@style='verb']">
1260  <samp><xsl:apply-templates /></samp>
1261</xsl:template>
1262
1263<xsl:template match="spanx[@style='strong']">
1264  <strong><xsl:apply-templates /></strong>
1265</xsl:template>
1266
1267
1268<xsl:template match="vspace[not(@blankLines) or @blankLines=0]">
1269  <br />
1270</xsl:template>
1271
1272<xsl:template match="vspace[@blankLines &gt; 0]">
1273  <br/><xsl:for-each select="//*[position() &lt;= @blankLines]"> <br /></xsl:for-each>
1274</xsl:template>
1275
1276<!-- keep the root for the case when we process XSLT-inline markup -->
1277<xsl:variable name="src" select="/" />
1278
1279<xsl:template match="xref[node()]">
1280  <xsl:variable name="target" select="@target" />
1281  <xsl:variable name="node" select="$src//*[@anchor=$target]" />
1282  <a href="#{$target}"><xsl:apply-templates /></a>
1283  <xsl:for-each select="$src/rfc/back/references/reference[@anchor=$target]">
1284    <xsl:text> </xsl:text><xsl:call-template name="referencename">
1285       <xsl:with-param name="node" select="." />
1286    </xsl:call-template>
1287  </xsl:for-each>
1288</xsl:template>
1289
1290<xsl:template match="xref[not(node())]">
1291  <xsl:variable name="context" select="." />
1292  <xsl:variable name="target" select="@target" />
1293  <xsl:variable name="node" select="$src//*[@anchor=$target]" />
1294  <xsl:if test="count($node)=0 and not(ancestor::ed:del)">
1295    <xsl:message>Undefined target: <xsl:value-of select="@target" /></xsl:message>
1296    <span class="error">Undefined target: <xsl:value-of select="@target" /></span>
1297  </xsl:if>
1298  <a href="#{$target}">
1299    <xsl:choose>
1300      <xsl:when test="local-name($node)='section'">
1301        <xsl:variable name="refname">
1302          <xsl:for-each select="$node">
1303            <xsl:call-template name="get-section-type">
1304              <xsl:with-param name="prec" select="$context/preceding-sibling::node()[1]" />
1305            </xsl:call-template>
1306          </xsl:for-each>
1307        </xsl:variable>
1308        <xsl:variable name="refnum">
1309          <xsl:for-each select="$node">
1310            <xsl:call-template name="get-section-number" />
1311          </xsl:for-each>
1312        </xsl:variable>
1313        <xsl:attribute name="title">
1314          <xsl:value-of select="$node/@title" />
1315        </xsl:attribute>
1316        <xsl:choose>
1317          <xsl:when test="@format='counter'">
1318            <xsl:value-of select="$refnum"/>
1319          </xsl:when>
1320          <xsl:when test="@format='title'">
1321            <xsl:value-of select="$node/@title"/>
1322          </xsl:when>
1323          <xsl:otherwise>
1324            <xsl:value-of select="normalize-space(concat($refname,'&#160;',$refnum))"/>
1325          </xsl:otherwise>
1326        </xsl:choose>
1327      </xsl:when>
1328      <xsl:when test="local-name($node)='figure'">
1329        <xsl:variable name="figcnt">
1330          <xsl:for-each select="$node">
1331            <xsl:number level="any" count="figure[@title!='' or @anchor!='']" />
1332          </xsl:for-each>
1333        </xsl:variable>
1334        <xsl:choose>
1335          <xsl:when test="@format='counter'">
1336            <xsl:value-of select="$figcnt" />
1337          </xsl:when>
1338          <xsl:when test="@format='title'">
1339            <xsl:value-of select="$node/@title" />
1340          </xsl:when>
1341          <xsl:otherwise>
1342            <xsl:value-of select="normalize-space(concat('Figure&#160;',$figcnt))"/>
1343          </xsl:otherwise>
1344        </xsl:choose>
1345      </xsl:when>
1346      <xsl:otherwise>
1347        <xsl:attribute name="title"><xsl:value-of select="normalize-space($node/front/title)" /></xsl:attribute>
1348        <xsl:call-template name="referencename"><xsl:with-param name="node" select="$src/rfc/back/references/reference[@anchor=$target]" /></xsl:call-template></xsl:otherwise>
1349    </xsl:choose>
1350  </a>
1351</xsl:template>
1352
1353
1354<!-- mark unmatched elements red -->
1355
1356<xsl:template match="*">
1357     <font color="red"><tt>&lt;<xsl:value-of select="name()" />&gt;</tt></font>
1358    <xsl:copy><xsl:apply-templates select="node()|@*" /></xsl:copy>
1359     <font color="red"><tt>&lt;/<xsl:value-of select="name()" />&gt;</tt></font>
1360</xsl:template>
1361
1362<xsl:template match="/">
1363  <xsl:copy><xsl:apply-templates select="node()" /></xsl:copy>
1364</xsl:template>
1365
1366
1367
1368
1369
1370
1371
1372
1373<!-- utility templates -->
1374
1375<xsl:template name="collectLeftHeaderColumn">
1376  <xsl:param name="mode" />
1377  <!-- default case -->
1378  <xsl:if test="not($xml2rfc-private)">
1379    <myns:item>Network Working Group</myns:item>
1380    <myns:item>
1381       <xsl:choose>
1382        <xsl:when test="/rfc/@ipr and $mode='nroff'">Internet Draft</xsl:when>
1383        <xsl:when test="/rfc/@ipr">INTERNET DRAFT</xsl:when>
1384        <xsl:otherwise>Request for Comments: <xsl:value-of select="/rfc/@number"/></xsl:otherwise>
1385      </xsl:choose>
1386    </myns:item>
1387    <xsl:if test="/rfc/@docName and $mode!='nroff'">
1388      <myns:item>
1389        &lt;<xsl:value-of select="/rfc/@docName" />&gt;
1390      </myns:item>
1391    </xsl:if>
1392    <xsl:if test="/rfc/@obsoletes and /rfc/@obsoletes!=''">
1393      <myns:item>
1394        Obsoletes: <xsl:call-template name="rfclist">
1395          <xsl:with-param name="list" select="normalize-space(/rfc/@obsoletes)" />
1396        </xsl:call-template>
1397        <xsl:if test="not(/rfc/@number)"> (if approved)</xsl:if>
1398      </myns:item>
1399    </xsl:if>
1400    <xsl:if test="/rfc/@seriesNo">
1401       <myns:item>
1402        <xsl:choose>
1403          <xsl:when test="/rfc/@category='bcp'">BCP: <xsl:value-of select="/rfc/@seriesNo" /></xsl:when>
1404          <xsl:when test="/rfc/@category='info'">FYI: <xsl:value-of select="/rfc/@seriesNo" /></xsl:when>
1405          <xsl:when test="/rfc/@category='std'">STD: <xsl:value-of select="/rfc/@seriesNo" /></xsl:when>
1406          <xsl:otherwise><xsl:value-of select="concat(/rfc/@category,': ',/rfc/@seriesNo)" /></xsl:otherwise>
1407        </xsl:choose>
1408      </myns:item>
1409    </xsl:if>
1410    <xsl:if test="/rfc/@updates and /rfc/@updates!=''">
1411      <myns:item>
1412          Updates: <xsl:call-template name="rfclist">
1413             <xsl:with-param name="list" select="normalize-space(/rfc/@updates)" />
1414          </xsl:call-template>
1415          <xsl:if test="not(/rfc/@number)"> (if approved)</xsl:if>
1416      </myns:item>
1417    </xsl:if>
1418    <xsl:if test="$mode!='nroff'">
1419      <myns:item>
1420         Category:
1421        <xsl:call-template name="get-category-long" />
1422      </myns:item>
1423    </xsl:if>
1424    <xsl:if test="/rfc/@ipr">
1425       <myns:item>Expires: <xsl:call-template name="expirydate" /></myns:item>
1426    </xsl:if>
1427  </xsl:if>
1428
1429  <!-- private case -->
1430  <xsl:if test="$xml2rfc-private">
1431    <myns:item><xsl:value-of select="$xml2rfc-private" /></myns:item>
1432  </xsl:if>
1433</xsl:template>
1434
1435<xsl:template name="collectRightHeaderColumn">
1436  <xsl:for-each select="author">
1437    <xsl:if test="@surname">
1438      <myns:item>
1439        <xsl:value-of select="concat(@initials,' ',@surname)" />
1440        <xsl:if test="@role">
1441          <xsl:choose>
1442            <xsl:when test="@role='editor'">
1443              <xsl:text>, Editor</xsl:text>
1444            </xsl:when>
1445            <xsl:otherwise>
1446              <xsl:text>, </xsl:text><xsl:value-of select="@role" />
1447            </xsl:otherwise>
1448          </xsl:choose>
1449        </xsl:if>
1450      </myns:item>
1451    </xsl:if>
1452    <xsl:variable name="org">
1453      <xsl:choose>
1454        <xsl:when test="organization/@abbrev"><xsl:value-of select="organization/@abbrev" /></xsl:when>
1455        <xsl:otherwise><xsl:value-of select="organization" /></xsl:otherwise>
1456      </xsl:choose>
1457    </xsl:variable>
1458    <xsl:variable name="orgOfFollowing">
1459      <xsl:choose>
1460        <xsl:when test="following-sibling::*[1]/organization/@abbrev"><xsl:value-of select="following-sibling::*[1]/organization/@abbrev" /></xsl:when>
1461        <xsl:otherwise><xsl:value-of select="following-sibling::*/organization" /></xsl:otherwise>
1462      </xsl:choose>
1463    </xsl:variable>
1464    <xsl:if test="$org != $orgOfFollowing">
1465      <myns:item><xsl:value-of select="$org" /></myns:item>
1466    </xsl:if>
1467  </xsl:for-each>
1468  <myns:item>
1469    <xsl:value-of select="concat(date/@month,' ',date/@year)" />
1470  </myns:item>
1471</xsl:template>
1472
1473
1474<xsl:template name="emitheader">
1475  <xsl:param name="lc" />
1476  <xsl:param name="rc" />
1477
1478  <xsl:for-each select="$lc/myns:item | $rc/myns:item">
1479    <xsl:variable name="pos" select="position()" />
1480    <xsl:if test="$pos &lt; count($lc/myns:item) + 1 or $pos &lt; count($rc/myns:item) + 1">
1481      <tr>
1482        <td class="header-l"><xsl:call-template name="copynodes"><xsl:with-param name="nodes" select="$lc/myns:item[$pos]/node()" /></xsl:call-template>&#0160;</td>
1483        <td class="header-r"><xsl:call-template name="copynodes"><xsl:with-param name="nodes" select="$rc/myns:item[$pos]/node()" /></xsl:call-template>&#0160;</td>
1484      </tr>
1485    </xsl:if>
1486  </xsl:for-each>
1487</xsl:template>
1488
1489<!-- convenience template that avoids copying namespace nodes we don't want -->
1490<xsl:template name="copynodes">
1491  <xsl:param name="nodes" />
1492  <xsl:for-each select="$nodes">
1493    <xsl:choose>
1494      <xsl:when test="namespace-uri()='http://www.w3.org/1999/xhtml'"><xsl:element name="{name()}" namespace="{namespace-uri()}"><xsl:copy-of select="@*|node()" /></xsl:element></xsl:when>
1495      <xsl:when test="self::*"><xsl:element name="{name()}"><xsl:copy-of select="@*|node()" /></xsl:element></xsl:when>
1496      <xsl:otherwise><xsl:copy-of select="." /></xsl:otherwise>
1497    </xsl:choose>
1498  </xsl:for-each>
1499</xsl:template>
1500
1501
1502<xsl:template name="expirydate">
1503  <xsl:variable name="date" select="/rfc/front/date" />
1504  <xsl:choose>
1505      <xsl:when test="$date/@month='January'">July <xsl:value-of select="$date/@year" /></xsl:when>
1506      <xsl:when test="$date/@month='February'">August <xsl:value-of select="$date/@year" /></xsl:when>
1507      <xsl:when test="$date/@month='March'">September <xsl:value-of select="$date/@year" /></xsl:when>
1508      <xsl:when test="$date/@month='April'">October <xsl:value-of select="$date/@year" /></xsl:when>
1509      <xsl:when test="$date/@month='May'">November <xsl:value-of select="$date/@year" /></xsl:when>
1510      <xsl:when test="$date/@month='June'">December <xsl:value-of select="$date/@year" /></xsl:when>
1511      <xsl:when test="$date/@month='July'">January <xsl:value-of select="$date/@year + 1" /></xsl:when>
1512      <xsl:when test="$date/@month='August'">February <xsl:value-of select="$date/@year + 1" /></xsl:when>
1513      <xsl:when test="$date/@month='September'">March <xsl:value-of select="$date/@year + 1" /></xsl:when>
1514      <xsl:when test="$date/@month='October'">April <xsl:value-of select="$date/@year + 1" /></xsl:when>
1515      <xsl:when test="$date/@month='November'">May <xsl:value-of select="$date/@year + 1" /></xsl:when>
1516      <xsl:when test="$date/@month='December'">June <xsl:value-of select="$date/@year + 1" /></xsl:when>
1517        <xsl:otherwise>WRONG SYNTAX FOR MONTH</xsl:otherwise>
1518     </xsl:choose>
1519</xsl:template>
1520
1521<xsl:template name="get-month-as-num">
1522  <xsl:variable name="date" select="/rfc/front/date" />
1523  <xsl:choose>
1524      <xsl:when test="$date/@month='January'">01</xsl:when>
1525      <xsl:when test="$date/@month='February'">02</xsl:when>
1526      <xsl:when test="$date/@month='March'">03</xsl:when>
1527      <xsl:when test="$date/@month='April'">04</xsl:when>
1528      <xsl:when test="$date/@month='May'">05</xsl:when>
1529      <xsl:when test="$date/@month='June'">06</xsl:when>
1530      <xsl:when test="$date/@month='July'">07</xsl:when>
1531      <xsl:when test="$date/@month='August'">08</xsl:when>
1532      <xsl:when test="$date/@month='September'">09</xsl:when>
1533      <xsl:when test="$date/@month='October'">10</xsl:when>
1534      <xsl:when test="$date/@month='November'">11</xsl:when>
1535      <xsl:when test="$date/@month='December'">12</xsl:when>
1536        <xsl:otherwise>WRONG SYNTAX FOR MONTH</xsl:otherwise>
1537     </xsl:choose>
1538</xsl:template>
1539
1540<!-- produce back section with author information -->
1541<xsl:template name="insertAuthors">
1542
1543  <!-- insert link to TOC including horizontal rule -->
1544  <xsl:call-template name="insertTocLink">
1545    <xsl:with-param name="rule" select="true()" />
1546  </xsl:call-template>
1547
1548  <h1>
1549    <xsl:call-template name="insert-conditional-pagebreak"/>
1550    <a name="{$anchor-prefix}.authors" />Author's Address<xsl:if test="count(/rfc/front/author) &gt; 1">es</xsl:if>
1551  </h1>
1552
1553  <table summary="Authors" width="99%" border="0" cellpadding="0" cellspacing="0">
1554    <xsl:apply-templates select="/rfc/front/author" />
1555  </table>
1556</xsl:template>
1557
1558
1559
1560<!-- insert copyright statement -->
1561
1562<xsl:template name="insertCopyright" xmlns="">
1563
1564  <section title="Intellectual Property Statement" anchor="{$anchor-prefix}.ipr" myns:unnumbered="unnumbered" myns:is-rfc2629="true">
1565    <xsl:choose>
1566      <xsl:when test="$ipr-rfc3667">
1567        <t myns:is-rfc2629="true">
1568          The IETF takes no position regarding the validity or scope of any
1569          Intellectual Property Rights or other rights that might be claimed to
1570          pertain to the implementation or use of the technology described in
1571          this document or the extent to which any license under such rights
1572          might or might not be available; nor does it represent that it has
1573          made any independent effort to identify any such rights. Information
1574          on the IETF's procedures with respect to rights in IETF Documents
1575          can be found in BCP 78 and BCP 79.
1576        </t>
1577        <t myns:is-rfc2629="true">
1578          Copies of IPR disclosures made to the IETF Secretariat and any
1579          assurances of licenses to be made available, or the result of an
1580          attempt made to obtain a general license or permission for the use
1581          of such proprietary rights by implementers or users of this
1582          specification can be obtained from the IETF on-line IPR repository
1583          at <eref target="http://www.ietf.org/ipr"/>.
1584        </t>
1585        <t myns:is-rfc2629="true">
1586          The IETF invites any interested party to bring to its attention any
1587          copyrights, patents or patent applications, or other proprietary
1588          rights that may cover technology that may be required to implement
1589          this standard. Please address the information to the IETF at
1590          <eref target="mailto:ietf-ipr@ietf.org">ietf-ipr@ietf.org</eref>.
1591        </t>
1592      </xsl:when>
1593      <xsl:otherwise>
1594        <t myns:is-rfc2629="true">
1595          The IETF takes no position regarding the validity or scope of
1596          any intellectual property or other rights that might be claimed
1597          to  pertain to the implementation or use of the technology
1598          described in this document or the extent to which any license
1599          under such rights might or might not be available; neither does
1600          it represent that it has made any effort to identify any such
1601          rights. Information on the IETF's procedures with respect to
1602          rights in standards-track and standards-related documentation
1603          can be found in BCP-11. Copies of claims of rights made
1604          available for publication and any assurances of licenses to
1605          be made available, or the result of an attempt made
1606          to obtain a general license or permission for the use of such
1607          proprietary rights by implementors or users of this
1608          specification can be obtained from the IETF Secretariat.
1609        </t>
1610        <t myns:is-rfc2629="true">
1611          The IETF invites any interested party to bring to its
1612          attention any copyrights, patents or patent applications, or
1613          other proprietary rights which may cover technology that may be
1614          required to practice this standard. Please address the
1615          information to the IETF Executive Director.
1616        </t>
1617        <xsl:if test="$xml2rfc-iprnotified='yes'">
1618          <t myns:is-rfc2629="true">
1619            The IETF has been notified of intellectual property rights
1620            claimed in regard to some or all of the specification contained
1621            in this document. For more information consult the online list
1622            of claimed rights.
1623          </t>
1624        </xsl:if>
1625      </xsl:otherwise>
1626    </xsl:choose>
1627  </section>
1628
1629  <xsl:if test="$ipr-rfc3667">
1630    <section title="Disclaimer of Validity" anchor="{$anchor-prefix}.disclaimer" myns:unnumbered="unnumbered" myns:notoclink="notoclink" myns:is-rfc2629="true">
1631      <t myns:is-rfc2629="true">
1632        This document and the information contained herein are provided on an
1633        "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS
1634        OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET
1635        ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED,
1636        INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE
1637        INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
1638        WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
1639      </t>
1640    </section>
1641  </xsl:if>
1642
1643  <xsl:choose>
1644    <xsl:when test="$ipr-rfc3667">
1645      <section title="Copyright Statement" anchor="{$anchor-prefix}.copyright" myns:unnumbered="unnumbered" myns:notoclink="notoclink" myns:is-rfc2629="true">
1646        <t myns:is-rfc2629="true">
1647          Copyright (C) The Internet Society (<xsl:value-of select="/rfc/front/date/@year" />).
1648          This document is subject to the rights, licenses and restrictions
1649          contained in BCP 78, and except as set forth therein, the authors
1650          retain all their rights.
1651        </t>
1652      </section>
1653    </xsl:when>
1654    <xsl:otherwise>
1655      <section title="Full Copyright Statement" anchor="{$anchor-prefix}.copyright" myns:unnumbered="unnumbered" myns:notoclink="notoclink" myns:is-rfc2629="true">
1656        <t myns:is-rfc2629="true">
1657          Copyright (C) The Internet Society (<xsl:value-of select="/rfc/front/date/@year" />). All Rights Reserved.
1658        </t>
1659        <t myns:is-rfc2629="true">
1660          This document and translations of it may be copied and furnished to
1661          others, and derivative works that comment on or otherwise explain it
1662          or assist in its implementation may be prepared, copied, published and
1663          distributed, in whole or in part, without restriction of any kind,
1664          provided that the above copyright notice and this paragraph are
1665          included on all such copies and derivative works. However, this
1666          document itself may not be modified in any way, such as by removing
1667          the copyright notice or references to the Internet Society or other
1668          Internet organizations, except as needed for the purpose of
1669          developing Internet standards in which case the procedures for
1670          copyrights defined in the Internet Standards process must be
1671          followed, or as required to translate it into languages other than
1672          English.
1673        </t>
1674        <t myns:is-rfc2629="true">
1675          The limited permissions granted above are perpetual and will not be
1676          revoked by the Internet Society or its successors or assignees.
1677        </t>
1678        <t myns:is-rfc2629="true">
1679          This document and the information contained herein is provided on an
1680          &quot;AS IS&quot; basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
1681          TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
1682          BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
1683          HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
1684          MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
1685        </t>
1686      </section>
1687    </xsl:otherwise>
1688  </xsl:choose>
1689
1690  <section title="Acknowledgement" myns:unnumbered="unnumbered" myns:notoclink="notoclink" myns:is-rfc2629="true">
1691    <t myns:is-rfc2629="true">
1692      Funding for the RFC Editor function is currently provided by the
1693      Internet Society.
1694    </t>
1695  </section>
1696
1697</xsl:template>
1698
1699
1700<!-- insert CSS style info -->
1701
1702<xsl:template name="insertCss">
1703a {
1704  text-decoration: none
1705}
1706a:hover {
1707  text-decoration: underline
1708}
1709a:active {
1710  text-decoration: underline
1711}
1712body {
1713  <xsl:if test="$xml2rfc-background!=''">
1714  background: url(<xsl:value-of select="$xml2rfc-background" />) #ffffff left top;
1715  </xsl:if>
1716  color: #000000;
1717  font-family: helvetica, arial, sans-serif;
1718  font-size: 13px;
1719}
1720dl {
1721  margin-left: 2em;
1722}
1723h1 {
1724  color: #333333;
1725  font-size: 16px;
1726  line-height: 16px;
1727  font-family: helvetica, arial, sans-serif;
1728  page-break-after: avoid;
1729}
1730h1.np {
1731  page-break-before: always;
1732}
1733h2 {
1734  color: #000000;
1735  font-size: 14px;
1736  font-family: helvetica, arial, sans-serif;
1737  page-break-after: avoid;
1738}
1739h3 {
1740  color: #000000;
1741  font-size: 13px;
1742  font-family: helvetica, arial, sans-serif;
1743  page-break-after: avoid;
1744}
1745img {
1746  margin-left: 3em;
1747}
1748li {
1749  margin-left: 2em;
1750  margin-right: 2em;
1751}
1752ol {
1753  margin-left: 2em;
1754  margin-right: 2em;
1755}
1756p {
1757  margin-left: 2em;
1758  margin-right: 2em;
1759}
1760pre {
1761  margin-left: 3em;
1762  background-color: lightyellow;
1763}
1764table {
1765  margin-left: 2em;
1766}
1767table.header {
1768  width: 66%;
1769}
1770td.top {
1771  vertical-align: top;
1772}
1773td.topnowrap {
1774  vertical-align: top;
1775  white-space: nowrap;
1776}
1777td.right {
1778  text-align: right;
1779}
1780td.header-l {
1781  width: 33%;
1782  color: #ffffff;
1783  background-color: #666666;
1784  font-size: 10px;
1785  font-family: arial, helvetica, sans-serif;
1786  vertical-align: top
1787}
1788td.header-r {
1789  width: 33%;
1790  color: #ffffff;
1791  background-color: #666666;
1792  font-size: 10px;
1793  font-family: arial, helvetica, sans-serif;
1794  vertical-align: top;
1795}
1796thead {
1797  display:table-header-group
1798}
1799.editingmark {
1800  background-color: khaki;
1801}
1802.error {
1803  font-size: 14pt;
1804  background-color: red;
1805}
1806.hotText {
1807  color:#ffffff;
1808  font-weight: normal;
1809  text-decoration: none;
1810  font-family: chelvetica, arial, sans-serif;
1811  font-size: 9px
1812}
1813.link2 {
1814  color:#ffffff;
1815  font-weight: bold;
1816  text-decoration: none;
1817  font-family: helvetica, arial, sans-serif;
1818  font-size: 9px
1819}
1820.toowide {
1821  color: red;
1822  font-weight: bold;
1823}
1824.RFC {
1825  color:#666666;
1826  font-weight: bold;
1827  text-decoration: none;
1828  font-family: helvetica, arial, sans-serif;
1829  font-size: 9px
1830}
1831.title {
1832  color: #990000;
1833  font-size: 22px;
1834  line-height: 22px;
1835  font-weight: bold;
1836  text-align: right;
1837  font-family: helvetica, arial, sans-serif
1838}
1839.figure {
1840  font-weight: bold;
1841  text-align: center;
1842  font-size: 12px;
1843}
1844.filename {
1845  color: #333333;
1846  font-weight: bold;
1847  font-size: 16px;
1848  line-height: 24px;
1849  font-family: helvetica, arial, sans-serif;
1850  text-align: right;
1851}
1852.warning {
1853  font-size: 14pt;
1854  background-color: yellow;
1855}
1856del {
1857  color: red;
1858  text-decoration: line-through;
1859}
1860.del {
1861  color: red;
1862  text-decoration: line-through;
1863}
1864ins {
1865  color: green;
1866  text-decoration: underline;
1867}
1868.ins {
1869  color: green;
1870  text-decoration: underline;
1871}
1872
1873table.openissue {
1874  background-color: khaki;
1875  border-width: thin;
1876  border-style: solid;
1877  border-color: black;
1878}
1879
1880table.closedissue {
1881  background-color: white;
1882  border-width: thin;
1883  border-style: solid;
1884  border-color: gray;
1885  color: gray;
1886}
1887
1888.closed-issue {
1889  border: solid;
1890  border-width: thin;
1891  background-color: lime;
1892  font-size: small;
1893  font-weight: bold;
1894}
1895
1896.open-issue {
1897  border: solid;
1898  border-width: thin;
1899  background-color: red;
1900  font-size: small;
1901  font-weight: bold;
1902}
1903
1904.editor-issue {
1905  border: solid;
1906  border-width: thin;
1907  background-color: yellow;
1908  font-size: small;
1909  font-weight: bold;
1910}
1911
1912@media print {
1913  .noprint {
1914    display: none;
1915  }
1916}
1917</xsl:template>
1918
1919
1920<!-- generate the index section -->
1921
1922<xsl:template name="insertSingleIref">
1923  <xsl:variable name="backlink">#<xsl:value-of select="$anchor-prefix"/>.iref.<xsl:number level="any" /></xsl:variable>
1924  &#0160;<a href="{$backlink}"><xsl:choose>
1925      <xsl:when test="@primary='true'"><b><xsl:call-template name="get-section-number" /></b></xsl:when>
1926      <xsl:otherwise><xsl:call-template name="get-section-number" /></xsl:otherwise>
1927    </xsl:choose>
1928  </a><xsl:if test="position()!=last()">, </xsl:if>
1929</xsl:template>
1930
1931
1932<xsl:template name="insertIndex">
1933
1934  <!-- insert link to TOC including horizontal rule -->
1935  <xsl:call-template name="insertTocLink">
1936    <xsl:with-param name="rule" select="true()" />
1937  </xsl:call-template>
1938
1939  <h1>
1940    <xsl:call-template name="insert-conditional-pagebreak"/>
1941    <a name="{$anchor-prefix}.index" />Index
1942  </h1>
1943
1944  <table summary="Index">
1945
1946    <xsl:for-each select="//iref[generate-id(.) = generate-id(key('index-first-letter',translate(substring(@item,1,1),$lcase,$ucase)))]">
1947      <xsl:sort select="translate(@item,$lcase,$ucase)" />
1948
1949      <tr>
1950        <td>
1951          <b><xsl:value-of select="translate(substring(@item,1,1),$lcase,$ucase)" /></b>
1952        </td>
1953      </tr>
1954
1955      <xsl:for-each select="key('index-first-letter',translate(substring(@item,1,1),$lcase,$ucase))">
1956
1957        <xsl:sort select="translate(@item,$lcase,$ucase)" />
1958
1959        <xsl:if test="generate-id(.) = generate-id(key('index-item',@item))">
1960
1961          <tr>
1962            <td>
1963              &#0160;&#0160;<xsl:value-of select="@item" />&#0160;
1964
1965              <xsl:for-each select="key('index-item',@item)[not(@subitem) or @subitem='']">
1966                <xsl:sort select="translate(@item,$lcase,$ucase)" />
1967                <xsl:call-template name="insertSingleIref" />
1968              </xsl:for-each>
1969            </td>
1970          </tr>
1971
1972          <xsl:for-each select="key('index-item',@item)[@subitem and @subitem!='']">
1973            <xsl:sort select="translate(@subitem,$lcase,$ucase)" />
1974
1975             <xsl:if test="generate-id(.) = generate-id(key('index-item-subitem',concat(@item,'..',@subitem)))">
1976            <tr>
1977              <td>
1978                &#0160;&#0160;&#0160;&#0160;<xsl:value-of select="@subitem" />&#0160;
1979
1980                <xsl:for-each select="key('index-item-subitem',concat(@item,'..',@subitem))">
1981                  <xsl:sort select="translate(@item,$lcase,$ucase)" />
1982                  <xsl:call-template name="insertSingleIref" />
1983                </xsl:for-each>
1984              </td>
1985            </tr>
1986            </xsl:if>
1987          </xsl:for-each>
1988
1989        </xsl:if>
1990
1991      </xsl:for-each>
1992
1993    </xsl:for-each>
1994  </table>
1995</xsl:template>
1996
1997
1998
1999
2000<xsl:template name="insertPreamble" xmlns="">
2001
2002  <section title="Status of this Memo" myns:unnumbered="unnumbered" myns:notoclink="notoclink" anchor="{$anchor-prefix}.status" myns:is-rfc2629="true">
2003
2004  <xsl:choose>
2005    <xsl:when test="/rfc/@ipr">
2006      <t myns:is-rfc2629="true">
2007        <xsl:choose>
2008
2009          <!-- RFC2026 -->
2010          <xsl:when test="/rfc/@ipr = 'full2026'">
2011            This document is an Internet-Draft and is
2012            in full conformance with all provisions of Section 10 of RFC2026.
2013          </xsl:when>
2014          <xsl:when test="/rfc/@ipr = 'noDerivativeWorks2026'">
2015            This document is an Internet-Draft and is
2016            in full conformance with all provisions of Section 10 of RFC2026
2017            except that the right to produce derivative works is not granted.
2018          </xsl:when>
2019          <xsl:when test="/rfc/@ipr = 'noDerivativeWorksNow'">
2020            This document is an Internet-Draft and is
2021            in full conformance with all provisions of Section 10 of RFC2026
2022            except that the right to produce derivative works is not granted.
2023            (If this document becomes part of an IETF working group activity,
2024            then it will be brought into full compliance with Section 10 of RFC2026.)
2025          </xsl:when>
2026          <xsl:when test="/rfc/@ipr = 'none'">
2027            This document is an Internet-Draft and is
2028            NOT offered in accordance with Section 10 of RFC2026,
2029            and the author does not provide the IETF with any rights other
2030            than to publish as an Internet-Draft.
2031          </xsl:when>
2032
2033          <!-- RFC3667 -->
2034          <xsl:when test="/rfc/@ipr = 'full3667'">
2035            By submitting this Internet-Draft, I certify that any applicable
2036            patent or other IPR claims of which I am aware have been disclosed,
2037            and any of which I become aware will be disclosed, in accordance
2038            with RFC 3668.
2039          </xsl:when>
2040          <xsl:when test="/rfc/@ipr = 'noModification3667'">
2041            By submitting this Internet-Draft, I certify that any applicable
2042            patent or other IPR claims of which I am aware have been disclosed,
2043            and any of which I become aware will be disclosed, in accordance
2044            with RFC 3668. This document may not be modified, and derivative
2045            works of it may not be created, except to publish it as an RFC and
2046            to translate it into languages other than English<xsl:if test="/rfc/@iprExtract">,
2047            other than to extract <xref target="{/rfc/@iprExtract}"/> as-is for separate use.</xsl:if>.
2048          </xsl:when>
2049          <xsl:when test="/rfc/@ipr = 'noDerivatives3667'">
2050            By submitting this Internet-Draft, I certify that any applicable
2051            patent or other IPR claims of which I am aware have been disclosed,
2052            and any of which I become aware will be disclosed, in accordance
2053            with RFC 3668. This document may not be modified, and derivative
2054            works of it may not be created<xsl:if test="/rfc/@iprExtract">,
2055            other than to extract <xref target="{/rfc/@iprExtract}"/> as-is for separate use.</xsl:if>..
2056          </xsl:when>
2057
2058          <xsl:otherwise>CONFORMANCE UNDEFINED.</xsl:otherwise>
2059        </xsl:choose>
2060      </t>
2061      <t myns:is-rfc2629="true">
2062        Internet-Drafts are working documents of the Internet Engineering
2063        Task Force (IETF), its areas, and its working groups.
2064        Note that other groups may also distribute working documents as
2065        Internet-Drafts.
2066      </t>
2067      <t myns:is-rfc2629="true">
2068        Internet-Drafts are draft documents valid for a maximum of six months
2069        and may be updated, replaced, or obsoleted by other documents at any time.
2070        It is inappropriate to use Internet-Drafts as reference material or to cite
2071        them other than as "work in progress".
2072      </t>
2073      <t myns:is-rfc2629="true">
2074        The list of current Internet-Drafts can be accessed at
2075        <eref target='http://www.ietf.org/ietf/1id-abstracts.txt' myns:is-rfc2629="true" />.
2076      </t>
2077      <t myns:is-rfc2629="true">
2078        The list of Internet-Draft Shadow Directories can be accessed at
2079        <eref target='http://www.ietf.org/shadow.html' myns:is-rfc2629="true"/>.
2080      </t>
2081      <t myns:is-rfc2629="true">
2082        This Internet-Draft will expire in <xsl:call-template name="expirydate" />.
2083      </t>
2084    </xsl:when>
2085
2086    <xsl:when test="/rfc/@category='bcp'">
2087      <t myns:is-rfc2629="true">
2088        This document specifies an Internet Best Current Practices for the Internet
2089        Community, and requests discussion and suggestions for improvements.
2090        Distribution of this memo is unlimited.
2091      </t>
2092    </xsl:when>
2093    <xsl:when test="/rfc/@category='exp'">
2094      <t myns:is-rfc2629="true">
2095        This memo defines an Experimental Protocol for the Internet community.
2096        It does not specify an Internet standard of any kind.
2097        Discussion and suggestions for improvement are requested.
2098        Distribution of this memo is unlimited.
2099      </t>
2100    </xsl:when>
2101    <xsl:when test="/rfc/@category='historic'">
2102      <t myns:is-rfc2629="true">
2103        This memo describes a historic protocol for the Internet community.
2104        It does not specify an Internet standard of any kind.
2105        Distribution of this memo is unlimited.
2106      </t>
2107    </xsl:when>
2108    <xsl:when test="/rfc/@category='info' or not(/rfc/@category)">
2109      <t myns:is-rfc2629="true">
2110        This memo provides information for the Internet community.
2111        It does not specify an Internet standard of any kind.
2112        Distribution of this memo is unlimited.
2113      </t>
2114    </xsl:when>
2115    <xsl:when test="/rfc/@category='std'">
2116      <t myns:is-rfc2629="true">
2117        This document specifies an Internet standards track protocol for the Internet
2118        community, and requests discussion and suggestions for improvements.
2119        Please refer to the current edition of the &quot;Internet Official Protocol
2120        Standards&quot; (STD 1) for the standardization state and status of this
2121        protocol. Distribution of this memo is unlimited.
2122      </t>
2123    </xsl:when>
2124    <xsl:otherwise>
2125      <t myns:is-rfc2629="true">UNSUPPORTED CATEGORY.</t>
2126    </xsl:otherwise>
2127  </xsl:choose>
2128
2129  </section>
2130
2131  <section title="Copyright Notice" myns:unnumbered="unnumbered" myns:notoclink="notoclink" anchor="{$anchor-prefix}.copyrightnotice" myns:is-rfc2629="true">
2132  <t myns:is-rfc2629="true">
2133    Copyright (C) The Internet Society (<xsl:value-of select="/rfc/front/date/@year" />). All Rights Reserved.
2134  </t>
2135  </section>
2136
2137</xsl:template>
2138
2139<!-- TOC generation -->
2140
2141<xsl:template match="/" mode="toc">
2142  <xsl:call-template name="insertTocLink">
2143    <xsl:with-param name="includeTitle" select="true()" />
2144      <xsl:with-param name="rule" select="true()" />
2145  </xsl:call-template>
2146
2147  <h1 class="np"> <!-- this pagebreak occurs always -->
2148    <a name="{$anchor-prefix}.toc">Table of Contents</a>
2149  </h1>
2150
2151  <p>
2152    <xsl:apply-templates mode="toc" />
2153  </p>
2154</xsl:template>
2155
2156<xsl:template name="insertTocLine">
2157  <xsl:param name="number" />
2158  <xsl:param name="target" />
2159  <xsl:param name="title" />
2160
2161  <!-- handle tocdepth parameter -->
2162  <xsl:choose>
2163    <xsl:when test="string-length(translate($number,'.ABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890&#167;','.')) &gt;= $parsedTocDepth">
2164      <!-- dropped entry -->
2165    </xsl:when>
2166    <xsl:otherwise>
2167      <xsl:choose>
2168        <xsl:when test="starts-with($number,'del-')">
2169          <xsl:value-of select="'&#160;&#160;&#160;&#160;&#160;&#160;'"/>
2170          <del>
2171            <xsl:value-of select="$number" />&#0160;
2172            <a href="#{$target}"><xsl:value-of select="$title"/></a>
2173          </del>
2174        </xsl:when>
2175        <xsl:when test="$number=''">
2176          <b>
2177            &#0160;&#0160;
2178            <a href="#{$target}"><xsl:value-of select="$title"/></a>
2179          </b>
2180        </xsl:when>
2181        <xsl:otherwise>
2182          <b>
2183            <xsl:value-of select="translate($number,'.ABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890&#167;','&#160;')"/>
2184            <xsl:value-of select="$number" />&#0160;
2185            <a href="#{$target}"><xsl:value-of select="$title"/></a>
2186          </b>
2187        </xsl:otherwise>
2188      </xsl:choose>
2189      <br />
2190    </xsl:otherwise>
2191  </xsl:choose>
2192</xsl:template>
2193
2194
2195<xsl:template match="back" mode="toc">
2196
2197  <xsl:apply-templates select="references" mode="toc" />
2198  <xsl:apply-templates select="/rfc/front" mode="toc" />
2199  <xsl:apply-templates select="*[not(self::references)]" mode="toc" />
2200
2201  <!-- copyright statements -->
2202  <xsl:if test="not($xml2rfc-private)">
2203    <xsl:call-template name="insertTocLine">
2204      <xsl:with-param name="number" select="'&#167;'"/>
2205      <xsl:with-param name="target" select="concat($anchor-prefix,'.ipr')"/>
2206      <xsl:with-param name="title" select="'Intellectual Property and Copyright Statements'"/>
2207    </xsl:call-template>
2208  </xsl:if>
2209
2210  <!-- insert the index if index entries exist -->
2211  <xsl:if test="//iref">
2212    <xsl:call-template name="insertTocLine">
2213      <xsl:with-param name="number" select="'&#167;'"/>
2214      <xsl:with-param name="target" select="concat($anchor-prefix,'.index')"/>
2215      <xsl:with-param name="title" select="'Index'"/>
2216    </xsl:call-template>
2217  </xsl:if>
2218
2219</xsl:template>
2220
2221<xsl:template match="front" mode="toc">
2222
2223  <xsl:variable name="title">
2224    <xsl:if test="count(author)=1">Author's Address</xsl:if>
2225    <xsl:if test="count(author)!=1">Author's Addresses</xsl:if>
2226  </xsl:variable>
2227
2228  <xsl:call-template name="insertTocLine">
2229    <xsl:with-param name="number" select="'&#167;'"/>
2230    <xsl:with-param name="target" select="concat($anchor-prefix,'.authors')"/>
2231    <xsl:with-param name="title" select="$title"/>
2232  </xsl:call-template>
2233
2234</xsl:template>
2235
2236<xsl:template match="references" mode="toc">
2237
2238  <xsl:variable name="num">
2239    <xsl:choose>
2240      <xsl:when test="not(preceding::references)" />
2241      <xsl:otherwise>
2242        <xsl:text>.</xsl:text><xsl:number/>
2243      </xsl:otherwise>
2244    </xsl:choose>
2245  </xsl:variable>
2246
2247  <xsl:variable name="title">
2248    <xsl:choose>
2249      <xsl:when test="@title!=''"><xsl:value-of select="@title" /></xsl:when>
2250      <xsl:otherwise>References</xsl:otherwise>
2251    </xsl:choose>
2252  </xsl:variable>
2253
2254  <xsl:call-template name="insertTocLine">
2255    <xsl:with-param name="number" select="'&#167;'"/>
2256    <xsl:with-param name="target" select="concat($anchor-prefix,'.references',$num)"/>
2257    <xsl:with-param name="title" select="$title"/>
2258  </xsl:call-template>
2259
2260</xsl:template>
2261
2262<xsl:template match="section" mode="toc">
2263  <xsl:variable name="sectionNumber">
2264    <xsl:call-template name="get-section-number" />
2265  </xsl:variable>
2266
2267  <xsl:variable name="target">
2268    <xsl:choose>
2269      <xsl:when test="@anchor"><xsl:value-of select="@anchor" /></xsl:when>
2270       <xsl:otherwise><xsl:value-of select="$anchor-prefix"/>.section.<xsl:value-of select="$sectionNumber" /></xsl:otherwise>
2271    </xsl:choose>
2272  </xsl:variable>
2273
2274  <xsl:call-template name="insertTocLine">
2275    <xsl:with-param name="number" select="$sectionNumber"/>
2276    <xsl:with-param name="target" select="$target"/>
2277    <xsl:with-param name="title" select="@title"/>
2278  </xsl:call-template>
2279
2280  <xsl:apply-templates mode="toc" />
2281</xsl:template>
2282
2283<xsl:template match="middle" mode="toc">
2284  <xsl:apply-templates mode="toc" />
2285</xsl:template>
2286
2287<xsl:template match="rfc" mode="toc">
2288  <xsl:apply-templates select="middle|back" mode="toc" />
2289</xsl:template>
2290
2291<xsl:template match="ed:del|ed:ins|ed:replace" mode="toc">
2292  <xsl:apply-templates mode="toc" />
2293</xsl:template>
2294
2295<xsl:template match="*" mode="toc" />
2296
2297
2298<xsl:template name="insertTocAppendix">
2299
2300  <xsl:if test="//figure[@title!='' or @anchor!='']">
2301    <p>
2302      <xsl:for-each select="//figure[@title!='' or @anchor!='']">
2303        <xsl:variable name="title">Figure <xsl:value-of select="position()"/><xsl:if test="@title">: <xsl:value-of select="@title"/></xsl:if>
2304        </xsl:variable>
2305        <xsl:call-template name="insertTocLine">
2306          <xsl:with-param name="target" select="concat($anchor-prefix,'.figure.',position())" />
2307          <xsl:with-param name="title" select="$title" />
2308        </xsl:call-template>
2309      </xsl:for-each>
2310    </p>
2311  </xsl:if>
2312
2313  <!-- experimental -->
2314  <xsl:if test="//ed:issue">
2315    <xsl:call-template name="insertIssuesList" />
2316  </xsl:if>
2317
2318</xsl:template>
2319
2320<xsl:template name="insertTocLink">
2321  <xsl:param name="includeTitle" select="false()" />
2322  <xsl:param name="rule" />
2323  <xsl:if test="$rule"><hr class="noprint"/></xsl:if>
2324  <xsl:if test="$includeTitle or $xml2rfc-toc='yes'">
2325    <table summary="link to TOC" class="noprint" style="margin-left: auto; margin-right: 0; float: right; width: 2.5em;">
2326      <xsl:if test="$includeTitle">
2327        <tr>
2328          <td style="background-color: #000000; text-align: center; vertical-align: middle; height: 2.5em;">
2329            <b><span class="RFC">&#0160;RFC&#0160;</span></b>
2330            <xsl:if test="/rfc/@number">
2331              <br />
2332              <span class="hotText"><xsl:value-of select="/rfc/@number"/></span>
2333            </xsl:if>
2334          </td>
2335        </tr>
2336      </xsl:if>
2337      <xsl:if test="$xml2rfc-toc='yes'">
2338        <tr>
2339          <td style="background-color: #990000; text-align: center; height: 1.5em;">
2340            <a href="#{$anchor-prefix}.toc"><b class="link2">&#0160;TOC&#0160;</b></a>
2341          </td>
2342        </tr>
2343      </xsl:if>
2344    </table>
2345  </xsl:if>
2346</xsl:template>
2347
2348
2349<xsl:template name="referencename">
2350  <xsl:param name="node" />
2351  <xsl:choose>
2352    <xsl:when test="$xml2rfc-symrefs='yes'">[<xsl:value-of select="$node/@anchor" />]</xsl:when>
2353    <xsl:otherwise><xsl:for-each select="$node">[<xsl:number level="any" />]</xsl:for-each></xsl:otherwise>
2354  </xsl:choose>
2355</xsl:template>
2356
2357
2358
2359<xsl:template name="replace-substring">
2360
2361  <xsl:param name="string" />
2362  <xsl:param name="replace" />
2363  <xsl:param name="by" />
2364
2365  <xsl:choose>
2366    <xsl:when test="contains($string,$replace)">
2367      <xsl:value-of select="concat(substring-before($string, $replace),$by)" />
2368      <xsl:call-template name="replace-substring">
2369        <xsl:with-param name="string" select="substring-after($string,$replace)" />
2370        <xsl:with-param name="replace" select="$replace" />
2371        <xsl:with-param name="by" select="$by" />
2372      </xsl:call-template>
2373    </xsl:when>
2374    <xsl:otherwise><xsl:value-of select="$string" /></xsl:otherwise>
2375  </xsl:choose>
2376
2377</xsl:template>
2378
2379<xsl:template name="showArtworkLine">
2380  <xsl:param name="line" />
2381  <xsl:param name="mode" />
2382
2383  <xsl:variable name="maxw" select="69" />
2384
2385  <xsl:if test="string-length($line) &gt; $maxw">
2386    <xsl:message>Artwork exceeds maximum width: <xsl:value-of select="$line" /></xsl:message>
2387  </xsl:if>
2388
2389  <xsl:choose>
2390    <xsl:when test="$mode='html'">
2391      <xsl:value-of select="substring($line,0,$maxw)" />
2392      <xsl:if test="string-length($line) &gt;= $maxw">
2393        <span class="toowide"><xsl:value-of select="substring($line,$maxw)" /></span>
2394      </xsl:if>
2395      <xsl:text>&#10;</xsl:text>
2396    </xsl:when>
2397    <xsl:when test="$mode='wordml'">
2398      <r xmlns="http://schemas.microsoft.com/office/word/2003/wordml">
2399        <t><xsl:value-of select="translate($line,' ','&#160;')"/></t>
2400      </r>
2401    </xsl:when>
2402    <xsl:when test="$mode='nroff'">
2403      <xsl:variable name="cline">
2404        <xsl:call-template name="replace-substring">
2405          <xsl:with-param name="string" select="$line" />
2406          <xsl:with-param name="replace" select="'\'" />
2407          <xsl:with-param name="by" select="'\\'" />
2408        </xsl:call-template>
2409      </xsl:variable>
2410      <xsl:value-of select="concat($cline,'&#10;')" />
2411    </xsl:when>
2412    <xsl:otherwise><xsl:value-of select="concat($line,'&#10;')" /></xsl:otherwise>
2413  </xsl:choose>
2414
2415</xsl:template>
2416
2417<xsl:template name="showArtwork">
2418  <xsl:param name="mode" />
2419  <xsl:param name="text" />
2420  <xsl:param name="initial" />
2421  <xsl:variable name="delim" select="'&#10;'" />
2422  <xsl:variable name="first" select="substring-before($text,$delim)" />
2423  <xsl:variable name="remainder" select="substring-after($text,$delim)" />
2424
2425  <xsl:choose>
2426    <xsl:when test="not(contains($text,$delim))">
2427      <xsl:call-template name="showArtworkLine">
2428        <xsl:with-param name="line" select="$text" />
2429        <xsl:with-param name="mode" select="$mode" />
2430      </xsl:call-template>
2431    </xsl:when>
2432    <xsl:otherwise>
2433      <!-- suppress empty initial lines -->
2434      <xsl:if test="$initial!='yes' or normalize-space($first)!=''">
2435        <xsl:call-template name="showArtworkLine">
2436          <xsl:with-param name="line" select="$first" />
2437          <xsl:with-param name="mode" select="$mode" />
2438        </xsl:call-template>
2439        <xsl:if test="$mode='wordml' and $remainder!=''">
2440          <r xmlns="http://schemas.microsoft.com/office/word/2003/wordml">
2441            <br />
2442          </r>
2443        </xsl:if>
2444      </xsl:if>
2445      <xsl:if test="$remainder!=''">
2446        <xsl:call-template name="showArtwork">
2447          <xsl:with-param name="text" select="$remainder" />
2448          <xsl:with-param name="mode" select="$mode" />
2449        </xsl:call-template>
2450      </xsl:if>
2451    </xsl:otherwise>
2452  </xsl:choose>
2453
2454</xsl:template>
2455
2456
2457<!--<xsl:template name="dump">
2458  <xsl:param name="text" />
2459  <xsl:variable name="c" select="substring($text,1,1)"/>
2460  <xsl:choose>
2461    <xsl:when test="$c='&#9;'">&amp;#9;</xsl:when>
2462    <xsl:when test="$c='&#10;'">&amp;#10;</xsl:when>
2463    <xsl:when test="$c='&#13;'">&amp;#13;</xsl:when>
2464    <xsl:when test="$c='&amp;'">&amp;amp;</xsl:when>
2465    <xsl:otherwise><xsl:value-of select="$c" /></xsl:otherwise>
2466  </xsl:choose>
2467  <xsl:if test="string-length($text) &gt; 1">
2468    <xsl:call-template name="dump">
2469      <xsl:with-param name="text" select="substring($text,2)" />
2470    </xsl:call-template>
2471  </xsl:if>
2472</xsl:template>-->
2473
2474
2475<xsl:template name="rfclist">
2476  <xsl:param name="list" />
2477  <xsl:choose>
2478    <xsl:when test="contains($list,',')">
2479      <xsl:variable name="rfcNo" select="substring-before($list,',')" />
2480      <a href="{concat($rfcUrlPrefix,$rfcNo,'.txt')}"><xsl:value-of select="$rfcNo" /></a>,
2481      <xsl:call-template name="rfclist">
2482        <xsl:with-param name="list" select="normalize-space(substring-after($list,','))" />
2483      </xsl:call-template>
2484    </xsl:when>
2485    <xsl:otherwise>
2486      <xsl:variable name="rfcNo" select="$list" />
2487      <a href="{concat($rfcUrlPrefix,$rfcNo,'.txt')}"><xsl:value-of select="$rfcNo" /></a>
2488    </xsl:otherwise>
2489  </xsl:choose>
2490</xsl:template>
2491
2492<xsl:template name="rfclist-for-dcmeta">
2493  <xsl:param name="list" />
2494  <xsl:choose>
2495    <xsl:when test="contains($list,',')">
2496      <xsl:variable name="rfcNo" select="substring-before($list,',')" />
2497      <meta name="DC.Relation.Replaces" content="urn:ietf:rfc:{$rfcNo}" />
2498      <xsl:call-template name="rfclist-for-dcmeta">
2499        <xsl:with-param name="list" select="normalize-space(substring-after($list,','))" />
2500      </xsl:call-template>
2501    </xsl:when>
2502    <xsl:otherwise>
2503      <xsl:variable name="rfcNo" select="$list" />
2504      <meta name="DC.Relation.Replaces" content="urn:ietf:rfc:{$rfcNo}" />
2505    </xsl:otherwise>
2506  </xsl:choose>
2507</xsl:template>
2508
2509<xsl:template name="sectionnumberPara">
2510  <!-- get section number of ancestor section element, then add t or figure number -->
2511  <xsl:if test="ancestor::section and not(ancestor::section[@myns:unnumbered='unnumbered'])">
2512    <xsl:for-each select="ancestor::section[1]"><xsl:call-template name="get-section-number" />.p.</xsl:for-each><xsl:number count="t|figure" />
2513  </xsl:if>
2514</xsl:template>
2515
2516<xsl:template name="editingMark">
2517  <xsl:if test="$xml2rfc-editing='yes' and ancestor::rfc">
2518    <sup class="editingmark"><span><xsl:number level="any" count="postamble|preamble|t"/></span>&#0160;</sup>
2519  </xsl:if>
2520</xsl:template>
2521
2522<!-- experimental annotation support -->
2523
2524<xsl:template match="ed:issue">
2525  <xsl:variable name="class">
2526    <xsl:choose>
2527      <xsl:when test="@status='closed'">closedissue</xsl:when>
2528      <xsl:otherwise>openissue</xsl:otherwise>
2529    </xsl:choose>
2530  </xsl:variable>
2531
2532  <table summary="issue {@name}" class="{$class}">
2533    <tr>
2534      <td colspan="3">
2535        <a name="{$anchor-prefix}.issue.{@name}">
2536          <xsl:choose>
2537            <xsl:when test="@status='closed'">
2538              <xsl:attribute name="class">closed-issue</xsl:attribute>
2539            </xsl:when>
2540            <xsl:when test="@status='editor'">
2541              <xsl:attribute name="class">editor-issue</xsl:attribute>
2542            </xsl:when>
2543            <xsl:otherwise>
2544              <xsl:attribute name="class">open-issue</xsl:attribute>
2545            </xsl:otherwise>
2546          </xsl:choose>
2547          <xsl:text>&#160;i&#160;</xsl:text>
2548        </a>
2549        <xsl:text>&#160;</xsl:text>
2550        <xsl:choose>
2551          <xsl:when test="@href">
2552            <em><a href="{@href}"><xsl:value-of select="@name" /></a></em>
2553          </xsl:when>
2554          <xsl:otherwise>
2555            <em><xsl:value-of select="@name" /></em>
2556          </xsl:otherwise>
2557        </xsl:choose>
2558        &#0160;
2559        (type: <xsl:value-of select="@type"/>, status: <xsl:value-of select="@status"/>)
2560      </td>
2561    </tr>
2562    <xsl:for-each select="ed:item">
2563      <tr>
2564        <td class="top">
2565          <a href="mailto:{@entered-by}?subject={/rfc/@docName}, {../@name}"><i><xsl:value-of select="@entered-by"/></i></a>
2566        </td>
2567        <td class="topnowrap">
2568          <xsl:value-of select="@date"/>
2569        </td>
2570        <td class="top">
2571          <xsl:call-template name="copynodes">
2572            <xsl:with-param name="nodes" select="node()" />
2573          </xsl:call-template>
2574        </td>
2575      </tr>
2576    </xsl:for-each>
2577    <xsl:for-each select="ed:resolution">
2578      <tr>
2579        <td class="top">
2580          <xsl:if test="@entered-by">
2581            <a href="mailto:{@entered-by}?subject={/rfc/@docName}, {../@name}"><i><xsl:value-of select="@entered-by"/></i></a>
2582          </xsl:if>
2583        </td>
2584        <td class="topnowrap">
2585          <xsl:value-of select="@datetime"/>
2586        </td>
2587        <td class="top">
2588          <em>Resolution:</em>&#0160;<xsl:copy-of select="node()" />
2589        </td>
2590      </tr>
2591    </xsl:for-each>
2592  </table>
2593
2594</xsl:template>
2595
2596<xsl:template name="insertIssuesList">
2597
2598  <h2><a name="{$anchor-prefix}.issues-list">Issues list</a></h2>
2599  <table summary="Issues list">
2600    <xsl:for-each select="//ed:issue">
2601      <xsl:sort select="@status" />
2602      <xsl:sort select="@name" />
2603      <tr>
2604        <td><a href="#{$anchor-prefix}.issue.{@name}"><xsl:value-of select="@name" /></a></td>
2605        <td><xsl:value-of select="@type" /></td>
2606        <td><xsl:value-of select="@status" /></td>
2607        <td><xsl:value-of select="ed:item[1]/@date" /></td>
2608        <td><a href="mailto:{ed:item[1]/@entered-by}?subject={/rfc/@docName}, {@name}"><xsl:value-of select="ed:item[1]/@entered-by" /></a></td>
2609      </tr>
2610    </xsl:for-each>
2611  </table>
2612
2613</xsl:template>
2614
2615<xsl:template name="formatTitle">
2616  <xsl:if test="@who">
2617    <xsl:value-of select="@who" />
2618  </xsl:if>
2619  <xsl:if test="@datetime">
2620    <xsl:value-of select="concat(' (',@datetime,')')" />
2621  </xsl:if>
2622  <xsl:if test="@reason">
2623    <xsl:value-of select="concat(': ',@reason)" />
2624  </xsl:if>
2625  <xsl:if test="@cite">
2626    <xsl:value-of select="concat(' &lt;',@cite,'&gt;')" />
2627  </xsl:if>
2628</xsl:template>
2629
2630<xsl:template name="insert-diagnostics">
2631
2632  <!-- check anchor names -->
2633  <xsl:variable name="badAnchors" select="//*[starts-with(@anchor,concat($anchor-prefix,'.'))]" />
2634  <xsl:if test="$badAnchors">
2635    <p class="warning">
2636      The following anchor names may collide with internally generated anchors because of their prefix "<xsl:value-of select="$anchor-prefix" />":
2637      <xsl:for-each select="$badAnchors">
2638        <xsl:value-of select="@anchor"/><xsl:if test="position()!=last()">, </xsl:if>
2639      </xsl:for-each>
2640    </p>
2641    <xsl:message>
2642      The following anchor names may collide with internally generated anchors because of their prefix "<xsl:value-of select="$anchor-prefix" />":
2643      <xsl:for-each select="$badAnchors">
2644        <xsl:value-of select="@anchor"/><xsl:if test="position()!=last()">, </xsl:if>
2645      </xsl:for-each>
2646    </xsl:message>
2647  </xsl:if>
2648
2649  <!-- check IDs -->
2650  <xsl:variable name="badTargets" select="//xref[not(@target=//@anchor) and not(ancestor::ed:del)]" />
2651  <xsl:if test="$badTargets">
2652    <p class="error">
2653      The following target names do not exist:
2654      <xsl:for-each select="$badTargets">
2655        <xsl:value-of select="@target"/><xsl:if test="position()!=last()">, </xsl:if>
2656      </xsl:for-each>
2657    </p>
2658    <xsl:message>
2659      The following target names do not exist:
2660      <xsl:for-each select="$badTargets">
2661        <xsl:value-of select="@target"/><xsl:if test="position()!=last()">, </xsl:if>
2662      </xsl:for-each>
2663    </xsl:message>
2664  </xsl:if>
2665
2666
2667</xsl:template>
2668
2669<!-- special change mark support, not supported by RFC2629 yet -->
2670
2671<xsl:template match="@ed:*" />
2672
2673<xsl:template match="ed:del">
2674  <xsl:call-template name="insert-issue-pointer"/>
2675  <del>
2676    <xsl:copy-of select="@*[namespace-uri()='']"/>
2677    <xsl:if test="not(@title) and ancestor-or-self::*[@ed:entered-by] and @datetime">
2678      <xsl:attribute name="title"><xsl:value-of select="concat(@datetime,', ',ancestor-or-self::*[@ed:entered-by][1]/@ed:entered-by)"/></xsl:attribute>
2679    </xsl:if>
2680    <xsl:apply-templates />
2681  </del>
2682</xsl:template>
2683
2684<xsl:template match="ed:ins">
2685  <xsl:call-template name="insert-issue-pointer"/>
2686  <ins>
2687    <xsl:copy-of select="@*[namespace-uri()='']"/>
2688    <xsl:if test="not(@title) and ancestor-or-self::*[@ed:entered-by] and @datetime">
2689      <xsl:attribute name="title"><xsl:value-of select="concat(@datetime,', ',ancestor-or-self::*[@ed:entered-by][1]/@ed:entered-by)"/></xsl:attribute>
2690    </xsl:if>
2691    <xsl:apply-templates />
2692  </ins>
2693</xsl:template>
2694
2695<xsl:template name="insert-issue-pointer">
2696  <xsl:if test="@ed:resolves">
2697    <xsl:variable name="resolves" select="@ed:resolves"/>
2698    <xsl:choose>
2699      <xsl:when test="not(ancestor::t)">
2700        <div><a class="open-issue" href="#{$anchor-prefix}.issue.{$resolves}" title="resolves: {$resolves}">
2701          <xsl:choose>
2702            <xsl:when test="//ed:issue[@name=$resolves and @status='closed']">
2703              <xsl:attribute name="class">closed-issue</xsl:attribute>
2704            </xsl:when>
2705            <xsl:when test="//ed:issue[@name=$resolves and @status='editor']">
2706              <xsl:attribute name="class">editor-issue</xsl:attribute>
2707            </xsl:when>
2708            <xsl:otherwise>
2709              <xsl:attribute name="class">open-issue</xsl:attribute>
2710            </xsl:otherwise>
2711          </xsl:choose>
2712          <xsl:text>&#160;i&#160;</xsl:text>
2713        </a></div>
2714      </xsl:when>
2715      <xsl:otherwise>
2716        <a class="open-issue" href="#{$anchor-prefix}.issue.{$resolves}" title="resolves: {$resolves}">
2717          <xsl:choose>
2718            <xsl:when test="//ed:issue[@name=$resolves and @status='closed']">
2719              <xsl:attribute name="class">closed-issue</xsl:attribute>
2720            </xsl:when>
2721            <xsl:when test="//ed:issue[@name=$resolves and @status='editor']">
2722              <xsl:attribute name="class">editor-issue</xsl:attribute>
2723            </xsl:when>
2724            <xsl:otherwise>
2725              <xsl:attribute name="class">open-issue</xsl:attribute>
2726            </xsl:otherwise>
2727          </xsl:choose>
2728          <xsl:text>&#160;i&#160;</xsl:text>
2729        </a>
2730      </xsl:otherwise>
2731    </xsl:choose>
2732  </xsl:if>
2733</xsl:template>
2734
2735<xsl:template match="ed:replace">
2736  <xsl:if test="@cite">
2737    <a class="editor-issue" href="{@cite}" target="_blank" title="see {@cite}">
2738      <xsl:text>&#160;i&#160;</xsl:text>
2739    </a>
2740  </xsl:if>
2741  <xsl:call-template name="insert-issue-pointer"/>
2742  <xsl:if test="ed:del">
2743    <del>
2744      <xsl:copy-of select="@*[namespace-uri()='']"/>
2745      <xsl:if test="not(@title) and ancestor-or-self::*[@ed:entered-by] and @datetime">
2746        <xsl:attribute name="title"><xsl:value-of select="concat(@datetime,', ',ancestor-or-self::*[@ed:entered-by][1]/@ed:entered-by)"/></xsl:attribute>
2747      </xsl:if>
2748      <xsl:apply-templates select="ed:del/node()" />
2749    </del>
2750  </xsl:if>
2751  <xsl:if test="ed:ins">
2752    <ins>
2753      <xsl:copy-of select="@*[namespace-uri()='']"/>
2754      <xsl:if test="not(@title) and ancestor-or-self::*[@ed:entered-by] and @datetime">
2755        <xsl:attribute name="title"><xsl:value-of select="concat(@datetime,', ',ancestor-or-self::*[@ed:entered-by][1]/@ed:entered-by)"/></xsl:attribute>
2756      </xsl:if>
2757      <xsl:apply-templates select="ed:ins/node()" />
2758    </ins>
2759  </xsl:if>
2760</xsl:template>
2761
2762<!-- convenience template for helping Mozilla (pre/ins inheritance problem) -->
2763<xsl:template name="insertInsDelClass">
2764  <xsl:if test="ancestor::ed:del">
2765    <xsl:attribute name="class">del</xsl:attribute>
2766  </xsl:if>
2767  <xsl:if test="ancestor::ed:ins">
2768    <xsl:attribute name="class">ins</xsl:attribute>
2769  </xsl:if>
2770</xsl:template>
2771
2772
2773<xsl:template name="sectionnumberAndEdits">
2774  <xsl:choose>
2775    <xsl:when test="ancestor::ed:del">del-<xsl:number count="ed:del//section" level="any"/></xsl:when>
2776    <xsl:when test="self::section and parent::ed:ins and local-name(../..)='replace'">
2777      <xsl:for-each select="../.."><xsl:call-template name="sectionnumberAndEdits" /></xsl:for-each>
2778      <xsl:for-each select="..">
2779        <xsl:if test="parent::ed:replace">
2780          <xsl:for-each select="..">
2781            <xsl:if test="parent::section">.</xsl:if><xsl:value-of select="1+count(preceding-sibling::section|preceding-sibling::ed:ins/section|preceding-sibling::ed:replace/ed:ins/section)" />
2782          </xsl:for-each>
2783        </xsl:if>
2784      </xsl:for-each>
2785    </xsl:when>
2786    <xsl:when test="self::section[parent::ed:ins]">
2787      <xsl:for-each select="../.."><xsl:call-template name="sectionnumberAndEdits" /></xsl:for-each>
2788      <xsl:for-each select="..">
2789        <xsl:if test="parent::section">.</xsl:if><xsl:value-of select="1+count(preceding-sibling::section|preceding-sibling::ed:ins/section|preceding-sibling::ed:replace/ed:ins/section)" />
2790      </xsl:for-each>
2791    </xsl:when>
2792    <xsl:when test="self::section">
2793      <xsl:for-each select=".."><xsl:call-template name="sectionnumberAndEdits" /></xsl:for-each>
2794      <xsl:if test="parent::section">.</xsl:if>
2795      <xsl:choose>
2796        <xsl:when test="parent::back">
2797          <xsl:number format="A" value="1+count(preceding-sibling::section|preceding-sibling::ed:ins/section|preceding-sibling::ed:replace/ed:ins/section)" />
2798        </xsl:when>
2799        <xsl:otherwise>
2800          <xsl:number value="1+count(preceding-sibling::section|preceding-sibling::ed:ins/section|preceding-sibling::ed:replace/ed:ins/section)" />
2801        </xsl:otherwise>
2802      </xsl:choose>
2803    </xsl:when>
2804    <xsl:when test="self::middle or self::back"><!-- done --></xsl:when>
2805    <xsl:otherwise>
2806      <!-- go up one level -->
2807      <xsl:for-each select=".."><xsl:call-template name="sectionnumberAndEdits" /></xsl:for-each>
2808    </xsl:otherwise>
2809  </xsl:choose>
2810</xsl:template>
2811
2812<!-- experimental table formatting -->
2813
2814<xsl:template match="texttable">
2815  <xsl:apply-templates select="preamble" />
2816  <table summary="{preamble}" border="1" cellpadding="3" cellspacing="0">
2817    <thead>
2818      <tr>
2819        <xsl:apply-templates select="ttcol" />
2820      </tr>
2821    </thead>
2822    <tbody>
2823      <xsl:variable name="columns" select="count(ttcol)" />
2824      <xsl:for-each select="c[(position() mod $columns) = 1]">
2825        <tr>
2826          <xsl:for-each select=". | following-sibling::c[position() &lt; $columns]">
2827            <td class="top">
2828              <xsl:variable name="pos" select="position()" />
2829              <xsl:variable name="col" select="../ttcol[position() = $pos]" />
2830              <xsl:if test="$col/@align">
2831                <xsl:attribute name="style">text-align: <xsl:value-of select="$col/@align" />;</xsl:attribute>
2832              </xsl:if>
2833              <xsl:apply-templates select="node()" />
2834              &#0160;
2835            </td>
2836          </xsl:for-each>
2837        </tr>
2838      </xsl:for-each>
2839    </tbody>
2840  </table>
2841  <xsl:apply-templates select="postamble" />
2842</xsl:template>
2843
2844<xsl:template match="ttcol">
2845  <th valign="top">
2846    <xsl:variable name="width">
2847      <xsl:if test="@width">width: <xsl:value-of select="@width" />; </xsl:if>
2848    </xsl:variable>
2849    <xsl:variable name="align">
2850      <xsl:choose>
2851        <xsl:when test="@align">text-align: <xsl:value-of select="@align" />;</xsl:when>
2852        <xsl:otherwise>text-align: left;</xsl:otherwise>
2853      </xsl:choose>
2854    </xsl:variable>
2855    <xsl:attribute name="style"><xsl:value-of select="concat($width,$align)" /></xsl:attribute>
2856    <xsl:apply-templates />
2857  </th>
2858</xsl:template>
2859
2860<!-- Chapter Link Generation -->
2861
2862<xsl:template match="*" mode="links"><xsl:apply-templates mode="links"/></xsl:template>
2863<xsl:template match="text()" mode="links" />
2864
2865<xsl:template match="/*/middle//section[not(myns:unnumbered) and not(ancestor::section)]" mode="links">
2866  <xsl:variable name="sectionNumber"><xsl:call-template name="get-section-number" /></xsl:variable>
2867  <link rel="Chapter" title="{$sectionNumber} {@title}" href="#{$anchor-prefix}.section.{$sectionNumber}" />
2868  <xsl:apply-templates mode="links" />
2869</xsl:template>
2870
2871<xsl:template match="/*/back//section[not(myns:unnumbered) and not(ancestor::section)]" mode="links">
2872  <xsl:variable name="sectionNumber"><xsl:call-template name="get-section-number" /></xsl:variable>
2873  <link rel="Appendix" title="{$sectionNumber} {@title}" href="#{$anchor-prefix}.section.{$sectionNumber}" />
2874  <xsl:apply-templates mode="links" />
2875</xsl:template>
2876
2877<!-- convenience templates -->
2878
2879<xsl:template name="get-author-summary">
2880  <xsl:choose>
2881    <xsl:when test="count(/rfc/front/author)=1">
2882      <xsl:value-of select="/rfc/front/author[1]/@surname" />
2883    </xsl:when>
2884    <xsl:when test="count(/rfc/front/author)=2">
2885      <xsl:value-of select="concat(/rfc/front/author[1]/@surname,' &amp; ',/rfc/front/author[2]/@surname)" />
2886    </xsl:when>
2887    <xsl:otherwise>
2888      <xsl:value-of select="concat(/rfc/front/author[1]/@surname,', et al.')" />
2889    </xsl:otherwise>
2890  </xsl:choose>
2891</xsl:template>
2892
2893<xsl:template name="get-authors">
2894  <xsl:for-each select="/rfc/front/author">
2895    <xsl:value-of select="@fullname" />
2896    <xsl:if test="position()!=last()">, </xsl:if>
2897  </xsl:for-each>
2898</xsl:template>
2899
2900<xsl:template name="get-category-long">
2901  <xsl:choose>
2902    <xsl:when test="$xml2rfc-footer"><xsl:value-of select="$xml2rfc-footer" /></xsl:when>
2903    <xsl:when test="$xml2rfc-private"/> <!-- private draft, footer not set -->
2904    <xsl:when test="/rfc/@category='bcp'">Best Current Practice</xsl:when>
2905    <xsl:when test="/rfc/@category='historic'">Historic</xsl:when>
2906    <xsl:when test="/rfc/@category='info' or not(/rfc/@category)">Informational</xsl:when>
2907    <xsl:when test="/rfc/@category='std'">Standards Track</xsl:when>
2908    <xsl:when test="/rfc/@category='exp'">Experimental</xsl:when>
2909    <xsl:otherwise>(category unknown)</xsl:otherwise>
2910  </xsl:choose>
2911</xsl:template>
2912
2913<xsl:template name="get-header-center">
2914  <xsl:choose>
2915    <xsl:when test="string-length(/rfc/front/title/@abbrev) &gt; 0">
2916      <xsl:value-of select="/rfc/front/title/@abbrev" />
2917    </xsl:when>
2918    <xsl:otherwise>
2919      <xsl:value-of select="/rfc/front/title" />
2920    </xsl:otherwise>
2921  </xsl:choose>
2922</xsl:template>
2923
2924<xsl:template name="get-header-left">
2925  <xsl:choose>
2926    <xsl:when test="$xml2rfc-header"><xsl:value-of select="$xml2rfc-header" /></xsl:when>
2927    <xsl:when test="$xml2rfc-private"/> <!-- private draft, header not set -->
2928    <xsl:when test="/rfc/@ipr">INTERNET DRAFT</xsl:when>
2929    <xsl:otherwise>RFC <xsl:value-of select="/rfc/@number"/></xsl:otherwise>
2930  </xsl:choose>
2931</xsl:template>
2932
2933<xsl:template name="get-generator">
2934  <xsl:variable name="gen">
2935    <xsl:text>http://greenbytes.de/tech/webdav/rfc2629.xslt, </xsl:text>
2936    <!-- when RCS keyword substitution in place, add version info -->
2937    <xsl:if test="contains('$Revision: 1.149 $',':')">
2938      <xsl:value-of select="concat('Revision ',normalize-space(translate(substring-after('$Revision: 1.149 $', 'Revision: '),'$','')),', ')" />
2939    </xsl:if>
2940    <xsl:value-of select="concat('XSLT vendor: ',system-property('xsl:vendor'),' ',system-property('xsl:vendor-url'))" />
2941  </xsl:variable>
2942  <xsl:value-of select="$gen" />
2943</xsl:template>
2944
2945<xsl:template name="get-header-right">
2946  <xsl:value-of select="concat(/rfc/front/date/@month,' ',/rfc/front/date/@year)" />
2947</xsl:template>
2948
2949<xsl:template name="get-keywords">
2950  <xsl:variable name="keyw">
2951    <xsl:for-each select="/rfc/front/keyword">
2952      <xsl:value-of select="translate(.,',',' ')" />
2953      <xsl:if test="position()!=last()">, </xsl:if>
2954    </xsl:for-each>
2955  </xsl:variable>
2956  <xsl:value-of select="normalize-space($keyw)" />
2957</xsl:template>
2958
2959<!-- get language from context node. nearest ancestor or return the default of "en" -->
2960<xsl:template name="get-lang">
2961  <xsl:choose>
2962    <xsl:when test="ancestor-or-self::*[@xml:lang]"><xsl:value-of select="ancestor-or-self::*/@xml:lang" /></xsl:when>
2963    <xsl:otherwise>en</xsl:otherwise>
2964  </xsl:choose>
2965</xsl:template>
2966
2967<xsl:template name="get-section-number">
2968  <xsl:variable name="hasEdits" select="count(//ed:del|//ed:ins)!=0" />
2969  <xsl:choose>
2970    <xsl:when test="$hasEdits">
2971      <xsl:call-template name="sectionnumberAndEdits" />
2972    </xsl:when>
2973    <xsl:otherwise>
2974      <xsl:choose>
2975        <xsl:when test="ancestor::back"><xsl:number count="ed:del|ed:ins|section|appendix" level="multiple" format="A.1.1.1.1.1.1.1" /></xsl:when>
2976        <xsl:when test="self::appendix"><xsl:number count="ed:del|ed:ins|appendix" level="multiple" format="A.1.1.1.1.1.1.1" /></xsl:when>
2977        <xsl:otherwise><xsl:number count="ed:del|ed:ins|section" level="multiple"/></xsl:otherwise>
2978      </xsl:choose>
2979    </xsl:otherwise>
2980  </xsl:choose>
2981</xsl:template>
2982
2983<xsl:template name="get-section-type">
2984  <xsl:param name="prec" />
2985  <xsl:choose>
2986    <xsl:when test="ancestor::back">Appendix</xsl:when>
2987    <xsl:otherwise>Section</xsl:otherwise>
2988  </xsl:choose>
2989</xsl:template>
2990
2991<xsl:template name="insert-conditional-pagebreak">
2992  <xsl:if test="$xml2rfc-compact!='yes'">
2993    <xsl:attribute name="class">np</xsl:attribute>
2994  </xsl:if>
2995</xsl:template>
2996
2997
2998</xsl:stylesheet>
2999