Changeset 662 for rfc2629xslt/rfc2629toXHTML.xslt
- Timestamp:
- 05/08/09 13:56:13 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
rfc2629xslt/rfc2629toXHTML.xslt
r599 r662 182 182 183 183 <xsl:variable name="ipr-2009-02" select="( $ipr-2008-11 and ($xml2rfc-ext-pub-year >= 2010 or ($xml2rfc-ext-pub-year >= 2009 and $xml2rfc-ext-pub-month-numeric >= 02)) )"/> 184 185 <!-- see http://mailman.rfc-editor.org/pipermail/rfc-interest/2009-June/001373.html --> 186 <xsl:variable name="abstract-first" select="( /rfc/@number and ( $xml2rfc-ext-pub-year >= 2010 or ($xml2rfc-ext-pub-year >= 2009 and $xml2rfc-ext-pub-month-numeric >= 07) ) )"/> 184 187 185 188 <!-- funding switch --> … … 500 503 <xsl:template match="back"> 501 504 502 <!-- add references section first, no matter where it appears in the503 source document -->504 <!-- as of April 2004, process from middle section505 <xsl:apply-templates select="references" />506 -->507 508 505 <!-- add editorial comments --> 509 506 <xsl:if test="//cref and $xml2rfc-comments='yes' and $xml2rfc-inline!='yes'"> … … 519 516 <xsl:apply-templates select="*[not(self::references) and not(self::ed:replace and .//references)]"/> 520 517 518 <!-- insert the index if index entries exist --> 519 <!-- note it always comes before the authors section --> 520 <xsl:if test="$has-index"> 521 <xsl:call-template name="insertIndex"/> 522 </xsl:if> 523 524 <!-- Authors section is the absolute last thing, except for copyright stuff --> 521 525 <xsl:if test="$xml2rfc-ext-authors-section='end'"> 522 526 <xsl:call-template name="insertAuthors"/> … … 540 544 </xsl:if> 541 545 542 <!-- insert the index if index entries exist -->543 <xsl:if test="$has-index">544 <xsl:call-template name="insertIndex"/>545 </xsl:if>546 547 546 </xsl:template> 548 547 … … 657 656 </xsl:choose> 658 657 659 <xsl:if test="not($xml2rfc-private)"> 660 661 <!-- Get status info formatted as per RFC2629--> 662 <xsl:variable name="preamble"> 663 <xsl:call-template name="insertPreamble"/> 664 </xsl:variable> 665 666 <!-- emit it --> 667 <xsl:choose> 668 <xsl:when test="function-available('exslt:node-set')"> 669 <xsl:apply-templates select="exslt:node-set($preamble)"/> 670 </xsl:when> 671 <xsl:otherwise> 672 <xsl:call-template name="error"> 673 <xsl:with-param name="msg" select="$node-set-warning"/> 674 </xsl:call-template> 675 </xsl:otherwise> 676 </xsl:choose> 658 <xsl:if test="not($xml2rfc-private) and not($abstract-first)"> 659 <xsl:call-template name="emit-ietf-preamble"/> 677 660 </xsl:if> 678 661 … … 683 666 <xsl:apply-templates select="ed:replace[.//note]"/> 684 667 668 <xsl:if test="not($xml2rfc-private) and $abstract-first"> 669 <xsl:call-template name="emit-ietf-preamble"/> 670 </xsl:if> 671 685 672 <xsl:if test="$xml2rfc-toc='yes'"> 686 673 <xsl:apply-templates select="/" mode="toc"/> … … 690 677 </xsl:template> 691 678 679 <xsl:template name="emit-ietf-preamble"> 680 <!-- Get status info formatted as per RFC2629--> 681 <xsl:variable name="preamble"> 682 <xsl:call-template name="insertPreamble"/> 683 </xsl:variable> 684 685 <!-- emit it --> 686 <xsl:choose> 687 <xsl:when test="function-available('exslt:node-set')"> 688 <xsl:apply-templates select="exslt:node-set($preamble)"/> 689 </xsl:when> 690 <xsl:otherwise> 691 <xsl:call-template name="error"> 692 <xsl:with-param name="msg" select="$node-set-warning"/> 693 </xsl:call-template> 694 </xsl:otherwise> 695 </xsl:choose> 696 </xsl:template> 692 697 693 698 <xsl:template match="iref"> … … 1363 1368 <xsl:otherwise/> 1364 1369 </xsl:choose> 1365 <meta name="DC.Date.Issued" scheme="ISO8601" content="{$xml2rfc-ext-pub-year}-{$xml2rfc-ext-pub-month-numeric}"/> 1370 <meta name="DC.Date.Issued" scheme="ISO8601"> 1371 <xsl:attribute name="content"> 1372 <xsl:value-of select="concat($xml2rfc-ext-pub-year,'-',$xml2rfc-ext-pub-month-numeric)"/> 1373 <xsl:if test="$xml2rfc-ext-pub-day != '' and not(/rfc/@number)"> 1374 <xsl:value-of select="concat('-',format-number($xml2rfc-ext-pub-day,'00'))"/> 1375 </xsl:if> 1376 </xsl:attribute> 1377 </meta> 1366 1378 1367 1379 <xsl:if test="/rfc/@obsoletes!=''"> … … 1536 1548 </xsl:if> 1537 1549 <xsl:choose> 1538 <xsl:when test="$sectionNumber='1' ">1550 <xsl:when test="$sectionNumber='1' or $sectionNumber='A'"> 1539 1551 <!-- pagebreak, this the first section --> 1540 1552 <xsl:attribute name="class">np</xsl:attribute> … … 1548 1560 <xsl:call-template name="insertInsDelClass"/> 1549 1561 1550 <xsl:if test="$sectionNumber!='' ">1562 <xsl:if test="$sectionNumber!='' and not(contains($sectionNumber,'unnumbered-'))"> 1551 1563 <a xmlns="http://www.w3.org/1999/xhtml" href="#{$anchor-prefix}.section.{$sectionNumber}"> 1552 1564 <xsl:call-template name="emit-section-number"> … … 1693 1705 </xsl:call-template> 1694 1706 </xsl:when> 1695 1707 1696 1708 <!-- Section links --> 1697 1709 <xsl:when test="$node/self::section or $node/self::appendix"> 1698 <xsl:apply-templates/> 1699 <xsl:text> (</xsl:text> 1700 <a xmlns="http://www.w3.org/1999/xhtml" href="#{@target}"> 1701 <!-- insert id when a backlink to this xref is needed in the index --> 1702 <xsl:if test="//iref[@x:for-anchor=$target] | //iref[@x:for-anchor='' and ../@anchor=$target]"> 1703 <xsl:attribute name="id"><xsl:value-of select="$anchor"/></xsl:attribute> 1704 </xsl:if> 1705 <xsl:call-template name="render-section-ref"> 1706 <xsl:with-param name="from" select="."/> 1707 <xsl:with-param name="to" select="$node"/> 1708 </xsl:call-template> 1709 </a> 1710 <xsl:text>)</xsl:text> 1710 <xsl:choose> 1711 <xsl:when test="@format='none'"> 1712 <a xmlns="http://www.w3.org/1999/xhtml" href="#{@target}"> 1713 <!-- insert id when a backlink to this xref is needed in the index --> 1714 <xsl:if test="//iref[@x:for-anchor=$target] | //iref[@x:for-anchor='' and ../@anchor=$target]"> 1715 <xsl:attribute name="id"><xsl:value-of select="$anchor"/></xsl:attribute> 1716 </xsl:if> 1717 <xsl:apply-templates/> 1718 </a> 1719 </xsl:when> 1720 <xsl:otherwise> 1721 <xsl:apply-templates/> 1722 <xsl:text> (</xsl:text> 1723 <a xmlns="http://www.w3.org/1999/xhtml" href="#{@target}"> 1724 <!-- insert id when a backlink to this xref is needed in the index --> 1725 <xsl:if test="//iref[@x:for-anchor=$target] | //iref[@x:for-anchor='' and ../@anchor=$target]"> 1726 <xsl:attribute name="id"><xsl:value-of select="$anchor"/></xsl:attribute> 1727 </xsl:if> 1728 <xsl:call-template name="render-section-ref"> 1729 <xsl:with-param name="from" select="."/> 1730 <xsl:with-param name="to" select="$node"/> 1731 </xsl:call-template> 1732 </a> 1733 <xsl:text>)</xsl:text> 1734 </xsl:otherwise> 1735 </xsl:choose> 1711 1736 </xsl:when> 1712 1737 … … 2224 2249 <xsl:template name="expirydate"> 2225 2250 <xsl:choose> 2251 <xsl:when test="$xml2rfc-ext-pub-day >= 1"> 2252 <xsl:call-template name="normalize-date"> 2253 <xsl:with-param name="year" select="$xml2rfc-ext-pub-year"/> 2254 <xsl:with-param name="month" select="$xml2rfc-ext-pub-month-numeric"/> 2255 <xsl:with-param name="day" select="$xml2rfc-ext-pub-day + 185"/> 2256 </xsl:call-template> 2257 </xsl:when> 2226 2258 <xsl:when test="$xml2rfc-ext-pub-month='January'">July <xsl:value-of select="$xml2rfc-ext-pub-year"/></xsl:when> 2227 2259 <xsl:when test="$xml2rfc-ext-pub-month='February'">August <xsl:value-of select="$xml2rfc-ext-pub-year"/></xsl:when> … … 2240 2272 </xsl:template> 2241 2273 2274 <xsl:template name="normalize-date"> 2275 <xsl:param name="year"/> 2276 <xsl:param name="month"/> 2277 <xsl:param name="day"/> 2278 2279 <xsl:variable name="isleap" select="(($year mod 4) = 0 and ($year mod 100 != 0)) or ($year mod 400) = 0"/> 2280 2281 <!--<xsl:message> 2282 <xsl:value-of select="concat($year,' ',$month,' ',$day)"/> 2283 </xsl:message>--> 2284 2285 <xsl:variable name="dim"> 2286 <xsl:choose> 2287 <xsl:when test="$month=1 or $month=3 or $month=5 or $month=7 or $month=8 or $month=10 or $month=12">31</xsl:when> 2288 <xsl:when test="$month=2 and $isleap">29</xsl:when> 2289 <xsl:when test="$month=2 and not($isleap)">28</xsl:when> 2290 <xsl:otherwise>30</xsl:otherwise> 2291 </xsl:choose> 2292 </xsl:variable> 2293 2294 <xsl:choose> 2295 <xsl:when test="$day > $dim and $month=12"> 2296 <xsl:call-template name="normalize-date"> 2297 <xsl:with-param name="year" select="$year + 1"/> 2298 <xsl:with-param name="month" select="1"/> 2299 <xsl:with-param name="day" select="$day - $dim"/> 2300 </xsl:call-template> 2301 </xsl:when> 2302 <xsl:when test="$day > $dim"> 2303 <xsl:call-template name="normalize-date"> 2304 <xsl:with-param name="year" select="$year"/> 2305 <xsl:with-param name="month" select="$month + 1"/> 2306 <xsl:with-param name="day" select="$day - $dim"/> 2307 </xsl:call-template> 2308 </xsl:when> 2309 <xsl:otherwise> 2310 <xsl:call-template name="get-month-as-name"> 2311 <xsl:with-param name="month" select="$month"/> 2312 </xsl:call-template> 2313 <xsl:value-of select="concat(' ',$day,', ',$year)"/> 2314 </xsl:otherwise> 2315 </xsl:choose> 2316 2317 </xsl:template> 2318 2242 2319 <xsl:template name="get-month-as-num"> 2243 2320 <xsl:param name="month"/> … … 2301 2378 <xsl:call-template name="insert-conditional-hrule"/> 2302 2379 2303 <h1 xmlns="http://www.w3.org/1999/xhtml" id="{$anchor-prefix}.authors"> 2304 <xsl:call-template name="insert-conditional-pagebreak"/> 2305 <xsl:if test="$number != ''"> 2306 <a href="#{$anchor-prefix}.section.{$number}" id="{$anchor-prefix}.section.{$number}"><xsl:value-of select="$number"/>.</a> 2307 <xsl:text> </xsl:text> 2308 </xsl:if> 2309 <a href="#{$anchor-prefix}.authors"><xsl:call-template name="get-authors-section-title"/></a> 2310 </h1> 2311 2312 <xsl:apply-templates select="/rfc/front/author"/> 2380 <div xmlns="http://www.w3.org/1999/xhtml" class="avoidbreak"> 2381 <h1 id="{$anchor-prefix}.authors"> 2382 <xsl:call-template name="insert-conditional-pagebreak"/> 2383 <xsl:if test="$number != ''"> 2384 <a href="#{$anchor-prefix}.section.{$number}" id="{$anchor-prefix}.section.{$number}"><xsl:value-of select="$number"/>.</a> 2385 <xsl:text> </xsl:text> 2386 </xsl:if> 2387 <a href="#{$anchor-prefix}.authors"><xsl:call-template name="get-authors-section-title"/></a> 2388 </h1> 2389 2390 <xsl:apply-templates select="/rfc/front/author"/> 2391 </div> 2313 2392 </xsl:if> 2314 2393 </xsl:template> … … 2661 2740 border-width: 1px; 2662 2741 } 2742 table.left { 2743 margin-right: auto; 2744 } 2745 table.right { 2746 margin-left: auto; 2747 } 2748 table.center { 2749 margin-left: auto; 2750 margin-right: auto; 2751 } 2663 2752 caption { 2664 2753 caption-side: bottom; … … 2739 2828 margin-left: 0em; 2740 2829 margin-right: 0em; 2830 } 2831 .avoidbreak { 2832 page-break-inside: avoid; 2741 2833 } 2742 2834 </xsl:if><xsl:if test="//x:bcp14">.bcp14 { … … 3572 3664 3573 3665 <!-- special case: RFC5378 escape applies to RFCs as well --> 3574 <!-- <xsl:if test="/rfc/@ipr = 'pre5378Trust200902'"> 3666 <!-- currently only applied to RFCs, need to discuss for IDs --> 3667 <xsl:if test="/rfc/@number and /rfc/@ipr = 'pre5378Trust200902'"> 3575 3668 <t> 3576 3669 This document may contain material from IETF Documents or IETF Contributions published or … … 3583 3676 other than English. 3584 3677 </t> 3585 </xsl:if> -->3678 </xsl:if> 3586 3679 3587 3680 </section> … … 3657 3750 </xsl:otherwise> 3658 3751 </xsl:choose> 3659 <xsl:if test="$number != '' ">3752 <xsl:if test="$number != '' and not(contains($number,'unnumbered-'))"> 3660 3753 <xsl:call-template name="emit-section-number"> 3661 3754 <xsl:with-param name="no" select="$number"/> … … 3682 3775 <xsl:template match="back" mode="toc"> 3683 3776 3684 <!-- <xsl:apply-templates select="references" mode="toc" /> -->3685 3686 3777 <xsl:if test="//cref and $xml2rfc-comments='yes' and $xml2rfc-inline!='yes'"> 3687 3778 <li xmlns="http://www.w3.org/1999/xhtml"> … … 3697 3788 </xsl:if> 3698 3789 <xsl:apply-templates select="*[not(self::references)]" mode="toc"/> 3790 3791 <!-- insert the index if index entries exist --> 3792 <xsl:if test="$has-index"> 3793 <li xmlns="http://www.w3.org/1999/xhtml"> 3794 <xsl:call-template name="insert-toc-line"> 3795 <xsl:with-param name="target" select="concat($anchor-prefix,'.index')"/> 3796 <xsl:with-param name="title" select="'Index'"/> 3797 </xsl:call-template> 3798 </li> 3799 </xsl:if> 3699 3800 3700 3801 <xsl:if test="$xml2rfc-ext-authors-section='end'"> … … 3712 3813 </xsl:if> 3713 3814 3714 <!-- insert the index if index entries exist -->3715 <xsl:if test="//iref">3716 <li xmlns="http://www.w3.org/1999/xhtml">3717 <xsl:call-template name="insert-toc-line">3718 <xsl:with-param name="target" select="concat($anchor-prefix,'.index')"/>3719 <xsl:with-param name="title" select="'Index'"/>3720 </xsl:call-template>3721 </li>3722 </xsl:if>3723 3724 3815 </xsl:template> 3725 3816 … … 4839 4930 <xsl:template name="sectionnumberAndEdits"> 4840 4931 <xsl:choose> 4841 <xsl:when test="ancestor::ed:del">del-<xsl:number count="ed:del//section" level="any"/></xsl:when> 4842 <xsl:when test="@x:fixed-section-number"> 4932 <xsl:when test="ancestor::ed:del"> 4933 <xsl:text>del-</xsl:text> 4934 <xsl:number count="ed:del//section" level="any"/> 4935 </xsl:when> 4936 <xsl:when test="@x:fixed-section-number and @x:fixed-section-number!=''"> 4843 4937 <xsl:value-of select="@x:fixed-section-number"/> 4938 </xsl:when> 4939 <xsl:when test="@x:fixed-section-number and @x:fixed-section-number=''"> 4940 <xsl:text>unnumbered-</xsl:text> 4941 <xsl:number count="section[@x:fixed-section-number='']" level="any"/> 4844 4942 </xsl:when> 4845 4943 <xsl:when test="self::section and parent::ed:ins and local-name(../..)='replace'"> … … 4943 5041 4944 5042 <div xmlns="http://www.w3.org/1999/xhtml" id="{$anch}"> 5043 4945 5044 <xsl:if test="@anchor!=''"> 4946 5045 <div id="{@anchor}"/> … … 4955 5054 <xsl:otherwise>full</xsl:otherwise> 4956 5055 </xsl:choose> 5056 <xsl:choose> 5057 <xsl:when test="@align='left'"> left</xsl:when> 5058 <xsl:when test="@align='right'"> right</xsl:when> 5059 <xsl:when test="@align='center' or not(@align) or @align=''"> center</xsl:when> 5060 <xsl:otherwise/> 5061 </xsl:choose> 5062 4957 5063 </xsl:variable> 4958 5064 4959 <table summary="{preamble}" class="{$style}" cellpadding="3" cellspacing="0"> 4960 5065 <table class="{$style}" cellpadding="3" cellspacing="0"> 4961 5066 <xsl:if test="(@title!='' or @anchor!='') and not(@suppress-title='true')"> 4962 5067 <xsl:variable name="n"><xsl:number level="any" count="texttable[(@title!='' or @anchor!='') and not(@suppress-title='true')]"/></xsl:variable> … … 4975 5080 <xsl:variable name="columns" select="count(ttcol)"/> 4976 5081 <xsl:variable name="fields" select="c | ed:replace/ed:ins/c | ed:replace/ed:del/c"/> 4977 <xsl:for-each select="$fields[ (position() mod $columns) = 1]">5082 <xsl:for-each select="$fields[$columns=1 or (position() mod $columns) = 1]"> 4978 5083 <tr> 4979 5084 <xsl:for-each select=". | following-sibling::c[position() < $columns]"> … … 5122 5227 <xsl:template match="/*/middle//section[not(myns:unnumbered) and not(ancestor::section)]" mode="links"> 5123 5228 <xsl:variable name="sectionNumber"><xsl:call-template name="get-section-number"/></xsl:variable> 5124 <link xmlns="http://www.w3.org/1999/xhtml" rel="Chapter" title="{$sectionNumber} {@title}" href="#{$anchor-prefix}.section.{$sectionNumber}"/> 5229 <xsl:variable name="title"> 5230 <xsl:if test="$sectionNumber!='' and not(contains($sectionNumber,'unnumbered-'))"> 5231 <xsl:value-of select="$sectionNumber"/> 5232 <xsl:text> </xsl:text> 5233 </xsl:if> 5234 <xsl:value-of select="@title"/> 5235 </xsl:variable> 5236 <link xmlns="http://www.w3.org/1999/xhtml" rel="Chapter" title="{$title}" href="#{$anchor-prefix}.section.{$sectionNumber}"/> 5125 5237 <xsl:apply-templates mode="links"/> 5126 5238 </xsl:template> … … 5128 5240 <xsl:template match="/*/back//section[not(myns:unnumbered) and not(ancestor::section)]" mode="links"> 5129 5241 <xsl:variable name="sectionNumber"><xsl:call-template name="get-section-number"/></xsl:variable> 5130 <link xmlns="http://www.w3.org/1999/xhtml" rel="Appendix" title="{$sectionNumber} {@title}" href="#{$anchor-prefix}.section.{$sectionNumber}"/> 5242 <xsl:variable name="title"> 5243 <xsl:if test="$sectionNumber!='' and not(contains($sectionNumber,'unnumbered-'))"> 5244 <xsl:value-of select="$sectionNumber"/> 5245 <xsl:text> </xsl:text> 5246 </xsl:if> 5247 <xsl:value-of select="@title"/> 5248 </xsl:variable> 5249 <link xmlns="http://www.w3.org/1999/xhtml" rel="Appendix" title="{$title}" href="#{$anchor-prefix}.section.{$sectionNumber}"/> 5131 5250 <xsl:apply-templates mode="links"/> 5132 5251 </xsl:template> … … 5206 5325 <xsl:text>http://greenbytes.de/tech/webdav/rfc2629.xslt, </xsl:text> 5207 5326 <!-- when RCS keyword substitution in place, add version info --> 5208 <xsl:if test="contains('$Revision: 1.4 39$',':')">5209 <xsl:value-of select="concat('Revision ',normalize-space(translate(substring-after('$Revision: 1.4 39$', 'Revision: '),'$','')),', ')"/>5327 <xsl:if test="contains('$Revision: 1.447 $',':')"> 5328 <xsl:value-of select="concat('Revision ',normalize-space(translate(substring-after('$Revision: 1.447 $', 'Revision: '),'$','')),', ')"/> 5210 5329 </xsl:if> 5211 <xsl:if test="contains('$Date: 2009-0 6-09 18:43:39$',':')">5212 <xsl:value-of select="concat(normalize-space(translate(substring-after('$Date: 2009-0 6-09 18:43:39$', 'Date: '),'$','')),', ')"/>5330 <xsl:if test="contains('$Date: 2009-08-04 19:54:03 $',':')"> 5331 <xsl:value-of select="concat(normalize-space(translate(substring-after('$Date: 2009-08-04 19:54:03 $', 'Date: '),'$','')),', ')"/> 5213 5332 </xsl:if> 5214 5333 <xsl:value-of select="concat('XSLT vendor: ',system-property('xsl:vendor'),' ',system-property('xsl:vendor-url'))"/> … … 5242 5361 <xsl:variable name="anchor" select="@anchor"/> 5243 5362 <xsl:choose> 5244 <xsl:when test="@x:fixed-section-number ">5363 <xsl:when test="@x:fixed-section-number and @x:fixed-section-number!=''"> 5245 5364 <xsl:value-of select="@x:fixed-section-number"/> 5365 </xsl:when> 5366 <xsl:when test="@x:fixed-section-number and @x:fixed-section-number=''"> 5367 <xsl:text>unnumbered-</xsl:text> 5368 <xsl:number count="section[@x:fixed-section-number='']" level="any"/> 5246 5369 </xsl:when> 5247 5370 <xsl:when test="$has-edits or ancestor::*/@x:fixed-section-number">
Note: See TracChangeset
for help on using the changeset viewer.