Changeset 662 for rfc2629xslt/rfc2629.xslt
- Timestamp:
- 05/08/09 13:56:13 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
rfc2629xslt/rfc2629.xslt
r599 r662 381 381 <xsl:variable name="ipr-2009-02" select="( 382 382 $ipr-2008-11 and ($xml2rfc-ext-pub-year >= 2010 or ($xml2rfc-ext-pub-year >= 2009 and $xml2rfc-ext-pub-month-numeric >= 02)) 383 )" /> 384 385 <!-- see http://mailman.rfc-editor.org/pipermail/rfc-interest/2009-June/001373.html --> 386 <xsl:variable name="abstract-first" select="( 387 /rfc/@number and ( 388 $xml2rfc-ext-pub-year >= 2010 or ($xml2rfc-ext-pub-year >= 2009 and $xml2rfc-ext-pub-month-numeric >= 07) 389 ) 383 390 )" /> 384 391 … … 706 713 <xsl:template match="back"> 707 714 708 <!-- add references section first, no matter where it appears in the709 source document -->710 <!-- as of April 2004, process from middle section711 <xsl:apply-templates select="references" />712 -->713 714 715 <!-- add editorial comments --> 715 716 <xsl:if test="//cref and $xml2rfc-comments='yes' and $xml2rfc-inline!='yes'"> … … 725 726 <xsl:apply-templates select="*[not(self::references) and not(self::ed:replace and .//references)]" /> 726 727 728 <!-- insert the index if index entries exist --> 729 <!-- note it always comes before the authors section --> 730 <xsl:if test="$has-index"> 731 <xsl:call-template name="insertIndex" /> 732 </xsl:if> 733 734 <!-- Authors section is the absolute last thing, except for copyright stuff --> 727 735 <xsl:if test="$xml2rfc-ext-authors-section='end'"> 728 736 <xsl:call-template name="insertAuthors" /> … … 746 754 </xsl:if> 747 755 748 <!-- insert the index if index entries exist -->749 <xsl:if test="$has-index">750 <xsl:call-template name="insertIndex" />751 </xsl:if>752 753 756 </xsl:template> 754 757 … … 863 866 </xsl:choose> 864 867 865 <xsl:if test="not($xml2rfc-private)"> 866 867 <!-- Get status info formatted as per RFC2629--> 868 <xsl:variable name="preamble"> 869 <xsl:call-template name="insertPreamble" /> 870 </xsl:variable> 871 872 <!-- emit it --> 873 <xsl:choose> 874 <xsl:when test="function-available('exslt:node-set')"> 875 <xsl:apply-templates select="exslt:node-set($preamble)" /> 876 </xsl:when> 877 <xsl:otherwise> 878 <xsl:call-template name="error"> 879 <xsl:with-param name="msg" select="$node-set-warning"/> 880 </xsl:call-template> 881 </xsl:otherwise> 882 </xsl:choose> 868 <xsl:if test="not($xml2rfc-private) and not($abstract-first)"> 869 <xsl:call-template name="emit-ietf-preamble"/> 883 870 </xsl:if> 884 871 … … 889 876 <xsl:apply-templates select="ed:replace[.//note]" /> 890 877 878 <xsl:if test="not($xml2rfc-private) and $abstract-first"> 879 <xsl:call-template name="emit-ietf-preamble"/> 880 </xsl:if> 881 891 882 <xsl:if test="$xml2rfc-toc='yes'"> 892 883 <xsl:apply-templates select="/" mode="toc" /> … … 896 887 </xsl:template> 897 888 889 <xsl:template name="emit-ietf-preamble"> 890 <!-- Get status info formatted as per RFC2629--> 891 <xsl:variable name="preamble"> 892 <xsl:call-template name="insertPreamble" /> 893 </xsl:variable> 894 895 <!-- emit it --> 896 <xsl:choose> 897 <xsl:when test="function-available('exslt:node-set')"> 898 <xsl:apply-templates select="exslt:node-set($preamble)" /> 899 </xsl:when> 900 <xsl:otherwise> 901 <xsl:call-template name="error"> 902 <xsl:with-param name="msg" select="$node-set-warning"/> 903 </xsl:call-template> 904 </xsl:otherwise> 905 </xsl:choose> 906 </xsl:template> 898 907 899 908 <xsl:template match="iref"> … … 1569 1578 <xsl:otherwise/> 1570 1579 </xsl:choose> 1571 <meta name="DC.Date.Issued" scheme="ISO8601" content="{$xml2rfc-ext-pub-year}-{$xml2rfc-ext-pub-month-numeric}" /> 1580 <meta name="DC.Date.Issued" scheme="ISO8601"> 1581 <xsl:attribute name="content"> 1582 <xsl:value-of select="concat($xml2rfc-ext-pub-year,'-',$xml2rfc-ext-pub-month-numeric)"/> 1583 <xsl:if test="$xml2rfc-ext-pub-day != '' and not(/rfc/@number)"> 1584 <xsl:value-of select="concat('-',format-number($xml2rfc-ext-pub-day,'00'))"/> 1585 </xsl:if> 1586 </xsl:attribute> 1587 </meta> 1572 1588 1573 1589 <xsl:if test="/rfc/@obsoletes!=''"> … … 1742 1758 </xsl:if> 1743 1759 <xsl:choose> 1744 <xsl:when test="$sectionNumber='1' ">1760 <xsl:when test="$sectionNumber='1' or $sectionNumber='A'"> 1745 1761 <!-- pagebreak, this the first section --> 1746 1762 <xsl:attribute name="class">np</xsl:attribute> … … 1754 1770 <xsl:call-template name="insertInsDelClass" /> 1755 1771 1756 <xsl:if test="$sectionNumber!='' ">1772 <xsl:if test="$sectionNumber!='' and not(contains($sectionNumber,'unnumbered-'))"> 1757 1773 <a href="#{$anchor-prefix}.section.{$sectionNumber}"> 1758 1774 <xsl:call-template name="emit-section-number"> … … 1899 1915 </xsl:call-template> 1900 1916 </xsl:when> 1901 1917 1902 1918 <!-- Section links --> 1903 1919 <xsl:when test="$node/self::section or $node/self::appendix"> 1904 <xsl:apply-templates/> 1905 <xsl:text> (</xsl:text> 1906 <a href="#{@target}"> 1907 <!-- insert id when a backlink to this xref is needed in the index --> 1908 <xsl:if test="//iref[@x:for-anchor=$target] | //iref[@x:for-anchor='' and ../@anchor=$target]"> 1909 <xsl:attribute name="id"><xsl:value-of select="$anchor"/></xsl:attribute> 1910 </xsl:if> 1911 <xsl:call-template name="render-section-ref"> 1912 <xsl:with-param name="from" select="."/> 1913 <xsl:with-param name="to" select="$node"/> 1914 </xsl:call-template> 1915 </a> 1916 <xsl:text>)</xsl:text> 1920 <xsl:choose> 1921 <xsl:when test="@format='none'"> 1922 <a href="#{@target}"> 1923 <!-- insert id when a backlink to this xref is needed in the index --> 1924 <xsl:if test="//iref[@x:for-anchor=$target] | //iref[@x:for-anchor='' and ../@anchor=$target]"> 1925 <xsl:attribute name="id"><xsl:value-of select="$anchor"/></xsl:attribute> 1926 </xsl:if> 1927 <xsl:apply-templates/> 1928 </a> 1929 </xsl:when> 1930 <xsl:otherwise> 1931 <xsl:apply-templates/> 1932 <xsl:text> (</xsl:text> 1933 <a href="#{@target}"> 1934 <!-- insert id when a backlink to this xref is needed in the index --> 1935 <xsl:if test="//iref[@x:for-anchor=$target] | //iref[@x:for-anchor='' and ../@anchor=$target]"> 1936 <xsl:attribute name="id"><xsl:value-of select="$anchor"/></xsl:attribute> 1937 </xsl:if> 1938 <xsl:call-template name="render-section-ref"> 1939 <xsl:with-param name="from" select="."/> 1940 <xsl:with-param name="to" select="$node"/> 1941 </xsl:call-template> 1942 </a> 1943 <xsl:text>)</xsl:text> 1944 </xsl:otherwise> 1945 </xsl:choose> 1917 1946 </xsl:when> 1918 1947 … … 2430 2459 <xsl:template name="expirydate"> 2431 2460 <xsl:choose> 2461 <xsl:when test="$xml2rfc-ext-pub-day >= 1"> 2462 <xsl:call-template name="normalize-date"> 2463 <xsl:with-param name="year" select="$xml2rfc-ext-pub-year"/> 2464 <xsl:with-param name="month" select="$xml2rfc-ext-pub-month-numeric"/> 2465 <xsl:with-param name="day" select="$xml2rfc-ext-pub-day + 185"/> 2466 </xsl:call-template> 2467 </xsl:when> 2432 2468 <xsl:when test="$xml2rfc-ext-pub-month='January'">July <xsl:value-of select="$xml2rfc-ext-pub-year" /></xsl:when> 2433 2469 <xsl:when test="$xml2rfc-ext-pub-month='February'">August <xsl:value-of select="$xml2rfc-ext-pub-year" /></xsl:when> … … 2446 2482 </xsl:template> 2447 2483 2484 <xsl:template name="normalize-date"> 2485 <xsl:param name="year"/> 2486 <xsl:param name="month"/> 2487 <xsl:param name="day"/> 2488 2489 <xsl:variable name="isleap" select="(($year mod 4) = 0 and ($year mod 100 != 0)) or ($year mod 400) = 0" /> 2490 2491 <!--<xsl:message> 2492 <xsl:value-of select="concat($year,' ',$month,' ',$day)"/> 2493 </xsl:message>--> 2494 2495 <xsl:variable name="dim"> 2496 <xsl:choose> 2497 <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> 2498 <xsl:when test="$month=2 and $isleap">29</xsl:when> 2499 <xsl:when test="$month=2 and not($isleap)">28</xsl:when> 2500 <xsl:otherwise>30</xsl:otherwise> 2501 </xsl:choose> 2502 </xsl:variable> 2503 2504 <xsl:choose> 2505 <xsl:when test="$day > $dim and $month=12"> 2506 <xsl:call-template name="normalize-date"> 2507 <xsl:with-param name="year" select="$year + 1"/> 2508 <xsl:with-param name="month" select="1"/> 2509 <xsl:with-param name="day" select="$day - $dim"/> 2510 </xsl:call-template> 2511 </xsl:when> 2512 <xsl:when test="$day > $dim"> 2513 <xsl:call-template name="normalize-date"> 2514 <xsl:with-param name="year" select="$year"/> 2515 <xsl:with-param name="month" select="$month + 1"/> 2516 <xsl:with-param name="day" select="$day - $dim"/> 2517 </xsl:call-template> 2518 </xsl:when> 2519 <xsl:otherwise> 2520 <xsl:call-template name="get-month-as-name"> 2521 <xsl:with-param name="month" select="$month"/> 2522 </xsl:call-template> 2523 <xsl:value-of select="concat(' ',$day,', ',$year)"/> 2524 </xsl:otherwise> 2525 </xsl:choose> 2526 2527 </xsl:template> 2528 2448 2529 <xsl:template name="get-month-as-num"> 2449 2530 <xsl:param name="month" /> … … 2507 2588 <xsl:call-template name="insert-conditional-hrule"/> 2508 2589 2509 <h1 id="{$anchor-prefix}.authors"> 2510 <xsl:call-template name="insert-conditional-pagebreak"/> 2511 <xsl:if test="$number != ''"> 2512 <a href="#{$anchor-prefix}.section.{$number}" id="{$anchor-prefix}.section.{$number}"><xsl:value-of select="$number"/>.</a> 2513 <xsl:text> </xsl:text> 2514 </xsl:if> 2515 <a href="#{$anchor-prefix}.authors"><xsl:call-template name="get-authors-section-title"/></a> 2516 </h1> 2517 2518 <xsl:apply-templates select="/rfc/front/author" /> 2590 <div class="avoidbreak"> 2591 <h1 id="{$anchor-prefix}.authors"> 2592 <xsl:call-template name="insert-conditional-pagebreak"/> 2593 <xsl:if test="$number != ''"> 2594 <a href="#{$anchor-prefix}.section.{$number}" id="{$anchor-prefix}.section.{$number}"><xsl:value-of select="$number"/>.</a> 2595 <xsl:text> </xsl:text> 2596 </xsl:if> 2597 <a href="#{$anchor-prefix}.authors"><xsl:call-template name="get-authors-section-title"/></a> 2598 </h1> 2599 2600 <xsl:apply-templates select="/rfc/front/author" /> 2601 </div> 2519 2602 </xsl:if> 2520 2603 </xsl:template> … … 2867 2950 border-width: 1px; 2868 2951 } 2952 table.left { 2953 margin-right: auto; 2954 } 2955 table.right { 2956 margin-left: auto; 2957 } 2958 table.center { 2959 margin-left: auto; 2960 margin-right: auto; 2961 } 2869 2962 caption { 2870 2963 caption-side: bottom; … … 2945 3038 margin-left: 0em; 2946 3039 margin-right: 0em; 3040 } 3041 .avoidbreak { 3042 page-break-inside: avoid; 2947 3043 } 2948 3044 </xsl:if><xsl:if test="//x:bcp14">.bcp14 { … … 3783 3879 3784 3880 <!-- special case: RFC5378 escape applies to RFCs as well --> 3785 <!-- <xsl:if test="/rfc/@ipr = 'pre5378Trust200902'"> 3881 <!-- currently only applied to RFCs, need to discuss for IDs --> 3882 <xsl:if test="/rfc/@number and /rfc/@ipr = 'pre5378Trust200902'"> 3786 3883 <t> 3787 3884 This document may contain material from IETF Documents or IETF Contributions published or … … 3794 3891 other than English. 3795 3892 </t> 3796 </xsl:if> -->3893 </xsl:if> 3797 3894 3798 3895 </section> … … 3868 3965 </xsl:otherwise> 3869 3966 </xsl:choose> 3870 <xsl:if test="$number != '' ">3967 <xsl:if test="$number != '' and not(contains($number,'unnumbered-'))"> 3871 3968 <xsl:call-template name="emit-section-number"> 3872 3969 <xsl:with-param name="no" select="$number"/> … … 3893 3990 <xsl:template match="back" mode="toc"> 3894 3991 3895 <!-- <xsl:apply-templates select="references" mode="toc" /> -->3896 3897 3992 <xsl:if test="//cref and $xml2rfc-comments='yes' and $xml2rfc-inline!='yes'"> 3898 3993 <li> … … 3908 4003 </xsl:if> 3909 4004 <xsl:apply-templates select="*[not(self::references)]" mode="toc" /> 4005 4006 <!-- insert the index if index entries exist --> 4007 <xsl:if test="$has-index"> 4008 <li> 4009 <xsl:call-template name="insert-toc-line"> 4010 <xsl:with-param name="target" select="concat($anchor-prefix,'.index')"/> 4011 <xsl:with-param name="title" select="'Index'"/> 4012 </xsl:call-template> 4013 </li> 4014 </xsl:if> 3910 4015 3911 4016 <xsl:if test="$xml2rfc-ext-authors-section='end'"> … … 3923 4028 </xsl:if> 3924 4029 3925 <!-- insert the index if index entries exist -->3926 <xsl:if test="//iref">3927 <li>3928 <xsl:call-template name="insert-toc-line">3929 <xsl:with-param name="target" select="concat($anchor-prefix,'.index')"/>3930 <xsl:with-param name="title" select="'Index'"/>3931 </xsl:call-template>3932 </li>3933 </xsl:if>3934 3935 4030 </xsl:template> 3936 4031 … … 5051 5146 <xsl:template name="sectionnumberAndEdits"> 5052 5147 <xsl:choose> 5053 <xsl:when test="ancestor::ed:del">del-<xsl:number count="ed:del//section" level="any"/></xsl:when> 5054 <xsl:when test="@x:fixed-section-number"> 5148 <xsl:when test="ancestor::ed:del"> 5149 <xsl:text>del-</xsl:text> 5150 <xsl:number count="ed:del//section" level="any"/> 5151 </xsl:when> 5152 <xsl:when test="@x:fixed-section-number and @x:fixed-section-number!=''"> 5055 5153 <xsl:value-of select="@x:fixed-section-number"/> 5154 </xsl:when> 5155 <xsl:when test="@x:fixed-section-number and @x:fixed-section-number=''"> 5156 <xsl:text>unnumbered-</xsl:text> 5157 <xsl:number count="section[@x:fixed-section-number='']" level="any"/> 5056 5158 </xsl:when> 5057 5159 <xsl:when test="self::section and parent::ed:ins and local-name(../..)='replace'"> … … 5155 5257 5156 5258 <div id="{$anch}"> 5259 5157 5260 <xsl:if test="@anchor!=''"> 5158 5261 <div id="{@anchor}"/> … … 5167 5270 <xsl:otherwise>full</xsl:otherwise> 5168 5271 </xsl:choose> 5272 <xsl:choose> 5273 <xsl:when test="@align='left'"> left</xsl:when> 5274 <xsl:when test="@align='right'"> right</xsl:when> 5275 <xsl:when test="@align='center' or not(@align) or @align=''"> center</xsl:when> 5276 <xsl:otherwise/> 5277 </xsl:choose> 5278 5169 5279 </xsl:variable> 5170 5280 5171 <table summary="{preamble}" class="{$style}" cellpadding="3" cellspacing="0"> 5172 5281 <table class="{$style}" cellpadding="3" cellspacing="0"> 5173 5282 <xsl:if test="(@title!='' or @anchor!='') and not(@suppress-title='true')"> 5174 5283 <xsl:variable name="n"><xsl:number level="any" count="texttable[(@title!='' or @anchor!='') and not(@suppress-title='true')]" /></xsl:variable> … … 5187 5296 <xsl:variable name="columns" select="count(ttcol)" /> 5188 5297 <xsl:variable name="fields" select="c | ed:replace/ed:ins/c | ed:replace/ed:del/c" /> 5189 <xsl:for-each select="$fields[ (position() mod $columns) = 1]">5298 <xsl:for-each select="$fields[$columns=1 or (position() mod $columns) = 1]"> 5190 5299 <tr> 5191 5300 <xsl:for-each select=". | following-sibling::c[position() < $columns]"> … … 5334 5443 <xsl:template match="/*/middle//section[not(myns:unnumbered) and not(ancestor::section)]" mode="links"> 5335 5444 <xsl:variable name="sectionNumber"><xsl:call-template name="get-section-number" /></xsl:variable> 5336 <link rel="Chapter" title="{$sectionNumber} {@title}" href="#{$anchor-prefix}.section.{$sectionNumber}" /> 5445 <xsl:variable name="title"> 5446 <xsl:if test="$sectionNumber!='' and not(contains($sectionNumber,'unnumbered-'))"> 5447 <xsl:value-of select="$sectionNumber"/> 5448 <xsl:text> </xsl:text> 5449 </xsl:if> 5450 <xsl:value-of select="@title"/> 5451 </xsl:variable> 5452 <link rel="Chapter" title="{$title}" href="#{$anchor-prefix}.section.{$sectionNumber}"/> 5337 5453 <xsl:apply-templates mode="links" /> 5338 5454 </xsl:template> … … 5340 5456 <xsl:template match="/*/back//section[not(myns:unnumbered) and not(ancestor::section)]" mode="links"> 5341 5457 <xsl:variable name="sectionNumber"><xsl:call-template name="get-section-number" /></xsl:variable> 5342 <link rel="Appendix" title="{$sectionNumber} {@title}" href="#{$anchor-prefix}.section.{$sectionNumber}" /> 5458 <xsl:variable name="title"> 5459 <xsl:if test="$sectionNumber!='' and not(contains($sectionNumber,'unnumbered-'))"> 5460 <xsl:value-of select="$sectionNumber"/> 5461 <xsl:text> </xsl:text> 5462 </xsl:if> 5463 <xsl:value-of select="@title"/> 5464 </xsl:variable> 5465 <link rel="Appendix" title="{$title}" href="#{$anchor-prefix}.section.{$sectionNumber}"/> 5343 5466 <xsl:apply-templates mode="links" /> 5344 5467 </xsl:template> … … 5418 5541 <xsl:text>http://greenbytes.de/tech/webdav/rfc2629.xslt, </xsl:text> 5419 5542 <!-- when RCS keyword substitution in place, add version info --> 5420 <xsl:if test="contains('$Revision: 1.4 39$',':')">5421 <xsl:value-of select="concat('Revision ',normalize-space(translate(substring-after('$Revision: 1.4 39$', 'Revision: '),'$','')),', ')" />5543 <xsl:if test="contains('$Revision: 1.447 $',':')"> 5544 <xsl:value-of select="concat('Revision ',normalize-space(translate(substring-after('$Revision: 1.447 $', 'Revision: '),'$','')),', ')" /> 5422 5545 </xsl:if> 5423 <xsl:if test="contains('$Date: 2009-0 6-09 18:43:39$',':')">5424 <xsl:value-of select="concat(normalize-space(translate(substring-after('$Date: 2009-0 6-09 18:43:39$', 'Date: '),'$','')),', ')" />5546 <xsl:if test="contains('$Date: 2009-08-04 19:54:03 $',':')"> 5547 <xsl:value-of select="concat(normalize-space(translate(substring-after('$Date: 2009-08-04 19:54:03 $', 'Date: '),'$','')),', ')" /> 5425 5548 </xsl:if> 5426 5549 <xsl:value-of select="concat('XSLT vendor: ',system-property('xsl:vendor'),' ',system-property('xsl:vendor-url'))" /> … … 5454 5577 <xsl:variable name="anchor" select="@anchor"/> 5455 5578 <xsl:choose> 5456 <xsl:when test="@x:fixed-section-number ">5579 <xsl:when test="@x:fixed-section-number and @x:fixed-section-number!=''"> 5457 5580 <xsl:value-of select="@x:fixed-section-number"/> 5581 </xsl:when> 5582 <xsl:when test="@x:fixed-section-number and @x:fixed-section-number=''"> 5583 <xsl:text>unnumbered-</xsl:text> 5584 <xsl:number count="section[@x:fixed-section-number='']" level="any"/> 5458 5585 </xsl:when> 5459 5586 <xsl:when test="$has-edits or ancestor::*/@x:fixed-section-number">
Note: See TracChangeset
for help on using the changeset viewer.