Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

6722 lines (6094 sloc) 263.121 kB
<!--
XSLT transformation from RFC2629 XML format to HTML
Copyright (c) 2006-2010, Julian Reschke (julian.reschke@greenbytes.de)
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of Julian Reschke nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-->
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:date="http://exslt.org/dates-and-times"
xmlns:ed="http://greenbytes.de/2002/rfcedit"
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="http://saxon.sf.net/"
xmlns:saxon-old="http://icl.com/saxon"
xmlns:x="http://purl.org/net/xml2rfc/ext"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
exclude-result-prefixes="date ed exslt msxsl myns rdf saxon saxon-old x xhtml"
>
<xsl:strip-space elements="back front list middle rfc section"/>
<xsl:output method="html" encoding="iso-8859-1" version="4.0" doctype-public="-//W3C//DTD HTML 4.01//EN" indent="no"/>
<!-- rfc comments PI -->
<xsl:param name="xml2rfc-comments">
<xsl:call-template name="parse-pis">
<xsl:with-param name="nodes" select="/processing-instruction('rfc')"/>
<xsl:with-param name="attr" select="'comments'"/>
<xsl:with-param name="default" select="'no'"/>
</xsl:call-template>
</xsl:param>
<!-- rfc compact PI -->
<xsl:param name="xml2rfc-compact">
<xsl:call-template name="parse-pis">
<xsl:with-param name="nodes" select="/processing-instruction('rfc')"/>
<xsl:with-param name="attr" select="'compact'"/>
<xsl:with-param name="default" select="$xml2rfc-rfcedstyle"/>
</xsl:call-template>
</xsl:param>
<!-- rfc footer PI -->
<xsl:param name="xml2rfc-footer">
<xsl:call-template name="parse-pis">
<xsl:with-param name="nodes" select="/processing-instruction('rfc')"/>
<xsl:with-param name="attr" select="'footer'"/>
</xsl:call-template>
</xsl:param>
<!-- rfc header PI -->
<xsl:param name="xml2rfc-header">
<xsl:call-template name="parse-pis">
<xsl:with-param name="nodes" select="/processing-instruction('rfc')"/>
<xsl:with-param name="attr" select="'header'"/>
</xsl:call-template>
</xsl:param>
<!-- rfc inline PI -->
<xsl:param name="xml2rfc-inline">
<xsl:call-template name="parse-pis">
<xsl:with-param name="nodes" select="/processing-instruction('rfc')"/>
<xsl:with-param name="attr" select="'inline'"/>
<xsl:with-param name="default" select="'no'"/>
</xsl:call-template>
</xsl:param>
<!-- include a table of contents if a processing instruction <?rfc?>
exists with contents toc="yes". Can be overriden by an XSLT parameter -->
<xsl:param name="xml2rfc-toc">
<xsl:call-template name="parse-pis">
<xsl:with-param name="nodes" select="/processing-instruction('rfc')"/>
<xsl:with-param name="attr" select="'toc'"/>
<xsl:with-param name="default" select="'no'"/>
</xsl:call-template>
</xsl:param>
<!-- optional tocdepth-->
<xsl:param name="xml2rfc-tocdepth">
<xsl:call-template name="parse-pis">
<xsl:with-param name="nodes" select="/processing-instruction('rfc')"/>
<xsl:with-param name="attr" select="'tocdepth'"/>
<xsl:with-param name="default" select="'3'"/>
</xsl:call-template>
</xsl:param>
<xsl:variable name="parsedTocDepth">
<xsl:choose>
<xsl:when test="$xml2rfc-tocdepth='1'">1</xsl:when>
<xsl:when test="$xml2rfc-tocdepth='2'">2</xsl:when>
<xsl:when test="$xml2rfc-tocdepth='3'">3</xsl:when>
<xsl:when test="$xml2rfc-tocdepth='4'">4</xsl:when>
<xsl:when test="$xml2rfc-tocdepth='5'">5</xsl:when>
<xsl:otherwise>99</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- suppress top block if a processing instruction <?rfc?>
exists with contents tocblock="no". Can be overriden by an XSLT parameter -->
<xsl:param name="xml2rfc-topblock">
<xsl:call-template name="parse-pis">
<xsl:with-param name="nodes" select="/processing-instruction('rfc')"/>
<xsl:with-param name="attr" select="'topblock'"/>
<xsl:with-param name="default" select="'yes'"/>
</xsl:call-template>
</xsl:param>
<!-- Format to the RFC Editor's taste -->
<xsl:param name="xml2rfc-rfcedstyle">
<xsl:call-template name="parse-pis">
<xsl:with-param name="nodes" select="/processing-instruction('rfc')"/>
<xsl:with-param name="attr" select="'rfcedstyle'"/>
<xsl:with-param name="default" select="'no'"/>
</xsl:call-template>
</xsl:param>
<!-- the name of an automatically inserted references section -->
<xsl:param name="xml2rfc-refparent">
<xsl:call-template name="parse-pis">
<xsl:with-param name="nodes" select="/processing-instruction('rfc')"/>
<xsl:with-param name="attr" select="'refparent'"/>
<xsl:with-param name="default" select="'References'"/>
</xsl:call-template>
</xsl:param>
<!-- use symbolic reference names instead of numeric ones unless a processing instruction <?rfc?>
exists with contents symrefs="no". Can be overriden by an XSLT parameter -->
<xsl:param name="xml2rfc-symrefs">
<xsl:call-template name="parse-pis">
<xsl:with-param name="nodes" select="/processing-instruction('rfc')"/>
<xsl:with-param name="attr" select="'symrefs'"/>
<xsl:with-param name="default" select="'yes'"/>
</xsl:call-template>
</xsl:param>
<!-- sort references if a processing instruction <?rfc?>
exists with contents sortrefs="yes". Can be overriden by an XSLT parameter -->
<xsl:param name="xml2rfc-sortrefs">
<xsl:call-template name="parse-pis">
<xsl:with-param name="nodes" select="/processing-instruction('rfc')"/>
<xsl:with-param name="attr" select="'sortrefs'"/>
<xsl:with-param name="default" select="'no'"/>
</xsl:call-template>
</xsl:param>
<!-- insert editing marks if a processing instruction <?rfc?>
exists with contents editing="yes". Can be overriden by an XSLT parameter -->
<xsl:param name="xml2rfc-editing">
<xsl:call-template name="parse-pis">
<xsl:with-param name="nodes" select="/processing-instruction('rfc')"/>
<xsl:with-param name="attr" select="'editing'"/>
<xsl:with-param name="default" select="'no'"/>
</xsl:call-template>
</xsl:param>
<!-- make it a private paper -->
<xsl:param name="xml2rfc-private">
<xsl:call-template name="parse-pis">
<xsl:with-param name="nodes" select="/processing-instruction('rfc')"/>
<xsl:with-param name="attr" select="'private'"/>
</xsl:call-template>
</xsl:param>
<!-- background image? -->
<xsl:param name="xml2rfc-background">
<xsl:call-template name="parse-pis">
<xsl:with-param name="nodes" select="/processing-instruction('rfc')"/>
<xsl:with-param name="attr" select="'background'"/>
</xsl:call-template>
</xsl:param>
<!-- extension for XML parsing in artwork -->
<xsl:param name="xml2rfc-ext-parse-xml-in-artwork">
<xsl:call-template name="parse-pis">
<xsl:with-param name="nodes" select="/processing-instruction('rfc-ext')"/>
<xsl:with-param name="attr" select="'parse-xml-in-artwork'"/>
<xsl:with-param name="default" select="'no'"/>
</xsl:call-template>
</xsl:param>
<xsl:param name="xml2rfc-ext-trace-parse-xml">
<xsl:call-template name="parse-pis">
<xsl:with-param name="nodes" select="/processing-instruction('rfc-ext')"/>
<xsl:with-param name="attr" select="'trace-parse-xml'"/>
<xsl:with-param name="default" select="'no'"/>
</xsl:call-template>
</xsl:param>
<!-- extension for excluding DCMI properties in meta tag (RFC2731) -->
<xsl:param name="xml2rfc-ext-support-rfc2731">
<xsl:call-template name="parse-pis">
<xsl:with-param name="nodes" select="/processing-instruction('rfc-ext')"/>
<xsl:with-param name="attr" select="'support-rfc2731'"/>
<xsl:with-param name="default" select="'yes'"/>
</xsl:call-template>
</xsl:param>
<!-- extension for allowing markup inside artwork -->
<xsl:param name="xml2rfc-ext-allow-markup-in-artwork">
<xsl:call-template name="parse-pis">
<xsl:with-param name="nodes" select="/processing-instruction('rfc-ext')"/>
<xsl:with-param name="attr" select="'allow-markup-in-artwork'"/>
<xsl:with-param name="default" select="'no'"/>
</xsl:call-template>
</xsl:param>
<!-- extension for including references into index -->
<xsl:param name="xml2rfc-ext-include-references-in-index">
<xsl:call-template name="parse-pis">
<xsl:with-param name="nodes" select="/processing-instruction('rfc-ext')"/>
<xsl:with-param name="attr" select="'include-references-in-index'"/>
<xsl:with-param name="default" select="'no'"/>
</xsl:call-template>
</xsl:param>
<!-- position of author's section -->
<xsl:param name="xml2rfc-ext-authors-section">
<xsl:call-template name="parse-pis">
<xsl:with-param name="nodes" select="/processing-instruction('rfc-ext')"/>
<xsl:with-param name="attr" select="'authors-section'"/>
</xsl:call-template>
</xsl:param>
<!-- justification? -->
<xsl:param name="xml2rfc-ext-justification">
<xsl:call-template name="parse-pis">
<xsl:with-param name="nodes" select="/processing-instruction('rfc-ext')"/>
<xsl:with-param name="attr" select="'justification'"/>
<xsl:with-param name="default" select="'no'"/>
</xsl:call-template>
</xsl:param>
<!-- switch for doublesided layout -->
<xsl:param name="xml2rfc-ext-duplex">
<xsl:call-template name="parse-pis">
<xsl:with-param name="nodes" select="/processing-instruction('rfc-ext')"/>
<xsl:with-param name="attr" select="'duplex'"/>
<xsl:with-param name="default" select="'no'"/>
</xsl:call-template>
</xsl:param>
<!-- experimental support for TLP 4.0, work in progress -->
<xsl:param name="xml2rfc-ext-tlp">
<xsl:call-template name="parse-pis">
<xsl:with-param name="nodes" select="/processing-instruction('rfc-ext')"/>
<xsl:with-param name="attr" select="'tlp'"/>
<xsl:with-param name="default" select="''"/>
</xsl:call-template>
</xsl:param>
<!-- trailing dots in section numbers -->
<xsl:param name="xml2rfc-ext-sec-no-trailing-dots">
<xsl:call-template name="parse-pis">
<xsl:with-param name="nodes" select="/processing-instruction('rfc-ext')"/>
<xsl:with-param name="attr" select="'sec-no-trailing-dots'"/>
</xsl:call-template>
</xsl:param>
<!-- choose whether or not to do mailto links -->
<xsl:param name="xml2rfc-linkmailto">
<xsl:call-template name="parse-pis">
<xsl:with-param name="nodes" select="/processing-instruction('rfc-ext')"/>
<xsl:with-param name="attr" select="'linkmailto'"/>
<xsl:with-param name="default" select="'yes'"/>
</xsl:call-template>
</xsl:param>
<!-- iprnotified switch -->
<xsl:param name="xml2rfc-iprnotified">
<xsl:call-template name="parse-pis">
<xsl:with-param name="nodes" select="/processing-instruction('rfc')"/>
<xsl:with-param name="attr" select="'iprnotified'"/>
<xsl:with-param name="default" select="'no'"/>
</xsl:call-template>
</xsl:param>
<!-- URL templates for RFCs and Internet Drafts. -->
<!-- Reference the authorative ASCII versions
<xsl:param name="rfcUrlPrefix" select="'http://www.ietf.org/rfc/rfc'" />
<xsl:param name="rfcUrlPostfix" select="'.txt'" />
-->
<!-- Reference the marked up versions over on http://tools.ietf.org/html. -->
<xsl:param name="rfcUrlPrefix" select="'http://tools.ietf.org/html/rfc'" />
<xsl:param name="rfcUrlPostfix" select="''" />
<xsl:param name="rfcUrlFragSection" select="'section-'" />
<xsl:param name="rfcUrlFragAppendix" select="'appendix-'" />
<xsl:param name="internetDraftUrlPrefix" select="'http://tools.ietf.org/html/'" />
<xsl:param name="internetDraftUrlPostfix" select="''" />
<xsl:param name="internetDraftUrlFrag" select="'section-'" />
<!-- warning re: absent node-set ext. function -->
<xsl:variable name="node-set-warning">
This stylesheet requires either an XSLT-1.0 processor with node-set()
extension function, or an XSLT-2.0 processor. Therefore, parts of the
document couldn't be displayed.
</xsl:variable>
<!-- character translation tables -->
<xsl:variable name="lcase" select="'abcdefghijklmnopqrstuvwxyz'" />
<xsl:variable name="ucase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
<!-- build help keys for indices -->
<xsl:key name="index-first-letter"
match="iref|reference"
use="translate(substring(concat(@anchor,@item),1,1),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')" />
<xsl:key name="index-item"
match="iref"
use="@item" />
<xsl:key name="index-item-subitem"
match="iref"
use="concat(@item,'..',@subitem)" />
<xsl:key name="index-xref-by-sec"
match="xref[@x:sec]"
use="concat(@target,'..',@x:sec)" />
<xsl:key name="index-xref-by-anchor"
match="xref[@x:rel]"
use="concat(@target,'..',@x:rel)" />
<xsl:key name="anchor-item"
match="//*[@anchor]"
use="@anchor"/>
<xsl:key name="xref-item"
match="//xref"
use="@target"/>
<xsl:key name="extref-item"
match="//x:ref"
use="."/>
<!-- prefix for automatically generated anchors -->
<xsl:variable name="anchor-prefix" select="'rfc'" />
<!-- IPR version switch -->
<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)
)" />
<xsl:variable name="rfcno" select="/rfc/@number"/>
<xsl:variable name="submissionType">
<xsl:choose>
<xsl:when test="/rfc/@submissionType='IETF' or not(/rfc/@submissionType) or /rfc/submissionType=''">IETF</xsl:when>
<xsl:when test="/rfc/@submissionType='IAB' or /rfc/@submissionType='IRTF' or /rfc/@submissionType='independent'">
<xsl:value-of select="/rfc/@submissionType"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat('(UNSUPPORTED SUBMISSION TYPE: ',/rfc/@submissionType,')')"/>
<xsl:call-template name="error">
<xsl:with-param name="msg" select="concat('Unsupported value for /rfc/@submissionType: ', /rfc/@submissionType)"/>
<xsl:with-param name="inline" select="'no'"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Header format as defined in RFC 5741, and deployed end of Dec 2009 -->
<xsl:variable name="header-format">
<xsl:choose>
<xsl:when test="$pub-yearmonth >= 201001 or
($rfcno=5741 or $rfcno=5742 or $rfcno=5743)"
>2010</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:variable>
<xsl:variable name="rfc-boilerplate">
<xsl:choose>
<!-- RFC boilerplate as defined in RFC 5741, and deployed end of Dec 2009 -->
<xsl:when test="$pub-yearmonth >= 201001 or
($rfcno=5741 or $rfcno=5742 or $rfcno=5743)"
>2010</xsl:when>
<xsl:when test="$xml2rfc-ext-tlp='4'">2010</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:variable>
<xsl:variable name="id-boilerplate">
<xsl:choose>
<!-- ID boilerplate approved by IESG on Jan 14 2010-->
<xsl:when test="$pub-yearmonth >= 201006"
>2010</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:variable>
<xsl:variable name="ipr-rfc4748" select="(
$ipr-rfc3667 and
( $rfcno &gt;= 4715 and ( $rfcno != 4718 and $rfcno != 4735 and $rfcno != 4749 ))
or
( $rfcno=4578 or $rfcno=4582 or $rfcno=4583 or $rfcno=4628 or $rfcno=4629 or $rfcno=4639 or $rfcno=4651 or $rfcno=4682 or $rfcno=4684 or $rfcno=4695 or $rfcno=4696 )
or
( not(/rfc/@number) and $pub-yearmonth >= 200611)
)" />
<xsl:variable name="ipr-2007-08" select="(
$ipr-rfc4748 and
(
($rfcno &gt; 5000
and $rfcno != 5020
and $rfcno != 5021
and $rfcno != 5034
and $rfcno != 5052
and $rfcno != 5065
and $rfcno != 5094) or
($xml2rfc-ext-pub-year >= 2008) or
(not(/rfc/@number) and $pub-yearmonth >= 200709)
)
)" />
<xsl:variable name="ipr-2008-11" select="(
/rfc/@number and $pub-yearmonth >= 200811
)
or
(
/rfc/@ipr = 'trust200811' or
/rfc/@ipr = 'noModificationTrust200811' or
/rfc/@ipr = 'noDerivativesTrust200902' or
/rfc/@ipr = 'trust200902' or
/rfc/@ipr = 'noModificationTrust200902' or
/rfc/@ipr = 'noDerivativesTrust200902' or
/rfc/@ipr = 'pre5378Trust200902'
)" />
<xsl:variable name="ipr-2009-02" select="(
$ipr-2008-11 and $pub-yearmonth >= 200902
)" />
<!-- this makes the Sep 2009 TLP text depend on the publication date to be >= 2009-11
for IDs, and around 2009-09 for RFCs-->
<xsl:variable name="ipr-2009-09" select="(
( not(/rfc/@number) and $pub-yearmonth >= 200911 )
or
(
/rfc/@number and $pub-yearmonth >= 200909 and
$rfcno!=5582 and $rfcno!=5621 and $rfcno!=5632 and $rfcno!=5645 and $rfcno!=5646 and $rfcno!=5681
)
)" />
<!-- this makes the Jan 2010 TLP text depend on the tlp ext PI
for IDs, and around 2010-01 for RFCs-->
<xsl:variable name="ipr-2010-01" select="(
( not(/rfc/@number) and $xml2rfc-ext-tlp='4' )
or
(
/rfc/@number and ($pub-yearmonth >= 201001 or
$rfcno=5741 or $rfcno=5742 or $rfcno=5743)
)
)" />
<!-- see http://mailman.rfc-editor.org/pipermail/rfc-interest/2009-June/001373.html -->
<!-- for IDs, implement the change as 2009-11 -->
<xsl:variable name="abstract-first" select="(
(/rfc/@number and $pub-yearmonth >= 200907)
or
(not(/rfc/@number) and $pub-yearmonth >= 200911)
)" />
<!-- funding switch -->
<xsl:variable name="funding0" select="(
$rfcno &gt; 2499) or
(not(/rfc/@number) and /rfc/@docName and $xml2rfc-ext-pub-year &gt;= 1999
)" />
<xsl:variable name="funding1" select="(
$rfcno &gt; 4320) or
(not(/rfc/@number) and /rfc/@docName and $xml2rfc-ext-pub-year &gt;= 2006
)" />
<xsl:variable name="no-funding" select="$ipr-2007-08"/>
<xsl:variable name="no-copylong" select="$ipr-2008-11"/>
<!-- will document have an index -->
<xsl:variable name="has-index" select="//iref or (//xref and $xml2rfc-ext-include-references-in-index='yes')" />
<!-- does the document contain edits? -->
<xsl:variable name="has-edits" select="//ed:ins | //ed:del | //ed:replace" />
<xsl:template match="text()[not(ancestor::artwork)]">
<xsl:variable name="ws" select="'&#9;&#10;&#13;&#32;'"/>
<xsl:variable name="starts-with-ws" select="translate(substring(.,1,1),$ws,'')"/>
<xsl:variable name="ends-with-ws" select="translate(substring(.,string-length(.),1),$ws,'')"/>
<!--<xsl:message> Orig: "<xsl:value-of select="."/>"</xsl:message>
<xsl:message>Start: "<xsl:value-of select="$starts-with-ws"/>"</xsl:message>
<xsl:message> End: "<xsl:value-of select="$ends-with-ws"/>"</xsl:message> -->
<xsl:if test="$starts-with-ws='' and preceding-sibling::node()">
<xsl:text> </xsl:text>
</xsl:if>
<xsl:value-of select="normalize-space(.)"/>
<xsl:if test="$ends-with-ws='' and following-sibling::node()">
<xsl:text> </xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="abstract">
<h1 id="{$anchor-prefix}.abstract"><a href="#{$anchor-prefix}.abstract">Abstract</a></h1>
<xsl:apply-templates />
</xsl:template>
<msxsl:script language="JScript" implements-prefix="myns">
function parseXml(str) {
try {
var doc = new ActiveXObject("MSXML2.DOMDocument");
doc.async = false;
if (doc.loadXML(str)) {
return "";
}
else {
return doc.parseError.reason + "\n" + doc.parseError.srcText + " (" + doc.parseError.line + "/" + doc.parseError.linepos + ")";
}
}
catch(e) {
return "";
}
}
</msxsl:script>
<xsl:template name="add-artwork-class">
<xsl:choose>
<xsl:when test="@type='abnf' or @type='abnf2045' or @type='abnf2616' or @type='application/xml-dtd' or @type='inline' or @type='application/relax-ng-compact-syntax'">
<xsl:attribute name="class">inline</xsl:attribute>
</xsl:when>
<xsl:when test="starts-with(@type,'message/http') and contains(@type,'msgtype=&quot;request&quot;')">
<xsl:attribute name="class">text2</xsl:attribute>
</xsl:when>
<xsl:when test="starts-with(@type,'message/http')">
<xsl:attribute name="class">text</xsl:attribute>
</xsl:when>
<xsl:when test="starts-with(@type,'drawing')">
<xsl:attribute name="class">drawing</xsl:attribute>
</xsl:when>
<xsl:when test="starts-with(@type,'text/plain') or @type='example' or @type='code'">
<xsl:attribute name="class">text</xsl:attribute>
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:template>
<xsl:template name="insert-begin-code">
<xsl:if test="@x:isCodeComponent='yes'">
<pre class="ccmarker cct"><span>&lt;CODE BEGINS></span></pre>
</xsl:if>
</xsl:template>
<xsl:template name="insert-end-code">
<xsl:if test="@x:isCodeComponent='yes'">
<pre class="ccmarker ccb"><span>&lt;CODE ENDS></span></pre>
</xsl:if>
</xsl:template>
<xsl:template match="artwork">
<xsl:if test="not(ancestor::ed:del) and $xml2rfc-ext-parse-xml-in-artwork='yes' and function-available('myns:parseXml')">
<xsl:if test="contains(.,'&lt;?xml')">
<xsl:variable name="body" select="substring-after(substring-after(.,'&lt;?xml'),'?>')" />
<xsl:if test="$body!='' and myns:parseXml($body)!=''">
<table style="background-color: red; border-width: thin; border-style: solid; border-color: black;">
<tr><td>
XML PARSE ERROR; parsed the body below:
<pre>
<xsl:value-of select="$body"/>
</pre>
resulting in:
<pre>
<xsl:value-of select="myns:parseXml($body)" />
</pre>
</td></tr></table>
</xsl:if>
</xsl:if>
<xsl:if test="@ed:parse-xml-after">
<xsl:if test="myns:parseXml(string(.))!=''">
<table style="background-color: red; border-width: thin; border-style: solid; border-color: black;">
<tr><td>
XML PARSE ERROR:
<pre><xsl:value-of select="myns:parseXml(string(.))" /></pre>
</td></tr></table>
</xsl:if>
</xsl:if>
</xsl:if>
<xsl:variable name="display">
<xsl:choose>
<xsl:when test="$xml2rfc-ext-allow-markup-in-artwork='yes'">
<xsl:apply-templates/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="@align='right'">
<div style="display:table; margin-left: auto; margin-right: 0pt;">
<xsl:call-template name="insert-begin-code"/>
<pre style="margin-left: 0em;">
<xsl:call-template name="add-artwork-class"/>
<xsl:call-template name="insertInsDelClass"/>
<xsl:copy-of select="$display"/>
</pre>
<xsl:call-template name="insert-end-code"/>
</div>
</xsl:when>
<xsl:when test="@align='center'">
<div style="display:table; margin-left: auto; margin-right: auto;">
<xsl:call-template name="insert-begin-code"/>
<pre style="margin-left: 0em;">
<xsl:call-template name="add-artwork-class"/>
<xsl:call-template name="insertInsDelClass"/>
<xsl:copy-of select="$display"/>
</pre>
<xsl:call-template name="insert-end-code"/>
</div>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="insert-begin-code"/>
<pre>
<xsl:call-template name="add-artwork-class"/>
<xsl:call-template name="insertInsDelClass"/>
<xsl:copy-of select="$display"/>
</pre>
<xsl:call-template name="insert-end-code"/>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="check-artwork-width">
<xsl:with-param name="content"><xsl:apply-templates/></xsl:with-param>
<xsl:with-param name="indent"><xsl:value-of select="string-length(@x:indent-with)"/></xsl:with-param>
</xsl:call-template>
</xsl:template>
<!-- special case for first text node in artwork -->
<xsl:template match="artwork/text()[1]">
<xsl:choose>
<xsl:when test="starts-with(.,'&#10;')">
<!-- reduce leading whitespace -->
<xsl:value-of select="substring(.,2)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="check-artwork-width">
<xsl:param name="content"/>
<xsl:param name="indent"/>
<xsl:choose>
<xsl:when test="not(contains($content,'&#10;'))">
<xsl:if test="string-length($content) > 69 + $indent">
<xsl:call-template name="warning">
<xsl:with-param name="inline" select="'no'"/>
<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>
</xsl:call-template>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="start" select="substring-before($content,'&#10;')"/>
<xsl:variable name="end" select="substring-after($content,'&#10;')"/>
<xsl:if test="string-length($start) > 69 + $indent">
<xsl:call-template name="warning">
<xsl:with-param name="inline" select="'no'"/>
<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>
</xsl:call-template>
</xsl:if>
<xsl:call-template name="check-artwork-width">
<xsl:with-param name="content" select="$end"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="artwork[@src and starts-with(@type,'image/')]">
<p>
<xsl:choose>
<xsl:when test="@align='center'">
<xsl:attribute name="style">text-align: center</xsl:attribute>
</xsl:when>
<xsl:when test="@align='right'">
<xsl:attribute name="style">text-align: right</xsl:attribute>
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
<xsl:choose>
<xsl:when test="@type='image/svg+xml'">
<object data="{@src}" type="image/svg+xml">
<xsl:choose>
<xsl:when test="@width!='' or @height!=''">
<xsl:copy-of select="@width|@height"/>
</xsl:when>
<xsl:otherwise xmlns:svg="http://www.w3.org/2000/svg">
<!-- try to find width and height from SVG -->
<xsl:variable name="svg" select="document(@src)"/>
<xsl:for-each select="$svg/svg:svg/@width|$svg/svg:svg/@height">
<!-- strip out the units, cross the fingers pixels are meant -->
<xsl:attribute name="{local-name()}">
<xsl:value-of select="translate(.,concat($ucase,$lcase),'')"/>
</xsl:attribute>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates/>
</object>
</xsl:when>
<xsl:otherwise>
<img src="{@src}" alt="{.}">
<xsl:if test="@width and @width!=''">
<xsl:copy-of select="@width"/>
</xsl:if>
<xsl:if test="@height and @height!=''">
<xsl:copy-of select="@height"/>
</xsl:if>
</img>
</xsl:otherwise>
</xsl:choose>
</p>
</xsl:template>
<xsl:template match="author">
<address class="vcard">
<span class="vcardline">
<span class="fn">
<xsl:value-of select="@fullname" />
</span>
<xsl:if test="@role">
(<xsl:value-of select="@role" />)
</xsl:if>
<!-- annotation support for Martin "uuml" Duerst -->
<xsl:if test="@x:annotation">
<xsl:text> </xsl:text>
<i><xsl:value-of select="@x:annotation"/></i>
</xsl:if>
<!-- components of name (hidden from display -->
<span class="n hidden">
<span class="family-name"><xsl:value-of select="@surname"/></span>
<!-- given-name family-name -->
<xsl:if test="@surname=substring(@fullname,1 + string-length(@fullname) - string-length(@surname))">
<span class="given-name"><xsl:value-of select="normalize-space(substring(@fullname,1,string-length(@fullname) - string-length(@surname)))"/></span>
</xsl:if>
<!-- family-name given-name -->
<xsl:if test="starts-with(@fullname,@surname)">
<span class="given-name"><xsl:value-of select="normalize-space(substring-after(@fullname,@surname))"/></span>
</xsl:if>
</span>
</span>
<xsl:if test="normalize-space(organization) != ''">
<span class="org vcardline">
<xsl:value-of select="organization" />
</span>
</xsl:if>
<xsl:if test="address/postal">
<span class="adr">
<xsl:if test="address/postal/street!=''">
<xsl:for-each select="address/postal/street">
<span class="street-address vcardline">
<xsl:call-template name="extract-normalized">
<xsl:with-param name="node" select="."/>
<xsl:with-param name="name" select="'street'"/>
</xsl:call-template>
</span>
</xsl:for-each>
</xsl:if>
<xsl:if test="address/postal/city|address/postal/region|address/postal/code">
<span class="vcardline">
<xsl:if test="address/postal/city">
<span class="locality">
<xsl:call-template name="extract-normalized">
<xsl:with-param name="node" select="address/postal/city"/>
<xsl:with-param name="name" select="'address/postal/city'"/>
</xsl:call-template>
</span>
<xsl:text>, </xsl:text>
</xsl:if>
<xsl:if test="address/postal/region">
<span class="region">
<xsl:call-template name="extract-normalized">
<xsl:with-param name="node" select="address/postal/region"/>
<xsl:with-param name="name" select="'address/postal/region'"/>
</xsl:call-template>
</span>
<xsl:text>&#160;</xsl:text>
</xsl:if>
<xsl:if test="address/postal/code">
<span class="postal-code">
<xsl:call-template name="extract-normalized">
<xsl:with-param name="node" select="address/postal/code"/>
<xsl:with-param name="name" select="'address/postal/code'"/>
</xsl:call-template>
</span>
</xsl:if>
</span>
</xsl:if>
<xsl:if test="address/postal/country">
<span class="country-name vcardline">
<xsl:call-template name="extract-normalized">
<xsl:with-param name="node" select="address/postal/country"/>
<xsl:with-param name="name" select="'address/postal/country'"/>
</xsl:call-template>
</span>
</xsl:if>
</span>
</xsl:if>
<xsl:if test="address/phone">
<span class="vcardline tel">
<xsl:text>Phone: </xsl:text>
<a href="tel:{translate(address/phone,' ','')}"><span class="value"><xsl:value-of select="address/phone" /></span></a>
</span>
</xsl:if>
<xsl:if test="address/facsimile">
<span class="vcardline tel">
<span class="type">Fax</span><xsl:text>: </xsl:text>
<a href="fax:{translate(address/facsimile,' ','')}"><span class="value"><xsl:value-of select="address/facsimile" /></span></a>
</span>
</xsl:if>
<xsl:for-each select="address/email">
<xsl:variable name="email">
<xsl:call-template name="extract-email"/>
</xsl:variable>
<span class="vcardline">
<xsl:choose>
<xsl:when test="$xml2rfc-rfcedstyle='yes'">Email: </xsl:when>
<xsl:otherwise>EMail: </xsl:otherwise>
</xsl:choose>
<a>
<xsl:if test="$xml2rfc-linkmailto!='no'">
<xsl:attribute name="href">mailto:<xsl:value-of select="$email" /></xsl:attribute>
</xsl:if>
<span class="email"><xsl:value-of select="$email" /></span>
</a>
</span>
</xsl:for-each>
<xsl:for-each select="address/uri">
<xsl:variable name="uri">
<xsl:call-template name="extract-uri"/>
</xsl:variable>
<span class="vcardline">
<xsl:text>URI: </xsl:text>
<a href="{$uri}" class="url"><xsl:value-of select="$uri" /></a>
<xsl:if test="@x:annotation">
<xsl:text> </xsl:text>
<i><xsl:value-of select="@x:annotation"/></i>
</xsl:if>
</span>
</xsl:for-each>
</address>
</xsl:template>
<!-- this is a named template because <back> may be absent -->
<xsl:template name="back">
<!-- add editorial comments -->
<xsl:if test="//cref and $xml2rfc-comments='yes' and $xml2rfc-inline!='yes'">
<xsl:call-template name="insertComments" />
</xsl:if>
<!-- next, add information about the document's authors -->
<xsl:if test="$xml2rfc-ext-authors-section!='end'">
<xsl:call-template name="insertAuthors" />
</xsl:if>
<!-- add all other top-level sections under <back> -->
<xsl:apply-templates select="back/*[not(self::references) and not(self::ed:replace and .//references)]" />
<!-- insert the index if index entries exist -->
<!-- note it always comes before the authors section -->
<xsl:if test="$has-index">
<xsl:call-template name="insertIndex" />
</xsl:if>
<!-- Authors section is the absolute last thing, except for copyright stuff -->
<xsl:if test="$xml2rfc-ext-authors-section='end'">
<xsl:call-template name="insertAuthors" />
</xsl:if>
<xsl:if test="$xml2rfc-private=''">
<!-- copyright statements -->
<xsl:variable name="copyright"><xsl:call-template name="insertCopyright" /></xsl:variable>
<!-- emit it -->
<xsl:choose>
<xsl:when test="function-available('exslt:node-set')">
<xsl:apply-templates select="exslt:node-set($copyright)" />
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="error">
<xsl:with-param name="msg" select="$node-set-warning"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
<xsl:template match="eref[node()]">
<a href="{@target}"><xsl:apply-templates /></a>
</xsl:template>
<xsl:template match="eref[not(node())]">
<xsl:text>&lt;</xsl:text>
<a href="{@target}"><xsl:value-of select="@target" /></a>
<xsl:text>&gt;</xsl:text>
</xsl:template>
<xsl:template match="figure">
<xsl:if test="@anchor!=''">
<xsl:call-template name="check-anchor"/>
<div id="{@anchor}"/>
</xsl:if>
<xsl:variable name="anch">
<xsl:call-template name="get-figure-anchor"/>
</xsl:variable>
<div id="{$anch}" />
<xsl:apply-templates />
<xsl:if test="(@title!='' or @anchor!='') and not(@suppress-title='true')">
<xsl:variable name="n"><xsl:number level="any" count="figure[(@title!='' or @anchor!='') and not(@suppress-title='true')]" /></xsl:variable>
<p class="figure">Figure <xsl:value-of select="$n"/><xsl:if test="@title!=''">: <xsl:value-of select="@title" /></xsl:if></p>
</xsl:if>
</xsl:template>
<xsl:template match="front">
<xsl:if test="$xml2rfc-topblock!='no'">
<!-- collect information for left column -->
<xsl:variable name="leftColumn">
<xsl:call-template name="collectLeftHeaderColumn" />
</xsl:variable>
<!-- collect information for right column -->
<xsl:variable name="rightColumn">
<xsl:call-template name="collectRightHeaderColumn" />
</xsl:variable>
<!-- insert the collected information -->
<table class="header">
<xsl:choose>
<xsl:when test="function-available('exslt:node-set')">
<xsl:call-template name="emitheader">
<xsl:with-param name="lc" select="exslt:node-set($leftColumn)" />
<xsl:with-param name="rc" select="exslt:node-set($rightColumn)" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="error">
<xsl:with-param name="msg" select="$node-set-warning"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</table>
</xsl:if>
<p class="title">
<!-- main title -->
<xsl:apply-templates select="title"/>
<xsl:if test="/rfc/@docName">
<br/>
<span class="filename"><xsl:value-of select="/rfc/@docName"/></span>
<xsl:if test="contains(/rfc/@docName,'.')">
<xsl:call-template name="warning">
<xsl:with-param name="msg">The @docName attribute should contain the base name, not the filename (thus no file extension).</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:if>
</p>
<!-- insert notice about update -->
<xsl:variable name="published-as" select="/*/x:link[@rel='Alternate' and starts-with(@title,'RFC')]"/>
<xsl:if test="$published-as">
<p style="color: green; text-align: center; font-size: 14pt; background-color: yellow;">
<b>Note:</b> a later version of this document has been published as <a href="{$published-as/@href}"><xsl:value-of select="$published-as/@title"/></a>.
</p>
</xsl:if>
<!-- check for conforming ipr attribute -->
<xsl:choose>
<xsl:when test="not(/rfc/@ipr)" />
<xsl:when test="/rfc/@ipr = 'full2026'" />
<xsl:when test="/rfc/@ipr = 'noDerivativeWorks'" />
<xsl:when test="/rfc/@ipr = 'noDerivativeWorksNow'" />
<xsl:when test="/rfc/@ipr = 'none'" />
<xsl:when test="/rfc/@ipr = 'full3667'" />
<xsl:when test="/rfc/@ipr = 'noModification3667'" />
<xsl:when test="/rfc/@ipr = 'noDerivatives3667'" />
<xsl:when test="/rfc/@ipr = 'full3978'" />
<xsl:when test="/rfc/@ipr = 'noModification3978'" />
<xsl:when test="/rfc/@ipr = 'noDerivatives3978'" />
<xsl:when test="/rfc/@ipr = 'trust200811'" />
<xsl:when test="/rfc/@ipr = 'noModificationTrust200811'" />
<xsl:when test="/rfc/@ipr = 'noDerivativesTrust200811'" />
<xsl:when test="/rfc/@ipr = 'trust200902'" />
<xsl:when test="/rfc/@ipr = 'noModificationTrust200902'" />
<xsl:when test="/rfc/@ipr = 'noDerivativesTrust200902'" />
<xsl:when test="/rfc/@ipr = 'pre5378Trust200902'" />
<xsl:otherwise>
<xsl:call-template name="error">
<xsl:with-param name="msg" select="concat('Unknown value for /rfc/@ipr: ', /rfc/@ipr)"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="$xml2rfc-private='' and not($abstract-first)">
<xsl:call-template name="emit-ietf-preamble"/>
</xsl:if>
<xsl:apply-templates select="x:boilerplate"/>
<xsl:apply-templates select="abstract" />
<xsl:apply-templates select="note" />
<!-- show notes inside change tracking as well -->
<xsl:apply-templates select="ed:replace[.//note]" />
<xsl:if test="$xml2rfc-private='' and $abstract-first">
<xsl:call-template name="emit-ietf-preamble"/>
</xsl:if>
<xsl:if test="$xml2rfc-toc='yes'">
<xsl:apply-templates select="/" mode="toc" />
<xsl:call-template name="insertTocAppendix" />
</xsl:if>
</xsl:template>
<xsl:template name="emit-ietf-preamble">
<!-- Get status info formatted as per RFC2629-->
<xsl:variable name="preamble">
<xsl:call-template name="insertPreamble" />
</xsl:variable>
<!-- emit it -->
<xsl:choose>
<xsl:when test="function-available('exslt:node-set')">
<xsl:apply-templates select="exslt:node-set($preamble)" />
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="error">
<xsl:with-param name="msg" select="$node-set-warning"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="iref">
<xsl:variable name="anchor"><xsl:call-template name="compute-iref-anchor"/></xsl:variable>
<xsl:choose>
<xsl:when test="parent::figure">
<div id="{$anchor}"/>
</xsl:when>
<xsl:when test="ancestor::t or ancestor::artwork or ancestor::preamble or ancestor::postamble">
<span id="{$anchor}"/>
</xsl:when>
<xsl:otherwise>
<div id="{$anchor}"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="compute-iref-anchor">
<xsl:variable name="first" select="translate(substring(@item,1,1),$ucase,$lcase)"/>
<xsl:variable name="nkey" select="translate($first,$lcase,'')"/>
<xsl:choose>
<xsl:when test="$nkey=''">
<xsl:value-of select="$anchor-prefix"/>.iref.<xsl:value-of select="$first"/>.<xsl:number level="any" count="iref[starts-with(translate(@item,$ucase,$lcase),$first)]"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$anchor-prefix"/>.iref.<xsl:number level="any" count="iref[translate(substring(@item,1,1),concat($lcase,$ucase),'')='']"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="compute-extref-anchor">
<xsl:variable name="first" select="translate(substring(.,1,1),$ucase,$lcase)"/>
<xsl:variable name="nkey" select="translate($first,$lcase,'')"/>
<xsl:choose>
<xsl:when test="$nkey=''">
<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)]"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$anchor-prefix"/>.extref.<xsl:number level="any" count="x:ref[translate(substring(.,1,1),concat($lcase,$ucase),'')='']"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- list templates depend on the list style -->
<xsl:template match="list[@style='empty' or not(@style)]">
<ul class="empty">
<xsl:call-template name="insertInsDelClass"/>
<xsl:apply-templates />
</ul>
</xsl:template>
<xsl:template match="list[starts-with(@style,'format ')]">
<dl>
<xsl:call-template name="insertInsDelClass"/>
<xsl:apply-templates />
</dl>
</xsl:template>
<xsl:template match="list[@style='hanging']">
<dl>
<xsl:call-template name="insertInsDelClass"/>
<xsl:apply-templates />
</dl>
</xsl:template>
<xsl:template match="list[@style='numbers']">
<ol>
<xsl:call-template name="insertInsDelClass"/>
<xsl:apply-templates />
</ol>
</xsl:template>
<!-- numbered list inside numbered list -->
<xsl:template match="list[@style='numbers']/t/list[@style='numbers']" priority="9">
<ol style="list-style-type: lower-alpha">
<xsl:call-template name="insertInsDelClass"/>
<xsl:apply-templates />
</ol>
</xsl:template>
<xsl:template match="list[@style='letters']">
<ol style="list-style-type: lower-alpha">
<xsl:call-template name="insertInsDelClass"/>
<xsl:apply-templates />
</ol>
</xsl:template>
<!-- nested lettered list uses uppercase -->
<xsl:template match="list//t//list[@style='letters']" priority="9">
<ol style="list-style-type: upper-alpha">
<xsl:call-template name="insertInsDelClass"/>
<xsl:apply-templates />
</ol>
</xsl:template>
<xsl:template match="list[@style='symbols']">
<ul>
<xsl:call-template name="insertInsDelClass"/>
<xsl:apply-templates />
</ul>
</xsl:template>
<!-- same for t(ext) elements -->
<xsl:template match="list[@style='empty' or not(@style)]/t | list[@style='empty' or not(@style)]/ed:replace/ed:*/t">
<!-- Inherited through CSS now <dd style="margin-top: .5em">-->
<li>
<xsl:call-template name="copy-anchor"/>
<xsl:call-template name="insertInsDelClass"/>
<xsl:apply-templates />
</li>
</xsl:template>
<xsl:template match="list[@style='numbers' or @style='symbols' or @style='letters']/x:lt">
<li>
<xsl:call-template name="copy-anchor"/>
<xsl:apply-templates select="t" />
</li>
</xsl:template>
<xsl:template match="list[@style='numbers' or @style='symbols' or @style='letters']/t | list[@style='numbers' or @style='symbols' or @style='letters']/ed:replace/ed:*/t">
<li>
<xsl:call-template name="copy-anchor"/>
<xsl:call-template name="insertInsDelClass"/>
<xsl:for-each select="../..">
<xsl:call-template name="insert-issue-pointer"/>
</xsl:for-each>
<xsl:apply-templates />
</li>
</xsl:template>
<xsl:template match="list[@style='hanging']/x:lt">
<xsl:if test="@hangText!=''">
<dt>
<xsl:call-template name="copy-anchor"/>
<xsl:call-template name="insertInsDelClass"/>
<xsl:variable name="del-node" select="ancestor::ed:del"/>
<xsl:variable name="rep-node" select="ancestor::ed:replace"/>
<xsl:variable name="deleted" select="$del-node and ($rep-node/ed:ins)"/>
<xsl:for-each select="../..">
<xsl:call-template name="insert-issue-pointer">
<xsl:with-param name="deleted-anchor" select="$deleted"/>
</xsl:call-template>
</xsl:for-each>
<xsl:value-of select="@hangText" />
</dt>
</xsl:if>
<dd>
<xsl:call-template name="insertInsDelClass"/>
<!-- if hangIndent present, use 0.7 of the specified value (1em is the width of the "m" character -->
<xsl:if test="../@hangIndent and ../@hangIndent!='0'">
<xsl:attribute name="style">margin-left: <xsl:value-of select="../@hangIndent * 0.7"/>em</xsl:attribute>
</xsl:if>
<xsl:apply-templates select="t" />
</dd>
</xsl:template>
<xsl:template match="list[@style='hanging']/t | list[@style='hanging']/ed:replace/ed:*/t">
<xsl:if test="@hangText!=''">
<dt>
<xsl:call-template name="copy-anchor"/>
<xsl:call-template name="insertInsDelClass"/>
<xsl:if test="count(preceding-sibling::t)=0">
<xsl:variable name="del-node" select="ancestor::ed:del"/>
<xsl:variable name="rep-node" select="ancestor::ed:replace"/>
<xsl:variable name="deleted" select="$del-node and ($rep-node/ed:ins)"/>
<xsl:for-each select="../..">
<xsl:call-template name="insert-issue-pointer">
<xsl:with-param name="deleted-anchor" select="$deleted"/>
</xsl:call-template>
</xsl:for-each>
</xsl:if>
<xsl:value-of select="@hangText" />
</dt>
</xsl:if>
<xsl:variable name="dd-content">
<xsl:apply-templates/>
</xsl:variable>
<xsl:if test="$dd-content!=''">
<dd>
<xsl:call-template name="insertInsDelClass"/>
<!-- if hangIndent present, use 0.7 of the specified value (1em is the width of the "m" character -->
<xsl:if test="../@hangIndent and ../@hangIndent!='0'">
<xsl:attribute name="style">margin-left: <xsl:value-of select="../@hangIndent * 0.7"/>em</xsl:attribute>
</xsl:if>
<xsl:apply-templates />
</dd>
</xsl:if>
</xsl:template>
<xsl:template match="list[starts-with(@style,'format ') and (contains(@style,'%c') or contains(@style,'%d'))]/t">
<xsl:variable name="list" select=".." />
<xsl:variable name="format" select="substring-after(../@style,'format ')" />
<xsl:variable name="pos">
<xsl:choose>
<xsl:when test="$list/@counter">
<xsl:number level="any" count="list[@counter=$list/@counter or (not(@counter) and @style=concat('format ',$list/@counter))]/t" />
</xsl:when>
<xsl:otherwise>
<xsl:number level="any" count="list[concat('format ',@counter)=$list/@style or (not(@counter) and @style=$list/@style)]/t" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<dt>
<xsl:call-template name="copy-anchor"/>
<xsl:choose>
<xsl:when test="contains($format,'%c')">
<xsl:value-of select="substring-before($format,'%c')"/><xsl:number value="$pos" format="a" /><xsl:value-of select="substring-after($format,'%c')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="substring-before($format,'%d')"/><xsl:number value="$pos" format="1" /><xsl:value-of select="substring-after($format,'%d')"/>
</xsl:otherwise>
</xsl:choose>
</dt>
<dd>
<xsl:apply-templates />
</dd>
</xsl:template>
<xsl:template match="middle">
<xsl:apply-templates />
<xsl:apply-templates select="../back//references"/>
</xsl:template>
<xsl:template match="note">
<xsl:variable name="num"><xsl:number/></xsl:variable>
<h1 id="{$anchor-prefix}.note.{$num}">
<xsl:call-template name="insertInsDelClass"/>
<a href="#{$anchor-prefix}.note.{$num}">
<xsl:value-of select="@title" />
</a>
</h1>
<xsl:apply-templates />
</xsl:template>
<xsl:template match="postamble">
<xsl:if test="normalize-space(.) != ''">
<p>
<xsl:call-template name="insertInsDelClass"/>
<xsl:call-template name="editingMark" />
<xsl:apply-templates />
</p>
</xsl:if>
</xsl:template>
<xsl:template match="preamble">
<xsl:if test="normalize-space(.) != ''">
<p>
<xsl:call-template name="copy-anchor"/>
<xsl:call-template name="insertInsDelClass"/>
<xsl:call-template name="editingMark" />
<xsl:apply-templates />
</p>
</xsl:if>
</xsl:template>
<xsl:template name="computed-auto-target">
<xsl:param name="bib"/>
<xsl:param name="ref"/>
<xsl:choose>
<xsl:when test="$ref and $bib/x:source/@href and $bib/x:source/@basename and $ref/@x:rel">
<xsl:value-of select="concat($bib/x:source/@basename,'.html',$ref/@x:rel)" />
</xsl:when>
<xsl:when test="$bib/seriesInfo/@name='RFC'">
<xsl:variable name="sec">
<xsl:choose>
<xsl:when test="$ref and starts-with($ref/@x:rel,'#') and not($ref/@x:sec)">
<xsl:variable name="extdoc" select="document($bib/x:source/@href)"/>
<xsl:for-each select="$extdoc//*[@anchor=substring-after($ref/@x:rel,'#')]">
<xsl:call-template name="get-section-number"/>
</xsl:for-each>
</xsl:when>
<xsl:when test="$ref">
<xsl:value-of select="$ref/@x:sec"/>
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:variable>
<xsl:value-of select="concat($rfcUrlPrefix,$bib/seriesInfo[@name='RFC']/@value,$rfcUrlPostfix)" />
<xsl:if test="$ref and $sec!='' and $rfcUrlFragSection and $rfcUrlFragAppendix">
<xsl:choose>
<xsl:when test="translate(substring($sec,1,1),$ucase,'')=''">
<xsl:value-of select="concat('#',$rfcUrlFragAppendix,$sec)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat('#',$rfcUrlFragSection,$sec)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:when>
<xsl:when test="$bib/seriesInfo/@name='Internet-Draft'">
<xsl:value-of select="concat($internetDraftUrlPrefix,$bib/seriesInfo[@name='Internet-Draft']/@value,$internetDraftUrlPostfix)" />
<xsl:if test="$ref and $ref/@x:sec and $internetDraftUrlFrag">
<xsl:value-of select="concat('#',$internetDraftUrlFrag,$ref/@x:sec)"/>
</xsl:if>
</xsl:when>
<xsl:otherwise />
</xsl:choose>
</xsl:template>
<xsl:template name="computed-target">
<xsl:param name="bib"/>
<xsl:param name="ref"/>
<xsl:choose>
<xsl:when test="$bib/@target">
<xsl:if test="$ref and $ref/@x:sec and $ref/@x:rel">
<xsl:value-of select="concat($bib/@target,$ref/@x:rel)"/>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="computed-auto-target">
<xsl:with-param name="bib" select="$bib"/>
<xsl:with-param name="ref" select="$ref"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="reference">
<!-- check for reference to reference -->
<xsl:variable name="anchor" select="@anchor"/>
<xsl:if test="not(ancestor::ed:del) and not(key('xref-item',$anchor))">
<xsl:call-template name="warning">
<xsl:with-param name="inline" select="'no'"/>
<xsl:with-param name="msg">unused reference '<xsl:value-of select="@anchor"/>'</xsl:with-param>
</xsl:call-template>
</xsl:if>
<!-- check normative/informative -->
<xsl:variable name="t-r-is-normative" select="ancestor-or-self::*[@x:nrm][1]"/>
<xsl:variable name="r-is-normative" select="$t-r-is-normative/@x:nrm='true'"/>
<xsl:if test="$r-is-normative and not(ancestor::ed:del)">
<xsl:variable name="tst">
<xsl:for-each select="key('xref-item',$anchor)">
<xsl:variable name="t-is-normative" select="ancestor-or-self::*[@x:nrm][1]"/>
<xsl:variable name="is-normative" select="$t-is-normative/@x:nrm='true'"/>
<xsl:if test="$is-normative">OK</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:if test="$tst=''">
<xsl:call-template name="warning">
<xsl:with-param name="inline" select="'no'"/>
<xsl:with-param name="msg">all references to the normative reference '<xsl:value-of select="@anchor"/>' appear to be informative</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:if>
<xsl:call-template name="check-anchor"/>
<xsl:variable name="target">
<xsl:choose>
<xsl:when test="@target"><xsl:value-of select="@target" /></xsl:when>
<xsl:otherwise>
<xsl:call-template name="computed-auto-target">
<xsl:with-param name="bib" select="."/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<tr>
<td class="reference">
<xsl:call-template name="insertInsDelClass"/>
<xsl:variable name="del-node" select="ancestor::ed:del"/>
<xsl:variable name="rep-node" select="ancestor::ed:replace"/>
<xsl:variable name="deleted" select="$del-node and ($rep-node/ed:ins)"/>
<xsl:for-each select="../..">
<xsl:call-template name="insert-issue-pointer">
<xsl:with-param name="deleted-anchor" select="$deleted"/>
</xsl:call-template>
</xsl:for-each>
<b id="{@anchor}">
<xsl:call-template name="referencename">
<xsl:with-param name="node" select="." />
</xsl:call-template>
</b>
</td>
<td class="top">
<xsl:call-template name="insertInsDelClass"/>
<xsl:for-each select="front/author">
<xsl:variable name="initials">
<xsl:call-template name="format-initials"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="@surname and @surname!=''">
<xsl:variable name="displayname">
<!-- surname/initials is reversed for last author except when it's the only one -->
<xsl:choose>
<xsl:when test="position()=last() and position()!=1">
<xsl:value-of select="concat($initials,' ',@surname)" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat(@surname,', ',$initials)" />
</xsl:otherwise>
</xsl:choose>
<xsl:if test="@role='editor'">
<xsl:text>, Ed.</xsl:text>
</xsl:if>
</xsl:variable>
<xsl:choose>
<xsl:when test="address/email">
<a>
<xsl:if test="$xml2rfc-linkmailto!='no'">
<xsl:attribute name="href">mailto:<xsl:value-of select="address/email" /></xsl:attribute>
</xsl:if>
<xsl:if test="organization/text()">
<xsl:attribute name="title"><xsl:value-of select="organization/text()"/></xsl:attribute>
</xsl:if>
<xsl:value-of select="$displayname" />
</a>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$displayname" />
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="position()=last() - 1">
<xsl:if test="last() &gt; 2">,</xsl:if>
<xsl:text> and </xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>, </xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="organization/text()">
<xsl:choose>
<xsl:when test="address/uri">
<a href="{address/uri}"><xsl:value-of select="organization" /></a>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="organization" />
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="position()=last() - 1">
<xsl:if test="last() &gt; 2">,</xsl:if>
<xsl:text> and </xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>, </xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise />
</xsl:choose>
</xsl:for-each>
<xsl:choose>
<xsl:when test="string-length($target) &gt; 0">
<xsl:text>&#8220;</xsl:text>
<a href="{$target}"><xsl:value-of select="normalize-space(front/title)" /></a>
<xsl:text>&#8221;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>&#8220;</xsl:text>
<xsl:value-of select="normalize-space(front/title)" />
<xsl:text>&#8221;</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:for-each select="seriesInfo">
<xsl:text>, </xsl:text>
<xsl:choose>
<xsl:when test="not(@name) and not(@value) and ./text()"><xsl:value-of select="." /></xsl:when>
<xsl:otherwise>
<xsl:value-of select="@name" />
<xsl:if test="@value!=''">&#0160;<xsl:value-of select="@value" /></xsl:if>
<xsl:if test="translate(@name,$ucase,$lcase)='internet-draft'"> (work in progress)</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<xsl:if test="front/date/@year != ''">
<xsl:if test="string(number(front/date/@year)) = 'NaN'">
<xsl:call-template name="warning">
<xsl:with-param name="inline" select="'no'"/>
<xsl:with-param name="msg">date/@year should be a number: '<xsl:value-of select="front/date/@year"/>' in reference '<xsl:value-of select="@anchor"/>'</xsl:with-param>
</xsl:call-template>
</xsl:if>
<xsl:text>, </xsl:text>
<xsl:if test="front/date/@month!=''"><xsl:value-of select="front/date/@month" />&#0160;</xsl:if>
<xsl:value-of select="front/date/@year" />
</xsl:if>
<xsl:if test="@target">
<xsl:text>, &lt;</xsl:text>
<a href="{@target}"><xsl:value-of select="@target"/></a>
<xsl:text>&gt;</xsl:text>
</xsl:if>
<xsl:text>.</xsl:text>
<xsl:for-each select="annotation">
<br />
<xsl:apply-templates />
</xsl:for-each>
</td>
</tr>
</xsl:template>
<xsl:template match="references">
<xsl:variable name="name">
<xsl:if test="ancestor::ed:del">
<xsl:text>del-</xsl:text>
</xsl:if>
<xsl:number level="any"/>
</xsl:variable>
<xsl:variable name="refseccount" select="count(/rfc/back/references)+count(/rfc/back/ed:replace/ed:ins/references)"/>
<!-- insert pseudo section when needed -->
<xsl:if test="not(preceding::references) and $refseccount!=1">
<xsl:call-template name="insert-conditional-hrule"/>
<h1 id="{$anchor-prefix}.references">
<xsl:call-template name="insert-conditional-pagebreak"/>
<xsl:variable name="sectionNumber">
<xsl:call-template name="get-references-section-number"/>
</xsl:variable>
<a id="{$anchor-prefix}.section.{$sectionNumber}" href="#{$anchor-prefix}.section.{$sectionNumber}">
<xsl:call-template name="emit-section-number">
<xsl:with-param name="no" select="$sectionNumber"/>
</xsl:call-template>
</a>
<xsl:text> </xsl:text>
<xsl:value-of select="$xml2rfc-refparent"/>
</h1>
</xsl:if>
<xsl:variable name="elemtype">
<xsl:choose>
<xsl:when test="$refseccount!=1">h2</xsl:when>
<xsl:otherwise>h1</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="title">
<xsl:choose>
<xsl:when test="not(@title) or @title=''"><xsl:value-of select="$xml2rfc-refparent"/></xsl:when>
<xsl:otherwise><xsl:value-of select="@title"/></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:element name="{$elemtype}">
<xsl:if test="$name='1'">
<xsl:call-template name="insert-conditional-pagebreak"/>
</xsl:if>
<xsl:variable name="sectionNumber">
<xsl:call-template name="get-section-number"/>
</xsl:variable>
<xsl:variable name="anchorpref">
<xsl:choose>
<xsl:when test="$elemtype='h1'"></xsl:when>
<xsl:otherwise>.<xsl:value-of select="$name"/></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:attribute name="id"><xsl:value-of select="concat($anchor-prefix,'.references',$anchorpref)"/></xsl:attribute>
<a href="#{$anchor-prefix}.section.{$sectionNumber}" id="{$anchor-prefix}.section.{$sectionNumber}">
<xsl:call-template name="emit-section-number">
<xsl:with-param name="no" select="$sectionNumber"/>
</xsl:call-template>
</a>
<xsl:text> </xsl:text>
<xsl:value-of select="$title"/>
</xsl:element>
<table>
<xsl:choose>
<xsl:when test="$xml2rfc-sortrefs='yes' and $xml2rfc-symrefs!='no'">
<xsl:apply-templates>
<xsl:sort select="@anchor|.//ed:ins//reference/@anchor" />
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates />
</xsl:otherwise>
</xsl:choose>
</table>
</xsl:template>
<xsl:template match="rfc">
<xsl:variable name="ignored">
<xsl:call-template name="parse-pis">
<xsl:with-param name="nodes" select="//processing-instruction('rfc-ext')"/>
<xsl:with-param name="attr" select="'SANITYCHECK'"/>
</xsl:call-template>
<xsl:call-template name="parse-pis">
<xsl:with-param name="nodes" select="//processing-instruction('rfc')"/>
<xsl:with-param name="attr" select="'SANITYCHECK'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="lang">
<xsl:call-template name="get-lang" />
</xsl:variable>
<html lang="{$lang}">
<head>
<xsl:attribute name="profile">
<xsl:text>http://www.w3.org/2006/03/hcard</xsl:text>
<xsl:if test="$xml2rfc-ext-support-rfc2731!='no'">
<xsl:text> </xsl:text>
<xsl:text>http://dublincore.org/documents/2008/08/04/dc-html/</xsl:text>
</xsl:if>
</xsl:attribute>
<title>
<xsl:apply-templates select="front/title" mode="get-text-content" />
</title>
<xsl:call-template name="insertCss" />
<!-- <link rel="alternate stylesheet" type="text/css" media="screen" title="Plain (typewriter)" href="rfc2629tty.css" /> -->
<!-- link elements -->
<xsl:if test="$xml2rfc-toc='yes'">
<link rel="Contents" href="#{$anchor-prefix}.toc" />
</xsl:if>
<link rel="Author" href="#{$anchor-prefix}.authors" />
<xsl:if test="$xml2rfc-private=''">
<xsl:choose>
<xsl:when test="$no-copylong">
<link rel="Copyright" href="#{$anchor-prefix}.copyrightnotice" />
</xsl:when>
<xsl:otherwise>
<link rel="Copyright" href="#{$anchor-prefix}.copyright" />
</xsl:otherwise>
</xsl:choose>
</xsl:if>
<xsl:if test="$has-index">
<link rel="Index" href="#{$anchor-prefix}.index" />
</xsl:if>
<xsl:apply-templates select="/" mode="links" />
<xsl:for-each select="x:link">
<link><xsl:copy-of select="@*" /></link>
</xsl:for-each>
<xsl:if test="@number">
<xsl:variable name="number">
<xsl:choose>
<xsl:when test="string-length(@number) &lt; 2">000<xsl:value-of select="@number"/></xsl:when>
<xsl:when test="string-length(@number) &lt; 3">00<xsl:value-of select="@number"/></xsl:when>
<xsl:when test="string-length(@number) &lt; 4">0<xsl:value-of select="@number"/></xsl:when>
<xsl:otherwise><xsl:value-of select="@number"/></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<link rel="Alternate" title="Authorative ASCII Version" href="http://www.ietf.org/rfc/rfc{@number}.txt" />
<link rel="Help" title="Additional Information on tools.ietf.org" href="http://tools.ietf.org/html/rfc{$number}" />
</xsl:if>
<!-- generator -->
<xsl:variable name="gen">
<xsl:call-template name="get-generator" />
</xsl:variable>
<meta name="generator" content="{$gen}" />
<!-- keywords -->
<xsl:if test="front/keyword">
<xsl:variable name="keyw">
<xsl:call-template name="get-keywords" />
</xsl:variable>
<meta name="keywords" content="{$keyw}" />
</xsl:if>
<xsl:if test="$xml2rfc-ext-support-rfc2731!='no'">
<!-- Dublin Core Metadata -->
<link rel="schema.dct" href="http://purl.org/dc/terms/" />
<!-- DC creator, see RFC2731 -->
<xsl:for-each select="front/author">
<xsl:variable name="initials">
<xsl:call-template name="format-initials"/>
</xsl:variable>
<meta name="dct.creator" content="{concat(@surname,', ',$initials)}" />
</xsl:for-each>
<xsl:if test="$xml2rfc-private=''">
<xsl:choose>
<xsl:when test="@number">
<meta name="dct.identifier" content="urn:ietf:rfc:{@number}" />
</xsl:when>
<xsl:when test="@docName">
<meta name="dct.identifier" content="urn:ietf:id:{@docName}" />
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
<meta name="dct.issued" scheme="ISO8601">
<xsl:attribute name="content">
<xsl:value-of select="concat($xml2rfc-ext-pub-year,'-',$pub-month-numeric)"/>
<xsl:if test="$xml2rfc-ext-pub-day != '' and not(@number)">
<xsl:value-of select="concat('-',format-number($xml2rfc-ext-pub-day,'00'))"/>
</xsl:if>
</xsl:attribute>
</meta>
<xsl:if test="@obsoletes!=''">
<xsl:call-template name="rfclist-for-dcmeta">
<xsl:with-param name="list" select="@obsoletes"/>
</xsl:call-template>
</xsl:if>
</xsl:if>
<xsl:if test="front/abstract">
<meta name="dct.abstract" content="{normalize-space(front/abstract)}" />
</xsl:if>
<xsl:if test="@number">
<meta name="dct.isPartOf" content="urn:issn:2070-1721" />
</xsl:if>
</xsl:if>
<!-- this replicates dct.abstract, but is used by Google & friends -->
<xsl:if test="front/abstract">
<meta name="description" content="{normalize-space(front/abstract)}" />
</xsl:if>
</head>
<body>
<!-- insert diagnostics -->
<xsl:call-template name="insert-diagnostics"/>
<xsl:apply-templates select="front" />
<xsl:apply-templates select="middle" />
<xsl:call-template name="back" />
</body>
</html>
</xsl:template>
<xsl:template match="t">
<xsl:if test="preceding-sibling::section or preceding-sibling::appendix">
<xsl:call-template name="warning">
<xsl:with-param name="msg">The paragraph below is misplaced; maybe a section is closed in the wrong place: </xsl:with-param>
<xsl:with-param name="msg2"><xsl:value-of select="."/></xsl:with-param>
</xsl:call-template>
</xsl:if>
<xsl:choose>
<xsl:when test="@anchor">
<div id="{@anchor}"><xsl:apply-templates mode="t-content" select="node()[1]" /></div>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates mode="t-content" select="node()[1]" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- for t-content, dispatch to default templates if it's block-level content -->
<xsl:template mode="t-content" match="list|figure|texttable">
<!-- <xsl:comment>t-content block-level</xsl:comment> -->
<xsl:apply-templates select="." />
<xsl:apply-templates select="following-sibling::node()[1]" mode="t-content" />
</xsl:template>
<!-- ... otherwise group into p elements -->
<xsl:template mode="t-content" match="*|node()">
<xsl:variable name="p">
<xsl:call-template name="get-paragraph-number" />
</xsl:variable>
<!-- do not open a new p element if this is a whitespace-only text node and no siblings follow -->
<xsl:if test="not(self::text() and normalize-space(.)='' and not(following-sibling::node()))">
<p>
<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">
<xsl:attribute name="id"><xsl:value-of select="$anchor-prefix"/>.section.<xsl:value-of select="$p"/></xsl:attribute>
</xsl:if>
<xsl:call-template name="insertInsDelClass"/>
<xsl:call-template name="editingMark" />
<xsl:apply-templates mode="t-content2" select="." />
</p>
</xsl:if>
<xsl:apply-templates mode="t-content" select="following-sibling::*[self::list or self::figure or self::texttable][1]" />
</xsl:template>
<xsl:template mode="t-content2" match="*">
<xsl:apply-templates select="." />
<xsl:if test="not(following-sibling::node()[1] [self::list or self::figure or self::texttable])">
<xsl:apply-templates select="following-sibling::node()[1]" mode="t-content2" />
</xsl:if>
</xsl:template>
<xsl:template mode="t-content2" match="text()">
<xsl:apply-templates select="." />
<xsl:if test="not(following-sibling::node()[1] [self::list or self::figure or self::texttable])">
<xsl:apply-templates select="following-sibling::node()[1]" mode="t-content2" />
</xsl:if>
</xsl:template>
<xsl:template mode="t-content2" match="comment()|processing-instruction()">
<xsl:apply-templates select="." />
<xsl:if test="not(following-sibling::node()[1] [self::list or self::figure or self::texttable])">
<xsl:apply-templates select="following-sibling::node()[1]" mode="t-content2" />
</xsl:if>
</xsl:template>
<xsl:template match="title">
<xsl:if test="@abbrev and string-length(@abbrev) > 40">
<xsl:call-template name="warning">
<xsl:with-param name="inline" select="'no'"/>
<xsl:with-param name="msg">title/@abbrev too long (max 40 characters)</xsl:with-param>
</xsl:call-template>
</xsl:if>
<xsl:if test="string-length(.) > 40 and (not(@abbrev) or @abbrev='')">
<xsl:call-template name="warning">
<xsl:with-param name="inline" select="'no'"/>
<xsl:with-param name="msg">title too long, should supply title/@abbrev attribute with less than 40 characters</xsl:with-param>
</xsl:call-template>
</xsl:if>
<xsl:apply-templates />
</xsl:template>
<xsl:template name="insertTitle">
<xsl:choose>
<xsl:when test="@ed:old-title">
<del>
<xsl:if test="ancestor-or-self::*[@ed:entered-by] and @ed:datetime">
<xsl:attribute name="title"><xsl:value-of select="concat(@ed:datetime,', ',ancestor-or-self::*[@ed:entered-by][1]/@ed:entered-by)"/></xsl:attribute>
</xsl:if>
<xsl:value-of select="@ed:old-title"/>
</del>
<ins>
<xsl:if test="ancestor-or-self::*[@ed:entered-by] and @ed:datetime">
<xsl:attribute name="title"><xsl:value-of select="concat(@ed:datetime,', ',ancestor-or-self::*[@ed:entered-by][1]/@ed:entered-by)"/></xsl:attribute>
</xsl:if>
<xsl:value-of select="@title"/>
</ins>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@title"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="section|appendix">
<xsl:if test="self::appendix">
<xsl:call-template name="warning">
<xsl:with-param name="inline" select="'no'"/>
<xsl:with-param name="msg">The "appendix" element is deprecated, use "section" inside "back" instead.</xsl:with-param>
</xsl:call-template>
</xsl:if>
<xsl:variable name="sectionNumber">
<xsl:choose>
<xsl:when test="@myns:unnumbered"></xsl:when>
<xsl:when test="ancestor::x:boilerplate"></xsl:when>
<xsl:otherwise><xsl:call-template name="get-section-number" /></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:if test="not(ancestor::section) and not(ancestor::x:boilerplate) and not(@myns:notoclink)">
<xsl:call-template name="insert-conditional-hrule"/>
</xsl:if>
<xsl:variable name="elemtype">
<xsl:choose>
<xsl:when test="count(ancestor::section) &lt;= 4">h<xsl:value-of select="1 + count(ancestor::section)"/></xsl:when>
<xsl:otherwise>h6</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- process irefs immediadetely following the section so that their anchor
actually is the section heading -->
<xsl:apply-templates select="iref[count(preceding-sibling::*[not(self::iref)])=0]"/>
<xsl:element name="{$elemtype}">
<xsl:if test="$sectionNumber!=''">
<xsl:attribute name="id"><xsl:value-of select="$anchor-prefix"/>.section.<xsl:value-of select="$sectionNumber"/></xsl:attribute>
</xsl:if>
<xsl:choose>
<xsl:when test="$sectionNumber='1' or $sectionNumber='A'">
<!-- pagebreak, this the first section -->
<xsl:attribute name="class">np</xsl:attribute>
</xsl:when>
<xsl:when test="not(ancestor::section) and not(@myns:notoclink)">
<xsl:call-template name="insert-conditional-pagebreak"/>
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
<xsl:call-template name="insertInsDelClass" />
<xsl:if test="$sectionNumber!='' and not(contains($sectionNumber,'unnumbered-'))">
<a href="#{$anchor-prefix}.section.{$sectionNumber}">
<xsl:call-template name="emit-section-number">
<xsl:with-param name="no" select="$sectionNumber"/>
</xsl:call-template>
</a>
<xsl:text>&#0160;</xsl:text>
</xsl:if>
<!-- issue tracking? -->
<xsl:if test="@ed:resolves">
<xsl:call-template name="insert-issue-pointer"/>
</xsl:if>
<xsl:choose>
<xsl:when test="@anchor">
<xsl:call-template name="check-anchor"/>
<a id="{@anchor}" href="#{@anchor}"><xsl:call-template name="insertTitle"/></a>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="insertTitle"/>
</xsl:otherwise>
</xsl:choose>
</xsl:element>
<!-- continue with all child elements but the irefs processed above -->
<xsl:apply-templates select="*[not(self::iref)]|iref[count(preceding-sibling::*[not(self::iref)])!=0]" />
</xsl:template>
<xsl:template match="spanx[@style='emph' or not(@style)]">
<em>
<xsl:call-template name="copy-anchor"/>
<xsl:apply-templates />
</em>
</xsl:template>
<xsl:template match="spanx[@style='verb']">
<samp>
<xsl:call-template name="copy-anchor"/>
<xsl:apply-templates />
</samp>
</xsl:template>
<xsl:template match="spanx[@style='strong']">
<strong>
<xsl:call-template name="copy-anchor"/>
<xsl:apply-templates />
</strong>
</xsl:template>
<xsl:template name="insert-blank-lines">
<xsl:param name="no"/>
<xsl:choose>
<xsl:when test="$no &lt;= 0">
<br/>
<!-- done -->
</xsl:when>
<xsl:otherwise>
<br/>
<xsl:call-template name="insert-blank-lines">
<xsl:with-param name="no" select="$no - 1"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="vspace[not(@blankLines)]">
<br />
</xsl:template>
<xsl:template match="vspace">
<xsl:call-template name="insert-blank-lines">
<xsl:with-param name="no" select="@blankLines"/>
</xsl:call-template>
</xsl:template>
<!-- keep the root for the case when we process XSLT-inline markup -->
<xsl:variable name="src" select="/" />
<xsl:template name="render-section-ref">
<xsl:param name="from" />
<xsl:param name="to" />
<xsl:variable name="refname">
<xsl:for-each select="$to">
<xsl:call-template name="get-section-type">
<xsl:with-param name="prec" select="$from/preceding-sibling::node()[1]" />
</xsl:call-template>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="refnum">
<xsl:for-each select="$to">
<xsl:call-template name="get-section-number" />
</xsl:for-each>
</xsl:variable>
<xsl:attribute name="title">
<xsl:value-of select="$to/@title" />
</xsl:attribute>
<xsl:choose>
<xsl:when test="$from/@format='counter'">
<xsl:value-of select="$refnum"/>
</xsl:when>
<xsl:when test="$from/@format='title'">
<xsl:value-of select="$to/@title"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="normalize-space(concat($refname,'&#160;',$refnum))"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="xref[node()]">
<xsl:variable name="target" select="@target" />
<xsl:variable name="node" select="key('anchor-item',$target)" />
<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>
<xsl:choose>
<!-- x:fmt='none': do not generate any links -->
<xsl:when test="@x:fmt='none'">
<xsl:choose>
<xsl:when test="$node/self::reference">
<cite title="{normalize-space($node/front/title)}">
<xsl:if test="$xml2rfc-ext-include-references-in-index='yes'">
<xsl:attribute name="id"><xsl:value-of select="$anchor"/></xsl:attribute>
</xsl:if>
<!-- insert id when a backlink to this xref is needed in the index -->
<xsl:if test="//iref[@x:for-anchor=$target] | //iref[@x:for-anchor='' and ../@anchor=$target]">
<xsl:attribute name="id"><xsl:value-of select="$anchor"/></xsl:attribute>
</xsl:if>
<xsl:apply-templates/>
</cite>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<!-- Other x:fmt values than "none": unsupported -->
<xsl:when test="@x:fmt and @x:fmt!='none'">
<xsl:call-template name="error">
<xsl:with-param name="msg" select="concat('unknown xref/@x:fmt extension: ',@x:fmt)"/>
</xsl:call-template>
</xsl:when>
<!-- Section links -->
<xsl:when test="$node/self::section or $node/self::appendix">
<xsl:choose>
<xsl:when test="@format='none'">
<a href="#{@target}">
<!-- insert id when a backlink to this xref is needed in the index -->
<xsl:if test="//iref[@x:for-anchor=$target] | //iref[@x:for-anchor='' and ../@anchor=$target]">
<xsl:attribute name="id"><xsl:value-of select="$anchor"/></xsl:attribute>
</xsl:if>
<xsl:apply-templates/>
</a>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
<xsl:text> (</xsl:text>
<a href="#{@target}">
<!-- insert id when a backlink to this xref is needed in the index -->
<xsl:if test="//iref[@x:for-anchor=$target] | //iref[@x:for-anchor='' and ../@anchor=$target]">
<xsl:attribute name="id"><xsl:value-of select="$anchor"/></xsl:attribute>
</xsl:if>
<xsl:call-template name="render-section-ref">
<xsl:with-param name="from" select="."/>
<xsl:with-param name="to" select="$node"/>
</xsl:call-template>
</a>
<xsl:text>)</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<!-- check normative/informative -->
<xsl:variable name="t-is-normative" select="ancestor-or-self::*[@x:nrm][1]"/>
<xsl:variable name="is-normative" select="$t-is-normative/@x:nrm='true'"/>
<xsl:if test="count($node)=1 and $is-normative">
<xsl:variable name="t-r-is-normative" select="$node/ancestor-or-self::*[@x:nrm][1]"/>
<xsl:variable name="r-is-normative" select="$t-r-is-normative/@x:nrm='true'"/>
<xsl:if test="not($r-is-normative)">
<xsl:call-template name="warning">
<xsl:with-param name="inline" select="'no'"/>
<xsl:with-param name="msg" select="concat('Potentially normative reference to ',@target,' not referenced normatively')"/>
</xsl:call-template>
</xsl:if>
</xsl:if>
<a href="#{$target}">
<xsl:if test="@format='none'">
<xsl:if test="$xml2rfc-ext-include-references-in-index='yes'">
<xsl:attribute name="id"><xsl:value-of select="$anchor"/></xsl:attribute>
</xsl:if>
</xsl:if>
<xsl:apply-templates />
</a>
<xsl:if test="not(@format='none')">
<xsl:for-each select="$src/rfc/back/references//reference[@anchor=$target]">
<xsl:text> </xsl:text>
<cite title="{normalize-space(front/title)}">
<xsl:if test="$xml2rfc-ext-include-references-in-index='yes'">
<xsl:attribute name="id"><xsl:value-of select="$anchor"/></xsl:attribute>
</xsl:if>
<xsl:call-template name="referencename">
<xsl:with-param name="node" select="." />
</xsl:call-template>
</cite>
</xsl:for-each>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:key name="iref-xanch" match="iref[@x:for-anchor]" use="@x:for-anchor"/>
<xsl:template match="xref[not(node())]">
<xsl:variable name="xref" select="."/>
<xsl:variable name="anchor"><xsl:value-of select="$anchor-prefix"/>.xref.<xsl:value-of select="$xref/@target"/>.<xsl:number level="any" count="xref[@target=$xref/@target]"/></xsl:variable>
<!-- ensure we have the right context, this <xref> may be processed from within the boilerplate -->
<xsl:for-each select="$src">
<xsl:variable name="node" select="key('anchor-item',$xref/@target)" />
<xsl:if test="count($node)=0 and not($node/ancestor::ed:del)">
<xsl:for-each select="$xref">
<xsl:call-template name="error">
<xsl:with-param name="msg" select="concat('Undefined target: ',$xref/@target)"/>
</xsl:call-template>
</xsl:for-each>
</xsl:if>
<xsl:choose>
<!-- Section links -->
<xsl:when test="$node/self::section or $node/self::appendix">
<a href="#{$xref/@target}">
<!-- insert id when a backlink to this xref is needed in the index -->
<xsl:if test="key('iref-xanch',$xref/@target) | key('iref-xanch','')[../@anchor=$xref/@target]">
<xsl:attribute name="id"><xsl:value-of select="$anchor"/></xsl:attribute>
</xsl:if>
<xsl:call-template name="render-section-ref">
<xsl:with-param name="from" select="$xref"/>
<xsl:with-param name="to" select="$node"/>
</xsl:call-template>
</a>
</xsl:when>
<!-- Figure links -->
<xsl:when test="$node/self::figure">
<a href="#{$xref/@target}">
<xsl:variable name="figcnt">
<xsl:for-each select="$node">
<xsl:number level="any" count="figure[(@title!='' or @anchor!='') and not(@suppress-title='true')]" />
</xsl:for-each>
</xsl:variable>
<xsl:choose>
<xsl:when test="$xref/@format='counter'">
<xsl:value-of select="$figcnt" />
</xsl:when>
<xsl:when test="$xref/@format='title'">
<xsl:value-of select="$node/@title" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="normalize-space(concat('Figure&#160;',$figcnt))"/>
</xsl:otherwise>
</xsl:choose>
</a>
</xsl:when>
<!-- Table links -->
<xsl:when test="$node/self::texttable">
<a href="#{$xref/@target}">
<xsl:variable name="tabcnt">
<xsl:for-each select="$node">
<xsl:number level="any" count="texttable[(@title!='' or @anchor!='') and not(@suppress-title='true')]" />
</xsl:for-each>
</xsl:variable>
<xsl:choose>
<xsl:when test="$xref/@format='counter'">
<xsl:value-of select="$tabcnt" />
</xsl:when>
<xsl:when test="$xref/@format='title'">
<xsl:value-of select="$node/@title" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="normalize-space(concat('Table&#160;',$tabcnt))"/>
</xsl:otherwise>
</xsl:choose>
</a>
</xsl:when>
<!-- Paragraph links -->
<xsl:when test="$node/self::t">
<a href="#{$xref/@target}">
<xsl:variable name="tcnt">
<xsl:for-each select="$node">
<xsl:call-template name="get-paragraph-number" />
</xsl:for-each>
</xsl:variable>
<xsl:choose>
<xsl:when test="$xref/@format='counter'">
<xsl:value-of select="$tcnt" />
</xsl:when>
<xsl:when test="$xref/@format='title'">
<xsl:value-of select="$node/@title" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="normalize-space(concat('Paragraph&#160;',substring-after($tcnt,'p.')))"/>
</xsl:otherwise>
</xsl:choose>
</a>
</xsl:when>
<!-- Comment links -->
<xsl:when test="$node/self::cref">
<a href="#{$xref/@target}">
<xsl:variable name="name">
<xsl:for-each select="$node">
<xsl:call-template name="get-comment-name" />
</xsl:for-each>
</xsl:variable>
<xsl:choose>
<xsl:when test="$xref/@format='counter'">
<xsl:value-of select="$name" />
</xsl:when>
<xsl:when test="$xref/@format='title'">
<xsl:value-of select="$node/@title" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="normalize-space(concat('Comment&#160;',$name))"/>
</xsl:otherwise>
</xsl:choose>
</a>
</xsl:when>
<!-- Reference links -->
<xsl:when test="$node/self::reference">
<!-- check normative/informative -->
<xsl:variable name="t-is-normative" select="$xref/ancestor-or-self::*[@x:nrm][1]"/>
<xsl:variable name="is-normative" select="$t-is-normative/@x:nrm='true'"/>
<xsl:if test="count($node)=1 and $is-normative">
<xsl:variable name="t-r-is-normative" select="$node/ancestor-or-self::*[@x:nrm][1]"/>
<xsl:variable name="r-is-normative" select="$t-r-is-normative/@x:nrm='true'"/>
<xsl:if test="not($r-is-normative)">
<xsl:for-each select="$xref">
<xsl:call-template name="warning">
<xsl:with-param name="inline" select="'no'"/>
<xsl:with-param name="msg" select="concat('Potentially normative reference to ',$xref/@target,' not referenced normatively')"/>
</xsl:call-template>
</xsl:for-each>
</xsl:if>
</xsl:if>
<xsl:variable name="href">
<xsl:call-template name="computed-target">
<xsl:with-param name="bib" select="$node"/>
<xsl:with-param name="ref" select="$xref"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="sec">
<xsl:choose>
<xsl:when test="starts-with($xref/@x:rel,'#') and not($xref/@x:sec) and $node/x:source/@href">
<xsl:variable name="extdoc" select="document($node/x:source/@href)"/>
<xsl:variable name="nodes" select="$extdoc//*[@anchor=substring-after($xref/@x:rel,'#')]"/>
<xsl:if test="not($nodes)">
<xsl:call-template name="error">
<xsl:with-param name="msg">Anchor '<xsl:value-of select="substring-after($xref/@x:rel,'#')"/>' not found in <xsl:value-of select="$node/x:source/@href"/>.</xsl:with-param>
</xsl:call-template>
</xsl:if>
<xsl:for-each select="$nodes">
<xsl:call-template name="get-section-number"/>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$xref/@x:sec"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="secterm">
<xsl:choose>
<!-- starts with letter? -->
<xsl:when test="translate(substring($sec,1,1),$ucase,'')=''">Appendix</xsl:when>
<xsl:otherwise>Section</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="fmt">
<xsl:choose>
<xsl:when test="$xref/@x:fmt!=''"><xsl:value-of select="$xref/@x:fmt"/></xsl:when>
<xsl:when test="$xref/ancestor::artwork">,</xsl:when>
<xsl:otherwise>of</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="title">
<xsl:choose>
<xsl:when test="starts-with($xref/@x:rel,'#') and not($xref/@x:sec) and $node/x:source/@href">
<xsl:variable name="extdoc" select="document($node/x:source/@href)"/>
<xsl:variable name="nodes" select="$extdoc//*[@anchor=substring-after($xref//@x:rel,'#')]"/>
<xsl:if test="not($nodes)">
<xsl:call-template name="error">
<xsl:with-param name="msg">Anchor '<xsl:value-of select="substring-after($xref//@x:rel,'#')"/>' not found in <xsl:value-of select="$node/x:source/@href"/>.</xsl:with-param>
</xsl:call-template>
</xsl:if>
<xsl:for-each select="$nodes">
<xsl:value-of select="@title"/>
</xsl:for-each>
</xsl:when>
<xsl:otherwise />
</xsl:choose>
</xsl:variable>
<!--
Formats:
() [XXXX] (Section SS)
, [XXXX], Section SS
of Section SS of [XXXX]
sec Section SS
number SS
-->
<xsl:if test="$fmt and not($fmt='()' or $fmt=',' or $fmt='of' or $fmt='sec' or $fmt='anchor' or $fmt='number')">
<xsl:call-template name="error">
<xsl:with-param name="msg" select="concat('unknown xref/@x:fmt extension: ',$fmt)"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="$sec!=''">
<xsl:choose>
<xsl:when test="$fmt='of' or $fmt='sec'">
<xsl:choose>
<xsl:when test="$href!=''">
<a href="{$href}">
<xsl:if test="$title!=''">
<xsl:attribute name="title"><xsl:value-of select="$title"/></xsl:attribute>
</xsl:if>
<xsl:if test="$fmt='sec' and $xml2rfc-ext-include-references-in-index='yes'">
<xsl:attribute name="id"><xsl:value-of select="$anchor"/></xsl:attribute>
</xsl:if>
<xsl:value-of select="$secterm"/>
<xsl:text> </xsl:text>
<xsl:value-of select="$sec"/>
</a>
</xsl:when>
<xsl:otherwise><xsl:value-of select="$secterm"/><xsl:text> </xsl:text><xsl:value-of select="$sec"/></xsl:otherwise>
</xsl:choose>
<xsl:if test="$fmt='of'">
<xsl:text> of </xsl:text>
</xsl:if>
</xsl:when>
<xsl:when test="$fmt='number'">
<xsl:choose>
<xsl:when test="$href!=''">
<a href="{$href}">
<xsl:if test="$title!=''">
<xsl:attribute name="title"><xsl:value-of select="$title"/></xsl:attribute>
</xsl:if>
<xsl:if test="$xml2rfc-ext-include-references-in-index='yes'">
<xsl:attribute name="id"><xsl:value-of select="$anchor"/></xsl:attribute>
</xsl:if>
<xsl:value-of select="$sec"/>
</a>
</xsl:when>
<xsl:otherwise><xsl:value-of select="$sec"/></xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise />
</xsl:choose>
</xsl:if>
<xsl:if test="$sec='' or ($fmt!='sec' and $fmt!='number')">
<a href="#{$xref/@target}">
<xsl:if test="$xml2rfc-ext-include-references-in-index='yes'">
<xsl:attribute name="id"><xsl:value-of select="$anchor"/></xsl:attribute>
</xsl:if>
<cite title="{normalize-space($node/front/title)}">
<xsl:variable name="val">
<xsl:call-template name="referencename">
<xsl:with-param name="node" select="$node" />
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$fmt='anchor'">
<!-- remove brackets -->
<xsl:value-of select="substring($val,2,string-length($val)-2)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$val"/>
</xsl:otherwise>
</xsl:choose>
</cite>
</a>
</xsl:if>
<xsl:if test="$sec!=''">
<xsl:choose>
<xsl:when test="$fmt='()'">
<xsl:text> (</xsl:text>
<xsl:choose>
<xsl:when test="$href!=''">
<a href="{$href}"><xsl:value-of select="$secterm"/><xsl:text> </xsl:text><xsl:value-of select="$sec"/></a>
</xsl:when>
<xsl:otherwise><xsl:value-of select="$secterm"/><xsl:text> </xsl:text><xsl:value-of select="$sec"/></xsl:otherwise>
</xsl:choose>
<xsl:text>)</xsl:text>
</xsl:when>
<xsl:when test="$fmt=','">
<xsl:text>, </xsl:text>
<xsl:choose>
<xsl:when test="$href!=''">
<a href="{$href}">
<xsl:if test="$title!=''">
<xsl:attribute name="title"><xsl:value-of select="$title"/></xsl:attribute>
</xsl:if>
<xsl:value-of select="$secterm"/>
<xsl:text> </xsl:text>
<xsl:value-of select="$sec"/>
</a>
</xsl:when>
<xsl:otherwise><xsl:value-of select="$secterm"/><xsl:text> </xsl:text><xsl:value-of select="$sec"/></xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="error">
<xsl:with-param name="msg" select="concat('xref to unknown element: ',name($node))"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:template>
<!-- mark unmatched elements red -->
<xsl:template match="*">
<xsl:call-template name="error">
<xsl:with-param name="inline" select="'no'"/>
<xsl:with-param name="msg">no XSLT template for element '<xsl:value-of select="name()"/>'</xsl:with-param>
</xsl:call-template>
<tt class="error">&lt;<xsl:value-of select="name()" />&gt;</tt>
<xsl:copy><xsl:apply-templates select="node()|@*" /></xsl:copy>
<tt class="error">&lt;/<xsl:value-of select="name()" />&gt;</tt>
</xsl:template>
<xsl:template match="/">
<xsl:apply-templates select="*" />
</xsl:template>
<!-- utility templates -->
<xsl:template name="collectLeftHeaderColumn">
<xsl:param name="mode" />
<!-- default case -->
<xsl:if test="$xml2rfc-private=''">
<xsl:choose>
<xsl:when test="/rfc/@number and $header-format='2010' and $submissionType='independent'">
<myns:item>Independent Submission</myns:item>
</xsl:when>
<xsl:when test="/rfc/@number and $header-format='2010' and $submissionType='IETF'">
<myns:item>Internet Engineering Task Force (IETF)</myns:item>
</xsl:when>
<xsl:when test="/rfc/@number and $header-format='2010' and $submissionType='IRTF'">
<myns:item>Internet Research Task Force (IRTF)</myns:item>
</xsl:when>
<xsl:when test="/rfc/@number and $header-format='2010' and $submissionType='IAB'">
<myns:item>Internet Architecture Board (IAB)</myns:item>
</xsl:when>
<xsl:when test="/rfc/front/workgroup and (not(/rfc/@number) or /rfc/@number='')">
<xsl:for-each select="/rfc/front/workgroup">
<myns:item><xsl:value-of select="."/></myns:item>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:if test="starts-with(/rfc/@docName,'draft-ietf-') and not(/rfc/front/workgroup)">
<xsl:call-template name="info">
<xsl:with-param name="inline" select="'no'"/>
<xsl:with-param name="msg">WG submissions should include a /rfc/front/workgroup element</xsl:with-param>
</xsl:call-template>
</xsl:if>
<myns:item>Network Working Group</myns:item>
</xsl:otherwise>
</xsl:choose>
<myns:item>
<xsl:choose>
<xsl:when test="/rfc/@ipr and not(/rfc/@number)">Internet-Draft</xsl:when>
<xsl:otherwise>Request for Comments: <xsl:value-of select="/rfc/@number"/></xsl:otherwise>
</xsl:choose>
</myns:item>
<xsl:if test="/rfc/@obsoletes!=''">
<myns:item>
<xsl:text>Obsoletes: </xsl:text>
<xsl:call-template name="rfclist">
<xsl:with-param name="list" select="normalize-space(/rfc/@obsoletes)" />
</xsl:call-template>
<xsl:if test="not(/rfc/@number)"> (if approved)</xsl:if>
</myns:item>
</xsl:if>
<xsl:if test="/rfc/@seriesNo">
<myns:item>
<xsl:choose>
<xsl:when test="/rfc/@category='bcp'">BCP: <xsl:value-of select="/rfc/@seriesNo" /></xsl:when>
<xsl:when test="/rfc/@category='info'">FYI: <xsl:value-of select="/rfc/@seriesNo" /></xsl:when>
<xsl:when test="/rfc/@category='std'">STD: <xsl:value-of select="/rfc/@seriesNo" /></xsl:when>
<xsl:otherwise><xsl:value-of select="concat(/rfc/@category,': ',/rfc/@seriesNo)" /></xsl:otherwise>
</xsl:choose>
</myns:item>
</xsl:if>
<xsl:if test="/rfc/@updates!=''">
<myns:item>
<xsl:text>Updates: </xsl:text>
<xsl:call-template name="rfclist">
<xsl:with-param name="list" select="normalize-space(/rfc/@updates)" />
</xsl:call-template>
<xsl:if test="not(/rfc/@number)"> (if approved)</xsl:if>
</myns:item>
</xsl:if>
<myns:item>
<xsl:choose>
<xsl:when test="/rfc/@number">
<xsl:text>Category: </xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>Intended status: </xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="get-category-long" />
</myns:item>
<xsl:if test="/rfc/@ipr and not(/rfc/@number)">
<myns:item>Expires: <xsl:call-template name="expirydate" /></myns:item>
</xsl:if>
</xsl:if>
<!-- private case -->
<xsl:if test="$xml2rfc-private!=''">
<myns:item><xsl:value-of select="$xml2rfc-private" /></myns:item>
</xsl:if>
<xsl:if test="$header-format='2010' and /rfc/@number">
<myns:item>ISSN: 2070-1721</myns:item>
</xsl:if>
</xsl:template>
<xsl:template name="collectRightHeaderColumn">
<xsl:for-each select="author">
<xsl:variable name="initials">
<xsl:call-template name="format-initials"/>
</xsl:variable>
<xsl:if test="@surname">
<myns:item>
<xsl:value-of select="concat($initials,' ',@surname)" />
<xsl:if test="@role">
<xsl:choose>
<xsl:when test="@role='editor'">
<xsl:text>, Editor</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>, </xsl:text><xsl:value-of select="@role" />
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</myns:item>
</xsl:if>
<xsl:variable name="org">
<xsl:choose>
<xsl:when test="organization/@abbrev"><xsl:value-of select="organization/@abbrev" /></xsl:when>
<xsl:otherwise><xsl:value-of select="organization" /></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="orgOfFollowing">
<xsl:choose>
<xsl:when test="following-sibling::*[1]/organization/@abbrev"><xsl:value-of select="following-sibling::*[1]/organization/@abbrev" /></xsl:when>
<xsl:otherwise><xsl:value-of select="following-sibling::*/organization" /></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:if test="$org != $orgOfFollowing and $org != ''">
<myns:item><xsl:value-of select="$org" /></myns:item>
</xsl:if>
</xsl:for-each>
<myns:item>
<xsl:if test="$xml2rfc-ext-pub-month!=''">
<xsl:value-of select="$xml2rfc-ext-pub-month" />
<xsl:if test="$xml2rfc-ext-pub-day!='' and /rfc/@ipr and not(/rfc/@number)">
<xsl:text> </xsl:text>
<xsl:value-of select="$xml2rfc-ext-pub-day" />
<xsl:text>,</xsl:text>
</xsl:if>
</xsl:if>
<xsl:if test="$xml2rfc-ext-pub-day='' and /rfc/@docName and not(substring(/rfc/@docName, string-length(/rfc/@docName) - string-length('-latest') + 1) = '-latest')">
<xsl:call-template name="warning">
<xsl:with-param name="msg" select="concat('/rfc/front/date/@day appears to be missing for a historic draft dated ', $pub-yearmonth)"/>
<xsl:with-param name="inline" select="'no'"/>
</xsl:call-template>
</xsl:if>
<xsl:value-of select="concat(' ',$xml2rfc-ext-pub-year)" />
</myns:item>
</xsl:template>
<xsl:template name="emitheader">
<xsl:param name="lc" />
<xsl:param name="rc" />
<tbody>
<xsl:for-each select="$lc/myns:item | $rc/myns:item">
<xsl:variable name="pos" select="position()" />
<xsl:if test="$pos &lt; count($lc/myns:item) + 1 or $pos &lt; count($rc/myns:item) + 1">
<tr>
<td class="left"><xsl:call-template name="copynodes"><xsl:with-param name="nodes" select="$lc/myns:item[$pos]/node()" /></xsl:call-template></td>
<td class="right"><xsl:call-template name="copynodes"><xsl:with-param name="nodes" select="$rc/myns:item[$pos]/node()" /></xsl:call-template></td>
</tr>
</xsl:if>
</xsl:for-each>
</tbody>
</xsl:template>
<!-- convenience template that avoids copying namespace nodes we don't want -->
<xsl:template name="copynodes">
<xsl:param name="nodes" />
<xsl:for-each select="$nodes">
<xsl:choose>
<xsl:when test="namespace-uri()='http://www.w3.org/1999/xhtml'">
<xsl:element name="{name()}" namespace="{namespace-uri()}">
<xsl:copy-of select="@*|node()" />
</xsl:element>
</xsl:when>
<xsl:when test="self::*">
<xsl:element name="{name()}">
<xsl:copy-of select="@*|node()" />
</xsl:element>
</xsl:when>
<!-- workaround for opera, remove when Opera > 9.0.x comes out -->
<xsl:when test="self::text()">
<xsl:value-of select="."/>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="." />
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:template>