Fixed ninja binary location logic to use ninja.BIN_DIR. Previous logic no longer...
[scons.git] / SCons / Tool / docbook / docbook-xsl-1.76.1 / fo / block.xsl
blobce19b419195c394b4f88d816eb12abb8af12fe21
1 <?xml version='1.0'?>
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:fo="http://www.w3.org/1999/XSL/Format"
4 version='1.0'>
6 <!-- ********************************************************************
7 $Id: block.xsl 8597 2010-03-20 04:56:04Z bobstayton $
8 ********************************************************************
10 This file is part of the XSL DocBook Stylesheet distribution.
11 See ../README or http://docbook.sf.net/release/xsl/current/ for
12 copyright and other information.
14 ******************************************************************** -->
16 <!-- ==================================================================== -->
17 <!-- What should we do about styling blockinfo? -->
19 <xsl:template match="blockinfo|info">
20 <!-- suppress -->
21 </xsl:template>
23 <!-- ==================================================================== -->
25 <xsl:template name="block.object">
26 <xsl:variable name="keep.together">
27 <xsl:call-template name="pi.dbfo_keep-together"/>
28 </xsl:variable>
29 <fo:block>
30 <xsl:if test="$keep.together != ''">
31 <xsl:attribute name="keep-together.within-column"><xsl:value-of
32 select="$keep.together"/></xsl:attribute>
33 </xsl:if>
34 <xsl:call-template name="anchor"/>
35 <xsl:apply-templates/>
36 </fo:block>
37 </xsl:template>
39 <!-- ==================================================================== -->
41 <xsl:template match="para">
42 <xsl:variable name="keep.together">
43 <xsl:call-template name="pi.dbfo_keep-together"/>
44 </xsl:variable>
45 <fo:block xsl:use-attribute-sets="normal.para.spacing">
46 <xsl:if test="$keep.together != ''">
47 <xsl:attribute name="keep-together.within-column"><xsl:value-of
48 select="$keep.together"/></xsl:attribute>
49 </xsl:if>
50 <xsl:call-template name="anchor"/>
51 <xsl:apply-templates/>
52 </fo:block>
53 </xsl:template>
55 <xsl:template match="simpara">
56 <xsl:variable name="keep.together">
57 <xsl:call-template name="pi.dbfo_keep-together"/>
58 </xsl:variable>
59 <fo:block xsl:use-attribute-sets="normal.para.spacing">
60 <xsl:if test="$keep.together != ''">
61 <xsl:attribute name="keep-together.within-column"><xsl:value-of
62 select="$keep.together"/></xsl:attribute>
63 </xsl:if>
64 <xsl:call-template name="anchor"/>
65 <xsl:apply-templates/>
66 </fo:block>
67 </xsl:template>
69 <xsl:template match="formalpara">
70 <xsl:variable name="keep.together">
71 <xsl:call-template name="pi.dbfo_keep-together"/>
72 </xsl:variable>
73 <fo:block xsl:use-attribute-sets="normal.para.spacing">
74 <xsl:if test="$keep.together != ''">
75 <xsl:attribute name="keep-together.within-column"><xsl:value-of
76 select="$keep.together"/></xsl:attribute>
77 </xsl:if>
78 <xsl:call-template name="anchor"/>
79 <xsl:apply-templates/>
80 </fo:block>
81 </xsl:template>
83 <!-- Only use title from info -->
84 <xsl:template match="formalpara/info">
85 <xsl:apply-templates select="title"/>
86 </xsl:template>
88 <xsl:template match="formalpara/title|formalpara/info/title">
89 <xsl:variable name="titleStr">
90 <xsl:apply-templates/>
91 </xsl:variable>
92 <xsl:variable name="lastChar">
93 <xsl:if test="$titleStr != ''">
94 <xsl:value-of select="substring($titleStr,string-length($titleStr),1)"/>
95 </xsl:if>
96 </xsl:variable>
98 <fo:inline font-weight="bold"
99 keep-with-next.within-line="always"
100 padding-end="1em">
101 <xsl:copy-of select="$titleStr"/>
102 <xsl:if test="$lastChar != ''
103 and not(contains($runinhead.title.end.punct, $lastChar))">
104 <xsl:value-of select="$runinhead.default.title.end.punct"/>
105 </xsl:if>
106 <xsl:text>&#160;</xsl:text>
107 </fo:inline>
108 </xsl:template>
110 <xsl:template match="formalpara/para">
111 <xsl:apply-templates/>
112 </xsl:template>
114 <!-- ==================================================================== -->
116 <xsl:template match="blockquote">
117 <xsl:variable name="keep.together">
118 <xsl:call-template name="pi.dbfo_keep-together"/>
119 </xsl:variable>
120 <fo:block xsl:use-attribute-sets="blockquote.properties">
121 <xsl:if test="$keep.together != ''">
122 <xsl:attribute name="keep-together.within-column"><xsl:value-of
123 select="$keep.together"/></xsl:attribute>
124 </xsl:if>
125 <xsl:call-template name="anchor"/>
126 <fo:block>
127 <xsl:if test="title|info/title">
128 <fo:block xsl:use-attribute-sets="formal.title.properties">
129 <xsl:apply-templates select="." mode="object.title.markup"/>
130 </fo:block>
131 </xsl:if>
132 <xsl:apply-templates select="*[local-name(.) != 'title'
133 and local-name(.) != 'attribution']"/>
134 </fo:block>
135 <xsl:if test="attribution">
136 <fo:block text-align="right">
137 <!-- mdash -->
138 <xsl:text>&#x2014;</xsl:text>
139 <xsl:apply-templates select="attribution"/>
140 </fo:block>
141 </xsl:if>
142 </fo:block>
143 </xsl:template>
145 <!-- Use an em dash per Chicago Manual of Style and https://sourceforge.net/tracker/index.php?func=detail&aid=2793878&group_id=21935&atid=373747 -->
146 <xsl:template match="epigraph">
147 <fo:block>
148 <xsl:call-template name="anchor"/>
149 <xsl:apply-templates select="para|simpara|formalpara|literallayout"/>
150 <xsl:if test="attribution">
151 <fo:inline>
152 <xsl:text>&#x2014;</xsl:text>
153 <xsl:apply-templates select="attribution"/>
154 </fo:inline>
155 </xsl:if>
156 </fo:block>
157 </xsl:template>
159 <xsl:template match="attribution">
160 <fo:inline><xsl:apply-templates/></fo:inline>
161 </xsl:template>
163 <!-- ==================================================================== -->
165 <xsl:template name="floater">
166 <xsl:param name="position" select="'none'"/>
167 <xsl:param name="clear" select="'both'"/>
168 <xsl:param name="width"/>
169 <xsl:param name="content"/>
170 <xsl:param name="start.indent">0pt</xsl:param>
171 <xsl:param name="end.indent">0pt</xsl:param>
173 <xsl:choose>
174 <xsl:when test="not($fop.extensions = 0)">
175 <!-- fop 0.20.5 does not support floats -->
176 <xsl:copy-of select="$content"/>
177 </xsl:when>
178 <xsl:when test="$position = 'none'">
179 <xsl:copy-of select="$content"/>
180 </xsl:when>
181 <xsl:when test="$position = 'before'">
182 <fo:float float="before">
183 <xsl:copy-of select="$content"/>
184 </fo:float>
185 </xsl:when>
186 <xsl:when test="$position = 'left' or
187 $position = 'start' or
188 $position = 'right' or
189 $position = 'end' or
190 $position = 'inside' or
191 $position = 'outside'">
192 <xsl:variable name="float">
193 <fo:float float="{$position}"
194 clear="{$clear}">
195 <fo:block-container
196 start-indent="{$start.indent}"
197 end-indent="{$end.indent}">
198 <xsl:if test="$width != ''">
199 <xsl:attribute name="inline-progression-dimension">
200 <xsl:value-of select="$width"/>
201 </xsl:attribute>
202 </xsl:if>
203 <fo:block>
204 <xsl:copy-of select="$content"/>
205 </fo:block>
206 </fo:block-container>
207 </fo:float>
208 </xsl:variable>
209 <xsl:choose>
210 <xsl:when test="$axf.extensions != 0 and self::sidebar">
211 <fo:block xsl:use-attribute-sets="normal.para.spacing"
212 space-after="0pt"
213 space-after.precedence="force"
214 start-indent="0pt" end-indent="0pt">
215 <xsl:copy-of select="$float"/>
216 </fo:block>
217 </xsl:when>
218 <xsl:when test="$axf.extensions != 0 and
219 ($position = 'left' or $position = 'start')">
220 <fo:float float="{$position}"
221 clear="{$clear}">
222 <fo:block-container
223 inline-progression-dimension=".001mm"
224 end-indent="{$start.indent} + {$width} + {$end.indent}">
225 <xsl:attribute name="start-indent">
226 <xsl:choose>
227 <xsl:when test="ancestor::para">
228 <!-- Special case for handling inline floats
229 in Antenna House-->
230 <xsl:value-of select="concat('-', $body.start.indent)"/>
231 </xsl:when>
232 <xsl:otherwise>0pt</xsl:otherwise>
233 </xsl:choose>
234 </xsl:attribute>
235 <fo:block start-indent="{$start.indent}"
236 end-indent="-{$start.indent} - {$width}">
237 <xsl:copy-of select="$content"/>
238 </fo:block>
239 </fo:block-container>
240 </fo:float>
242 </xsl:when>
243 <xsl:when test="$axf.extensions != 0 and
244 ($position = 'right' or $position = 'end')">
245 <!-- Special case for handling inline floats in Antenna House-->
246 <fo:float float="{$position}"
247 clear="{$clear}">
248 <fo:block-container
249 inline-progression-dimension=".001mm"
250 end-indent="-{$body.end.indent}"
251 start-indent="{$start.indent} + {$width} + {$end.indent}">
252 <fo:block end-indent="{$end.indent}"
253 start-indent="-{$end.indent} - {$width}">
254 <xsl:copy-of select="$content"/>
255 </fo:block>
256 </fo:block-container>
257 </fo:float>
259 </xsl:when>
260 <xsl:when test="$xep.extensions != 0 and self::sidebar">
261 <!-- float needs some space above to line up with following para -->
262 <fo:block xsl:use-attribute-sets="normal.para.spacing">
263 <xsl:copy-of select="$float"/>
264 </fo:block>
265 </xsl:when>
266 <xsl:when test="$xep.extensions != 0">
267 <xsl:copy-of select="$float"/>
268 </xsl:when>
269 <xsl:otherwise>
270 <xsl:copy-of select="$float"/>
271 </xsl:otherwise>
272 </xsl:choose>
273 </xsl:when>
274 <xsl:otherwise>
275 <xsl:copy-of select="$content"/>
276 </xsl:otherwise>
277 </xsl:choose>
278 </xsl:template>
280 <xsl:template match="sidebar" name="sidebar">
281 <!-- Also does margin notes -->
282 <xsl:variable name="pi-type">
283 <xsl:call-template name="pi.dbfo_float-type"/>
284 </xsl:variable>
286 <xsl:variable name="id">
287 <xsl:call-template name="object.id"/>
288 </xsl:variable>
290 <xsl:choose>
291 <xsl:when test="$pi-type = 'margin.note'">
292 <xsl:call-template name="margin.note"/>
293 </xsl:when>
294 <xsl:otherwise>
295 <xsl:variable name="content">
296 <fo:block xsl:use-attribute-sets="sidebar.properties"
297 id="{$id}">
298 <xsl:call-template name="sidebar.titlepage"/>
299 <xsl:apply-templates select="node()[not(self::title) and
300 not(self::info) and
301 not(self::sidebarinfo)]"/>
302 </fo:block>
303 </xsl:variable>
305 <xsl:variable name="pi-width">
306 <xsl:call-template name="pi.dbfo_sidebar-width"/>
307 </xsl:variable>
309 <xsl:variable name="position">
310 <xsl:choose>
311 <xsl:when test="$pi-type != ''">
312 <xsl:value-of select="$pi-type"/>
313 </xsl:when>
314 <xsl:otherwise>
315 <xsl:value-of select="$sidebar.float.type"/>
316 </xsl:otherwise>
317 </xsl:choose>
318 </xsl:variable>
320 <xsl:call-template name="floater">
321 <xsl:with-param name="content" select="$content"/>
322 <xsl:with-param name="position" select="$position"/>
323 <xsl:with-param name="width">
324 <xsl:choose>
325 <xsl:when test="$pi-width != ''">
326 <xsl:value-of select="$pi-width"/>
327 </xsl:when>
328 <xsl:otherwise>
329 <xsl:value-of select="$sidebar.float.width"/>
330 </xsl:otherwise>
331 </xsl:choose>
332 </xsl:with-param>
333 <xsl:with-param name="start.indent">
334 <xsl:choose>
335 <xsl:when test="$position = 'start' or
336 $position = 'left'">0pt</xsl:when>
337 <xsl:when test="$position = 'end' or
338 $position = 'right'">0.5em</xsl:when>
339 <xsl:otherwise>0pt</xsl:otherwise>
340 </xsl:choose>
341 </xsl:with-param>
342 <xsl:with-param name="end.indent">
343 <xsl:choose>
344 <xsl:when test="$position = 'start' or
345 $position = 'left'">0.5em</xsl:when>
346 <xsl:when test="$position = 'end' or
347 $position = 'right'">0pt</xsl:when>
348 <xsl:otherwise>0pt</xsl:otherwise>
349 </xsl:choose>
350 </xsl:with-param>
351 </xsl:call-template>
352 </xsl:otherwise>
353 </xsl:choose>
355 </xsl:template>
357 <xsl:template match="sidebar/title|sidebarinfo|sidebar/info"/>
359 <xsl:template match="sidebar/title|sidebarinfo/title|sidebar/info/title"
360 mode="titlepage.mode" priority="1">
361 <fo:block xsl:use-attribute-sets="sidebar.title.properties">
362 <xsl:apply-templates/>
363 </fo:block>
364 </xsl:template>
366 <xsl:template name="margin.note">
367 <xsl:param name="content">
368 <fo:block xsl:use-attribute-sets="margin.note.properties">
369 <xsl:if test="./title">
370 <fo:block xsl:use-attribute-sets="margin.note.title.properties">
371 <xsl:apply-templates select="./title" mode="margin.note.title.mode"/>
372 </fo:block>
373 </xsl:if>
374 <xsl:apply-templates/>
375 </fo:block>
376 </xsl:param>
378 <xsl:variable name="pi-width">
379 <xsl:call-template name="pi.dbfo_sidebar-width"/>
380 </xsl:variable>
382 <xsl:variable name="position" select="$margin.note.float.type"/>
384 <xsl:call-template name="floater">
385 <xsl:with-param name="content" select="$content"/>
386 <xsl:with-param name="position" select="$position"/>
387 <xsl:with-param name="width" >
388 <xsl:choose>
389 <xsl:when test="$pi-width != ''">
390 <xsl:value-of select="$pi-width"/>
391 </xsl:when>
392 <xsl:otherwise>
393 <xsl:value-of select="$margin.note.width"/>
394 </xsl:otherwise>
395 </xsl:choose>
396 </xsl:with-param>
397 <xsl:with-param name="start.indent">
398 <xsl:choose>
399 <xsl:when test="$position = 'start' or
400 $position = 'left'">0pt</xsl:when>
401 <xsl:when test="$position = 'end' or
402 $position = 'right'">0.5em</xsl:when>
403 <xsl:otherwise>0pt</xsl:otherwise>
404 </xsl:choose>
405 </xsl:with-param>
406 <xsl:with-param name="end.indent">
407 <xsl:choose>
408 <xsl:when test="$position = 'start' or
409 $position = 'left'">0.5em</xsl:when>
410 <xsl:when test="$position = 'end' or
411 $position = 'right'">0pt</xsl:when>
412 <xsl:otherwise>0pt</xsl:otherwise>
413 </xsl:choose>
414 </xsl:with-param>
415 </xsl:call-template>
416 </xsl:template>
418 <xsl:template match="sidebar/title" mode="margin.note.title.mode">
419 <xsl:apply-templates/>
420 </xsl:template>
422 <!-- ==================================================================== -->
424 <xsl:template match="abstract">
425 <xsl:variable name="keep.together">
426 <xsl:call-template name="pi.dbfo_keep-together"/>
427 </xsl:variable>
428 <fo:block xsl:use-attribute-sets="abstract.properties">
429 <xsl:if test="$keep.together != ''">
430 <xsl:attribute name="keep-together.within-column"><xsl:value-of
431 select="$keep.together"/></xsl:attribute>
432 </xsl:if>
433 <xsl:call-template name="anchor"/>
434 <xsl:apply-templates/>
435 </fo:block>
436 </xsl:template>
438 <xsl:template match="abstract/title|abstract/info/title">
439 <fo:block xsl:use-attribute-sets="abstract.title.properties">
440 <xsl:apply-templates/>
441 </fo:block>
442 </xsl:template>
444 <!-- ==================================================================== -->
446 <xsl:template match="msgset">
447 <xsl:apply-templates/>
448 </xsl:template>
450 <xsl:template match="msgentry">
451 <xsl:call-template name="block.object"/>
452 </xsl:template>
454 <xsl:template match="simplemsgentry">
455 <xsl:call-template name="block.object"/>
456 </xsl:template>
458 <xsl:template match="msg">
459 <xsl:call-template name="block.object"/>
460 </xsl:template>
462 <xsl:template match="msgmain">
463 <xsl:apply-templates/>
464 </xsl:template>
466 <xsl:template match="msgsub">
467 <xsl:apply-templates/>
468 </xsl:template>
470 <xsl:template match="msgrel">
471 <xsl:apply-templates/>
472 </xsl:template>
474 <xsl:template match="msgtext">
475 <xsl:apply-templates/>
476 </xsl:template>
478 <xsl:template match="msginfo">
479 <xsl:call-template name="block.object"/>
480 </xsl:template>
482 <xsl:template match="msglevel">
483 <fo:block>
484 <fo:inline font-weight="bold"
485 keep-with-next.within-line="always">
486 <xsl:call-template name="gentext.template">
487 <xsl:with-param name="context" select="'msgset'"/>
488 <xsl:with-param name="name" select="'MsgLevel'"/>
489 </xsl:call-template>
490 </fo:inline>
491 <xsl:apply-templates/>
492 </fo:block>
493 </xsl:template>
495 <xsl:template match="msgorig">
496 <fo:block>
497 <fo:inline font-weight="bold"
498 keep-with-next.within-line="always">
499 <xsl:call-template name="gentext.template">
500 <xsl:with-param name="context" select="'msgset'"/>
501 <xsl:with-param name="name" select="'MsgOrig'"/>
502 </xsl:call-template>
503 </fo:inline>
504 <xsl:apply-templates/>
505 </fo:block>
506 </xsl:template>
508 <xsl:template match="msgaud">
509 <fo:block>
510 <fo:inline font-weight="bold"
511 keep-with-next.within-line="always">
512 <xsl:call-template name="gentext.template">
513 <xsl:with-param name="context" select="'msgset'"/>
514 <xsl:with-param name="name" select="'MsgAud'"/>
515 </xsl:call-template>
516 </fo:inline>
517 <xsl:apply-templates/>
518 </fo:block>
519 </xsl:template>
521 <xsl:template match="msgexplan">
522 <xsl:call-template name="block.object"/>
523 </xsl:template>
525 <xsl:template match="msgexplan/title">
526 <fo:block font-weight="bold"
527 keep-with-next.within-column="always"
528 hyphenate="false">
529 <xsl:apply-templates/>
530 </fo:block>
531 </xsl:template>
533 <!-- ==================================================================== -->
534 <!-- For better or worse, revhistory is allowed in content... -->
536 <xsl:template match="revhistory">
537 <fo:table table-layout="fixed" xsl:use-attribute-sets="revhistory.table.properties">
538 <xsl:call-template name="anchor"/>
539 <fo:table-column column-number="1" column-width="proportional-column-width(1)"/>
540 <fo:table-column column-number="2" column-width="proportional-column-width(1)"/>
541 <fo:table-column column-number="3" column-width="proportional-column-width(1)"/>
542 <fo:table-body start-indent="0pt" end-indent="0pt">
543 <fo:table-row>
544 <fo:table-cell number-columns-spanned="3" xsl:use-attribute-sets="revhistory.table.cell.properties">
545 <fo:block xsl:use-attribute-sets="revhistory.title.properties">
546 <xsl:choose>
547 <xsl:when test="title|info/title">
548 <xsl:apply-templates select="title|info/title" mode="titlepage.mode"/>
549 </xsl:when>
550 <xsl:otherwise>
551 <xsl:call-template name="gentext">
552 <xsl:with-param name="key" select="'RevHistory'"/>
553 </xsl:call-template>
554 </xsl:otherwise>
555 </xsl:choose>
556 </fo:block>
557 </fo:table-cell>
558 </fo:table-row>
559 <xsl:apply-templates/>
560 </fo:table-body>
561 </fo:table>
562 </xsl:template>
564 <xsl:template match="revhistory/title">
565 <!-- Handled in titlepage.mode -->
566 </xsl:template>
568 <xsl:template match="revhistory/revision">
569 <xsl:variable name="revnumber" select="revnumber"/>
570 <xsl:variable name="revdate" select="date"/>
571 <xsl:variable name="revauthor" select="authorinitials|author"/>
572 <xsl:variable name="revremark" select="revremark|revdescription"/>
573 <fo:table-row>
574 <fo:table-cell xsl:use-attribute-sets="revhistory.table.cell.properties">
575 <fo:block>
576 <xsl:call-template name="anchor"/>
577 <xsl:if test="$revnumber">
578 <xsl:call-template name="gentext">
579 <xsl:with-param name="key" select="'Revision'"/>
580 </xsl:call-template>
581 <xsl:call-template name="gentext.space"/>
582 <xsl:apply-templates select="$revnumber[1]"/>
583 </xsl:if>
584 </fo:block>
585 </fo:table-cell>
586 <fo:table-cell xsl:use-attribute-sets="revhistory.table.cell.properties">
587 <fo:block>
588 <xsl:apply-templates select="$revdate[1]"/>
589 </fo:block>
590 </fo:table-cell>
591 <fo:table-cell xsl:use-attribute-sets="revhistory.table.cell.properties">
592 <fo:block>
593 <xsl:for-each select="$revauthor">
594 <xsl:apply-templates select="."/>
595 <xsl:if test="position() != last()">
596 <xsl:text>, </xsl:text>
597 </xsl:if>
598 </xsl:for-each>
599 </fo:block>
600 </fo:table-cell>
601 </fo:table-row>
602 <xsl:if test="$revremark">
603 <fo:table-row>
604 <fo:table-cell number-columns-spanned="3" xsl:use-attribute-sets="revhistory.table.cell.properties">
605 <fo:block>
606 <xsl:apply-templates select="$revremark[1]"/>
607 </fo:block>
608 </fo:table-cell>
609 </fo:table-row>
610 </xsl:if>
611 </xsl:template>
613 <xsl:template match="revision/revnumber">
614 <xsl:apply-templates/>
615 </xsl:template>
617 <xsl:template match="revision/date">
618 <xsl:apply-templates/>
619 </xsl:template>
621 <xsl:template match="revision/authorinitials">
622 <xsl:apply-templates/>
623 </xsl:template>
625 <xsl:template match="revision/author">
626 <xsl:apply-templates/>
627 </xsl:template>
629 <xsl:template match="revision/revremark">
630 <xsl:apply-templates/>
631 </xsl:template>
633 <xsl:template match="revision/revdescription">
634 <xsl:apply-templates/>
635 </xsl:template>
637 <!-- ==================================================================== -->
639 <xsl:template match="ackno|acknowledgements[parent::article]">
640 <fo:block xsl:use-attribute-sets="normal.para.spacing">
641 <xsl:call-template name="anchor"/>
642 <xsl:apply-templates/>
643 </fo:block>
644 </xsl:template>
646 <!-- ==================================================================== -->
648 <xsl:template match="highlights">
649 <xsl:call-template name="block.object"/>
650 </xsl:template>
652 <!-- ==================================================================== -->
654 </xsl:stylesheet>