source: rfc2629xslt/rfc2629toXHTML.xslt @ 329

Last change on this file since 329 was 329, checked in by julian.reschke@…, 11 years ago

update to latest version of rfc2629.xslt

  • Property svn:eol-style set to native
File size: 200.9 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!--Auto-generated from rfc2629.xslt through HTMLtoXHTML.xslt-->
3<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ed="http://greenbytes.de/2002/rfcedit" xmlns:date="http://exslt.org/dates-and-times" xmlns:exslt="http://exslt.org/common" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:myns="mailto:julian.reschke@greenbytes.de?subject=rcf2629.xslt" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:saxon-old="http://icl.com/saxon" xmlns:saxon="http://saxon.sf.net/" xmlns:x="http://purl.org/net/xml2rfc/ext" xmlns:xhtml="http://www.w3.org/1999/xhtml" version="1.0" exclude-result-prefixes="date ed exslt msxsl myns rdf saxon saxon-old x xhtml">
4
5<xsl:strip-space elements="back front list middle rfc section"/>               
6               
7<xsl:output doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" encoding="UTF-8" method="xml"/>
8
9<!-- process some of the processing instructions supported by Marshall T. Rose's
10     xml2rfc sofware, see <http://xml.resource.org/> -->
11
12<!-- delimiters in PIs -->
13<xsl:variable name="quote-chars">"'</xsl:variable>     
14     
15<!-- rfc comments PI -->
16
17<xsl:param name="xml2rfc-comments" select="substring-after(       translate(/processing-instruction('rfc')[contains(.,'comments=')], concat($quote-chars,' '), ''),         'comments=')"/>
18
19<!-- rfc compact PI -->
20
21<xsl:param name="xml2rfc-compact" select="substring-after(       translate(/processing-instruction('rfc')[contains(.,'compact=')], concat($quote-chars,' '), ''),         'compact=')"/>
22
23<!-- rfc footer PI -->
24
25<xsl:param name="xml2rfc-footer" select="substring-after(       translate(/processing-instruction('rfc')[contains(.,'footer=')], concat($quote-chars,' '), ''),         'footer=')"/>
26
27<!-- rfc header PI -->
28
29<xsl:param name="xml2rfc-header" select="substring-after(       translate(/processing-instruction('rfc')[contains(.,'header=')], concat($quote-chars,' '), ''),         'header=')"/>
30
31<!-- rfc inline PI -->
32
33<xsl:param name="xml2rfc-inline" select="substring-after(       translate(/processing-instruction('rfc')[contains(.,'inline=')], concat($quote-chars,' '), ''),         'inline=')"/>
34
35<!-- rfc strict PI -->
36
37<xsl:param name="xml2rfc-strict" select="substring-after(       translate(/processing-instruction('rfc')[contains(.,'strict=')], concat($quote-chars,' '), ''),         'strict=')"/>
38
39<!-- include a table of contents if a processing instruction <?rfc?>
40     exists with contents toc="yes". Can be overriden by an XSLT parameter -->
41
42<xsl:param name="xml2rfc-toc" select="substring-after(       translate(/processing-instruction('rfc')[contains(.,'toc=')], concat($quote-chars,' '), ''),         'toc=')"/>
43
44<!-- optional tocdepth-->
45
46<xsl:param name="xml2rfc-tocdepth" select="substring-after(       translate(/processing-instruction('rfc')[contains(.,'tocdepth=')], concat($quote-chars,' '), ''),         'tocdepth=')"/>
47
48<xsl:variable name="parsedTocDepth">
49  <xsl:choose>
50    <xsl:when test="$xml2rfc-tocdepth='1'">1</xsl:when>
51    <xsl:when test="$xml2rfc-tocdepth='2'">2</xsl:when>
52    <xsl:when test="$xml2rfc-tocdepth='3'">3</xsl:when>
53    <xsl:when test="$xml2rfc-tocdepth='4'">4</xsl:when>
54    <xsl:when test="$xml2rfc-tocdepth='5'">5</xsl:when>
55    <xsl:otherwise>99</xsl:otherwise>
56  </xsl:choose>
57</xsl:variable>
58
59<!-- suppress top block if a processing instruction <?rfc?>
60     exists with contents tocblock="no". Can be overriden by an XSLT parameter -->
61
62<xsl:param name="xml2rfc-topblock" select="substring-after(       translate(/processing-instruction('rfc')[contains(.,'topblock=')], concat($quote-chars,' '), ''),         'topblock=')"/>
63
64<!-- use symbolic reference names instead of numeric ones unless a processing instruction <?rfc?>
65     exists with contents symrefs="no". Can be overriden by an XSLT parameter -->
66
67<xsl:param name="xml2rfc-symrefs" select="substring-after(       translate(/processing-instruction('rfc')[contains(.,'symrefs=')], concat($quote-chars,' '), ''),         'symrefs=')"/>
68
69<!-- sort references if a processing instruction <?rfc?>
70     exists with contents sortrefs="yes". Can be overriden by an XSLT parameter -->
71
72<xsl:param name="xml2rfc-sortrefs" select="substring-after(       translate(/processing-instruction('rfc')[contains(.,'sortrefs=')], concat($quote-chars,' '), ''),         'sortrefs=')"/>
73
74<!-- insert editing marks if a processing instruction <?rfc?>
75     exists with contents editing="yes". Can be overriden by an XSLT parameter -->
76
77<xsl:param name="xml2rfc-editing" select="substring-after(       translate(/processing-instruction('rfc')[contains(.,'editing=')], concat($quote-chars,' '), ''),         'editing=')"/>
78
79<!-- make it a private paper -->
80
81<xsl:param name="xml2rfc-private" select="substring-after(       translate(/processing-instruction('rfc')[contains(.,'private=')], $quote-chars, ''),         'private=')"/>
82
83<!-- background image? -->
84
85<xsl:param name="xml2rfc-background" select="substring-after(       translate(/processing-instruction('rfc')[contains(.,'background=')], $quote-chars, ''),         'background=')"/>
86
87<!-- extension for XML parsing in artwork -->
88
89<xsl:param name="xml2rfc-ext-parse-xml-in-artwork" select="substring-after(       translate(/processing-instruction('rfc-ext')[contains(.,'parse-xml-in-artwork=')], concat($quote-chars,' '), ''),         'parse-xml-in-artwork=')"/>
90
91<!-- extension for excluding DCMI properties in meta tag (RFC2731) -->
92
93<xsl:param name="xml2rfc-ext-support-rfc2731" select="substring-after(       translate(/processing-instruction('rfc-ext')[contains(.,'support-rfc2731=')], concat($quote-chars,' '), ''),         'support-rfc2731=')"/>
94
95<!-- extension for allowing markup inside artwork -->
96
97<xsl:param name="xml2rfc-ext-allow-markup-in-artwork" select="substring-after(       translate(/processing-instruction('rfc-ext')[contains(.,'allow-markup-in-artwork=')], concat($quote-chars,' '), ''),         'allow-markup-in-artwork=')"/>
98
99<!-- extension for including references into index -->
100
101<xsl:param name="xml2rfc-ext-include-references-in-index" select="substring-after(       translate(/processing-instruction('rfc-ext')[contains(.,'include-references-in-index=')], concat($quote-chars,' '), ''),         'include-references-in-index=')"/>
102
103<!-- position of author's section -->
104
105<xsl:param name="xml2rfc-ext-authors-section" select="substring-after(       translate(/processing-instruction('rfc-ext')[contains(.,'authors-section=')], concat($quote-chars,' '), ''),         'authors-section=')"/>
106
107<!-- justification? -->
108
109<xsl:param name="xml2rfc-ext-justification" select="substring-after(       translate(/processing-instruction('rfc-ext')[contains(.,'justification=')], concat($quote-chars,' '), ''),         'justification=')"/>
110
111<!-- trailing dots in section numbers -->
112
113<xsl:param name="xml2rfc-ext-sec-no-trailing-dots" select="substring-after(       translate(/processing-instruction('rfc-ext')[contains(.,'sec-no-trailing-dots=')], concat($quote-chars,' '), ''),         'sec-no-trailing-dots=')"/>
114
115<!-- choose whether or not to do mailto links --> 
116 
117<xsl:param name="xml2rfc-linkmailto" select="substring-after(        translate(/processing-instruction('rfc')[contains(.,'linkmailto=')], concat($quote-chars,' '), ''),          'linkmailto=')"/> 
118
119
120<!-- iprnotified switch --> 
121 
122<xsl:param name="xml2rfc-iprnotified" select="substring-after(        translate(/processing-instruction('rfc')[contains(.,'iprnotified=')], concat($quote-chars,' '), ''),          'iprnotified=')"/> 
123
124<!-- URL templates for RFCs and Internet Drafts. -->
125
126<!-- Reference the authorative ASCII versions
127<xsl:param name="rfcUrlPrefix" select="'http://www.ietf.org/rfc/rfc'" />
128<xsl:param name="rfcUrlPostfix" select="'.txt'" />
129-->
130<!-- Reference the marked up versions over on http://tools.ietf.org/html. -->
131<xsl:param name="rfcUrlPrefix" select="'http://tools.ietf.org/html/rfc'"/>
132<xsl:param name="rfcUrlPostfix" select="''"/>
133<xsl:param name="rfcUrlFrag" select="'section-'"/>
134<xsl:param name="internetDraftUrlPrefix" select="'http://tools.ietf.org/html/'"/>
135<xsl:param name="internetDraftUrlPostfix" select="''"/>
136<xsl:param name="internetDraftUrlFrag" select="'section-'"/>
137
138<!-- warning re: absent node-set ext. function -->
139<xsl:variable name="node-set-warning">
140  This stylesheet requires either an XSLT-1.0 processor with node-set()
141  extension function, or an XSLT-2.0 processor. Therefore, parts of the
142  document couldn't be displayed.
143</xsl:variable>
144
145<!-- character translation tables -->
146<xsl:variable name="lcase" select="'abcdefghijklmnopqrstuvwxyz'"/>
147<xsl:variable name="ucase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>       
148
149<xsl:variable name="plain" select="' #/ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
150<xsl:variable name="touri" select="'___abcdefghijklmnopqrstuvwxyz'"/>
151
152<!-- build help keys for indices -->
153<xsl:key name="index-first-letter" match="iref|reference" use="translate(substring(concat(@anchor,@item),1,1),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
154
155<xsl:key name="index-item" match="iref" use="@item"/>
156
157<xsl:key name="index-item-subitem" match="iref" use="concat(@item,'..',@subitem)"/>
158
159<xsl:key name="index-xref-by-sec" match="xref[@x:sec]" use="concat(@target,'..',@x:sec)"/>
160
161<xsl:key name="index-xref-by-anchor" match="xref[@x:rel]" use="concat(@target,'..',@x:rel)"/>
162
163<xsl:key name="anchor-item" match="//*[@anchor]" use="@anchor"/>
164
165<xsl:key name="xref-item" match="//xref" use="@target"/>
166
167<xsl:key name="extref-item" match="//x:ref" use="."/>
168
169<!-- prefix for automatically generated anchors -->
170<xsl:variable name="anchor-prefix" select="'rfc'"/>
171
172<!-- IPR version switch -->
173<xsl:variable name="ipr-rfc3667" select="(   /rfc/@number &gt; 3708) or   not(     (/rfc/@ipr = 'full2026') or     (/rfc/@ipr = 'noDerivativeWorks2026') or     (/rfc/@ipr = 'noDerivativeWorksNow') or     (/rfc/@ipr = 'none') or     (/rfc/@ipr = '') or     not(/rfc/@ipr)   )"/>
174
175<xsl:variable name="ipr-rfc4748" select="(   $ipr-rfc3667 and     (       (/rfc/@number &gt; 4671) or       ($xml2rfc-ext-pub-year &gt; 2006) or       ($xml2rfc-ext-pub-year &gt; 2005 and $xml2rfc-ext-pub-month-numeric &gt;= 11)     )   )"/>
176
177<xsl:variable name="ipr-2007-08" select="(   $ipr-rfc4748 and     (       (/rfc/@number &gt; 5000         and /rfc/@number != 5020         and /rfc/@number != 5021         and /rfc/@number != 5034         and /rfc/@number != 5052         and /rfc/@number != 5065         and /rfc/@number != 5094) or       ($xml2rfc-ext-pub-year &gt;= 2008) or       (not(/rfc/@number) and $xml2rfc-ext-pub-year &gt;= 2007 and $xml2rfc-ext-pub-month-numeric &gt;= 9)     )   )"/>
178
179<!-- funding switch --> 
180<xsl:variable name="funding0" select="(   /rfc/@number &gt; 2499) or   (not(/rfc/@number) and /rfc/@docName and $xml2rfc-ext-pub-year &gt;= 1999   )"/>
181 
182<xsl:variable name="funding1" select="(   /rfc/@number &gt; 4320) or   (not(/rfc/@number) and /rfc/@docName and $xml2rfc-ext-pub-year &gt;= 2006   )"/>
183
184<xsl:variable name="funding2" select="$ipr-2007-08"/>
185
186<!-- will document have an index -->
187<xsl:variable name="has-index" select="//iref or (//xref and $xml2rfc-ext-include-references-in-index='yes')"/>
188         
189<!-- does the document contain edits? -->
190<xsl:variable name="has-edits" select="//ed:ins | //ed:del | //ed:replace"/>
191
192<!-- Templates for the various elements of rfc2629.dtd -->
193             
194<xsl:template match="text()[not(ancestor::artwork)]">
195  <xsl:variable name="starts-with-ws" select="translate(substring(.,1,1),'&#x9;&#xA;&#xD; ','')"/>
196  <xsl:variable name="ends-with-ws" select="translate(substring(.,string-length(.),1),'&#x9;&#xA;&#xD; ','')"/>
197  <!--<xsl:message> Orig: "<xsl:value-of select="."/>"</xsl:message>
198  <xsl:message>Start: "<xsl:value-of select="$starts-with-ws"/>"</xsl:message>
199  <xsl:message>  End: "<xsl:value-of select="$ends-with-ws"/>"</xsl:message> -->
200  <xsl:if test="$starts-with-ws='' and preceding-sibling::node()">
201    <xsl:text> </xsl:text>
202  </xsl:if>
203  <xsl:value-of select="normalize-space(.)"/>
204  <xsl:if test="$ends-with-ws='' and following-sibling::node()">
205    <xsl:text> </xsl:text>
206  </xsl:if>
207</xsl:template>
208             
209             
210<xsl:template match="abstract">
211  <h1 xmlns="http://www.w3.org/1999/xhtml" id="{$anchor-prefix}.abstract"><a href="#{$anchor-prefix}.abstract">Abstract</a></h1>
212  <xsl:apply-templates/>
213</xsl:template>
214
215<msxsl:script language="JScript" implements-prefix="myns">
216  function parseXml(str) {
217    try {
218      var doc = new ActiveXObject("MSXML2.DOMDocument");
219      doc.async = false;
220      if (doc.loadXML(str)) {
221        return "";
222      }
223      else {
224        return doc.parseError.reason + "\n" + doc.parseError.srcText + " (" + doc.parseError.line + "/" + doc.parseError.linepos + ")";
225      }
226    }
227    catch(e) {
228      return "";
229    }
230  }
231</msxsl:script>
232
233<xsl:template name="add-artwork-class">
234  <xsl:choose>
235    <xsl:when test="@type='abnf' or @type='abnf2616' or @type='application/xml-dtd' or @type='inline' or @type='application/relax-ng-compact-syntax'">
236      <xsl:attribute name="class">inline</xsl:attribute>
237    </xsl:when>
238    <xsl:when test="starts-with(@type,'message/http') and contains(@type,'msgtype=&#34;request&#34;')">
239      <xsl:attribute name="class">text2</xsl:attribute>
240    </xsl:when>
241    <xsl:when test="starts-with(@type,'message/http')">
242      <xsl:attribute name="class">text</xsl:attribute>
243    </xsl:when>
244    <xsl:when test="starts-with(@type,'drawing')">
245      <xsl:attribute name="class">drawing</xsl:attribute>
246    </xsl:when>
247    <xsl:when test="starts-with(@type,'text/plain') or @type='example' or @type='code'">
248      <xsl:attribute name="class">text</xsl:attribute>
249    </xsl:when>
250    <xsl:otherwise/>
251  </xsl:choose>
252</xsl:template>
253
254<xsl:template match="artwork">
255  <xsl:if test="not(ancestor::ed:del) and $xml2rfc-ext-parse-xml-in-artwork='yes' and function-available('myns:parseXml')">
256    <xsl:if test="contains(.,'&lt;?xml')">
257      <xsl:variable name="body" select="substring-after(substring-after(.,'&lt;?xml'),'?&gt;')"/> 
258      <xsl:if test="$body!='' and myns:parseXml($body)!=''">
259        <table xmlns="http://www.w3.org/1999/xhtml" style="background-color: red; border-width: thin; border-style: solid; border-color: black;">
260        <tr><td>
261        XML PARSE ERROR; parsed the body below:
262        <pre>
263        <xsl:value-of select="$body"/>
264        </pre>
265        resulting in:
266        <pre>
267        <xsl:value-of select="myns:parseXml($body)"/>
268        </pre>
269        </td></tr></table>
270      </xsl:if>
271    </xsl:if>
272    <xsl:if test="@ed:parse-xml-after">
273      <xsl:if test="myns:parseXml(string(.))!=''">
274        <table xmlns="http://www.w3.org/1999/xhtml" style="background-color: red; border-width: thin; border-style: solid; border-color: black;">
275        <tr><td>
276        XML PARSE ERROR:
277        <pre><xsl:value-of select="myns:parseXml(string(.))"/></pre>
278        </td></tr></table>
279      </xsl:if>
280    </xsl:if>
281  </xsl:if>
282  <xsl:variable name="display">
283    <xsl:choose>
284      <xsl:when test="$xml2rfc-ext-allow-markup-in-artwork='yes'">
285        <xsl:apply-templates/>
286      </xsl:when>
287      <xsl:otherwise>
288        <xsl:value-of select="."/>
289      </xsl:otherwise>
290    </xsl:choose>
291  </xsl:variable> 
292  <xsl:choose>
293    <xsl:when test="@align='right'">
294      <div xmlns="http://www.w3.org/1999/xhtml" style="display:table; margin-left: auto; margin-right: 0pt;">
295        <pre style="margin-left: 0em;">
296          <xsl:call-template name="add-artwork-class"/>
297          <xsl:call-template name="insertInsDelClass"/>
298          <xsl:copy-of select="$display"/>
299        </pre>         
300      </div>
301    </xsl:when>
302    <xsl:when test="@align='center'">
303      <div xmlns="http://www.w3.org/1999/xhtml" style="display:table; margin-left: auto; margin-right: auto;">
304        <pre style="margin-left: 0em;">
305          <xsl:call-template name="add-artwork-class"/>
306          <xsl:call-template name="insertInsDelClass"/>
307          <xsl:copy-of select="$display"/>
308        </pre>         
309      </div>
310    </xsl:when>
311    <xsl:otherwise>
312      <pre xmlns="http://www.w3.org/1999/xhtml">
313        <xsl:call-template name="add-artwork-class"/>
314        <xsl:call-template name="insertInsDelClass"/>
315        <xsl:copy-of select="$display"/>
316      </pre>
317    </xsl:otherwise>
318  </xsl:choose>
319  <xsl:call-template name="check-artwork-width">
320    <xsl:with-param name="content"><xsl:apply-templates/></xsl:with-param>
321    <xsl:with-param name="indent"><xsl:value-of select="string-length(@x:indent-with)"/></xsl:with-param>
322  </xsl:call-template>
323</xsl:template>
324
325<!-- special case for first text node in artwork -->
326<xsl:template match="artwork/text()[1]">
327  <xsl:choose>
328    <xsl:when test="starts-with(.,'&#xA;')">
329      <!-- reduce leading whitespace -->
330      <xsl:value-of select="substring(.,2)"/>
331    </xsl:when>
332    <xsl:otherwise>
333      <xsl:value-of select="."/>
334    </xsl:otherwise>
335  </xsl:choose>
336</xsl:template>
337
338
339<xsl:template name="check-artwork-width">
340  <xsl:param name="content"/>
341  <xsl:param name="indent"/>
342  <xsl:choose>
343    <xsl:when test="not(contains($content,'&#xA;'))">
344      <xsl:if test="string-length($content) &gt; 69 + $indent">
345        <xsl:call-template name="warning">
346          <xsl:with-param name="inline" select="'no'"/>
347          <xsl:with-param name="msg">artwork line too long: '<xsl:value-of select="$content"/>' (<xsl:value-of select="string-length($content)"/> characters)</xsl:with-param>
348        </xsl:call-template>
349      </xsl:if>
350    </xsl:when>
351    <xsl:otherwise>
352      <xsl:variable name="start" select="substring-before($content,'&#xA;')"/> 
353      <xsl:variable name="end" select="substring-after($content,'&#xA;')"/> 
354      <xsl:if test="string-length($start) &gt; 69 + $indent">
355        <xsl:call-template name="warning">
356          <xsl:with-param name="inline" select="'no'"/>
357          <xsl:with-param name="msg">artwork line too long: '<xsl:value-of select="$start"/>' (<xsl:value-of select="string-length($start)"/> characters)</xsl:with-param>
358        </xsl:call-template>
359      </xsl:if>
360      <xsl:call-template name="check-artwork-width">
361        <xsl:with-param name="content" select="$end"/>
362      </xsl:call-template>
363    </xsl:otherwise>
364  </xsl:choose>
365</xsl:template>
366
367<xsl:template match="artwork[@src and starts-with(@type,'image/')]">
368  <p xmlns="http://www.w3.org/1999/xhtml">
369    <xsl:choose>
370      <xsl:when test="@type='image/svg+xml'">
371        <object data="{@src}" type="image/svg+xml">
372          <xsl:choose>
373            <xsl:when test="@width!='' or @height!=''">
374              <xsl:copy-of select="@width|@height"/>
375            </xsl:when>
376            <xsl:otherwise xmlns:svg="http://www.w3.org/2000/svg">
377              <!-- try to find width and height from SVG -->
378              <xsl:variable name="svg" select="document(@src)"/>
379              <xsl:for-each select="$svg/svg:svg/@width|$svg/svg:svg/@height">
380                <!-- strip out the units, cross the fingers pixels are meant -->
381                <xsl:attribute name="{local-name()}">
382                  <xsl:value-of select="translate(.,concat($ucase,$lcase),'')"/>
383                </xsl:attribute>
384              </xsl:for-each>
385            </xsl:otherwise>
386          </xsl:choose>
387          <xsl:apply-templates/>
388        </object>
389      </xsl:when>
390      <xsl:otherwise>
391        <img src="{@src}" alt="{.}">
392          <xsl:copy-of select="@width|@height"/>
393        </img>
394      </xsl:otherwise>
395    </xsl:choose>
396  </p>
397</xsl:template>
398
399<xsl:template match="author">
400
401    <address xmlns="http://www.w3.org/1999/xhtml" class="vcard">
402      <span class="vcardline">
403        <span class="fn">
404          <xsl:value-of select="@fullname"/>
405        </span>
406        <xsl:if test="@role">
407          (<xsl:value-of select="@role"/>)
408        </xsl:if>
409        <!-- components of name (hidden from display -->
410        <span class="n hidden">
411          <span class="family-name"><xsl:value-of select="@surname"/></span>
412          <!-- given-name family-name -->
413          <xsl:if test="@surname=substring(@fullname,1 + string-length(@fullname) - string-length(@surname))">
414            <span class="given-name"><xsl:value-of select="normalize-space(substring(@fullname,1,string-length(@fullname) - string-length(@surname)))"/></span>
415          </xsl:if>
416          <!-- family-name given-name -->
417          <xsl:if test="starts-with(@fullname,@surname)">
418            <span class="given-name"><xsl:value-of select="normalize-space(substring-after(@fullname,@surname))"/></span>
419          </xsl:if>
420        </span>
421      </span>
422      <xsl:if test="normalize-space(organization) != ''">
423        <span class="org vcardline">
424          <xsl:value-of select="organization"/>
425        </span>
426      </xsl:if>
427      <xsl:if test="address/postal">
428        <span class="adr">
429          <xsl:if test="address/postal/street!=''">
430            <xsl:for-each select="address/postal/street">
431              <span class="street-address vcardline">
432                <xsl:value-of select="."/>
433              </span>
434            </xsl:for-each>
435          </xsl:if>
436          <xsl:if test="address/postal/city|address/postal/region|address/postal/code">
437            <span class="vcardline">
438              <xsl:if test="address/postal/city"><span class="locality"><xsl:value-of select="address/postal/city"/></span>, </xsl:if>
439              <xsl:if test="address/postal/region"><span class="region"><xsl:value-of select="address/postal/region"/></span> </xsl:if>
440              <xsl:if test="address/postal/code"><span class="postal-code"><xsl:value-of select="address/postal/code"/></span></xsl:if>
441            </span>
442          </xsl:if>
443          <xsl:if test="address/postal/country">
444            <span class="country-name vcardline"><xsl:value-of select="address/postal/country"/></span>
445          </xsl:if>
446        </span>
447      </xsl:if>
448      <xsl:if test="address/phone">
449        <span class="vcardline tel">
450          <xsl:text>Phone: </xsl:text>
451          <a href="tel:{translate(address/phone,' ','')}"><span class="value"><xsl:value-of select="address/phone"/></span></a>
452        </span>
453      </xsl:if>
454      <xsl:if test="address/facsimile">
455        <span class="vcardline tel">
456          <span class="type">Fax</span><xsl:text>: </xsl:text>
457          <a href="fax:{translate(address/facsimile,' ','')}"><span class="value"><xsl:value-of select="address/facsimile"/></span></a>
458        </span>
459      </xsl:if>
460      <xsl:for-each select="address/email">
461        <xsl:variable name="email">
462          <xsl:call-template name="extract-email"/>
463        </xsl:variable>
464       
465        <span class="vcardline">
466          <xsl:text>EMail: </xsl:text>
467          <a>
468            <xsl:if test="$xml2rfc-linkmailto!='no'">
469              <xsl:attribute name="href">mailto:<xsl:value-of select="$email"/></xsl:attribute>
470            </xsl:if>
471            <span class="email"><xsl:value-of select="$email"/></span>
472          </a>
473        </span>
474      </xsl:for-each>
475      <xsl:for-each select="address/uri">
476        <xsl:variable name="uri">
477          <xsl:call-template name="extract-uri"/>
478        </xsl:variable>
479
480        <span class="vcardline">
481          <xsl:text>URI: </xsl:text>
482          <a href="{$uri}" class="url"><xsl:value-of select="$uri"/></a>
483        </span>
484      </xsl:for-each>
485    </address>
486
487</xsl:template>
488
489<xsl:template match="back">
490
491  <!-- add references section first, no matter where it appears in the
492    source document -->
493  <!-- as of April 2004, process from middle section
494  <xsl:apply-templates select="references" />
495  -->
496 
497  <!-- add editorial comments -->
498  <xsl:if test="//cref and $xml2rfc-comments='yes' and $xml2rfc-inline!='yes'">
499    <xsl:call-template name="insertComments"/>
500  </xsl:if>
501 
502  <!-- next, add information about the document's authors -->
503  <xsl:if test="$xml2rfc-ext-authors-section!='end'">
504    <xsl:call-template name="insertAuthors"/>
505  </xsl:if>
506     
507  <!-- add all other top-level sections under <back> -->
508  <xsl:apply-templates select="*[not(self::references) and not(self::ed:replace and .//references)]"/>
509
510  <xsl:if test="$xml2rfc-ext-authors-section='end'">
511    <xsl:call-template name="insertAuthors"/>
512  </xsl:if>
513
514  <xsl:if test="not($xml2rfc-private)">
515    <!-- copyright statements -->
516    <xsl:variable name="copyright"><xsl:call-template name="insertCopyright"/></xsl:variable>
517 
518    <!-- emit it -->
519    <xsl:choose>
520      <xsl:when test="function-available('exslt:node-set')">
521        <xsl:apply-templates select="exslt:node-set($copyright)"/>
522      </xsl:when>
523      <xsl:otherwise>
524        <xsl:call-template name="error">
525          <xsl:with-param name="msg" select="$node-set-warning"/>
526        </xsl:call-template>
527      </xsl:otherwise>
528    </xsl:choose>
529  </xsl:if>
530 
531  <!-- insert the index if index entries exist -->
532  <xsl:if test="$has-index">
533    <xsl:call-template name="insertIndex"/>
534  </xsl:if>
535
536</xsl:template>
537
538<xsl:template match="eref[node()]">
539  <a xmlns="http://www.w3.org/1999/xhtml" href="{@target}"><xsl:apply-templates/></a>
540</xsl:template>
541               
542<xsl:template match="eref[not(node())]">
543  <xsl:text>&lt;</xsl:text>
544  <a xmlns="http://www.w3.org/1999/xhtml" href="{@target}"><xsl:value-of select="@target"/></a>
545  <xsl:text>&gt;</xsl:text>
546</xsl:template>
547
548<xsl:template match="figure">
549  <xsl:if test="@anchor!=''">
550    <xsl:call-template name="check-anchor"/>
551    <div xmlns="http://www.w3.org/1999/xhtml" id="{@anchor}"/>
552  </xsl:if>
553  <xsl:variable name="anch">
554    <xsl:call-template name="get-figure-anchor"/>
555  </xsl:variable>
556  <div xmlns="http://www.w3.org/1999/xhtml" id="{$anch}"/>
557  <xsl:apply-templates/>
558  <xsl:if test="(@title!='' or @anchor!='') and not(@suppress-title='true')">
559    <xsl:variable name="n"><xsl:number level="any" count="figure[(@title!='' or @anchor!='') and not(@suppress-title='true')]"/></xsl:variable>
560    <p xmlns="http://www.w3.org/1999/xhtml" class="figure">Figure <xsl:value-of select="$n"/><xsl:if test="@title!=''">: <xsl:value-of select="@title"/></xsl:if></p>
561  </xsl:if>
562</xsl:template>
563
564<xsl:template match="front">
565 
566  <xsl:if test="$xml2rfc-topblock!='no'">
567    <!-- collect information for left column -->
568     
569    <xsl:variable name="leftColumn">
570      <xsl:call-template name="collectLeftHeaderColumn"/>   
571    </xsl:variable>
572 
573    <!-- collect information for right column -->
574     
575    <xsl:variable name="rightColumn">
576      <xsl:call-template name="collectRightHeaderColumn"/>   
577    </xsl:variable>
578     
579    <!-- insert the collected information -->
580    <table xmlns="http://www.w3.org/1999/xhtml" summary="header information" class="header" border="0" cellpadding="1" cellspacing="1">
581      <xsl:choose>
582        <xsl:when test="function-available('exslt:node-set')">
583          <xsl:call-template name="emitheader">
584            <xsl:with-param name="lc" select="exslt:node-set($leftColumn)"/>   
585            <xsl:with-param name="rc" select="exslt:node-set($rightColumn)"/>   
586          </xsl:call-template>
587        </xsl:when>   
588        <xsl:otherwise>
589          <xsl:call-template name="error">
590            <xsl:with-param name="msg" select="$node-set-warning"/>
591          </xsl:call-template>
592        </xsl:otherwise>
593      </xsl:choose>
594    </table>
595  </xsl:if>
596   
597  <p xmlns="http://www.w3.org/1999/xhtml" class="title">
598    <!-- main title -->
599
600    <xsl:apply-templates select="title"/>
601    <xsl:if test="/rfc/@docName">
602      <br/>
603      <span class="filename"><xsl:value-of select="/rfc/@docName"/></span>
604     
605      <xsl:if test="contains(/rfc/@docName,'.')">
606        <xsl:call-template name="warning">
607          <xsl:with-param name="msg">The @docName attribute should contain the base name, not the filename (thus no file extension).</xsl:with-param>
608        </xsl:call-template>
609      </xsl:if>
610    </xsl:if> 
611  </p>
612 
613  <!-- insert notice about update -->
614  <xsl:variable name="published-as" select="/*/x:link[@rel='Alternate' and starts-with(@title,'RFC')]"/>
615  <xsl:if test="$published-as">
616    <p xmlns="http://www.w3.org/1999/xhtml" style="color: green; text-align: center; font-size: 14pt; background-color: yellow;">
617      <b>Note:</b> a later version of this document has been published as <a href="{$published-as/@href}"><xsl:value-of select="$published-as/@title"/></a>.
618    </p>
619  </xsl:if>
620   
621  <xsl:if test="not($xml2rfc-private)">
622    <!-- Get status info formatted as per RFC2629-->
623    <xsl:variable name="preamble"><xsl:call-template name="insertPreamble"/></xsl:variable>
624   
625    <!-- emit it -->
626    <xsl:choose>
627      <xsl:when test="function-available('exslt:node-set')">
628        <xsl:apply-templates select="exslt:node-set($preamble)"/>
629      </xsl:when>
630      <xsl:otherwise>
631        <xsl:call-template name="error">
632          <xsl:with-param name="msg" select="$node-set-warning"/>
633        </xsl:call-template>
634      </xsl:otherwise>
635    </xsl:choose>
636  </xsl:if>
637           
638  <xsl:apply-templates select="abstract"/>
639  <xsl:apply-templates select="note"/>
640  <!-- show notes inside change tracking as well -->
641  <xsl:apply-templates select="ed:replace[.//note]"/>
642   
643  <xsl:if test="$xml2rfc-toc='yes'">
644    <xsl:apply-templates select="/" mode="toc"/>
645    <xsl:call-template name="insertTocAppendix"/>
646  </xsl:if>
647
648</xsl:template>
649
650
651<xsl:template match="iref">
652  <xsl:variable name="anchor"><xsl:call-template name="compute-iref-anchor"/></xsl:variable>
653  <xsl:choose>
654    <xsl:when test="ancestor::t|ancestor::figure">
655      <span xmlns="http://www.w3.org/1999/xhtml" id="{$anchor}"/>
656    </xsl:when>
657    <xsl:otherwise>
658      <div xmlns="http://www.w3.org/1999/xhtml" id="{$anchor}"/>
659    </xsl:otherwise>
660  </xsl:choose>
661</xsl:template>
662
663<xsl:template name="compute-iref-anchor">
664  <xsl:variable name="first" select="translate(substring(@item,1,1),$ucase,$lcase)"/>
665  <xsl:variable name="nkey" select="translate($first,$lcase,'')"/>
666  <xsl:choose>
667    <xsl:when test="$nkey=''">
668      <xsl:value-of select="$anchor-prefix"/>.iref.<xsl:value-of select="$first"/>.<xsl:number level="any" count="iref[starts-with(translate(@item,$ucase,$lcase),$first)]"/>
669    </xsl:when>
670    <xsl:otherwise>
671      <xsl:value-of select="$anchor-prefix"/>.iref.<xsl:number level="any" count="iref[translate(substring(@item,1,1),concat($lcase,$ucase),'')='']"/>
672    </xsl:otherwise>
673  </xsl:choose>
674</xsl:template>
675
676<xsl:template name="compute-extref-anchor">
677  <xsl:variable name="first" select="translate(substring(.,1,1),$ucase,$lcase)"/>
678  <xsl:variable name="nkey" select="translate($first,$lcase,'')"/>
679  <xsl:choose>
680    <xsl:when test="$nkey=''">
681      <xsl:value-of select="$anchor-prefix"/>.extref.<xsl:value-of select="$first"/>.<xsl:number level="any" count="x:ref[starts-with(translate(.,$ucase,$lcase),$first)]"/>
682    </xsl:when>
683    <xsl:otherwise>
684      <xsl:value-of select="$anchor-prefix"/>.extref.<xsl:number level="any" count="x:ref[translate(substring(.,1,1),concat($lcase,$ucase),'')='']"/>
685    </xsl:otherwise>
686  </xsl:choose>
687</xsl:template>
688
689<!-- list templates depend on the list style -->
690
691<xsl:template match="list[@style='empty' or not(@style)]">
692  <dl xmlns="http://www.w3.org/1999/xhtml" class="empty">
693    <xsl:call-template name="insertInsDelClass"/>
694    <xsl:apply-templates/>
695  </dl>
696</xsl:template>
697
698<xsl:template match="list[starts-with(@style,'format ')]">
699  <dl xmlns="http://www.w3.org/1999/xhtml">
700    <xsl:call-template name="insertInsDelClass"/>
701    <xsl:apply-templates/>
702  </dl>
703</xsl:template>
704
705<xsl:template match="list[@style='hanging']">
706  <dl xmlns="http://www.w3.org/1999/xhtml">
707    <xsl:call-template name="insertInsDelClass"/>
708    <xsl:apply-templates/>
709  </dl>
710</xsl:template>
711
712<xsl:template match="list[@style='numbers']">
713  <ol xmlns="http://www.w3.org/1999/xhtml">
714    <xsl:call-template name="insertInsDelClass"/>
715    <xsl:apply-templates/>
716  </ol>
717</xsl:template>
718
719<!-- numbered list inside numbered list -->
720<xsl:template match="list[@style='numbers']/t/list[@style='numbers']" priority="9">
721  <ol xmlns="http://www.w3.org/1999/xhtml" style="list-style-type: lower-alpha">
722    <xsl:call-template name="insertInsDelClass"/>
723    <xsl:apply-templates/>
724  </ol>
725</xsl:template>
726
727<xsl:template match="list[@style='letters']">
728  <ol xmlns="http://www.w3.org/1999/xhtml" style="list-style-type: lower-alpha">
729    <xsl:call-template name="insertInsDelClass"/>
730    <xsl:apply-templates/>
731  </ol>
732</xsl:template>
733
734<!-- nested lettered list uses uppercase -->
735<xsl:template match="list//t//list[@style='letters']" priority="9">
736  <ol xmlns="http://www.w3.org/1999/xhtml" style="list-style-type: upper-alpha">
737    <xsl:call-template name="insertInsDelClass"/>
738    <xsl:apply-templates/>
739  </ol>
740</xsl:template>
741   
742<xsl:template match="list[@style='symbols']">
743  <ul xmlns="http://www.w3.org/1999/xhtml">
744    <xsl:call-template name="insertInsDelClass"/>
745    <xsl:apply-templates/>
746  </ul>
747</xsl:template>
748
749
750<!-- same for t(ext) elements -->
751
752<xsl:template match="list[@style='empty' or not(@style)]/t | list[@style='empty' or not(@style)]/ed:replace/ed:*/t">
753  <!-- Inherited through CSS now <dd style="margin-top: .5em">-->
754  <dd xmlns="http://www.w3.org/1999/xhtml">
755    <xsl:call-template name="copy-anchor"/>
756    <xsl:call-template name="insertInsDelClass"/>
757    <xsl:apply-templates/>
758  </dd>
759</xsl:template>
760
761<xsl:template match="list[@style='numbers' or @style='symbols' or @style='letters']/x:lt">
762  <li xmlns="http://www.w3.org/1999/xhtml">
763    <xsl:call-template name="copy-anchor"/>
764    <xsl:apply-templates select="t"/>
765  </li>
766</xsl:template>
767
768<xsl:template match="list[@style='numbers' or @style='symbols' or @style='letters']/t | list[@style='numbers' or @style='symbols' or @style='letters']/ed:replace/ed:*/t">
769  <li xmlns="http://www.w3.org/1999/xhtml">
770    <xsl:call-template name="copy-anchor"/>
771    <xsl:call-template name="insertInsDelClass"/>
772    <xsl:for-each select="../..">
773      <xsl:call-template name="insert-issue-pointer"/>
774    </xsl:for-each>
775    <xsl:apply-templates/>
776  </li>
777</xsl:template>
778
779<xsl:template match="list[@style='hanging']/x:lt">
780  <xsl:if test="@hangText!=''">
781    <dt xmlns="http://www.w3.org/1999/xhtml">
782      <xsl:call-template name="copy-anchor"/>
783      <xsl:call-template name="insertInsDelClass"/>
784      <xsl:variable name="del-node" select="ancestor::ed:del"/>
785      <xsl:variable name="rep-node" select="ancestor::ed:replace"/>
786      <xsl:variable name="deleted" select="$del-node and ($rep-node/ed:ins)"/>
787      <xsl:for-each select="../..">
788        <xsl:call-template name="insert-issue-pointer">
789          <xsl:with-param name="deleted-anchor" select="$deleted"/>
790        </xsl:call-template>
791      </xsl:for-each>
792      <xsl:value-of select="@hangText"/>
793    </dt>
794  </xsl:if>
795  <dd xmlns="http://www.w3.org/1999/xhtml">
796    <xsl:call-template name="insertInsDelClass"/>
797    <!-- if hangIndent present, use 0.7 of the specified value (1em is the width of the "m" character -->
798    <xsl:if test="../@hangIndent and ../@hangIndent!='0'">
799      <xsl:attribute name="style">margin-left: <xsl:value-of select="../@hangIndent * 0.7"/>em</xsl:attribute>
800    </xsl:if>
801    <xsl:apply-templates select="t"/>
802  </dd>
803</xsl:template>
804
805<xsl:template match="list[@style='hanging']/t | list[@style='hanging']/ed:replace/ed:*/t">
806  <xsl:if test="@hangText!=''">
807    <dt xmlns="http://www.w3.org/1999/xhtml">
808      <xsl:call-template name="copy-anchor"/>
809      <xsl:call-template name="insertInsDelClass"/>
810      <xsl:if test="count(preceding-sibling::t)=0">
811        <xsl:variable name="del-node" select="ancestor::ed:del"/>
812        <xsl:variable name="rep-node" select="ancestor::ed:replace"/>
813        <xsl:variable name="deleted" select="$del-node and ($rep-node/ed:ins)"/>
814        <xsl:for-each select="../..">
815          <xsl:call-template name="insert-issue-pointer">
816            <xsl:with-param name="deleted-anchor" select="$deleted"/>
817          </xsl:call-template>
818        </xsl:for-each>
819      </xsl:if>
820      <xsl:value-of select="@hangText"/>
821    </dt>
822  </xsl:if>
823
824  <xsl:variable name="dd-content">
825    <xsl:apply-templates/>
826  </xsl:variable>
827
828  <xsl:if test="$dd-content!=''">
829    <dd xmlns="http://www.w3.org/1999/xhtml">
830      <xsl:call-template name="insertInsDelClass"/>
831      <!-- if hangIndent present, use 0.7 of the specified value (1em is the width of the "m" character -->
832      <xsl:if test="../@hangIndent and ../@hangIndent!='0'">
833        <xsl:attribute name="style">margin-left: <xsl:value-of select="../@hangIndent * 0.7"/>em</xsl:attribute>
834      </xsl:if>
835      <xsl:apply-templates/>
836    </dd>
837  </xsl:if>
838</xsl:template>
839
840<xsl:template match="list[starts-with(@style,'format ') and (contains(@style,'%c') or contains(@style,'%d'))]/t">
841  <xsl:variable name="list" select=".."/>
842  <xsl:variable name="format" select="substring-after(../@style,'format ')"/>
843  <xsl:variable name="pos">
844    <xsl:choose>
845      <xsl:when test="$list/@counter">
846        <xsl:number level="any" count="list[@counter=$list/@counter or (not(@counter) and @style=concat('format ',$list/@counter))]/t"/>
847      </xsl:when>
848      <xsl:otherwise>
849        <xsl:number level="any" count="list[concat('format ',@counter)=$list/@style or (not(@counter) and @style=$list/@style)]/t"/>
850      </xsl:otherwise>
851    </xsl:choose>
852  </xsl:variable>
853  <dt xmlns="http://www.w3.org/1999/xhtml">
854    <xsl:call-template name="copy-anchor"/>
855    <xsl:choose>
856      <xsl:when test="contains($format,'%c')">
857        <xsl:value-of select="substring-before($format,'%c')"/><xsl:number value="$pos" format="a"/><xsl:value-of select="substring-after($format,'%c')"/>
858      </xsl:when>
859      <xsl:otherwise>
860        <xsl:value-of select="substring-before($format,'%d')"/><xsl:number value="$pos" format="1"/><xsl:value-of select="substring-after($format,'%d')"/>
861      </xsl:otherwise>
862    </xsl:choose>
863  </dt>
864  <dd xmlns="http://www.w3.org/1999/xhtml">
865    <xsl:apply-templates/>
866  </dd>
867</xsl:template>
868
869<xsl:template match="middle">
870  <xsl:apply-templates/>
871  <xsl:apply-templates select="../back//references"/>
872</xsl:template>
873
874<xsl:template match="note">
875  <xsl:variable name="num"><xsl:number/></xsl:variable>
876    <h1 xmlns="http://www.w3.org/1999/xhtml" id="{$anchor-prefix}.note.{$num}">
877      <xsl:call-template name="insertInsDelClass"/>
878      <a href="#{$anchor-prefix}.note.{$num}">
879        <xsl:value-of select="@title"/>
880      </a>
881    </h1>
882  <xsl:apply-templates/>
883</xsl:template>
884
885<xsl:template match="postamble">
886  <xsl:if test="normalize-space(.) != ''">
887    <p xmlns="http://www.w3.org/1999/xhtml">
888      <xsl:call-template name="insertInsDelClass"/>
889      <xsl:call-template name="editingMark"/>
890      <xsl:apply-templates/>
891    </p>
892  </xsl:if>
893</xsl:template>
894
895<xsl:template match="preamble">
896  <xsl:if test="normalize-space(.) != ''">
897    <p xmlns="http://www.w3.org/1999/xhtml">
898      <xsl:call-template name="copy-anchor"/>
899      <xsl:call-template name="insertInsDelClass"/>
900      <xsl:call-template name="editingMark"/>
901      <xsl:apply-templates/>
902    </p>
903  </xsl:if>
904</xsl:template>
905
906<xsl:template name="computed-auto-target">
907  <xsl:param name="bib"/>
908  <xsl:param name="ref"/>
909
910  <xsl:choose>
911    <xsl:when test="$ref and $bib/x:source/@href and $bib/x:source/@basename and $ref/@x:rel">
912      <xsl:value-of select="concat($bib/x:source/@basename,'.html',$ref/@x:rel)"/>
913    </xsl:when>
914    <xsl:when test="$bib/seriesInfo/@name='RFC'">
915      <xsl:variable name="sec">
916        <xsl:choose>
917          <xsl:when test="$ref and starts-with($ref/@x:rel,'#') and not($ref/@x:sec)">
918            <xsl:variable name="extdoc" select="document($bib/x:source/@href)"/>
919            <xsl:for-each select="$extdoc//*[@anchor=substring-after($ref/@x:rel,'#')]">
920              <xsl:call-template name="get-section-number"/>
921            </xsl:for-each>
922          </xsl:when>
923          <xsl:when test="$ref">
924            <xsl:value-of select="$ref/@x:sec"/>
925          </xsl:when>
926          <xsl:otherwise/>
927        </xsl:choose>
928      </xsl:variable>
929      <xsl:value-of select="concat($rfcUrlPrefix,$bib/seriesInfo[@name='RFC']/@value,$rfcUrlPostfix)"/>
930      <xsl:if test="$ref and $sec!='' and $rfcUrlFrag">
931        <xsl:value-of select="concat('#',$rfcUrlFrag,$sec)"/>
932      </xsl:if>
933    </xsl:when>
934    <xsl:when test="$bib/seriesInfo/@name='Internet-Draft'">
935      <xsl:value-of select="concat($internetDraftUrlPrefix,$bib/seriesInfo[@name='Internet-Draft']/@value,$internetDraftUrlPostfix)"/>
936      <xsl:if test="$ref and $ref/@x:sec and $internetDraftUrlFrag">
937        <xsl:value-of select="concat('#',$internetDraftUrlFrag,$ref/@x:sec)"/>
938      </xsl:if>
939    </xsl:when>
940    <xsl:otherwise/>
941  </xsl:choose> 
942 
943</xsl:template>
944
945<xsl:template name="computed-target">
946  <xsl:param name="bib"/>
947  <xsl:param name="ref"/>
948
949  <xsl:choose>
950    <xsl:when test="$bib/@target">
951      <xsl:if test="$ref and $ref/@x:sec and $ref/@x:rel">
952        <xsl:value-of select="concat($bib/@target,$ref/@x:rel)"/>
953      </xsl:if>
954    </xsl:when>
955    <xsl:otherwise>
956      <xsl:call-template name="computed-auto-target">
957        <xsl:with-param name="bib" select="$bib"/>
958        <xsl:with-param name="ref" select="$ref"/>
959      </xsl:call-template>
960    </xsl:otherwise>
961  </xsl:choose> 
962 
963</xsl:template>
964
965<xsl:template match="reference">
966
967  <!-- check for reference to reference -->
968  <xsl:variable name="anchor" select="@anchor"/>
969  <xsl:if test="not(ancestor::ed:del) and not(key('xref-item',$anchor))">
970    <xsl:call-template name="warning">
971      <xsl:with-param name="inline" select="'no'"/>
972      <xsl:with-param name="msg">unused reference '<xsl:value-of select="@anchor"/>'</xsl:with-param>
973    </xsl:call-template>
974  </xsl:if>
975
976  <xsl:call-template name="check-anchor"/>
977
978  <xsl:variable name="target">
979    <xsl:choose>
980      <xsl:when test="@target"><xsl:value-of select="@target"/></xsl:when>
981      <xsl:otherwise>
982        <xsl:call-template name="computed-auto-target">
983          <xsl:with-param name="bib" select="."/>
984        </xsl:call-template>
985      </xsl:otherwise>
986    </xsl:choose>
987  </xsl:variable>
988 
989  <tr xmlns="http://www.w3.org/1999/xhtml">
990    <td class="reference">
991      <xsl:call-template name="insertInsDelClass"/>
992      <xsl:variable name="del-node" select="ancestor::ed:del"/>
993      <xsl:variable name="rep-node" select="ancestor::ed:replace"/>
994      <xsl:variable name="deleted" select="$del-node and ($rep-node/ed:ins)"/>
995      <xsl:for-each select="../..">
996        <xsl:call-template name="insert-issue-pointer">
997          <xsl:with-param name="deleted-anchor" select="$deleted"/>
998        </xsl:call-template>
999      </xsl:for-each>
1000      <b id="{@anchor}">
1001        <xsl:call-template name="referencename">
1002          <xsl:with-param name="node" select="."/>
1003        </xsl:call-template>
1004      </b>
1005    </td>
1006   
1007    <td class="top">
1008      <xsl:call-template name="insertInsDelClass"/>
1009      <xsl:for-each select="front/author">
1010        <xsl:variable name="initials">
1011          <xsl:call-template name="format-initials"/>
1012        </xsl:variable>
1013     
1014        <xsl:choose>
1015          <xsl:when test="@surname and @surname!=''">
1016            <xsl:variable name="displayname">
1017              <!-- surname/initials is reversed for last author except when it's the only one -->
1018              <xsl:choose>
1019                <xsl:when test="position()=last() and position()!=1">
1020                  <xsl:value-of select="concat($initials,' ',@surname)"/>
1021                </xsl:when>
1022                <xsl:otherwise>
1023                  <xsl:value-of select="concat(@surname,', ',$initials)"/>
1024                </xsl:otherwise>
1025              </xsl:choose>
1026              <xsl:if test="@role='editor'">
1027                <xsl:text>, Ed.</xsl:text>
1028              </xsl:if>
1029            </xsl:variable>
1030            <xsl:choose>
1031              <xsl:when test="address/email">
1032                <a>
1033                  <xsl:if test="$xml2rfc-linkmailto!='no'">
1034                    <xsl:attribute name="href">mailto:<xsl:value-of select="address/email"/></xsl:attribute>
1035                  </xsl:if>
1036                  <xsl:if test="organization/text()">
1037                    <xsl:attribute name="title"><xsl:value-of select="organization/text()"/></xsl:attribute>
1038                  </xsl:if>
1039                  <xsl:value-of select="$displayname"/>
1040                </a>
1041              </xsl:when>
1042              <xsl:otherwise>
1043                <xsl:value-of select="$displayname"/>
1044              </xsl:otherwise>
1045            </xsl:choose>
1046           
1047            <xsl:choose>
1048              <xsl:when test="position()=last() - 1">
1049                <xsl:if test="last() &gt; 2">,</xsl:if>
1050                <xsl:text> and </xsl:text>
1051              </xsl:when>
1052              <xsl:otherwise>
1053                <xsl:text>, </xsl:text>
1054              </xsl:otherwise>
1055            </xsl:choose>
1056          </xsl:when>
1057          <xsl:when test="organization/text()">
1058            <xsl:choose>
1059              <xsl:when test="address/uri">
1060                <a href="{address/uri}"><xsl:value-of select="organization"/></a>
1061              </xsl:when>
1062              <xsl:otherwise>
1063                <xsl:value-of select="organization"/>
1064              </xsl:otherwise>
1065            </xsl:choose>
1066           
1067            <xsl:choose>
1068              <xsl:when test="position()=last() - 1">
1069                <xsl:if test="last() &gt; 2">,</xsl:if>
1070                <xsl:text> and </xsl:text>
1071              </xsl:when>
1072              <xsl:otherwise>
1073                <xsl:text>, </xsl:text>
1074              </xsl:otherwise>
1075            </xsl:choose>
1076          </xsl:when>
1077          <xsl:otherwise/>
1078        </xsl:choose>
1079      </xsl:for-each>
1080         
1081      <xsl:choose>
1082        <xsl:when test="string-length($target) &gt; 0">
1083          <xsl:text>&#8220;</xsl:text><a href="{$target}"><xsl:value-of select="front/title"/></a><xsl:text>&#8221;</xsl:text>
1084        </xsl:when>
1085        <xsl:otherwise>
1086          <xsl:text>&#8220;</xsl:text><xsl:value-of select="front/title"/><xsl:text>&#8221;</xsl:text>
1087        </xsl:otherwise>
1088      </xsl:choose>
1089           
1090      <xsl:for-each select="seriesInfo">
1091        <xsl:text>, </xsl:text>
1092        <xsl:choose>
1093          <xsl:when test="not(@name) and not(@value) and ./text()"><xsl:value-of select="."/></xsl:when>
1094          <xsl:otherwise>
1095            <xsl:value-of select="@name"/>
1096            <xsl:if test="@value!=''"> <xsl:value-of select="@value"/></xsl:if>
1097            <xsl:if test="translate(@name,$ucase,$lcase)='internet-draft'"> (work in progress)</xsl:if>
1098          </xsl:otherwise>
1099        </xsl:choose>
1100      </xsl:for-each>
1101     
1102      <xsl:if test="front/date/@year != '' and front/date/@year != '???'">
1103        <xsl:text>, </xsl:text>
1104        <xsl:if test="front/date/@month!=''"><xsl:value-of select="front/date/@month"/> </xsl:if>
1105        <xsl:value-of select="front/date/@year"/>
1106      </xsl:if>
1107     
1108      <xsl:if test="@target">
1109        <xsl:text>, &lt;</xsl:text>
1110        <a href="{@target}"><xsl:value-of select="@target"/></a>
1111        <xsl:text>&gt;</xsl:text>
1112      </xsl:if>
1113     
1114      <xsl:text>.</xsl:text>
1115
1116      <xsl:for-each select="annotation">
1117        <br/>
1118        <xsl:apply-templates/>
1119      </xsl:for-each>
1120
1121    </td>
1122  </tr>
1123 
1124 
1125</xsl:template>
1126
1127
1128<xsl:template match="references">
1129
1130  <xsl:variable name="name">
1131    <xsl:if test="ancestor::ed:del">
1132      <xsl:text>del-</xsl:text>
1133    </xsl:if>
1134    <xsl:number level="any"/>     
1135  </xsl:variable>
1136 
1137  <xsl:variable name="refseccount" select="count(/rfc/back/references)+count(/rfc/back/ed:replace/ed:ins/references)"/>
1138
1139  <!-- insert pseudo section when needed -->
1140  <xsl:if test="not(preceding::references) and $refseccount!=1">
1141    <xsl:call-template name="insert-conditional-hrule"/>
1142    <h1 xmlns="http://www.w3.org/1999/xhtml" id="{$anchor-prefix}.references">
1143      <xsl:call-template name="insert-conditional-pagebreak"/>
1144      <xsl:variable name="sectionNumber">
1145        <xsl:call-template name="get-references-section-number"/>
1146      </xsl:variable>
1147      <a id="{$anchor-prefix}.section.{$sectionNumber}" href="#{$anchor-prefix}.section.{$sectionNumber}">
1148        <xsl:call-template name="emit-section-number">
1149          <xsl:with-param name="no" select="$sectionNumber"/>
1150        </xsl:call-template>
1151      </a>
1152      <xsl:text> References</xsl:text>
1153    </h1>
1154  </xsl:if>
1155 
1156  <xsl:variable name="elemtype">
1157    <xsl:choose>
1158      <xsl:when test="$refseccount!=1">h2</xsl:when>
1159      <xsl:otherwise>h1</xsl:otherwise>
1160    </xsl:choose>
1161  </xsl:variable>
1162 
1163  <xsl:variable name="title">
1164    <xsl:choose>
1165      <xsl:when test="not(@title) or @title=''">References</xsl:when>
1166      <xsl:otherwise><xsl:value-of select="@title"/></xsl:otherwise>
1167    </xsl:choose>
1168  </xsl:variable>
1169 
1170  <xsl:element namespace="http://www.w3.org/1999/xhtml" name="{$elemtype}"> 
1171    <xsl:if test="$name='1'">
1172      <xsl:call-template name="insert-conditional-pagebreak"/>
1173    </xsl:if>
1174    <xsl:variable name="sectionNumber">
1175      <xsl:call-template name="get-section-number"/>
1176    </xsl:variable>
1177    <xsl:variable name="anchorpref">
1178      <xsl:choose>
1179        <xsl:when test="$elemtype='h1'"/>
1180        <xsl:otherwise>.<xsl:value-of select="$name"/></xsl:otherwise>
1181      </xsl:choose>
1182    </xsl:variable>
1183    <xsl:attribute name="id"><xsl:value-of select="concat($anchor-prefix,'.references',$anchorpref)"/></xsl:attribute>
1184    <a xmlns="http://www.w3.org/1999/xhtml" href="#{$anchor-prefix}.section.{$sectionNumber}" id="{$anchor-prefix}.section.{$sectionNumber}">
1185      <xsl:call-template name="emit-section-number">
1186        <xsl:with-param name="no" select="$sectionNumber"/>
1187      </xsl:call-template>
1188    </a>
1189    <xsl:text> </xsl:text>
1190    <xsl:value-of select="$title"/>
1191  </xsl:element>
1192 
1193  <table xmlns="http://www.w3.org/1999/xhtml" summary="{$title}">
1194    <xsl:choose>
1195      <xsl:when test="$xml2rfc-sortrefs='yes' and $xml2rfc-symrefs!='no'">
1196        <xsl:apply-templates>
1197          <xsl:sort select="@anchor|.//ed:ins//reference/@anchor"/>
1198        </xsl:apply-templates>
1199      </xsl:when>
1200      <xsl:otherwise>
1201        <xsl:apply-templates/>
1202      </xsl:otherwise>
1203    </xsl:choose>
1204  </table>
1205
1206</xsl:template>
1207
1208<xsl:template match="rfc">
1209 
1210  <!-- conformance checks -->
1211  <xsl:if test="$xml2rfc-symrefs!='no' and $xml2rfc-symrefs!='yes' and //reference">
1212    <xsl:call-template name="warning">
1213      <xsl:with-param name="inline" select="'no'"/>
1214      <xsl:with-param name="msg">symrefs PI not specified; default has changed from 'no' to 'yes'.</xsl:with-param>
1215    </xsl:call-template>
1216  </xsl:if>
1217 
1218  <xsl:variable name="lang">
1219    <xsl:call-template name="get-lang"/>
1220  </xsl:variable>
1221
1222  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{$lang}">
1223    <head profile="http://www.w3.org/2006/03/hcard">
1224      <title>
1225        <xsl:apply-templates select="front/title" mode="get-text-content"/>
1226      </title>
1227      <style type="text/css" title="Xml2Rfc (sans serif)">
1228        <xsl:call-template name="insertCss"/>
1229      </style>
1230      <!-- <link rel="alternate stylesheet" type="text/css" media="screen" title="Plain (typewriter)" href="rfc2629tty.css" /> -->
1231           
1232      <!-- link elements -->
1233      <xsl:if test="$xml2rfc-toc='yes'">
1234        <link rel="Contents" href="#{$anchor-prefix}.toc"/>
1235      </xsl:if>
1236      <link rel="Author" href="#{$anchor-prefix}.authors"/>
1237      <xsl:if test="not($xml2rfc-private)">
1238        <link rel="Copyright" href="#{$anchor-prefix}.copyright"/>
1239      </xsl:if>
1240      <xsl:if test="$has-index">
1241        <link rel="Index" href="#{$anchor-prefix}.index"/>
1242      </xsl:if>
1243      <xsl:apply-templates select="/" mode="links"/>
1244      <xsl:for-each select="/rfc/x:link">
1245        <link><xsl:copy-of select="@*"/></link>
1246      </xsl:for-each>
1247      <xsl:if test="/rfc/@number">
1248        <xsl:variable name="number">
1249          <xsl:choose>
1250            <xsl:when test="string-length(/rfc/@number) &lt; 2">000<xsl:value-of select="/rfc/@number"/></xsl:when>
1251            <xsl:when test="string-length(/rfc/@number) &lt; 3">00<xsl:value-of select="/rfc/@number"/></xsl:when>
1252            <xsl:when test="string-length(/rfc/@number) &lt; 4">0<xsl:value-of select="/rfc/@number"/></xsl:when>
1253            <xsl:otherwise><xsl:value-of select="/rfc/@number"/></xsl:otherwise>
1254          </xsl:choose>
1255        </xsl:variable>
1256        <link rel="Alternate" title="Authorative ASCII Version" href="http://www.ietf.org/rfc/rfc{/rfc/@number}.txt"/>
1257        <link rel="Help" title="Additional Information on tools.ietf.org" href="http://tools.ietf.org/html/rfc{$number}"/>
1258      </xsl:if>
1259
1260      <!-- generator -->
1261      <xsl:variable name="gen">
1262        <xsl:call-template name="get-generator"/>
1263      </xsl:variable>
1264      <meta name="generator" content="{$gen}"/>
1265     
1266      <!-- keywords -->
1267      <xsl:if test="front/keyword">
1268        <xsl:variable name="keyw">
1269          <xsl:call-template name="get-keywords"/>
1270        </xsl:variable>
1271        <meta name="keywords" content="{$keyw}"/>
1272      </xsl:if>
1273
1274      <xsl:if test="$xml2rfc-ext-support-rfc2731!='no'">
1275        <!-- Dublin Core Metadata -->
1276        <link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"/>
1277             
1278        <!-- DC creator, see RFC2731 -->
1279        <xsl:for-each select="/rfc/front/author">
1280          <xsl:variable name="initials">
1281            <xsl:call-template name="format-initials"/>
1282          </xsl:variable>
1283          <meta name="DC.Creator" content="{concat(@surname,', ',$initials)}"/>
1284        </xsl:for-each>
1285       
1286        <xsl:if test="not($xml2rfc-private)">
1287          <xsl:choose>
1288            <xsl:when test="/rfc/@number">
1289              <meta name="DC.Identifier" content="urn:ietf:rfc:{/rfc/@number}"/>
1290            </xsl:when>
1291            <xsl:when test="/rfc/@docName">
1292              <meta name="DC.Identifier" content="urn:ietf:id:{/rfc/@docName}"/>
1293            </xsl:when>
1294            <xsl:otherwise/>
1295          </xsl:choose>
1296          <meta name="DC.Date.Issued" scheme="ISO8601" content="{$xml2rfc-ext-pub-year}-{$xml2rfc-ext-pub-month-numeric}"/>
1297 
1298          <xsl:if test="/rfc/@obsoletes!=''">
1299            <xsl:call-template name="rfclist-for-dcmeta">
1300              <xsl:with-param name="list" select="/rfc/@obsoletes"/>
1301            </xsl:call-template>
1302          </xsl:if>
1303        </xsl:if>
1304 
1305        <xsl:if test="/rfc/front/abstract">
1306          <meta name="DC.Description.Abstract" content="{normalize-space(/rfc/front/abstract)}"/>
1307        </xsl:if>     
1308      </xsl:if>     
1309    </head>
1310    <body>
1311      <!-- insert diagnostics -->
1312      <xsl:call-template name="insert-diagnostics"/>
1313
1314      <xsl:apply-templates select="front"/>
1315      <xsl:apply-templates select="middle"/>
1316      <xsl:apply-templates select="back"/>
1317    </body>
1318  </html>
1319</xsl:template>               
1320
1321
1322<xsl:template match="t">
1323  <xsl:if test="preceding-sibling::section or preceding-sibling::appendix">
1324    <xsl:call-template name="warning">
1325      <xsl:with-param name="msg">The paragraph below is misplaced; maybe a section is closed in the wrong place: </xsl:with-param>
1326      <xsl:with-param name="msg2"><xsl:value-of select="."/></xsl:with-param>
1327    </xsl:call-template>
1328  </xsl:if>
1329  <xsl:choose>
1330    <xsl:when test="@anchor">
1331      <div xmlns="http://www.w3.org/1999/xhtml" id="{@anchor}"><xsl:apply-templates mode="t-content" select="node()[1]"/></div>
1332    </xsl:when>
1333    <xsl:otherwise>
1334      <xsl:apply-templates mode="t-content" select="node()[1]"/>
1335    </xsl:otherwise>
1336  </xsl:choose>
1337</xsl:template>
1338
1339<!-- for t-content, dispatch to default templates if it's block-level content -->
1340<xsl:template mode="t-content" match="list|figure|texttable">
1341  <!-- <xsl:comment>t-content block-level</xsl:comment>  -->
1342  <xsl:apply-templates select="."/>
1343  <xsl:apply-templates select="following-sibling::node()[1]" mode="t-content"/>
1344</xsl:template>               
1345               
1346<!-- ... otherwise group into p elements -->
1347<xsl:template mode="t-content" match="*|node()">
1348  <xsl:variable name="p">
1349    <xsl:call-template name="get-paragraph-number"/>
1350  </xsl:variable>
1351
1352  <!-- do not open a new p element if this is a whitespace-only text node and no siblings follow --> 
1353  <xsl:if test="not(self::text() and normalize-space(.)='' and not(following-sibling::node()))">
1354    <p xmlns="http://www.w3.org/1999/xhtml">
1355      <xsl:if test="$p!='' and not(ancestor::ed:del) and not(ancestor::ed:ins) and not(ancestor::x:lt) and count(preceding-sibling::node())=0">
1356        <xsl:attribute name="id"><xsl:value-of select="$anchor-prefix"/>.section.<xsl:value-of select="$p"/></xsl:attribute>
1357      </xsl:if>
1358      <xsl:call-template name="insertInsDelClass"/>
1359      <xsl:call-template name="editingMark"/>
1360      <xsl:apply-templates mode="t-content2" select="."/>
1361    </p>
1362  </xsl:if>
1363  <xsl:apply-templates mode="t-content" select="following-sibling::*[self::list or self::figure or self::texttable][1]"/>
1364</xsl:template>               
1365               
1366<xsl:template mode="t-content2" match="*">
1367  <xsl:apply-templates select="."/>
1368  <xsl:if test="not(following-sibling::node()[1] [self::list or self::figure or self::texttable])">
1369    <xsl:apply-templates select="following-sibling::node()[1]" mode="t-content2"/>
1370  </xsl:if>
1371</xsl:template>       
1372
1373<xsl:template mode="t-content2" match="text()">
1374  <xsl:apply-templates select="."/>
1375  <xsl:if test="not(following-sibling::node()[1] [self::list or self::figure or self::texttable])">
1376    <xsl:apply-templates select="following-sibling::node()[1]" mode="t-content2"/>
1377  </xsl:if>
1378</xsl:template>               
1379
1380<xsl:template mode="t-content2" match="comment()">
1381  <xsl:apply-templates select="."/>
1382  <xsl:if test="not(following-sibling::node()[1] [self::list or self::figure or self::texttable])">
1383    <xsl:apply-templates select="following-sibling::node()[1]" mode="t-content2"/>
1384  </xsl:if>
1385</xsl:template>               
1386
1387<xsl:template match="title">
1388  <xsl:if test="@abbrev and string-length(@abbrev) &gt; 40">
1389    <xsl:call-template name="warning">
1390      <xsl:with-param name="inline" select="'no'"/>
1391      <xsl:with-param name="msg">title/@abbrev too long (max 40 characters)</xsl:with-param>
1392    </xsl:call-template>
1393  </xsl:if>
1394
1395  <xsl:if test="string-length(.) &gt; 40 and (not(@abbrev) or @abbrev='')">
1396    <xsl:call-template name="warning">
1397      <xsl:with-param name="inline" select="'no'"/>
1398      <xsl:with-param name="msg">title too long, should supply title/@abbrev attribute with less than 40 characters</xsl:with-param>
1399    </xsl:call-template>
1400  </xsl:if>
1401
1402  <xsl:apply-templates/>
1403</xsl:template>
1404
1405<xsl:template name="insertTitle">
1406  <xsl:choose>
1407    <xsl:when test="@ed:old-title">
1408      <del xmlns="http://www.w3.org/1999/xhtml">
1409        <xsl:if test="ancestor-or-self::*[@ed:entered-by] and @ed:datetime">
1410          <xsl:attribute name="title"><xsl:value-of select="concat(@ed:datetime,', ',ancestor-or-self::*[@ed:entered-by][1]/@ed:entered-by)"/></xsl:attribute>
1411        </xsl:if>
1412        <xsl:value-of select="@ed:old-title"/>
1413      </del>
1414      <ins xmlns="http://www.w3.org/1999/xhtml">
1415        <xsl:if test="ancestor-or-self::*[@ed:entered-by] and @ed:datetime">
1416          <xsl:attribute name="title"><xsl:value-of select="concat(@ed:datetime,', ',ancestor-or-self::*[@ed:entered-by][1]/@ed:entered-by)"/></xsl:attribute>
1417        </xsl:if>
1418        <xsl:value-of select="@title"/>
1419      </ins>
1420    </xsl:when>
1421    <xsl:otherwise>
1422      <xsl:value-of select="@title"/>
1423    </xsl:otherwise>
1424  </xsl:choose>
1425</xsl:template>
1426
1427<xsl:template match="section|appendix">
1428
1429  <xsl:if test="self::appendix">
1430    <xsl:call-template name="warning">
1431      <xsl:with-param name="inline" select="'no'"/>
1432      <xsl:with-param name="msg">The "appendix" element is deprecated, use "section" inside "back" instead.</xsl:with-param>
1433    </xsl:call-template>
1434  </xsl:if>
1435
1436  <xsl:variable name="sectionNumber">
1437    <xsl:choose>
1438      <xsl:when test="@myns:unnumbered"/>
1439      <xsl:otherwise><xsl:call-template name="get-section-number"/></xsl:otherwise>
1440    </xsl:choose>
1441  </xsl:variable>
1442   
1443  <xsl:if test="not(ancestor::section) and not(@myns:notoclink)">
1444    <xsl:call-template name="insert-conditional-hrule"/>
1445  </xsl:if>
1446 
1447  <xsl:variable name="elemtype">
1448    <xsl:choose>
1449      <xsl:when test="count(ancestor::section) = 0">h1</xsl:when>
1450      <xsl:when test="count(ancestor::section) = 1">h2</xsl:when>
1451      <xsl:when test="count(ancestor::section) = 2">h3</xsl:when>
1452      <xsl:when test="count(ancestor::section) = 3">h4</xsl:when>
1453      <xsl:otherwise>h5</xsl:otherwise>
1454    </xsl:choose>
1455  </xsl:variable>
1456 
1457  <!-- process irefs immediadetely following the section so that their anchor
1458  actually is the section heading -->
1459  <xsl:apply-templates select="iref[count(preceding-sibling::*[not(self::iref)])=0]"/>
1460
1461  <xsl:element namespace="http://www.w3.org/1999/xhtml" name="{$elemtype}">
1462    <xsl:if test="$sectionNumber!=''">
1463      <xsl:attribute name="id"><xsl:value-of select="$anchor-prefix"/>.section.<xsl:value-of select="$sectionNumber"/></xsl:attribute>
1464    </xsl:if>
1465    <xsl:choose>
1466      <xsl:when test="$sectionNumber='1'">
1467        <!-- pagebreak, this the first section -->
1468        <xsl:attribute name="class">np</xsl:attribute>
1469      </xsl:when>
1470      <xsl:when test="not(ancestor::section) and not(@myns:notoclink)">
1471        <xsl:call-template name="insert-conditional-pagebreak"/>
1472      </xsl:when>
1473      <xsl:otherwise/>
1474    </xsl:choose>
1475   
1476    <xsl:call-template name="insertInsDelClass"/>
1477       
1478    <xsl:if test="$sectionNumber!=''">
1479      <a xmlns="http://www.w3.org/1999/xhtml" href="#{$anchor-prefix}.section.{$sectionNumber}">
1480        <xsl:call-template name="emit-section-number">
1481          <xsl:with-param name="no" select="$sectionNumber"/>
1482        </xsl:call-template>
1483      </a>
1484      <xsl:text> </xsl:text>
1485    </xsl:if>
1486   
1487    <!-- issue tracking? -->
1488    <xsl:if test="@ed:resolves">
1489      <xsl:call-template name="insert-issue-pointer"/>
1490    </xsl:if>
1491   
1492    <xsl:choose>
1493      <xsl:when test="@anchor">
1494        <xsl:call-template name="check-anchor"/>
1495        <a xmlns="http://www.w3.org/1999/xhtml" id="{@anchor}" href="#{@anchor}"><xsl:call-template name="insertTitle"/></a>
1496      </xsl:when>
1497      <xsl:otherwise>
1498        <xsl:call-template name="insertTitle"/>
1499      </xsl:otherwise>
1500    </xsl:choose>
1501  </xsl:element>
1502  <!-- continue with all child elements but the irefs processed above -->
1503  <xsl:apply-templates select="*[not(self::iref)]|iref[count(preceding-sibling::*[not(self::iref)])!=0]"/>
1504</xsl:template>
1505
1506<xsl:template match="spanx[@style='emph' or not(@style)]">
1507  <em xmlns="http://www.w3.org/1999/xhtml">
1508    <xsl:call-template name="copy-anchor"/>
1509    <xsl:apply-templates/>
1510  </em>
1511</xsl:template>
1512
1513<xsl:template match="spanx[@style='verb']">
1514  <samp xmlns="http://www.w3.org/1999/xhtml">
1515    <xsl:call-template name="copy-anchor"/>
1516    <xsl:apply-templates/>
1517  </samp>
1518</xsl:template>
1519
1520<xsl:template match="spanx[@style='strong']">
1521  <strong xmlns="http://www.w3.org/1999/xhtml">
1522    <xsl:call-template name="copy-anchor"/>
1523    <xsl:apply-templates/>
1524  </strong>
1525</xsl:template>
1526
1527<xsl:template name="insert-blank-lines">
1528  <xsl:param name="no"/>
1529  <xsl:choose>
1530    <xsl:when test="$no &lt;= 0">
1531      <br xmlns="http://www.w3.org/1999/xhtml"/>
1532      <!-- done -->
1533    </xsl:when>
1534    <xsl:otherwise>
1535      <br xmlns="http://www.w3.org/1999/xhtml"/>
1536      <xsl:call-template name="insert-blank-lines">
1537        <xsl:with-param name="no" select="$no - 1"/>
1538      </xsl:call-template>
1539    </xsl:otherwise>
1540  </xsl:choose>
1541</xsl:template>
1542
1543<xsl:template match="vspace[not(@blankLines)]">
1544  <br xmlns="http://www.w3.org/1999/xhtml"/>
1545</xsl:template>
1546
1547<xsl:template match="vspace">
1548  <xsl:call-template name="insert-blank-lines">
1549    <xsl:with-param name="no" select="@blankLines"/>
1550  </xsl:call-template>
1551</xsl:template>
1552
1553<!-- keep the root for the case when we process XSLT-inline markup -->
1554<xsl:variable name="src" select="/"/>
1555
1556<xsl:template name="render-section-ref">
1557  <xsl:param name="from"/>
1558  <xsl:param name="to"/>
1559
1560  <xsl:variable name="refname">
1561    <xsl:for-each select="$to">
1562      <xsl:call-template name="get-section-type">
1563        <xsl:with-param name="prec" select="$from/preceding-sibling::node()[1]"/>
1564      </xsl:call-template>
1565    </xsl:for-each>
1566  </xsl:variable>
1567  <xsl:variable name="refnum">
1568    <xsl:for-each select="$to">
1569      <xsl:call-template name="get-section-number"/>
1570    </xsl:for-each>
1571  </xsl:variable>
1572  <xsl:attribute name="title">
1573    <xsl:value-of select="$to/@title"/>
1574  </xsl:attribute>
1575  <xsl:choose>
1576    <xsl:when test="@format='counter'">
1577      <xsl:value-of select="$refnum"/>
1578    </xsl:when>
1579    <xsl:when test="@format='title'">
1580      <xsl:value-of select="$to/@title"/>
1581    </xsl:when>
1582    <xsl:otherwise>
1583      <xsl:value-of select="normalize-space(concat($refname,' ',$refnum))"/>
1584    </xsl:otherwise>
1585  </xsl:choose>
1586</xsl:template>
1587
1588<xsl:template match="xref[node()]">
1589
1590  <xsl:variable name="target" select="@target"/>
1591  <xsl:variable name="node" select="key('anchor-item',$target)"/>
1592  <xsl:variable name="anchor"><xsl:value-of select="$anchor-prefix"/>.xref.<xsl:value-of select="@target"/>.<xsl:number level="any" count="xref[@target=$target]"/></xsl:variable>
1593
1594  <xsl:choose>
1595
1596    <!-- x:fmt='none': do not generate any links -->
1597    <xsl:when test="@x:fmt='none'">
1598      <xsl:choose>
1599        <xsl:when test="name($node)='reference'">
1600          <cite xmlns="http://www.w3.org/1999/xhtml" title="{normalize-space($node/front/title)}">
1601            <xsl:if test="$xml2rfc-ext-include-references-in-index='yes'">
1602              <xsl:attribute name="id"><xsl:value-of select="$anchor"/></xsl:attribute>
1603            </xsl:if>
1604            <!-- insert id when a backlink to this xref is needed in the index -->
1605            <xsl:if test="//iref[@x:for-anchor=$target] | //iref[@x:for-anchor='' and ../@anchor=$target]">
1606              <xsl:attribute name="id"><xsl:value-of select="$anchor"/></xsl:attribute>
1607            </xsl:if>
1608            <xsl:apply-templates/>
1609          </cite>
1610        </xsl:when>
1611        <xsl:otherwise>
1612          <xsl:apply-templates/>
1613        </xsl:otherwise>
1614      </xsl:choose>
1615    </xsl:when>
1616 
1617    <!-- Other x:fmt values than "none": unsupported -->
1618    <xsl:when test="@x:fmt and @x:fmt!='none'">
1619      <xsl:call-template name="error">
1620        <xsl:with-param name="msg" select="concat('unknown xref/@x:fmt extension: ',@x:fmt)"/>
1621      </xsl:call-template>
1622    </xsl:when>
1623
1624    <!-- Section links -->
1625    <xsl:when test="name($node)='section' or name($node)='appendix'">
1626      <xsl:apply-templates/>
1627      <xsl:variable name="context" select="."/>
1628      <xsl:text> (</xsl:text>
1629      <a xmlns="http://www.w3.org/1999/xhtml" href="#{@target}">
1630        <!-- insert id when a backlink to this xref is needed in the index -->
1631        <xsl:if test="//iref[@x:for-anchor=$target] | //iref[@x:for-anchor='' and ../@anchor=$target]">
1632          <xsl:attribute name="id"><xsl:value-of select="$anchor"/></xsl:attribute>
1633        </xsl:if>
1634        <xsl:call-template name="render-section-ref">
1635          <xsl:with-param name="from" select="."/>
1636          <xsl:with-param name="to" select="$node"/>
1637        </xsl:call-template>
1638      </a>
1639      <xsl:text>)</xsl:text>
1640    </xsl:when>
1641
1642    <xsl:otherwise>
1643      <a xmlns="http://www.w3.org/1999/xhtml" href="#{$target}"><xsl:apply-templates/></a>
1644      <xsl:if test="not(@format='none')">
1645        <xsl:for-each select="$src/rfc/back/references//reference[@anchor=$target]">
1646          <xsl:text> </xsl:text>
1647          <cite xmlns="http://www.w3.org/1999/xhtml" title="{normalize-space(front/title)}">
1648            <xsl:if test="$xml2rfc-ext-include-references-in-index='yes'">
1649              <xsl:attribute name="id"><xsl:value-of select="$anchor"/></xsl:attribute>
1650            </xsl:if>
1651            <xsl:call-template name="referencename">
1652               <xsl:with-param name="node" select="."/>
1653            </xsl:call-template>
1654          </cite>
1655        </xsl:for-each>
1656      </xsl:if>
1657    </xsl:otherwise>
1658  </xsl:choose>
1659
1660</xsl:template>
1661               
1662<xsl:key name="iref-xanch" match="iref[@x:for-anchor]" use="@x:for-anchor"/>           
1663               
1664<xsl:template match="xref[not(node())]">
1665
1666  <xsl:variable name="context" select="."/>
1667  <xsl:variable name="target" select="@target"/>
1668  <xsl:variable name="anchor"><xsl:value-of select="$anchor-prefix"/>.xref.<xsl:value-of select="@target"/>.<xsl:number level="any" count="xref[@target=$target]"/></xsl:variable>
1669  <xsl:variable name="node" select="key('anchor-item',$target)"/>
1670  <xsl:if test="count($node)=0 and not(ancestor::ed:del)">
1671    <xsl:call-template name="error">
1672      <xsl:with-param name="msg" select="concat('Undefined target: ',@target)"/>
1673    </xsl:call-template>
1674  </xsl:if>
1675
1676  <xsl:choose>
1677 
1678    <!-- Section links -->
1679    <xsl:when test="name($node)='section' or name($node)='appendix'">
1680      <a xmlns="http://www.w3.org/1999/xhtml" href="#{@target}">
1681        <!-- insert id when a backlink to this xref is needed in the index -->
1682        <xsl:if test="key('iref-xanch',$target) | key('iref-xanch','')[../@anchor=$target]">
1683          <xsl:attribute name="id"><xsl:value-of select="$anchor"/></xsl:attribute>
1684        </xsl:if>
1685        <xsl:call-template name="render-section-ref">
1686          <xsl:with-param name="from" select="."/>
1687          <xsl:with-param name="to" select="$node"/>
1688        </xsl:call-template>
1689      </a>
1690    </xsl:when>
1691
1692    <!-- Figure links -->
1693    <xsl:when test="name($node)='figure'">
1694      <a xmlns="http://www.w3.org/1999/xhtml" href="#{$target}">
1695        <xsl:variable name="figcnt">
1696          <xsl:for-each select="$node">
1697            <xsl:number level="any" count="figure[(@title!='' or @anchor!='') and not(@suppress-title='true')]"/>
1698          </xsl:for-each>
1699        </xsl:variable>
1700        <xsl:choose>
1701          <xsl:when test="@format='counter'">
1702            <xsl:value-of select="$figcnt"/>
1703          </xsl:when>
1704          <xsl:when test="@format='title'">
1705            <xsl:value-of select="$node/@title"/>
1706          </xsl:when>
1707          <xsl:otherwise>
1708            <xsl:value-of select="normalize-space(concat('Figure ',$figcnt))"/>
1709          </xsl:otherwise>
1710        </xsl:choose>
1711      </a>
1712    </xsl:when>
1713   
1714    <!-- Table links -->
1715    <xsl:when test="name($node)='texttable'">
1716      <a xmlns="http://www.w3.org/1999/xhtml" href="#{$target}">
1717        <xsl:variable name="tabcnt">
1718          <xsl:for-each select="$node">
1719            <xsl:number level="any" count="texttable[(@title!='' or @anchor!='') and not(@suppress-title='true')]"/>
1720          </xsl:for-each>
1721        </xsl:variable>
1722        <xsl:choose>
1723          <xsl:when test="@format='counter'">
1724            <xsl:value-of select="$tabcnt"/>
1725          </xsl:when>
1726          <xsl:when test="@format='title'">
1727            <xsl:value-of select="$node/@title"/>
1728          </xsl:when>
1729          <xsl:otherwise>
1730            <xsl:value-of select="normalize-space(concat('Table ',$tabcnt))"/>
1731          </xsl:otherwise>
1732        </xsl:choose>
1733      </a>
1734    </xsl:when>
1735   
1736    <!-- Reference links -->
1737    <xsl:when test="name($node)='reference'">
1738
1739      <xsl:variable name="href">
1740        <xsl:call-template name="computed-target">
1741          <xsl:with-param name="bib" select="$node"/>
1742          <xsl:with-param name="ref" select="."/>
1743        </xsl:call-template>
1744      </xsl:variable>
1745     
1746      <xsl:variable name="sec">
1747        <xsl:choose>
1748          <xsl:when test="starts-with(@x:rel,'#') and not(@x:sec) and $node/x:source/@href">
1749            <xsl:variable name="extdoc" select="document($node/x:source/@href)"/>
1750            <xsl:variable name="nodes" select="$extdoc//*[@anchor=substring-after(current()/@x:rel,'#')]"/>
1751            <xsl:if test="not($nodes)">
1752              <xsl:call-template name="error">
1753                <xsl:with-param name="msg">Anchor '<xsl:value-of select="substring-after(current()/@x:rel,'#')"/>' not found in <xsl:value-of select="$node/x:source/@href"/>.</xsl:with-param>
1754              </xsl:call-template>
1755            </xsl:if>
1756            <xsl:for-each select="$nodes">
1757              <xsl:call-template name="get-section-number"/>
1758            </xsl:for-each>
1759          </xsl:when>
1760          <xsl:otherwise>
1761            <xsl:value-of select="@x:sec"/>
1762          </xsl:otherwise>
1763        </xsl:choose>
1764      </xsl:variable>
1765     
1766      <xsl:variable name="secterm">
1767        <xsl:choose>
1768          <!-- starts with letter? -->
1769          <xsl:when test="translate(substring($sec,1,1),$ucase,'')=''">Appendix</xsl:when>
1770          <xsl:otherwise>Section</xsl:otherwise>
1771        </xsl:choose>
1772      </xsl:variable>
1773
1774      <xsl:variable name="fmt">
1775        <xsl:choose>
1776          <xsl:when test="@x:fmt!=''"><xsl:value-of select="@x:fmt"/></xsl:when>
1777          <xsl:when test="ancestor::artwork">,</xsl:when>
1778          <xsl:otherwise>of</xsl:otherwise>
1779        </xsl:choose>
1780      </xsl:variable>
1781
1782      <xsl:variable name="title">
1783        <xsl:choose>
1784          <xsl:when test="starts-with(@x:rel,'#') and not(@x:sec) and $node/x:source/@href">
1785            <xsl:variable name="extdoc" select="document($node/x:source/@href)"/>
1786            <xsl:variable name="nodes" select="$extdoc//*[@anchor=substring-after(current()/@x:rel,'#')]"/>
1787            <xsl:if test="not($nodes)">
1788              <xsl:call-template name="error">
1789                <xsl:with-param name="msg">Anchor '<xsl:value-of select="substring-after(current()/@x:rel,'#')"/>' not found in <xsl:value-of select="$node/x:source/@href"/>.</xsl:with-param>
1790              </xsl:call-template>
1791            </xsl:if>
1792            <xsl:for-each select="$nodes">
1793              <xsl:value-of select="@title"/>
1794            </xsl:for-each>
1795          </xsl:when>
1796          <xsl:otherwise/>
1797        </xsl:choose>
1798      </xsl:variable>
1799
1800      <!--
1801      Formats:
1802     
1803        ()      [XXXX] (Section SS)
1804        ,       [XXXX], Section SS
1805        of      Section SS of [XXXX]
1806        sec     Section SS
1807        number  SS
1808      -->
1809     
1810      <xsl:if test="$fmt and not($fmt='()' or $fmt=',' or $fmt='of' or $fmt='sec' or $fmt='anchor' or $fmt='number')">
1811        <xsl:call-template name="error">
1812          <xsl:with-param name="msg" select="concat('unknown xref/@x:fmt extension: ',$fmt)"/>
1813        </xsl:call-template>
1814      </xsl:if>
1815
1816      <xsl:if test="$sec!=''">
1817             
1818        <xsl:choose>
1819          <xsl:when test="$fmt='of' or $fmt='sec'">
1820            <xsl:choose>
1821              <xsl:when test="$href!=''">
1822                <a xmlns="http://www.w3.org/1999/xhtml" href="{$href}">
1823                  <xsl:if test="$title!=''">
1824                    <xsl:attribute name="title"><xsl:value-of select="$title"/></xsl:attribute>
1825                  </xsl:if>
1826                  <xsl:if test="$fmt='sec' and $xml2rfc-ext-include-references-in-index='yes'">
1827                    <xsl:attribute name="id"><xsl:value-of select="$anchor"/></xsl:attribute>
1828                  </xsl:if>
1829                  <xsl:value-of select="$secterm"/>
1830                  <xsl:text> </xsl:text>
1831                  <xsl:value-of select="$sec"/>
1832                </a>
1833              </xsl:when>
1834              <xsl:otherwise><xsl:value-of select="$secterm"/><xsl:text> </xsl:text><xsl:value-of select="$sec"/></xsl:otherwise>
1835            </xsl:choose>
1836            <xsl:if test="$fmt='of'">
1837              <xsl:text> of </xsl:text>
1838            </xsl:if>
1839          </xsl:when>
1840          <xsl:when test="$fmt='number'">
1841            <xsl:choose>
1842              <xsl:when test="$href!=''">
1843                <a xmlns="http://www.w3.org/1999/xhtml" href="{$href}">
1844                  <xsl:if test="$title!=''">
1845                    <xsl:attribute name="title"><xsl:value-of select="$title"/></xsl:attribute>
1846                  </xsl:if>
1847                  <xsl:if test="$xml2rfc-ext-include-references-in-index='yes'">
1848                    <xsl:attribute name="id"><xsl:value-of select="$anchor"/></xsl:attribute>
1849                  </xsl:if>
1850                  <xsl:value-of select="$sec"/>
1851                </a>
1852              </xsl:when>
1853              <xsl:otherwise><xsl:value-of select="$sec"/></xsl:otherwise>
1854            </xsl:choose>
1855          </xsl:when>
1856          <xsl:otherwise/>
1857        </xsl:choose>
1858      </xsl:if>
1859
1860      <xsl:if test="$sec='' or ($fmt!='sec' and $fmt!='number')">
1861        <a xmlns="http://www.w3.org/1999/xhtml" href="#{$target}">
1862          <xsl:if test="$xml2rfc-ext-include-references-in-index='yes'">
1863            <xsl:attribute name="id"><xsl:value-of select="$anchor"/></xsl:attribute>
1864          </xsl:if>
1865          <cite title="{normalize-space($node/front/title)}">
1866            <xsl:variable name="val">
1867              <xsl:call-template name="referencename">
1868                <xsl:with-param name="node" select="$node"/>
1869              </xsl:call-template>
1870            </xsl:variable>
1871            <xsl:choose>
1872              <xsl:when test="$fmt='anchor'">
1873                <!-- remove brackets -->
1874                <xsl:value-of select="substring($val,2,string-length($val)-2)"/>
1875              </xsl:when>
1876              <xsl:otherwise>
1877                <xsl:value-of select="$val"/>
1878              </xsl:otherwise>
1879            </xsl:choose>
1880          </cite>
1881        </a>
1882      </xsl:if>
1883     
1884      <xsl:if test="$sec!=''">
1885        <xsl:choose>
1886          <xsl:when test="$fmt='()'">
1887            <xsl:text> (</xsl:text>
1888            <xsl:choose>
1889              <xsl:when test="$href!=''">
1890                <a xmlns="http://www.w3.org/1999/xhtml" href="{$href}"><xsl:value-of select="$secterm"/><xsl:text> </xsl:text><xsl:value-of select="$sec"/></a>
1891              </xsl:when>
1892              <xsl:otherwise><xsl:value-of select="$secterm"/><xsl:text> </xsl:text><xsl:value-of select="$sec"/></xsl:otherwise>
1893            </xsl:choose>
1894            <xsl:text>)</xsl:text>
1895          </xsl:when>
1896          <xsl:when test="$fmt=','">
1897            <xsl:text>, </xsl:text>
1898            <xsl:choose>
1899              <xsl:when test="$href!=''">
1900                <a xmlns="http://www.w3.org/1999/xhtml" href="{$href}">
1901                  <xsl:if test="$title!=''">
1902                    <xsl:attribute name="title"><xsl:value-of select="$title"/></xsl:attribute>
1903                  </xsl:if>
1904                  <xsl:value-of select="$secterm"/>
1905                  <xsl:text> </xsl:text>
1906                  <xsl:value-of select="$sec"/>
1907                </a>
1908              </xsl:when>
1909              <xsl:otherwise><xsl:value-of select="$secterm"/><xsl:text> </xsl:text><xsl:value-of select="$sec"/></xsl:otherwise>
1910            </xsl:choose>
1911          </xsl:when>
1912          <xsl:otherwise/>
1913        </xsl:choose>
1914      </xsl:if>
1915    </xsl:when>
1916   
1917    <xsl:otherwise>
1918      <xsl:call-template name="error">
1919        <xsl:with-param name="msg" select="concat('xref to unknown element: ',name($node))"/>
1920      </xsl:call-template>
1921    </xsl:otherwise>
1922  </xsl:choose>
1923</xsl:template>
1924
1925
1926<!-- mark unmatched elements red -->
1927
1928<xsl:template match="*">
1929  <xsl:message>ERROR: no XSLT template for element: &lt;<xsl:value-of select="name()"/>&gt;</xsl:message>   
1930  <tt xmlns="http://www.w3.org/1999/xhtml" class="error">&lt;<xsl:value-of select="name()"/>&gt;</tt>
1931  <xsl:copy><xsl:apply-templates select="node()|@*"/></xsl:copy>
1932  <tt xmlns="http://www.w3.org/1999/xhtml" class="error">&lt;/<xsl:value-of select="name()"/>&gt;</tt>
1933</xsl:template>
1934
1935<xsl:template match="/">
1936  <xsl:apply-templates select="*"/>
1937</xsl:template>
1938
1939<!-- utility templates -->
1940
1941<xsl:template name="collectLeftHeaderColumn">
1942  <xsl:param name="mode"/>
1943  <!-- default case -->
1944  <xsl:if test="not($xml2rfc-private)">
1945    <myns:item>Network Working Group</myns:item>
1946    <myns:item>
1947       <xsl:choose>
1948        <xsl:when test="/rfc/@ipr and not(/rfc/@number)">Internet Draft</xsl:when>
1949        <xsl:otherwise>Request for Comments: <xsl:value-of select="/rfc/@number"/></xsl:otherwise>
1950      </xsl:choose>
1951    </myns:item>
1952    <xsl:if test="/rfc/@docName and $mode!='nroff'">
1953      <myns:item>
1954        &lt;<xsl:value-of select="/rfc/@docName"/>&gt;
1955      </myns:item>
1956    </xsl:if>
1957    <xsl:if test="/rfc/@obsoletes and /rfc/@obsoletes!=''">
1958      <myns:item>
1959        <xsl:text>Obsoletes: </xsl:text>
1960        <xsl:call-template name="rfclist">
1961          <xsl:with-param name="list" select="normalize-space(/rfc/@obsoletes)"/>
1962        </xsl:call-template>
1963        <xsl:if test="not(/rfc/@number)"> (if approved)</xsl:if>
1964      </myns:item>
1965    </xsl:if>
1966    <xsl:if test="/rfc/@seriesNo">
1967       <myns:item>
1968        <xsl:choose>
1969          <xsl:when test="/rfc/@category='bcp'">BCP: <xsl:value-of select="/rfc/@seriesNo"/></xsl:when>
1970          <xsl:when test="/rfc/@category='info'">FYI: <xsl:value-of select="/rfc/@seriesNo"/></xsl:when>
1971          <xsl:when test="/rfc/@category='std'">STD: <xsl:value-of select="/rfc/@seriesNo"/></xsl:when>
1972          <xsl:otherwise><xsl:value-of select="concat(/rfc/@category,': ',/rfc/@seriesNo)"/></xsl:otherwise>
1973        </xsl:choose>
1974      </myns:item>
1975    </xsl:if>
1976    <xsl:if test="/rfc/@updates and /rfc/@updates!=''">
1977      <myns:item>
1978        <xsl:text>Updates: </xsl:text>
1979          <xsl:call-template name="rfclist">
1980             <xsl:with-param name="list" select="normalize-space(/rfc/@updates)"/>
1981          </xsl:call-template>
1982          <xsl:if test="not(/rfc/@number)"> (if approved)</xsl:if>
1983      </myns:item>
1984    </xsl:if>
1985    <xsl:if test="$mode!='nroff'">
1986      <myns:item>
1987        <xsl:choose>
1988          <xsl:when test="/rfc/@number">
1989            <xsl:text>Category: </xsl:text>
1990          </xsl:when>
1991          <xsl:otherwise>
1992            <xsl:text>Intended status: </xsl:text>
1993          </xsl:otherwise>
1994        </xsl:choose>
1995        <xsl:call-template name="get-category-long"/>
1996      </myns:item>
1997    </xsl:if>
1998    <xsl:if test="/rfc/@ipr and not(/rfc/@number)">
1999       <myns:item>Expires: <xsl:call-template name="expirydate"/></myns:item>
2000    </xsl:if>
2001  </xsl:if>
2002   
2003  <!-- private case -->
2004  <xsl:if test="$xml2rfc-private">
2005    <myns:item><xsl:value-of select="$xml2rfc-private"/></myns:item>
2006  </xsl:if>
2007</xsl:template>
2008
2009<xsl:template name="collectRightHeaderColumn">
2010  <xsl:for-each select="author">
2011    <xsl:variable name="initials">
2012      <xsl:call-template name="format-initials"/>
2013    </xsl:variable>
2014    <xsl:if test="@surname">
2015      <myns:item>
2016        <xsl:value-of select="concat($initials,' ',@surname)"/>
2017        <xsl:if test="@role">
2018          <xsl:choose>
2019            <xsl:when test="@role='editor'">
2020              <xsl:text>, Editor</xsl:text>
2021            </xsl:when>
2022            <xsl:otherwise>
2023              <xsl:text>, </xsl:text><xsl:value-of select="@role"/>
2024            </xsl:otherwise>
2025          </xsl:choose>
2026        </xsl:if>
2027      </myns:item>
2028    </xsl:if>
2029    <xsl:variable name="org">
2030      <xsl:choose>
2031        <xsl:when test="organization/@abbrev"><xsl:value-of select="organization/@abbrev"/></xsl:when>
2032        <xsl:otherwise><xsl:value-of select="organization"/></xsl:otherwise>
2033      </xsl:choose>
2034    </xsl:variable>
2035    <xsl:variable name="orgOfFollowing">
2036      <xsl:choose>
2037        <xsl:when test="following-sibling::*[1]/organization/@abbrev"><xsl:value-of select="following-sibling::*[1]/organization/@abbrev"/></xsl:when>
2038        <xsl:otherwise><xsl:value-of select="following-sibling::*/organization"/></xsl:otherwise>
2039      </xsl:choose>
2040    </xsl:variable>
2041    <xsl:if test="$org != $orgOfFollowing and $org != ''">
2042      <myns:item><xsl:value-of select="$org"/></myns:item>
2043    </xsl:if>
2044  </xsl:for-each>
2045  <myns:item>
2046    <xsl:if test="$xml2rfc-ext-pub-month!=''">
2047      <xsl:value-of select="$xml2rfc-ext-pub-month"/>
2048      <xsl:if test="$xml2rfc-ext-pub-day!='' and /rfc/@ipr and not(/rfc/@number)">
2049        <xsl:text> </xsl:text>
2050        <xsl:value-of select="$xml2rfc-ext-pub-day"/>
2051        <xsl:text>,</xsl:text>
2052      </xsl:if>
2053    </xsl:if>
2054    <xsl:value-of select="concat(' ',$xml2rfc-ext-pub-year)"/>
2055  </myns:item>
2056</xsl:template>
2057
2058
2059<xsl:template name="emitheader">
2060  <xsl:param name="lc"/>
2061  <xsl:param name="rc"/>
2062
2063  <xsl:for-each select="$lc/myns:item | $rc/myns:item">
2064    <xsl:variable name="pos" select="position()"/>
2065    <xsl:if test="$pos &lt; count($lc/myns:item) + 1 or $pos &lt; count($rc/myns:item) + 1"> 
2066      <tr xmlns="http://www.w3.org/1999/xhtml">
2067        <td class="header left"><xsl:call-template name="copynodes"><xsl:with-param name="nodes" select="$lc/myns:item[$pos]/node()"/></xsl:call-template></td>
2068        <td class="header right"><xsl:call-template name="copynodes"><xsl:with-param name="nodes" select="$rc/myns:item[$pos]/node()"/></xsl:call-template></td>
2069      </tr>
2070    </xsl:if>
2071  </xsl:for-each>
2072</xsl:template>
2073
2074<!-- convenience template that avoids copying namespace nodes we don't want -->
2075<xsl:template name="copynodes">
2076  <xsl:param name="nodes"/>
2077  <xsl:for-each select="$nodes">
2078    <xsl:choose>
2079      <xsl:when test="namespace-uri()='http://www.w3.org/1999/xhtml'">
2080        <xsl:element namespace="{namespace-uri()}" name="{name()}">
2081          <xsl:copy-of select="@*|node()"/>
2082        </xsl:element>
2083      </xsl:when>
2084      <xsl:when test="self::*">
2085        <xsl:element namespace="http://www.w3.org/1999/xhtml" name="{name()}">
2086          <xsl:copy-of select="@*|node()"/>
2087        </xsl:element>
2088      </xsl:when>
2089      <!-- workaround for opera, remove when Opera > 9.0.x comes out -->
2090      <xsl:when test="self::text()">
2091        <xsl:value-of select="."/>
2092      </xsl:when>
2093      <xsl:otherwise>
2094        <xsl:copy-of select="."/>
2095      </xsl:otherwise>
2096    </xsl:choose>
2097  </xsl:for-each>
2098</xsl:template>
2099
2100
2101<xsl:template name="expirydate">
2102  <xsl:choose>
2103    <xsl:when test="$xml2rfc-ext-pub-month='January'">July <xsl:value-of select="$xml2rfc-ext-pub-year"/></xsl:when>
2104    <xsl:when test="$xml2rfc-ext-pub-month='February'">August <xsl:value-of select="$xml2rfc-ext-pub-year"/></xsl:when>
2105    <xsl:when test="$xml2rfc-ext-pub-month='March'">September <xsl:value-of select="$xml2rfc-ext-pub-year"/></xsl:when>
2106    <xsl:when test="$xml2rfc-ext-pub-month='April'">October <xsl:value-of select="$xml2rfc-ext-pub-year"/></xsl:when>
2107    <xsl:when test="$xml2rfc-ext-pub-month='May'">November <xsl:value-of select="$xml2rfc-ext-pub-year"/></xsl:when>
2108    <xsl:when test="$xml2rfc-ext-pub-month='June'">December <xsl:value-of select="$xml2rfc-ext-pub-year"/></xsl:when>
2109    <xsl:when test="$xml2rfc-ext-pub-month='July'">January <xsl:value-of select="$xml2rfc-ext-pub-year + 1"/></xsl:when>
2110    <xsl:when test="$xml2rfc-ext-pub-month='August'">February <xsl:value-of select="$xml2rfc-ext-pub-year + 1"/></xsl:when>
2111    <xsl:when test="$xml2rfc-ext-pub-month='September'">March <xsl:value-of select="$xml2rfc-ext-pub-year + 1"/></xsl:when>
2112    <xsl:when test="$xml2rfc-ext-pub-month='October'">April <xsl:value-of select="$xml2rfc-ext-pub-year + 1"/></xsl:when>
2113    <xsl:when test="$xml2rfc-ext-pub-month='November'">May <xsl:value-of select="$xml2rfc-ext-pub-year + 1"/></xsl:when>
2114    <xsl:when test="$xml2rfc-ext-pub-month='December'">June <xsl:value-of select="$xml2rfc-ext-pub-year + 1"/></xsl:when>
2115      <xsl:otherwise>WRONG SYNTAX FOR MONTH</xsl:otherwise>
2116   </xsl:choose>
2117</xsl:template>
2118
2119<xsl:template name="get-month-as-num">
2120  <xsl:param name="month"/>
2121  <xsl:choose>
2122    <xsl:when test="$month='January'">01</xsl:when>
2123    <xsl:when test="$month='February'">02</xsl:when>
2124    <xsl:when test="$month='March'">03</xsl:when>
2125    <xsl:when test="$month='April'">04</xsl:when>
2126    <xsl:when test="$month='May'">05</xsl:when>
2127    <xsl:when test="$month='June'">06</xsl:when>
2128    <xsl:when test="$month='July'">07</xsl:when>
2129    <xsl:when test="$month='August'">08</xsl:when>
2130    <xsl:when test="$month='September'">09</xsl:when>
2131    <xsl:when test="$month='October'">10</xsl:when>
2132    <xsl:when test="$month='November'">11</xsl:when>
2133    <xsl:when test="$month='December'">12</xsl:when>
2134    <xsl:otherwise>WRONG SYNTAX FOR MONTH</xsl:otherwise>
2135  </xsl:choose>
2136</xsl:template>
2137
2138<xsl:template name="get-month-as-name">
2139  <xsl:param name="month"/>
2140  <xsl:choose>
2141    <xsl:when test="$month=1">January</xsl:when>
2142    <xsl:when test="$month=2">February</xsl:when>
2143    <xsl:when test="$month=3">March</xsl:when>
2144    <xsl:when test="$month=4">April</xsl:when>
2145    <xsl:when test="$month=5">May</xsl:when>
2146    <xsl:when test="$month=6">June</xsl:when>
2147    <xsl:when test="$month=7">July</xsl:when>
2148    <xsl:when test="$month=8">August</xsl:when>
2149    <xsl:when test="$month=9">September</xsl:when>
2150    <xsl:when test="$month=10">October</xsl:when>
2151    <xsl:when test="$month=11">November</xsl:when>
2152    <xsl:when test="$month=12">December</xsl:when>
2153    <xsl:otherwise>WRONG SYNTAX FOR MONTH</xsl:otherwise>
2154   </xsl:choose>
2155</xsl:template>
2156
2157<!-- produce back section with author information -->
2158<xsl:template name="get-authors-section-title">
2159  <xsl:choose>
2160    <xsl:when test="count(/rfc/front/author)=1">Author's Address</xsl:when>
2161    <xsl:otherwise>Authors' Addresses</xsl:otherwise>
2162  </xsl:choose>
2163</xsl:template>
2164
2165<xsl:template name="get-authors-section-number">
2166  <xsl:if test="/*/x:assign-section-number[@builtin-target='authors']">
2167    <xsl:value-of select="/*/x:assign-section-number[@builtin-target='authors']/@number"/>
2168  </xsl:if>
2169</xsl:template>
2170
2171<xsl:template name="insertAuthors">
2172
2173  <xsl:variable name="number">
2174    <xsl:call-template name="get-authors-section-number"/>
2175  </xsl:variable>
2176   
2177  <xsl:if test="$number!='suppress'">
2178    <xsl:call-template name="insert-conditional-hrule"/>
2179   
2180    <h1 xmlns="http://www.w3.org/1999/xhtml" id="{$anchor-prefix}.authors">
2181      <xsl:call-template name="insert-conditional-pagebreak"/>
2182      <xsl:if test="$number != ''">
2183        <a href="#{$anchor-prefix}.section.{$number}" id="{$anchor-prefix}.section.{$number}"><xsl:value-of select="$number"/>.</a>
2184        <xsl:text> </xsl:text>
2185      </xsl:if>
2186      <a href="#{$anchor-prefix}.authors"><xsl:call-template name="get-authors-section-title"/></a>
2187    </h1>
2188 
2189    <xsl:apply-templates select="/rfc/front/author"/>
2190  </xsl:if>
2191</xsl:template>
2192
2193
2194
2195<!-- insert copyright statement -->
2196
2197<xsl:template name="insertCopyright" myns:namespaceless-elements="xml2rfc">
2198
2199  <xsl:choose>
2200    <xsl:when test="$ipr-rfc3667">
2201      <section title="Full Copyright Statement" anchor="{$anchor-prefix}.copyright" myns:unnumbered="unnumbered" myns:notoclink="notoclink">
2202        <t>
2203          <xsl:choose>
2204            <xsl:when test="$ipr-2007-08"/>
2205            <xsl:when test="$ipr-rfc4748">
2206              Copyright © The IETF Trust (<xsl:value-of select="$xml2rfc-ext-pub-year"/>).
2207            </xsl:when>
2208            <xsl:otherwise>
2209              Copyright © The Internet Society (<xsl:value-of select="$xml2rfc-ext-pub-year"/>).
2210            </xsl:otherwise>
2211          </xsl:choose>
2212        </t>
2213        <t>
2214          This document is subject to the rights, licenses and restrictions
2215          contained in BCP 78<xsl:if test="/rfc/@submissionType='independent'"> and at <eref target="http://www.rfc-editor.org/copyright.html"/></xsl:if>, and except as set forth therein, the authors
2216          retain all their rights.
2217        </t>
2218        <t>
2219          <xsl:choose>
2220            <xsl:when test="$ipr-rfc4748">
2221              This document and the information contained herein are provided
2222              on an &#8220;AS IS&#8221; basis and THE CONTRIBUTOR,
2223              THE ORGANIZATION HE/SHE REPRESENTS OR IS SPONSORED BY (IF ANY),
2224              THE INTERNET SOCIETY, THE IETF TRUST AND THE INTERNET ENGINEERING
2225              TASK FORCE DISCLAIM ALL WARRANTIES,
2226              EXPRESS OR IMPLIED,
2227              INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE
2228              INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
2229              WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
2230            </xsl:when>
2231            <xsl:otherwise>
2232              This document and the information contained herein are provided
2233              on an &#8220;AS IS&#8221; basis and THE CONTRIBUTOR,
2234              THE ORGANIZATION HE/SHE REPRESENTS OR IS SPONSORED BY (IF ANY),
2235              THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIM
2236              ALL WARRANTIES,
2237              EXPRESS OR IMPLIED,
2238              INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE
2239              INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
2240              WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
2241            </xsl:otherwise>
2242          </xsl:choose>
2243        </t>
2244      </section>   
2245    </xsl:when>
2246    <xsl:otherwise>
2247      <!-- <http://tools.ietf.org/html/rfc2026#section-10.4> -->
2248      <section title="Full Copyright Statement" anchor="{$anchor-prefix}.copyright" myns:unnumbered="unnumbered" myns:notoclink="notoclink">
2249        <t>
2250          Copyright © The Internet Society (<xsl:value-of select="$xml2rfc-ext-pub-year"/>). All Rights Reserved.
2251        </t>
2252        <t>
2253          This document and translations of it may be copied and furnished to
2254          others, and derivative works that comment on or otherwise explain it
2255          or assist in its implementation may be prepared, copied, published and
2256          distributed, in whole or in part, without restriction of any kind,
2257          provided that the above copyright notice and this paragraph are
2258          included on all such copies and derivative works. However, this
2259          document itself may not be modified in any way, such as by removing
2260          the copyright notice or references to the Internet Society or other
2261          Internet organizations, except as needed for the purpose of
2262          developing Internet standards in which case the procedures for
2263          copyrights defined in the Internet Standards process must be
2264          followed, or as required to translate it into languages other than
2265          English.
2266        </t>
2267        <t>
2268          The limited permissions granted above are perpetual and will not be
2269          revoked by the Internet Society or its successors or assignees.
2270        </t>
2271        <t>
2272          This document and the information contained herein is provided on an
2273          &#8220;AS IS&#8221; basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
2274          TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
2275          BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
2276          HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
2277          MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
2278        </t>
2279      </section>
2280    </xsl:otherwise>
2281  </xsl:choose>
2282
2283  <section title="Intellectual Property" anchor="{$anchor-prefix}.ipr" myns:unnumbered="unnumbered">
2284    <xsl:choose>
2285      <xsl:when test="$ipr-rfc3667">
2286        <t>
2287          The IETF takes no position regarding the validity or scope of any
2288          Intellectual Property Rights or other rights that might be claimed to
2289          pertain to the implementation or use of the technology described in
2290          this document or the extent to which any license under such rights
2291          might or might not be available; nor does it represent that it has
2292          made any independent effort to identify any such rights.  Information
2293          on the procedures with respect to rights in RFC documents
2294          can be found in BCP 78 and BCP 79.
2295        </t>       
2296        <t>
2297          Copies of IPR disclosures made to the IETF Secretariat and any
2298          assurances of licenses to be made available, or the result of an
2299          attempt made to obtain a general license or permission for the use
2300          of such proprietary rights by implementers or users of this
2301          specification can be obtained from the IETF on-line IPR repository
2302          at <eref target="http://www.ietf.org/ipr"/>.
2303        </t>       
2304        <t>
2305          The IETF invites any interested party to bring to its attention any
2306          copyrights, patents or patent applications, or other proprietary
2307          rights that may cover technology that may be required to implement
2308          this standard. Please address the information to the IETF at
2309          <eref target="mailto:ietf-ipr@ietf.org">ietf-ipr@ietf.org</eref>.
2310        </t>       
2311      </xsl:when>
2312      <xsl:otherwise>
2313        <t>
2314          The IETF takes no position regarding the validity or scope of
2315          any intellectual property or other rights that might be claimed
2316          to  pertain to the implementation or use of the technology
2317          described in this document or the extent to which any license
2318          under such rights might or might not be available; neither does
2319          it represent that it has made any effort to identify any such
2320          rights. Information on the IETF's procedures with respect to
2321          rights in standards-track and standards-related documentation
2322          can be found in BCP-11. Copies of claims of rights made
2323          available for publication and any assurances of licenses to
2324          be made available, or the result of an attempt made
2325          to obtain a general license or permission for the use of such
2326          proprietary rights by implementors or users of this
2327          specification can be obtained from the IETF Secretariat.
2328        </t>
2329        <t>
2330          The IETF invites any interested party to bring to its
2331          attention any copyrights, patents or patent applications, or
2332          other proprietary rights which may cover technology that may be
2333          required to practice this standard. Please address the
2334          information to the IETF Executive Director.
2335        </t>
2336        <xsl:if test="$xml2rfc-iprnotified='yes'">
2337          <t>
2338            The IETF has been notified of intellectual property rights
2339            claimed in regard to some or all of the specification contained
2340            in this document. For more information consult the online list
2341            of claimed rights.
2342          </t>
2343        </xsl:if>
2344      </xsl:otherwise>
2345    </xsl:choose>
2346  </section>
2347 
2348  <xsl:choose>
2349    <xsl:when test="$funding2"/>
2350    <xsl:when test="$funding1 and /rfc/@number">
2351      <section title="Acknowledgement" myns:unnumbered="unnumbered" myns:notoclink="notoclink">
2352        <t>
2353          Funding for the RFC Editor function is provided by the IETF
2354          Administrative Support Activity (IASA).
2355        </t>
2356      </section>
2357    </xsl:when>
2358    <xsl:when test="$funding0 and /rfc/@number">
2359      <section title="Acknowledgement" myns:unnumbered="unnumbered" myns:notoclink="notoclink">
2360        <t>
2361          Funding for the RFC Editor function is currently provided by
2362          the Internet Society.
2363        </t>
2364      </section>
2365    </xsl:when>
2366    <xsl:otherwise/>
2367  </xsl:choose>
2368
2369</xsl:template>
2370
2371
2372<!-- insert CSS style info -->
2373
2374<xsl:template name="insertCss">
2375a {
2376  text-decoration: none;
2377}
2378a.smpl {
2379  color: black;
2380}
2381a:hover {
2382  text-decoration: underline;
2383}
2384a:active {
2385  text-decoration: underline;
2386}
2387address {
2388  margin-top: 1em;
2389  margin-left: 2em;
2390  font-style: normal;
2391}<xsl:if test="//x:blockquote">
2392blockquote {
2393  border-style: solid;
2394  border-color: gray;
2395  border-width: 0 0 0 .25em;
2396  font-style: italic;
2397  padding-left: 0.5em;
2398}</xsl:if>
2399body {<xsl:if test="$xml2rfc-background!=''">
2400  background: url(<xsl:value-of select="$xml2rfc-background"/>) #ffffff left top;</xsl:if>
2401  color: black;
2402  font-family: verdana, helvetica, arial, sans-serif;
2403  font-size: 10pt;
2404}<xsl:if test="//xhtml:p">
2405br.p {
2406  line-height: 150%;
2407}</xsl:if>
2408cite {
2409  font-style: normal;
2410}<xsl:if test="//x:note">
2411div.note {
2412  margin-left: 2em;
2413}</xsl:if>
2414dd {
2415  margin-right: 2em;<xsl:if test="$xml2rfc-ext-justification='always'">
2416  text-align: justify;</xsl:if>
2417}
2418dl {
2419  margin-left: 2em;
2420}
2421<!-- spacing between two entries in definition lists -->
2422dl.empty dd {
2423  margin-top: .5em;
2424}
2425dl p {
2426  margin-left: 0em;
2427}
2428dt {
2429  margin-top: .5em;
2430}
2431h1 {
2432  font-size: 14pt;
2433  line-height: 21pt;
2434  page-break-after: avoid;
2435}
2436h1.np {
2437  page-break-before: always;
2438}
2439h1 a {
2440  color: #333333;
2441}
2442h2 {
2443  font-size: 12pt;
2444  line-height: 15pt;
2445  page-break-after: avoid;
2446}
2447h2 a {
2448  color: black;
2449}
2450h3 {
2451  font-size: 10pt;
2452  page-break-after: avoid;
2453}
2454h3 a {
2455  color: black;
2456}
2457h4 {
2458  font-size: 10pt;
2459  page-break-after: avoid;
2460}
2461h4 a {
2462  color: black;
2463}
2464h5 {
2465  font-size: 10pt;
2466  page-break-after: avoid;
2467}
2468h5 a {
2469  color: black;
2470}
2471img {
2472  margin-left: 3em;
2473}
2474li {
2475  margin-left: 2em;
2476  margin-right: 2em;<xsl:if test="$xml2rfc-ext-justification='always'">
2477  text-align: justify;</xsl:if>
2478}
2479ol {
2480  margin-left: 2em;
2481  margin-right: 2em;
2482}
2483ol p {
2484  margin-left: 0em;
2485}<xsl:if test="//xhtml:q">
2486q {
2487  font-style: italic;
2488}</xsl:if>
2489p {
2490  margin-left: 2em;
2491  margin-right: 2em;<xsl:if test="$xml2rfc-ext-justification='always'">
2492  text-align: justify;</xsl:if>
2493}
2494pre {
2495  margin-left: 3em;
2496  background-color: lightyellow;
2497  padding: .25em;
2498}
2499pre.text2 {
2500  border-style: dotted;
2501  border-width: 1px;
2502  background-color: #f0f0f0;
2503  width: 69em;
2504}
2505pre.inline {
2506  background-color: white;
2507  padding: 0em;
2508}
2509pre.text {
2510  border-style: dotted;
2511  border-width: 1px;
2512  background-color: #f8f8f8;
2513  width: 69em;
2514}
2515pre.drawing {
2516  border-style: solid;
2517  border-width: 1px;
2518  background-color: #f8f8f8;
2519  padding: 2em;
2520}<xsl:if test="//x:q">
2521q {
2522  font-style: italic;
2523}</xsl:if>
2524<xsl:if test="//x:sup">
2525sup {
2526  font-size: 60%;
2527}</xsl:if>
2528table {
2529  margin-left: 2em;
2530}<xsl:if test="//texttable">
2531table.tt {
2532  vertical-align: top;
2533}
2534table.full {
2535  border-style: outset;
2536  border-width: 1px;
2537}
2538table.headers {
2539  border-style: outset;
2540  border-width: 1px;
2541}
2542table.tt td {
2543  vertical-align: top;
2544}
2545table.full td {
2546  border-style: inset;
2547  border-width: 1px;
2548}
2549table.tt th {
2550  vertical-align: top;
2551}
2552table.full th {
2553  border-style: inset;
2554  border-width: 1px;
2555}
2556table.headers th {
2557  border-style: none none inset none;
2558  border-width: 1px;
2559}</xsl:if>
2560table.header {
2561  width: 95%;
2562  font-size: 10pt;
2563  color: white;
2564}
2565td.top {
2566  vertical-align: top;
2567}
2568td.topnowrap {
2569  vertical-align: top;
2570  white-space: nowrap;
2571}
2572td.header {
2573  background-color: gray;
2574  width: 50%;
2575}<xsl:if test="/rfc/@obsoletes | /rfc/@updates">
2576td.header a {
2577  color: white;
2578}</xsl:if>
2579td.reference {
2580  vertical-align: top;
2581  white-space: nowrap;
2582  padding-right: 1em;
2583}
2584thead {
2585  display:table-header-group;
2586}
2587ul.toc {
2588  list-style: none;
2589  margin-left: 1.5em;
2590  margin-right: 0em;
2591  padding-left: 0em;
2592}
2593li.tocline0 {
2594  line-height: 150%;
2595  font-weight: bold;
2596  font-size: 10pt;
2597  margin-left: 0em;
2598  margin-right: 0em;
2599}
2600li.tocline1 {
2601  line-height: normal;
2602  font-weight: normal;
2603  font-size: 9pt;
2604  margin-left: 0em;
2605  margin-right: 0em;
2606}
2607li.tocline2 {
2608  font-size: 0pt;
2609}
2610ul p {
2611  margin-left: 0em;
2612}
2613ul.ind {
2614  list-style: none;
2615  margin-left: 1.5em;
2616  margin-right: 0em;
2617  padding-left: 0em;
2618}
2619li.indline0 {
2620  font-weight: bold;
2621  line-height: 200%;
2622  margin-left: 0em;
2623  margin-right: 0em;
2624}
2625li.indline1 {
2626  font-weight: normal;
2627  line-height: 150%;
2628  margin-left: 0em;
2629  margin-right: 0em;
2630}
2631<xsl:if test="//x:bcp14">.bcp14 {
2632  font-style: normal;
2633  text-transform: lowercase;
2634  font-variant: small-caps;
2635}</xsl:if><xsl:if test="//x:blockquote">
2636blockquote &gt; * .bcp14 {
2637  font-style: italic;
2638}</xsl:if>
2639.comment {
2640  background-color: yellow;
2641}<xsl:if test="$xml2rfc-editing='yes'">
2642.editingmark {
2643  background-color: khaki;
2644}</xsl:if>
2645.center {
2646  text-align: center;
2647}
2648.error {
2649  color: red;
2650  font-style: italic;
2651  font-weight: bold;
2652}
2653.figure {
2654  font-weight: bold;
2655  text-align: center;
2656  font-size: 9pt;
2657}
2658.filename {
2659  color: #333333;
2660  font-weight: bold;
2661  font-size: 12pt;
2662  line-height: 21pt;
2663  text-align: center;
2664}
2665.fn {
2666  font-weight: bold;
2667}
2668.hidden {
2669  display: none;
2670}
2671.left {
2672  text-align: left;
2673}
2674.right {
2675  text-align: right;
2676}
2677.title {
2678  color: #990000;
2679  font-size: 18pt;
2680  line-height: 18pt;
2681  font-weight: bold;
2682  text-align: center;
2683  margin-top: 36pt;
2684}
2685.vcardline {
2686  display: block;
2687}
2688.warning {
2689  font-size: 14pt;
2690  background-color: yellow;
2691}
2692<xsl:if test="$has-edits">del {
2693  color: red;
2694  text-decoration: line-through;
2695}
2696.del {
2697  color: red;
2698  text-decoration: line-through;
2699}
2700ins {
2701  color: green;
2702  text-decoration: underline;
2703}
2704.ins {
2705  color: green;
2706  text-decoration: underline;
2707}
2708div.issuepointer {
2709  float: left;
2710}</xsl:if><xsl:if test="//ed:issue">
2711table.openissue {
2712  background-color: khaki;
2713  border-width: thin;
2714  border-style: solid;
2715  border-color: black;
2716}
2717table.closedissue {
2718  background-color: white;
2719  border-width: thin;
2720  border-style: solid;
2721  border-color: gray;
2722  color: gray;
2723}
2724thead th {
2725  text-align: left;
2726}
2727.bg-issue {
2728  border: solid;
2729  border-width: 1px;
2730  font-size: 7pt;
2731}
2732.closed-issue {
2733  border: solid;
2734  border-width: thin;
2735  background-color: lime;
2736  font-size: smaller;
2737  font-weight: bold;
2738}
2739.open-issue {
2740  border: solid;
2741  border-width: thin;
2742  background-color: red;
2743  font-size: smaller;
2744  font-weight: bold;
2745}
2746.editor-issue {
2747  border: solid;
2748  border-width: thin;
2749  background-color: yellow;
2750  font-size: smaller;
2751  font-weight: bold;
2752}</xsl:if>
2753
2754@media print {
2755  .noprint {
2756    display: none;
2757  }
2758 
2759  a {
2760    color: black;
2761    text-decoration: none;
2762  }
2763
2764  table.header {
2765    width: 90%;
2766  }
2767
2768  td.header {
2769    width: 50%;
2770    color: black;
2771    background-color: white;
2772    vertical-align: top;
2773    font-size: 12pt;
2774  }
2775
2776  ul.toc a::after {
2777    content: leader('.') target-counter(attr(href), page);
2778  }
2779 
2780  a.iref {
2781    content: target-counter(attr(href), page);
2782  }
2783 
2784  .print2col {
2785    column-count: 2;
2786    -moz-column-count: 2;<!-- for Firefox -->
2787    column-fill: auto;<!-- for PrinceXML -->
2788  }
2789<xsl:if test="$xml2rfc-ext-justification='print'">
2790  dd {
2791    text-align: justify;
2792  }
2793  li {
2794    text-align: justify;
2795  }
2796  p {
2797    text-align: justify;
2798  }
2799</xsl:if>}
2800
2801@page {
2802  @top-left {
2803       content: "<xsl:call-template name="get-header-left"/>";
2804  }
2805  @top-right {
2806       content: "<xsl:call-template name="get-header-right"/>";
2807  }
2808  @top-center {
2809       content: "<xsl:call-template name="get-header-center"/>";
2810  }
2811  @bottom-left {
2812       content: "<xsl:call-template name="get-author-summary"/>";
2813  }
2814  @bottom-center {
2815       content: "<xsl:call-template name="get-category-long"/>";
2816  }
2817  @bottom-right {
2818       content: "[Page " counter(page) "]";
2819  }
2820}
2821
2822@page:first {
2823    @top-left {
2824      content: normal;
2825    }
2826    @top-right {
2827      content: normal;
2828    }
2829    @top-center {
2830      content: normal;
2831    }
2832}
2833</xsl:template>
2834
2835
2836<!-- generate the index section -->
2837
2838<xsl:template name="insertSingleIref">
2839  <xsl:choose>
2840    <xsl:when test="@ed:xref">
2841      <!-- special index generator mode -->
2842      <xsl:text>[</xsl:text>
2843      <a xmlns="http://www.w3.org/1999/xhtml" href="#{@ed:xref}"><xsl:value-of select="@ed:xref"/></a>
2844      <xsl:text>, </xsl:text>
2845      <a xmlns="http://www.w3.org/1999/xhtml">
2846        <xsl:variable name="htmluri" select="//reference[@anchor=current()/@ed:xref]/format[@type='HTML']/@target"/>
2847        <xsl:if test="$htmluri">
2848          <xsl:attribute name="href"><xsl:value-of select="concat($htmluri,'#',@ed:frag)"/></xsl:attribute>
2849        </xsl:if>       
2850        <xsl:choose>
2851          <xsl:when test="@primary='true'"><b><xsl:value-of select="@ed:label"/></b></xsl:when>
2852          <xsl:otherwise><xsl:value-of select="@ed:label"/></xsl:otherwise>
2853        </xsl:choose>
2854      </a>
2855      <xsl:text>]</xsl:text>
2856      <xsl:if test="position()!=last()">, </xsl:if>
2857    </xsl:when>
2858    <xsl:otherwise>
2859      <xsl:variable name="_n">
2860        <xsl:call-template name="get-section-number"/>
2861      </xsl:variable>
2862      <xsl:variable name="n">
2863        <xsl:choose>
2864          <xsl:when test="$_n!=''">
2865            <xsl:value-of select="$_n"/>
2866          </xsl:when>
2867          <xsl:otherwise>§</xsl:otherwise>
2868        </xsl:choose>
2869      </xsl:variable>
2870      <xsl:variable name="backlink">
2871        <xsl:choose>
2872          <xsl:when test="self::xref">
2873            <xsl:variable name="target" select="@target"/>
2874            <xsl:text>#</xsl:text>
2875            <xsl:value-of select="$anchor-prefix"/>
2876            <xsl:text>.xref.</xsl:text>
2877            <xsl:value-of select="@target"/>.<xsl:number level="any" count="xref[@target=$target]"/>
2878          </xsl:when>
2879          <xsl:when test="self::iref">
2880            <xsl:text>#</xsl:text>
2881            <xsl:call-template name="compute-iref-anchor"/>
2882          </xsl:when>
2883          <xsl:when test="self::x:ref">
2884            <xsl:text>#</xsl:text>
2885            <xsl:call-template name="compute-extref-anchor"/>
2886          </xsl:when>
2887          <xsl:otherwise>
2888            <xsl:message>Unsupported element type for insertSingleIref</xsl:message>
2889          </xsl:otherwise>
2890        </xsl:choose>
2891      </xsl:variable>
2892      <a xmlns="http://www.w3.org/1999/xhtml" class="iref" href="{$backlink}">
2893        <xsl:call-template name="insertInsDelClass"/>
2894        <xsl:choose>
2895          <xsl:when test="@primary='true'"><b><xsl:value-of select="$n"/></b></xsl:when>
2896          <xsl:otherwise><xsl:value-of select="$n"/></xsl:otherwise>
2897        </xsl:choose>
2898      </a>
2899      <xsl:if test="position()!=last()">, </xsl:if>
2900    </xsl:otherwise>
2901  </xsl:choose>
2902</xsl:template>
2903
2904<xsl:template name="insertSingleXref">
2905  <xsl:variable name="_n">
2906    <xsl:call-template name="get-section-number"/>
2907  </xsl:variable>
2908  <xsl:variable name="n">
2909    <xsl:choose>
2910      <xsl:when test="$_n!=''">
2911        <xsl:value-of select="$_n"/>
2912      </xsl:when>
2913      <xsl:otherwise>§</xsl:otherwise>
2914    </xsl:choose>
2915  </xsl:variable>
2916  <xsl:choose>
2917    <xsl:when test="self::reference">
2918      <a xmlns="http://www.w3.org/1999/xhtml" class="iref" href="#{@anchor}">
2919        <xsl:call-template name="insertInsDelClass"/>
2920        <b><xsl:value-of select="$n"/></b>
2921      </a>
2922    </xsl:when>
2923    <xsl:otherwise>
2924      <xsl:variable name="target" select="@target"/>
2925      <xsl:variable name="backlink">#<xsl:value-of select="$anchor-prefix"/>.xref.<xsl:value-of select="$target"/>.<xsl:number level="any" count="xref[@target=$target]"/></xsl:variable>
2926      <a xmlns="http://www.w3.org/1999/xhtml" class="iref" href="{$backlink}">
2927        <xsl:call-template name="insertInsDelClass"/>
2928        <xsl:value-of select="$n"/>
2929      </a>
2930    </xsl:otherwise>
2931  </xsl:choose>
2932  <xsl:if test="position()!=last()">, </xsl:if>
2933</xsl:template>
2934
2935<xsl:template name="insertIndex">
2936
2937  <xsl:call-template name="insert-conditional-hrule"/>
2938
2939  <h1 xmlns="http://www.w3.org/1999/xhtml" id="{$anchor-prefix}.index">
2940    <xsl:call-template name="insert-conditional-pagebreak"/>
2941    <a href="#{$anchor-prefix}.index">Index</a>
2942  </h1>
2943 
2944  <!-- generate navigation links to index subsections -->
2945  <p xmlns="http://www.w3.org/1999/xhtml" class="noprint">
2946    <xsl:variable name="irefs" select="//iref[generate-id(.) = generate-id(key('index-first-letter',translate(substring(@item,1,1),$lcase,$ucase)))]"/>
2947    <xsl:variable name="xrefs" select="//reference[not(starts-with(@anchor,'deleted-'))][generate-id(.) = generate-id(key('index-first-letter',translate(substring(@anchor,1,1),$lcase,$ucase)))]"/>
2948 
2949    <xsl:for-each select="$irefs | $xrefs">
2950   
2951      <xsl:sort select="translate(concat(@item,@anchor),$lcase,$ucase)"/>
2952         
2953      <xsl:variable name="letter" select="translate(substring(concat(@item,@anchor),1,1),$lcase,$ucase)"/>
2954
2955      <!-- character? -->
2956      <xsl:if test="translate($letter,concat($lcase,$ucase,'0123456789'),'')=''">
2957     
2958        <xsl:variable name="showit">
2959          <xsl:choose>
2960            <xsl:when test="$xml2rfc-ext-include-references-in-index!='yes'">
2961              <xsl:if test="$irefs[starts-with(translate(@item,$lcase,$ucase),$letter)]">
2962                <xsl:text>yes</xsl:text>
2963              </xsl:if>
2964            </xsl:when>
2965            <xsl:otherwise>
2966              <xsl:text>yes</xsl:text>
2967            </xsl:otherwise>
2968          </xsl:choose>
2969        </xsl:variable>
2970       
2971        <xsl:if test="$showit='yes'">
2972          <a href="#{$anchor-prefix}.index.{$letter}">
2973            <xsl:value-of select="$letter"/>
2974          </a>
2975          <xsl:text> </xsl:text>
2976        </xsl:if>
2977     
2978      </xsl:if>
2979
2980    </xsl:for-each>
2981  </p>
2982
2983  <!-- for each index subsection -->
2984  <div xmlns="http://www.w3.org/1999/xhtml" class="print2col">
2985  <ul class="ind">
2986    <xsl:variable name="irefs2" select="//iref[generate-id(.) = generate-id(key('index-first-letter',translate(substring(@item,1,1),$lcase,$ucase)))]"/>
2987    <xsl:variable name="xrefs2" select="//reference[not(starts-with(@anchor,'deleted-'))][generate-id(.) = generate-id(key('index-first-letter',translate(substring(@anchor,1,1),$lcase,$ucase)))]"/>
2988 
2989    <xsl:for-each select="$irefs2 | $xrefs2">
2990      <xsl:sort select="translate(concat(@item,@anchor),$lcase,$ucase)"/>
2991      <xsl:variable name="letter" select="translate(substring(concat(@item,@anchor),1,1),$lcase,$ucase)"/>
2992           
2993      <xsl:variable name="showit">
2994        <xsl:choose>
2995          <xsl:when test="$xml2rfc-ext-include-references-in-index!='yes'">
2996            <xsl:if test="$irefs2[starts-with(translate(@item,$lcase,$ucase),$letter)]">
2997              <xsl:text>yes</xsl:text>
2998            </xsl:if>
2999          </xsl:when>
3000          <xsl:otherwise>
3001            <xsl:text>yes</xsl:text>
3002          </xsl:otherwise>
3003        </xsl:choose>
3004      </xsl:variable>
3005
3006      <xsl:if test="$showit='yes'">
3007        <li class="indline0">
3008         
3009          <!-- make letters and digits stand out -->
3010          <xsl:choose>
3011            <xsl:when test="translate($letter,concat($lcase,$ucase,'0123456789'),'')=''">
3012              <a id="{$anchor-prefix}.index.{$letter}" href="#{$anchor-prefix}.index.{$letter}">
3013                <b><xsl:value-of select="$letter"/></b>
3014              </a>
3015            </xsl:when>
3016            <xsl:otherwise>
3017              <b><xsl:value-of select="$letter"/></b>
3018            </xsl:otherwise>
3019          </xsl:choose>
3020       
3021          <ul class="ind"> 
3022            <xsl:for-each select="key('index-first-letter',translate(substring(concat(@item,@anchor),1,1),$lcase,$ucase))">
3023       
3024              <xsl:sort select="translate(concat(@item,@anchor),$lcase,$ucase)"/>
3025             
3026                <xsl:choose>
3027                  <xsl:when test="self::reference">
3028                    <xsl:if test="$xml2rfc-ext-include-references-in-index='yes' and not(starts-with(@anchor,'deleted-'))">
3029                      <li class="indline1">
3030                        <em>
3031                          <xsl:value-of select="@anchor"/>
3032                        </em>
3033                        <xsl:text>  </xsl:text>
3034                       
3035                        <xsl:variable name="rs" select="key('xref-item',current()/@anchor) | . | key('anchor-item',concat('deleted-',current()/@anchor))"/>
3036                       
3037                        <xsl:for-each select="$rs">
3038                          <xsl:call-template name="insertSingleXref"/>
3039                        </xsl:for-each>
3040
3041                        <xsl:variable name="rs2" select="$rs[@x:sec]"/>
3042
3043                        <xsl:if test="$rs2">
3044                          <ul class="ind"> 
3045                            <xsl:for-each select="$rs2">
3046                              <xsl:sort select="substring-before(concat(@x:sec,'.'),'.')" data-type="number"/>
3047                              <xsl:sort select="substring(@x:sec,1+string-length(substring-before(@x:sec,'.')))" data-type="number"/>
3048                              <xsl:if test="generate-id(.) = generate-id(key('index-xref-by-sec',concat(@target,'..',@x:sec)))">
3049                                <li class="indline1">
3050                                  <em>
3051                                    <xsl:choose>
3052                                      <xsl:when test="translate(substring(@x:sec,1,1),$ucase,'')=''">
3053                                        <xsl:text>Appendix </xsl:text>
3054                                      </xsl:when>
3055                                      <xsl:otherwise>
3056                                        <xsl:text>Section </xsl:text>
3057                                      </xsl:otherwise>
3058                                    </xsl:choose>
3059                                    <xsl:value-of select="@x:sec"/>
3060                                  </em>
3061                                  <xsl:text>  </xsl:text>
3062                                  <xsl:for-each select="key('index-xref-by-sec',concat(@target,'..',@x:sec))">
3063                                    <xsl:call-template name="insertSingleXref"/>
3064                                  </xsl:for-each>
3065                                </li>
3066                              </xsl:if>
3067                            </xsl:for-each>
3068                          </ul>
3069                        </xsl:if>
3070
3071                        <xsl:if test="current()/x:source/@href">
3072                          <xsl:variable name="rs3" select="$rs[not(@x:sec) and @x:rel]"/>
3073                          <xsl:variable name="doc" select="document(current()/x:source/@href)"/>
3074                          <xsl:if test="$rs3">
3075                            <ul class="ind"> 
3076                              <xsl:for-each select="$rs3">
3077                                <xsl:sort select="count($doc//*[@anchor and following::*/@anchor=substring-after(current()/@x:rel,'#')])" order="ascending" data-type="number"/>
3078                                <xsl:if test="generate-id(.) = generate-id(key('index-xref-by-anchor',concat(@target,'..',@x:rel)))">
3079                                  <li class="indline1">
3080                                    <em>
3081                                      <xsl:variable name="sec">
3082                                        <xsl:for-each select="$doc//*[@anchor=substring-after(current()/@x:rel,'#')]">
3083                                          <xsl:call-template name="get-section-number"/>
3084                                        </xsl:for-each>
3085                                      </xsl:variable>
3086                                      <xsl:choose>
3087                                        <xsl:when test="translate(substring($sec,1,1),$ucase,'')=''">
3088                                          <xsl:text>Appendix </xsl:text>
3089                                        </xsl:when>
3090                                        <xsl:otherwise>
3091                                          <xsl:text>Section </xsl:text>
3092                                        </xsl:otherwise>
3093                                      </xsl:choose>
3094                                      <xsl:value-of select="$sec"/>
3095                                    </em>
3096                                    <xsl:text>  </xsl:text>
3097                                    <xsl:for-each select="key('index-xref-by-anchor',concat(@target,'..',@x:rel))">
3098                                      <xsl:call-template name="insertSingleXref"/>
3099                                    </xsl:for-each>
3100                                  </li>
3101                                </xsl:if>
3102                              </xsl:for-each>
3103                            </ul>
3104                          </xsl:if>
3105                        </xsl:if>
3106                      </li>
3107                    </xsl:if>
3108                  </xsl:when>
3109                  <xsl:otherwise>
3110                    <!-- regular iref -->
3111                    <xsl:if test="generate-id(.) = generate-id(key('index-item',concat(@item,@anchor)))">
3112                      <xsl:variable name="item" select="@item"/>
3113                      <xsl:variable name="in-artwork" select="key('index-item',$item)[@primary='true' and ancestor::artwork]"/>
3114                         
3115                      <li class="indline1">
3116                        <xsl:choose>
3117                          <xsl:when test="$in-artwork">
3118                            <tt><xsl:value-of select="@item"/></tt>
3119                          </xsl:when>
3120                          <xsl:otherwise>
3121                            <xsl:value-of select="@item"/>
3122                          </xsl:otherwise>
3123                        </xsl:choose>
3124                        <xsl:text>  </xsl:text>
3125                       
3126                        <xsl:variable name="irefs3" select="key('index-item',@item)[not(@subitem) or @subitem='']"/>
3127                        <xsl:variable name="xrefs3" select="key('xref-item',$irefs3[@x:for-anchor='']/../@anchor) | key('xref-item',$irefs3/@x:for-anchor)"/>
3128                        <xsl:variable name="extrefs3" select="key('extref-item',$irefs3[@x:for-anchor='']/../@anchor) | key('extref-item',$irefs3/@x:for-anchor)"/>
3129
3130                        <xsl:for-each select="$irefs3|$xrefs3|$extrefs3">
3131                          <!-- <xsl:sort select="translate(@item,$lcase,$ucase)" />  -->
3132                          <xsl:call-template name="insertSingleIref"/>
3133                        </xsl:for-each>
3134         
3135                        <xsl:variable name="s2" select="key('index-item',@item)[@subitem and @subitem!='']"/>
3136                        <xsl:if test="$s2">
3137                          <ul class="ind"> 
3138                            <xsl:for-each select="$s2">
3139                              <xsl:sort select="translate(@subitem,$lcase,$ucase)"/>
3140                             
3141                              <xsl:if test="generate-id(.) = generate-id(key('index-item-subitem',concat(@item,'..',@subitem)))">
3142                 
3143                                <xsl:variable name="itemsubitem" select="concat(@item,'..',@subitem)"/>
3144                                <xsl:variable name="in-artwork2" select="key('index-item-subitem',concat(@item,'..',@subitem))[@primary='true' and ancestor::artwork]"/>
3145                 
3146                                <li class="indline1">
3147             
3148                                  <xsl:choose>
3149                                    <xsl:when test="$in-artwork2">
3150                                      <tt><xsl:value-of select="@subitem"/></tt>
3151                                    </xsl:when>
3152                                    <xsl:otherwise>
3153                                      <xsl:value-of select="@subitem"/>
3154                                    </xsl:otherwise>
3155                                  </xsl:choose>
3156                                  <xsl:text>  </xsl:text>
3157                                   
3158                                  <xsl:variable name="irefs4" select="key('index-item-subitem',concat(@item,'..',@subitem))"/>
3159                                  <xsl:variable name="xrefs4" select="key('xref-item',$irefs4[@x:for-anchor='']/../@anchor) | key('xref-item',$irefs4/@x:for-anchor)"/>
3160                                  <xsl:variable name="extrefs4" select="key('extref-item',$irefs4[@x:for-anchor='']/../@anchor) | key('extref-item',$irefs4/@x:for-anchor)"/>
3161
3162                                  <xsl:for-each select="$irefs4|$xrefs4|$extrefs4">
3163                                    <!--<xsl:sort select="translate(@item,$lcase,$ucase)" />-->                   
3164                                    <xsl:call-template name="insertSingleIref"/>
3165                                  </xsl:for-each>
3166               
3167                                </li>
3168                              </xsl:if>
3169                            </xsl:for-each>
3170                          </ul>
3171                        </xsl:if>
3172                      </li>
3173                    </xsl:if>
3174                  </xsl:otherwise>
3175                </xsl:choose>
3176             
3177                     
3178            </xsl:for-each>           
3179          </ul>
3180        </li>
3181      </xsl:if>
3182     
3183    </xsl:for-each>
3184  </ul>
3185  </div>
3186 
3187</xsl:template>
3188
3189
3190
3191
3192<xsl:template name="insertPreamble" myns:namespaceless-elements="xml2rfc">
3193
3194  <section title="Status of this Memo" myns:unnumbered="unnumbered" myns:notoclink="notoclink" anchor="{$anchor-prefix}.status">
3195
3196  <xsl:choose>
3197    <xsl:when test="/rfc/@ipr and not(/rfc/@number)">
3198      <t>
3199        <xsl:choose>
3200         
3201          <!-- RFC2026 -->
3202          <xsl:when test="/rfc/@ipr = 'full2026'">
3203            This document is an Internet-Draft and is
3204            in full conformance with all provisions of Section 10 of RFC2026.   
3205          </xsl:when>
3206          <xsl:when test="/rfc/@ipr = 'noDerivativeWorks2026'">
3207            This document is an Internet-Draft and is
3208            in full conformance with all provisions of Section 10 of RFC2026
3209            except that the right to produce derivative works is not granted.   
3210          </xsl:when>
3211          <xsl:when test="/rfc/@ipr = 'noDerivativeWorksNow'">
3212            This document is an Internet-Draft and is
3213            in full conformance with all provisions of Section 10 of RFC2026
3214            except that the right to produce derivative works is not granted.
3215            (If this document becomes part of an IETF working group activity,
3216            then it will be brought into full compliance with Section 10 of RFC2026.) 
3217          </xsl:when>
3218          <xsl:when test="/rfc/@ipr = 'none'">
3219            This document is an Internet-Draft and is
3220            NOT offered in accordance with Section 10 of RFC2026,
3221            and the author does not provide the IETF with any rights other
3222            than to publish as an Internet-Draft.
3223          </xsl:when>
3224         
3225          <!-- RFC3667 -->
3226          <xsl:when test="/rfc/@ipr = 'full3667'">
3227            This document is an Internet-Draft and is subject to all provisions
3228            of section 3 of RFC 3667.  By submitting this Internet-Draft, each
3229            author represents that any applicable patent or other IPR claims of
3230            which he or she is aware have been or will be disclosed, and any of
3231            which he or she become aware will be disclosed, in accordance with
3232            RFC 3668.
3233          </xsl:when>
3234          <xsl:when test="/rfc/@ipr = 'noModification3667'">
3235            This document is an Internet-Draft and is subject to all provisions
3236            of section 3 of RFC 3667.  By submitting this Internet-Draft, each
3237            author represents that any applicable patent or other IPR claims of
3238            which he or she is aware have been or will be disclosed, and any of
3239            which he or she become aware will be disclosed, in accordance with
3240            RFC 3668.  This document may not be modified, and derivative works of
3241            it may not be created, except to publish it as an RFC and to
3242            translate it into languages other than English<xsl:if test="/rfc/@iprExtract">,
3243            other than to extract <xref target="{/rfc/@iprExtract}"/> as-is
3244            for separate use.</xsl:if>.
3245          </xsl:when>
3246          <xsl:when test="/rfc/@ipr = 'noDerivatives3667'">
3247            This document is an Internet-Draft and is subject to all provisions
3248            of section 3 of RFC 3667 except for the right to produce derivative
3249            works.  By submitting this Internet-Draft, each author represents
3250            that any applicable patent or other IPR claims of which he or she
3251            is aware have been or will be disclosed, and any of which he or she
3252            become aware will be disclosed, in accordance with RFC 3668.  This
3253            document may not be modified, and derivative works of it may
3254            not be created<xsl:if test="/rfc/@iprExtract">, other than to extract
3255            <xref target="{/rfc/@iprExtract}"/> as-is for separate use.</xsl:if>.
3256          </xsl:when>
3257         
3258          <!-- RFC3978 -->
3259          <xsl:when test="/rfc/@ipr = 'full3978'">
3260            By submitting this Internet-Draft, each
3261            author represents that any applicable patent or other IPR claims of
3262            which he or she is aware have been or will be disclosed, and any of
3263            which he or she becomes aware will be disclosed, in accordance with
3264            Section 6 of BCP 79.
3265          </xsl:when>
3266          <xsl:when test="/rfc/@ipr = 'noModification3978'">
3267            By submitting this Internet-Draft, each
3268            author represents that any applicable patent or other IPR claims of
3269            which he or she is aware have been or will be disclosed, and any of
3270            which he or she becomes aware will be disclosed, in accordance with
3271            Section 6 of BCP 79.  This document may not be modified, and derivative works of
3272            it may not be created, except to publish it as an RFC and to
3273            translate it into languages other than English<xsl:if test="/rfc/@iprExtract">,
3274            other than to extract <xref target="{/rfc/@iprExtract}"/> as-is
3275            for separate use.</xsl:if>.
3276          </xsl:when>
3277          <xsl:when test="/rfc/@ipr = 'noDerivatives3978'">
3278            By submitting this Internet-Draft, each author represents
3279            that any applicable patent or other IPR claims of which he or she
3280            is aware have been or will be disclosed, and any of which he or she
3281            becomes aware will be disclosed, in accordance with Section 6 of BCP 79.  This
3282            document may not be modified, and derivative works of it may
3283            not be created<xsl:if test="/rfc/@iprExtract">, other than to extract
3284            <xref target="{/rfc/@iprExtract}"/> as-is for separate use.</xsl:if>.
3285          </xsl:when>
3286
3287          <xsl:otherwise>CONFORMANCE UNDEFINED.</xsl:otherwise>
3288        </xsl:choose>
3289      </t>
3290      <t>
3291        Internet-Drafts are working documents of the Internet Engineering
3292        Task Force (IETF), its areas, and its working groups.
3293        Note that other groups may also distribute working documents as
3294        Internet-Drafts.
3295      </t>
3296      <t>
3297        Internet-Drafts are draft documents valid for a maximum of six months
3298        and may be updated, replaced, or obsoleted by other documents at any time.
3299        It is inappropriate to use Internet-Drafts as reference material or to cite
3300        them other than as &#8220;work in progress&#8221;.
3301      </t>
3302      <t>
3303        The list of current Internet-Drafts can be accessed at
3304        <eref target="http://www.ietf.org/ietf/1id-abstracts.txt"/>.
3305      </t>
3306      <t>
3307        The list of Internet-Draft Shadow Directories can be accessed at
3308        <eref target="http://www.ietf.org/shadow.html"/>.
3309      </t>
3310      <t>
3311        This Internet-Draft will expire in <xsl:call-template name="expirydate"/>.
3312      </t>
3313    </xsl:when>
3314
3315    <xsl:when test="/rfc/@category='bcp'">
3316      <t>
3317        This document specifies an Internet Best Current Practices for the Internet
3318        Community, and requests discussion and suggestions for improvements.
3319        Distribution of this memo is unlimited.
3320      </t>
3321    </xsl:when>
3322    <xsl:when test="/rfc/@category='exp'">
3323      <t>
3324        This memo defines an Experimental Protocol for the Internet community.
3325        It does not specify an Internet standard of any kind.
3326        Discussion and suggestions for improvement are requested.
3327        Distribution of this memo is unlimited.
3328      </t>
3329    </xsl:when>
3330    <xsl:when test="/rfc/@category='historic'">
3331      <t>
3332        This memo describes a historic protocol for the Internet community.
3333        It does not specify an Internet standard of any kind.
3334        Distribution of this memo is unlimited.
3335      </t>
3336    </xsl:when>
3337    <xsl:when test="/rfc/@category='info' or not(/rfc/@category)">
3338      <t>
3339        This memo provides information for the Internet community.
3340        It does not specify an Internet standard of any kind.
3341        Distribution of this memo is unlimited.
3342      </t>
3343    </xsl:when>
3344    <xsl:when test="/rfc/@category='std'">
3345      <t>
3346        This document specifies an Internet standards track protocol for the Internet
3347        community, and requests discussion and suggestions for improvements.
3348        Please refer to the current edition of the &#8220;Internet Official Protocol
3349        Standards&#8221; (STD 1) for the standardization state and status of this
3350        protocol. Distribution of this memo is unlimited.
3351      </t>
3352    </xsl:when>
3353    <xsl:otherwise>
3354      <t>UNSUPPORTED CATEGORY.</t>
3355    </xsl:otherwise>
3356  </xsl:choose>
3357 
3358  </section>
3359
3360  <xsl:choose>
3361    <xsl:when test="$ipr-2007-08"/>
3362    <xsl:when test="$ipr-rfc4748">
3363      <section title="Copyright Notice" myns:unnumbered="unnumbered" myns:notoclink="notoclink" anchor="{$anchor-prefix}.copyrightnotice">
3364        <t>
3365          Copyright © The IETF Trust (<xsl:value-of select="$xml2rfc-ext-pub-year"/>).  All Rights Reserved.
3366        </t>
3367      </section>
3368    </xsl:when>
3369    <xsl:otherwise>
3370      <section title="Copyright Notice" myns:unnumbered="unnumbered" myns:notoclink="notoclink" anchor="{$anchor-prefix}.copyrightnotice">
3371        <t>
3372          Copyright © The Internet Society (<xsl:value-of select="$xml2rfc-ext-pub-year"/>).  All Rights Reserved.
3373      </t>
3374      </section>
3375    </xsl:otherwise>
3376  </xsl:choose>
3377 
3378</xsl:template>
3379
3380<!-- TOC generation -->
3381
3382<xsl:template match="/" mode="toc">
3383  <hr xmlns="http://www.w3.org/1999/xhtml" class="noprint"/>
3384
3385  <h1 xmlns="http://www.w3.org/1999/xhtml" class="np" id="{$anchor-prefix}.toc"> <!-- this pagebreak occurs always -->
3386    <a href="#{$anchor-prefix}.toc">Table of Contents</a>
3387  </h1>
3388
3389  <ul xmlns="http://www.w3.org/1999/xhtml" class="toc">
3390    <xsl:apply-templates mode="toc"/>
3391  </ul>
3392</xsl:template>
3393
3394<xsl:template name="insert-toc-line">
3395  <xsl:param name="number"/>
3396  <xsl:param name="target"/>
3397  <xsl:param name="title"/>
3398  <xsl:param name="tocparam"/>
3399  <xsl:param name="oldtitle"/>
3400  <xsl:param name="waschanged"/>
3401
3402  <!-- handle tocdepth parameter -->
3403  <xsl:choose>
3404    <xsl:when test="($tocparam='' or $tocparam='default') and string-length(translate($number,'.ABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890§','.')) &gt;= $parsedTocDepth">
3405      <!-- dropped entry because excluded -->
3406      <xsl:attribute name="class">tocline2</xsl:attribute>
3407    </xsl:when>
3408    <xsl:when test="$tocparam='exclude'">
3409      <!-- dropped entry because excluded -->
3410      <xsl:attribute name="class">tocline2</xsl:attribute>
3411    </xsl:when>
3412    <xsl:otherwise>
3413      <xsl:choose>
3414        <xsl:when test="starts-with($number,'del-')">
3415          <del xmlns="http://www.w3.org/1999/xhtml">
3416            <xsl:value-of select="$number"/>
3417            <a href="#{$target}"><xsl:value-of select="$title"/></a>
3418          </del>
3419        </xsl:when>
3420        <xsl:otherwise>
3421          <xsl:choose>
3422            <xsl:when test="not(contains($number,'.'))">
3423              <xsl:attribute name="class">tocline0</xsl:attribute>
3424            </xsl:when>
3425            <xsl:otherwise>
3426              <xsl:attribute name="class">tocline1</xsl:attribute>
3427            </xsl:otherwise>
3428          </xsl:choose>
3429          <xsl:if test="$number != ''">
3430            <xsl:call-template name="emit-section-number">
3431              <xsl:with-param name="no" select="$number"/>
3432            </xsl:call-template>
3433            <xsl:text>   </xsl:text>
3434          </xsl:if>
3435          <a xmlns="http://www.w3.org/1999/xhtml" href="#{$target}">
3436            <xsl:choose>
3437              <xsl:when test="$waschanged!=''">
3438                <ins><xsl:value-of select="$title"/></ins>
3439                <del><xsl:value-of select="$oldtitle"/></del>
3440              </xsl:when>
3441              <xsl:otherwise>
3442                <xsl:value-of select="$title"/>
3443              </xsl:otherwise>
3444            </xsl:choose>
3445          </a>
3446        </xsl:otherwise>
3447      </xsl:choose>
3448    </xsl:otherwise>
3449  </xsl:choose>
3450</xsl:template>
3451
3452<xsl:template match="back" mode="toc">
3453
3454  <!-- <xsl:apply-templates select="references" mode="toc" /> -->
3455
3456  <xsl:if test="//cref and $xml2rfc-comments='yes' and $xml2rfc-inline!='yes'">
3457    <li xmlns="http://www.w3.org/1999/xhtml">
3458      <xsl:call-template name="insert-toc-line">
3459        <xsl:with-param name="target" select="concat($anchor-prefix,'.comments')"/>
3460        <xsl:with-param name="title" select="'Editorial Comments'"/>
3461      </xsl:call-template>
3462    </li>
3463  </xsl:if>
3464
3465  <xsl:if test="$xml2rfc-ext-authors-section!='end'">
3466    <xsl:apply-templates select="/rfc/front" mode="toc"/>
3467  </xsl:if>
3468  <xsl:apply-templates select="*[not(self::references)]" mode="toc"/>
3469
3470  <xsl:if test="$xml2rfc-ext-authors-section='end'">
3471    <xsl:apply-templates select="/rfc/front" mode="toc"/>
3472  </xsl:if>
3473
3474  <!-- copyright statements -->
3475  <xsl:if test="not($xml2rfc-private)">
3476    <li xmlns="http://www.w3.org/1999/xhtml">
3477      <xsl:call-template name="insert-toc-line">
3478        <xsl:with-param name="target" select="concat($anchor-prefix,'.ipr')"/>
3479        <xsl:with-param name="title" select="'Intellectual Property and Copyright Statements'"/>
3480      </xsl:call-template>
3481    </li>
3482  </xsl:if>
3483 
3484  <!-- insert the index if index entries exist -->
3485  <xsl:if test="//iref">
3486    <li xmlns="http://www.w3.org/1999/xhtml">
3487      <xsl:call-template name="insert-toc-line">
3488        <xsl:with-param name="target" select="concat($anchor-prefix,'.index')"/>
3489        <xsl:with-param name="title" select="'Index'"/>
3490      </xsl:call-template>
3491    </li>
3492  </xsl:if>
3493
3494</xsl:template>
3495
3496<xsl:template match="front" mode="toc">
3497 
3498  <xsl:variable name="authors-title">
3499    <xsl:call-template name="get-authors-section-title"/>
3500  </xsl:variable>
3501  <xsl:variable name="authors-number">
3502    <xsl:call-template name="get-authors-section-number"/>
3503  </xsl:variable>
3504
3505  <xsl:if test="$authors-number!='suppress'">
3506    <li xmlns="http://www.w3.org/1999/xhtml">
3507      <xsl:call-template name="insert-toc-line">
3508        <xsl:with-param name="target" select="concat($anchor-prefix,'.authors')"/>
3509        <xsl:with-param name="title" select="$authors-title"/>
3510        <xsl:with-param name="number" select="$authors-number"/>
3511      </xsl:call-template>
3512    </li>
3513  </xsl:if>
3514
3515</xsl:template>
3516
3517<xsl:template name="references-toc">
3518
3519  <!-- distinguish two cases: (a) single references element (process
3520  as toplevel section; (b) multiple references sections (add one toplevel
3521  container with subsection) -->
3522
3523  <xsl:variable name="refsecs" select="/rfc/back/references|/rfc/back/ed:replace/ed:ins/references"/>
3524   
3525  <xsl:choose>
3526    <xsl:when test="count($refsecs) = 0">
3527      <!-- nop -->
3528    </xsl:when>
3529    <xsl:when test="count($refsecs) = 1">
3530      <xsl:for-each select="$refsecs">
3531        <xsl:variable name="title">
3532          <xsl:choose>
3533            <xsl:when test="@title!=''"><xsl:value-of select="@title"/></xsl:when>
3534            <xsl:otherwise>References</xsl:otherwise>
3535          </xsl:choose>
3536        </xsl:variable>
3537     
3538        <li xmlns="http://www.w3.org/1999/xhtml">
3539          <xsl:call-template name="insert-toc-line">
3540            <xsl:with-param name="number">
3541              <xsl:call-template name="get-references-section-number"/>
3542            </xsl:with-param>
3543            <xsl:with-param name="target" select="concat($anchor-prefix,'.references')"/>
3544            <xsl:with-param name="title" select="$title"/>
3545          </xsl:call-template>
3546        </li>
3547      </xsl:for-each>
3548    </xsl:when>
3549    <xsl:otherwise>
3550      <li xmlns="http://www.w3.org/1999/xhtml">
3551        <!-- insert pseudo container -->   
3552        <xsl:call-template name="insert-toc-line">
3553          <xsl:with-param name="number">
3554            <xsl:call-template name="get-references-section-number"/>
3555          </xsl:with-param>
3556          <xsl:with-param name="target" select="concat($anchor-prefix,'.references')"/>
3557          <xsl:with-param name="title" select="'References'"/>
3558        </xsl:call-template>
3559 
3560        <ul class="toc">
3561          <!-- ...with subsections... -->   
3562          <xsl:for-each select="$refsecs">
3563            <xsl:variable name="title">
3564              <xsl:choose>
3565                <xsl:when test="@title!=''"><xsl:value-of select="@title"/></xsl:when>
3566                <xsl:otherwise>References</xsl:otherwise>
3567              </xsl:choose>
3568            </xsl:variable>
3569         
3570            <xsl:variable name="sectionNumber">
3571              <xsl:call-template name="get-section-number"/>
3572            </xsl:variable>
3573   
3574            <xsl:variable name="num">
3575              <xsl:number level="any"/>
3576            </xsl:variable>
3577   
3578            <li>
3579              <xsl:call-template name="insert-toc-line">
3580                <xsl:with-param name="number" select="$sectionNumber"/>
3581                <xsl:with-param name="target" select="concat($anchor-prefix,'.references','.',$num)"/>
3582                <xsl:with-param name="title" select="$title"/>
3583              </xsl:call-template>
3584            </li>
3585          </xsl:for-each>
3586        </ul>
3587      </li>
3588    </xsl:otherwise>
3589  </xsl:choose>
3590</xsl:template>
3591
3592<xsl:template match="section|appendix" mode="toc">
3593  <xsl:variable name="sectionNumber">
3594    <xsl:call-template name="get-section-number"/>
3595  </xsl:variable>
3596
3597  <xsl:variable name="target">
3598    <xsl:choose>
3599      <xsl:when test="@anchor"><xsl:value-of select="@anchor"/></xsl:when>
3600       <xsl:otherwise><xsl:value-of select="$anchor-prefix"/>.section.<xsl:value-of select="$sectionNumber"/></xsl:otherwise>
3601    </xsl:choose>
3602  </xsl:variable>
3603
3604  <!-- obtain content, just to check whether we need to recurse at all -->
3605  <xsl:variable name="content">
3606    <li xmlns="http://www.w3.org/1999/xhtml">
3607      <xsl:call-template name="insert-toc-line">
3608        <xsl:with-param name="number" select="$sectionNumber"/>
3609        <xsl:with-param name="target" select="$target"/>
3610        <xsl:with-param name="title" select="@title"/>
3611        <xsl:with-param name="tocparam" select="@toc"/>
3612        <xsl:with-param name="oldtitle" select="@ed:old-title"/>
3613        <xsl:with-param name="waschanged" select="@ed:resolves"/>
3614      </xsl:call-template>
3615   
3616      <ul class="toc">
3617        <xsl:apply-templates mode="toc"/>
3618      </ul>
3619    </li>
3620  </xsl:variable>
3621 
3622  <xsl:if test="$content!=''">
3623    <li xmlns="http://www.w3.org/1999/xhtml">
3624      <xsl:call-template name="insert-toc-line">
3625        <xsl:with-param name="number" select="$sectionNumber"/>
3626        <xsl:with-param name="target" select="$target"/>
3627        <xsl:with-param name="title" select="@title"/>
3628        <xsl:with-param name="tocparam" select="@toc"/>
3629        <xsl:with-param name="oldtitle" select="@ed:old-title"/>
3630        <xsl:with-param name="waschanged" select="@ed:resolves"/>
3631      </xsl:call-template>
3632   
3633      <!-- obtain nested content, just to check whether we need to recurse at all -->
3634      <xsl:variable name="nested-content">
3635        <ul class="toc">
3636          <xsl:apply-templates mode="toc"/>
3637        </ul>
3638      </xsl:variable>
3639     
3640      <!-- only recurse if we need to (do not produce useless list container) -->     
3641      <xsl:if test="$nested-content!=''">
3642        <ul class="toc">
3643          <xsl:apply-templates mode="toc"/>
3644        </ul>
3645      </xsl:if>
3646    </li>
3647  </xsl:if>
3648</xsl:template>
3649
3650<xsl:template match="middle" mode="toc">
3651  <xsl:apply-templates mode="toc"/>
3652  <xsl:call-template name="references-toc"/>
3653</xsl:template>
3654
3655<xsl:template match="rfc" mode="toc">
3656  <xsl:apply-templates select="middle|back" mode="toc"/>
3657</xsl:template>
3658
3659<xsl:template match="ed:del|ed:ins|ed:replace" mode="toc">
3660  <xsl:apply-templates mode="toc"/>
3661</xsl:template>
3662
3663<xsl:template match="*|text()" mode="toc"/>
3664
3665
3666<xsl:template name="insertTocAppendix">
3667 
3668  <xsl:if test="//figure[@title!='' or @anchor!='']">
3669    <ul xmlns="http://www.w3.org/1999/xhtml" class="toc">
3670      <xsl:for-each select="//figure[@title!='' or @anchor!='']">
3671        <xsl:variable name="title">Figure <xsl:value-of select="position()"/><xsl:if test="@title">: <xsl:value-of select="@title"/></xsl:if>
3672        </xsl:variable>
3673        <li>
3674          <xsl:call-template name="insert-toc-line">
3675            <xsl:with-param name="target" select="concat($anchor-prefix,'.figure.',position())"/>
3676            <xsl:with-param name="title" select="$title"/>
3677          </xsl:call-template>
3678        </li>
3679      </xsl:for-each>
3680    </ul>
3681  </xsl:if>
3682 
3683  <!-- experimental -->
3684  <xsl:if test="//ed:issue">
3685    <xsl:call-template name="insertIssuesList"/>
3686  </xsl:if>
3687
3688</xsl:template>
3689
3690<xsl:template name="referencename">
3691  <xsl:param name="node"/>
3692 
3693  <xsl:for-each select="$node">
3694    <xsl:choose>
3695      <xsl:when test="$xml2rfc-symrefs!='no' and ancestor::ed:del">
3696        <xsl:variable name="unprefixed" select="substring-after(@anchor,'deleted-')"/>
3697        <xsl:choose>
3698          <xsl:when test="$unprefixed!=''">
3699            <xsl:value-of select="concat('[',$unprefixed,']')"/>
3700          </xsl:when>
3701          <xsl:otherwise>
3702            <xsl:if test="count(//reference[@anchor=current()/@anchor])!=1">
3703              <xsl:message>Deleted duplicate anchors should have the prefix "deleted-": <xsl:value-of select="@anchor"/></xsl:message>
3704            </xsl:if>
3705            <xsl:value-of select="concat('[',@anchor,']')"/>
3706          </xsl:otherwise>
3707        </xsl:choose>
3708      </xsl:when>
3709      <xsl:when test="$xml2rfc-symrefs!='no'">[<xsl:value-of select="@anchor"/>]</xsl:when>
3710      <xsl:when test="ancestor::ed:del">
3711        <xsl:text>[del]</xsl:text>
3712      </xsl:when>
3713      <xsl:otherwise>[<xsl:number level="any" count="reference[not(ancestor::ed:del)]"/>]</xsl:otherwise>
3714    </xsl:choose>
3715  </xsl:for-each> 
3716</xsl:template>
3717
3718
3719
3720<xsl:template name="replace-substring">
3721
3722  <xsl:param name="string"/>
3723  <xsl:param name="replace"/>
3724  <xsl:param name="by"/>
3725
3726  <xsl:choose>
3727    <xsl:when test="contains($string,$replace)">
3728      <xsl:value-of select="concat(substring-before($string, $replace),$by)"/>
3729      <xsl:call-template name="replace-substring">
3730        <xsl:with-param name="string" select="substring-after($string,$replace)"/>
3731        <xsl:with-param name="replace" select="$replace"/>
3732        <xsl:with-param name="by" select="$by"/>
3733      </xsl:call-template>
3734    </xsl:when>
3735    <xsl:otherwise><xsl:value-of select="$string"/></xsl:otherwise>
3736  </xsl:choose>
3737
3738</xsl:template>
3739
3740
3741<xsl:template name="rfclist">
3742  <xsl:param name="list"/>
3743  <xsl:choose>
3744    <xsl:when test="contains($list,',')">
3745      <xsl:variable name="rfcNo" select="substring-before($list,',')"/>
3746      <xsl:call-template name="check-front-matter-ref">
3747        <xsl:with-param name="name" select="$rfcNo"/>
3748      </xsl:call-template>
3749      <a xmlns="http://www.w3.org/1999/xhtml" href="{concat($rfcUrlPrefix,$rfcNo,$rfcUrlPostfix)}"><xsl:value-of select="$rfcNo"/></a>,
3750      <xsl:call-template name="rfclist">
3751        <xsl:with-param name="list" select="normalize-space(substring-after($list,','))"/>
3752      </xsl:call-template>
3753    </xsl:when>
3754    <xsl:otherwise>
3755      <xsl:variable name="rfcNo" select="$list"/>
3756      <xsl:call-template name="check-front-matter-ref">
3757        <xsl:with-param name="name" select="$rfcNo"/>
3758      </xsl:call-template>
3759      <a xmlns="http://www.w3.org/1999/xhtml" href="{concat($rfcUrlPrefix,$rfcNo,$rfcUrlPostfix)}"><xsl:value-of select="$rfcNo"/></a>
3760    </xsl:otherwise>
3761  </xsl:choose>
3762</xsl:template>
3763
3764<xsl:template name="check-front-matter-ref">
3765  <xsl:param name="name"/>
3766  <xsl:choose>
3767    <xsl:when test="starts-with($name,'draft-')">
3768      <xsl:if test="not(//references//reference/seriesInfo[@name='Internet-Draft' and @value=$name])">
3769        <xsl:call-template name="warning">
3770          <xsl:with-param name="inline" select="'no'"/>
3771          <xsl:with-param name="msg" select="concat('front matter mentions I-D ',$name,' for which there is no reference element')"/>
3772        </xsl:call-template>
3773      </xsl:if>
3774    </xsl:when>
3775    <xsl:otherwise>
3776      <xsl:if test="not(//references//reference/seriesInfo[@name='RFC' and @value=$name])">
3777        <xsl:call-template name="warning">
3778          <xsl:with-param name="inline" select="'no'"/>
3779          <xsl:with-param name="msg" select="concat('front matter mentions RFC ',$name,' for which there is no reference element')"/>
3780        </xsl:call-template>
3781      </xsl:if>
3782    </xsl:otherwise>
3783  </xsl:choose>
3784</xsl:template>
3785
3786<xsl:template name="check-anchor">
3787  <xsl:if test="@anchor and @anchor!=''">
3788    <!-- check validity of anchor name -->
3789    <xsl:variable name="test">
3790      <xsl:element namespace="http://www.w3.org/1999/xhtml" name="{@anchor}"/>
3791    </xsl:variable>
3792    <xsl:if test="count(exslt:node-set($test)//*) = 0">
3793      <xsl:call-template name="error">
3794        <xsl:with-param name="msg" select="concat('&#34;',@anchor,'&#34; is not a valid XML name')"/>
3795      </xsl:call-template>
3796    </xsl:if>
3797  </xsl:if>
3798</xsl:template>
3799
3800<xsl:template name="copy-anchor">
3801  <xsl:call-template name="check-anchor"/>
3802  <xsl:if test="@anchor and @anchor!=''">
3803    <xsl:attribute name="id"><xsl:value-of select="@anchor"/></xsl:attribute>
3804  </xsl:if>
3805</xsl:template>
3806
3807<xsl:template name="rfclist-for-dcmeta">
3808  <xsl:param name="list"/>
3809  <xsl:choose>
3810    <xsl:when test="contains($list,',')">
3811      <xsl:variable name="rfcNo" select="substring-before($list,',')"/>
3812      <meta xmlns="http://www.w3.org/1999/xhtml" name="DC.Relation.Replaces" content="urn:ietf:rfc:{$rfcNo}"/>
3813      <xsl:call-template name="rfclist-for-dcmeta">
3814        <xsl:with-param name="list" select="normalize-space(substring-after($list,','))"/>
3815      </xsl:call-template>
3816    </xsl:when>
3817    <xsl:otherwise>
3818      <xsl:variable name="rfcNo" select="$list"/>
3819      <meta xmlns="http://www.w3.org/1999/xhtml" name="DC.Relation.Replaces" content="urn:ietf:rfc:{$rfcNo}"/>
3820    </xsl:otherwise>
3821  </xsl:choose>
3822</xsl:template>
3823
3824<xsl:template name="get-paragraph-number">
3825  <!-- get section number of ancestor section element, then add t or figure number -->
3826  <xsl:if test="ancestor::section and not(ancestor::section[@myns:unnumbered='unnumbered']) and not(ancestor::x:blockquote) and not(ancestor::x:note)">
3827    <xsl:for-each select="ancestor::section[1]"><xsl:call-template name="get-section-number"/>.p.</xsl:for-each><xsl:number count="t|figure|x:blockquote|x:note"/>
3828  </xsl:if>
3829</xsl:template>
3830
3831<xsl:template name="editingMark">
3832  <xsl:if test="$xml2rfc-editing='yes' and ancestor::rfc">
3833    <sup xmlns="http://www.w3.org/1999/xhtml" class="editingmark"><span><xsl:number level="any" count="postamble|preamble|t"/></span> </sup>
3834  </xsl:if>
3835</xsl:template>
3836
3837<!-- internal ref support -->
3838<xsl:key name="anchor-item-alias" match="//*[@anchor and (x:anchor-alias/@value or ed:replace/ed:ins/x:anchor-alias)]" use="x:anchor-alias/@value | ed:replace/ed:ins/x:anchor-alias/@value"/>
3839
3840<xsl:template match="x:ref">
3841  <xsl:variable name="val" select="."/>
3842<!--  <xsl:variable name="target" select="//*[(@anchor and x:anchor-alias/@value=$val) or (@anchor and ed:replace/ed:ins/x:anchor-alias/@value=$val) or (@anchor=$val)]"/> -->
3843  <xsl:variable name="target" select="key('anchor-item',$val) | key('anchor-item-alias',$val)"/>
3844  <xsl:variable name="irefs" select="//iref[@x:for-anchor=$val]"/>
3845  <xsl:choose>
3846    <xsl:when test="$target">
3847      <a xmlns="http://www.w3.org/1999/xhtml" href="#{$target/@anchor}" class="smpl">
3848        <!-- to be indexed? -->
3849        <xsl:if test="$irefs">
3850          <xsl:attribute name="id"><xsl:call-template name="compute-extref-anchor"/></xsl:attribute>
3851        </xsl:if>
3852        <xsl:value-of select="."/>
3853      </a>
3854    </xsl:when>
3855    <xsl:otherwise>
3856      <xsl:call-template name="warning">
3857        <xsl:with-param name="inline" select="'no'"/>
3858        <xsl:with-param name="msg">internal link target for '<xsl:value-of select="."/>' does not exist.</xsl:with-param>
3859      </xsl:call-template>
3860      <xsl:value-of select="."/>
3861    </xsl:otherwise>
3862  </xsl:choose>
3863</xsl:template>
3864
3865<!-- Nothing to do here -->
3866<xsl:template match="x:anchor-alias"/>
3867
3868<!-- Quotes -->
3869<xsl:template match="x:q">
3870  <q xmlns="http://www.w3.org/1999/xhtml">
3871    <xsl:copy-of select="@cite"/>
3872    <xsl:apply-templates/>
3873  </q>
3874</xsl:template>
3875
3876<!-- Notes -->
3877<xsl:template match="x:note">
3878  <div xmlns="http://www.w3.org/1999/xhtml" class="note">
3879    <xsl:apply-templates/>
3880  </div>
3881</xsl:template>
3882
3883<xsl:template match="x:bcp14">
3884  <!-- check valid BCP14 keywords, then emphasize them -->
3885  <xsl:variable name="c" select="normalize-space(.)"/>
3886  <xsl:choose>
3887    <xsl:when test="$c='MUST' or $c='REQUIRED' or $c='SHALL'">
3888      <em xmlns="http://www.w3.org/1999/xhtml" class="bcp14"><xsl:value-of select="."/></em>
3889    </xsl:when>
3890    <xsl:when test="$c='MUST NOT' or $c='SHALL NOT'">
3891      <em xmlns="http://www.w3.org/1999/xhtml" class="bcp14"><xsl:value-of select="."/></em>
3892    </xsl:when>
3893    <xsl:when test="$c='SHOULD' or $c='RECOMMENDED'">
3894      <em xmlns="http://www.w3.org/1999/xhtml" class="bcp14"><xsl:value-of select="."/></em>
3895    </xsl:when>
3896    <xsl:when test="$c='SHOULD NOT' or $c='NOT RECOMMENDED'">
3897      <em xmlns="http://www.w3.org/1999/xhtml" class="bcp14"><xsl:value-of select="."/></em>
3898    </xsl:when>
3899    <xsl:when test="$c='MAY' or $c='OPTIONAL'">
3900      <em xmlns="http://www.w3.org/1999/xhtml" class="bcp14"><xsl:value-of select="."/></em>
3901    </xsl:when>
3902    <xsl:otherwise>
3903      <xsl:value-of select="."/>
3904      <xsl:message>ERROR: unknown BCP14 keyword: <xsl:value-of select="."/></xsl:message>
3905    </xsl:otherwise>
3906  </xsl:choose>
3907</xsl:template>
3908
3909<xsl:template match="x:blockquote">
3910  <xsl:variable name="p">
3911    <xsl:call-template name="get-paragraph-number"/>
3912  </xsl:variable>
3913
3914  <blockquote xmlns="http://www.w3.org/1999/xhtml">
3915    <xsl:if test="string-length($p) &gt; 0 and not(ancestor::ed:del) and not(ancestor::ed:ins)">
3916      <xsl:attribute name="id"><xsl:value-of select="$anchor-prefix"/>.section.<xsl:value-of select="$p"/></xsl:attribute>
3917    </xsl:if>
3918    <xsl:call-template name="insertInsDelClass"/>
3919    <xsl:call-template name="editingMark"/>
3920    <xsl:copy-of select="@cite"/>
3921    <xsl:apply-templates/>
3922  </blockquote>
3923</xsl:template>
3924
3925<!-- Definitions -->
3926<xsl:template match="x:dfn">
3927  <dfn xmlns="http://www.w3.org/1999/xhtml">
3928    <xsl:call-template name="copy-anchor"/>
3929    <xsl:apply-templates/>
3930  </dfn>
3931</xsl:template>
3932
3933<!-- headings -->
3934<xsl:template match="x:h">
3935  <b xmlns="http://www.w3.org/1999/xhtml">
3936    <xsl:apply-templates/>
3937  </b>
3938</xsl:template>
3939
3940<!-- superscripts -->
3941<xsl:template match="x:sup">
3942  <sup xmlns="http://www.w3.org/1999/xhtml">
3943    <xsl:apply-templates/>
3944  </sup>
3945</xsl:template>
3946
3947<!-- bold -->
3948<xsl:template match="x:highlight">
3949  <b xmlns="http://www.w3.org/1999/xhtml">
3950    <xsl:apply-templates/>
3951  </b>
3952</xsl:template>
3953
3954<!-- measuring lengths -->
3955<xsl:template match="x:length-of">
3956  <xsl:variable name="target" select="//*[@anchor=current()/@target]"/>
3957  <xsl:if test="count($target)!=1">
3958    <xsl:call-template name="error">
3959      <xsl:with-param name="msg" select="concat('@target ',@target,' defined ',count($target),' times.')"/>
3960    </xsl:call-template>
3961  </xsl:if>
3962  <xsl:variable name="content">
3963    <xsl:apply-templates select="$target"/>
3964  </xsl:variable>
3965  <xsl:variable name="lineends" select="string-length($content) - string-length(translate($content,'&#xA;',''))"/>
3966  <xsl:variable name="indents">
3967    <xsl:choose>
3968      <xsl:when test="@indented">
3969        <xsl:value-of select="number(@indented) * $lineends"/>
3970      </xsl:when>
3971      <xsl:otherwise>0</xsl:otherwise>
3972    </xsl:choose>
3973  </xsl:variable>
3974  <xsl:value-of select="string-length($content) + $lineends - $indents"/>
3975</xsl:template>
3976
3977<!-- Nop -->
3978<xsl:template match="x:span">
3979  <xsl:apply-templates/>
3980</xsl:template>
3981
3982<xsl:template match="x:parse-xml">
3983  <xsl:apply-templates/>
3984
3985  <xsl:if test="function-available('exslt:node-set')">
3986    <xsl:variable name="cleaned">
3987      <xsl:apply-templates mode="cleanup-edits"/>
3988    </xsl:variable>
3989    <xsl:choose>
3990      <xsl:when test="function-available('myns:parseXml')">
3991        <xsl:if test="myns:parseXml(concat($cleaned,''))!=''">
3992          <xsl:call-template name="error">
3993            <xsl:with-param name="msg" select="concat('Parse error in XML: ', myns:parseXml(concat($cleaned,'')))"/>
3994          </xsl:call-template>
3995        </xsl:if>
3996      </xsl:when>
3997      <xsl:when test="function-available('saxon:parse')">
3998        <xsl:variable name="parsed" select="saxon:parse(concat($cleaned,''))"/>
3999        <xsl:if test="$parsed='foo'">
4000          <xsl:comment>should not get here</xsl:comment>
4001        </xsl:if>
4002      </xsl:when>
4003      <xsl:otherwise/>
4004    </xsl:choose>
4005  </xsl:if>
4006</xsl:template>
4007
4008<!-- inlined RDF support -->
4009<xsl:template match="rdf:Description">
4010  <!-- ignore -->
4011</xsl:template>
4012
4013<!-- cleanup for ins/del -->
4014
4015<xsl:template match="comment()|@*" mode="cleanup-edits"><xsl:copy/></xsl:template>
4016
4017<xsl:template match="text()" mode="cleanup-edits"><xsl:copy/></xsl:template>
4018
4019<xsl:template match="/" mode="cleanup-edits">
4020        <xsl:copy><xsl:apply-templates select="node()" mode="cleanup-edits"/></xsl:copy>
4021</xsl:template>
4022
4023<xsl:template match="ed:del" mode="cleanup-edits"/>
4024
4025<xsl:template match="ed:replace" mode="cleanup-edits">
4026  <xsl:apply-templates mode="cleanup-edits"/>
4027</xsl:template>
4028
4029<xsl:template match="ed:ins" mode="cleanup-edits">
4030  <xsl:apply-templates mode="cleanup-edits"/>
4031</xsl:template>
4032
4033
4034<!-- ABNF support -->
4035<xsl:template name="to-abnf-char-sequence">
4036  <xsl:param name="chars"/>
4037 
4038  <xsl:variable name="c" select="substring($chars,1,1)"/>
4039  <xsl:variable name="r" select="substring($chars,2)"/>
4040   
4041  <xsl:choose>
4042    <xsl:when test="$c='A'">41</xsl:when>
4043    <xsl:when test="$c='B'">42</xsl:when>
4044    <xsl:when test="$c='C'">43</xsl:when>
4045    <xsl:when test="$c='D'">44</xsl:when>
4046    <xsl:when test="$c='E'">45</xsl:when>
4047    <xsl:when test="$c='F'">46</xsl:when>
4048    <xsl:when test="$c='G'">47</xsl:when>
4049    <xsl:when test="$c='H'">48</xsl:when>
4050    <xsl:when test="$c='I'">49</xsl:when>
4051    <xsl:when test="$c='J'">4A</xsl:when>
4052    <xsl:when test="$c='K'">4B</xsl:when>
4053    <xsl:when test="$c='L'">4C</xsl:when>
4054    <xsl:when test="$c='M'">4D</xsl:when>
4055    <xsl:when test="$c='N'">4E</xsl:when>
4056    <xsl:when test="$c='O'">4F</xsl:when>
4057    <xsl:when test="$c='P'">50</xsl:when>
4058    <xsl:when test="$c='Q'">51</xsl:when>
4059    <xsl:when test="$c='R'">52</xsl:when>
4060    <xsl:when test="$c='S'">53</xsl:when>
4061    <xsl:when test="$c='T'">54</xsl:when>
4062    <xsl:when test="$c='U'">55</xsl:when>
4063    <xsl:when test="$c='V'">56</xsl:when>
4064    <xsl:when test="$c='W'">57</xsl:when>
4065    <xsl:when test="$c='X'">58</xsl:when>
4066    <xsl:when test="$c='Y'">59</xsl:when>
4067    <xsl:when test="$c='Z'">5A</xsl:when>
4068    <xsl:when test="$c='a'">61</xsl:when>
4069    <xsl:when test="$c='b'">62</xsl:when>
4070    <xsl:when test="$c='c'">63</xsl:when>
4071    <xsl:when test="$c='d'">64</xsl:when>
4072    <xsl:when test="$c='e'">65</xsl:when>
4073    <xsl:when test="$c='f'">66</xsl:when>
4074    <xsl:when test="$c='g'">67</xsl:when>
4075    <xsl:when test="$c='h'">68</xsl:when>
4076    <xsl:when test="$c='i'">69</xsl:when>
4077    <xsl:when test="$c='j'">6A</xsl:when>
4078    <xsl:when test="$c='k'">6B</xsl:when>
4079    <xsl:when test="$c='l'">6C</xsl:when>
4080    <xsl:when test="$c='m'">6D</xsl:when>
4081    <xsl:when test="$c='n'">6E</xsl:when>
4082    <xsl:when test="$c='o'">6F</xsl:when>
4083    <xsl:when test="$c='p'">70</xsl:when>
4084    <xsl:when test="$c='q'">71</xsl:when>
4085    <xsl:when test="$c='r'">72</xsl:when>
4086    <xsl:when test="$c='s'">73</xsl:when>
4087    <xsl:when test="$c='t'">74</xsl:when>
4088    <xsl:when test="$c='u'">75</xsl:when>
4089    <xsl:when test="$c='v'">76</xsl:when>
4090    <xsl:when test="$c='w'">77</xsl:when>
4091    <xsl:when test="$c='x'">78</xsl:when>
4092    <xsl:when test="$c='y'">79</xsl:when>
4093    <xsl:when test="$c='z'">7A</xsl:when>
4094    <xsl:otherwise>
4095      <xsl:text>??</xsl:text>
4096      <xsl:call-template name="error">
4097        <xsl:with-param name="msg" select="concat('unexpected character in ABNF char sequence: ',substring($chars,1,1))"/>
4098      </xsl:call-template>
4099    </xsl:otherwise>
4100  </xsl:choose>
4101
4102  <xsl:if test="$r!=''">
4103    <xsl:text>.</xsl:text>
4104    <xsl:call-template name="to-abnf-char-sequence">
4105      <xsl:with-param name="chars" select="$r"/>
4106    </xsl:call-template>
4107  </xsl:if>
4108 
4109</xsl:template>
4110
4111<xsl:template match="x:abnf-char-sequence">
4112  <xsl:choose>
4113    <xsl:when test="substring(.,1,1) != '&#34;' or substring(.,string-length(.),1) != '&#34;'">
4114      <xsl:call-template name="error">
4115        <xsl:with-param name="msg" select="'contents of x:abnf-char-sequence needs to be quoted.'"/>
4116      </xsl:call-template>
4117    </xsl:when>
4118    <xsl:otherwise>
4119      <xsl:text>%x</xsl:text>
4120      <xsl:call-template name="to-abnf-char-sequence">
4121        <xsl:with-param name="chars" select="substring(.,2,string-length(.)-2)"/>
4122      </xsl:call-template>
4123    </xsl:otherwise>
4124  </xsl:choose>
4125</xsl:template>
4126
4127<!-- box drawing -->
4128
4129<!-- nop for alignment -->
4130<xsl:template match="x:x"/>
4131
4132<!-- box (top) -->
4133<xsl:template match="x:bt">
4134  <xsl:text>&#9484;</xsl:text>
4135  <xsl:value-of select="translate(substring(.,2,string-length(.)-2),'-','&#9472;')"/>
4136  <xsl:text>&#9488;</xsl:text>
4137</xsl:template>
4138
4139<!-- box (center) -->
4140<xsl:template match="x:bc">
4141  <xsl:variable name="first" select="substring(.,1)"/>
4142  <xsl:variable name="last" select="substring(.,string-length(.)-1)"/>
4143  <xsl:variable name="content" select="substring(.,2,string-length(.)-2)"/>
4144  <xsl:variable name="is-delimiter" select="translate($content,'-','')=''"/>
4145 
4146  <xsl:choose>
4147    <xsl:when test="$is-delimiter">
4148      <xsl:text>&#9500;</xsl:text>
4149      <xsl:value-of select="translate($content,'-','&#9472;')"/>
4150      <xsl:text>&#9508;</xsl:text>
4151    </xsl:when>
4152    <xsl:when test="*">
4153      <xsl:for-each select="node()">
4154        <xsl:choose>
4155          <xsl:when test="position()=1">
4156            <xsl:text>&#9474;</xsl:text>
4157            <xsl:value-of select="substring(.,2)"/>
4158          </xsl:when>
4159          <xsl:when test="position()=last()">
4160            <xsl:value-of select="substring(.,1,string-length(.)-1)"/>
4161            <xsl:text>&#9474;</xsl:text>
4162          </xsl:when>
4163          <xsl:otherwise>
4164            <xsl:apply-templates select="."/>
4165          </xsl:otherwise>
4166        </xsl:choose>
4167      </xsl:for-each>
4168    </xsl:when>
4169    <xsl:otherwise>
4170      <xsl:text>&#9474;</xsl:text>
4171      <xsl:value-of select="$content"/>
4172      <xsl:text>&#9474;</xsl:text>
4173    </xsl:otherwise>
4174  </xsl:choose>
4175 
4176</xsl:template>
4177
4178<!-- box (bottom) -->
4179<xsl:template match="x:bb">
4180  <xsl:text>&#9492;</xsl:text>
4181  <xsl:value-of select="translate(substring(.,2,string-length(.)-2),'-','&#9472;')"/>
4182  <xsl:text>&#9496;</xsl:text>
4183</xsl:template>
4184
4185<!-- author handling extensions -->
4186<xsl:template match="x:include-author">
4187  <xsl:for-each select="/*/front/author[@anchor=current()/@target]">
4188    <xsl:apply-templates select="."/>
4189  </xsl:for-each>
4190</xsl:template>
4191
4192<!-- experimental annotation support -->
4193
4194<xsl:template match="ed:issueref">
4195  <xsl:choose>
4196    <xsl:when test=".=//ed:issue/@name">
4197      <a xmlns="http://www.w3.org/1999/xhtml" href="#{$anchor-prefix}.issue.{.}">
4198        <xsl:apply-templates/>
4199      </a>
4200    </xsl:when>
4201    <xsl:otherwise>
4202      <xsl:call-template name="warning">
4203        <xsl:with-param name="msg">Dangling ed:issueref: <xsl:value-of select="."/></xsl:with-param>
4204      </xsl:call-template>
4205      <xsl:apply-templates/>
4206    </xsl:otherwise>
4207  </xsl:choose>
4208</xsl:template>
4209
4210<xsl:template match="ed:issue">
4211  <xsl:variable name="class">
4212    <xsl:choose>
4213      <xsl:when test="@status='closed'">closedissue</xsl:when>
4214      <xsl:otherwise>openissue</xsl:otherwise>
4215    </xsl:choose>
4216  </xsl:variable>
4217 
4218  <table xmlns="http://www.w3.org/1999/xhtml" summary="issue {@name}" class="{$class}">
4219    <tr>
4220      <td colspan="3">
4221        <a id="{$anchor-prefix}.issue.{@name}">
4222          <xsl:choose>
4223            <xsl:when test="@status='closed'">
4224              <xsl:attribute name="class">closed-issue</xsl:attribute>
4225            </xsl:when>
4226            <xsl:when test="@status='editor'">
4227              <xsl:attribute name="class">editor-issue</xsl:attribute>
4228            </xsl:when>
4229            <xsl:otherwise>
4230              <xsl:attribute name="class">open-issue</xsl:attribute>
4231            </xsl:otherwise>
4232          </xsl:choose>
4233          <xsl:text> I </xsl:text>
4234        </a>
4235        <xsl:text> </xsl:text>
4236        <xsl:choose>
4237          <xsl:when test="@href">
4238            <em><a href="{@href}"><xsl:value-of select="@name"/></a></em>
4239          </xsl:when>
4240          <xsl:when test="@alternate-href">
4241            <em>[<a href="{@alternate-href}">alternate link</a>]</em>
4242          </xsl:when>
4243          <xsl:otherwise>
4244            <em><xsl:value-of select="@name"/></em>
4245          </xsl:otherwise>
4246        </xsl:choose>
4247         
4248        (type: <xsl:value-of select="@type"/>, status: <xsl:value-of select="@status"/>)
4249      </td>
4250    </tr>
4251
4252    <xsl:apply-templates select="ed:item"/>
4253    <xsl:apply-templates select="ed:resolution"/>
4254
4255    <xsl:variable name="changes" select="//*[@ed:resolves=current()/@name or ed:resolves=current()/@name]"/>
4256    <xsl:if test="$changes">
4257      <tr>
4258        <td class="top" colspan="3">
4259          Associated changes in this document:
4260          <xsl:variable name="issue" select="@name"/>
4261          <xsl:for-each select="$changes">
4262            <a href="#{$anchor-prefix}.change.{$issue}.{position()}">
4263              <xsl:variable name="label">
4264                <xsl:call-template name="get-section-number"/>
4265              </xsl:variable>
4266              <xsl:choose>
4267                <xsl:when test="$label!=''"><xsl:value-of select="$label"/></xsl:when>
4268                <xsl:otherwise>&lt;<xsl:value-of select="concat('#',$anchor-prefix,'.change.',$issue,'.',position())"/>&gt;</xsl:otherwise>
4269              </xsl:choose>
4270            </a>
4271            <xsl:if test="position()!=last()">, </xsl:if>
4272          </xsl:for-each>
4273          <xsl:text>.</xsl:text>
4274        </td>
4275      </tr>
4276    </xsl:if>
4277  </table>
4278   
4279</xsl:template>
4280
4281<xsl:template match="ed:item">
4282  <tr xmlns="http://www.w3.org/1999/xhtml">
4283    <td class="top">
4284      <xsl:if test="@entered-by">
4285        <a href="mailto:{@entered-by}?subject={/rfc/@docName},%20{../@name}">
4286          <i><xsl:value-of select="@entered-by"/></i>
4287        </a>
4288      </xsl:if>
4289    </td>
4290    <td class="topnowrap">
4291      <xsl:value-of select="@date"/>
4292    </td>
4293    <td class="top">
4294      <xsl:apply-templates select="node()" mode="issuehtml"/>
4295    </td>
4296  </tr>
4297</xsl:template>
4298
4299<xsl:template match="ed:resolution">
4300  <tr xmlns="http://www.w3.org/1999/xhtml">
4301    <td class="top">
4302      <xsl:if test="@entered-by">
4303        <a href="mailto:{@entered-by}?subject={/rfc/@docName},%20{../@name}"><i><xsl:value-of select="@entered-by"/></i></a>
4304      </xsl:if>
4305    </td>
4306    <td class="topnowrap">
4307      <xsl:value-of select="@datetime"/>
4308    </td>
4309    <td class="top">
4310      <em>Resolution:</em>
4311      <xsl:apply-templates select="node()" mode="issuehtml"/>
4312    </td>
4313  </tr>
4314</xsl:template>
4315
4316<xsl:template match="ed:annotation">
4317  <em xmlns="http://www.w3.org/1999/xhtml">
4318    <xsl:apply-templates/>
4319  </em>
4320</xsl:template>
4321
4322<!-- special templates for handling XHTML in issues -->
4323<xsl:template match="text()" mode="issuehtml">
4324  <xsl:value-of select="."/>
4325</xsl:template>
4326
4327<xsl:template match="*|@*" mode="issuehtml">
4328  <xsl:message terminate="yes">Unexpected node in issue HTML: <xsl:value-of select="local-name(.)"/></xsl:message>
4329</xsl:template>
4330
4331<xsl:template match="xhtml:a|xhtml:b|xhtml:br|xhtml:cite|xhtml:del|xhtml:em|xhtml:i|xhtml:ins|xhtml:q|xhtml:pre|xhtml:tt" mode="issuehtml">
4332  <xsl:element namespace="http://www.w3.org/1999/xhtml" name="{local-name()}">
4333    <xsl:apply-templates select="@*|node()" mode="issuehtml"/>
4334  </xsl:element>
4335</xsl:template>
4336
4337<xsl:template match="xhtml:p" mode="issuehtml">
4338  <xsl:apply-templates select="node()" mode="issuehtml"/>
4339  <br xmlns="http://www.w3.org/1999/xhtml" class="p"/>
4340</xsl:template>
4341
4342<xsl:template match="xhtml:a/@href|xhtml:q/@cite" mode="issuehtml">
4343  <xsl:attribute name="{local-name(.)}">
4344    <xsl:value-of select="."/>
4345  </xsl:attribute>
4346</xsl:template>
4347
4348<xsl:template match="ed:issueref" mode="issuehtml">
4349  <xsl:apply-templates select="."/>
4350</xsl:template>
4351
4352<xsl:template match="ed:eref" mode="issuehtml">
4353  <xsl:text>&lt;</xsl:text>
4354  <a xmlns="http://www.w3.org/1999/xhtml" href="{.}"><xsl:value-of select="."/></a>
4355  <xsl:text>&gt;</xsl:text>
4356</xsl:template>
4357
4358<xsl:template name="insertIssuesList">
4359
4360  <h2 xmlns="http://www.w3.org/1999/xhtml" id="{$anchor-prefix}.issues-list"><a href="#{$anchor-prefix}.issues-list">Issues list</a></h2>
4361  <table xmlns="http://www.w3.org/1999/xhtml" summary="Issues list">
4362    <thead>
4363      <tr>
4364        <th>Id</th>
4365        <th>Type</th>
4366        <th>Status</th>
4367        <th>Date</th>
4368        <th>Raised By</th>
4369      </tr>
4370    </thead>
4371    <tbody>
4372      <xsl:for-each select="//ed:issue">
4373        <xsl:sort select="@status"/>
4374        <xsl:sort select="@name"/>
4375        <tr>
4376          <td><a href="#{$anchor-prefix}.issue.{@name}"><xsl:value-of select="@name"/></a></td>
4377          <td><xsl:value-of select="@type"/></td>
4378          <td><xsl:value-of select="@status"/></td>
4379          <td><xsl:value-of select="ed:item[1]/@date"/></td>
4380          <td><a href="mailto:{ed:item[1]/@entered-by}?subject={/rfc/@docName},%20{@name}"><xsl:value-of select="ed:item[1]/@entered-by"/></a></td>
4381        </tr>
4382      </xsl:for-each>
4383    </tbody>
4384  </table>
4385 
4386</xsl:template>
4387
4388<xsl:template name="formatTitle">
4389  <xsl:if test="@who">
4390    <xsl:value-of select="@who"/>
4391  </xsl:if>
4392  <xsl:if test="@datetime">
4393    <xsl:value-of select="concat(' (',@datetime,')')"/>
4394  </xsl:if>
4395  <xsl:if test="@reason">
4396    <xsl:value-of select="concat(': ',@reason)"/>
4397  </xsl:if>
4398  <xsl:if test="@cite">
4399    <xsl:value-of select="concat(' &lt;',@cite,'&gt;')"/>
4400  </xsl:if>
4401</xsl:template>
4402
4403<xsl:template name="insert-diagnostics">
4404 
4405  <!-- check anchor names -->
4406  <xsl:variable name="badAnchors" select="//*[starts-with(@anchor,concat($anchor-prefix,'.'))][@anchor!=concat($anchor-prefix,'.authors') and /*/x:assign-section-number[@number='suppress' and @builtin-target='authors']]"/>
4407 
4408  <xsl:if test="$badAnchors">
4409    <xsl:variable name="text">
4410      The following anchor names may collide with internally generated anchors because of their prefix "<xsl:value-of select="$anchor-prefix"/>":
4411      <xsl:for-each select="$badAnchors">
4412        <xsl:value-of select="@anchor"/><xsl:if test="position()!=last()">, </xsl:if>
4413      </xsl:for-each>
4414    </xsl:variable>
4415    <xsl:call-template name="warning">
4416      <xsl:with-param name="msg"><xsl:value-of select="$text"/></xsl:with-param>
4417    </xsl:call-template>
4418  </xsl:if>
4419 
4420  <!-- check ABNF syntax references -->
4421  <xsl:if test="//artwork[@type='abnf2616']">
4422    <xsl:if test="not(//reference/seriesInfo[@name='RFC' and (@value='2068' or @value='2616')])">
4423      <xsl:call-template name="warning">
4424        <xsl:with-param name="inline">no</xsl:with-param>
4425        <xsl:with-param name="msg">document uses HTTP-style ABNF syntax, but doesn't reference RFC 2068 or 2616.</xsl:with-param>
4426      </xsl:call-template>
4427    </xsl:if>
4428  </xsl:if>
4429  <xsl:if test="//artwork[@type='abnf']">
4430    <xsl:if test="not(//reference/seriesInfo[@name='RFC' and (@value='2234' or @value='4234' or @value='5234')])">
4431      <xsl:call-template name="warning">
4432        <xsl:with-param name="inline">no</xsl:with-param>
4433        <xsl:with-param name="msg">document uses ABNF syntax, but doesn't reference RFC 2234, 4234 or 5234.</xsl:with-param>
4434      </xsl:call-template>
4435    </xsl:if>
4436  </xsl:if>
4437 
4438  <!-- check IDs -->
4439  <xsl:variable name="badTargets" select="//xref[not(@target=//@anchor) and not(ancestor::ed:del)]"/>
4440  <xsl:if test="$badTargets">
4441    <xsl:variable name="text">
4442      The following target names do not exist:
4443      <xsl:for-each select="$badTargets">
4444        <xsl:value-of select="@target"/><xsl:if test="position()!=last()">, </xsl:if>
4445      </xsl:for-each>
4446    </xsl:variable>
4447    <xsl:call-template name="warning">
4448      <xsl:with-param name="msg"><xsl:value-of select="$text"/></xsl:with-param>
4449    </xsl:call-template>
4450  </xsl:if>
4451 
4452 
4453</xsl:template>
4454
4455<!-- special change mark support, not supported by RFC2629 yet -->
4456
4457<xsl:template match="@ed:*"/>
4458
4459<xsl:template match="ed:del">
4460  <xsl:call-template name="insert-issue-pointer"/>
4461  <del xmlns="http://www.w3.org/1999/xhtml">
4462    <xsl:copy-of select="@*[namespace-uri()='']"/>
4463    <xsl:if test="not(@title) and ancestor-or-self::*[@ed:entered-by] and @datetime">
4464      <xsl:attribute name="title"><xsl:value-of select="concat(@datetime,', ',ancestor-or-self::*[@ed:entered-by][1]/@ed:entered-by)"/></xsl:attribute>
4465    </xsl:if>
4466    <xsl:apply-templates/>
4467  </del>
4468</xsl:template>
4469
4470<xsl:template match="ed:ins">
4471  <xsl:call-template name="insert-issue-pointer"/>
4472  <ins xmlns="http://www.w3.org/1999/xhtml">
4473    <xsl:copy-of select="@*[namespace-uri()='']"/>
4474    <xsl:if test="not(@title) and ancestor-or-self::*[@ed:entered-by] and @datetime">
4475      <xsl:attribute name="title"><xsl:value-of select="concat(@datetime,', ',ancestor-or-self::*[@ed:entered-by][1]/@ed:entered-by)"/></xsl:attribute>
4476    </xsl:if>
4477    <xsl:apply-templates/>
4478  </ins>
4479</xsl:template>
4480
4481<xsl:template name="insert-issue-pointer">
4482  <xsl:param name="deleted-anchor"/>
4483  <xsl:variable name="change" select="."/>
4484  <xsl:for-each select="@ed:resolves|ed:resolves">
4485    <xsl:variable name="resolves" select="."/>
4486    <!-- need the right context node for proper numbering -->
4487    <xsl:variable name="count"><xsl:for-each select=".."><xsl:number level="any" count="*[@ed:resolves=$resolves or ed:resolves=$resolves]"/></xsl:for-each></xsl:variable>
4488    <xsl:variable name="total" select="count(//*[@ed:resolves=$resolves or ed:resolves=$resolves])"/>
4489    <xsl:variable name="id">
4490      <xsl:value-of select="$anchor-prefix"/>.change.<xsl:value-of select="$resolves"/>.<xsl:value-of select="$count"/>
4491    </xsl:variable>
4492    <xsl:choose>
4493      <!-- block level? -->
4494      <xsl:when test="not(ancestor::t) and not(ancestor::title) and not(ancestor::figure) and not($change/@ed:old-title)">
4495        <div xmlns="http://www.w3.org/1999/xhtml" class="issuepointer noprint">
4496          <xsl:if test="not($deleted-anchor)">
4497            <xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
4498          </xsl:if>
4499          <xsl:if test="$count &gt; 1">
4500            <a class="bg-issue" title="previous change for {$resolves}" href="#{$anchor-prefix}.change.{$resolves}.{$count - 1}">&#8593;</a>
4501          </xsl:if>
4502          <a class="open-issue" href="#{$anchor-prefix}.issue.{$resolves}" title="resolves: {$resolves}">
4503            <xsl:choose>
4504              <xsl:when test="//ed:issue[@name=$resolves and @status='closed']">
4505                <xsl:attribute name="class">closed-issue</xsl:attribute>
4506              </xsl:when>
4507              <xsl:when test="//ed:issue[@name=$resolves and @status='editor']">
4508                <xsl:attribute name="class">editor-issue</xsl:attribute>
4509              </xsl:when>
4510              <xsl:otherwise>
4511                <xsl:attribute name="class">open-issue</xsl:attribute>
4512              </xsl:otherwise>
4513            </xsl:choose>
4514            <xsl:text> I </xsl:text>
4515          </a>
4516          <xsl:if test="$count &lt; $total">
4517            <a class="bg-issue" title="next change for {$resolves}" href="#{$anchor-prefix}.change.{$resolves}.{$count + 1}">&#8595;</a>
4518          </xsl:if>
4519          <xsl:text> </xsl:text>
4520        </div>
4521      </xsl:when>
4522      <xsl:otherwise>
4523        <xsl:if test="$count &gt; 1">
4524          <a xmlns="http://www.w3.org/1999/xhtml" class="bg-issue" title="previous change for {$resolves}" href="#{$anchor-prefix}.change.{$resolves}.{$count - 1}">&#8593;</a>
4525        </xsl:if>
4526        <a xmlns="http://www.w3.org/1999/xhtml" title="resolves: {$resolves}" href="#{$anchor-prefix}.issue.{$resolves}">
4527          <xsl:if test="not($deleted-anchor)">
4528            <xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
4529          </xsl:if>
4530          <xsl:choose>
4531            <xsl:when test="//ed:issue[@name=$resolves and @status='closed']">
4532              <xsl:attribute name="class">closed-issue noprint</xsl:attribute>
4533            </xsl:when>
4534            <xsl:when test="//ed:issue[@name=$resolves and @status='editor']">
4535              <xsl:attribute name="class">editor-issue noprint</xsl:attribute>
4536            </xsl:when>
4537            <xsl:otherwise>
4538              <xsl:attribute name="class">open-issue noprint</xsl:attribute>
4539            </xsl:otherwise>
4540          </xsl:choose>
4541          <xsl:text> I </xsl:text>
4542        </a>
4543        <xsl:if test="$count &lt; $total">
4544          <a xmlns="http://www.w3.org/1999/xhtml" class="bg-issue" title="next change for {$resolves}" href="#{$anchor-prefix}.change.{$resolves}.{$count + 1}">&#8595;</a>
4545        </xsl:if>
4546      </xsl:otherwise>
4547    </xsl:choose>
4548  </xsl:for-each>
4549</xsl:template>
4550
4551<xsl:template match="ed:replace">
4552  <!-- we need to special-case things like lists and tables -->
4553  <xsl:choose>
4554    <xsl:when test="parent::list">
4555      <xsl:apply-templates select="ed:del/node()"/>
4556      <xsl:apply-templates select="ed:ins/node()"/>
4557    </xsl:when>
4558    <xsl:when test="ancestor::references">
4559      <xsl:apply-templates select="ed:del/node()"/>
4560      <xsl:apply-templates select="ed:ins/node()"/>
4561    </xsl:when>
4562    <xsl:otherwise>
4563      <xsl:if test="@cite">
4564        <a xmlns="http://www.w3.org/1999/xhtml" class="editor-issue" href="{@cite}" target="_blank" title="see {@cite}">
4565          <xsl:text> i </xsl:text>
4566        </a>
4567      </xsl:if>
4568      <xsl:call-template name="insert-issue-pointer"/>
4569      <xsl:if test="ed:del">
4570        <del xmlns="http://www.w3.org/1999/xhtml">
4571          <xsl:copy-of select="@*[namespace-uri()='']"/>
4572          <xsl:if test="not(@title) and ancestor-or-self::xsl:template[@ed:entered-by] and @datetime">
4573            <xsl:attribute name="title"><xsl:value-of select="concat(@datetime,', ',ancestor-or-self::*[@ed:entered-by][1]/@ed:entered-by)"/></xsl:attribute>
4574          </xsl:if>
4575          <xsl:apply-templates select="ed:del/node()"/>
4576        </del>
4577      </xsl:if>
4578      <xsl:if test="ed:ins">
4579        <ins xmlns="http://www.w3.org/1999/xhtml">
4580          <xsl:copy-of select="@*[namespace-uri()='']"/>
4581          <xsl:if test="not(@title) and ancestor-or-self::*[@ed:entered-by] and @datetime">
4582            <xsl:attribute name="title"><xsl:value-of select="concat(@datetime,', ',ancestor-or-self::*[@ed:entered-by][1]/@ed:entered-by)"/></xsl:attribute>
4583          </xsl:if>
4584          <xsl:apply-templates select="ed:ins/node()"/>
4585        </ins>
4586      </xsl:if>
4587    </xsl:otherwise>
4588  </xsl:choose>
4589</xsl:template>
4590
4591<!-- convenience template for helping Mozilla (pre/ins inheritance problem) -->
4592<xsl:template name="insertInsDelClass">
4593  <xsl:if test="ancestor::ed:del">
4594    <xsl:attribute name="class">del</xsl:attribute>
4595  </xsl:if>
4596  <xsl:if test="ancestor::ed:ins">
4597    <xsl:attribute name="class">ins</xsl:attribute>
4598  </xsl:if>
4599</xsl:template>
4600
4601
4602<xsl:template name="sectionnumberAndEdits">
4603  <xsl:choose>
4604    <xsl:when test="ancestor::ed:del">del-<xsl:number count="ed:del//section" level="any"/></xsl:when>
4605    <xsl:when test="@x:fixed-section-number">
4606      <xsl:value-of select="@x:fixed-section-number"/>
4607    </xsl:when>
4608    <xsl:when test="self::section and parent::ed:ins and local-name(../..)='replace'">
4609      <xsl:for-each select="../.."><xsl:call-template name="sectionnumberAndEdits"/></xsl:for-each>
4610      <xsl:for-each select="..">
4611        <xsl:if test="parent::ed:replace">
4612          <xsl:for-each select="..">
4613            <xsl:if test="parent::section">.</xsl:if>
4614            <xsl:variable name="cnt" select="1+count(preceding-sibling::section|preceding-sibling::ed:ins/section|preceding-sibling::ed:replace/ed:ins/section)"/>
4615            <xsl:choose>
4616              <xsl:when test="ancestor::back and not(ancestor::section)"><xsl:number format="A" value="$cnt"/></xsl:when>
4617              <xsl:otherwise><xsl:value-of select="$cnt"/></xsl:otherwise>
4618            </xsl:choose>
4619          </xsl:for-each>
4620        </xsl:if>
4621      </xsl:for-each>
4622    </xsl:when>
4623    <xsl:when test="self::section[parent::ed:ins]">
4624      <xsl:for-each select="../.."><xsl:call-template name="sectionnumberAndEdits"/></xsl:for-each>
4625      <xsl:for-each select="..">
4626        <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)"/>
4627      </xsl:for-each>
4628    </xsl:when>
4629    <xsl:when test="self::section">
4630      <xsl:for-each select=".."><xsl:call-template name="sectionnumberAndEdits"/></xsl:for-each>
4631      <xsl:if test="parent::section">.</xsl:if>
4632      <xsl:choose>
4633        <xsl:when test="parent::back">
4634          <xsl:number format="A" value="1+count(preceding-sibling::section|preceding-sibling::ed:ins/section|preceding-sibling::ed:replace/ed:ins/section)"/>
4635        </xsl:when>
4636        <xsl:otherwise>
4637          <xsl:number value="1+count(preceding-sibling::section|preceding-sibling::ed:ins/section|preceding-sibling::ed:replace/ed:ins/section)"/>
4638        </xsl:otherwise>
4639      </xsl:choose>
4640    </xsl:when>
4641    <xsl:when test="self::references">
4642      <xsl:choose>
4643        <xsl:when test="count(/*/back/references)+count(/*/back/ed:replace/ed:ins/references)=1"><xsl:call-template name="get-references-section-number"/></xsl:when>
4644        <xsl:otherwise><xsl:call-template name="get-references-section-number"/>.<xsl:number level="any"/></xsl:otherwise>
4645      </xsl:choose>
4646    </xsl:when>
4647    <xsl:when test="self::middle or self::back"><!-- done --></xsl:when>
4648    <xsl:otherwise>
4649      <!-- go up one level -->
4650      <xsl:for-each select=".."><xsl:call-template name="sectionnumberAndEdits"/></xsl:for-each>
4651    </xsl:otherwise>
4652  </xsl:choose>
4653</xsl:template>
4654
4655<!-- utilities for warnings -->
4656
4657<xsl:template name="warning">
4658  <xsl:param name="msg"/>
4659  <xsl:param name="msg2"/>
4660  <xsl:param name="inline"/>
4661  <xsl:if test="$inline!='no'">
4662    <div xmlns="http://www.w3.org/1999/xhtml" class="error">WARNING: <xsl:value-of select="$msg"/><xsl:value-of select="$msg2"/></div>
4663  </xsl:if>
4664  <xsl:message>WARNING: <xsl:value-of select="$msg"/><xsl:value-of select="$msg2"/><xsl:call-template name="lineno"/></xsl:message>
4665</xsl:template>
4666
4667<xsl:template name="error">
4668  <xsl:param name="msg"/>
4669  <xsl:param name="msg2"/>
4670  <xsl:param name="inline"/>
4671  <xsl:if test="$inline!='no'">
4672    <div xmlns="http://www.w3.org/1999/xhtml" class="error">ERROR: <xsl:value-of select="$msg"/><xsl:value-of select="$msg2"/></div>
4673  </xsl:if>
4674  <xsl:message>ERROR: <xsl:value-of select="$msg"/><xsl:value-of select="$msg2"/><xsl:call-template name="lineno"/></xsl:message>
4675</xsl:template>
4676
4677<!-- table formatting -->
4678
4679<xsl:template match="texttable">
4680
4681  <xsl:variable name="anch">
4682    <xsl:call-template name="get-table-anchor"/>
4683  </xsl:variable>
4684
4685  <div xmlns="http://www.w3.org/1999/xhtml" id="{$anch}">
4686    <xsl:if test="@anchor!=''">
4687      <div id="{@anchor}"/>
4688    </xsl:if>
4689    <xsl:apply-templates select="preamble"/>
4690    <xsl:variable name="style">
4691      <xsl:text>tt </xsl:text>
4692      <xsl:choose>
4693        <xsl:when test="@style!=''">
4694          <xsl:value-of select="@style"/>
4695        </xsl:when>
4696        <xsl:otherwise>full</xsl:otherwise>
4697      </xsl:choose>
4698    </xsl:variable>
4699    <table summary="{preamble}" class="{$style}" cellpadding="3" cellspacing="0">
4700      <xsl:if test="ttcol!=''">
4701        <!-- skip header when all column titles are empty -->
4702        <thead>
4703          <tr>
4704            <xsl:apply-templates select="ttcol"/>
4705          </tr>
4706        </thead>
4707      </xsl:if>
4708      <tbody>
4709        <xsl:variable name="columns" select="count(ttcol)"/>
4710        <xsl:variable name="fields" select="c | ed:replace/ed:ins/c | ed:replace/ed:del/c"/>
4711        <xsl:for-each select="$fields[(position() mod $columns) = 1]">
4712          <tr>
4713            <xsl:for-each select=". | following-sibling::c[position() &lt; $columns]">
4714              <td>
4715                <xsl:call-template name="insertInsDelClass"/>
4716                <xsl:variable name="pos" select="position()"/>
4717                <xsl:variable name="col" select="../ttcol[position() = $pos]"/>
4718                <xsl:choose>
4719                  <xsl:when test="$col/@align='right' or $col/@align='center'">
4720                    <xsl:attribute name="class"><xsl:value-of select="$col/@align"/></xsl:attribute>
4721                  </xsl:when>
4722                  <xsl:when test="$col/@align='left' or not($col/@align)">
4723                    <!-- that's the default, nothing to do here -->
4724                  </xsl:when>
4725                  <xsl:otherwise>
4726                    <xsl:message>Unknown align attribute on ttcol: <xsl:value-of select="$col/@align"/></xsl:message>
4727                  </xsl:otherwise>
4728                </xsl:choose>
4729                <xsl:apply-templates select="node()"/>
4730              </td>
4731            </xsl:for-each>
4732          </tr>
4733        </xsl:for-each>
4734      </tbody>
4735    </table>
4736    <xsl:apply-templates select="postamble"/>
4737
4738    <xsl:if test="(@title!='' or @anchor!='') and not(@suppress-title='true')">
4739      <xsl:variable name="n"><xsl:number level="any" count="texttable[(@title!='' or @anchor!='') and not(@suppress-title='true')]"/></xsl:variable>
4740      <p class="figure">Table <xsl:value-of select="$n"/><xsl:if test="@title!=''">: <xsl:value-of select="@title"/></xsl:if></p>
4741    </xsl:if>
4742  </div>
4743 
4744</xsl:template>
4745
4746<xsl:template match="ttcol">
4747  <th xmlns="http://www.w3.org/1999/xhtml">
4748   
4749    <xsl:choose>
4750      <xsl:when test="@align='right' or @align='center' or @align='left'">
4751        <xsl:attribute name="class"><xsl:value-of select="@align"/></xsl:attribute>
4752      </xsl:when>
4753      <xsl:when test="not(@align)">
4754        <!-- that's the default, nothing to do here -->
4755      </xsl:when>
4756      <xsl:otherwise>
4757        <xsl:message>Unknown align attribute on ttcol: <xsl:value-of select="@align"/></xsl:message>
4758      </xsl:otherwise>
4759    </xsl:choose>
4760   
4761    <xsl:if test="@width">
4762      <xsl:attribute name="style">width: <xsl:value-of select="@width"/>;</xsl:attribute>
4763    </xsl:if>
4764
4765    <xsl:apply-templates/>
4766  </th>
4767</xsl:template>
4768
4769<!-- cref support -->
4770
4771<xsl:template match="cref">
4772  <xsl:if test="$xml2rfc-comments!='no'">
4773    <xsl:variable name="cid">
4774      <xsl:choose>
4775        <xsl:when test="@anchor">
4776          <xsl:value-of select="@anchor"/>
4777        </xsl:when>
4778        <xsl:otherwise>
4779          <xsl:value-of select="$anchor-prefix"/>
4780          <xsl:text>.comment.</xsl:text>
4781          <xsl:number count="cref[not(@anchor)]" level="any"/>
4782        </xsl:otherwise>
4783      </xsl:choose>
4784    </xsl:variable>
4785   
4786    <span xmlns="http://www.w3.org/1999/xhtml" class="comment">
4787      <xsl:if test="$xml2rfc-inline!='yes'">
4788        <xsl:attribute name="title">
4789          <xsl:if test="@source"><xsl:value-of select="@source"/>: </xsl:if>
4790          <xsl:apply-templates select="text()|eref"/>
4791        </xsl:attribute>
4792      </xsl:if>
4793      <xsl:text>[</xsl:text>
4794      <xsl:choose>
4795        <xsl:when test="$xml2rfc-inline='yes'">
4796          <xsl:value-of select="$cid"/>
4797          <xsl:text>: </xsl:text>
4798          <xsl:apply-templates select="text()|eref"/>
4799          <xsl:if test="@source"> --<xsl:value-of select="@source"/></xsl:if>
4800        </xsl:when>
4801        <xsl:otherwise>
4802          <a href="#{$cid}">
4803            <xsl:value-of select="$cid"/>
4804          </a>
4805        </xsl:otherwise>
4806      </xsl:choose>
4807      <xsl:text>]</xsl:text>
4808    </span>
4809  </xsl:if>
4810</xsl:template>
4811
4812<xsl:template name="insertComments">
4813
4814  <xsl:call-template name="insert-conditional-hrule"/>
4815   
4816  <h1 xmlns="http://www.w3.org/1999/xhtml">
4817    <xsl:call-template name="insert-conditional-pagebreak"/>
4818    <a id="{$anchor-prefix}.comments" href="#{$anchor-prefix}.comments">Editorial Comments</a>
4819  </h1>
4820
4821  <dl xmlns="http://www.w3.org/1999/xhtml">
4822    <xsl:for-each select="//cref">
4823      <xsl:variable name="cid">
4824        <xsl:choose>
4825          <xsl:when test="@anchor">
4826            <xsl:value-of select="@anchor"/>
4827          </xsl:when>
4828          <xsl:otherwise>
4829            <xsl:value-of select="$anchor-prefix"/>
4830            <xsl:text>.comment.</xsl:text>
4831            <xsl:number count="cref[not(@anchor)]" level="any"/>
4832          </xsl:otherwise>
4833        </xsl:choose>
4834      </xsl:variable>
4835      <dt id="{$cid}">
4836        [<xsl:value-of select="$cid"/>]
4837      </dt>
4838      <dd>
4839        <xsl:apply-templates select="node()"/>
4840        <xsl:if test="@source"> --<xsl:value-of select="@source"/></xsl:if>
4841      </dd>
4842    </xsl:for-each>
4843  </dl>
4844</xsl:template>
4845
4846
4847<!-- Chapter Link Generation -->
4848
4849<xsl:template match="*" mode="links"><xsl:apply-templates mode="links"/></xsl:template>
4850<xsl:template match="text()" mode="links"/>
4851
4852<xsl:template match="/*/middle//section[not(myns:unnumbered) and not(ancestor::section)]" mode="links">
4853  <xsl:variable name="sectionNumber"><xsl:call-template name="get-section-number"/></xsl:variable>
4854  <link xmlns="http://www.w3.org/1999/xhtml" rel="Chapter" title="{$sectionNumber} {@title}" href="#{$anchor-prefix}.section.{$sectionNumber}"/>
4855  <xsl:apply-templates mode="links"/>
4856</xsl:template>
4857
4858<xsl:template match="/*/back//section[not(myns:unnumbered) and not(ancestor::section)]" mode="links">
4859  <xsl:variable name="sectionNumber"><xsl:call-template name="get-section-number"/></xsl:variable>
4860  <link xmlns="http://www.w3.org/1999/xhtml" rel="Appendix" title="{$sectionNumber} {@title}" href="#{$anchor-prefix}.section.{$sectionNumber}"/>
4861  <xsl:apply-templates mode="links"/>
4862</xsl:template>
4863
4864<xsl:template match="/*/back/references[position()=1]" mode="links">
4865  <xsl:variable name="sectionNumber"><xsl:call-template name="get-references-section-number"/></xsl:variable>
4866  <link xmlns="http://www.w3.org/1999/xhtml" rel="Chapter" href="#{$anchor-prefix}.section.{$sectionNumber}">
4867    <xsl:choose>
4868      <xsl:when test="@title and count(/*/back/references)=1">
4869        <xsl:attribute name="title">
4870          <xsl:call-template name="get-references-section-number"/>
4871          <xsl:text> </xsl:text>
4872          <xsl:value-of select="@title"/>
4873        </xsl:attribute>
4874      </xsl:when>
4875      <xsl:otherwise>
4876        <xsl:attribute name="title">
4877          <xsl:call-template name="get-references-section-number"/>
4878          <xsl:text> References</xsl:text>
4879        </xsl:attribute>
4880      </xsl:otherwise>
4881    </xsl:choose>
4882  </link>
4883</xsl:template>
4884
4885<!-- convenience templates -->
4886
4887<xsl:template name="get-author-summary">
4888  <xsl:choose>
4889    <xsl:when test="count(/rfc/front/author)=1">
4890      <xsl:value-of select="/rfc/front/author[1]/@surname"/>
4891    </xsl:when>
4892    <xsl:when test="count(/rfc/front/author)=2">
4893      <xsl:value-of select="concat(/rfc/front/author[1]/@surname,' &amp; ',/rfc/front/author[2]/@surname)"/>
4894    </xsl:when>
4895    <xsl:otherwise>
4896      <xsl:value-of select="concat(/rfc/front/author[1]/@surname,', et al.')"/>
4897    </xsl:otherwise>
4898  </xsl:choose>
4899</xsl:template>
4900
4901<xsl:template name="get-authors">
4902  <xsl:for-each select="/rfc/front/author">
4903    <xsl:value-of select="@fullname"/>
4904    <xsl:if test="position()!=last()">, </xsl:if>
4905  </xsl:for-each>
4906</xsl:template>
4907
4908<xsl:template name="get-category-long">
4909  <xsl:choose>
4910    <xsl:when test="$xml2rfc-footer"><xsl:value-of select="$xml2rfc-footer"/></xsl:when>
4911    <xsl:when test="$xml2rfc-private"/> <!-- private draft, footer not set -->
4912    <xsl:when test="/rfc/@category='bcp'">Best Current Practice</xsl:when>
4913    <xsl:when test="/rfc/@category='historic'">Historic</xsl:when>
4914    <xsl:when test="/rfc/@category='info' or not(/rfc/@category)">Informational</xsl:when>
4915    <xsl:when test="/rfc/@category='std'">Standards Track</xsl:when>
4916    <xsl:when test="/rfc/@category='exp'">Experimental</xsl:when>
4917    <xsl:otherwise>(category unknown)</xsl:otherwise>
4918  </xsl:choose>
4919</xsl:template>
4920
4921<xsl:template name="get-header-center">
4922  <xsl:choose>
4923    <xsl:when test="string-length(/rfc/front/title/@abbrev) &gt; 0">
4924      <xsl:value-of select="/rfc/front/title/@abbrev"/>
4925    </xsl:when>
4926    <xsl:otherwise>
4927      <xsl:apply-templates select="/rfc/front/title" mode="get-text-content"/>
4928    </xsl:otherwise>
4929  </xsl:choose>
4930</xsl:template>
4931
4932<xsl:template name="get-header-left">
4933  <xsl:choose>
4934    <xsl:when test="$xml2rfc-header"><xsl:value-of select="$xml2rfc-header"/></xsl:when>
4935    <xsl:when test="$xml2rfc-private"/> <!-- private draft, header not set -->
4936    <xsl:when test="/rfc/@ipr and not(/rfc/@number)">INTERNET DRAFT</xsl:when>
4937    <xsl:otherwise>RFC <xsl:value-of select="/rfc/@number"/></xsl:otherwise>
4938  </xsl:choose>
4939</xsl:template>
4940
4941<xsl:template name="get-generator">
4942  <xsl:variable name="gen">
4943    <xsl:text>http://greenbytes.de/tech/webdav/rfc2629.xslt, </xsl:text>
4944    <!-- when RCS keyword substitution in place, add version info -->
4945    <xsl:if test="contains('$Revision: 1.400 $',':')">
4946      <xsl:value-of select="concat('Revision ',normalize-space(translate(substring-after('$Revision: 1.400 $', 'Revision: '),'$','')),', ')"/>
4947    </xsl:if>
4948    <xsl:if test="contains('$Date: 2008-10-10 14:04:14 $',':')">
4949      <xsl:value-of select="concat(normalize-space(translate(substring-after('$Date: 2008-10-10 14:04:14 $', 'Date: '),'$','')),', ')"/>
4950    </xsl:if>
4951    <xsl:value-of select="concat('XSLT vendor: ',system-property('xsl:vendor'),' ',system-property('xsl:vendor-url'))"/>
4952  </xsl:variable>
4953  <xsl:value-of select="$gen"/>
4954</xsl:template>
4955
4956<xsl:template name="get-header-right">
4957  <xsl:value-of select="concat($xml2rfc-ext-pub-month, ' ', $xml2rfc-ext-pub-year)"/>
4958</xsl:template>
4959
4960<xsl:template name="get-keywords">
4961  <xsl:variable name="keyw">
4962    <xsl:for-each select="/rfc/front/keyword">
4963      <xsl:value-of select="translate(.,',',' ')"/>
4964      <xsl:if test="position()!=last()">, </xsl:if>
4965    </xsl:for-each>
4966  </xsl:variable>
4967  <xsl:value-of select="normalize-space($keyw)"/>
4968</xsl:template>
4969
4970<!-- get language from context node. nearest ancestor or return the default of "en" -->
4971<xsl:template name="get-lang">
4972  <xsl:choose>
4973    <xsl:when test="ancestor-or-self::*[@xml:lang]"><xsl:value-of select="ancestor-or-self::*/@xml:lang"/></xsl:when>
4974    <xsl:otherwise>en</xsl:otherwise>
4975  </xsl:choose>
4976</xsl:template>
4977
4978<xsl:template name="get-section-number">
4979  <xsl:variable name="anchor" select="@anchor"/>
4980  <xsl:choose>
4981    <xsl:when test="@x:fixed-section-number">
4982      <xsl:value-of select="@x:fixed-section-number"/>
4983    </xsl:when>
4984    <xsl:when test="$has-edits or ancestor::*/@x:fixed-section-number">
4985      <xsl:call-template name="sectionnumberAndEdits"/>
4986    </xsl:when>
4987    <xsl:otherwise>
4988      <xsl:choose>
4989        <xsl:when test="self::references">
4990          <xsl:choose>
4991            <xsl:when test="count(/*/back/references)=1">
4992              <xsl:call-template name="get-references-section-number"/>
4993            </xsl:when>
4994            <xsl:otherwise>
4995              <xsl:call-template name="get-references-section-number"/>.<xsl:number count="references"/>
4996            </xsl:otherwise>
4997          </xsl:choose>
4998        </xsl:when>
4999        <xsl:when test="self::reference">
5000          <xsl:for-each select="parent::references">
5001            <xsl:choose>
5002              <xsl:when test="count(/*/back/references)=1">
5003                <xsl:call-template name="get-references-section-number"/>
5004              </xsl:when>
5005              <xsl:otherwise>
5006                <xsl:call-template name="get-references-section-number"/>.<xsl:number count="references"/>
5007              </xsl:otherwise>
5008            </xsl:choose>
5009          </xsl:for-each>
5010        </xsl:when>
5011        <xsl:when test="ancestor::reference">
5012          <xsl:for-each select="ancestor::reference">
5013            <xsl:call-template name="get-section-number"/>
5014          </xsl:for-each>
5015        </xsl:when>
5016        <xsl:when test="ancestor::back"><xsl:number count="section|appendix" level="multiple" format="A.1.1.1.1.1.1.1"/></xsl:when>
5017        <xsl:when test="self::appendix"><xsl:number count="appendix" level="multiple" format="A.1.1.1.1.1.1.1"/></xsl:when>
5018        <xsl:otherwise><xsl:number count="section" level="multiple"/></xsl:otherwise>
5019      </xsl:choose>
5020    </xsl:otherwise>
5021  </xsl:choose>
5022</xsl:template>
5023
5024<!-- get the section number for the references section -->
5025<xsl:template name="get-references-section-number">
5026  <xsl:value-of select="count(/rfc/middle/section) + count(/rfc/middle/ed:replace/ed:ins/section) + 1"/>
5027</xsl:template>
5028
5029<xsl:template name="emit-section-number">
5030  <xsl:param name="no"/>
5031  <xsl:value-of select="$no"/><xsl:if test="not(contains($no,'.')) or $xml2rfc-ext-sec-no-trailing-dots='yes'">.</xsl:if>
5032</xsl:template>
5033
5034<xsl:template name="get-section-type">
5035  <xsl:param name="prec"/> <!-- TODO: check this, it's unused -->
5036  <xsl:choose>
5037    <xsl:when test="ancestor::back">Appendix</xsl:when>
5038    <xsl:otherwise>Section</xsl:otherwise>
5039  </xsl:choose>
5040</xsl:template>
5041
5042<xsl:template name="get-table-anchor">
5043  <xsl:value-of select="$anchor-prefix"/>
5044  <xsl:text>.table.</xsl:text>
5045  <xsl:choose>
5046    <xsl:when test="@title!='' or @anchor!=''">
5047      <xsl:number level="any" count="texttable[@title!='' or @anchor!='']"/>
5048    </xsl:when>
5049    <xsl:otherwise>
5050      <xsl:text>u.</xsl:text>
5051      <xsl:number level="any" count="texttable[not(@title!='' or @anchor!='')]"/>
5052    </xsl:otherwise>
5053  </xsl:choose>
5054</xsl:template>
5055
5056<xsl:template name="get-figure-anchor">
5057  <xsl:value-of select="$anchor-prefix"/>
5058  <xsl:text>.figure.</xsl:text>
5059  <xsl:choose>
5060    <xsl:when test="@title!='' or @anchor!=''">
5061      <xsl:number level="any" count="figure[@title!='' or @anchor!='']"/>
5062    </xsl:when>
5063    <xsl:otherwise>
5064      <xsl:text>u.</xsl:text>
5065      <xsl:number level="any" count="figure[not(@title!='' or @anchor!='')]"/>
5066    </xsl:otherwise>
5067  </xsl:choose>
5068</xsl:template>
5069
5070<!-- reformat contents of author/@initials -->
5071<xsl:template name="format-initials">
5072  <xsl:choose>
5073    <xsl:when test="string-length(@initials)=1">
5074      <xsl:value-of select="concat(@initials,'.')"/>
5075    </xsl:when>
5076    <xsl:otherwise>
5077      <xsl:value-of select="@initials"/>
5078    </xsl:otherwise>
5079  </xsl:choose>
5080</xsl:template>
5081
5082<!-- checking for email element -->
5083<xsl:template name="extract-email">
5084  <xsl:variable name="email" select="normalize-space(.)"/>
5085  <xsl:if test="string-length(.) != string-length($email) or contains($email,' ')">
5086    <xsl:call-template name="warning">
5087      <xsl:with-param name="inline" select="'no'"/>
5088      <xsl:with-param name="msg">excessive whitespace in email address: '<xsl:value-of select="."/>'</xsl:with-param>
5089    </xsl:call-template>
5090  </xsl:if>
5091 
5092  <xsl:variable name="email2">
5093    <xsl:choose>
5094      <xsl:when test="starts-with($email,'mailto:')">
5095        <xsl:call-template name="warning">
5096          <xsl:with-param name="inline" select="'no'"/>
5097          <xsl:with-param name="msg">email should not include URI scheme: '<xsl:value-of select="."/>'</xsl:with-param>
5098        </xsl:call-template>
5099        <xsl:value-of select="substring($email, 1 + string-length('mailto:'))"/>
5100      </xsl:when>
5101      <xsl:otherwise>
5102        <xsl:value-of select="$email"/>
5103      </xsl:otherwise>
5104    </xsl:choose>
5105  </xsl:variable>
5106 
5107  <xsl:value-of select="$email2"/>
5108</xsl:template>
5109
5110<!-- checking for uri element -->
5111<xsl:template name="extract-uri">
5112  <xsl:variable name="uri" select="normalize-space(.)"/>
5113  <xsl:if test="string-length(.) != string-length($uri) or contains($uri,' ')">
5114    <xsl:call-template name="warning">
5115      <xsl:with-param name="inline" select="'no'"/>
5116      <xsl:with-param name="msg">excessive whitespace in URI: '<xsl:value-of select="."/>'</xsl:with-param>
5117    </xsl:call-template>
5118  </xsl:if>
5119 
5120  <xsl:value-of select="$uri"/>
5121</xsl:template>
5122
5123<xsl:template name="insert-conditional-pagebreak">
5124  <xsl:if test="$xml2rfc-compact!='yes'">
5125    <xsl:attribute name="class">np</xsl:attribute>
5126  </xsl:if>
5127</xsl:template>
5128
5129<xsl:template name="insert-conditional-hrule">
5130  <xsl:if test="$xml2rfc-compact!='yes'">
5131    <hr xmlns="http://www.w3.org/1999/xhtml" class="noprint"/>
5132  </xsl:if>
5133</xsl:template>
5134
5135<!-- get text content from marked-up text -->
5136
5137<xsl:template match="text()" mode="get-text-content">
5138  <xsl:value-of select="."/>
5139</xsl:template>
5140
5141<xsl:template match="*" mode="get-text-content">
5142  <xsl:apply-templates mode="get-text-content"/>
5143</xsl:template>
5144
5145<xsl:template match="ed:del" mode="get-text-content">
5146</xsl:template>
5147
5148<!-- diag support -->
5149<xsl:template name="lineno">
5150  <xsl:if test="function-available('saxon-old:line-number')">
5151    <xsl:if test="saxon-old:line-number() &gt; 0">
5152      <xsl:text> (at line </xsl:text>
5153      <xsl:value-of select="saxon-old:line-number()"/>
5154      <xsl:text>)</xsl:text>
5155    </xsl:if>
5156  </xsl:if>
5157  <xsl:if test="function-available('saxon:line-number')">
5158    <xsl:if test="saxon:line-number() &gt; 0">
5159      <xsl:text> (at line </xsl:text>
5160      <xsl:value-of select="saxon:line-number()"/>
5161      <xsl:text>)</xsl:text>
5162    </xsl:if>
5163  </xsl:if>
5164</xsl:template>
5165
5166<!-- define exslt:node-set for msxml -->       
5167<msxsl:script language="JScript" implements-prefix="exslt">
5168  this['node-set'] = function (x) {
5169    return x;
5170  }
5171</msxsl:script>
5172
5173<!-- date handling -->
5174
5175<msxsl:script language="JScript" implements-prefix="date">
5176  this['year'] = function (x) {
5177    if (x) {throw "not supported"};
5178    return (new Date()).getFullYear();
5179  }
5180
5181  this['month-in-year'] = function (x) {
5182    if (x) {throw "not supported"};
5183    return 1 + (new Date()).getMonth();
5184  }
5185
5186  this['day-in-month'] = function (x) {
5187    if (x) {throw "not supported"};
5188    return (new Date()).getDate();
5189  }
5190</msxsl:script>
5191
5192<xsl:variable name="may-default-dates">
5193  <xsl:choose>
5194    <xsl:when test="function-available('date:year') and function-available('date:month-in-year') and date:day-in-month()">
5195      <xsl:variable name="year-specified" select="/rfc/front/date/@year and /rfc/front/date/@year!=''"/>
5196      <xsl:variable name="month-specified" select="/rfc/front/date/@month and /rfc/front/date/@month!=''"/>
5197      <xsl:variable name="day-specified" select="/rfc/front/date/@day and /rfc/front/date/@day!=''"/>
5198      <xsl:variable name="system-month">
5199        <xsl:call-template name="get-month-as-name">
5200          <xsl:with-param name="month" select="date:month-in-year()"/>
5201        </xsl:call-template>
5202      </xsl:variable>
5203      <xsl:choose>
5204        <xsl:when test="$year-specified and /rfc/front/date/@year!=date:year()">Specified year <xsl:value-of select="/rfc/front/date/@year"/> does not match system date (<xsl:value-of select="date:year()"/>)</xsl:when>
5205        <xsl:when test="$month-specified and /rfc/front/date/@month!=$system-month">Specified month <xsl:value-of select="/rfc/front/date/@month"/> does not match system date (<xsl:value-of select="$system-month"/>)</xsl:when>
5206        <xsl:when test="$day-specified and /rfc/front/date/@day!=date:day-in-month()">Specified day does not match system date</xsl:when>
5207        <xsl:when test="not($year-specified) and ($month-specified or $day-specified)">Can't default year when month or day is specified</xsl:when>
5208        <xsl:when test="not($month-specified) and $day-specified">Can't default month when day is specified</xsl:when>
5209        <xsl:otherwise>yes</xsl:otherwise>
5210      </xsl:choose>
5211    </xsl:when>
5212    <!-- may, but won't -->
5213    <xsl:otherwise>yes</xsl:otherwise> 
5214  </xsl:choose>
5215</xsl:variable>
5216
5217<xsl:param name="xml2rfc-ext-pub-year">
5218  <xsl:choose>
5219    <xsl:when test="/rfc/front/date/@year and /rfc/front/date/@year!=''">
5220      <xsl:value-of select="/rfc/front/date/@year"/>
5221    </xsl:when>
5222    <xsl:when test="function-available('date:year')">
5223      <xsl:if test="/rfc/front/date/@month and /rfc/front/date/@month!=''">
5224        <xsl:call-template name="error">
5225          <xsl:with-param name="msg" select="'defaulting publication year although month was specified'"/>
5226        </xsl:call-template>
5227      </xsl:if>
5228      <xsl:if test="/rfc/front/date/@day and /rfc/front/date/@day!=''">
5229        <xsl:call-template name="error">
5230          <xsl:with-param name="msg" select="'defaulting publication year although day was specified'"/>
5231        </xsl:call-template>
5232      </xsl:if>
5233      <xsl:value-of select="date:year()"/>
5234    </xsl:when>
5235    <xsl:otherwise>
5236      <xsl:call-template name="error">
5237        <xsl:with-param name="msg" select="'/rfc/front/date/@year missing (and XSLT processor cannot compute the system date)'"/>
5238      </xsl:call-template>
5239    </xsl:otherwise>
5240  </xsl:choose>
5241</xsl:param>
5242
5243<xsl:param name="xml2rfc-ext-pub-month">
5244  <xsl:choose>
5245    <xsl:when test="/rfc/front/date/@month and /rfc/front/date/@month!=''">
5246      <xsl:value-of select="/rfc/front/date/@month"/>
5247    </xsl:when>
5248    <xsl:when test="function-available('date:month-in-year') and $may-default-dates='yes'">
5249      <xsl:call-template name="get-month-as-name">
5250        <xsl:with-param name="month" select="date:month-in-year()"/>
5251      </xsl:call-template>
5252    </xsl:when>
5253    <xsl:when test="function-available('date:month-in-year') and $may-default-dates!='yes'">
5254      <xsl:call-template name="warning">
5255        <xsl:with-param name="inline" select="'no'"/>
5256        <xsl:with-param name="msg" select="$may-default-dates"/>
5257      </xsl:call-template>
5258    </xsl:when>
5259    <xsl:otherwise>
5260      <xsl:call-template name="error">
5261        <xsl:with-param name="msg" select="'/rfc/front/date/@month missing (and XSLT processor cannot compute the system date)'"/>
5262      </xsl:call-template>
5263    </xsl:otherwise>
5264  </xsl:choose>
5265</xsl:param>
5266
5267<xsl:param name="xml2rfc-ext-pub-month-numeric">
5268  <xsl:call-template name="get-month-as-num">
5269    <xsl:with-param name="month" select="$xml2rfc-ext-pub-month"/>
5270  </xsl:call-template>
5271</xsl:param>
5272
5273<xsl:param name="xml2rfc-ext-pub-day">
5274  <xsl:choose>
5275    <xsl:when test="/rfc/front/date/@day and /rfc/front/date/@day!=''">
5276      <xsl:value-of select="/rfc/front/date/@day"/>
5277    </xsl:when>
5278    <xsl:when test="function-available('date:day-in-month') and $may-default-dates='yes'">
5279      <xsl:value-of select="date:day-in-month()"/>
5280    </xsl:when>
5281    <xsl:otherwise/> <!-- harmless, we just don't have it -->
5282  </xsl:choose>
5283</xsl:param>
5284
5285</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.