Changeset 754 for rfc2629xslt/rfc2629.xslt
- Timestamp:
- 31/01/10 23:09:48 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
rfc2629xslt/rfc2629.xslt
r741 r754 2 2 XSLT transformation from RFC2629 XML format to HTML 3 3 4 Copyright (c) 2006-20 09, Julian Reschke (julian.reschke@greenbytes.de)4 Copyright (c) 2006-2010, Julian Reschke (julian.reschke@greenbytes.de) 5 5 All rights reserved. 6 6 … … 290 290 </xsl:param> 291 291 292 <!-- experimental support for RFC 5741, work in progress -->293 294 <xsl:param name="xml2rfc-ext-hab">295 <xsl:call-template name="parse-pis">296 <xsl:with-param name="nodes" select="/processing-instruction('rfc-ext')"/>297 <xsl:with-param name="attr" select="'h-a-b'"/>298 <xsl:with-param name="default" select="'no'"/>299 </xsl:call-template>300 </xsl:param>301 302 292 <!-- experimental support for TLP 4.0, work in progress --> 303 293 … … 436 426 <xsl:when test="$pub-yearmonth >= 201001 or 437 427 ($rfcno=5741 or $rfcno=5742 or $rfcno=5743)" 428 >2010</xsl:when> 429 <xsl:otherwise/> 430 </xsl:choose> 431 </xsl:variable> 432 433 <xsl:variable name="rfc-boilerplate"> 434 <xsl:choose> 435 <!-- RFC boilerplate as defined in RFC 5741, and deployed end of Dec 2009 --> 436 <xsl:when test="$pub-yearmonth >= 201001 or 437 ($rfcno=5741 or $rfcno=5742 or $rfcno=5743)" 438 >2010</xsl:when> 439 <xsl:when test="$xml2rfc-ext-tlp='4'">2010</xsl:when> 440 <xsl:otherwise/> 441 </xsl:choose> 442 </xsl:variable> 443 444 <xsl:variable name="id-boilerplate"> 445 <xsl:choose> 446 <!-- ID boilerplate approved by IESG on Jan 14 2010--> 447 <xsl:when test="$pub-yearmonth >= 201004" 438 448 >2010</xsl:when> 439 449 <xsl:otherwise/> … … 494 504 )" /> 495 505 506 <!-- this makes the Jan 2010 TLP text depend on the tlp ext PI 507 for IDs, and around 2010-01 for RFCs--> 508 <xsl:variable name="ipr-2010-01" select="( 509 ( not(/rfc/@number) and $xml2rfc-ext-tlp='4' ) 510 or 511 ( 512 /rfc/@number and ($pub-yearmonth >= 201001 or 513 $rfcno=5741 or $rfcno=5742 or $rfcno=5743) 514 ) 515 )" /> 516 496 517 <!-- see http://mailman.rfc-editor.org/pipermail/rfc-interest/2009-June/001373.html --> 497 518 <!-- for IDs, implement the change as 2009-11 --> … … 522 543 <!-- does the document contain edits? --> 523 544 <xsl:variable name="has-edits" select="//ed:ins | //ed:del | //ed:replace" /> 524 525 <!-- Templates for the various elements of rfc2629.dtd -->526 545 527 546 <xsl:template match="text()[not(ancestor::artwork)]"> 528 <xsl:variable name="starts-with-ws" select="translate(substring(.,1,1),'	  ','')"/> 529 <xsl:variable name="ends-with-ws" select="translate(substring(.,string-length(.),1),'	  ','')"/> 547 <xsl:variable name="ws" select="'	  '"/> 548 <xsl:variable name="starts-with-ws" select="translate(substring(.,1,1),$ws,'')"/> 549 <xsl:variable name="ends-with-ws" select="translate(substring(.,string-length(.),1),$ws,'')"/> 530 550 <!--<xsl:message> Orig: "<xsl:value-of select="."/>"</xsl:message> 531 551 <xsl:message>Start: "<xsl:value-of select="$starts-with-ws"/>"</xsl:message> … … 886 906 </xsl:template> 887 907 888 <xsl:template match="back"> 908 <!-- this is a named template because <back> may be absent --> 909 <xsl:template name="back"> 889 910 890 911 <!-- add editorial comments --> … … 899 920 900 921 <!-- add all other top-level sections under <back> --> 901 <xsl:apply-templates select=" *[not(self::references) and not(self::ed:replace and .//references)]" />922 <xsl:apply-templates select="back/*[not(self::references) and not(self::ed:replace and .//references)]" /> 902 923 903 924 <!-- insert the index if index entries exist --> … … 1697 1718 <link rel="Author" href="#{$anchor-prefix}.authors" /> 1698 1719 <xsl:if test="$xml2rfc-private=''"> 1699 <link rel="Copyright" href="#{$anchor-prefix}.copyright" /> 1720 <xsl:choose> 1721 <xsl:when test="$no-copylong"> 1722 <link rel="Copyright" href="#{$anchor-prefix}.copyrightnotice" /> 1723 </xsl:when> 1724 <xsl:otherwise> 1725 <link rel="Copyright" href="#{$anchor-prefix}.copyright" /> 1726 </xsl:otherwise> 1727 </xsl:choose> 1700 1728 </xsl:if> 1701 1729 <xsl:if test="$has-index"> … … 1735 1763 <xsl:if test="$xml2rfc-ext-support-rfc2731!='no'"> 1736 1764 <!-- Dublin Core Metadata --> 1737 <link rel="schema. DC" href="http://purl.org/dc/elements/1.1/" />1765 <link rel="schema.dct" href="http://purl.org/dc/terms/" /> 1738 1766 1739 1767 <!-- DC creator, see RFC2731 --> … … 1742 1770 <xsl:call-template name="format-initials"/> 1743 1771 </xsl:variable> 1744 <meta name=" DC.Creator" content="{concat(@surname,', ',$initials)}" />1772 <meta name="dct.creator" content="{concat(@surname,', ',$initials)}" /> 1745 1773 </xsl:for-each> 1746 1774 … … 1748 1776 <xsl:choose> 1749 1777 <xsl:when test="@number"> 1750 <meta name=" DC.Identifier" content="urn:ietf:rfc:{@number}" />1778 <meta name="dct.identifier" content="urn:ietf:rfc:{@number}" /> 1751 1779 </xsl:when> 1752 1780 <xsl:when test="@docName"> 1753 <meta name=" DC.Identifier" content="urn:ietf:id:{@docName}" />1781 <meta name="dct.identifier" content="urn:ietf:id:{@docName}" /> 1754 1782 </xsl:when> 1755 1783 <xsl:otherwise/> 1756 1784 </xsl:choose> 1757 <meta name=" DC.Date.Issued" scheme="ISO8601">1785 <meta name="dct.issued" scheme="ISO8601"> 1758 1786 <xsl:attribute name="content"> 1759 1787 <xsl:value-of select="concat($xml2rfc-ext-pub-year,'-',$pub-month-numeric)"/> … … 1772 1800 1773 1801 <xsl:if test="front/abstract"> 1774 <meta name=" DC.Description.Abstract" content="{normalize-space(front/abstract)}" />1802 <meta name="dct.abstract" content="{normalize-space(front/abstract)}" /> 1775 1803 </xsl:if> 1776 1804 1777 1805 <xsl:if test="@number"> 1778 <meta name=" DC.isPartOf" content="urn:issn:2070-1721" />1806 <meta name="dct.isPartOf" content="urn:issn:2070-1721" /> 1779 1807 </xsl:if> 1780 1808 1781 1809 </xsl:if> 1782 1810 1783 <!-- this replicates dc .description.abstract, but is used by Google & friends -->1811 <!-- this replicates dct.abstract, but is used by Google & friends --> 1784 1812 <xsl:if test="front/abstract"> 1785 1813 <meta name="description" content="{normalize-space(front/abstract)}" /> … … 1793 1821 <xsl:apply-templates select="front" /> 1794 1822 <xsl:apply-templates select="middle" /> 1795 <xsl: apply-templates select="back" />1823 <xsl:call-template name="back" /> 1796 1824 </body> 1797 1825 </html> … … 2509 2537 </xsl:when> 2510 2538 <xsl:otherwise> 2539 <xsl:if test="starts-with(/rfc/@docName,'draft-ietf-') and not(/rfc/front/workgroup)"> 2540 <xsl:call-template name="info"> 2541 <xsl:with-param name="inline" select="'no'"/> 2542 <xsl:with-param name="msg">WG submissions should include a /rfc/front/workgroup element</xsl:with-param> 2543 </xsl:call-template> 2544 </xsl:if> 2511 2545 <myns:item>Network Working Group</myns:item> 2512 2546 </xsl:otherwise> … … 2514 2548 <myns:item> 2515 2549 <xsl:choose> 2516 <xsl:when test="/rfc/@ipr and not(/rfc/@number)">Internet 2550 <xsl:when test="/rfc/@ipr and not(/rfc/@number)">Internet-Draft</xsl:when> 2517 2551 <xsl:otherwise>Request for Comments: <xsl:value-of select="/rfc/@number"/></xsl:otherwise> 2518 2552 </xsl:choose> 2519 2553 </myns:item> 2520 <xsl:if test="/rfc/@obsoletes and /rfc/@obsoletes!=''">2554 <xsl:if test="/rfc/@obsoletes!=''"> 2521 2555 <myns:item> 2522 2556 <xsl:text>Obsoletes: </xsl:text> … … 2537 2571 </myns:item> 2538 2572 </xsl:if> 2539 <xsl:if test="/rfc/@updates and /rfc/@updates!=''">2573 <xsl:if test="/rfc/@updates!=''"> 2540 2574 <myns:item> 2541 2575 <xsl:text>Updates: </xsl:text> … … 2834 2868 <t> 2835 2869 This document is subject to the rights, licenses and restrictions 2836 contained in BCP 78<xsl:if test="$submissionType='independent'"> and at <eref target="http://www.rfc-editor.org/copyright.html" /></xsl:if>, and except as set forth therein, the authors2870 contained in BCP 78<xsl:if test="$submissionType='independent'"> and at <eref target="http://www.rfc-editor.org/copyright.html">http://www.rfc-editor.org/copyright.html</eref></xsl:if>, and except as set forth therein, the authors 2837 2871 retain all their rights. 2838 2872 </t> … … 2871 2905 <t> 2872 2906 The limited permissions granted above are perpetual and will not be 2873 revoked by the Internet Society or its successors or assign ees.2907 revoked by the Internet Society or its successors or assigns. 2874 2908 </t> 2875 2909 <t> … … 2904 2938 of such proprietary rights by implementers or users of this 2905 2939 specification can be obtained from the IETF on-line IPR repository 2906 at <eref target="http://www.ietf.org/ipr" />.2940 at <eref target="http://www.ietf.org/ipr">http://www.ietf.org/ipr</eref>. 2907 2941 </t> 2908 2942 <t> … … 3979 4013 </xsl:when> 3980 4014 3981 <!-- as of Feb 2010 -->3982 <xsl:when test="$ xml2rfc-ext-tlp='4'and (/rfc/@ipr = 'trust200902'4015 <!-- as of Jan 2010, TLP 4.0 --> 4016 <xsl:when test="$ipr-2010-01 and (/rfc/@ipr = 'trust200902' 3983 4017 or /rfc/@ipr = 'noModificationTrust200902' 3984 4018 or /rfc/@ipr = 'noDerivativesTrust200902' … … 4032 4066 </xsl:choose> 4033 4067 </t> 4034 <t> 4035 Internet-Drafts are working documents of the Internet Engineering 4036 Task Force (IETF), its areas, and its working groups. 4037 Note that other groups may also distribute working documents as 4038 Internet-Drafts. 4039 </t> 4068 <xsl:choose> 4069 <xsl:when test="$id-boilerplate='2010'"> 4070 <t> 4071 Internet-Drafts are working documents of the Internet Engineering 4072 Task Force (IETF). Note that other groups may also distribute 4073 working documents as Internet-Drafts. The list of current 4074 Internet-Drafts is at <eref target='http://datatracker.ietf.org/drafts/current/'>http://datatracker.ietf.org/drafts/current/</eref>. 4075 </t> 4076 </xsl:when> 4077 <xsl:otherwise> 4078 <t> 4079 Internet-Drafts are working documents of the Internet Engineering 4080 Task Force (IETF), its areas, and its working groups. 4081 Note that other groups may also distribute working documents as 4082 Internet-Drafts. 4083 </t> 4084 </xsl:otherwise> 4085 </xsl:choose> 4040 4086 <t> 4041 4087 Internet-Drafts are draft documents valid for a maximum of six months … … 4044 4090 them other than as “work in progress”. 4045 4091 </t> 4046 <t> 4047 The list of current Internet-Drafts can be accessed at 4048 <eref target='http://www.ietf.org/ietf/1id-abstracts.txt'/>. 4049 </t> 4050 <t> 4051 The list of Internet-Draft Shadow Directories can be accessed at 4052 <eref target='http://www.ietf.org/shadow.html'/>. 4053 </t> 4092 <xsl:if test="$id-boilerplate=''"> 4093 <t> 4094 The list of current Internet-Drafts can be accessed at 4095 <eref target='http://www.ietf.org/ietf/1id-abstracts.txt'>http://www.ietf.org/ietf/1id-abstracts.txt</eref>. 4096 </t> 4097 <t> 4098 The list of Internet-Draft Shadow Directories can be accessed at 4099 <eref target='http://www.ietf.org/shadow.html'>http://www.ietf.org/shadow.html</eref>. 4100 </t> 4101 </xsl:if> 4054 4102 <t> 4055 4103 This Internet-Draft will expire in <xsl:call-template name="expirydate" />. … … 4057 4105 </xsl:when> 4058 4106 4059 <xsl:when test="/rfc/@category='bcp' and $ xml2rfc-ext-hab='yes'">4107 <xsl:when test="/rfc/@category='bcp' and $rfc-boilerplate='2010'"> 4060 4108 <t> 4061 4109 This memo documents an Internet Best Current Practice. … … 4069 4117 </t> 4070 4118 </xsl:when> 4071 <xsl:when test="/rfc/@category='exp' and $ xml2rfc-ext-hab='yes'">4119 <xsl:when test="/rfc/@category='exp' and $rfc-boilerplate='2010'"> 4072 4120 <t> 4073 4121 This document is not an Internet Standards Track specification; it is … … 4083 4131 </t> 4084 4132 </xsl:when> 4085 <xsl:when test="/rfc/@category='historic' and $ xml2rfc-ext-hab='yes'">4133 <xsl:when test="/rfc/@category='historic' and $rfc-boilerplate='2010'"> 4086 4134 <t> 4087 4135 This document is not an Internet Standards Track specification; it is … … 4096 4144 </t> 4097 4145 </xsl:when> 4098 <xsl:when test="/rfc/@category='std' and $ xml2rfc-ext-hab='yes'">4146 <xsl:when test="/rfc/@category='std' and $rfc-boilerplate='2010'"> 4099 4147 <t> 4100 4148 This is an Internet Standards Track document. … … 4110 4158 </t> 4111 4159 </xsl:when> 4112 <xsl:when test="(/rfc/@category='info' or not(/rfc/@category)) and $ xml2rfc-ext-hab='yes'">4160 <xsl:when test="(/rfc/@category='info' or not(/rfc/@category)) and $rfc-boilerplate='2010'"> 4113 4161 <t> 4114 4162 This document is not an Internet Standards Track specification; it is … … 4135 4183 4136 4184 <!-- 2nd and 3rd paragraph --> 4137 <xsl:if test="$ xml2rfc-ext-hab='yes'">4185 <xsl:if test="$rfc-boilerplate='2010' and /rfc/@number"> 4138 4186 <t> 4139 4187 <xsl:if test="/rfc/@category='exp'"> … … 4245 4293 </t> 4246 4294 <xsl:choose> 4247 <xsl:when test="$ipr-20 09-09 and $xml2rfc-ext-tlp='4'">4295 <xsl:when test="$ipr-2010-01"> 4248 4296 <t> 4249 4297 This document is subject to BCP 78 and the IETF Trust's Legal … … 4397 4445 </xsl:template> 4398 4446 4399 <xsl:template match="back" mode="toc">4447 <xsl:template name="back-toc"> 4400 4448 4401 4449 <xsl:if test="//cref and $xml2rfc-comments='yes' and $xml2rfc-inline!='yes'"> … … 4411 4459 <xsl:apply-templates select="/rfc/front" mode="toc" /> 4412 4460 </xsl:if> 4413 <xsl:apply-templates select=" *[not(self::references)]" mode="toc" />4461 <xsl:apply-templates select="back/*[not(self::references)]" mode="toc" /> 4414 4462 4415 4463 <!-- insert the index if index entries exist --> … … 4599 4647 4600 4648 <xsl:template match="rfc" mode="toc"> 4601 <xsl:apply-templates select="middle|back" mode="toc" /> 4649 <xsl:apply-templates select="middle" mode="toc" /> 4650 <xsl:call-template name="back-toc" /> 4602 4651 </xsl:template> 4603 4652 … … 4685 4734 <xsl:template name="rfc-or-id-link"> 4686 4735 <xsl:param name="name" /> 4687 <xsl:call-template name="check-front-matter-ref"> 4688 <xsl:with-param name="name" select="$name"/> 4689 </xsl:call-template> 4690 <a> 4691 <xsl:attribute name="href"> 4692 <xsl:choose> 4693 <xsl:when test="starts-with($name,'draft-')"> 4694 <xsl:value-of select="concat($internetDraftUrlPrefix,$name,$internetDraftUrlPostfix)"/> 4695 </xsl:when> 4696 <xsl:otherwise> 4697 <xsl:value-of select="concat($rfcUrlPrefix,$name,$rfcUrlPostfix)"/> 4698 </xsl:otherwise> 4699 </xsl:choose> 4700 </xsl:attribute> 4701 <xsl:value-of select="$name" /> 4702 </a> 4736 4737 <xsl:choose> 4738 <xsl:when test="starts-with($name,'draft-')"> 4739 <a href="{concat($internetDraftUrlPrefix,$name,$internetDraftUrlPostfix)}"><xsl:value-of select="$name"/></a> 4740 <xsl:call-template name="check-front-matter-ref"> 4741 <xsl:with-param name="name" select="$name"/> 4742 </xsl:call-template> 4743 </xsl:when> 4744 <xsl:when test="number($name)=$name"> 4745 <a href="{concat($rfcUrlPrefix,$name,$rfcUrlPostfix)}"><xsl:value-of select="$name"/></a> 4746 <xsl:call-template name="check-front-matter-ref"> 4747 <xsl:with-param name="name" select="$name"/> 4748 </xsl:call-template> 4749 </xsl:when> 4750 <xsl:otherwise> 4751 <xsl:value-of select="$name"/> 4752 <xsl:call-template name="warning"> 4753 <xsl:with-param name="inline" select="'no'"/> 4754 <xsl:with-param name="msg" select="concat('In metadata obsoletes/updates, RFC number of draft name is expected - found: ',$name)"/> 4755 </xsl:call-template> 4756 </xsl:otherwise> 4757 </xsl:choose> 4703 4758 </xsl:template> 4704 4759 … … 4773 4828 <xsl:when test="contains($list,',')"> 4774 4829 <xsl:variable name="rfcNo" select="substring-before($list,',')" /> 4775 <meta name=" DC.Relation.Replaces" content="urn:ietf:rfc:{$rfcNo}" />4830 <meta name="dct.replaces" content="urn:ietf:rfc:{$rfcNo}" /> 4776 4831 <xsl:call-template name="rfclist-for-dcmeta"> 4777 4832 <xsl:with-param name="list" select="normalize-space(substring-after($list,','))" /> … … 4780 4835 <xsl:otherwise> 4781 4836 <xsl:variable name="rfcNo" select="$list" /> 4782 <meta name=" DC.Relation.Replaces" content="urn:ietf:rfc:{$rfcNo}" />4837 <meta name="dct.replaces" content="urn:ietf:rfc:{$rfcNo}" /> 4783 4838 </xsl:otherwise> 4784 4839 </xsl:choose> … … 4840 4895 <!-- Notes --> 4841 4896 <xsl:template match="x:note"> 4897 <xsl:variable name="p"> 4898 <xsl:call-template name="get-paragraph-number" /> 4899 </xsl:variable> 4900 4842 4901 <div class="note"> 4902 <xsl:if test="$p!='' and not(ancestor::ed:del) and not(ancestor::ed:ins)"> 4903 <xsl:attribute name="id"><xsl:value-of select="$anchor-prefix"/>.section.<xsl:value-of select="$p"/></xsl:attribute> 4904 </xsl:if> 4843 4905 <xsl:apply-templates/> 4844 4906 </div> … … 5662 5724 </xsl:template> 5663 5725 5726 <xsl:template name="info"> 5727 <xsl:param name="msg"/> 5728 <xsl:param name="msg2"/> 5729 <xsl:param name="inline"/> 5730 <xsl:call-template name="emit-message"> 5731 <xsl:with-param name="level">INFO</xsl:with-param> 5732 <xsl:with-param name="msg" select="$msg"/> 5733 <xsl:with-param name="msg2" select="$msg2"/> 5734 <xsl:with-param name="inline" select="$inline"/> 5735 </xsl:call-template> 5736 </xsl:template> 5737 5664 5738 <xsl:template name="error"> 5665 5739 <xsl:param name="msg"/> … … 5980 6054 <xsl:when test="$xml2rfc-header!=''"><xsl:value-of select="$xml2rfc-header" /></xsl:when> 5981 6055 <xsl:when test="$xml2rfc-private!=''"/> <!-- private draft, header not set --> 5982 <xsl:when test="/rfc/@ipr and not(/rfc/@number)">I NTERNET DRAFT</xsl:when>6056 <xsl:when test="/rfc/@ipr and not(/rfc/@number)">Internet-Draft</xsl:when> 5983 6057 <xsl:otherwise>RFC <xsl:value-of select="/rfc/@number"/></xsl:otherwise> 5984 6058 </xsl:choose> … … 5989 6063 <xsl:text>http://greenbytes.de/tech/webdav/rfc2629.xslt, </xsl:text> 5990 6064 <!-- when RCS keyword substitution in place, add version info --> 5991 <xsl:if test="contains('$Revision: 1. 497$',':')">5992 <xsl:value-of select="concat('Revision ',normalize-space(translate(substring-after('$Revision: 1. 497$', 'Revision: '),'$','')),', ')" />6065 <xsl:if test="contains('$Revision: 1.508 $',':')"> 6066 <xsl:value-of select="concat('Revision ',normalize-space(translate(substring-after('$Revision: 1.508 $', 'Revision: '),'$','')),', ')" /> 5993 6067 </xsl:if> 5994 <xsl:if test="contains('$Date: 20 09-12-30 19:57:37 $',':')">5995 <xsl:value-of select="concat(normalize-space(translate(substring-after('$Date: 20 09-12-30 19:57:37 $', 'Date: '),'$','')),', ')" />6068 <xsl:if test="contains('$Date: 2010-01-29 12:52:17 $',':')"> 6069 <xsl:value-of select="concat(normalize-space(translate(substring-after('$Date: 2010-01-29 12:52:17 $', 'Date: '),'$','')),', ')" /> 5996 6070 </xsl:if> 5997 6071 <xsl:value-of select="concat('XSLT vendor: ',system-property('xsl:vendor'),' ',system-property('xsl:vendor-url'))" />
Note: See TracChangeset
for help on using the changeset viewer.