1 | <!-- |
---|
2 | XSLT transformation from RFC2629 XML format to XSL-FO |
---|
3 | |
---|
4 | Copyright (c) 2006-2021, Julian Reschke (julian.reschke@greenbytes.de) |
---|
5 | All rights reserved. |
---|
6 | |
---|
7 | Redistribution and use in source and binary forms, with or without |
---|
8 | modification, are permitted provided that the following conditions are met: |
---|
9 | |
---|
10 | * Redistributions of source code must retain the above copyright notice, |
---|
11 | this list of conditions and the following disclaimer. |
---|
12 | * Redistributions in binary form must reproduce the above copyright notice, |
---|
13 | this list of conditions and the following disclaimer in the documentation |
---|
14 | and/or other materials provided with the distribution. |
---|
15 | * Neither the name of Julian Reschke nor the names of its contributors |
---|
16 | may be used to endorse or promote products derived from this software |
---|
17 | without specific prior written permission. |
---|
18 | |
---|
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
---|
23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
---|
29 | POSSIBILITY OF SUCH DAMAGE. |
---|
30 | --> |
---|
31 | |
---|
32 | <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
---|
33 | version="1.0" |
---|
34 | xmlns:ed="http://greenbytes.de/2002/rfcedit" |
---|
35 | xmlns:exslt="http://exslt.org/common" |
---|
36 | xmlns:fo="http://www.w3.org/1999/XSL/Format" |
---|
37 | xmlns:msxsl="urn:schemas-microsoft-com:xslt" |
---|
38 | xmlns:myns="mailto:julian.reschke@greenbytes.de?subject=rfc2629.xslt" |
---|
39 | xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
---|
40 | xmlns:svg="http://www.w3.org/2000/svg" |
---|
41 | xmlns:x="http://purl.org/net/xml2rfc/ext" |
---|
42 | xmlns:xi="http://www.w3.org/2001/XInclude" |
---|
43 | |
---|
44 | exclude-result-prefixes="ed exslt msxsl myns rdf svg x xi" |
---|
45 | > |
---|
46 | |
---|
47 | <xsl:import href="rfc2629-no-doctype.xslt" /> |
---|
48 | |
---|
49 | <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/> |
---|
50 | |
---|
51 | <!-- page sizes as per <http://tools.ietf.org/html/draft-rfc-editor-rfc2223bis-08#section-3.2> --> |
---|
52 | <xsl:attribute-set name="page"> |
---|
53 | <xsl:attribute name="margin-left">1in</xsl:attribute> |
---|
54 | <xsl:attribute name="margin-right">1in</xsl:attribute> |
---|
55 | <xsl:attribute name="page-height">11in</xsl:attribute> |
---|
56 | <xsl:attribute name="page-width">8.5in</xsl:attribute> |
---|
57 | </xsl:attribute-set> |
---|
58 | |
---|
59 | <xsl:attribute-set name="base"> |
---|
60 | <xsl:attribute name="font-family">serif</xsl:attribute> |
---|
61 | <xsl:attribute name="font-size">10pt</xsl:attribute> |
---|
62 | <xsl:attribute name="line-height-shift-adjustment">disregard-shifts</xsl:attribute> |
---|
63 | </xsl:attribute-set> |
---|
64 | |
---|
65 | <xsl:attribute-set name="h1"> |
---|
66 | <xsl:attribute name="font-weight">bold</xsl:attribute> |
---|
67 | <xsl:attribute name="font-size">14pt</xsl:attribute> |
---|
68 | <xsl:attribute name="keep-with-next">always</xsl:attribute> |
---|
69 | <xsl:attribute name="space-before">14pt</xsl:attribute> |
---|
70 | <xsl:attribute name="space-after">7pt</xsl:attribute> |
---|
71 | </xsl:attribute-set> |
---|
72 | |
---|
73 | <xsl:attribute-set name="h2"> |
---|
74 | <xsl:attribute name="font-weight">bold</xsl:attribute> |
---|
75 | <xsl:attribute name="font-size">12pt</xsl:attribute> |
---|
76 | <xsl:attribute name="keep-with-next">always</xsl:attribute> |
---|
77 | <xsl:attribute name="space-before">12pt</xsl:attribute> |
---|
78 | <xsl:attribute name="space-after">6pt</xsl:attribute> |
---|
79 | </xsl:attribute-set> |
---|
80 | |
---|
81 | <xsl:attribute-set name="h3"> |
---|
82 | <xsl:attribute name="font-weight">bold</xsl:attribute> |
---|
83 | <xsl:attribute name="font-size">11pt</xsl:attribute> |
---|
84 | <xsl:attribute name="keep-with-next">always</xsl:attribute> |
---|
85 | <xsl:attribute name="space-before">11pt</xsl:attribute> |
---|
86 | <xsl:attribute name="space-after">3pt</xsl:attribute> |
---|
87 | </xsl:attribute-set> |
---|
88 | |
---|
89 | <xsl:attribute-set name="comment"> |
---|
90 | <xsl:attribute name="font-weight">bold</xsl:attribute> |
---|
91 | <xsl:attribute name="background-color">yellow</xsl:attribute> |
---|
92 | </xsl:attribute-set> |
---|
93 | |
---|
94 | <xsl:attribute-set name="external-link"> |
---|
95 | <xsl:attribute name="color">blue</xsl:attribute> |
---|
96 | <xsl:attribute name="text-decoration">underline</xsl:attribute> |
---|
97 | </xsl:attribute-set> |
---|
98 | |
---|
99 | <xsl:attribute-set name="index"> |
---|
100 | <xsl:attribute name="font-size">9pt</xsl:attribute> |
---|
101 | </xsl:attribute-set> |
---|
102 | |
---|
103 | <xsl:attribute-set name="internal-link"> |
---|
104 | <xsl:attribute name="color">#000080</xsl:attribute> |
---|
105 | </xsl:attribute-set> |
---|
106 | |
---|
107 | <xsl:attribute-set name="newpage"> |
---|
108 | <xsl:attribute name="page-break-before"> |
---|
109 | <xsl:choose> |
---|
110 | <xsl:when test="$xml2rfc-ext-duplex='yes'">right</xsl:when> |
---|
111 | <xsl:otherwise>always</xsl:otherwise> |
---|
112 | </xsl:choose> |
---|
113 | </xsl:attribute> |
---|
114 | </xsl:attribute-set> |
---|
115 | |
---|
116 | <xsl:attribute-set name="title"> |
---|
117 | <xsl:attribute name="text-align">center</xsl:attribute> |
---|
118 | <xsl:attribute name="font-weight">bold</xsl:attribute> |
---|
119 | <xsl:attribute name="font-size">18pt</xsl:attribute> |
---|
120 | <xsl:attribute name="space-before">3em</xsl:attribute> |
---|
121 | <xsl:attribute name="space-after">3em</xsl:attribute> |
---|
122 | </xsl:attribute-set> |
---|
123 | |
---|
124 | <xsl:template match="abstract"> |
---|
125 | <fo:block xsl:use-attribute-sets="h1" id="{concat($anchor-pref,'abstract')}">Abstract</fo:block> |
---|
126 | <xsl:apply-templates /> |
---|
127 | </xsl:template> |
---|
128 | |
---|
129 | <!-- special case for first text node in artwork or sourcecode --> |
---|
130 | <xsl:template match="artwork/text()[1]|sourcecode/text()[1]" priority="9"> |
---|
131 | <xsl:choose> |
---|
132 | <xsl:when test="substring(.,1,1)=' '"> |
---|
133 | <xsl:value-of select="substring(.,2)" /> |
---|
134 | </xsl:when> |
---|
135 | <xsl:otherwise> |
---|
136 | <xsl:value-of select="." /> |
---|
137 | </xsl:otherwise> |
---|
138 | </xsl:choose> |
---|
139 | </xsl:template> |
---|
140 | |
---|
141 | <xsl:template name="add-artwork-attr"> |
---|
142 | <xsl:choose> |
---|
143 | <xsl:when test="@type='abnf' or @type='abnf2045' or @type='abnf2616' or @type='abnf7230' or @type='application/xml-dtd' or @type='application/relax-ng-compact-syntax'"> |
---|
144 | <!-- just display inline --> |
---|
145 | </xsl:when> |
---|
146 | |
---|
147 | <xsl:when test="starts-with(@type,'message/http') and contains(@type,'msgtype="request"')"> |
---|
148 | <xsl:attribute name="background-color">#f0f0f0</xsl:attribute> |
---|
149 | <xsl:attribute name="border-style">dotted</xsl:attribute> |
---|
150 | <xsl:attribute name="border-width">thin</xsl:attribute> |
---|
151 | </xsl:when> |
---|
152 | |
---|
153 | <xsl:when test="starts-with(@type,'message/http')"> |
---|
154 | <xsl:attribute name="background-color">#f8f8f8</xsl:attribute> |
---|
155 | <xsl:attribute name="border-style">dotted</xsl:attribute> |
---|
156 | <xsl:attribute name="border-width">thin</xsl:attribute> |
---|
157 | </xsl:when> |
---|
158 | |
---|
159 | <xsl:when test="self::sourcecode or starts-with(@type,'text/plain') or @type='example' or @type='code' or @type='http-message'"> |
---|
160 | <xsl:attribute name="background-color">#f8f8f8</xsl:attribute> |
---|
161 | <xsl:attribute name="border-style">dotted</xsl:attribute> |
---|
162 | <xsl:attribute name="border-width">thin</xsl:attribute> |
---|
163 | </xsl:when> |
---|
164 | |
---|
165 | <xsl:otherwise> |
---|
166 | <xsl:attribute name="background-color">#dddddd</xsl:attribute> |
---|
167 | <xsl:attribute name="font-size">9pt</xsl:attribute> |
---|
168 | </xsl:otherwise> |
---|
169 | </xsl:choose> |
---|
170 | |
---|
171 | <xsl:choose> |
---|
172 | <xsl:when test="@align='center'"> |
---|
173 | <xsl:attribute name="text-align">center</xsl:attribute> |
---|
174 | </xsl:when> |
---|
175 | <xsl:when test="@align='right'"> |
---|
176 | <xsl:attribute name="text-align">right</xsl:attribute> |
---|
177 | </xsl:when> |
---|
178 | <xsl:otherwise/> |
---|
179 | </xsl:choose> |
---|
180 | </xsl:template> |
---|
181 | |
---|
182 | <xsl:template match="artwork|sourcecode"> |
---|
183 | <fo:block> |
---|
184 | <xsl:call-template name="copy-anchor"/> |
---|
185 | <xsl:if test="not(ancestor::figure)"> |
---|
186 | <xsl:attribute name="start-indent">2em</xsl:attribute> |
---|
187 | </xsl:if> |
---|
188 | <xsl:if test="(self::artwork and @x:is-code-component='yes') or (self::sourcecode and @markers='true')"> |
---|
189 | <fo:block font-family="monospace" color="gray"> |
---|
190 | <xsl:text><CODE BEGINS></xsl:text> |
---|
191 | <xsl:if test="self::sourcecode and @name"> |
---|
192 | <xsl:variable name="offending" select="translate(@name,concat($alnum,'-+.,;_~#'),'')"/> |
---|
193 | <xsl:choose> |
---|
194 | <xsl:when test="$offending!=''"> |
---|
195 | <xsl:call-template name="error"> |
---|
196 | <xsl:with-param name="msg">illegal characters in @name attribute '<xsl:value-of select="@name"/>': '<xsl:value-of select="$offending"/>'</xsl:with-param> |
---|
197 | </xsl:call-template> |
---|
198 | </xsl:when> |
---|
199 | <xsl:otherwise> |
---|
200 | <xsl:text> file "</xsl:text> |
---|
201 | <xsl:value-of select="@name"/> |
---|
202 | <xsl:text>"</xsl:text> |
---|
203 | </xsl:otherwise> |
---|
204 | </xsl:choose> |
---|
205 | </xsl:if> |
---|
206 | </fo:block> |
---|
207 | </xsl:if> |
---|
208 | <fo:block font-family="monospace" padding=".5em" |
---|
209 | white-space-treatment="preserve" linefeed-treatment="preserve" |
---|
210 | white-space-collapse="false" page-break-inside="avoid"> |
---|
211 | <xsl:call-template name="add-artwork-attr"/> |
---|
212 | <xsl:apply-templates/> |
---|
213 | </fo:block> |
---|
214 | <xsl:if test="(self::artwork and @x:is-code-component='yes') or (self::sourcecode and @markers='true')"> |
---|
215 | <fo:block font-family="monospace" color="gray"><CODE ENDS></fo:block> |
---|
216 | </xsl:if> |
---|
217 | </fo:block> |
---|
218 | </xsl:template> |
---|
219 | |
---|
220 | <xsl:template match="artwork[xi:include]" priority="9"> |
---|
221 | <xsl:variable name="resolved" xmlns=""> |
---|
222 | <xsl:element name="artwork" namespace=""> |
---|
223 | <xsl:copy-of select="@*"/> |
---|
224 | <xsl:for-each select="node()"> |
---|
225 | <xsl:choose> |
---|
226 | <xsl:when test="self::xi:include"> |
---|
227 | <xsl:if test="(@parse and @parse!='xml') or @xpointer"> |
---|
228 | <xsl:call-template name="error"> |
---|
229 | <xsl:with-param name="msg" select="'Unsupported attributes on x:include element'"/> |
---|
230 | </xsl:call-template> |
---|
231 | </xsl:if> |
---|
232 | <xsl:copy-of select="document(@href)"/> |
---|
233 | </xsl:when> |
---|
234 | <xsl:otherwise> |
---|
235 | <xsl:copy-of select="."/> |
---|
236 | </xsl:otherwise> |
---|
237 | </xsl:choose> |
---|
238 | </xsl:for-each> |
---|
239 | </xsl:element> |
---|
240 | </xsl:variable> |
---|
241 | <xsl:apply-templates select="exslt:node-set($resolved)/*"/> |
---|
242 | </xsl:template> |
---|
243 | |
---|
244 | <xsl:template match="artwork[@src and (starts-with(@type,'image/') or @type='svg')]|artwork[svg:svg]"> |
---|
245 | <fo:block> |
---|
246 | <xsl:choose> |
---|
247 | <xsl:when test="@align='center'"> |
---|
248 | <xsl:attribute name="text-align">center</xsl:attribute> |
---|
249 | </xsl:when> |
---|
250 | <xsl:when test="@align='right'"> |
---|
251 | <xsl:attribute name="text-align">right</xsl:attribute> |
---|
252 | </xsl:when> |
---|
253 | <xsl:otherwise/> |
---|
254 | </xsl:choose> |
---|
255 | <xsl:choose> |
---|
256 | <xsl:when test="svg:svg"> |
---|
257 | <fo:instream-foreign-object> |
---|
258 | <xsl:choose> |
---|
259 | <xsl:when test="parent::artset and ../@anchor"> |
---|
260 | <xsl:attribute name="id"><xsl:value-of select="../@anchor"/></xsl:attribute> |
---|
261 | </xsl:when> |
---|
262 | <xsl:when test="parent::artset and ../artwork/@anchor"> |
---|
263 | <xsl:attribute name="id"><xsl:value-of select="../artwork[@anchor][1]/@anchor"/></xsl:attribute> |
---|
264 | </xsl:when> |
---|
265 | <xsl:when test="@anchor"> |
---|
266 | <xsl:attribute name="id"><xsl:value-of select="/@anchor"/></xsl:attribute> |
---|
267 | </xsl:when> |
---|
268 | <xsl:otherwise/> |
---|
269 | </xsl:choose> |
---|
270 | <xsl:apply-templates select="svg:svg" mode="embed-svg"/> |
---|
271 | </fo:instream-foreign-object> |
---|
272 | </xsl:when> |
---|
273 | <xsl:otherwise> |
---|
274 | <fo:external-graphic scaling-method="integer-pixels" src="url({@src})"/> |
---|
275 | </xsl:otherwise> |
---|
276 | </xsl:choose> |
---|
277 | </fo:block> |
---|
278 | </xsl:template> |
---|
279 | |
---|
280 | <xsl:template match="/" mode="embed-svg"> |
---|
281 | <xsl:copy><xsl:apply-templates select="node()" mode="embed-svg"/></xsl:copy> |
---|
282 | </xsl:template> |
---|
283 | |
---|
284 | <xsl:template match="contact[ancestor::t]"> |
---|
285 | <xsl:value-of select="@fullname"/> |
---|
286 | <xsl:if test="@asciiFullname"> |
---|
287 | <xsl:text> (</xsl:text> |
---|
288 | <xsl:value-of select="@asciiFullname"/> |
---|
289 | <xsl:text>)</xsl:text> |
---|
290 | </xsl:if> |
---|
291 | </xsl:template> |
---|
292 | |
---|
293 | <xsl:template match="author|contact|x:contributor"> |
---|
294 | <fo:block start-indent="2em" space-before=".5em" space-after=".5em"> |
---|
295 | |
---|
296 | <xsl:call-template name="emit-author"/> |
---|
297 | |
---|
298 | <xsl:if test="@asciiFullname!='' or organization/@ascii!='' or address/postal/*/@ascii"> |
---|
299 | <fo:block space-before=".5em"> |
---|
300 | Additional contact information: |
---|
301 | </fo:block> |
---|
302 | <xsl:call-template name="emit-author"> |
---|
303 | <xsl:with-param name="ascii" select="false()"/> |
---|
304 | </xsl:call-template> |
---|
305 | </xsl:if> |
---|
306 | </fo:block> |
---|
307 | </xsl:template> |
---|
308 | |
---|
309 | <xsl:template name="emit-postal-line"> |
---|
310 | <xsl:param name="prefix"/> |
---|
311 | <xsl:param name="value"/> |
---|
312 | <xsl:param name="values"/> |
---|
313 | <xsl:param name="link"/> |
---|
314 | <xsl:param name="annotation"/> |
---|
315 | |
---|
316 | <xsl:if test="normalize-space($value)!='' or $values"> |
---|
317 | <fo:block> |
---|
318 | <xsl:if test="$prefix!=''"><xsl:value-of select="$prefix"/>: </xsl:if> |
---|
319 | <xsl:choose> |
---|
320 | <xsl:when test="$values"> |
---|
321 | <xsl:for-each select="exslt:node-set($values)/*"> |
---|
322 | <xsl:choose> |
---|
323 | <xsl:when test="@href"> |
---|
324 | <fo:basic-link external-destination="url('{@href}')" xsl:use-attribute-sets="external-link"><xsl:value-of select="normalize-space(.)"/></fo:basic-link> |
---|
325 | </xsl:when> |
---|
326 | <xsl:otherwise> |
---|
327 | <xsl:value-of select="normalize-space(.)"/> |
---|
328 | </xsl:otherwise> |
---|
329 | </xsl:choose> |
---|
330 | <xsl:if test="position()!=last()">, </xsl:if> |
---|
331 | </xsl:for-each> |
---|
332 | </xsl:when> |
---|
333 | <xsl:when test="$link!=''"> |
---|
334 | <fo:basic-link external-destination="url('{$link}')" xsl:use-attribute-sets="external-link"><xsl:value-of select="normalize-space($value)"/></fo:basic-link> |
---|
335 | </xsl:when> |
---|
336 | <xsl:otherwise> |
---|
337 | <xsl:value-of select="normalize-space($value)"/> |
---|
338 | </xsl:otherwise> |
---|
339 | </xsl:choose> |
---|
340 | <xsl:if test="$annotation!=''"> |
---|
341 | <xsl:text> </xsl:text> |
---|
342 | <fo:wrapper font-style="italic"><xsl:value-of select="$annotation"/></fo:wrapper> |
---|
343 | </xsl:if> |
---|
344 | </fo:block> |
---|
345 | </xsl:if> |
---|
346 | </xsl:template> |
---|
347 | |
---|
348 | <xsl:template name="emit-author"> |
---|
349 | <xsl:param name="ascii" select="true()"/> |
---|
350 | <fo:block> |
---|
351 | <fo:wrapper font-weight="bold"> |
---|
352 | <xsl:choose> |
---|
353 | <xsl:when test="(not(@fullname) or @fullname='') and @surname!=''"> |
---|
354 | <xsl:call-template name="warning"> |
---|
355 | <xsl:with-param name="msg">fullname attribute should be specified for author (using surname instead)</xsl:with-param> |
---|
356 | </xsl:call-template> |
---|
357 | <xsl:call-template name="format-initials"/> |
---|
358 | <xsl:text> </xsl:text> |
---|
359 | <xsl:value-of select="@surname"/> |
---|
360 | </xsl:when> |
---|
361 | <xsl:when test="@asciiFullname!='' and $ascii"> |
---|
362 | <xsl:value-of select="@asciiFullname" /> |
---|
363 | </xsl:when> |
---|
364 | <xsl:otherwise> |
---|
365 | <xsl:value-of select="@fullname" /> |
---|
366 | </xsl:otherwise> |
---|
367 | </xsl:choose> |
---|
368 | </fo:wrapper> |
---|
369 | <xsl:if test="not(self::contact) and @role"> |
---|
370 | <fo:wrapper> (<xsl:value-of select="@role" />)</fo:wrapper> |
---|
371 | </xsl:if> |
---|
372 | <!-- annotation support for Martin "uuml" Duerst --> |
---|
373 | <xsl:if test="@x:annotation"> |
---|
374 | <xsl:text> </xsl:text> |
---|
375 | <fo:wrapper font-style="italic"><xsl:value-of select="@x:annotation"/></fo:wrapper> |
---|
376 | </xsl:if> |
---|
377 | </fo:block> |
---|
378 | |
---|
379 | <xsl:if test="normalize-space(concat(organization,organization/@ascii)) != ''"> |
---|
380 | <fo:block> |
---|
381 | <xsl:choose> |
---|
382 | <xsl:when test="organization/@ascii!='' and $ascii"> |
---|
383 | <xsl:value-of select="organization/@ascii" /> |
---|
384 | </xsl:when> |
---|
385 | <xsl:otherwise> |
---|
386 | <xsl:value-of select="organization" /> |
---|
387 | </xsl:otherwise> |
---|
388 | </xsl:choose> |
---|
389 | </fo:block> |
---|
390 | </xsl:if> |
---|
391 | |
---|
392 | <xsl:call-template name="emit-author-details"> |
---|
393 | <xsl:with-param name="ascii" select="$ascii"/> |
---|
394 | </xsl:call-template> |
---|
395 | </xsl:template> |
---|
396 | |
---|
397 | <xsl:template match="back"> |
---|
398 | <!-- done in parent template --> |
---|
399 | </xsl:template> |
---|
400 | |
---|
401 | |
---|
402 | <xsl:template match="figure"> |
---|
403 | |
---|
404 | <xsl:variable name="anch"> |
---|
405 | <xsl:call-template name="get-figure-anchor"/> |
---|
406 | </xsl:variable> |
---|
407 | |
---|
408 | <fo:block space-before=".5em" space-after=".5em" id="{$anch}" page-break-inside="avoid"> |
---|
409 | <xsl:if test="not(ancestor::t)"> |
---|
410 | <xsl:attribute name="start-indent">2em</xsl:attribute> |
---|
411 | </xsl:if> |
---|
412 | <xsl:call-template name="add-anchor"/> |
---|
413 | <xsl:apply-templates select="*[not(self::name)]"/> |
---|
414 | <xsl:if test="(@title!='' or name) or (@anchor!='' and not(@suppress-title='true'))"> |
---|
415 | <xsl:variable name="n"><xsl:call-template name="get-figure-number"/></xsl:variable> |
---|
416 | <fo:block text-align="center" space-before=".5em" space-after="1em"> |
---|
417 | <xsl:if test="not(starts-with($n,'u'))"> |
---|
418 | <xsl:text>Figure </xsl:text> |
---|
419 | <xsl:value-of select="$n"/> |
---|
420 | <xsl:if test="@title!='' or name">: </xsl:if> |
---|
421 | </xsl:if> |
---|
422 | <xsl:choose> |
---|
423 | <xsl:when test="name"> |
---|
424 | <xsl:apply-templates select="name/node()"/> |
---|
425 | </xsl:when> |
---|
426 | <xsl:otherwise> |
---|
427 | <xsl:value-of select="@title" /> |
---|
428 | </xsl:otherwise> |
---|
429 | </xsl:choose> |
---|
430 | </fo:block> |
---|
431 | </xsl:if> |
---|
432 | </fo:block> |
---|
433 | </xsl:template> |
---|
434 | |
---|
435 | <xsl:template match="front"> |
---|
436 | |
---|
437 | <xsl:if test="$xml2rfc-topblock!='no'"> |
---|
438 | <!-- collect information for left column --> |
---|
439 | |
---|
440 | <xsl:variable name="leftColumn"> |
---|
441 | <xsl:call-template name="collectLeftHeaderColumn" /> |
---|
442 | </xsl:variable> |
---|
443 | |
---|
444 | <!-- collect information for right column --> |
---|
445 | |
---|
446 | <xsl:variable name="rightColumn"> |
---|
447 | <xsl:call-template name="collectRightHeaderColumn" /> |
---|
448 | </xsl:variable> |
---|
449 | |
---|
450 | <!-- insert the collected information --> |
---|
451 | |
---|
452 | <fo:table width="100%" table-layout="fixed"> |
---|
453 | <fo:table-column column-width="proportional-column-width(1)" /> |
---|
454 | <fo:table-column column-width="proportional-column-width(1)" /> |
---|
455 | <fo:table-body> |
---|
456 | <xsl:choose> |
---|
457 | <xsl:when test="function-available('exslt:node-set')"> |
---|
458 | <xsl:call-template name="emitheader"> |
---|
459 | <xsl:with-param name="lc" select="exslt:node-set($leftColumn)" /> |
---|
460 | <xsl:with-param name="rc" select="exslt:node-set($rightColumn)" /> |
---|
461 | </xsl:call-template> |
---|
462 | </xsl:when> |
---|
463 | <xsl:otherwise> |
---|
464 | <xsl:call-template name="emitheader"> |
---|
465 | <xsl:with-param name="lc" select="$leftColumn" /> |
---|
466 | <xsl:with-param name="rc" select="$rightColumn" /> |
---|
467 | </xsl:call-template> |
---|
468 | </xsl:otherwise> |
---|
469 | </xsl:choose> |
---|
470 | </fo:table-body> |
---|
471 | </fo:table> |
---|
472 | </xsl:if> |
---|
473 | |
---|
474 | <fo:block xsl:use-attribute-sets="title"> |
---|
475 | <xsl:apply-templates select="/rfc/front/title/node()"/> |
---|
476 | <xsl:if test="/rfc/@docName"> |
---|
477 | <fo:block font-size="80%"><xsl:value-of select="/rfc/@docName" /></fo:block> |
---|
478 | </xsl:if> |
---|
479 | </fo:block> |
---|
480 | |
---|
481 | <xsl:if test="not($abstract-first)"> |
---|
482 | <xsl:if test="$xml2rfc-private=''"> |
---|
483 | <xsl:call-template name="emit-ietf-preamble"> |
---|
484 | <xsl:with-param name="notes" select="$notes-in-boilerplate"/> |
---|
485 | </xsl:call-template> |
---|
486 | </xsl:if> |
---|
487 | </xsl:if> |
---|
488 | |
---|
489 | <xsl:apply-templates select="abstract" /> |
---|
490 | <xsl:if test="$notes-follow-abstract"> |
---|
491 | <xsl:apply-templates select="$notes-not-in-boilerplate" /> |
---|
492 | </xsl:if> |
---|
493 | |
---|
494 | <xsl:if test="$abstract-first"> |
---|
495 | <xsl:if test="$xml2rfc-private=''"> |
---|
496 | <xsl:call-template name="emit-ietf-preamble"> |
---|
497 | <xsl:with-param name="notes" select="$notes-in-boilerplate"/> |
---|
498 | </xsl:call-template> |
---|
499 | </xsl:if> |
---|
500 | </xsl:if> |
---|
501 | |
---|
502 | <xsl:if test="not($notes-follow-abstract)"> |
---|
503 | <xsl:apply-templates select="$notes-not-in-boilerplate" /> |
---|
504 | </xsl:if> |
---|
505 | |
---|
506 | <xsl:if test="$xml2rfc-toc='yes'"> |
---|
507 | <xsl:apply-templates select="/" mode="toc" /> |
---|
508 | <!--<xsl:call-template name="insertTocAppendix" />--> |
---|
509 | </xsl:if> |
---|
510 | |
---|
511 | </xsl:template> |
---|
512 | |
---|
513 | <xsl:template match="eref[text()|*]"> |
---|
514 | <fo:basic-link external-destination="url('{@target}')" xsl:use-attribute-sets="external-link"> |
---|
515 | <xsl:call-template name="format-uri"> |
---|
516 | <xsl:with-param name="s" select="."/> |
---|
517 | </xsl:call-template> |
---|
518 | </fo:basic-link> |
---|
519 | <fo:footnote> |
---|
520 | <fo:inline font-size="6pt" vertical-align="super"><xsl:number level="any" count="eref[text()|*]" /></fo:inline> |
---|
521 | <fo:footnote-body> |
---|
522 | <fo:block font-size="8pt" start-indent="2em" text-align="left"> |
---|
523 | <fo:inline font-size="6pt" vertical-align="super"><xsl:number level="any" count="eref[text()|*]" /></fo:inline> |
---|
524 | <xsl:text> </xsl:text> |
---|
525 | <xsl:value-of select="@target" /> |
---|
526 | </fo:block> |
---|
527 | </fo:footnote-body> |
---|
528 | </fo:footnote> |
---|
529 | </xsl:template> |
---|
530 | |
---|
531 | <xsl:template match="eref[not(text()|*)]"> |
---|
532 | <xsl:variable name="in-angles" select="(not(/rfc/@version >= 3) and not(@brackets='none')) or @brackets='angle'"/> |
---|
533 | <xsl:if test="$in-angles"><xsl:text><</xsl:text></xsl:if> |
---|
534 | <fo:basic-link external-destination="url('{@target}')" xsl:use-attribute-sets="external-link"> |
---|
535 | <xsl:call-template name="format-uri"> |
---|
536 | <xsl:with-param name="s" select="@target"/> |
---|
537 | </xsl:call-template> |
---|
538 | </fo:basic-link> |
---|
539 | <xsl:if test="$in-angles"><xsl:text>></xsl:text></xsl:if> |
---|
540 | </xsl:template> |
---|
541 | |
---|
542 | <!-- processed in a later stage --> |
---|
543 | <xsl:template match="iref[not(ancestor::t or ancestor::li) and not(parent::section)]"> |
---|
544 | <fo:block> |
---|
545 | <xsl:attribute name="id"><xsl:value-of select="$anchor-pref" />iref.<xsl:number level="any"/></xsl:attribute> |
---|
546 | <xsl:choose> |
---|
547 | <xsl:when test="@primary='true'"> |
---|
548 | <xsl:attribute name="index-key"> |
---|
549 | <xsl:value-of select="concat('item=',@item,',subitem=',@subitem,',primary')"/> |
---|
550 | </xsl:attribute> |
---|
551 | </xsl:when> |
---|
552 | <xsl:otherwise> |
---|
553 | <xsl:attribute name="index-key"> |
---|
554 | <xsl:value-of select="concat('item=',@item,',subitem=',@subitem)"/> |
---|
555 | </xsl:attribute> |
---|
556 | </xsl:otherwise> |
---|
557 | </xsl:choose> |
---|
558 | </fo:block> |
---|
559 | </xsl:template> |
---|
560 | |
---|
561 | <xsl:template match="iref[parent::section]"> |
---|
562 | <!-- processed on section level --> |
---|
563 | </xsl:template> |
---|
564 | |
---|
565 | <xsl:template match="iref[(ancestor::t or ancestor::li) and not(parent::section)]"> |
---|
566 | <fo:inline> |
---|
567 | <xsl:attribute name="id"><xsl:value-of select="$anchor-pref" />iref.<xsl:number level="any"/></xsl:attribute> |
---|
568 | <xsl:choose> |
---|
569 | <xsl:when test="@primary='true'"> |
---|
570 | <xsl:attribute name="index-key"> |
---|
571 | <xsl:value-of select="concat('item=',@item,',subitem=',@subitem,',primary')"/> |
---|
572 | </xsl:attribute> |
---|
573 | </xsl:when> |
---|
574 | <xsl:otherwise> |
---|
575 | <xsl:attribute name="index-key"> |
---|
576 | <xsl:value-of select="concat('item=',@item,',subitem=',@subitem)"/> |
---|
577 | </xsl:attribute> |
---|
578 | </xsl:otherwise> |
---|
579 | </xsl:choose> |
---|
580 | </fo:inline> |
---|
581 | </xsl:template> |
---|
582 | |
---|
583 | <xsl:template match="iref" mode="iref-start"> |
---|
584 | <fo:index-range-begin> |
---|
585 | <xsl:attribute name="id"><xsl:value-of select="$anchor-pref" />iref.<xsl:number level="any"/></xsl:attribute> |
---|
586 | <xsl:choose> |
---|
587 | <xsl:when test="@primary='true'"> |
---|
588 | <xsl:attribute name="index-key"> |
---|
589 | <xsl:value-of select="concat('item=',@item,',subitem=',@subitem,',primary')"/> |
---|
590 | </xsl:attribute> |
---|
591 | </xsl:when> |
---|
592 | <xsl:otherwise> |
---|
593 | <xsl:attribute name="index-key"> |
---|
594 | <xsl:value-of select="concat('item=',@item,',subitem=',@subitem)"/> |
---|
595 | </xsl:attribute> |
---|
596 | </xsl:otherwise> |
---|
597 | </xsl:choose> |
---|
598 | </fo:index-range-begin> |
---|
599 | </xsl:template> |
---|
600 | |
---|
601 | <xsl:template match="iref" mode="iref-end"> |
---|
602 | <fo:index-range-end> |
---|
603 | <xsl:attribute name="ref-id"><xsl:value-of select="$anchor-pref" />iref.<xsl:number level="any"/></xsl:attribute> |
---|
604 | </fo:index-range-end> |
---|
605 | </xsl:template> |
---|
606 | |
---|
607 | <xsl:template match="dl"> |
---|
608 | <xsl:variable name="spac" select="@spacing"/> |
---|
609 | <xsl:variable name="width"> |
---|
610 | <xsl:choose> |
---|
611 | <xsl:when test="@indent"> |
---|
612 | <xsl:value-of select="@indent div 2"/> |
---|
613 | <xsl:text>em</xsl:text> |
---|
614 | </xsl:when> |
---|
615 | <xsl:otherwise> |
---|
616 | <!-- find longest label and use it to calculate indentation--> |
---|
617 | <xsl:variable name="l"> |
---|
618 | <xsl:for-each select="dt"> |
---|
619 | <xsl:sort select="string-length(.)" order="descending" data-type="number"/> |
---|
620 | <xsl:if test="position()=1"> |
---|
621 | <xsl:value-of select="." /> |
---|
622 | </xsl:if> |
---|
623 | </xsl:for-each> |
---|
624 | </xsl:variable> |
---|
625 | <xsl:value-of select="concat(format-number(string-length($l) * 0.8, '#.0'),'em')"/> |
---|
626 | </xsl:otherwise> |
---|
627 | </xsl:choose> |
---|
628 | </xsl:variable> |
---|
629 | |
---|
630 | <fo:list-block provisional-distance-between-starts="{$width}"> |
---|
631 | <xsl:if test="parent::section|parent::note|parent::abstract"> |
---|
632 | <xsl:attribute name="start-indent">2em</xsl:attribute> |
---|
633 | </xsl:if> |
---|
634 | <xsl:for-each select="dt"> |
---|
635 | <fo:list-item> |
---|
636 | <xsl:if test="not($spac='compact')"> |
---|
637 | <xsl:attribute name="space-before">.5em</xsl:attribute> |
---|
638 | <xsl:attribute name="space-after">.5em</xsl:attribute> |
---|
639 | </xsl:if> |
---|
640 | <xsl:apply-templates select="."/> |
---|
641 | <xsl:apply-templates select="following-sibling::dd[1]"/> |
---|
642 | </fo:list-item> |
---|
643 | </xsl:for-each> |
---|
644 | </fo:list-block> |
---|
645 | </xsl:template> |
---|
646 | |
---|
647 | <xsl:template match="dl/dt"> |
---|
648 | <fo:list-item-label end-indent="label-end()"> |
---|
649 | <xsl:call-template name="copy-anchor"/> |
---|
650 | <fo:block> |
---|
651 | <xsl:call-template name="attach-paragraph-number-as-id"/> |
---|
652 | <xsl:apply-templates/> |
---|
653 | </fo:block> |
---|
654 | </fo:list-item-label> |
---|
655 | </xsl:template> |
---|
656 | |
---|
657 | <xsl:template match="dl/dd"> |
---|
658 | <fo:list-item-body start-indent="body-start()"> |
---|
659 | <xsl:call-template name="copy-anchor"/> |
---|
660 | <fo:block> |
---|
661 | <xsl:call-template name="attach-paragraph-number-as-id"/> |
---|
662 | <xsl:variable name="block-level-children" select="artwork|aside|dl|figure|ol|sourcecode|t|table|ul"/> |
---|
663 | <xsl:choose> |
---|
664 | <xsl:when test="$block-level-children"> |
---|
665 | <!-- TODO: improve error handling--> |
---|
666 | <xsl:for-each select="$block-level-children"> |
---|
667 | <xsl:choose> |
---|
668 | <xsl:when test="self::t"> |
---|
669 | <fo:block> |
---|
670 | <xsl:call-template name="copy-anchor"/> |
---|
671 | <xsl:apply-templates/> |
---|
672 | </fo:block> |
---|
673 | </xsl:when> |
---|
674 | <xsl:otherwise> |
---|
675 | <fo:block> |
---|
676 | <xsl:apply-templates select="."/> |
---|
677 | </fo:block> |
---|
678 | </xsl:otherwise> |
---|
679 | </xsl:choose> |
---|
680 | </xsl:for-each> |
---|
681 | </xsl:when> |
---|
682 | <xsl:otherwise> |
---|
683 | <fo:block> |
---|
684 | <xsl:apply-templates/> |
---|
685 | </fo:block> |
---|
686 | </xsl:otherwise> |
---|
687 | </xsl:choose> |
---|
688 | </fo:block> |
---|
689 | </fo:list-item-body> |
---|
690 | </xsl:template> |
---|
691 | |
---|
692 | <xsl:template name="list-empty"> |
---|
693 | <fo:list-block provisional-distance-between-starts="2em"> |
---|
694 | <xsl:apply-templates /> |
---|
695 | </fo:list-block> |
---|
696 | </xsl:template> |
---|
697 | |
---|
698 | <xsl:template name="list-format"> |
---|
699 | <fo:list-block provisional-distance-between-starts="{string-length(@style) - string-length('format ')}em"> |
---|
700 | <xsl:apply-templates /> |
---|
701 | </fo:list-block> |
---|
702 | </xsl:template> |
---|
703 | |
---|
704 | <xsl:template name="list-hanging"> |
---|
705 | <xsl:variable name="width"> |
---|
706 | <xsl:choose> |
---|
707 | <xsl:when test="@x:indent"> |
---|
708 | <xsl:value-of select="@x:indent"/> |
---|
709 | </xsl:when> |
---|
710 | <xsl:otherwise> |
---|
711 | <!-- find longest label and use it to calculate indentation--> |
---|
712 | <xsl:variable name="l"> |
---|
713 | <xsl:for-each select="t"> |
---|
714 | <xsl:sort select="string-length(@hangText)" order="descending" data-type="number"/> |
---|
715 | <xsl:if test="position()=1"> |
---|
716 | <xsl:value-of select="@hangText" /> |
---|
717 | </xsl:if> |
---|
718 | </xsl:for-each> |
---|
719 | </xsl:variable> |
---|
720 | <xsl:value-of select="concat(format-number(string-length($l) * 0.8, '#.0'),'em')"/> |
---|
721 | </xsl:otherwise> |
---|
722 | </xsl:choose> |
---|
723 | </xsl:variable> |
---|
724 | |
---|
725 | <fo:list-block provisional-distance-between-starts="{$width}"> |
---|
726 | <xsl:apply-templates /> |
---|
727 | </fo:list-block> |
---|
728 | </xsl:template> |
---|
729 | |
---|
730 | <xsl:template name="list-letters"> |
---|
731 | <fo:list-block provisional-distance-between-starts="1.5em"> |
---|
732 | <xsl:apply-templates /> |
---|
733 | </fo:list-block> |
---|
734 | </xsl:template> |
---|
735 | |
---|
736 | <xsl:template name="list-numbers"> |
---|
737 | <fo:list-block provisional-distance-between-starts="1.5em"> |
---|
738 | <xsl:apply-templates /> |
---|
739 | </fo:list-block> |
---|
740 | </xsl:template> |
---|
741 | |
---|
742 | <xsl:template name="list-symbols"> |
---|
743 | <fo:list-block provisional-distance-between-starts="1.5em"> |
---|
744 | <xsl:apply-templates /> |
---|
745 | </fo:list-block> |
---|
746 | </xsl:template> |
---|
747 | |
---|
748 | <xsl:template match="list"> |
---|
749 | <xsl:variable name="style" select="ancestor-or-self::list[@style][1]/@style"/> |
---|
750 | <xsl:call-template name="check-no-text-content"/> |
---|
751 | <xsl:choose> |
---|
752 | <xsl:when test="not($style) or $style='empty'"> |
---|
753 | <xsl:call-template name="check-no-hangindent"/> |
---|
754 | <xsl:call-template name="list-empty"/> |
---|
755 | </xsl:when> |
---|
756 | <xsl:when test="starts-with($style, 'format ')"> |
---|
757 | <xsl:call-template name="list-format"/> |
---|
758 | </xsl:when> |
---|
759 | <xsl:when test="$style='hanging'"> |
---|
760 | <xsl:call-template name="list-hanging"/> |
---|
761 | </xsl:when> |
---|
762 | <xsl:when test="$style='letters'"> |
---|
763 | <xsl:call-template name="check-no-hangindent"/> |
---|
764 | <xsl:call-template name="list-letters"/> |
---|
765 | </xsl:when> |
---|
766 | <xsl:when test="$style='numbers'"> |
---|
767 | <xsl:call-template name="check-no-hangindent"/> |
---|
768 | <xsl:call-template name="list-numbers"/> |
---|
769 | </xsl:when> |
---|
770 | <xsl:when test="$style='symbols'"> |
---|
771 | <xsl:call-template name="check-no-hangindent"/> |
---|
772 | <xsl:call-template name="list-symbols"/> |
---|
773 | </xsl:when> |
---|
774 | <xsl:otherwise> |
---|
775 | <xsl:call-template name="error"> |
---|
776 | <xsl:with-param name="msg" select="concat('Unsupported style attribute: ', $style)"/> |
---|
777 | </xsl:call-template> |
---|
778 | </xsl:otherwise> |
---|
779 | </xsl:choose> |
---|
780 | </xsl:template> |
---|
781 | |
---|
782 | <xsl:template match="list[@style='hanging']/x:lt" priority="1"> |
---|
783 | <xsl:variable name="compact"> |
---|
784 | <xsl:call-template name="get-compact-setting"/> |
---|
785 | </xsl:variable> |
---|
786 | <fo:list-item> |
---|
787 | <xsl:if test="not($compact='yes')"> |
---|
788 | <xsl:attribute name="space-before">.5em</xsl:attribute> |
---|
789 | <xsl:attribute name="space-after">.5em</xsl:attribute> |
---|
790 | </xsl:if> |
---|
791 | <xsl:call-template name="copy-anchor"/> |
---|
792 | <fo:list-item-label end-indent="label-end()"><fo:block><xsl:value-of select="@hangText" /></fo:block></fo:list-item-label> |
---|
793 | <fo:list-item-body start-indent="body-start()"> |
---|
794 | <xsl:for-each select="t"> |
---|
795 | <fo:block> |
---|
796 | <xsl:if test="position()!=1"> |
---|
797 | <xsl:attribute name="space-before">.5em</xsl:attribute> |
---|
798 | </xsl:if> |
---|
799 | <xsl:apply-templates /> |
---|
800 | </fo:block> |
---|
801 | </xsl:for-each> |
---|
802 | </fo:list-item-body> |
---|
803 | </fo:list-item> |
---|
804 | </xsl:template> |
---|
805 | |
---|
806 | <xsl:template match="list[@style='hanging']/t | list[@style='hanging']/ed:replace/ed:ins/t" priority="1"> |
---|
807 | <xsl:variable name="compact"> |
---|
808 | <xsl:call-template name="get-compact-setting"/> |
---|
809 | </xsl:variable> |
---|
810 | <fo:list-item> |
---|
811 | <xsl:if test="not($compact='yes')"> |
---|
812 | <xsl:attribute name="space-before">.5em</xsl:attribute> |
---|
813 | <xsl:attribute name="space-after">.5em</xsl:attribute> |
---|
814 | </xsl:if> |
---|
815 | <xsl:call-template name="copy-anchor"/> |
---|
816 | <fo:list-item-label end-indent="label-end()"><fo:block><xsl:value-of select="@hangText" /></fo:block></fo:list-item-label> |
---|
817 | <fo:list-item-body start-indent="body-start()"><fo:block><xsl:apply-templates /></fo:block></fo:list-item-body> |
---|
818 | </fo:list-item> |
---|
819 | </xsl:template> |
---|
820 | |
---|
821 | <xsl:template match="ul"> |
---|
822 | <xsl:choose> |
---|
823 | <xsl:when test="not(li) and @x:when-empty"> |
---|
824 | <fo:block> |
---|
825 | <xsl:call-template name="copy-anchor"/> |
---|
826 | <xsl:value-of select="@x:when-empty"/> |
---|
827 | </fo:block> |
---|
828 | </xsl:when> |
---|
829 | <xsl:otherwise> |
---|
830 | <fo:list-block provisional-distance-between-starts="1.5em"> |
---|
831 | <xsl:call-template name="copy-anchor"/> |
---|
832 | <xsl:if test="self::ul and parent::section|parent::note|parent::abstract"> |
---|
833 | <xsl:attribute name="start-indent">2em</xsl:attribute> |
---|
834 | </xsl:if> |
---|
835 | <xsl:apply-templates /> |
---|
836 | </fo:list-block> |
---|
837 | </xsl:otherwise> |
---|
838 | </xsl:choose> |
---|
839 | </xsl:template> |
---|
840 | |
---|
841 | <xsl:template match="ul[not(@empty='true')]/li | list[@style='symbols' or (not(@style) and ancestor::list[@style='symbols'])]/t" priority="1"> |
---|
842 | <fo:list-item space-before=".25em" space-after=".25em"> |
---|
843 | <xsl:call-template name="copy-anchor"/> |
---|
844 | <fo:list-item-label end-indent="label-end()"><fo:block>•</fo:block></fo:list-item-label> |
---|
845 | <fo:list-item-body start-indent="body-start()"><fo:block><xsl:apply-templates /></fo:block></fo:list-item-body> |
---|
846 | </fo:list-item> |
---|
847 | </xsl:template> |
---|
848 | |
---|
849 | <xsl:template match="list[@style='symbols' or (not(@style) and ancestor::list[@style='symbols'])]/x:lt" priority="1"> |
---|
850 | <fo:list-item space-before=".25em" space-after=".25em"> |
---|
851 | <xsl:call-template name="copy-anchor"/> |
---|
852 | <fo:list-item-label end-indent="label-end()"><fo:block>•</fo:block></fo:list-item-label> |
---|
853 | <fo:list-item-body start-indent="body-start()"> |
---|
854 | <xsl:for-each select="t"> |
---|
855 | <fo:block> |
---|
856 | <xsl:if test="position()!=1"> |
---|
857 | <xsl:attribute name="space-before">.25em</xsl:attribute> |
---|
858 | </xsl:if> |
---|
859 | <xsl:apply-templates /> |
---|
860 | </fo:block> |
---|
861 | </xsl:for-each> |
---|
862 | </fo:list-item-body> |
---|
863 | </fo:list-item> |
---|
864 | </xsl:template> |
---|
865 | |
---|
866 | <xsl:template match="ul[@empty='true']/li | list/t"> |
---|
867 | <fo:list-item space-before=".25em" space-after=".25em"> |
---|
868 | <xsl:call-template name="copy-anchor"/> |
---|
869 | <fo:list-item-label end-indent="label-end()"><fo:block></fo:block></fo:list-item-label> |
---|
870 | <fo:list-item-body start-indent="body-start()"><fo:block><xsl:apply-templates /></fo:block></fo:list-item-body> |
---|
871 | </fo:list-item> |
---|
872 | </xsl:template> |
---|
873 | |
---|
874 | <xsl:template match="ol[not(@type) or string-length(@type)=1]"> |
---|
875 | <fo:list-block provisional-distance-between-starts="1.5em"> |
---|
876 | <xsl:call-template name="copy-anchor"/> |
---|
877 | <xsl:if test="self::ol and parent::section|parent::note|parent::abstract"> |
---|
878 | <xsl:attribute name="start-indent">2em</xsl:attribute> |
---|
879 | </xsl:if> |
---|
880 | <xsl:apply-templates /> |
---|
881 | </fo:list-block> |
---|
882 | </xsl:template> |
---|
883 | |
---|
884 | <xsl:template match="ol[not(@type) or string-length(@type)=1]/li[not(blockquote|t)] | list[@style='numbers' or @style='letters' or (not(@style) and ancestor::list[@style='numbers' or @style='letters'])]/t" priority="1"> |
---|
885 | <fo:list-item space-before=".25em" space-after=".25em"> |
---|
886 | <xsl:call-template name="copy-anchor"/> |
---|
887 | <fo:list-item-label end-indent="label-end()"> |
---|
888 | <fo:block> |
---|
889 | <xsl:choose> |
---|
890 | <xsl:when test="ancestor::ol"> |
---|
891 | <xsl:variable name="node" select="ancestor::ol"/> |
---|
892 | <xsl:variable name="s"> |
---|
893 | <xsl:choose> |
---|
894 | <xsl:when test="$node/@group"> |
---|
895 | <xsl:call-template name="ol-start"> |
---|
896 | <xsl:with-param name="node" select="$node"/> |
---|
897 | </xsl:call-template> |
---|
898 | </xsl:when> |
---|
899 | <xsl:when test="$node/@start"> |
---|
900 | <xsl:value-of select="$node/@start"/> |
---|
901 | </xsl:when> |
---|
902 | <xsl:otherwise>1</xsl:otherwise> |
---|
903 | </xsl:choose> |
---|
904 | </xsl:variable> |
---|
905 | <xsl:variable name="n"><xsl:number/></xsl:variable> |
---|
906 | <xsl:choose> |
---|
907 | <xsl:when test="$node/@type='a' or $node/@type='A' or $node/@type='i' or $node/@type='I'"> |
---|
908 | <xsl:number value="$n + $s - 1" format="{$node/@type}"/> |
---|
909 | </xsl:when> |
---|
910 | <xsl:otherwise> |
---|
911 | <xsl:value-of select="$n + $s - 1"/> |
---|
912 | </xsl:otherwise> |
---|
913 | </xsl:choose> |
---|
914 | <xsl:text>.</xsl:text> |
---|
915 | </xsl:when> |
---|
916 | <xsl:when test="ancestor::list/@style='numbers'"><xsl:number/>.</xsl:when> |
---|
917 | <xsl:when test="ancestor::list/@style='letters'"><xsl:number format="a"/>.</xsl:when> |
---|
918 | <xsl:otherwise>???</xsl:otherwise> |
---|
919 | </xsl:choose> |
---|
920 | </fo:block> |
---|
921 | </fo:list-item-label> |
---|
922 | <fo:list-item-body start-indent="body-start()"><fo:block><xsl:apply-templates /></fo:block></fo:list-item-body> |
---|
923 | </fo:list-item> |
---|
924 | </xsl:template> |
---|
925 | |
---|
926 | <xsl:template match="ol[not(@type) or string-length(@type)=1]/li[blockquote|t] | list[@style='numbers' or @style='letters' or (not(@style) and ancestor::list[@style='numbers' or @style='letters'])]/x:lt" priority="1"> |
---|
927 | <fo:list-item space-before=".25em" space-after=".25em"> |
---|
928 | <xsl:call-template name="copy-anchor"/> |
---|
929 | <fo:list-item-label end-indent="label-end()"> |
---|
930 | <fo:block> |
---|
931 | <xsl:choose> |
---|
932 | <xsl:when test="ancestor::ol and ancestor::ol/@start"> |
---|
933 | <xsl:variable name="n"><xsl:number/></xsl:variable> |
---|
934 | <xsl:value-of select="$n + ancestor::ol/@start - 1"/> |
---|
935 | <xsl:text>.</xsl:text> |
---|
936 | </xsl:when> |
---|
937 | <xsl:when test="ancestor::list/@style='numbers' or ancestor::ol"><xsl:number/>.</xsl:when> |
---|
938 | <xsl:when test="ancestor::list/@style='letters'"><xsl:number format="a"/>.</xsl:when> |
---|
939 | <xsl:otherwise>???</xsl:otherwise> |
---|
940 | </xsl:choose> |
---|
941 | </fo:block> |
---|
942 | </fo:list-item-label> |
---|
943 | <fo:list-item-body start-indent="body-start()"> |
---|
944 | <xsl:for-each select="blockquote|t"> |
---|
945 | <fo:block> |
---|
946 | <xsl:if test="position()!=1"> |
---|
947 | <xsl:attribute name="space-before">.25em</xsl:attribute> |
---|
948 | </xsl:if> |
---|
949 | <xsl:choose> |
---|
950 | <xsl:when test="self::t"> |
---|
951 | <xsl:apply-templates /> |
---|
952 | </xsl:when> |
---|
953 | <xsl:otherwise> |
---|
954 | <xsl:apply-templates select="."/> |
---|
955 | </xsl:otherwise> |
---|
956 | </xsl:choose> |
---|
957 | </fo:block> |
---|
958 | </xsl:for-each> |
---|
959 | </fo:list-item-body> |
---|
960 | </fo:list-item> |
---|
961 | </xsl:template> |
---|
962 | |
---|
963 | <!-- special case: nested --> |
---|
964 | <xsl:template match="list//t//list[@style='letters']/t" priority="9"> |
---|
965 | <fo:list-item space-before=".25em" space-after=".25em"> |
---|
966 | <xsl:call-template name="copy-anchor"/> |
---|
967 | <fo:list-item-label end-indent="label-end()"><fo:block><xsl:number format="A"/>.</fo:block></fo:list-item-label> |
---|
968 | <fo:list-item-body start-indent="body-start()"><fo:block><xsl:apply-templates /></fo:block></fo:list-item-body> |
---|
969 | </fo:list-item> |
---|
970 | </xsl:template> |
---|
971 | |
---|
972 | <xsl:template match="ol[string-length(@type)>1]"> |
---|
973 | <fo:list-block provisional-distance-between-starts="{string-length(@type) + 1}em"> |
---|
974 | <xsl:apply-templates /> |
---|
975 | </fo:list-block> |
---|
976 | </xsl:template> |
---|
977 | |
---|
978 | <xsl:template match="list[starts-with(@style,'format ')]/t" priority="1"> |
---|
979 | <xsl:variable name="list" select=".." /> |
---|
980 | <xsl:variable name="format" select="substring-after(../@style,'format ')" /> |
---|
981 | <xsl:variable name="pos"> |
---|
982 | <xsl:choose> |
---|
983 | <xsl:when test="$list/@counter"> |
---|
984 | <xsl:number level="any" count="list[@counter=$list/@counter or (not(@counter) and @style=concat('format ',$list/@counter))]/t" /> |
---|
985 | </xsl:when> |
---|
986 | <xsl:otherwise> |
---|
987 | <xsl:number level="any" count="list[concat('format ',@counter)=$list/@style or (not(@counter) and @style=$list/@style)]/t" /> |
---|
988 | </xsl:otherwise> |
---|
989 | </xsl:choose> |
---|
990 | </xsl:variable> |
---|
991 | <fo:list-item space-before=".25em" space-after=".25em"> |
---|
992 | <xsl:call-template name="copy-anchor"/> |
---|
993 | <fo:list-item-label end-indent="label-end()"> |
---|
994 | <fo:block> |
---|
995 | <xsl:call-template name="expand-format-percent"> |
---|
996 | <xsl:with-param name="format" select="$format"/> |
---|
997 | <xsl:with-param name="pos" select="$pos"/> |
---|
998 | </xsl:call-template> |
---|
999 | </fo:block> |
---|
1000 | </fo:list-item-label> |
---|
1001 | <fo:list-item-body start-indent="body-start()"> |
---|
1002 | <fo:block> |
---|
1003 | <xsl:apply-templates /> |
---|
1004 | </fo:block> |
---|
1005 | </fo:list-item-body> |
---|
1006 | </fo:list-item> |
---|
1007 | </xsl:template> |
---|
1008 | |
---|
1009 | <xsl:template match="ol[string-length(@type)>1]/li"> |
---|
1010 | <xsl:variable name="format" select="../@type" /> |
---|
1011 | <xsl:variable name="start"> |
---|
1012 | <xsl:choose> |
---|
1013 | <xsl:when test="../@group"> |
---|
1014 | <xsl:call-template name="ol-start"> |
---|
1015 | <xsl:with-param name="node" select=".."/> |
---|
1016 | </xsl:call-template> |
---|
1017 | </xsl:when> |
---|
1018 | <xsl:when test="../@start"> |
---|
1019 | <xsl:value-of select="../@start"/> |
---|
1020 | </xsl:when> |
---|
1021 | <xsl:otherwise>1</xsl:otherwise> |
---|
1022 | </xsl:choose> |
---|
1023 | </xsl:variable> |
---|
1024 | <xsl:variable name="pos"><xsl:number/></xsl:variable> |
---|
1025 | <fo:list-item space-before=".25em" space-after=".25em"> |
---|
1026 | <xsl:call-template name="copy-anchor"/> |
---|
1027 | <fo:list-item-label end-indent="label-end()"> |
---|
1028 | <fo:block> |
---|
1029 | <xsl:call-template name="expand-format-percent"> |
---|
1030 | <xsl:with-param name="format" select="$format"/> |
---|
1031 | <xsl:with-param name="pos" select="$start - 1 + $pos"/> |
---|
1032 | </xsl:call-template> |
---|
1033 | </fo:block> |
---|
1034 | </fo:list-item-label> |
---|
1035 | <fo:list-item-body start-indent="body-start()"> |
---|
1036 | <fo:block> |
---|
1037 | <xsl:apply-templates /> |
---|
1038 | </fo:block> |
---|
1039 | </fo:list-item-body> |
---|
1040 | </fo:list-item> |
---|
1041 | </xsl:template> |
---|
1042 | |
---|
1043 | <xsl:template match="middle"> |
---|
1044 | <xsl:apply-templates /> |
---|
1045 | </xsl:template> |
---|
1046 | |
---|
1047 | <xsl:template match="note"> |
---|
1048 | <xsl:variable name="num"><xsl:number count="note"/></xsl:variable> |
---|
1049 | <fo:block xsl:use-attribute-sets="h1" id="{concat($anchor-pref,'note.',$num)}"> |
---|
1050 | <xsl:choose> |
---|
1051 | <xsl:when test="name"> |
---|
1052 | <xsl:apply-templates select="name/node()"/> |
---|
1053 | <xsl:if test="@title"> |
---|
1054 | <xsl:call-template name="warning"> |
---|
1055 | <xsl:with-param name="msg">both @title attribute and name child node present</xsl:with-param> |
---|
1056 | </xsl:call-template> |
---|
1057 | </xsl:if> |
---|
1058 | </xsl:when> |
---|
1059 | <xsl:otherwise> |
---|
1060 | <xsl:value-of select="@title" /> |
---|
1061 | </xsl:otherwise> |
---|
1062 | </xsl:choose> |
---|
1063 | </fo:block> |
---|
1064 | <xsl:if test="@removeInRFC='true' and (not(t) or t[1]!=$note-removeInRFC)"> |
---|
1065 | <fo:block font-style="italic" start-indent="2em"> |
---|
1066 | <xsl:value-of select="$note-removeInRFC"/> |
---|
1067 | </fo:block> |
---|
1068 | </xsl:if> |
---|
1069 | <xsl:apply-templates /> |
---|
1070 | </xsl:template> |
---|
1071 | <xsl:template match="note/name"/> |
---|
1072 | |
---|
1073 | <xsl:template match="preamble"> |
---|
1074 | <fo:block space-after=".5em"> |
---|
1075 | <xsl:call-template name="copy-anchor"/> |
---|
1076 | <xsl:apply-templates /> |
---|
1077 | </fo:block> |
---|
1078 | </xsl:template> |
---|
1079 | |
---|
1080 | <xsl:template match="postamble"> |
---|
1081 | <fo:block space-before=".5em"><xsl:apply-templates /></fo:block> |
---|
1082 | </xsl:template> |
---|
1083 | |
---|
1084 | <!-- processed elsewhere --> |
---|
1085 | <xsl:template match="displayreference"/> |
---|
1086 | |
---|
1087 | <xsl:template match="reference"> |
---|
1088 | |
---|
1089 | <fo:list-item space-after=".5em"> |
---|
1090 | <fo:list-item-label end-indent="label-end()"> |
---|
1091 | <fo:block id="{@anchor}"> |
---|
1092 | <xsl:if test="$xml2rfc-ext-include-references-in-index='yes'"> |
---|
1093 | <xsl:attribute name="index-key"> |
---|
1094 | <xsl:value-of select="concat('xrefitem=',@anchor,',primary')"/> |
---|
1095 | </xsl:attribute> |
---|
1096 | </xsl:if> |
---|
1097 | <xsl:call-template name="reference-name"/> |
---|
1098 | </fo:block> |
---|
1099 | </fo:list-item-label> |
---|
1100 | |
---|
1101 | <fo:list-item-body start-indent="body-start()"> |
---|
1102 | <xsl:call-template name="insert-reference-body"/> |
---|
1103 | </fo:list-item-body> |
---|
1104 | </fo:list-item> |
---|
1105 | </xsl:template> |
---|
1106 | |
---|
1107 | <xsl:template match="referencegroup"> |
---|
1108 | |
---|
1109 | <fo:list-item space-after=".5em"> |
---|
1110 | <fo:list-item-label end-indent="label-end()"> |
---|
1111 | <fo:block id="{@anchor}"> |
---|
1112 | <xsl:if test="$xml2rfc-ext-include-references-in-index='yes'"> |
---|
1113 | <xsl:attribute name="index-key"> |
---|
1114 | <xsl:value-of select="concat('xrefitem=',@anchor,',primary')"/> |
---|
1115 | </xsl:attribute> |
---|
1116 | </xsl:if> |
---|
1117 | <xsl:call-template name="reference-name"/> |
---|
1118 | </fo:block> |
---|
1119 | </fo:list-item-label> |
---|
1120 | |
---|
1121 | <fo:list-item-body start-indent="body-start()"> |
---|
1122 | <xsl:variable name="included" select="exslt:node-set($includeDirectives)/myns:include[@in=generate-id(current())]/*[self::reference or self::referencegroup]"/> |
---|
1123 | <xsl:choose> |
---|
1124 | <xsl:when test="$xml2rfc-sortrefs='yes' and $xml2rfc-symrefs!='no'"> |
---|
1125 | <xsl:for-each select="reference|$included"> |
---|
1126 | <xsl:sort select="concat(/rfc/back/displayreference[@target=current()/@anchor]/@to,@anchor,.//ed:ins//reference/@anchor)" /> |
---|
1127 | <xsl:call-template name="insert-reference-body"> |
---|
1128 | <xsl:with-param name="in-reference-group" select="true()"/> |
---|
1129 | </xsl:call-template> |
---|
1130 | </xsl:for-each> |
---|
1131 | </xsl:when> |
---|
1132 | <xsl:otherwise> |
---|
1133 | <xsl:for-each select="reference|$included"> |
---|
1134 | <xsl:call-template name="insert-reference-body"> |
---|
1135 | <xsl:with-param name="in-reference-group" select="true()"/> |
---|
1136 | </xsl:call-template> |
---|
1137 | </xsl:for-each> |
---|
1138 | </xsl:otherwise> |
---|
1139 | </xsl:choose> |
---|
1140 | <xsl:if test="@target"> |
---|
1141 | <fo:block> |
---|
1142 | <xsl:call-template name="format-uri"> |
---|
1143 | <xsl:with-param name="s" select="@target"/> |
---|
1144 | </xsl:call-template> |
---|
1145 | <xsl:text>></xsl:text> |
---|
1146 | </fo:block> |
---|
1147 | </xsl:if> |
---|
1148 | </fo:list-item-body> |
---|
1149 | </fo:list-item> |
---|
1150 | </xsl:template> |
---|
1151 | |
---|
1152 | <xsl:template name="insert-reference-body"> |
---|
1153 | <xsl:param name="in-reference-group" select="false()"/> |
---|
1154 | |
---|
1155 | <xsl:variable name="front" select="front[1]|document(x:source/@href)/rfc/front[1]"/> |
---|
1156 | <xsl:if test="count($front)=0"> |
---|
1157 | <xsl:call-template name="error"> |
---|
1158 | <xsl:with-param name="msg"><front> element missing for '<xsl:value-of select="@anchor"/>'</xsl:with-param> |
---|
1159 | </xsl:call-template> |
---|
1160 | </xsl:if> |
---|
1161 | <xsl:if test="count($front)>1"> |
---|
1162 | <xsl:call-template name="warning"> |
---|
1163 | <xsl:with-param name="msg"><front> can be omitted when <x:source> is specified (for '<xsl:value-of select="@anchor"/>')</xsl:with-param> |
---|
1164 | </xsl:call-template> |
---|
1165 | </xsl:if> |
---|
1166 | |
---|
1167 | <xsl:variable name="target"> |
---|
1168 | <xsl:call-template name="link-ref-title-to"/> |
---|
1169 | </xsl:variable> |
---|
1170 | |
---|
1171 | <fo:block> |
---|
1172 | <xsl:if test="$in-reference-group"> |
---|
1173 | <xsl:call-template name="copy-anchor"/> |
---|
1174 | </xsl:if> |
---|
1175 | <xsl:for-each select="$front[1]/author"> |
---|
1176 | <xsl:variable name="initials"> |
---|
1177 | <xsl:call-template name="format-initials"/> |
---|
1178 | </xsl:variable> |
---|
1179 | <xsl:variable name="truncated-initials"> |
---|
1180 | <xsl:call-template name="truncate-initials"> |
---|
1181 | <xsl:with-param name="initials" select="$initials"/> |
---|
1182 | </xsl:call-template> |
---|
1183 | </xsl:variable> |
---|
1184 | <xsl:choose> |
---|
1185 | <xsl:when test="@surname!='' or (@fullname!='' and normalize-space(@fullname)!=normalize-space(organization))"> |
---|
1186 | <xsl:call-template name="displayname-for-author"> |
---|
1187 | <xsl:with-param name="not-reversed" select="position()=last() and position()!=1"/> |
---|
1188 | </xsl:call-template> |
---|
1189 | <xsl:choose> |
---|
1190 | <xsl:when test="position()=last() - 1"> |
---|
1191 | <xsl:if test="last() > 2">,</xsl:if> |
---|
1192 | <xsl:text> and </xsl:text> |
---|
1193 | </xsl:when> |
---|
1194 | <xsl:otherwise> |
---|
1195 | <xsl:text>, </xsl:text> |
---|
1196 | </xsl:otherwise> |
---|
1197 | </xsl:choose> |
---|
1198 | </xsl:when> |
---|
1199 | <xsl:when test="organization/text()"> |
---|
1200 | <xsl:value-of select="organization" /> |
---|
1201 | <xsl:if test="organization/@ascii"> |
---|
1202 | <xsl:value-of select="concat(' (',normalize-space(organization/@ascii),')')"/> |
---|
1203 | </xsl:if> |
---|
1204 | <xsl:choose> |
---|
1205 | <xsl:when test="position()=last() - 1"> |
---|
1206 | <xsl:if test="last() > 2">,</xsl:if> |
---|
1207 | <xsl:text> and </xsl:text> |
---|
1208 | </xsl:when> |
---|
1209 | <xsl:otherwise> |
---|
1210 | <xsl:text>, </xsl:text> |
---|
1211 | </xsl:otherwise> |
---|
1212 | </xsl:choose> |
---|
1213 | </xsl:when> |
---|
1214 | <xsl:otherwise /> |
---|
1215 | </xsl:choose> |
---|
1216 | </xsl:for-each> |
---|
1217 | |
---|
1218 | <xsl:variable name="quoted" select="not($front[1]/title/@x:quotes='false') and not(@quote-title='false')"/> |
---|
1219 | <xsl:variable name="title"> |
---|
1220 | <xsl:apply-templates select="$front[1]/title/node()" mode="get-text-content"/> |
---|
1221 | </xsl:variable> |
---|
1222 | |
---|
1223 | <xsl:if test="$quoted">"<!--“--></xsl:if> |
---|
1224 | <xsl:choose> |
---|
1225 | <xsl:when test="string-length($target) > 0"> |
---|
1226 | <fo:basic-link external-destination="url('{$target}')" xsl:use-attribute-sets="external-link"><xsl:value-of select="$title"/></fo:basic-link> |
---|
1227 | </xsl:when> |
---|
1228 | <xsl:otherwise> |
---|
1229 | <xsl:value-of select="$title"/> |
---|
1230 | </xsl:otherwise> |
---|
1231 | </xsl:choose> |
---|
1232 | <xsl:if test="$quoted">"<!--”--></xsl:if> |
---|
1233 | |
---|
1234 | <xsl:if test="$front[1]/title/@ascii!=''"> |
---|
1235 | <xsl:text> (</xsl:text> |
---|
1236 | <xsl:if test="$quoted">"<!--“--></xsl:if> |
---|
1237 | <xsl:value-of select="normalize-space($front[1]/title/@ascii)" /> |
---|
1238 | <xsl:if test="$quoted">"<!--”--></xsl:if> |
---|
1239 | <xsl:text>)</xsl:text> |
---|
1240 | </xsl:if> |
---|
1241 | |
---|
1242 | <xsl:variable name="si" select="seriesInfo|$front[1]/seriesInfo"/> |
---|
1243 | <xsl:if test="seriesInfo and $front[1]/seriesInfo"> |
---|
1244 | <xsl:call-template name="warning"> |
---|
1245 | <xsl:with-param name="msg">seriesInfo present both on reference and reference/front</xsl:with-param> |
---|
1246 | </xsl:call-template> |
---|
1247 | </xsl:if> |
---|
1248 | |
---|
1249 | <xsl:variable name="doi"> |
---|
1250 | <xsl:choose> |
---|
1251 | <xsl:when test="$si"> |
---|
1252 | <xsl:call-template name="compute-doi"/> |
---|
1253 | </xsl:when> |
---|
1254 | <xsl:when test="document(x:source/@href)/rfc/@number"> |
---|
1255 | <xsl:call-template name="compute-doi"> |
---|
1256 | <xsl:with-param name="rfc" select="document(x:source/@href)/rfc/@number"/> |
---|
1257 | </xsl:call-template> |
---|
1258 | </xsl:when> |
---|
1259 | <xsl:otherwise/> |
---|
1260 | </xsl:choose> |
---|
1261 | </xsl:variable> |
---|
1262 | |
---|
1263 | <xsl:for-each select="$si"> |
---|
1264 | <xsl:call-template name="emit-series-info"> |
---|
1265 | <xsl:with-param name="multiple-rfcs" select="count($si[@name='RFC']) > 1"/> |
---|
1266 | <xsl:with-param name="doi" select="$doi"/> |
---|
1267 | </xsl:call-template> |
---|
1268 | </xsl:for-each> |
---|
1269 | |
---|
1270 | <!-- fall back to x:source when needed --> |
---|
1271 | <xsl:if test="not($si) and x:source/@href"> |
---|
1272 | <xsl:variable name="derivedsi" myns:namespaceless-elements="xml2rfc"> |
---|
1273 | <xsl:if test="document(x:source/@href)/rfc/@docName"> |
---|
1274 | <seriesInfo name="Internet-Draft" value="{document(x:source/@href)/rfc/@docName}"/> |
---|
1275 | </xsl:if> |
---|
1276 | <xsl:if test="document(x:source/@href)/rfc/@number"> |
---|
1277 | <seriesInfo name="RFC" value="{document(x:source/@href)/rfc/@number}"/> |
---|
1278 | </xsl:if> |
---|
1279 | </xsl:variable> |
---|
1280 | <xsl:variable name="tsi" select="exslt:node-set($derivedsi)/seriesInfo"/> |
---|
1281 | <xsl:for-each select="$tsi"> |
---|
1282 | <xsl:call-template name="emit-series-info"/> |
---|
1283 | </xsl:for-each> |
---|
1284 | </xsl:if> |
---|
1285 | |
---|
1286 | <!-- Insert DOI for RFCs --> |
---|
1287 | <xsl:if test="$xml2rfc-ext-insert-doi='yes' and $doi!='' and not(.//seriesInfo[@name='DOI'])"> |
---|
1288 | <xsl:variable name="uri"> |
---|
1289 | <xsl:call-template name="compute-doi-uri"> |
---|
1290 | <xsl:with-param name="doi" select="$doi"/> |
---|
1291 | </xsl:call-template> |
---|
1292 | </xsl:variable> |
---|
1293 | <xsl:text>, </xsl:text> |
---|
1294 | <fo:basic-link xsl:use-attribute-sets="external-link" external-destination="{$uri}"><xsl:text>DOI </xsl:text><xsl:value-of select="$doi"/></fo:basic-link> |
---|
1295 | </xsl:if> |
---|
1296 | |
---|
1297 | <!-- avoid hacks using seriesInfo when it's not really series information --> |
---|
1298 | <xsl:for-each select="x:prose|refcontent"> |
---|
1299 | <xsl:text>, </xsl:text> |
---|
1300 | <xsl:apply-templates/> |
---|
1301 | </xsl:for-each> |
---|
1302 | |
---|
1303 | <xsl:call-template name="insert-pub-date"> |
---|
1304 | <xsl:with-param name="front" select="$front[1]"/> |
---|
1305 | </xsl:call-template> |
---|
1306 | |
---|
1307 | <xsl:choose> |
---|
1308 | <xsl:when test="string-length(normalize-space(@target)) > 0"> |
---|
1309 | <!-- hack: suppress specified target in reference group when it appears to be an info link to the RFC editor page --> |
---|
1310 | <xsl:if test="not($in-reference-group) or not(contains(@target,'www.rfc-editor.org/info/rfc'))"> |
---|
1311 | <xsl:text>, <</xsl:text> |
---|
1312 | <xsl:call-template name="format-uri"> |
---|
1313 | <xsl:with-param name="s" select="@target"/> |
---|
1314 | </xsl:call-template> |
---|
1315 | <xsl:text>></xsl:text> |
---|
1316 | </xsl:if> |
---|
1317 | </xsl:when> |
---|
1318 | <xsl:when test="not($in-reference-group) and $xml2rfc-ext-link-rfc-to-info-page='yes' and .//seriesInfo[@name='BCP'] and starts-with(@anchor, 'BCP')"> |
---|
1319 | <xsl:text>, <</xsl:text> |
---|
1320 | <xsl:variable name="uri"> |
---|
1321 | <xsl:call-template name="compute-rfc-info-uri"> |
---|
1322 | <xsl:with-param name="type" select="'bcp'"/> |
---|
1323 | <xsl:with-param name="no" select="../seriesInfo[@name='BCP']/@value"/> |
---|
1324 | </xsl:call-template> |
---|
1325 | </xsl:variable> |
---|
1326 | <xsl:call-template name="format-uri"> |
---|
1327 | <xsl:with-param name="s" select="$uri"/> |
---|
1328 | </xsl:call-template> |
---|
1329 | <xsl:text>></xsl:text> |
---|
1330 | </xsl:when> |
---|
1331 | <xsl:when test="not($in-reference-group) and $xml2rfc-ext-link-rfc-to-info-page='yes' and .//seriesInfo[@name='RFC']"> |
---|
1332 | <xsl:text>, <</xsl:text> |
---|
1333 | <xsl:variable name="uri"> |
---|
1334 | <xsl:call-template name="compute-rfc-info-uri"> |
---|
1335 | <xsl:with-param name="type" select="'rfc'"/> |
---|
1336 | <xsl:with-param name="no" select="../seriesInfo[@name='RFC']/@value"/> |
---|
1337 | </xsl:call-template> |
---|
1338 | </xsl:variable> |
---|
1339 | <xsl:call-template name="format-uri"> |
---|
1340 | <xsl:with-param name="s" select="$uri"/> |
---|
1341 | </xsl:call-template> |
---|
1342 | <xsl:text>></xsl:text> |
---|
1343 | </xsl:when> |
---|
1344 | <xsl:otherwise/> |
---|
1345 | </xsl:choose> |
---|
1346 | |
---|
1347 | <xsl:text>.</xsl:text> |
---|
1348 | |
---|
1349 | <xsl:for-each select="annotation"> |
---|
1350 | <fo:block><xsl:apply-templates /></fo:block> |
---|
1351 | </xsl:for-each> |
---|
1352 | |
---|
1353 | </fo:block> |
---|
1354 | </xsl:template> |
---|
1355 | |
---|
1356 | <xsl:template match="references"> |
---|
1357 | |
---|
1358 | <xsl:variable name="name"> |
---|
1359 | <xsl:number level="any"/> |
---|
1360 | </xsl:variable> |
---|
1361 | |
---|
1362 | <!-- insert pseudo section when needed --> |
---|
1363 | <xsl:if test="$name='1' and count(/*/back/references)!=1"> |
---|
1364 | <fo:block id="{$anchor-pref}references" xsl:use-attribute-sets="h1"> |
---|
1365 | <xsl:if test="$name='1'"> |
---|
1366 | <xsl:attribute name="page-break-before">always</xsl:attribute> |
---|
1367 | </xsl:if> |
---|
1368 | <xsl:variable name="sectionNumber"> |
---|
1369 | <xsl:call-template name="get-references-section-number"/> |
---|
1370 | </xsl:variable> |
---|
1371 | <xsl:call-template name="emit-section-number"> |
---|
1372 | <xsl:with-param name="no" select="$sectionNumber"/> |
---|
1373 | </xsl:call-template> |
---|
1374 | <xsl:text>  </xsl:text> |
---|
1375 | <xsl:value-of select="$xml2rfc-refparent"/> |
---|
1376 | </fo:block> |
---|
1377 | </xsl:if> |
---|
1378 | |
---|
1379 | <xsl:choose> |
---|
1380 | <xsl:when test="count(/*/back/references)=1 and not(ancestor::references)"> |
---|
1381 | <fo:block xsl:use-attribute-sets="h1 newpage"> |
---|
1382 | <xsl:call-template name="copy-anchor"/> |
---|
1383 | <fo:wrapper id="{$anchor-pref}references" > |
---|
1384 | <xsl:variable name="sectionNumber"> |
---|
1385 | <xsl:call-template name="get-section-number"/> |
---|
1386 | </xsl:variable> |
---|
1387 | <xsl:call-template name="emit-section-number"> |
---|
1388 | <xsl:with-param name="no" select="$sectionNumber"/> |
---|
1389 | </xsl:call-template> |
---|
1390 | <xsl:text>  </xsl:text> |
---|
1391 | <xsl:choose> |
---|
1392 | <xsl:when test="name"> |
---|
1393 | <xsl:if test="@title"> |
---|
1394 | <xsl:call-template name="warning"> |
---|
1395 | <xsl:with-param name="msg">both @title attribute and name child node present</xsl:with-param> |
---|
1396 | </xsl:call-template> |
---|
1397 | </xsl:if> |
---|
1398 | <xsl:apply-templates select="name/node()"/> |
---|
1399 | </xsl:when> |
---|
1400 | <xsl:when test="@title!=''"><xsl:value-of select="@title"/></xsl:when> |
---|
1401 | <xsl:otherwise><xsl:value-of select="$xml2rfc-refparent"/></xsl:otherwise> |
---|
1402 | </xsl:choose> |
---|
1403 | </fo:wrapper> |
---|
1404 | </fo:block> |
---|
1405 | </xsl:when> |
---|
1406 | <xsl:otherwise> |
---|
1407 | <fo:block xsl:use-attribute-sets="h2"> |
---|
1408 | <xsl:call-template name="copy-anchor"/> |
---|
1409 | <fo:wrapper id="{$anchor-pref}references.{$name}" > |
---|
1410 | <xsl:variable name="sectionNumber"> |
---|
1411 | <xsl:call-template name="get-section-number"/> |
---|
1412 | </xsl:variable> |
---|
1413 | <xsl:call-template name="emit-section-number"> |
---|
1414 | <xsl:with-param name="no" select="$sectionNumber"/> |
---|
1415 | </xsl:call-template> |
---|
1416 | <xsl:text>  </xsl:text> |
---|
1417 | <xsl:choose> |
---|
1418 | <xsl:when test="name"> |
---|
1419 | <xsl:if test="@title"> |
---|
1420 | <xsl:call-template name="warning"> |
---|
1421 | <xsl:with-param name="msg">both @title attribute and name child node present</xsl:with-param> |
---|
1422 | </xsl:call-template> |
---|
1423 | </xsl:if> |
---|
1424 | <xsl:apply-templates select="name/node()"/> |
---|
1425 | </xsl:when> |
---|
1426 | <xsl:when test="@title!=''"><xsl:value-of select="@title"/></xsl:when> |
---|
1427 | <xsl:otherwise><xsl:value-of select="$xml2rfc-refparent"/></xsl:otherwise> |
---|
1428 | </xsl:choose> |
---|
1429 | </fo:wrapper> |
---|
1430 | </fo:block> |
---|
1431 | </xsl:otherwise> |
---|
1432 | </xsl:choose> |
---|
1433 | |
---|
1434 | <!-- find longest label and use it to calculate indentation--> |
---|
1435 | <xsl:variable name="l"> |
---|
1436 | <xsl:choose> |
---|
1437 | <xsl:when test="$xml2rfc-symrefs='no'">[99]</xsl:when> |
---|
1438 | <xsl:otherwise> |
---|
1439 | <xsl:for-each select="//reference|//referencegroup|exslt:node-set($includeDirectives)/myns:include/reference"> |
---|
1440 | <xsl:sort select="string-length(@anchor)" order="descending" data-type="number"/> |
---|
1441 | <xsl:if test="position()=1"> |
---|
1442 | <xsl:value-of select="@anchor" /> |
---|
1443 | </xsl:if> |
---|
1444 | </xsl:for-each> |
---|
1445 | </xsl:otherwise> |
---|
1446 | </xsl:choose> |
---|
1447 | </xsl:variable> |
---|
1448 | |
---|
1449 | <xsl:variable name="included" select="exslt:node-set($includeDirectives)/myns:include[@in=generate-id(current())]/*[self::reference or self::referencegroup]"/> |
---|
1450 | <xsl:variable name="refs" select="reference|referencegroup|$included"/> |
---|
1451 | <xsl:choose> |
---|
1452 | <xsl:when test="references"> |
---|
1453 | <xsl:apply-templates select="references"/> |
---|
1454 | <xsl:if test="$refs"> |
---|
1455 | <xsl:call-template name="error"> |
---|
1456 | <xsl:with-param name="msg">Cannot mix <references> elements with other child nodes such as <xsl:value-of select="local-name($refs[1])"/> (these will be ignored)</xsl:with-param> |
---|
1457 | </xsl:call-template> |
---|
1458 | </xsl:if> |
---|
1459 | </xsl:when> |
---|
1460 | <xsl:when test="$refs"> |
---|
1461 | <fo:list-block provisional-distance-between-starts="{string-length($l) * 0.8}em"> |
---|
1462 | <xsl:choose> |
---|
1463 | <xsl:when test="$xml2rfc-sortrefs='yes' and $xml2rfc-symrefs!='no'"> |
---|
1464 | <xsl:apply-templates select="$refs"> |
---|
1465 | <xsl:sort select="concat(/rfc/back/displayreference[@target=current()/@anchor]/@to,@anchor,.//ed:ins//reference/@anchor)" /> |
---|
1466 | </xsl:apply-templates> |
---|
1467 | </xsl:when> |
---|
1468 | <xsl:otherwise> |
---|
1469 | <xsl:apply-templates select="$refs"/> |
---|
1470 | </xsl:otherwise> |
---|
1471 | </xsl:choose> |
---|
1472 | </fo:list-block> |
---|
1473 | </xsl:when> |
---|
1474 | <xsl:otherwise/> |
---|
1475 | </xsl:choose> |
---|
1476 | </xsl:template> |
---|
1477 | |
---|
1478 | <!-- handled above --> |
---|
1479 | <xsl:template match="references/name"/> |
---|
1480 | |
---|
1481 | <xsl:template match="rfc"> |
---|
1482 | <fo:root xsl:use-attribute-sets="base"> |
---|
1483 | |
---|
1484 | <fo:layout-master-set> |
---|
1485 | <fo:simple-page-master master-name="first-page" xsl:use-attribute-sets="page"> |
---|
1486 | <fo:region-body margin-bottom="1in" margin-top="1in"/> |
---|
1487 | <fo:region-after extent="1cm" region-name="footer"/> |
---|
1488 | </fo:simple-page-master> |
---|
1489 | <fo:simple-page-master master-name="other-pages-right" xsl:use-attribute-sets="page"> |
---|
1490 | <fo:region-body margin-bottom="1in" margin-top="1in" /> |
---|
1491 | <fo:region-before extent="1cm" region-name="header-right"/> |
---|
1492 | <fo:region-after extent="1cm" region-name="footer-right"/> |
---|
1493 | </fo:simple-page-master> |
---|
1494 | <fo:simple-page-master master-name="other-pages-left" xsl:use-attribute-sets="page"> |
---|
1495 | <fo:region-body margin-bottom="1in" margin-top="1in" /> |
---|
1496 | <fo:region-before extent="1cm" region-name="header-left"/> |
---|
1497 | <fo:region-after extent="1cm" region-name="footer-left"/> |
---|
1498 | </fo:simple-page-master> |
---|
1499 | <fo:simple-page-master master-name="other-pages-dc-right" xsl:use-attribute-sets="page"> |
---|
1500 | <fo:region-body margin-bottom="1in" margin-top="1in" column-count="2"/> |
---|
1501 | <fo:region-before extent="1cm" region-name="header-right"/> |
---|
1502 | <fo:region-after extent="1cm" region-name="footer-right"/> |
---|
1503 | </fo:simple-page-master> |
---|
1504 | <fo:simple-page-master master-name="other-pages-dc-left" xsl:use-attribute-sets="page"> |
---|
1505 | <fo:region-body margin-bottom="1in" margin-top="1in" column-count="2"/> |
---|
1506 | <fo:region-before extent="1cm" region-name="header-left"/> |
---|
1507 | <fo:region-after extent="1cm" region-name="footer-left"/> |
---|
1508 | </fo:simple-page-master> |
---|
1509 | <fo:page-sequence-master master-name="sequence"> |
---|
1510 | <fo:single-page-master-reference master-reference="first-page" /> |
---|
1511 | <xsl:choose> |
---|
1512 | <xsl:when test="$xml2rfc-ext-duplex='yes'"> |
---|
1513 | <fo:repeatable-page-master-alternatives> |
---|
1514 | <fo:conditional-page-master-reference odd-or-even="even" master-reference="other-pages-left"/> |
---|
1515 | <fo:conditional-page-master-reference odd-or-even="odd" master-reference="other-pages-right"/> |
---|
1516 | </fo:repeatable-page-master-alternatives> |
---|
1517 | </xsl:when> |
---|
1518 | <xsl:otherwise> |
---|
1519 | <fo:repeatable-page-master-reference master-reference="other-pages-right" /> |
---|
1520 | </xsl:otherwise> |
---|
1521 | </xsl:choose> |
---|
1522 | </fo:page-sequence-master> |
---|
1523 | <fo:page-sequence-master master-name="sequence-dc"> |
---|
1524 | <xsl:choose> |
---|
1525 | <xsl:when test="$xml2rfc-ext-duplex='yes'"> |
---|
1526 | <fo:repeatable-page-master-alternatives> |
---|
1527 | <fo:conditional-page-master-reference odd-or-even="even" master-reference="other-pages-dc-left"/> |
---|
1528 | <fo:conditional-page-master-reference odd-or-even="odd" master-reference="other-pages-dc-right"/> |
---|
1529 | </fo:repeatable-page-master-alternatives> |
---|
1530 | </xsl:when> |
---|
1531 | <xsl:otherwise> |
---|
1532 | <fo:repeatable-page-master-reference master-reference="other-pages-dc-right" /> |
---|
1533 | </xsl:otherwise> |
---|
1534 | </xsl:choose> |
---|
1535 | </fo:page-sequence-master> |
---|
1536 | </fo:layout-master-set> |
---|
1537 | |
---|
1538 | <fo:declarations> |
---|
1539 | <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> |
---|
1540 | <rdf:Description rdf:about="" xmlns:dc="http://purl.org/dc/elements/1.1/"> |
---|
1541 | <dc:title><xsl:apply-templates select="front/title" mode="get-text-content"/></dc:title> |
---|
1542 | <dc:creator><xsl:call-template name="get-author-summary" /></dc:creator> |
---|
1543 | <dc:description><xsl:value-of select="normalize-space(/rfc/front/abstract)"/></dc:description> |
---|
1544 | <xsl:if test="$is-rfc"> |
---|
1545 | <dc:isPartOf>urn:ISSN:2070-1721</dc:isPartOf> |
---|
1546 | </xsl:if> |
---|
1547 | <xsl:if test="/rfc/front/keyword" xmlns:pdf="http://ns.adobe.com/pdf/1.3/"> |
---|
1548 | <pdf:Keywords> |
---|
1549 | <xsl:for-each select="/rfc/front/keyword"> |
---|
1550 | <xsl:value-of select="."/> |
---|
1551 | <xsl:if test="position()!=last()">, </xsl:if> |
---|
1552 | </xsl:for-each> |
---|
1553 | </pdf:Keywords> |
---|
1554 | </xsl:if> |
---|
1555 | </rdf:Description> |
---|
1556 | </rdf:RDF> |
---|
1557 | </fo:declarations> |
---|
1558 | |
---|
1559 | <fo:bookmark-tree> |
---|
1560 | <xsl:apply-templates select="." mode="bookmarks" /> |
---|
1561 | </fo:bookmark-tree> |
---|
1562 | |
---|
1563 | <xsl:variable name="lang"><xsl:call-template name="get-lang"/></xsl:variable> |
---|
1564 | |
---|
1565 | <fo:page-sequence master-reference="sequence" language="{$lang}"> |
---|
1566 | <xsl:if test="$xml2rfc-ext-duplex='yes'"> |
---|
1567 | <xsl:attribute name="force-page-count">even</xsl:attribute> |
---|
1568 | </xsl:if> |
---|
1569 | |
---|
1570 | <xsl:call-template name="insertHeader" /> |
---|
1571 | <xsl:call-template name="insertFooter" /> |
---|
1572 | |
---|
1573 | <fo:flow flow-name="xsl-region-body"> |
---|
1574 | |
---|
1575 | <!-- process front & middle section, but not back --> |
---|
1576 | <xsl:apply-templates /> |
---|
1577 | |
---|
1578 | <!-- because it requires multiple page masters --> |
---|
1579 | <!-- references first --> |
---|
1580 | <xsl:apply-templates select="back/references" /> |
---|
1581 | |
---|
1582 | <xsl:if test="$xml2rfc-ext-authors-section='before-appendices'"> |
---|
1583 | <xsl:call-template name="insertAuthors" /> |
---|
1584 | </xsl:if> |
---|
1585 | |
---|
1586 | <!-- add all other top-level sections under <back> --> |
---|
1587 | <xsl:apply-templates select="back/*[not(self::references)]" /> |
---|
1588 | |
---|
1589 | </fo:flow> |
---|
1590 | </fo:page-sequence> |
---|
1591 | |
---|
1592 | <xsl:if test="$has-index"> |
---|
1593 | <fo:page-sequence master-reference="sequence-dc" language="{$lang}"> |
---|
1594 | <xsl:if test="$xml2rfc-ext-duplex='yes'"> |
---|
1595 | <xsl:attribute name="force-page-count">even</xsl:attribute> |
---|
1596 | </xsl:if> |
---|
1597 | <xsl:call-template name="insertHeader" /> |
---|
1598 | <xsl:call-template name="insertFooter" /> |
---|
1599 | <fo:flow flow-name="xsl-region-body" xsl:use-attribute-sets="index"> |
---|
1600 | <xsl:call-template name="insertIndex" /> |
---|
1601 | </fo:flow> |
---|
1602 | </fo:page-sequence> |
---|
1603 | </xsl:if> |
---|
1604 | |
---|
1605 | <xsl:if test="$xml2rfc-ext-authors-section='end' or ($xml2rfc-private='' and not($no-copylong))"> |
---|
1606 | <fo:page-sequence master-reference="sequence" language="{$lang}"> |
---|
1607 | <xsl:if test="$xml2rfc-ext-duplex='yes'"> |
---|
1608 | <xsl:attribute name="force-page-count">even</xsl:attribute> |
---|
1609 | </xsl:if> |
---|
1610 | |
---|
1611 | <xsl:call-template name="insertHeader" /> |
---|
1612 | <xsl:call-template name="insertFooter" /> |
---|
1613 | |
---|
1614 | <fo:flow flow-name="xsl-region-body"> |
---|
1615 | |
---|
1616 | <xsl:if test="$xml2rfc-ext-authors-section='end'"> |
---|
1617 | <xsl:call-template name="insertAuthors" /> |
---|
1618 | </xsl:if> |
---|
1619 | |
---|
1620 | <xsl:if test="$xml2rfc-private=''"> |
---|
1621 | <!-- copyright statements --> |
---|
1622 | <xsl:variable name="copyright"> |
---|
1623 | <xsl:call-template name="insertCopyright" /> |
---|
1624 | </xsl:variable> |
---|
1625 | |
---|
1626 | <xsl:if test="normalize-space($copyright)=''"> |
---|
1627 | <fo:block/> |
---|
1628 | </xsl:if> |
---|
1629 | |
---|
1630 | <xsl:apply-templates select="exslt:node-set($copyright)/node()" /> |
---|
1631 | </xsl:if> |
---|
1632 | </fo:flow> |
---|
1633 | </fo:page-sequence> |
---|
1634 | </xsl:if> |
---|
1635 | |
---|
1636 | </fo:root> |
---|
1637 | </xsl:template> |
---|
1638 | |
---|
1639 | |
---|
1640 | <xsl:template name="section-maker"> |
---|
1641 | <xsl:variable name="sectionNumber"> |
---|
1642 | <xsl:choose> |
---|
1643 | <xsl:when test="ancestor::boilerplate"></xsl:when> |
---|
1644 | <xsl:otherwise><xsl:call-template name="get-section-number" /></xsl:otherwise> |
---|
1645 | </xsl:choose> |
---|
1646 | </xsl:variable> |
---|
1647 | |
---|
1648 | <xsl:if test="$sectionNumber!=''"> |
---|
1649 | <xsl:attribute name="id"><xsl:value-of select="concat($anchor-pref,'section.',$sectionNumber)"/> |
---|
1650 | </xsl:attribute></xsl:if> |
---|
1651 | |
---|
1652 | <xsl:call-template name="add-anchor" /> |
---|
1653 | |
---|
1654 | <xsl:if test="$sectionNumber!='' and not(contains($sectionNumber,$unnumbered))"> |
---|
1655 | <xsl:call-template name="emit-section-number"> |
---|
1656 | <xsl:with-param name="no" select="$sectionNumber"/> |
---|
1657 | <xsl:with-param name="appendixPrefix" select="true()"/> |
---|
1658 | </xsl:call-template> |
---|
1659 | <xsl:text>  </xsl:text> |
---|
1660 | </xsl:if> |
---|
1661 | |
---|
1662 | <xsl:choose> |
---|
1663 | <xsl:when test="name"> |
---|
1664 | <xsl:apply-templates select="name/node()"/> |
---|
1665 | <xsl:if test="@title"> |
---|
1666 | <xsl:call-template name="warning"> |
---|
1667 | <xsl:with-param name="msg">both @title attribute and name child node present</xsl:with-param> |
---|
1668 | </xsl:call-template> |
---|
1669 | </xsl:if> |
---|
1670 | </xsl:when> |
---|
1671 | <xsl:otherwise> |
---|
1672 | <xsl:value-of select="@title" /> |
---|
1673 | </xsl:otherwise> |
---|
1674 | </xsl:choose> |
---|
1675 | </xsl:template> |
---|
1676 | |
---|
1677 | <!-- handled in section-maker --> |
---|
1678 | <xsl:template match="section/name"/> |
---|
1679 | |
---|
1680 | <!-- suppress xml2rfc preptool artefacts --> |
---|
1681 | <xsl:template match="section[author]" priority="9"/> |
---|
1682 | |
---|
1683 | <xsl:template match="section[count(ancestor::section) = 0 and (ancestor::boilerplate)]"> |
---|
1684 | |
---|
1685 | <fo:block xsl:use-attribute-sets="h1"> |
---|
1686 | <xsl:call-template name="section-maker" /> |
---|
1687 | </fo:block> |
---|
1688 | |
---|
1689 | <xsl:if test="@removeInRFC='true' and (not(t) or t[1]!=$section-removeInRFC)"> |
---|
1690 | <fo:block font-style="italic" start-indent="2em"> |
---|
1691 | <xsl:value-of select="$section-removeInRFC"/> |
---|
1692 | </fo:block> |
---|
1693 | </xsl:if> |
---|
1694 | |
---|
1695 | <xsl:apply-templates select="iref" mode="iref-start"/> |
---|
1696 | <xsl:apply-templates /> |
---|
1697 | <xsl:apply-templates select="iref" mode="iref-end"/> |
---|
1698 | </xsl:template> |
---|
1699 | |
---|
1700 | <xsl:template match="section[count(ancestor::section) = 0 and not(ancestor::boilerplate)]"> |
---|
1701 | |
---|
1702 | <fo:block xsl:use-attribute-sets="h1 newpage"> |
---|
1703 | <xsl:call-template name="section-maker" /> |
---|
1704 | </fo:block> |
---|
1705 | |
---|
1706 | <xsl:if test="@removeInRFC='true' and (not(t) or t[1]!=$section-removeInRFC)"> |
---|
1707 | <fo:block font-style="italic" start-indent="2em"> |
---|
1708 | <xsl:value-of select="$section-removeInRFC"/> |
---|
1709 | </fo:block> |
---|
1710 | </xsl:if> |
---|
1711 | |
---|
1712 | <xsl:apply-templates select="iref" mode="iref-start"/> |
---|
1713 | <xsl:apply-templates /> |
---|
1714 | <xsl:apply-templates select="iref" mode="iref-end"/> |
---|
1715 | </xsl:template> |
---|
1716 | |
---|
1717 | <xsl:template match="section[count(ancestor::section) = 1]"> |
---|
1718 | <fo:block xsl:use-attribute-sets="h2"> |
---|
1719 | <xsl:call-template name="section-maker" /> |
---|
1720 | </fo:block> |
---|
1721 | |
---|
1722 | <xsl:if test="@removeInRFC='true' and t[1]!=$section-removeInRFC"> |
---|
1723 | <fo:block font-style="italic" start-indent="2em"> |
---|
1724 | <xsl:value-of select="$section-removeInRFC"/> |
---|
1725 | </fo:block> |
---|
1726 | </xsl:if> |
---|
1727 | |
---|
1728 | <xsl:apply-templates select="iref" mode="iref-start"/> |
---|
1729 | <xsl:apply-templates /> |
---|
1730 | <xsl:apply-templates select="iref" mode="iref-end"/> |
---|
1731 | </xsl:template> |
---|
1732 | |
---|
1733 | <xsl:template match="section[count(ancestor::section) > 1]"> |
---|
1734 | <fo:block xsl:use-attribute-sets="h3"> |
---|
1735 | <xsl:call-template name="section-maker" /> |
---|
1736 | </fo:block> |
---|
1737 | |
---|
1738 | <xsl:apply-templates select="iref" mode="iref-start"/> |
---|
1739 | <xsl:apply-templates /> |
---|
1740 | <xsl:apply-templates select="iref" mode="iref-end"/> |
---|
1741 | </xsl:template> |
---|
1742 | |
---|
1743 | <xsl:template match="spanx[@style='emph' or not(@style)]|em"> |
---|
1744 | <fo:wrapper font-style="italic"> |
---|
1745 | <xsl:call-template name="copy-anchor"/> |
---|
1746 | <xsl:apply-templates /> |
---|
1747 | </fo:wrapper> |
---|
1748 | </xsl:template> |
---|
1749 | |
---|
1750 | <xsl:template match="spanx[@style='strong']|strong"> |
---|
1751 | <fo:wrapper font-weight="bold"> |
---|
1752 | <xsl:call-template name="copy-anchor"/> |
---|
1753 | <xsl:apply-templates /> |
---|
1754 | </fo:wrapper> |
---|
1755 | </xsl:template> |
---|
1756 | |
---|
1757 | <xsl:template match="spanx[@style='verb' or @style='vbare']|tt"> |
---|
1758 | <fo:wrapper font-family="monospace"> |
---|
1759 | <xsl:call-template name="copy-anchor"/> |
---|
1760 | <xsl:apply-templates/> |
---|
1761 | </fo:wrapper> |
---|
1762 | </xsl:template> |
---|
1763 | |
---|
1764 | <xsl:template match="t"> |
---|
1765 | <fo:block space-before=".5em" space-after=".5em"> |
---|
1766 | <xsl:call-template name="insert-justification"/> |
---|
1767 | <xsl:variable name="indent"> |
---|
1768 | <xsl:choose> |
---|
1769 | <xsl:when test="@indent and number(@indent)>0"> |
---|
1770 | <xsl:value-of select="@indent div 2"/> |
---|
1771 | </xsl:when> |
---|
1772 | <xsl:otherwise>0</xsl:otherwise> |
---|
1773 | </xsl:choose> |
---|
1774 | </xsl:variable> |
---|
1775 | <xsl:attribute name="start-indent"> |
---|
1776 | <xsl:choose> |
---|
1777 | <xsl:when test="parent::x:blockquote|parent::blockquote"><xsl:value-of select="4 + $indent"/>em</xsl:when> |
---|
1778 | <xsl:when test="parent::x:note|parent::aside"><xsl:value-of select="4 + $indent"/>em</xsl:when> |
---|
1779 | <xsl:otherwise><xsl:value-of select="2 + $indent"/>em</xsl:otherwise> |
---|
1780 | </xsl:choose> |
---|
1781 | </xsl:attribute> |
---|
1782 | <xsl:call-template name="copy-anchor"/> |
---|
1783 | <xsl:apply-templates /> |
---|
1784 | </fo:block> |
---|
1785 | </xsl:template> |
---|
1786 | |
---|
1787 | <xsl:template match="vspace"> |
---|
1788 | <fo:block/> |
---|
1789 | </xsl:template> |
---|
1790 | |
---|
1791 | <!-- xref to section or appendix --> |
---|
1792 | <xsl:template name="xref-to-section"> |
---|
1793 | <xsl:param name="from"/> |
---|
1794 | <xsl:param name="to"/> |
---|
1795 | <xsl:param name="id"/> |
---|
1796 | <xsl:param name="irefs"/> |
---|
1797 | <xsl:param name="child-nodes"/> |
---|
1798 | |
---|
1799 | <xsl:choose> |
---|
1800 | <xsl:when test="$child-nodes and not($from/@format='none') and $xml2rfc-ext-xref-with-text-generate!='nothing'"> |
---|
1801 | <xsl:apply-templates select="$child-nodes"/> |
---|
1802 | <xsl:text> (</xsl:text> |
---|
1803 | <fo:basic-link internal-destination="{$from/@target}" xsl:use-attribute-sets="internal-link"> |
---|
1804 | <xsl:if test="$irefs"> |
---|
1805 | <!-- insert id when a backlink to this xref is needed in the index --> |
---|
1806 | <xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute> |
---|
1807 | </xsl:if> |
---|
1808 | <xsl:for-each select="$irefs"> |
---|
1809 | <fo:wrapper index-key="{concat('item=',@item,',subitem=',@subitem)}" /> |
---|
1810 | </xsl:for-each> |
---|
1811 | <xsl:call-template name="render-section-ref"> |
---|
1812 | <xsl:with-param name="from" select="$from"/> |
---|
1813 | <xsl:with-param name="to" select="$to"/> |
---|
1814 | </xsl:call-template> |
---|
1815 | </fo:basic-link> |
---|
1816 | <xsl:text>)</xsl:text> |
---|
1817 | </xsl:when> |
---|
1818 | <xsl:otherwise> |
---|
1819 | <fo:basic-link internal-destination="{$from/@target}" xsl:use-attribute-sets="internal-link"> |
---|
1820 | <xsl:if test="$irefs"> |
---|
1821 | <!-- insert id when a backlink to this xref is needed in the index --> |
---|
1822 | <xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute> |
---|
1823 | </xsl:if> |
---|
1824 | <xsl:for-each select="$irefs"> |
---|
1825 | <fo:wrapper index-key="{concat('item=',@item,',subitem=',@subitem)}" /> |
---|
1826 | </xsl:for-each> |
---|
1827 | <xsl:call-template name="render-section-ref"> |
---|
1828 | <xsl:with-param name="from" select="$from"/> |
---|
1829 | <xsl:with-param name="to" select="$to"/> |
---|
1830 | <xsl:with-param name="child-nodes" select="$child-nodes"/> |
---|
1831 | </xsl:call-template> |
---|
1832 | </fo:basic-link> |
---|
1833 | </xsl:otherwise> |
---|
1834 | </xsl:choose> |
---|
1835 | </xsl:template> |
---|
1836 | |
---|
1837 | <!-- xref to figure --> |
---|
1838 | <xsl:template name="xref-to-figure"> |
---|
1839 | <xsl:param name="from"/> |
---|
1840 | <xsl:param name="to"/> |
---|
1841 | <xsl:param name="child-nodes"/> |
---|
1842 | |
---|
1843 | <fo:basic-link internal-destination="{$from/@target}" xsl:use-attribute-sets="internal-link"> |
---|
1844 | <xsl:call-template name="xref-to-figure-text"> |
---|
1845 | <xsl:with-param name="from" select="$from"/> |
---|
1846 | <xsl:with-param name="to" select="$to"/> |
---|
1847 | <xsl:with-param name="child-nodes" select="$child-nodes"/> |
---|
1848 | </xsl:call-template> |
---|
1849 | </fo:basic-link> |
---|
1850 | </xsl:template> |
---|
1851 | |
---|
1852 | <!-- xref to table --> |
---|
1853 | <xsl:template name="xref-to-table"> |
---|
1854 | <xsl:param name="from"/> |
---|
1855 | <xsl:param name="to"/> |
---|
1856 | <xsl:param name="child-nodes"/> |
---|
1857 | |
---|
1858 | <fo:basic-link internal-destination="{$from/@target}" xsl:use-attribute-sets="internal-link"> |
---|
1859 | <xsl:call-template name="xref-to-table-text"> |
---|
1860 | <xsl:with-param name="from" select="$from"/> |
---|
1861 | <xsl:with-param name="to" select="$to"/> |
---|
1862 | <xsl:with-param name="child-nodes" select="$child-nodes"/> |
---|
1863 | </xsl:call-template> |
---|
1864 | </fo:basic-link> |
---|
1865 | </xsl:template> |
---|
1866 | |
---|
1867 | <!-- xref to paragraph --> |
---|
1868 | <xsl:template name="xref-to-paragraph"> |
---|
1869 | <xsl:param name="from"/> |
---|
1870 | <xsl:param name="to"/> |
---|
1871 | <xsl:param name="anchor"/> |
---|
1872 | <xsl:param name="child-nodes"/> |
---|
1873 | |
---|
1874 | <fo:basic-link internal-destination="{$anchor}" xsl:use-attribute-sets="internal-link"> |
---|
1875 | <xsl:call-template name="xref-to-paragraph-text"> |
---|
1876 | <xsl:with-param name="from" select="$from"/> |
---|
1877 | <xsl:with-param name="to" select="$to"/> |
---|
1878 | <xsl:with-param name="child-nodes" select="$child-nodes"/> |
---|
1879 | </xsl:call-template> |
---|
1880 | </fo:basic-link> |
---|
1881 | </xsl:template> |
---|
1882 | |
---|
1883 | <xsl:template name="emit-link"> |
---|
1884 | <xsl:param name="target"/> |
---|
1885 | <xsl:param name="id"/> |
---|
1886 | <xsl:param name="title"/> |
---|
1887 | <xsl:param name="citation-title"/> |
---|
1888 | <xsl:param name="index-item"/> |
---|
1889 | <xsl:param name="index-subitem"/> |
---|
1890 | <xsl:param name="text"/> |
---|
1891 | <xsl:param name="child-nodes"/> |
---|
1892 | |
---|
1893 | <xsl:if test="$text!='' and $child-nodes"> |
---|
1894 | <xsl:call-template name="warning"> |
---|
1895 | <xsl:with-param name="msg">emit-link called both with text and child-nodes</xsl:with-param> |
---|
1896 | </xsl:call-template> |
---|
1897 | </xsl:if> |
---|
1898 | |
---|
1899 | <xsl:variable name="t"> |
---|
1900 | <xsl:if test="starts-with($target,'#')"> |
---|
1901 | <xsl:value-of select="substring($target,2)"/> |
---|
1902 | </xsl:if> |
---|
1903 | </xsl:variable> |
---|
1904 | |
---|
1905 | <xsl:choose> |
---|
1906 | <xsl:when test="$t!=''"> |
---|
1907 | <fo:basic-link internal-destination="{$t}" xsl:use-attribute-sets="internal-link"> |
---|
1908 | <xsl:if test="$id!='' and $xml2rfc-ext-include-references-in-index='yes'"> |
---|
1909 | <xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute> |
---|
1910 | </xsl:if> |
---|
1911 | <xsl:if test="$index-item!='' and $xml2rfc-ext-include-references-in-index='yes'"> |
---|
1912 | <xsl:attribute name="index-key">xrefitem=<xsl:value-of select="$index-item"/></xsl:attribute> |
---|
1913 | </xsl:if> |
---|
1914 | <xsl:if test="$index-subitem!='' and $xml2rfc-ext-include-references-in-index='yes'"> |
---|
1915 | <fo:wrapper index-key="xrefitem={concat($index-item,'#',$index-subitem)}"/> |
---|
1916 | </xsl:if> |
---|
1917 | <xsl:choose> |
---|
1918 | <xsl:when test="$child-nodes"> |
---|
1919 | <xsl:apply-templates select="$child-nodes"/> |
---|
1920 | </xsl:when> |
---|
1921 | <xsl:otherwise> |
---|
1922 | <xsl:value-of select="$text"/> |
---|
1923 | </xsl:otherwise> |
---|
1924 | </xsl:choose> |
---|
1925 | </fo:basic-link> |
---|
1926 | </xsl:when> |
---|
1927 | <xsl:when test="$target!=''"> |
---|
1928 | <fo:basic-link external-destination="{$target}" xsl:use-attribute-sets="external-link"> |
---|
1929 | <xsl:if test="$id!='' and $xml2rfc-ext-include-references-in-index='yes'"> |
---|
1930 | <xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute> |
---|
1931 | </xsl:if> |
---|
1932 | <xsl:if test="$index-item!='' and $xml2rfc-ext-include-references-in-index='yes'"> |
---|
1933 | <xsl:attribute name="index-key">xrefitem=<xsl:value-of select="$index-item"/></xsl:attribute> |
---|
1934 | </xsl:if> |
---|
1935 | <xsl:if test="$index-subitem!='' and $xml2rfc-ext-include-references-in-index='yes'"> |
---|
1936 | <fo:wrapper index-key="xrefitem={concat($index-item,'#',$index-subitem)}"/> |
---|
1937 | </xsl:if> |
---|
1938 | <xsl:choose> |
---|
1939 | <xsl:when test="$child-nodes"> |
---|
1940 | <xsl:apply-templates select="$child-nodes"/> |
---|
1941 | </xsl:when> |
---|
1942 | <xsl:otherwise> |
---|
1943 | <xsl:value-of select="$text"/> |
---|
1944 | </xsl:otherwise> |
---|
1945 | </xsl:choose> |
---|
1946 | </fo:basic-link> |
---|
1947 | </xsl:when> |
---|
1948 | <xsl:when test="($id!='' and $xml2rfc-ext-include-references-in-index='yes') or ($index-item!='' and $xml2rfc-ext-include-references-in-index='yes')"> |
---|
1949 | <fo:wrapper> |
---|
1950 | <xsl:if test="$id!='' and $xml2rfc-ext-include-references-in-index='yes'"> |
---|
1951 | <xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute> |
---|
1952 | </xsl:if> |
---|
1953 | <xsl:if test="$index-item!='' and $xml2rfc-ext-include-references-in-index='yes'"> |
---|
1954 | <xsl:attribute name="index-key">xrefitem=<xsl:value-of select="$index-item"/></xsl:attribute> |
---|
1955 | </xsl:if> |
---|
1956 | <xsl:if test="$index-subitem!='' and $xml2rfc-ext-include-references-in-index='yes'"> |
---|
1957 | <fo:wrapper index-key="xrefitem={concat($index-item,'#',$index-subitem)}"/> |
---|
1958 | </xsl:if> |
---|
1959 | <xsl:choose> |
---|
1960 | <xsl:when test="$child-nodes"> |
---|
1961 | <xsl:apply-templates select="$child-nodes"/> |
---|
1962 | </xsl:when> |
---|
1963 | <xsl:otherwise> |
---|
1964 | <xsl:value-of select="$text"/> |
---|
1965 | </xsl:otherwise> |
---|
1966 | </xsl:choose> |
---|
1967 | </fo:wrapper> |
---|
1968 | </xsl:when> |
---|
1969 | <xsl:otherwise> |
---|
1970 | <xsl:choose> |
---|
1971 | <xsl:when test="$child-nodes"> |
---|
1972 | <xsl:apply-templates select="$child-nodes"/> |
---|
1973 | </xsl:when> |
---|
1974 | <xsl:otherwise> |
---|
1975 | <xsl:value-of select="$text"/> |
---|
1976 | </xsl:otherwise> |
---|
1977 | </xsl:choose> |
---|
1978 | </xsl:otherwise> |
---|
1979 | </xsl:choose> |
---|
1980 | </xsl:template> |
---|
1981 | |
---|
1982 | <xsl:template match="xref|relref"> |
---|
1983 | <xsl:apply-imports/> |
---|
1984 | </xsl:template> |
---|
1985 | |
---|
1986 | <xsl:template match="/"> |
---|
1987 | <xsl:apply-templates /> |
---|
1988 | </xsl:template> |
---|
1989 | |
---|
1990 | <xsl:template match="xi:include"> |
---|
1991 | <xsl:choose> |
---|
1992 | <xsl:when test="not(parent::references)"> |
---|
1993 | <xsl:call-template name="error"> |
---|
1994 | <xsl:with-param name="msg" select="'Support for x:include is restricted to child elements of <references>'"/> |
---|
1995 | </xsl:call-template> |
---|
1996 | </xsl:when> |
---|
1997 | <xsl:otherwise> |
---|
1998 | <!-- handled elsewhere --> |
---|
1999 | </xsl:otherwise> |
---|
2000 | </xsl:choose> |
---|
2001 | </xsl:template> |
---|
2002 | |
---|
2003 | <xsl:template match="br"> |
---|
2004 | <fo:block/> |
---|
2005 | </xsl:template> |
---|
2006 | |
---|
2007 | <xsl:template match="*"> |
---|
2008 | <xsl:message terminate="yes">ERROR: unknown or unexpected element: {<xsl:value-of select="namespace-uri()" />}<xsl:value-of select="local-name()" /><xsl:call-template name="lineno"/>: '<xsl:value-of select="."/>'</xsl:message> |
---|
2009 | </xsl:template> |
---|
2010 | |
---|
2011 | <!-- work around for text() formatter applying templates to generated table --> |
---|
2012 | <xsl:template match="myns:item//a"> |
---|
2013 | <xsl:value-of select="."/> |
---|
2014 | </xsl:template> |
---|
2015 | |
---|
2016 | <xsl:template name="emitheader"> |
---|
2017 | <xsl:param name="lc" /> |
---|
2018 | <xsl:param name="rc" /> |
---|
2019 | |
---|
2020 | <xsl:for-each select="$lc/myns:item | $rc/myns:item"> |
---|
2021 | <xsl:variable name="pos" select="position()" /> |
---|
2022 | <xsl:if test="$pos < count($lc/myns:item) + 1 or $pos < count($rc/myns:item) + 1"> |
---|
2023 | <fo:table-row> |
---|
2024 | <fo:table-cell> |
---|
2025 | <fo:block> |
---|
2026 | <xsl:apply-templates select="$lc/myns:item[$pos]/node()" mode="simple-html" /> |
---|
2027 | </fo:block> |
---|
2028 | </fo:table-cell> |
---|
2029 | <fo:table-cell> |
---|
2030 | <fo:block text-align="right"> |
---|
2031 | <xsl:apply-templates select="$rc/myns:item[$pos]/node()" mode="simple-html" /> |
---|
2032 | </fo:block> |
---|
2033 | </fo:table-cell> |
---|
2034 | </fo:table-row> |
---|
2035 | </xsl:if> |
---|
2036 | </xsl:for-each> |
---|
2037 | </xsl:template> |
---|
2038 | |
---|
2039 | <xsl:template match="text()" mode="simple-html"> |
---|
2040 | <xsl:apply-templates select="." /> |
---|
2041 | </xsl:template> |
---|
2042 | |
---|
2043 | <xsl:template match="a" mode="simple-html"> |
---|
2044 | <fo:basic-link external-destination="url('{@href}')" xsl:use-attribute-sets="external-link"> |
---|
2045 | <xsl:apply-templates /> |
---|
2046 | </fo:basic-link> |
---|
2047 | </xsl:template> |
---|
2048 | |
---|
2049 | |
---|
2050 | <!-- produce back section with author information --> |
---|
2051 | <xsl:template name="insertAuthors"> |
---|
2052 | |
---|
2053 | <xsl:variable name="sectionNumber"> |
---|
2054 | <xsl:call-template name="get-authors-section-number"/> |
---|
2055 | </xsl:variable> |
---|
2056 | |
---|
2057 | <xsl:if test="$sectionNumber!='suppress' and $xml2rfc-authorship!='no'"> |
---|
2058 | <fo:block id="{$anchor-pref}authors" xsl:use-attribute-sets="h1 newpage"> |
---|
2059 | <xsl:if test="$sectionNumber != ''"> |
---|
2060 | <xsl:call-template name="emit-section-number"> |
---|
2061 | <xsl:with-param name="no" select="$sectionNumber"/> |
---|
2062 | </xsl:call-template> |
---|
2063 | <xsl:text>  </xsl:text> |
---|
2064 | </xsl:if> |
---|
2065 | <xsl:call-template name="get-authors-section-title"/> |
---|
2066 | </fo:block> |
---|
2067 | |
---|
2068 | <xsl:apply-templates select="/rfc/front/author" /> |
---|
2069 | </xsl:if> |
---|
2070 | </xsl:template> |
---|
2071 | |
---|
2072 | <xsl:template name="insert-index-item"> |
---|
2073 | <xsl:param name="in-artwork"/> |
---|
2074 | <xsl:param name="irefs"/> |
---|
2075 | <xsl:param name="xrefs"/> |
---|
2076 | <xsl:param name="extrefs"/> |
---|
2077 | |
---|
2078 | <xsl:choose> |
---|
2079 | <xsl:when test="$in-artwork"> |
---|
2080 | <fo:wrapper font-family="monospace"><xsl:value-of select="@item" /></fo:wrapper> |
---|
2081 | </xsl:when> |
---|
2082 | <xsl:otherwise> |
---|
2083 | <xsl:value-of select="@item" /> |
---|
2084 | </xsl:otherwise> |
---|
2085 | </xsl:choose> |
---|
2086 | <xsl:text> </xsl:text> |
---|
2087 | |
---|
2088 | <xsl:if test="$irefs"> |
---|
2089 | <fo:index-page-citation-list merge-sequential-page-numbers="merge"> |
---|
2090 | <fo:index-key-reference page-number-treatment="link" ref-index-key="{concat('item=',@item,',subitem=',@subitem,',primary')}" font-weight="bold"/> |
---|
2091 | <fo:index-key-reference page-number-treatment="link" ref-index-key="{concat('item=',@item,',subitem=',@subitem)}"/> |
---|
2092 | </fo:index-page-citation-list> |
---|
2093 | </xsl:if> |
---|
2094 | |
---|
2095 | </xsl:template> |
---|
2096 | |
---|
2097 | <xsl:template name="insert-index-subitem"> |
---|
2098 | <xsl:param name="in-artwork"/> |
---|
2099 | <xsl:param name="irefs"/> |
---|
2100 | <xsl:param name="xrefs"/> |
---|
2101 | <xsl:param name="extrefs"/> |
---|
2102 | |
---|
2103 | <fo:block start-indent="2em" hyphenate="true"> |
---|
2104 | <xsl:choose> |
---|
2105 | <xsl:when test="$in-artwork"> |
---|
2106 | <fo:wrapper font-family="monospace"><xsl:value-of select="@subitem" /></fo:wrapper> |
---|
2107 | </xsl:when> |
---|
2108 | <xsl:otherwise> |
---|
2109 | <xsl:value-of select="@subitem" /> |
---|
2110 | </xsl:otherwise> |
---|
2111 | </xsl:choose> |
---|
2112 | <xsl:text> </xsl:text> |
---|
2113 | |
---|
2114 | <xsl:if test="$irefs"> |
---|
2115 | <fo:index-page-citation-list merge-sequential-page-numbers="merge"> |
---|
2116 | <fo:index-key-reference page-number-treatment="link" ref-index-key="{concat('item=',@item,',subitem=',@subitem,',primary')}" font-weight="bold"/> |
---|
2117 | <fo:index-key-reference page-number-treatment="link" ref-index-key="{concat('item=',@item,',subitem=',@subitem)}" /> |
---|
2118 | </fo:index-page-citation-list> |
---|
2119 | </xsl:if> |
---|
2120 | |
---|
2121 | </fo:block> |
---|
2122 | </xsl:template> |
---|
2123 | |
---|
2124 | <xsl:variable name="item-wrapper-element">fo:block</xsl:variable> |
---|
2125 | <xsl:attribute-set name="item-wrapper-element"> |
---|
2126 | <xsl:attribute name="start-indent">1em</xsl:attribute> |
---|
2127 | <xsl:attribute name="hyphenate">true</xsl:attribute> |
---|
2128 | </xsl:attribute-set> |
---|
2129 | <xsl:variable name="subitems-wrapper-element">fo:wrapper</xsl:variable> |
---|
2130 | |
---|
2131 | <!-- generate the index section --> |
---|
2132 | |
---|
2133 | <xsl:template name="insertIndex"> |
---|
2134 | |
---|
2135 | <fo:block xsl:use-attribute-sets="h1 newpage" id="{$anchor-pref}index"> |
---|
2136 | <xsl:text>Index</xsl:text> |
---|
2137 | </fo:block> |
---|
2138 | |
---|
2139 | <xsl:for-each select="//iref | //reference[not(starts-with(@anchor,'deleted-'))]"> |
---|
2140 | <xsl:sort select="translate(concat(@item,/rfc/back/displayreference[@target=current()/@anchor]/@to,@anchor),$lcase,$ucase)" /> |
---|
2141 | <xsl:variable name="letter" select="translate(substring(concat(@item,/rfc/back/displayreference[@target=current()/@anchor]/@to,@anchor),1,1),$lcase,$ucase)"/> |
---|
2142 | |
---|
2143 | <xsl:variable name="showit" select="$xml2rfc-ext-include-references-in-index='yes' or self::iref"/> |
---|
2144 | |
---|
2145 | <xsl:if test="$showit and generate-id(.) = generate-id(key('index-first-letter',$letter)[1])"> |
---|
2146 | <fo:block space-before="1em" font-weight="bold"> |
---|
2147 | <xsl:value-of select="$letter" /> |
---|
2148 | </fo:block> |
---|
2149 | |
---|
2150 | <xsl:for-each select="key('index-first-letter',$letter)"> |
---|
2151 | |
---|
2152 | <xsl:sort select="translate(concat(@item,@anchor),$lcase,$ucase)" /> |
---|
2153 | |
---|
2154 | <xsl:choose> |
---|
2155 | <xsl:when test="self::reference"> |
---|
2156 | <xsl:if test="$xml2rfc-ext-include-references-in-index='yes' and not(starts-with(@anchor,'deleted-'))"> |
---|
2157 | |
---|
2158 | <xsl:variable name="rs" select="key('xref-item',current()/@anchor) | . | key('anchor-item',concat('deleted-',current()/@anchor))"/> |
---|
2159 | |
---|
2160 | <fo:block start-indent="1em" hyphenate="true"> |
---|
2161 | <xsl:variable name="val"> |
---|
2162 | <xsl:call-template name="reference-name"/> |
---|
2163 | </xsl:variable> |
---|
2164 | <fo:wrapper font-style="italic"><xsl:value-of select="substring($val,2,string-length($val)-2)"/></fo:wrapper> |
---|
2165 | <xsl:text> </xsl:text> |
---|
2166 | |
---|
2167 | <fo:index-page-citation-list merge-sequential-page-numbers="merge"> |
---|
2168 | <fo:index-key-reference page-number-treatment="link" ref-index-key="{concat('xrefitem=',@anchor,',primary')}" font-weight="bold"/> |
---|
2169 | <fo:index-key-reference page-number-treatment="link" ref-index-key="{concat('xrefitem=',@anchor)}"/> |
---|
2170 | </fo:index-page-citation-list> |
---|
2171 | |
---|
2172 | <xsl:variable name="rs2" select="$rs[@x:sec|@section]"/> |
---|
2173 | |
---|
2174 | <xsl:if test="$rs2"> |
---|
2175 | <xsl:for-each select="$rs2"> |
---|
2176 | <xsl:sort select="substring-before(concat(@x:sec,@section,'.'),'.')" data-type="number"/> |
---|
2177 | <xsl:sort select="substring(concat(@x:sec,@section),2+string-length(substring-before(concat(@x:sec,@section),'.')))" data-type="number"/> |
---|
2178 | |
---|
2179 | <xsl:if test="generate-id(.) = generate-id(key('index-xref-by-sec',concat(@target,'..',@x:sec,@section)))"> |
---|
2180 | <fo:block start-indent="2em" hyphenate="true"> |
---|
2181 | <fo:wrapper font-style="italic"> |
---|
2182 | <xsl:call-template name="format-section-ref"> |
---|
2183 | <xsl:with-param name="number" select="concat(@x:sec,@section)"/> |
---|
2184 | </xsl:call-template> |
---|
2185 | <xsl:text> </xsl:text> |
---|
2186 | </fo:wrapper> |
---|
2187 | <fo:index-page-citation-list merge-sequential-page-numbers="merge"> |
---|
2188 | <fo:index-key-reference page-number-treatment="link" ref-index-key="{concat('xrefitem=',@target,'#',@x:sec,@section)}"/> |
---|
2189 | </fo:index-page-citation-list> |
---|
2190 | </fo:block> |
---|
2191 | </xsl:if> |
---|
2192 | </xsl:for-each> |
---|
2193 | </xsl:if> |
---|
2194 | |
---|
2195 | <xsl:if test="current()/x:source/@href"> |
---|
2196 | <xsl:variable name="rs3" select="$rs[not(@x:sec) and @x:rel]"/> |
---|
2197 | <xsl:if test="$rs3"> |
---|
2198 | <xsl:variable name="doc" select="document(current()/x:source/@href)"/> |
---|
2199 | <xsl:for-each select="$rs3"> |
---|
2200 | <xsl:sort select="count($doc//*[@anchor and following::*/@anchor=substring-after(current()/@x:rel,'#')])" order="ascending" data-type="number"/> |
---|
2201 | <xsl:if test="generate-id(.) = generate-id(key('index-xref-by-anchor',concat(@target,'..',@x:rel))[1])"> |
---|
2202 | <fo:block start-indent="2em" hyphenate="true"> |
---|
2203 | <xsl:variable name="sec"> |
---|
2204 | <xsl:for-each select="$doc//*[@anchor=substring-after(current()/@x:rel,'#')]"> |
---|
2205 | <xsl:call-template name="get-section-number"/> |
---|
2206 | </xsl:for-each> |
---|
2207 | </xsl:variable> |
---|
2208 | <fo:wrapper font-style="italic"> |
---|
2209 | <xsl:call-template name="format-section-ref"> |
---|
2210 | <xsl:with-param name="number" select="$sec"/> |
---|
2211 | </xsl:call-template> |
---|
2212 | </fo:wrapper> |
---|
2213 | <xsl:text> </xsl:text> |
---|
2214 | <fo:index-page-citation-list merge-sequential-page-numbers="merge"> |
---|
2215 | <fo:index-key-reference page-number-treatment="link" ref-index-key="{concat('xrefitem=',@target,'#',$sec)}"/> |
---|
2216 | </fo:index-page-citation-list> |
---|
2217 | </fo:block> |
---|
2218 | </xsl:if> |
---|
2219 | </xsl:for-each> |
---|
2220 | </xsl:if> |
---|
2221 | </xsl:if> |
---|
2222 | |
---|
2223 | </fo:block> |
---|
2224 | |
---|
2225 | </xsl:if> |
---|
2226 | </xsl:when> |
---|
2227 | <xsl:otherwise> |
---|
2228 | <xsl:call-template name="insert-index-regular-iref"/> |
---|
2229 | </xsl:otherwise> |
---|
2230 | </xsl:choose> |
---|
2231 | |
---|
2232 | |
---|
2233 | </xsl:for-each> |
---|
2234 | </xsl:if> |
---|
2235 | </xsl:for-each> |
---|
2236 | </xsl:template> |
---|
2237 | |
---|
2238 | |
---|
2239 | |
---|
2240 | <xsl:template match="/" mode="toc"> |
---|
2241 | <fo:block xsl:use-attribute-sets="h1 newpage" id="{concat($anchor-pref,'toc')}"> |
---|
2242 | <xsl:text>Table of Contents</xsl:text> |
---|
2243 | </fo:block> |
---|
2244 | |
---|
2245 | <xsl:apply-templates mode="toc" /> |
---|
2246 | </xsl:template> |
---|
2247 | |
---|
2248 | <xsl:template name="back-toc"> |
---|
2249 | |
---|
2250 | <xsl:apply-templates select="references" mode="toc" /> |
---|
2251 | |
---|
2252 | <xsl:if test="$xml2rfc-ext-authors-section='before-appendices'"> |
---|
2253 | <xsl:apply-templates select="/rfc/front" mode="toc" /> |
---|
2254 | </xsl:if> |
---|
2255 | |
---|
2256 | <xsl:apply-templates select="back/*[not(self::references)]" mode="toc" /> |
---|
2257 | |
---|
2258 | <!-- insert the index if index entries exist --> |
---|
2259 | <xsl:if test="$has-index"> |
---|
2260 | <xsl:call-template name="insert-toc-line"> |
---|
2261 | <xsl:with-param name="target" select="concat($anchor-pref,'index')"/> |
---|
2262 | <xsl:with-param name="title" select="'Index'"/> |
---|
2263 | </xsl:call-template> |
---|
2264 | </xsl:if> |
---|
2265 | |
---|
2266 | <xsl:if test="$xml2rfc-ext-authors-section='end'"> |
---|
2267 | <xsl:apply-templates select="/rfc/front" mode="toc" /> |
---|
2268 | </xsl:if> |
---|
2269 | |
---|
2270 | <!-- copyright statements --> |
---|
2271 | <xsl:if test="$xml2rfc-private='' and not($no-copylong)"> |
---|
2272 | <xsl:call-template name="insert-toc-line"> |
---|
2273 | <xsl:with-param name="target" select="concat($anchor-pref,'ipr')"/> |
---|
2274 | <xsl:with-param name="title" select="'Intellectual Property and Copyright Statements'"/> |
---|
2275 | </xsl:call-template> |
---|
2276 | </xsl:if> |
---|
2277 | |
---|
2278 | </xsl:template> |
---|
2279 | |
---|
2280 | <xsl:template match="front" mode="toc"> |
---|
2281 | |
---|
2282 | <xsl:variable name="authors-title"> |
---|
2283 | <xsl:call-template name="get-authors-section-title"/> |
---|
2284 | </xsl:variable> |
---|
2285 | <xsl:variable name="authors-number"> |
---|
2286 | <xsl:call-template name="get-authors-section-number"/> |
---|
2287 | </xsl:variable> |
---|
2288 | <xsl:if test="$authors-number!='suppress' and $xml2rfc-authorship!='no'"> |
---|
2289 | <xsl:call-template name="insert-toc-line"> |
---|
2290 | <xsl:with-param name="target" select="concat($anchor-pref,'authors')"/> |
---|
2291 | <xsl:with-param name="title" select="$authors-title"/> |
---|
2292 | <xsl:with-param name="number" select="$authors-number"/> |
---|
2293 | </xsl:call-template> |
---|
2294 | </xsl:if> |
---|
2295 | |
---|
2296 | </xsl:template> |
---|
2297 | |
---|
2298 | <xsl:template name="references-toc"> |
---|
2299 | |
---|
2300 | <!-- distinguish two cases: (a) single references element (process |
---|
2301 | as toplevel section; (b) multiple references sections (add one toplevel |
---|
2302 | container with subsection) --> |
---|
2303 | |
---|
2304 | <xsl:choose> |
---|
2305 | <xsl:when test="count(/*/back/references) = 0"> |
---|
2306 | <!-- nop --> |
---|
2307 | </xsl:when> |
---|
2308 | <xsl:when test="count(/*/back/references) = 1"> |
---|
2309 | <xsl:for-each select="/*/back/references"> |
---|
2310 | <xsl:variable name="title"> |
---|
2311 | <xsl:choose> |
---|
2312 | <xsl:when test="@title!=''"><xsl:value-of select="@title" /></xsl:when> |
---|
2313 | <xsl:otherwise><xsl:value-of select="$xml2rfc-refparent"/></xsl:otherwise> |
---|
2314 | </xsl:choose> |
---|
2315 | </xsl:variable> |
---|
2316 | |
---|
2317 | <xsl:call-template name="insert-toc-line"> |
---|
2318 | <xsl:with-param name="number"> |
---|
2319 | <xsl:call-template name="get-references-section-number"/> |
---|
2320 | </xsl:with-param> |
---|
2321 | <xsl:with-param name="target" select="concat($anchor-pref,'references')"/> |
---|
2322 | <xsl:with-param name="title" select="$title"/> |
---|
2323 | <xsl:with-param name="name" select="name"/> |
---|
2324 | </xsl:call-template> |
---|
2325 | |
---|
2326 | <xsl:if test="references"> |
---|
2327 | <xsl:for-each select="references"> |
---|
2328 | <xsl:call-template name="references-toc-entry"/> |
---|
2329 | </xsl:for-each> |
---|
2330 | </xsl:if> |
---|
2331 | </xsl:for-each> |
---|
2332 | </xsl:when> |
---|
2333 | <xsl:otherwise> |
---|
2334 | <!-- insert pseudo container --> |
---|
2335 | <xsl:call-template name="insert-toc-line"> |
---|
2336 | <xsl:with-param name="number"> |
---|
2337 | <xsl:call-template name="get-references-section-number"/> |
---|
2338 | </xsl:with-param> |
---|
2339 | <xsl:with-param name="target" select="concat($anchor-pref,'references')"/> |
---|
2340 | <xsl:with-param name="title" select="$xml2rfc-refparent"/> |
---|
2341 | </xsl:call-template> |
---|
2342 | |
---|
2343 | <!-- ...with subsections... --> |
---|
2344 | <xsl:for-each select="/*/back/references"> |
---|
2345 | <xsl:call-template name="references-toc-entry"/> |
---|
2346 | </xsl:for-each> |
---|
2347 | </xsl:otherwise> |
---|
2348 | </xsl:choose> |
---|
2349 | </xsl:template> |
---|
2350 | |
---|
2351 | <xsl:template name="references-toc-entry"> |
---|
2352 | <xsl:variable name="title"> |
---|
2353 | <xsl:choose> |
---|
2354 | <xsl:when test="@title!=''"><xsl:value-of select="@title" /></xsl:when> |
---|
2355 | <xsl:otherwise><xsl:value-of select="$xml2rfc-refparent"/></xsl:otherwise> |
---|
2356 | </xsl:choose> |
---|
2357 | </xsl:variable> |
---|
2358 | |
---|
2359 | <xsl:variable name="sectionNumber"> |
---|
2360 | <xsl:call-template name="get-section-number" /> |
---|
2361 | </xsl:variable> |
---|
2362 | |
---|
2363 | <xsl:variable name="num"> |
---|
2364 | <xsl:number level="any"/> |
---|
2365 | </xsl:variable> |
---|
2366 | |
---|
2367 | <xsl:call-template name="insert-toc-line"> |
---|
2368 | <xsl:with-param name="number" select="$sectionNumber"/> |
---|
2369 | <xsl:with-param name="target" select="concat($anchor-pref,'references','.',$num)"/> |
---|
2370 | <xsl:with-param name="title" select="$title"/> |
---|
2371 | <xsl:with-param name="name" select="name"/> |
---|
2372 | </xsl:call-template> |
---|
2373 | |
---|
2374 | <xsl:if test="references"> |
---|
2375 | <xsl:for-each select="references"> |
---|
2376 | <xsl:call-template name="references-toc-entry"/> |
---|
2377 | </xsl:for-each> |
---|
2378 | </xsl:if> |
---|
2379 | </xsl:template> |
---|
2380 | |
---|
2381 | <!-- suppress xml2rfc preptool artefacts --> |
---|
2382 | <xsl:template match="section[author]" mode="toc"/> |
---|
2383 | |
---|
2384 | <xsl:template match="section" mode="toc"> |
---|
2385 | <xsl:variable name="sectionNumber"> |
---|
2386 | <xsl:call-template name="get-section-number" /> |
---|
2387 | </xsl:variable> |
---|
2388 | |
---|
2389 | <xsl:variable name="target"> |
---|
2390 | <xsl:choose> |
---|
2391 | <xsl:when test="@anchor"><xsl:value-of select="@anchor" /></xsl:when> |
---|
2392 | <xsl:otherwise><xsl:value-of select="$anchor-pref"/>section.<xsl:value-of select="$sectionNumber" /></xsl:otherwise> |
---|
2393 | </xsl:choose> |
---|
2394 | </xsl:variable> |
---|
2395 | |
---|
2396 | <xsl:call-template name="insert-toc-line"> |
---|
2397 | <xsl:with-param name="number" select="$sectionNumber"/> |
---|
2398 | <xsl:with-param name="target" select="$target"/> |
---|
2399 | <xsl:with-param name="title" select="@title"/> |
---|
2400 | <xsl:with-param name="name" select="name"/> |
---|
2401 | <xsl:with-param name="tocparam" select="@toc"/> |
---|
2402 | </xsl:call-template> |
---|
2403 | |
---|
2404 | <xsl:if test=".//section"> |
---|
2405 | <xsl:apply-templates mode="toc" /> |
---|
2406 | </xsl:if> |
---|
2407 | </xsl:template> |
---|
2408 | |
---|
2409 | <xsl:template name="insert-toc-line"> |
---|
2410 | <xsl:param name="number" /> |
---|
2411 | <xsl:param name="target" /> |
---|
2412 | <xsl:param name="title" /> |
---|
2413 | <xsl:param name="name" /> |
---|
2414 | <xsl:param name="tocparam" /> |
---|
2415 | |
---|
2416 | <xsl:variable name="depth"> |
---|
2417 | <!-- count the dots --> |
---|
2418 | <xsl:value-of select="string-length(translate($number,'.ABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890§','.'))"/> |
---|
2419 | </xsl:variable> |
---|
2420 | |
---|
2421 | <!-- handle tocdepth parameter --> |
---|
2422 | <xsl:choose> |
---|
2423 | <xsl:when test="(not($tocparam) or $tocparam='' or $tocparam='default') and $depth >= $parsedTocDepth"> |
---|
2424 | <!-- dropped entry because of depth--> |
---|
2425 | </xsl:when> |
---|
2426 | <xsl:when test="$tocparam='exclude'"> |
---|
2427 | <!-- dropped entry because excluded --> |
---|
2428 | </xsl:when> |
---|
2429 | <xsl:when test="$depth = 0"> |
---|
2430 | <fo:block space-before="1em" font-weight="bold" text-align-last="justify"> |
---|
2431 | <xsl:if test="$number!='' and not(contains($number,$unnumbered))"> |
---|
2432 | <xsl:if test="translate($number,$ucase,'')=''">Appendix </xsl:if> |
---|
2433 | <xsl:value-of select="$number" /> |
---|
2434 | <xsl:if test="$xml2rfc-ext-sec-no-trailing-dots='yes'">.</xsl:if> |
---|
2435 | <xsl:text>  </xsl:text> |
---|
2436 | </xsl:if> |
---|
2437 | <fo:basic-link internal-destination="{$target}" xsl:use-attribute-sets="internal-link"> |
---|
2438 | <xsl:choose> |
---|
2439 | <xsl:when test="$name"> |
---|
2440 | <xsl:call-template name="render-name-ref"> |
---|
2441 | <xsl:with-param name="n" select="$name/node()"/> |
---|
2442 | </xsl:call-template> |
---|
2443 | </xsl:when> |
---|
2444 | <xsl:otherwise> |
---|
2445 | <xsl:value-of select="$title"/> |
---|
2446 | </xsl:otherwise> |
---|
2447 | </xsl:choose> |
---|
2448 | </fo:basic-link> |
---|
2449 | <fo:leader leader-pattern="dots"/> |
---|
2450 | <fo:page-number-citation ref-id="{$target}"/> |
---|
2451 | </fo:block> |
---|
2452 | </xsl:when> |
---|
2453 | <xsl:when test="$depth = 1"> |
---|
2454 | <fo:block space-before="0.5em" text-align-last="justify"> |
---|
2455 | <xsl:if test="$number!='' and not(contains($number,$unnumbered))"> |
---|
2456 | <xsl:value-of select="$number" /> |
---|
2457 | <xsl:if test="$xml2rfc-ext-sec-no-trailing-dots='yes'">.</xsl:if> |
---|
2458 | <xsl:text>    </xsl:text> |
---|
2459 | </xsl:if> |
---|
2460 | <fo:basic-link internal-destination="{$target}" xsl:use-attribute-sets="internal-link"> |
---|
2461 | <xsl:choose> |
---|
2462 | <xsl:when test="$name"> |
---|
2463 | <xsl:call-template name="render-name-ref"> |
---|
2464 | <xsl:with-param name="n" select="$name/node()"/> |
---|
2465 | </xsl:call-template> |
---|
2466 | </xsl:when> |
---|
2467 | <xsl:otherwise> |
---|
2468 | <xsl:value-of select="$title"/> |
---|
2469 | </xsl:otherwise> |
---|
2470 | </xsl:choose> |
---|
2471 | </fo:basic-link> |
---|
2472 | <fo:leader leader-pattern="dots"/> |
---|
2473 | <fo:page-number-citation ref-id="{$target}"/> |
---|
2474 | </fo:block> |
---|
2475 | </xsl:when> |
---|
2476 | <xsl:otherwise> |
---|
2477 | <fo:block text-align-last="justify"> |
---|
2478 | <xsl:text>  </xsl:text> |
---|
2479 | <xsl:if test="$number!='' and not(contains($number,$unnumbered))"> |
---|
2480 | <xsl:value-of select="$number" /> |
---|
2481 | <xsl:if test="$xml2rfc-ext-sec-no-trailing-dots='yes'">.</xsl:if> |
---|
2482 | <xsl:text>    </xsl:text> |
---|
2483 | </xsl:if> |
---|
2484 | <fo:basic-link internal-destination="{$target}" xsl:use-attribute-sets="internal-link"> |
---|
2485 | <xsl:choose> |
---|
2486 | <xsl:when test="$name"> |
---|
2487 | <xsl:call-template name="render-name-ref"> |
---|
2488 | <xsl:with-param name="n" select="$name/node()"/> |
---|
2489 | </xsl:call-template> |
---|
2490 | </xsl:when> |
---|
2491 | <xsl:otherwise> |
---|
2492 | <xsl:value-of select="$title"/> |
---|
2493 | </xsl:otherwise> |
---|
2494 | </xsl:choose> |
---|
2495 | </fo:basic-link> |
---|
2496 | <fo:leader leader-pattern="dots"/> |
---|
2497 | <fo:page-number-citation ref-id="{$target}"/> |
---|
2498 | </fo:block> |
---|
2499 | </xsl:otherwise> |
---|
2500 | </xsl:choose> |
---|
2501 | |
---|
2502 | </xsl:template> |
---|
2503 | |
---|
2504 | |
---|
2505 | <!-- |
---|
2506 | <xsl:template name="rfclist"> |
---|
2507 | <xsl:param name="list" /> |
---|
2508 | <xsl:choose> |
---|
2509 | <xsl:when test="contains($list,',')"> |
---|
2510 | <xsl:variable name="rfcNo" select="substring-before($list,',')" /> |
---|
2511 | <a href="{concat($rfcUrlPrefix,$rfcNo,'.txt')}"><xsl:value-of select="$rfcNo" /></a>, |
---|
2512 | <xsl:call-template name="rfclist"> |
---|
2513 | <xsl:with-param name="list" select="normalize-space(substring-after($list,','))" /> |
---|
2514 | </xsl:call-template> |
---|
2515 | </xsl:when> |
---|
2516 | <xsl:otherwise> |
---|
2517 | <xsl:variable name="rfcNo" select="$list" /> |
---|
2518 | <a href="{concat($rfcUrlPrefix,$rfcNo,'.txt')}"><xsl:value-of select="$rfcNo" /></a> |
---|
2519 | </xsl:otherwise> |
---|
2520 | </xsl:choose> |
---|
2521 | </xsl:template> |
---|
2522 | --> |
---|
2523 | |
---|
2524 | <xsl:template name="insertHeader"> |
---|
2525 | <xsl:variable name="left"> |
---|
2526 | <xsl:call-template name="get-header-left" /> |
---|
2527 | </xsl:variable> |
---|
2528 | <xsl:variable name="center"> |
---|
2529 | <xsl:call-template name="get-header-center" /> |
---|
2530 | </xsl:variable> |
---|
2531 | <xsl:variable name="right"> |
---|
2532 | <xsl:call-template name="get-header-right" /> |
---|
2533 | </xsl:variable> |
---|
2534 | |
---|
2535 | <fo:static-content flow-name="header-right"> |
---|
2536 | <fo:block space-after=".5cm" /> |
---|
2537 | <fo:table width="100%" text-align="center" table-layout="fixed"> |
---|
2538 | <fo:table-column column-width="proportional-column-width({(string-length($left)+string-length($right)) div 2})" /> |
---|
2539 | <fo:table-column column-width="proportional-column-width({string-length($center)})" /> |
---|
2540 | <fo:table-column column-width="proportional-column-width({(string-length($left)+string-length($right)) div 2})" /> |
---|
2541 | <fo:table-body> |
---|
2542 | <fo:table-row> |
---|
2543 | <fo:table-cell> |
---|
2544 | <fo:block text-align="start"> |
---|
2545 | <xsl:value-of select="$left" /> |
---|
2546 | </fo:block> |
---|
2547 | </fo:table-cell> |
---|
2548 | <fo:table-cell text-align="center"> |
---|
2549 | <fo:block> |
---|
2550 | <xsl:value-of select="$center" /> |
---|
2551 | </fo:block> |
---|
2552 | </fo:table-cell> |
---|
2553 | <fo:table-cell text-align="end"> |
---|
2554 | <fo:block> |
---|
2555 | <xsl:value-of select="$right" /> |
---|
2556 | </fo:block> |
---|
2557 | </fo:table-cell> |
---|
2558 | </fo:table-row> |
---|
2559 | </fo:table-body> |
---|
2560 | </fo:table> |
---|
2561 | </fo:static-content> |
---|
2562 | |
---|
2563 | <fo:static-content flow-name="header-left"> |
---|
2564 | <fo:block space-after=".5cm" /> |
---|
2565 | <fo:table width="100%" text-align="center" table-layout="fixed"> |
---|
2566 | <fo:table-column column-width="proportional-column-width({(string-length($left)+string-length($right)) div 2})" /> |
---|
2567 | <fo:table-column column-width="proportional-column-width({string-length($center)})" /> |
---|
2568 | <fo:table-column column-width="proportional-column-width({(string-length($left)+string-length($right)) div 2})" /> |
---|
2569 | <fo:table-body> |
---|
2570 | <fo:table-row> |
---|
2571 | <fo:table-cell text-align="start"> |
---|
2572 | <fo:block> |
---|
2573 | <xsl:value-of select="$right" /> |
---|
2574 | </fo:block> |
---|
2575 | </fo:table-cell> |
---|
2576 | <fo:table-cell text-align="center"> |
---|
2577 | <fo:block> |
---|
2578 | <xsl:value-of select="$center" /> |
---|
2579 | </fo:block> |
---|
2580 | </fo:table-cell> |
---|
2581 | <fo:table-cell> |
---|
2582 | <fo:block text-align="end"> |
---|
2583 | <xsl:value-of select="$left" /> |
---|
2584 | </fo:block> |
---|
2585 | </fo:table-cell> |
---|
2586 | </fo:table-row> |
---|
2587 | </fo:table-body> |
---|
2588 | </fo:table> |
---|
2589 | </fo:static-content> |
---|
2590 | |
---|
2591 | </xsl:template> |
---|
2592 | |
---|
2593 | <xsl:template name="insertFooter"> |
---|
2594 | <xsl:variable name="left"> |
---|
2595 | <xsl:call-template name="get-author-summary" /> |
---|
2596 | </xsl:variable> |
---|
2597 | <xsl:variable name="center"> |
---|
2598 | <xsl:call-template name="get-bottom-center" /> |
---|
2599 | </xsl:variable> |
---|
2600 | <xsl:variable name="right">[Page 999]</xsl:variable> |
---|
2601 | |
---|
2602 | <fo:static-content flow-name="footer-right"> |
---|
2603 | <fo:table text-align="center" width="100%" table-layout="fixed"> |
---|
2604 | <fo:table-column column-width="proportional-column-width({(string-length($left)+string-length($right)) div 2})" /> |
---|
2605 | <fo:table-column column-width="proportional-column-width({string-length($center)})" /> |
---|
2606 | <fo:table-column column-width="proportional-column-width({(string-length($left)+string-length($right)) div 2})" /> |
---|
2607 | <fo:table-body> |
---|
2608 | <fo:table-row> |
---|
2609 | <fo:table-cell> |
---|
2610 | <fo:block text-align="start"> |
---|
2611 | <xsl:value-of select="$left" /> |
---|
2612 | </fo:block> |
---|
2613 | </fo:table-cell> |
---|
2614 | <fo:table-cell> |
---|
2615 | <fo:block text-align="center"> |
---|
2616 | <xsl:value-of select="$center" /> |
---|
2617 | </fo:block> |
---|
2618 | </fo:table-cell> |
---|
2619 | <fo:table-cell> |
---|
2620 | <fo:block text-align="end">[Page <fo:page-number />]</fo:block> |
---|
2621 | </fo:table-cell> |
---|
2622 | </fo:table-row> |
---|
2623 | </fo:table-body> |
---|
2624 | </fo:table> |
---|
2625 | </fo:static-content> |
---|
2626 | |
---|
2627 | <fo:static-content flow-name="footer-left"> |
---|
2628 | <fo:table text-align="center" width="100%" table-layout="fixed"> |
---|
2629 | <fo:table-column column-width="proportional-column-width({(string-length($left)+string-length($right)) div 2})" /> |
---|
2630 | <fo:table-column column-width="proportional-column-width({string-length($center)})" /> |
---|
2631 | <fo:table-column column-width="proportional-column-width({(string-length($left)+string-length($right)) div 2})" /> |
---|
2632 | <fo:table-body> |
---|
2633 | <fo:table-row> |
---|
2634 | <fo:table-cell> |
---|
2635 | <fo:block text-align="start">[Page <fo:page-number />]</fo:block> |
---|
2636 | </fo:table-cell> |
---|
2637 | <fo:table-cell> |
---|
2638 | <fo:block text-align="center"> |
---|
2639 | <xsl:value-of select="$center" /> |
---|
2640 | </fo:block> |
---|
2641 | </fo:table-cell> |
---|
2642 | <fo:table-cell> |
---|
2643 | <fo:block text-align="end"> |
---|
2644 | <xsl:value-of select="$left" /> |
---|
2645 | </fo:block> |
---|
2646 | </fo:table-cell> |
---|
2647 | </fo:table-row> |
---|
2648 | </fo:table-body> |
---|
2649 | </fo:table> |
---|
2650 | </fo:static-content> |
---|
2651 | |
---|
2652 | </xsl:template> |
---|
2653 | |
---|
2654 | <!-- change tracking --> |
---|
2655 | |
---|
2656 | <xsl:template match="ed:annotation" /> |
---|
2657 | <xsl:template match="ed:del" /> |
---|
2658 | <xsl:template match="ed:issue" /> |
---|
2659 | <xsl:template match="ed:ins"> |
---|
2660 | <xsl:apply-templates /> |
---|
2661 | </xsl:template> |
---|
2662 | <xsl:template match="ed:issueref"> |
---|
2663 | <xsl:apply-templates /> |
---|
2664 | </xsl:template> |
---|
2665 | |
---|
2666 | <xsl:template match="ed:replace"> |
---|
2667 | <!--<xsl:variable name="no">change<xsl:number level="any"/></xsl:variable> |
---|
2668 | <fo:change-bar-begin change-bar-class="{$no}" change-bar-style="solid" change-bar-color="red" change-bar-offset="2mm"/>--> |
---|
2669 | <xsl:apply-templates /> |
---|
2670 | <!--<fo:change-bar-end change-bar-class="{$no}"/>--> |
---|
2671 | </xsl:template> |
---|
2672 | |
---|
2673 | <!-- extensions --> |
---|
2674 | |
---|
2675 | <xsl:template match="ed:link" /> |
---|
2676 | |
---|
2677 | <xsl:template match="x:feedback" /> |
---|
2678 | |
---|
2679 | <xsl:template match="node()" mode="bookmarks"> |
---|
2680 | <xsl:apply-templates mode="bookmarks"/> |
---|
2681 | </xsl:template> |
---|
2682 | |
---|
2683 | <xsl:template match="abstract" mode="bookmarks"> |
---|
2684 | <fo:bookmark internal-destination="{concat($anchor-pref,'abstract')}"> |
---|
2685 | <fo:bookmark-title>Abstract</fo:bookmark-title> |
---|
2686 | <xsl:apply-templates mode="bookmarks"/> |
---|
2687 | </fo:bookmark> |
---|
2688 | </xsl:template> |
---|
2689 | |
---|
2690 | <xsl:template match="note" mode="bookmarks"> |
---|
2691 | <xsl:variable name="num"> |
---|
2692 | <xsl:number count="note" /> |
---|
2693 | </xsl:variable> |
---|
2694 | <fo:bookmark internal-destination="{concat($anchor-pref,'note.',$num)}"> |
---|
2695 | <fo:bookmark-title><xsl:value-of select="@title|name"/></fo:bookmark-title> |
---|
2696 | <xsl:apply-templates mode="bookmarks"/> |
---|
2697 | </fo:bookmark> |
---|
2698 | </xsl:template> |
---|
2699 | |
---|
2700 | <!-- suppress xml2rfc preptool artefacts --> |
---|
2701 | <xsl:template match="section[author]" mode="bookmarks" priority="9"/> |
---|
2702 | |
---|
2703 | <xsl:template match="section[not(ancestor::boilerplate)]" mode="bookmarks"> |
---|
2704 | <xsl:variable name="sectionNumber"><xsl:call-template name="get-section-number" /></xsl:variable> |
---|
2705 | <fo:bookmark internal-destination="{$anchor-pref}section.{$sectionNumber}"> |
---|
2706 | <fo:bookmark-title> |
---|
2707 | <xsl:if test="$sectionNumber!='' and not(contains($sectionNumber,$unnumbered))"> |
---|
2708 | <xsl:if test="translate($sectionNumber,$ucase,'')=''">Appendix </xsl:if> |
---|
2709 | <xsl:value-of select="$sectionNumber"/> |
---|
2710 | <xsl:if test="$xml2rfc-ext-sec-no-trailing-dots='yes'">.</xsl:if> |
---|
2711 | <xsl:text> </xsl:text> |
---|
2712 | </xsl:if> |
---|
2713 | <xsl:choose> |
---|
2714 | <xsl:when test="name"> |
---|
2715 | <xsl:variable name="hold"> |
---|
2716 | <xsl:apply-templates select="name/node()"/> |
---|
2717 | </xsl:variable> |
---|
2718 | <xsl:value-of select="normalize-space($hold)"/> |
---|
2719 | </xsl:when> |
---|
2720 | <xsl:otherwise> |
---|
2721 | <xsl:value-of select="@title"/> |
---|
2722 | </xsl:otherwise> |
---|
2723 | </xsl:choose> |
---|
2724 | </fo:bookmark-title> |
---|
2725 | <xsl:apply-templates mode="bookmarks"/> |
---|
2726 | </fo:bookmark> |
---|
2727 | </xsl:template> |
---|
2728 | |
---|
2729 | <xsl:template match="section[ancestor::boilerplate]" mode="bookmarks"> |
---|
2730 | <fo:bookmark internal-destination="{@anchor}"> |
---|
2731 | <fo:bookmark-title><xsl:value-of select="@title|name"/></fo:bookmark-title> |
---|
2732 | <xsl:apply-templates mode="bookmarks"/> |
---|
2733 | </fo:bookmark> |
---|
2734 | </xsl:template> |
---|
2735 | |
---|
2736 | <xsl:template match="back" mode="bookmarks"> |
---|
2737 | |
---|
2738 | <xsl:call-template name="references-bookmarks" /> |
---|
2739 | |
---|
2740 | <xsl:if test="$xml2rfc-ext-authors-section='before-appendices'"> |
---|
2741 | <xsl:apply-templates select="/rfc/front" mode="bookmarks" /> |
---|
2742 | </xsl:if> |
---|
2743 | |
---|
2744 | <xsl:apply-templates select="*[not(self::references)]" mode="bookmarks" /> |
---|
2745 | |
---|
2746 | <!-- insert the index if index entries exist --> |
---|
2747 | <xsl:if test="$has-index"> |
---|
2748 | <fo:bookmark internal-destination="{concat($anchor-pref,'index')}"> |
---|
2749 | <fo:bookmark-title>Index</fo:bookmark-title> |
---|
2750 | </fo:bookmark> |
---|
2751 | </xsl:if> |
---|
2752 | |
---|
2753 | <xsl:if test="$xml2rfc-ext-authors-section='end'"> |
---|
2754 | <xsl:apply-templates select="/rfc/front" mode="bookmarks" /> |
---|
2755 | </xsl:if> |
---|
2756 | |
---|
2757 | <xsl:if test="$xml2rfc-private='' and not($no-copylong)"> |
---|
2758 | <!-- copyright statements --> |
---|
2759 | <fo:bookmark internal-destination="{concat($anchor-pref,'ipr')}"> |
---|
2760 | <fo:bookmark-title>Intellectual Property and Copyright Statements</fo:bookmark-title> |
---|
2761 | </fo:bookmark> |
---|
2762 | </xsl:if> |
---|
2763 | |
---|
2764 | </xsl:template> |
---|
2765 | |
---|
2766 | <xsl:template match="front" mode="bookmarks"> |
---|
2767 | |
---|
2768 | <xsl:variable name="authors-number"> |
---|
2769 | <xsl:call-template name="get-authors-section-number"/> |
---|
2770 | </xsl:variable> |
---|
2771 | |
---|
2772 | <xsl:variable name="title"> |
---|
2773 | <xsl:if test="$authors-number!=''"> |
---|
2774 | <xsl:value-of select="$authors-number"/> |
---|
2775 | <xsl:text> </xsl:text> |
---|
2776 | </xsl:if> |
---|
2777 | <xsl:call-template name="get-authors-section-title"/> |
---|
2778 | </xsl:variable> |
---|
2779 | |
---|
2780 | <xsl:if test="$authors-number!='suppress' and $xml2rfc-authorship!='no'"> |
---|
2781 | <fo:bookmark internal-destination="{concat($anchor-pref,'authors')}"> |
---|
2782 | <fo:bookmark-title><xsl:value-of select="$title"/></fo:bookmark-title> |
---|
2783 | </fo:bookmark> |
---|
2784 | </xsl:if> |
---|
2785 | </xsl:template> |
---|
2786 | |
---|
2787 | <xsl:template match="middle" mode="bookmarks"> |
---|
2788 | <xsl:apply-templates mode="bookmarks" /> |
---|
2789 | </xsl:template> |
---|
2790 | |
---|
2791 | <xsl:template name="references-bookmarks"> |
---|
2792 | |
---|
2793 | <!-- distinguish two cases: (a) single references element (process |
---|
2794 | as toplevel section; (b) multiple references sections (add one toplevel |
---|
2795 | container with subsection) --> |
---|
2796 | |
---|
2797 | <xsl:choose> |
---|
2798 | <xsl:when test="count(/*/back/references) = 0"> |
---|
2799 | <!-- nothing to do --> |
---|
2800 | </xsl:when> |
---|
2801 | <xsl:when test="count(/*/back/references) = 1"> |
---|
2802 | <xsl:for-each select="/*/back/references"> |
---|
2803 | <xsl:call-template name="references-entry-bookmarks"/> |
---|
2804 | </xsl:for-each> |
---|
2805 | </xsl:when> |
---|
2806 | <xsl:otherwise> |
---|
2807 | <!-- insert pseudo container --> |
---|
2808 | <fo:bookmark internal-destination="{$anchor-pref}references"> |
---|
2809 | <fo:bookmark-title> |
---|
2810 | <xsl:call-template name="get-references-section-number"/> |
---|
2811 | <xsl:if test="$xml2rfc-ext-sec-no-trailing-dots='yes'">.</xsl:if> |
---|
2812 | <xsl:text> </xsl:text> |
---|
2813 | <xsl:value-of select="$xml2rfc-refparent"/> |
---|
2814 | </fo:bookmark-title> |
---|
2815 | |
---|
2816 | <!-- ...with subsections... --> |
---|
2817 | <xsl:for-each select="/*/back/references"> |
---|
2818 | <xsl:call-template name="references-entry-bookmarks"/> |
---|
2819 | </xsl:for-each> |
---|
2820 | </fo:bookmark> |
---|
2821 | |
---|
2822 | </xsl:otherwise> |
---|
2823 | </xsl:choose> |
---|
2824 | </xsl:template> |
---|
2825 | |
---|
2826 | <xsl:template name="references-entry-bookmarks"> |
---|
2827 | <xsl:variable name="title"> |
---|
2828 | <xsl:choose> |
---|
2829 | <xsl:when test="name"><xsl:apply-templates select="name/node()"/></xsl:when> |
---|
2830 | <xsl:when test="@title!=''"><xsl:value-of select="@title" /></xsl:when> |
---|
2831 | <xsl:otherwise><xsl:value-of select="$xml2rfc-refparent"/></xsl:otherwise> |
---|
2832 | </xsl:choose> |
---|
2833 | </xsl:variable> |
---|
2834 | |
---|
2835 | <xsl:variable name="sectionNumber"> |
---|
2836 | <xsl:call-template name="get-section-number" /> |
---|
2837 | <xsl:if test="$xml2rfc-ext-sec-no-trailing-dots='yes'">.</xsl:if> |
---|
2838 | </xsl:variable> |
---|
2839 | |
---|
2840 | <xsl:variable name="num"> |
---|
2841 | <xsl:number level="any"/> |
---|
2842 | </xsl:variable> |
---|
2843 | |
---|
2844 | <xsl:variable name="tnum"> |
---|
2845 | <xsl:choose> |
---|
2846 | <xsl:when test="$num=1"/> |
---|
2847 | <xsl:otherwise>.<xsl:value-of select="$num"/></xsl:otherwise> |
---|
2848 | </xsl:choose> |
---|
2849 | </xsl:variable> |
---|
2850 | |
---|
2851 | <fo:bookmark internal-destination="{$anchor-pref}references{$tnum}"> |
---|
2852 | <fo:bookmark-title><xsl:value-of select="concat($sectionNumber,' ',normalize-space($title))"/></fo:bookmark-title> |
---|
2853 | |
---|
2854 | <xsl:for-each select="references"> |
---|
2855 | <xsl:call-template name="references-entry-bookmarks"/> |
---|
2856 | </xsl:for-each> |
---|
2857 | </fo:bookmark> |
---|
2858 | </xsl:template> |
---|
2859 | |
---|
2860 | <xsl:template match="rfc" mode="bookmarks"> |
---|
2861 | <xsl:if test="$xml2rfc-private='' and not($abstract-first)"> |
---|
2862 | <xsl:call-template name="emit-ietf-preamble-bookmarks"/> |
---|
2863 | </xsl:if> |
---|
2864 | |
---|
2865 | <xsl:apply-templates select="front/abstract" mode="bookmarks"/> |
---|
2866 | <xsl:apply-templates select="front/note[@title!='IESG Note' or $xml2rfc-private!='']" mode="bookmarks"/> |
---|
2867 | |
---|
2868 | <xsl:if test="$xml2rfc-private='' and $abstract-first"> |
---|
2869 | <xsl:call-template name="emit-ietf-preamble-bookmarks"/> |
---|
2870 | </xsl:if> |
---|
2871 | |
---|
2872 | <xsl:if test="$xml2rfc-toc='yes'"> |
---|
2873 | <fo:bookmark internal-destination="{concat($anchor-pref,'toc')}"> |
---|
2874 | <fo:bookmark-title>Table of Contents</fo:bookmark-title> |
---|
2875 | </fo:bookmark> |
---|
2876 | </xsl:if> |
---|
2877 | |
---|
2878 | <xsl:apply-templates select="middle|back" mode="bookmarks"/> |
---|
2879 | </xsl:template> |
---|
2880 | |
---|
2881 | <xsl:template name="emit-ietf-preamble-bookmarks"> |
---|
2882 | <!-- Get status info formatted as per RFC2629--> |
---|
2883 | <xsl:variable name="preamble"> |
---|
2884 | <xsl:for-each select="/rfc"> |
---|
2885 | <xsl:call-template name="insertPreamble" /> |
---|
2886 | </xsl:for-each> |
---|
2887 | </xsl:variable> |
---|
2888 | |
---|
2889 | <!-- emit it --> |
---|
2890 | <xsl:choose> |
---|
2891 | <xsl:when test="function-available('exslt:node-set')"> |
---|
2892 | <xsl:apply-templates select="exslt:node-set($preamble)/node()" mode="bookmarks"/> |
---|
2893 | </xsl:when> |
---|
2894 | <xsl:otherwise> |
---|
2895 | <xsl:variable name="temp" select="$preamble"/> |
---|
2896 | <xsl:apply-templates select="$temp/node()" mode="bookmarks"/> |
---|
2897 | </xsl:otherwise> |
---|
2898 | </xsl:choose> |
---|
2899 | </xsl:template> |
---|
2900 | |
---|
2901 | <!-- experimental table formatting --> |
---|
2902 | |
---|
2903 | <xsl:template name="sum-widths"> |
---|
2904 | <xsl:param name="list"/> |
---|
2905 | <xsl:choose> |
---|
2906 | <xsl:when test="count($list)=0"> |
---|
2907 | <xsl:value-of select="0"/> |
---|
2908 | </xsl:when> |
---|
2909 | <xsl:when test="count($list)=1"> |
---|
2910 | <xsl:value-of select="number(substring-before($list[1],'%'))"/> |
---|
2911 | </xsl:when> |
---|
2912 | <xsl:otherwise> |
---|
2913 | <xsl:variable name="remainder"> |
---|
2914 | <xsl:call-template name="sum-widths"> |
---|
2915 | <xsl:with-param name="list" select="$list[position()>1]" /> |
---|
2916 | </xsl:call-template> |
---|
2917 | </xsl:variable> |
---|
2918 | <xsl:value-of select="$remainder + number(substring-before($list[1],'%'))" /> |
---|
2919 | </xsl:otherwise> |
---|
2920 | </xsl:choose> |
---|
2921 | </xsl:template> |
---|
2922 | |
---|
2923 | <!-- |
---|
2924 | <xsl:attribute-set name="all-borders-solid"> |
---|
2925 | <xsl:attribute name="border-left-style">solid</xsl:attribute> |
---|
2926 | <xsl:attribute name="border-right-style">solid</xsl:attribute> |
---|
2927 | <xsl:attribute name="border-top-style">solid</xsl:attribute> |
---|
2928 | <xsl:attribute name="border-bottom-style">solid</xsl:attribute> |
---|
2929 | <xsl:attribute name="border-left-width">thin</xsl:attribute> |
---|
2930 | <xsl:attribute name="border-right-width">thin</xsl:attribute> |
---|
2931 | <xsl:attribute name="border-top-width">thin</xsl:attribute> |
---|
2932 | <xsl:attribute name="border-bottom-width">thin</xsl:attribute> |
---|
2933 | <xsl:attribute name="padding-left">0.5em</xsl:attribute> |
---|
2934 | <xsl:attribute name="padding-right">0.5em</xsl:attribute> |
---|
2935 | </xsl:attribute-set> |
---|
2936 | |
---|
2937 | --> |
---|
2938 | |
---|
2939 | <!--TODO --> |
---|
2940 | <xsl:template match="table"> |
---|
2941 | <fo:block space-before=".5em" space-after=".5em" start-indent="2em"> |
---|
2942 | <xsl:apply-templates select="iref"/> |
---|
2943 | <xsl:call-template name="copy-anchor"/> |
---|
2944 | <fo:table> |
---|
2945 | <!-- FOP doesn't have table-and-caption--> |
---|
2946 | <xsl:apply-templates select="thead"/> |
---|
2947 | <xsl:apply-templates select="tfoot"/> |
---|
2948 | <xsl:apply-templates select="tbody"/> |
---|
2949 | </fo:table> |
---|
2950 | <xsl:variable name="n"><xsl:call-template name="get-table-number"/></xsl:variable> |
---|
2951 | <fo:block text-align="center" space-before="1em" space-after="1em"> |
---|
2952 | <xsl:text>Table </xsl:text> |
---|
2953 | <xsl:value-of select="$n"/> |
---|
2954 | <xsl:if test="name"> |
---|
2955 | <xsl:text>: </xsl:text> |
---|
2956 | <xsl:apply-templates select="name/node()"/> |
---|
2957 | </xsl:if> |
---|
2958 | </fo:block> |
---|
2959 | </fo:block> |
---|
2960 | </xsl:template> |
---|
2961 | <xsl:template match="table/name"/> |
---|
2962 | |
---|
2963 | <xsl:template match="tbody"> |
---|
2964 | <fo:table-body> |
---|
2965 | <xsl:call-template name="copy-anchor"/> |
---|
2966 | <xsl:apply-templates/> |
---|
2967 | </fo:table-body> |
---|
2968 | </xsl:template> |
---|
2969 | |
---|
2970 | <xsl:template match="td"> |
---|
2971 | <fo:table-cell> |
---|
2972 | <xsl:call-template name="copy-anchor"/> |
---|
2973 | <xsl:choose> |
---|
2974 | <xsl:when test="@align"> |
---|
2975 | <xsl:attribute name="text-align"><xsl:value-of select="@align" /></xsl:attribute> |
---|
2976 | </xsl:when> |
---|
2977 | <xsl:otherwise> |
---|
2978 | <xsl:attribute name="text-align">left</xsl:attribute> |
---|
2979 | </xsl:otherwise> |
---|
2980 | </xsl:choose> |
---|
2981 | <xsl:if test="@colspan"> |
---|
2982 | <xsl:attribute name="number-columns-spanned"><xsl:value-of select="@colspan" /></xsl:attribute> |
---|
2983 | </xsl:if> |
---|
2984 | <xsl:if test="@rowspan"> |
---|
2985 | <xsl:attribute name="number-rows-spanned"><xsl:value-of select="@rowspan" /></xsl:attribute> |
---|
2986 | </xsl:if> |
---|
2987 | <fo:block> |
---|
2988 | <xsl:apply-templates/> |
---|
2989 | </fo:block> |
---|
2990 | </fo:table-cell> |
---|
2991 | </xsl:template> |
---|
2992 | |
---|
2993 | <xsl:template match="th"> |
---|
2994 | <fo:table-cell> |
---|
2995 | <xsl:call-template name="copy-anchor"/> |
---|
2996 | <xsl:choose> |
---|
2997 | <xsl:when test="@align"> |
---|
2998 | <xsl:attribute name="text-align"><xsl:value-of select="@align" /></xsl:attribute> |
---|
2999 | </xsl:when> |
---|
3000 | <xsl:otherwise> |
---|
3001 | <xsl:attribute name="text-align">left</xsl:attribute> |
---|
3002 | </xsl:otherwise> |
---|
3003 | </xsl:choose> |
---|
3004 | <xsl:if test="@colspan"> |
---|
3005 | <xsl:attribute name="number-columns-spanned"><xsl:value-of select="@colspan" /></xsl:attribute> |
---|
3006 | </xsl:if> |
---|
3007 | <xsl:if test="@rowspan"> |
---|
3008 | <xsl:attribute name="number-rows-spanned"><xsl:value-of select="@rowspan" /></xsl:attribute> |
---|
3009 | </xsl:if> |
---|
3010 | <fo:block font-weight="bold"> |
---|
3011 | <xsl:apply-templates/> |
---|
3012 | </fo:block> |
---|
3013 | </fo:table-cell> |
---|
3014 | </xsl:template> |
---|
3015 | |
---|
3016 | <xsl:template match="tfoot"> |
---|
3017 | <fo:table-footer> |
---|
3018 | <xsl:call-template name="copy-anchor"/> |
---|
3019 | <xsl:apply-templates/> |
---|
3020 | </fo:table-footer> |
---|
3021 | </xsl:template> |
---|
3022 | |
---|
3023 | <xsl:template match="thead"> |
---|
3024 | <fo:table-header> |
---|
3025 | <xsl:call-template name="copy-anchor"/> |
---|
3026 | <xsl:apply-templates/> |
---|
3027 | </fo:table-header> |
---|
3028 | </xsl:template> |
---|
3029 | |
---|
3030 | <xsl:template match="tr"> |
---|
3031 | <fo:table-row> |
---|
3032 | <xsl:call-template name="copy-anchor"/> |
---|
3033 | <xsl:apply-templates/> |
---|
3034 | </fo:table-row> |
---|
3035 | </xsl:template> |
---|
3036 | |
---|
3037 | |
---|
3038 | <xsl:template match="texttable"> |
---|
3039 | |
---|
3040 | <xsl:variable name="style"> |
---|
3041 | <xsl:choose> |
---|
3042 | <xsl:when test="@style!=''"> |
---|
3043 | <xsl:value-of select="@style"/> |
---|
3044 | </xsl:when> |
---|
3045 | <xsl:otherwise>full</xsl:otherwise> |
---|
3046 | </xsl:choose> |
---|
3047 | </xsl:variable> |
---|
3048 | |
---|
3049 | <xsl:variable name="anch"> |
---|
3050 | <xsl:call-template name="get-table-anchor"/> |
---|
3051 | </xsl:variable> |
---|
3052 | |
---|
3053 | <fo:block space-before=".5em" space-after=".5em" start-indent="2em" id="{$anch}"> |
---|
3054 | <xsl:call-template name="add-anchor"/> |
---|
3055 | <xsl:if test="@x:caption-side='top'"> |
---|
3056 | <xsl:call-template name="insert-table-caption"/> |
---|
3057 | </xsl:if> |
---|
3058 | <xsl:apply-templates select="preamble" /> |
---|
3059 | <fo:table> |
---|
3060 | <xsl:variable name="total-specified"> |
---|
3061 | <xsl:call-template name="sum-widths"> |
---|
3062 | <xsl:with-param name="list" select="ttcol/@width" /> |
---|
3063 | </xsl:call-template> |
---|
3064 | </xsl:variable> |
---|
3065 | <xsl:for-each select="ttcol"> |
---|
3066 | <fo:table-column> |
---|
3067 | <xsl:choose> |
---|
3068 | <xsl:when test="@width"> |
---|
3069 | <xsl:attribute name="column-width">proportional-column-width(<xsl:value-of select="substring-before(@width,'%')" />)</xsl:attribute> |
---|
3070 | </xsl:when> |
---|
3071 | <xsl:otherwise> |
---|
3072 | <xsl:attribute name="column-width">proportional-column-width(<xsl:value-of select="(100 - number($total-specified)) div count(../ttcol[not(@width)])" />)</xsl:attribute> |
---|
3073 | </xsl:otherwise> |
---|
3074 | </xsl:choose> |
---|
3075 | </fo:table-column> |
---|
3076 | </xsl:for-each> |
---|
3077 | <xsl:if test="ttcol!=''"> |
---|
3078 | <!-- skip header when all column titles are empty --> |
---|
3079 | <fo:table-header start-indent="0em" space-after=".5em"> |
---|
3080 | <fo:table-row> |
---|
3081 | <xsl:apply-templates select="ttcol" /> |
---|
3082 | </fo:table-row> |
---|
3083 | </fo:table-header> |
---|
3084 | </xsl:if> |
---|
3085 | <fo:table-body start-indent="0em"> |
---|
3086 | <xsl:if test="$style='all' or $style='full'"> |
---|
3087 | <xsl:attribute name="border-left-style">solid</xsl:attribute> |
---|
3088 | <xsl:attribute name="border-right-style">solid</xsl:attribute> |
---|
3089 | <xsl:attribute name="border-top-style">solid</xsl:attribute> |
---|
3090 | <xsl:attribute name="border-bottom-style">solid</xsl:attribute> |
---|
3091 | <xsl:attribute name="border-left-width">thin</xsl:attribute> |
---|
3092 | <xsl:attribute name="border-right-width">thin</xsl:attribute> |
---|
3093 | <xsl:attribute name="border-top-width">thin</xsl:attribute> |
---|
3094 | <xsl:attribute name="border-bottom-width">thin</xsl:attribute> |
---|
3095 | </xsl:if> |
---|
3096 | <xsl:variable name="columns" select="count(ttcol)" /> |
---|
3097 | <xsl:choose> |
---|
3098 | <xsl:when test="not(c)"> |
---|
3099 | <!-- special case: empty body --> |
---|
3100 | <fo:table-cell><fo:block/></fo:table-cell> |
---|
3101 | </xsl:when> |
---|
3102 | <xsl:otherwise> |
---|
3103 | <xsl:for-each select="c[$columns=1 or (position() mod $columns) = 1]"> |
---|
3104 | <fo:table-row> |
---|
3105 | <xsl:for-each select=". | following-sibling::c[position() < $columns]"> |
---|
3106 | <fo:table-cell padding-left="0.5em" padding-right="0.5em"> |
---|
3107 | <xsl:if test="$style='all' or $style='full'"> |
---|
3108 | <xsl:attribute name="border-left-style">solid</xsl:attribute> |
---|
3109 | <xsl:attribute name="border-right-style">solid</xsl:attribute> |
---|
3110 | <xsl:attribute name="border-left-width">thin</xsl:attribute> |
---|
3111 | <xsl:attribute name="border-right-width">thin</xsl:attribute> |
---|
3112 | </xsl:if> |
---|
3113 | <xsl:if test="$style='all'"> |
---|
3114 | <xsl:attribute name="border-top-style">solid</xsl:attribute> |
---|
3115 | <xsl:attribute name="border-bottom-style">solid</xsl:attribute> |
---|
3116 | <xsl:attribute name="border-top-width">thin</xsl:attribute> |
---|
3117 | <xsl:attribute name="border-bottom-width">thin</xsl:attribute> |
---|
3118 | </xsl:if> |
---|
3119 | <fo:block> |
---|
3120 | <xsl:variable name="pos" select="position()" /> |
---|
3121 | <xsl:variable name="col" select="../ttcol[position() = $pos]" /> |
---|
3122 | <xsl:if test="$col/@align"> |
---|
3123 | <xsl:attribute name="text-align"><xsl:value-of select="$col/@align" /></xsl:attribute> |
---|
3124 | </xsl:if> |
---|
3125 | <xsl:apply-templates select="node()" /> |
---|
3126 | </fo:block> |
---|
3127 | </fo:table-cell> |
---|
3128 | </xsl:for-each> |
---|
3129 | </fo:table-row> |
---|
3130 | </xsl:for-each> |
---|
3131 | </xsl:otherwise> |
---|
3132 | </xsl:choose> |
---|
3133 | </fo:table-body> |
---|
3134 | </fo:table> |
---|
3135 | <xsl:apply-templates select="postamble" /> |
---|
3136 | <xsl:if test="not(@x:caption-side) or @x:caption-side!='top'"> |
---|
3137 | <xsl:call-template name="insert-table-caption"/> |
---|
3138 | </xsl:if> |
---|
3139 | </fo:block> |
---|
3140 | </xsl:template> |
---|
3141 | |
---|
3142 | <xsl:template name="insert-table-caption"> |
---|
3143 | <xsl:if test="(@title!='') or (@anchor!='' and not(@suppress-title='true'))"> |
---|
3144 | <xsl:variable name="n"><xsl:call-template name="get-table-number"/></xsl:variable> |
---|
3145 | <fo:block text-align="center" space-before="1em" space-after="1em"> |
---|
3146 | <xsl:if test="not(starts-with($n,'u'))"> |
---|
3147 | <xsl:text>Table </xsl:text> |
---|
3148 | <xsl:value-of select="$n"/> |
---|
3149 | <xsl:if test="@title!=''">: </xsl:if> |
---|
3150 | </xsl:if> |
---|
3151 | <xsl:if test="@title!=''"> |
---|
3152 | <xsl:value-of select="@title" /> |
---|
3153 | </xsl:if> |
---|
3154 | </fo:block> |
---|
3155 | </xsl:if> |
---|
3156 | </xsl:template> |
---|
3157 | |
---|
3158 | <xsl:template match="ttcol"> |
---|
3159 | <xsl:variable name="style"> |
---|
3160 | <xsl:choose> |
---|
3161 | <xsl:when test="../@style!=''"> |
---|
3162 | <xsl:value-of select="../@style"/> |
---|
3163 | </xsl:when> |
---|
3164 | <xsl:otherwise>full</xsl:otherwise> |
---|
3165 | </xsl:choose> |
---|
3166 | </xsl:variable> |
---|
3167 | |
---|
3168 | <fo:table-cell padding-left="0.5em" padding-right="0.5em"> |
---|
3169 | <xsl:if test="$style='all' or $style='full' or $style='headers'"> |
---|
3170 | <xsl:attribute name="border-bottom-style">solid</xsl:attribute> |
---|
3171 | <xsl:attribute name="border-bottom-width">thin</xsl:attribute> |
---|
3172 | </xsl:if> |
---|
3173 | <xsl:if test="$style='all' or $style='full'"> |
---|
3174 | <xsl:attribute name="border-left-style">solid</xsl:attribute> |
---|
3175 | <xsl:attribute name="border-right-style">solid</xsl:attribute> |
---|
3176 | <xsl:attribute name="border-top-style">solid</xsl:attribute> |
---|
3177 | <xsl:attribute name="border-left-width">thin</xsl:attribute> |
---|
3178 | <xsl:attribute name="border-right-width">thin</xsl:attribute> |
---|
3179 | <xsl:attribute name="border-top-width">thin</xsl:attribute> |
---|
3180 | </xsl:if> |
---|
3181 | <!-- <xsl:if test="@width"> |
---|
3182 | <xsl:attribute name="width"><xsl:value-of select="@width" /></xsl:attribute> |
---|
3183 | </xsl:if> --> |
---|
3184 | <xsl:choose> |
---|
3185 | <xsl:when test="@align"> |
---|
3186 | <xsl:attribute name="text-align"><xsl:value-of select="@align" /></xsl:attribute> |
---|
3187 | </xsl:when> |
---|
3188 | <xsl:otherwise> |
---|
3189 | <xsl:attribute name="text-align">left</xsl:attribute> |
---|
3190 | </xsl:otherwise> |
---|
3191 | </xsl:choose> |
---|
3192 | <fo:block font-weight="bold"> |
---|
3193 | <xsl:apply-templates /> |
---|
3194 | </fo:block> |
---|
3195 | </fo:table-cell> |
---|
3196 | </xsl:template> |
---|
3197 | |
---|
3198 | <xsl:template name="add-anchor"> |
---|
3199 | <xsl:if test="@anchor"> |
---|
3200 | <fo:block id="{@anchor}" /> |
---|
3201 | </xsl:if> |
---|
3202 | </xsl:template> |
---|
3203 | |
---|
3204 | <!-- cref support --> |
---|
3205 | |
---|
3206 | <xsl:template match="cref[@display='false']"> |
---|
3207 | <!-- hidden --> |
---|
3208 | </xsl:template> |
---|
3209 | |
---|
3210 | <xsl:template match="cref[not(@display) or @display!='false']"> |
---|
3211 | <xsl:if test="$xml2rfc-comments!='no'"> |
---|
3212 | <xsl:variable name="cid"> |
---|
3213 | <xsl:call-template name="get-comment-name"/> |
---|
3214 | </xsl:variable> |
---|
3215 | |
---|
3216 | <xsl:choose> |
---|
3217 | <xsl:when test="$xml2rfc-inline!='yes'"> |
---|
3218 | <fo:footnote> |
---|
3219 | <fo:inline> |
---|
3220 | <fo:basic-link font-size="8pt" vertical-align="super" internal-destination="{$cid}">[<xsl:value-of select="$cid"/>]</fo:basic-link> |
---|
3221 | </fo:inline> |
---|
3222 | <fo:footnote-body> |
---|
3223 | <fo:block font-size="10pt" start-indent="2em" text-align="left" id="{$cid}"> |
---|
3224 | <fo:inline font-size="8pt" vertical-align="super">[<xsl:value-of select="$cid"/>]</fo:inline> |
---|
3225 | <xsl:text> </xsl:text> |
---|
3226 | <xsl:apply-templates select="node()"/> |
---|
3227 | <xsl:if test="@source"> --<xsl:value-of select="@source"/></xsl:if> |
---|
3228 | </fo:block> |
---|
3229 | </fo:footnote-body> |
---|
3230 | </fo:footnote> |
---|
3231 | </xsl:when> |
---|
3232 | <xsl:otherwise> |
---|
3233 | <fo:inline xsl:use-attribute-sets="comment" id="{$cid}"> |
---|
3234 | <xsl:text>[</xsl:text> |
---|
3235 | <xsl:if test="@anchor or (not(/rfc/@version) or /rfc/@version < 3)"> |
---|
3236 | <xsl:value-of select="$cid"/> |
---|
3237 | <xsl:text>: </xsl:text> |
---|
3238 | </xsl:if> |
---|
3239 | <xsl:apply-templates select="node()"/> |
---|
3240 | <xsl:if test="@source"> --<xsl:value-of select="@source"/></xsl:if> |
---|
3241 | <xsl:text>]</xsl:text> |
---|
3242 | </fo:inline> |
---|
3243 | </xsl:otherwise> |
---|
3244 | </xsl:choose> |
---|
3245 | </xsl:if> |
---|
3246 | </xsl:template> |
---|
3247 | |
---|
3248 | |
---|
3249 | |
---|
3250 | <xsl:template name="insert-justification"> |
---|
3251 | <xsl:if test="$xml2rfc-ext-justification='always' or $xml2rfc-ext-justification='print'"> |
---|
3252 | <xsl:attribute name="text-align">justify</xsl:attribute> |
---|
3253 | </xsl:if> |
---|
3254 | </xsl:template> |
---|
3255 | |
---|
3256 | <!-- Extensions --> |
---|
3257 | |
---|
3258 | <!-- Nothing to do for PDF output --> |
---|
3259 | <xsl:template match="x:assign-section-number" /> |
---|
3260 | <xsl:template match="x:link|link" /> |
---|
3261 | |
---|
3262 | <!-- Nothing to do here --> |
---|
3263 | <xsl:template match="x:anchor-alias" /> |
---|
3264 | |
---|
3265 | <!-- internal ref support --> |
---|
3266 | <xsl:key name="anchor-item-alias" match="//*[@anchor and (x:anchor-alias/@value or ed:replace/ed:ins/x:anchor-alias)]" use="x:anchor-alias/@value | ed:replace/ed:ins/x:anchor-alias/@value"/> |
---|
3267 | |
---|
3268 | <xsl:template match="x:ref"> |
---|
3269 | <xsl:variable name="val" select="normalize-space(.)"/> |
---|
3270 | <xsl:variable name="target" select="key('anchor-item',$val) | key('anchor-item-alias',$val) | //reference/x:source[x:defines=$val]"/> |
---|
3271 | <xsl:variable name="irefs" select="//iref[@x:for-anchor=$val]"/> |
---|
3272 | <xsl:if test="count($target)>1"> |
---|
3273 | <xsl:call-template name="warning"> |
---|
3274 | <xsl:with-param name="msg">internal link target for '<xsl:value-of select="."/>' is ambiguous; picking first.</xsl:with-param> |
---|
3275 | </xsl:call-template> |
---|
3276 | </xsl:if> |
---|
3277 | <xsl:choose> |
---|
3278 | <xsl:when test="$target[1]/@anchor"> |
---|
3279 | <fo:basic-link internal-destination="{$target[1]/@anchor}" xsl:use-attribute-sets="internal-link"> |
---|
3280 | <xsl:call-template name="copy-anchor"/> |
---|
3281 | <xsl:apply-templates/> |
---|
3282 | </fo:basic-link> |
---|
3283 | </xsl:when> |
---|
3284 | <xsl:otherwise> |
---|
3285 | <fo:inline> |
---|
3286 | <xsl:call-template name="copy-anchor"/> |
---|
3287 | <xsl:apply-templates/> |
---|
3288 | </fo:inline> |
---|
3289 | </xsl:otherwise> |
---|
3290 | </xsl:choose> |
---|
3291 | </xsl:template> |
---|
3292 | |
---|
3293 | <!-- Unicode --> |
---|
3294 | <xsl:template match="x:u-map"/> |
---|
3295 | <xsl:template match="u"> |
---|
3296 | <xsl:call-template name="emit-u"/> |
---|
3297 | </xsl:template> |
---|
3298 | |
---|
3299 | <!-- BCP14 keywords --> |
---|
3300 | <xsl:template match="x:bcp14|bcp14"> |
---|
3301 | <!-- TODO: figure out something that prints well --> |
---|
3302 | <xsl:apply-templates/> |
---|
3303 | </xsl:template> |
---|
3304 | |
---|
3305 | <!-- Notes --> |
---|
3306 | <xsl:template match="x:note|aside"> |
---|
3307 | <xsl:apply-templates/> |
---|
3308 | </xsl:template> |
---|
3309 | |
---|
3310 | <!-- Quotes --> |
---|
3311 | <xsl:template match="x:blockquote|blockquote"> |
---|
3312 | <fo:block font-style="italic" space-before=".5em" space-after=".5em" start-indent="3em" |
---|
3313 | border-left-style="solid" border-left-color="gray" border-left-width=".25em" padding-left=".5em"> |
---|
3314 | <xsl:apply-templates/> |
---|
3315 | <xsl:if test="@quotedFrom"> |
---|
3316 | <fo:block> |
---|
3317 | <xsl:text>— </xsl:text> |
---|
3318 | <xsl:choose> |
---|
3319 | <xsl:when test="@cite"><fo:basic-link external-destination="url(@cite)" xsl:use-attribute-sets="external-link"><xsl:value-of select="@quotedFrom"/></fo:basic-link></xsl:when> |
---|
3320 | <xsl:otherwise><xsl:value-of select="@quotedFrom"/></xsl:otherwise> |
---|
3321 | </xsl:choose> |
---|
3322 | </fo:block> |
---|
3323 | </xsl:if> |
---|
3324 | </fo:block> |
---|
3325 | </xsl:template> |
---|
3326 | |
---|
3327 | <xsl:template match="x:q"> |
---|
3328 | <fo:wrapper font-style="italic"> |
---|
3329 | <xsl:text>“</xsl:text> |
---|
3330 | <xsl:apply-templates/> |
---|
3331 | <xsl:text>”</xsl:text> |
---|
3332 | </fo:wrapper> |
---|
3333 | </xsl:template> |
---|
3334 | |
---|
3335 | <!-- Definitions --> |
---|
3336 | <xsl:template match="x:dfn"> |
---|
3337 | <fo:wrapper font-style="italic"> |
---|
3338 | <xsl:if test="not(preceding-sibling::x:dfn) and count(following-sibling::list)=1"> |
---|
3339 | <xsl:attribute name="keep-with-next">always</xsl:attribute> |
---|
3340 | </xsl:if> |
---|
3341 | <xsl:apply-templates/> |
---|
3342 | </fo:wrapper> |
---|
3343 | </xsl:template> |
---|
3344 | |
---|
3345 | <!-- Headings --> |
---|
3346 | <xsl:template match="x:h"> |
---|
3347 | <fo:wrapper font-weight="bold"> |
---|
3348 | <xsl:apply-templates/> |
---|
3349 | </fo:wrapper> |
---|
3350 | </xsl:template> |
---|
3351 | |
---|
3352 | <!-- Highlightinghing --> |
---|
3353 | <xsl:template match="x:highlight"> |
---|
3354 | <fo:wrapper font-weight="bold"> |
---|
3355 | <xsl:apply-templates/> |
---|
3356 | </fo:wrapper> |
---|
3357 | </xsl:template> |
---|
3358 | |
---|
3359 | <!-- Superscripts --> |
---|
3360 | <xsl:template match="x:sup|sup"> |
---|
3361 | <fo:inline font-size="6pt" vertical-align="super"> |
---|
3362 | <xsl:apply-templates/> |
---|
3363 | </fo:inline> |
---|
3364 | </xsl:template> |
---|
3365 | |
---|
3366 | <!-- Superscripts --> |
---|
3367 | <xsl:template match="sub"> |
---|
3368 | <fo:inline font-size="6pt" vertical-align="sub"> |
---|
3369 | <xsl:apply-templates/> |
---|
3370 | </fo:inline> |
---|
3371 | </xsl:template> |
---|
3372 | |
---|
3373 | <!-- measuring lengths --> |
---|
3374 | <xsl:template match="x:length-of"> |
---|
3375 | <xsl:variable name="target" select="//*[@anchor=current()/@target]"/> |
---|
3376 | <xsl:if test="count($target)!=1"> |
---|
3377 | <xsl:call-template name="error"> |
---|
3378 | <xsl:with-param name="msg" select="concat('@target ',@target,' defined ',count($target),' times.')"/> |
---|
3379 | </xsl:call-template> |
---|
3380 | </xsl:if> |
---|
3381 | <xsl:variable name="content"> |
---|
3382 | <xsl:apply-templates select="$target"/> |
---|
3383 | </xsl:variable> |
---|
3384 | <xsl:variable name="lineends" select="string-length($content) - string-length(translate($content,' ',''))"/> |
---|
3385 | <xsl:variable name="indents"> |
---|
3386 | <xsl:choose> |
---|
3387 | <xsl:when test="@indented"> |
---|
3388 | <xsl:value-of select="number(@indented) * $lineends"/> |
---|
3389 | </xsl:when> |
---|
3390 | <xsl:otherwise>0</xsl:otherwise> |
---|
3391 | </xsl:choose> |
---|
3392 | </xsl:variable> |
---|
3393 | <xsl:value-of select="string-length($content) + $lineends - $indents"/> |
---|
3394 | </xsl:template> |
---|
3395 | |
---|
3396 | <!-- Nop --> |
---|
3397 | <xsl:template match="x:span"> |
---|
3398 | <xsl:apply-templates/> |
---|
3399 | </xsl:template> |
---|
3400 | |
---|
3401 | <!-- XML checking --> |
---|
3402 | <xsl:template match="x:parse-xml"> |
---|
3403 | <xsl:apply-templates/> |
---|
3404 | </xsl:template> |
---|
3405 | |
---|
3406 | <xsl:template match="x:abnf-char-sequence"> |
---|
3407 | <xsl:choose> |
---|
3408 | <xsl:when test="substring(.,1,1) != '"' or substring(.,string-length(.),1) != '"'"> |
---|
3409 | <xsl:call-template name="error"> |
---|
3410 | <xsl:with-param name="msg" select="'contents of x:abnf-char-sequence needs to be quoted.'" /> |
---|
3411 | </xsl:call-template> |
---|
3412 | </xsl:when> |
---|
3413 | <xsl:otherwise> |
---|
3414 | <xsl:text>%x</xsl:text> |
---|
3415 | <xsl:call-template name="to-abnf-char-sequence"> |
---|
3416 | <xsl:with-param name="chars" select="substring(.,2,string-length(.)-2)"/> |
---|
3417 | </xsl:call-template> |
---|
3418 | </xsl:otherwise> |
---|
3419 | </xsl:choose> |
---|
3420 | </xsl:template> |
---|
3421 | |
---|
3422 | <!-- inlined RDF support --> |
---|
3423 | <xsl:template match="rdf:Description"> |
---|
3424 | <!-- ignore --> |
---|
3425 | </xsl:template> |
---|
3426 | |
---|
3427 | <!-- box drawing --> |
---|
3428 | |
---|
3429 | <!-- nop for alignment --> |
---|
3430 | <xsl:template match="x:x"/> |
---|
3431 | |
---|
3432 | <!-- box --> |
---|
3433 | <xsl:template match="x:bt|x:bc|x:bb"> |
---|
3434 | <xsl:apply-templates /> |
---|
3435 | </xsl:template> |
---|
3436 | |
---|
3437 | <!-- author handling extensions --> |
---|
3438 | <xsl:template match="x:include-author"> |
---|
3439 | <xsl:for-each select="/*/front/author[@anchor=current()/@target]"> |
---|
3440 | <xsl:apply-templates select="."/> |
---|
3441 | </xsl:for-each> |
---|
3442 | </xsl:template> |
---|
3443 | |
---|
3444 | <!-- boilerplate --> |
---|
3445 | <xsl:template match="boilerplate"> |
---|
3446 | <xsl:apply-templates/> |
---|
3447 | </xsl:template> |
---|
3448 | |
---|
3449 | <!-- experimental: format URI with zero-width spaces to ease line breaks --> |
---|
3450 | |
---|
3451 | <xsl:template name="format-uri"> |
---|
3452 | <xsl:param name="s"/> |
---|
3453 | <xsl:param name="mode"/> |
---|
3454 | |
---|
3455 | <xsl:choose> |
---|
3456 | <!-- optimization for not hypenating the scheme name --> |
---|
3457 | <xsl:when test="$mode!='after-scheme' and string-length(substring-before($s,':')) > 2"> |
---|
3458 | <xsl:value-of select="concat(substring-before($s,':'),':​')"/> |
---|
3459 | <xsl:call-template name="format-uri"> |
---|
3460 | <xsl:with-param name="s" select="substring-after($s,':')"/> |
---|
3461 | <xsl:with-param name="mode" select="'after-scheme'"/> |
---|
3462 | </xsl:call-template> |
---|
3463 | </xsl:when> |
---|
3464 | <!-- do no insert break points after hyphens --> |
---|
3465 | <xsl:when test="starts-with($s,'-')"> |
---|
3466 | <xsl:text>-</xsl:text> |
---|
3467 | <xsl:call-template name="format-uri"> |
---|
3468 | <xsl:with-param name="s" select="substring($s,2)"/> |
---|
3469 | <xsl:with-param name="mode" select="'after-scheme'"/> |
---|
3470 | </xsl:call-template> |
---|
3471 | </xsl:when> |
---|
3472 | <!-- last char?--> |
---|
3473 | <xsl:when test="string-length($s)=1"> |
---|
3474 | <xsl:value-of select="$s"/> |
---|
3475 | </xsl:when> |
---|
3476 | <!-- add one zwsp after each character --> |
---|
3477 | <xsl:when test="$s!=''"> |
---|
3478 | <xsl:value-of select="concat(substring($s,1,1),'​')"/> |
---|
3479 | <xsl:call-template name="format-uri"> |
---|
3480 | <xsl:with-param name="s" select="substring($s,2)"/> |
---|
3481 | <xsl:with-param name="mode" select="'after-scheme'"/> |
---|
3482 | </xsl:call-template> |
---|
3483 | </xsl:when> |
---|
3484 | <xsl:otherwise> |
---|
3485 | <!-- done --> |
---|
3486 | </xsl:otherwise> |
---|
3487 | </xsl:choose> |
---|
3488 | |
---|
3489 | </xsl:template> |
---|
3490 | |
---|
3491 | <xsl:template name="emit-message-inline"> |
---|
3492 | <xsl:param name="message"/> |
---|
3493 | <xsl:param name="node" select="."/> |
---|
3494 | <xsl:for-each select="$node"> |
---|
3495 | <xsl:choose> |
---|
3496 | <xsl:when test="ancestor::t"> |
---|
3497 | <fo:inline color="red"><xsl:value-of select="$message"/></fo:inline> |
---|
3498 | </xsl:when> |
---|
3499 | <xsl:otherwise> |
---|
3500 | <fo:block color="red"><xsl:value-of select="$message"/></fo:block> |
---|
3501 | </xsl:otherwise> |
---|
3502 | </xsl:choose> |
---|
3503 | </xsl:for-each> |
---|
3504 | </xsl:template> |
---|
3505 | |
---|
3506 | <!-- clean up links from HTML --> |
---|
3507 | <xsl:template match="node()|@*" mode="strip-links"> |
---|
3508 | <xsl:copy> |
---|
3509 | <xsl:apply-templates select="node()|@*" mode="strip-links" /> |
---|
3510 | </xsl:copy> |
---|
3511 | </xsl:template> |
---|
3512 | <xsl:template match="fo:basic-link" mode="strip-links"> |
---|
3513 | <xsl:apply-templates select="node()" mode="strip-links" /> |
---|
3514 | </xsl:template> |
---|
3515 | |
---|
3516 | <xsl:template match="fo:block" mode="strip-ids-and-linebreaks"> |
---|
3517 | <xsl:text> </xsl:text> |
---|
3518 | </xsl:template> |
---|
3519 | |
---|
3520 | <xsl:template match="artset"> |
---|
3521 | <!-- see https://tools.ietf.org/html/draft-levkowetz-xml2rfc-v3-implementation-notes-08#section-3.1.1 --> |
---|
3522 | <xsl:choose> |
---|
3523 | <xsl:when test="artwork[svg:svg or normalize-space(.)='' or @src!='']"> |
---|
3524 | <xsl:apply-templates select="artwork[svg:svg or normalize-space(.)='' or @src!=''][1]"/> |
---|
3525 | </xsl:when> |
---|
3526 | <xsl:when test="artwork"> |
---|
3527 | <xsl:apply-templates select="artwork[1]"/> |
---|
3528 | </xsl:when> |
---|
3529 | <xsl:when test="@anchor"> |
---|
3530 | <fo:block id="{@anchor}"/> |
---|
3531 | </xsl:when> |
---|
3532 | <xsl:otherwise/> |
---|
3533 | </xsl:choose> |
---|
3534 | </xsl:template> |
---|
3535 | |
---|
3536 | </xsl:transform> |
---|