Changeset 662 for rfc2629xslt/rfc2629toFO.xslt
- Timestamp:
- 05/08/09 13:56:13 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
rfc2629xslt/rfc2629toFO.xslt
r588 r662 242 242 243 243 <xsl:template match="back"> 244 245 <!-- add references section first, no matter where it appears in the 246 source document --> 247 <!-- <xsl:apply-templates select="references" /> --> 248 249 <xsl:if test="$xml2rfc-ext-authors-section!='end'"> 250 <xsl:call-template name="insertAuthors" /> 251 </xsl:if> 252 253 <!-- add all other top-level sections under <back> --> 254 <xsl:apply-templates select="*[not(self::references)]" /> 255 256 <xsl:if test="$xml2rfc-ext-authors-section='end'"> 257 <xsl:call-template name="insertAuthors" /> 258 </xsl:if> 259 260 <xsl:if test="not($xml2rfc-private)"> 261 <!-- copyright statements --> 262 <xsl:variable name="copyright"><xsl:call-template name="insertCopyright" /></xsl:variable> 263 264 <!-- emit it --> 265 <xsl:choose> 266 <xsl:when test="function-available('exslt:node-set')"> 267 <xsl:apply-templates select="exslt:node-set($copyright)/node()" /> 268 </xsl:when> 269 <xsl:otherwise> <!--proceed with fingers crossed--> 270 <xsl:variable name="temp" select="$copyright"/> 271 <xsl:apply-templates select="$temp/node()" /> 272 </xsl:otherwise> 273 </xsl:choose> 274 </xsl:if> 275 244 <!-- done in parent template --> 276 245 </xsl:template> 277 246 … … 340 309 <fo:block font-size="80%"><xsl:value-of select="/rfc/@docName" /></fo:block> 341 310 </xsl:if> 342 </fo:block>311 </fo:block> 343 312 344 <!-- Get status info formatted as per RFC2629--> 345 <xsl:if test="not($xml2rfc-private)"> 346 <xsl:variable name="preamble"><xsl:call-template name="insertPreamble" /></xsl:variable> 347 348 <!-- emit it --> 349 <xsl:choose> 350 <xsl:when test="function-available('exslt:node-set')"> 351 <xsl:apply-templates select="exslt:node-set($preamble)/node()" /> 352 </xsl:when> 353 <xsl:otherwise> 354 <xsl:variable name="temp" select="$preamble"/> 355 <xsl:apply-templates select="$temp/node()" /> 356 </xsl:otherwise> 357 </xsl:choose> 313 <xsl:if test="not($xml2rfc-private) and not($abstract-first)"> 314 <xsl:call-template name="emit-ietf-preamble"/> 358 315 </xsl:if> 359 316 … … 361 318 <xsl:apply-templates select="abstract" /> 362 319 <xsl:apply-templates select="note" /> 320 321 <xsl:if test="not($xml2rfc-private) and $abstract-first"> 322 <xsl:call-template name="emit-ietf-preamble"/> 323 </xsl:if> 363 324 364 325 <xsl:if test="$xml2rfc-toc='yes'"> … … 662 623 <xsl:template match="middle"> 663 624 <xsl:apply-templates /> 664 <xsl:apply-templates select="../back/references" />665 625 </xsl:template> 666 626 … … 830 790 <xsl:when test="count(/*/back/references)=1"> 831 791 <fo:block id="{$anchor-prefix}.references" xsl:use-attribute-sets="h1 newpage"> 832 <xsl:call-template name="get-section-number"/>   792 <xsl:variable name="sectionNumber"> 793 <xsl:call-template name="get-section-number"/> 794 </xsl:variable> 795 <xsl:call-template name="emit-section-number"> 796 <xsl:with-param name="no" select="$sectionNumber"/> 797 </xsl:call-template> 798 <xsl:text>  </xsl:text> 833 799 <xsl:choose> 834 800 <xsl:when test="@title!=''"><xsl:value-of select="@title"/></xsl:when> … … 839 805 <xsl:otherwise> 840 806 <fo:block id="{$anchor-prefix}.references.{$name}" xsl:use-attribute-sets="h2"> 841 <xsl:call-template name="get-section-number"/>   807 <xsl:variable name="sectionNumber"> 808 <xsl:call-template name="get-section-number"/> 809 </xsl:variable> 810 <xsl:call-template name="emit-section-number"> 811 <xsl:with-param name="no" select="$sectionNumber"/> 812 </xsl:call-template> 813 <xsl:text>  </xsl:text> 842 814 <xsl:choose> 843 815 <xsl:when test="@title!=''"><xsl:value-of select="@title"/></xsl:when> … … 961 933 <xsl:variable name="lang"><xsl:call-template name="get-lang"/></xsl:variable> 962 934 963 <fo:page-sequence master-reference="sequence" language="{$lang}" force-page-count="even">935 <fo:page-sequence master-reference="sequence" language="{$lang}"> 964 936 <xsl:if test="$xml2rfc-ext-duplex='yes'"> 965 937 <xsl:attribute name="force-page-count">even</xsl:attribute> … … 970 942 971 943 <fo:flow flow-name="xsl-region-body"> 972 <xsl:apply-templates /> 944 945 <!-- process front & middle section, but not back --> 946 <xsl:apply-templates /> 947 948 <!-- because it requires multiple page masters --> 949 <!-- references first --> 950 <xsl:apply-templates select="back/references" /> 951 952 <xsl:if test="$xml2rfc-ext-authors-section!='end'"> 953 <xsl:call-template name="insertAuthors" /> 954 </xsl:if> 955 956 <!-- add all other top-level sections under <back> --> 957 <xsl:apply-templates select="back/*[not(self::references)]" /> 958 973 959 </fo:flow> 974 960 </fo:page-sequence> … … 986 972 </fo:page-sequence> 987 973 </xsl:if> 974 975 <xsl:if test="$xml2rfc-ext-authors-section='end' or (not($xml2rfc-private) and not($no-copylong))"> 976 <fo:page-sequence master-reference="sequence" language="{$lang}"> 977 <xsl:if test="$xml2rfc-ext-duplex='yes'"> 978 <xsl:attribute name="force-page-count">even</xsl:attribute> 979 </xsl:if> 980 981 <xsl:call-template name="insertHeader" /> 982 <xsl:call-template name="insertFooter" /> 983 984 <fo:flow flow-name="xsl-region-body"> 985 986 <xsl:if test="$xml2rfc-ext-authors-section='end'"> 987 <xsl:call-template name="insertAuthors" /> 988 </xsl:if> 989 990 <xsl:if test="not($xml2rfc-private)"> 991 <!-- copyright statements --> 992 <xsl:variable name="copyright"> 993 <xsl:call-template name="insertCopyright" /> 994 </xsl:variable> 995 996 <!-- emit it --> 997 <xsl:choose> 998 <xsl:when test="function-available('exslt:node-set')"> 999 <xsl:apply-templates select="exslt:node-set($copyright)/node()" /> 1000 </xsl:when> 1001 <xsl:otherwise> <!--proceed with fingers crossed--> 1002 <xsl:variable name="temp" select="$copyright"/> 1003 <xsl:apply-templates select="$temp/node()" /> 1004 </xsl:otherwise> 1005 </xsl:choose> 1006 </xsl:if> 1007 1008 </fo:flow> 1009 </fo:page-sequence> 1010 </xsl:if> 988 1011 989 1012 </fo:root> … … 1006 1029 <xsl:call-template name="add-anchor" /> 1007 1030 1008 <xsl:if test="$sectionNumber!='' ">1031 <xsl:if test="$sectionNumber!='' and not(contains($sectionNumber,'unnumbered-'))"> 1009 1032 <xsl:call-template name="emit-section-number"> 1010 1033 <xsl:with-param name="no" select="$sectionNumber"/> … … 1158 1181 </fo:basic-link> 1159 1182 </xsl:when> 1183 1160 1184 <xsl:when test="$node/self::section or $node/self::appendix"> 1161 <xsl:apply-templates/> 1162 <xsl:text> (</xsl:text> 1163 <fo:basic-link internal-destination="{$target}" xsl:use-attribute-sets="internal-link"> 1164 <!-- insert id when a backlink to this xref is needed in the index --> 1165 <xsl:variable name="ireftargets" select="//iref[@x:for-anchor=$target] | //iref[@x:for-anchor='' and ../@anchor=$target]"/> 1166 <xsl:if test="$ireftargets"> 1167 <xsl:attribute name="id"><xsl:value-of select="$anchor"/></xsl:attribute> 1168 </xsl:if> 1169 <xsl:for-each select="$ireftargets"> 1170 <fo:wrapper index-key="{concat('item=',@item,',subitem=',@subitem)}" /> 1171 </xsl:for-each> 1172 <xsl:call-template name="render-section-ref"> 1173 <xsl:with-param name="from" select="."/> 1174 <xsl:with-param name="to" select="$node"/> 1175 </xsl:call-template> 1176 </fo:basic-link> 1177 <xsl:text>)</xsl:text> 1185 <xsl:choose> 1186 <xsl:when test="@format='none'"> 1187 <fo:basic-link internal-destination="{$target}" xsl:use-attribute-sets="internal-link"> 1188 <!-- insert id when a backlink to this xref is needed in the index --> 1189 <xsl:variable name="ireftargets" select="//iref[@x:for-anchor=$target] | //iref[@x:for-anchor='' and ../@anchor=$target]"/> 1190 <xsl:if test="$ireftargets"> 1191 <xsl:attribute name="id"><xsl:value-of select="$anchor"/></xsl:attribute> 1192 </xsl:if> 1193 <xsl:for-each select="$ireftargets"> 1194 <fo:wrapper index-key="{concat('item=',@item,',subitem=',@subitem)}" /> 1195 </xsl:for-each> 1196 <xsl:apply-templates/> 1197 </fo:basic-link> 1198 </xsl:when> 1199 <xsl:otherwise> 1200 <xsl:apply-templates/> 1201 <xsl:text> (</xsl:text> 1202 <fo:basic-link internal-destination="{$target}" xsl:use-attribute-sets="internal-link"> 1203 <!-- insert id when a backlink to this xref is needed in the index --> 1204 <xsl:variable name="ireftargets" select="//iref[@x:for-anchor=$target] | //iref[@x:for-anchor='' and ../@anchor=$target]"/> 1205 <xsl:if test="$ireftargets"> 1206 <xsl:attribute name="id"><xsl:value-of select="$anchor"/></xsl:attribute> 1207 </xsl:if> 1208 <xsl:for-each select="$ireftargets"> 1209 <fo:wrapper index-key="{concat('item=',@item,',subitem=',@subitem)}" /> 1210 </xsl:for-each> 1211 <xsl:call-template name="render-section-ref"> 1212 <xsl:with-param name="from" select="."/> 1213 <xsl:with-param name="to" select="$node"/> 1214 </xsl:call-template> 1215 </fo:basic-link> 1216 <xsl:text>)</xsl:text> 1217 </xsl:otherwise> 1218 </xsl:choose> 1178 1219 </xsl:when> 1220 1179 1221 <xsl:otherwise> 1180 1222 <fo:basic-link internal-destination="{$target}" xsl:use-attribute-sets="internal-link"> … … 1711 1753 <xsl:template match="back" mode="toc"> 1712 1754 1713 < !-- <xsl:apply-templates select="references" mode="toc" /> -->1755 <xsl:apply-templates select="references" mode="toc" /> 1714 1756 1715 1757 <xsl:if test="$xml2rfc-ext-authors-section!='end'"> … … 1718 1760 1719 1761 <xsl:apply-templates select="*[not(self::references)]" mode="toc" /> 1762 1763 <!-- insert the index if index entries exist --> 1764 <xsl:if test="$has-index"> 1765 <xsl:call-template name="insert-toc-line"> 1766 <xsl:with-param name="target" select="concat($anchor-prefix,'.index')"/> 1767 <xsl:with-param name="title" select="'Index'"/> 1768 </xsl:call-template> 1769 </xsl:if> 1720 1770 1721 1771 <xsl:if test="$xml2rfc-ext-authors-section='end'"> … … 1731 1781 </xsl:if> 1732 1782 1733 <!-- insert the index if index entries exist -->1734 <xsl:if test="$has-index">1735 <xsl:call-template name="insert-toc-line">1736 <xsl:with-param name="target" select="concat($anchor-prefix,'.index')"/>1737 <xsl:with-param name="title" select="'Index'"/>1738 </xsl:call-template>1739 </xsl:if>1740 1741 1783 </xsl:template> 1742 1784 … … 1866 1908 <xsl:when test="$depth = 0"> 1867 1909 <fo:block space-before="1em" font-weight="bold" text-align-last="justify"> 1868 <xsl:if test="$number!='' ">1910 <xsl:if test="$number!='' and not(contains($number,'unnumbered-'))"> 1869 1911 <xsl:value-of select="$number" /> 1870 1912 <xsl:if test="$xml2rfc-ext-sec-no-trailing-dots='yes'">.</xsl:if> … … 1878 1920 <xsl:when test="$depth = 1"> 1879 1921 <fo:block space-before="0.5em" text-align-last="justify"> 1880 <xsl:if test="$number!='' ">1922 <xsl:if test="$number!='' and not(contains($number,'unnumbered-'))"> 1881 1923 <xsl:value-of select="$number" /> 1882 1924 <xsl:if test="$xml2rfc-ext-sec-no-trailing-dots='yes'">.</xsl:if> … … 1891 1933 <fo:block text-align-last="justify"> 1892 1934 <xsl:text>  </xsl:text> 1893 <xsl:if test="$number!='' ">1935 <xsl:if test="$number!='' and not(contains($number,'unnumbered-'))"> 1894 1936 <xsl:value-of select="$number" /> 1895 1937 <xsl:if test="$xml2rfc-ext-sec-no-trailing-dots='yes'">.</xsl:if> … … 2104 2146 <fo:bookmark internal-destination="{$anchor-prefix}.section.{$sectionNumber}"> 2105 2147 <fo:bookmark-title> 2106 <xsl:value-of select="$sectionNumber"/> 2107 <xsl:if test="$xml2rfc-ext-sec-no-trailing-dots='yes'">.</xsl:if> 2108 <xsl:value-of select="concat(' ',@title)"/> 2148 <xsl:if test="$sectionNumber!='' and not(contains($sectionNumber,'unnumbered-'))"> 2149 <xsl:value-of select="$sectionNumber"/> 2150 <xsl:if test="$xml2rfc-ext-sec-no-trailing-dots='yes'">.</xsl:if> 2151 <xsl:text> </xsl:text> 2152 </xsl:if> 2153 <xsl:value-of select="@title"/> 2109 2154 </fo:bookmark-title> 2110 2155 <xsl:apply-templates mode="bookmarks"/> … … 2121 2166 <xsl:template match="back" mode="bookmarks"> 2122 2167 2168 <xsl:call-template name="references-bookmarks" /> 2169 2123 2170 <xsl:if test="$xml2rfc-ext-authors-section!='end'"> 2124 2171 <xsl:apply-templates select="/rfc/front" mode="bookmarks" /> … … 2126 2173 2127 2174 <xsl:apply-templates select="*[not(self::references)]" mode="bookmarks" /> 2175 2176 <!-- insert the index if index entries exist --> 2177 <xsl:if test="$has-index"> 2178 <fo:bookmark internal-destination="{concat($anchor-prefix,'.index')}"> 2179 <fo:bookmark-title>Index</fo:bookmark-title> 2180 </fo:bookmark> 2181 </xsl:if> 2128 2182 2129 2183 <xsl:if test="$xml2rfc-ext-authors-section='end'"> … … 2138 2192 </xsl:if> 2139 2193 2140 <!-- insert the index if index entries exist -->2141 <xsl:if test="$has-index">2142 <fo:bookmark internal-destination="{concat($anchor-prefix,'.index')}">2143 <fo:bookmark-title>Index</fo:bookmark-title>2144 </fo:bookmark>2145 </xsl:if>2146 2194 </xsl:template> 2147 2195 … … 2169 2217 <xsl:template match="middle" mode="bookmarks"> 2170 2218 <xsl:apply-templates mode="bookmarks" /> 2171 <xsl:call-template name="references-bookmarks" />2172 2219 </xsl:template> 2173 2220 … … 2361 2408 </xsl:if> 2362 2409 <xsl:variable name="columns" select="count(ttcol)" /> 2363 <xsl:for-each select="c[ (position() mod $columns) = 1]">2410 <xsl:for-each select="c[$columns=1 or (position() mod $columns) = 1]"> 2364 2411 <fo:table-row> 2365 2412 <xsl:for-each select=". | following-sibling::c[position() < $columns]">
Note: See TracChangeset
for help on using the changeset viewer.