3 Licensed to the Apache Software Foundation (ASF) under one or more
4 contributor license agreements. See the NOTICE file distributed with
5 this work for additional information regarding copyright ownership.
6 The ASF licenses this file to You under the Apache License, Version 2.0
7 (the "License"); you may not use this file except in compliance with
8 the License. You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
18 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
19 xmlns:fo="http://www.w3.org/1999/XSL/Format"
21 <!-- left, justify, right -->
22 <xsl:variable name="text-align" select="string(//skinconfig/pdf/page/@text-align)"/>
23 <!-- print URL of external links -->
24 <xsl:variable name="show-external-urls" select="//skinconfig/pdf/show-external-urls"/>
25 <!-- Get the section depth to use when generating the minitoc (default is 2) -->
26 <xsl:variable name="toc-max-depth" select="number(//skinconfig/toc/@max-depth)"/>
27 <!-- The page size to be used -->
28 <xsl:variable name="pagesize"
29 select="string(//skinconfig/pdf/page/@size)"/>
30 <!-- The page orientation ("portrait" or "landscape") -->
31 <xsl:variable name="pageorientation"
32 select="string(//skinconfig/pdf/page/@orientation)"/>
33 <!-- Double-sided printing toggle -->
34 <xsl:variable name="doublesided"
35 select="string(//skinconfig/pdf/margins/@double-sided)"/>
36 <!-- The top page margin -->
37 <xsl:variable name="topmargin"
38 select="string(//skinconfig/pdf/margins/top)"/>
39 <!-- The bottom page margin -->
40 <xsl:variable name="bottommargin"
41 select="string(//skinconfig/pdf/margins/bottom)"/>
42 <!-- The inner page margin (always the left margin if
43 double-sided printing is off, alternating between left and right if
45 <xsl:variable name="innermargin"
46 select="string(//skinconfig/pdf/margins/inner)"/>
47 <!-- The outer page margin (always the right margin if
48 double-sided printing is off, alternating between right and left if
50 <xsl:variable name="outermargin"
51 select="string(//skinconfig/pdf/margins/outer)"/>
52 <xsl:param name="numbersections" select="'true'"/>
53 <!-- page breaks after TOC and each page if an aggregate document -->
54 <xsl:variable name="page-break-top-sections" select="'true'"/>
55 <!-- page numbering format -->
56 <xsl:variable name="page-numbering-format" select="string(//skinconfig/pdf/page-numbering-format)"/>
57 <!-- Section depth at which we stop numbering and just indent -->
58 <xsl:param name="numbering-max-depth" select="'3'"/>
59 <xsl:param name="imagesdir" select="."/>
60 <xsl:param name="xmlbasedir"/>
61 <xsl:include href="pdfoutline.xsl"/>
62 <xsl:include href="footerinfo.xsl"/>
63 <!-- Determine page height for various page sizes (US Letter portrait
65 <!-- FIXME: JJP:would this be better of a file? -->
66 <xsl:variable name="pageheight">
68 <xsl:when test="$pageorientation = 'landscape'">
70 <xsl:when test="$pagesize = 'a0'">841mm</xsl:when>
71 <xsl:when test="$pagesize = 'a1'">594mm</xsl:when>
72 <xsl:when test="$pagesize = 'a2'">420mm</xsl:when>
73 <xsl:when test="$pagesize = 'a3'">297mm</xsl:when>
74 <xsl:when test="$pagesize = 'a4'">210mm</xsl:when>
75 <xsl:when test="$pagesize = 'a5'">148mm</xsl:when>
76 <xsl:when test="$pagesize = 'executive'">7.25in</xsl:when>
77 <xsl:when test="$pagesize = 'folio'">8.5in</xsl:when>
78 <xsl:when test="$pagesize = 'ledger'">11in</xsl:when>
79 <xsl:when test="$pagesize = 'legal'">8.5in</xsl:when>
80 <xsl:when test="$pagesize = 'letter'">8.5in</xsl:when>
81 <xsl:when test="$pagesize = 'quarto'">8.5in</xsl:when>
82 <xsl:when test="$pagesize = 'tabloid'">11in</xsl:when>
83 <xsl:otherwise>8.5in</xsl:otherwise>
88 <xsl:when test="$pagesize = 'a0'">1189mm</xsl:when>
89 <xsl:when test="$pagesize = 'a1'">841mm</xsl:when>
90 <xsl:when test="$pagesize = 'a2'">594mm</xsl:when>
91 <xsl:when test="$pagesize = 'a3'">420mm</xsl:when>
92 <xsl:when test="$pagesize = 'a4'">297mm</xsl:when>
93 <xsl:when test="$pagesize = 'a5'">210mm</xsl:when>
94 <xsl:when test="$pagesize = 'executive'">10.5in</xsl:when>
95 <xsl:when test="$pagesize = 'folio'">13in</xsl:when>
96 <xsl:when test="$pagesize = 'ledger'">17in</xsl:when>
97 <xsl:when test="$pagesize = 'legal'">14in</xsl:when>
98 <xsl:when test="$pagesize = 'quarto'">10.83in</xsl:when>
99 <xsl:when test="$pagesize = 'tabloid'">17in</xsl:when>
100 <xsl:otherwise>11in</xsl:otherwise>
105 <!-- Determine page width for various page sizes (US Letter portrait
107 <xsl:variable name="pagewidth">
109 <xsl:when test="$pageorientation = 'landscape'">
111 <xsl:when test="$pagesize = 'a0'">1189mm</xsl:when>
112 <xsl:when test="$pagesize = 'a1'">841mm</xsl:when>
113 <xsl:when test="$pagesize = 'a2'">594mm</xsl:when>
114 <xsl:when test="$pagesize = 'a3'">420mm</xsl:when>
115 <xsl:when test="$pagesize = 'a4'">297mm</xsl:when>
116 <xsl:when test="$pagesize = 'a5'">210mm</xsl:when>
117 <xsl:when test="$pagesize = 'executive'">10.5in</xsl:when>
118 <xsl:when test="$pagesize = 'folio'">13in</xsl:when>
119 <xsl:when test="$pagesize = 'ledger'">17in</xsl:when>
120 <xsl:when test="$pagesize = 'legal'">14in</xsl:when>
121 <xsl:when test="$pagesize = 'quarto'">10.83in</xsl:when>
122 <xsl:when test="$pagesize = 'tabloid'">17in</xsl:when>
123 <xsl:otherwise>11in</xsl:otherwise>
128 <xsl:when test="$pagesize = 'a0'">841mm</xsl:when>
129 <xsl:when test="$pagesize = 'a1'">594mm</xsl:when>
130 <xsl:when test="$pagesize = 'a2'">420mm</xsl:when>
131 <xsl:when test="$pagesize = 'a3'">297mm</xsl:when>
132 <xsl:when test="$pagesize = 'a4'">210mm</xsl:when>
133 <xsl:when test="$pagesize = 'a5'">148mm</xsl:when>
134 <xsl:when test="$pagesize = 'executive'">7.25in</xsl:when>
135 <xsl:when test="$pagesize = 'folio'">8.5in</xsl:when>
136 <xsl:when test="$pagesize = 'ledger'">11in</xsl:when>
137 <xsl:when test="$pagesize = 'legal'">8.5in</xsl:when>
138 <xsl:when test="$pagesize = 'letter'">8.5in</xsl:when>
139 <xsl:when test="$pagesize = 'quarto'">8.5in</xsl:when>
140 <xsl:when test="$pagesize = 'tabloid'">11in</xsl:when>
141 <xsl:otherwise>8.5in</xsl:otherwise>
146 <xsl:template match="/">
147 <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
148 <fo:layout-master-set>
149 <fo:simple-page-master master-name="first-page"
150 page-height="{$pageheight}"
151 page-width="{$pagewidth}"
152 margin-top="{$topmargin}"
153 margin-bottom="{$bottommargin}"
154 margin-left="{$innermargin}"
155 margin-right="{$outermargin}">
158 margin-bottom=".5in"/>
160 region-name="first-footer"
162 display-align="before"/>
163 </fo:simple-page-master>
164 <fo:simple-page-master master-name="even-page"
165 page-height="{$pageheight}"
166 page-width="{$pagewidth}"
167 margin-top="{$topmargin}"
168 margin-bottom="{$bottommargin}">
170 <xsl:when test="$doublesided = 'true'">
171 <xsl:attribute name="margin-left">
172 <xsl:value-of select="$outermargin"/>
174 <xsl:attribute name="margin-right">
175 <xsl:value-of select="$innermargin"/>
179 <xsl:attribute name="margin-left">
180 <xsl:value-of select="$innermargin"/>
182 <xsl:attribute name="margin-right">
183 <xsl:value-of select="$outermargin"/>
188 region-name="even-header"
190 border-bottom="0.5pt solid"/>
193 margin-bottom=".5in"/>
195 region-name="even-footer"
197 display-align="before"/>
198 </fo:simple-page-master>
199 <fo:simple-page-master master-name="odd-page"
200 page-height="{$pageheight}"
201 page-width="{$pagewidth}"
202 margin-top="{$topmargin}"
203 margin-bottom="{$bottommargin}"
204 margin-left="{$innermargin}"
205 margin-right="{$outermargin}">
207 region-name="odd-header"
209 border-bottom="0.5pt solid"/>
212 margin-bottom=".5in"/>
214 region-name="odd-footer"
216 display-align="before"/>
217 </fo:simple-page-master>
218 <fo:page-sequence-master master-name="book">
219 <fo:repeatable-page-master-alternatives>
220 <fo:conditional-page-master-reference
221 page-position="first"
222 master-reference="first-page"/>
223 <fo:conditional-page-master-reference
225 master-reference="odd-page"/>
226 <fo:conditional-page-master-reference
228 master-reference="even-page"/>
229 </fo:repeatable-page-master-alternatives>
230 </fo:page-sequence-master>
231 </fo:layout-master-set>
232 <xsl:apply-templates select="/site/document" mode="outline"/>
233 <fo:page-sequence master-reference="book">
234 <xsl:apply-templates select="/site/document"/>
238 <xsl:template match="document">
240 <xsl:value-of select="header/title"/>
242 <fo:static-content flow-name="first-footer">
244 border-top="0.25pt solid"
247 <xsl:apply-templates select="footer"/>
249 <!-- don't list page number on first page if it's contents is just the TOC -->
250 <xsl:if test="not($toc-max-depth > 0 and $page-break-top-sections)">
251 <xsl:call-template name="insertPageNumber">
252 <xsl:with-param name="text-align">start</xsl:with-param>
255 <xsl:call-template name="info"/>
257 <fo:static-content flow-name="even-header">
262 <xsl:value-of select="header/title"/>
265 <fo:static-content flow-name="even-footer">
267 border-top="0.25pt solid"
270 <xsl:apply-templates select="footer"/>
272 <xsl:call-template name="insertPageNumber">
273 <xsl:with-param name="text-align">end</xsl:with-param>
275 <xsl:call-template name="info"/>
277 <fo:static-content flow-name="odd-header">
282 <xsl:value-of select="header/title"/>
285 <fo:static-content flow-name="odd-footer">
287 border-top="0.25pt solid"
290 <xsl:apply-templates select="footer"/>
292 <xsl:call-template name="insertPageNumber">
293 <xsl:with-param name="text-align">start</xsl:with-param>
295 <xsl:call-template name="info"/>
297 <fo:flow flow-name="xsl-region-body">
299 padding-before="24pt"
303 id="{generate-id()}">
304 <xsl:value-of select="header/title"/>
307 text-align="{$text-align}"
308 padding-before="18pt"
309 padding-after="18pt">
310 <xsl:apply-templates/>
312 <!-- Total number of pages calculation... -->
313 <fo:block id="term"/>
316 <xsl:template match="abstract">
325 <xsl:call-template name="insertPageBreaks"/>
326 <xsl:apply-templates/>
329 <xsl:template match="notice">
336 border-top="0.25pt solid"
337 border-bottom="0.25pt solid"
340 <xsl:call-template name="insertPageBreaks"/>
341 <!-- insert i18n stuff here -->
342 NOTICE: <xsl:apply-templates/>
345 <xsl:template match="anchor">
346 <fo:block id="{@id}"/>
347 <xsl:apply-templates/>
349 <xsl:template match="section">
350 <xsl:param name="level">0</xsl:param>
351 <xsl:variable name="size">
352 <!-- 14pt for level 1 12pt for level 2 -->
353 <xsl:value-of select="14-number($level)"/>
355 <xsl:variable name="background-color" select="//skinconfig/colors/color[@name='body']/@value"/>
356 <xsl:variable name="heading-color" select="//skinconfig/colors/color[@name='subheading']/@value"/>
357 <xsl:variable name="heading-type" select="//skinconfig/headings/@type"/>
360 font-size="{$size}pt"
364 <xsl:call-template name="insertPageBreaks"/>
365 <xsl:if test="$heading-type = 'boxed'">
366 <xsl:attribute name="background-color">
367 <xsl:value-of select="$heading-color"/>
370 <xsl:attribute name="id">
372 <xsl:when test="normalize-space(@id)!=''">
373 <xsl:value-of select="@id"/>
376 <xsl:value-of select="generate-id()"/>
380 <xsl:if test="$numbersections = 'true' and number($level) < $numbering-max-depth+1">
381 <xsl:number format="1.1.1.1.1.1.1" count="section" level="multiple"/>
382 <xsl:text>. </xsl:text>
384 <!-- For sections 4 or more nestings deep, indent instead of number -->
385 <xsl:if test="number($level) > $numbering-max-depth+1">
386 <xsl:attribute name="start-indent">
387 <xsl:value-of select="4+number($level)"/>
388 <xsl:text>pt</xsl:text>
391 <xsl:value-of select="title"/>
393 <xsl:if test="$heading-type = 'underlined'">
394 <!-- The non-breaking space in this block is required, otherwise
395 the block won't be rendered at all. -->
398 font-size="{10 div (number($level) +1 )}pt"
399 background-color="{$heading-color}"> </fo:block>
402 background-color="{$background-color}">
403 <xsl:apply-templates>
404 <xsl:with-param name="level" select="number($level)+1"/>
405 </xsl:apply-templates>
408 <xsl:template match="title">
409 <!-- do nothing as titles are handled in their parent templates -->
411 <xsl:template match="subtitle">
412 <xsl:param name="level">0</xsl:param>
413 <xsl:variable name="size" select="16-(number($level)*1.5)"/>
416 font-size="{$size}pt">
417 <xsl:call-template name="insertPageBreaks"/>
418 <xsl:apply-templates/>
421 <xsl:template match="authors">
426 <xsl:call-template name="insertPageBreaks"/>
427 <!-- insert i18n stuff here -->
429 <xsl:for-each select="person">
430 <xsl:value-of select="@name"/>
431 <xsl:if test="not(position() = last())">, </xsl:if>
435 <xsl:template match="p">
437 <xsl:when test="ancestor::li and not(preceding-sibling::*)">
441 <xsl:call-template name="insertPageBreaks"/>
442 <xsl:apply-templates/>
450 <xsl:call-template name="insertPageBreaks"/>
451 <xsl:apply-templates/>
456 <xsl:template match="source">
457 <xsl:variable name="color" select="//skinconfig/colors/color[@name='code']/@value"/>
459 font-family="monospace"
461 background-color="{$color}"
462 white-space-collapse="false"
463 linefeed-treatment="preserve"
464 white-space-treatment="preserve"
467 <xsl:call-template name="insertPageBreaks"/>
468 <xsl:apply-templates/>
471 <xsl:template match="ol|ul">
473 provisional-distance-between-starts="18pt"
474 provisional-label-separation="3pt"
476 <xsl:apply-templates/>
479 <xsl:template match="ol/li">
481 <xsl:if test="not(following-sibling::li[1])">
482 <xsl:attribute name="space-after">6pt"</xsl:attribute>
485 end-indent="label-end()">
487 <xsl:number format="1."/>
489 </fo:list-item-label>
491 start-indent="body-start()">
494 <xsl:apply-templates/>
499 <!-- Emulate browser handling of these invalid combinations that our DTD
500 unfortunately allows -->
501 <xsl:template match="ul/ul | ul/ol | ol/ul | ol/ol">
503 <fo:list-item-label end-indent="label-end()">
504 <fo:block></fo:block>
505 </fo:list-item-label>
506 <fo:list-item-body start-indent="body-start()">
507 <fo:block font-family="serif">
508 <xsl:apply-templates/>
513 <xsl:template match="ul/li">
515 <xsl:if test="not(following-sibling::li[1])">
516 <xsl:attribute name="space-after">6pt</xsl:attribute>
518 <fo:list-item-label end-indent="label-end()">
519 <fo:block>•</fo:block>
520 </fo:list-item-label>
521 <fo:list-item-body start-indent="body-start()">
524 <xsl:apply-templates/>
529 <xsl:template match="dl">
531 provisional-distance-between-starts="18pt"
532 provisional-label-separation="3pt"
534 <xsl:apply-templates/>
537 <xsl:template match="dt">
539 <fo:list-item-label end-indent="label-end()">
540 <fo:block></fo:block>
541 </fo:list-item-label>
542 <fo:list-item-body start-indent="body-start()">
545 <xsl:apply-templates/>
550 <xsl:template match="dd">
552 <fo:list-item-label end-indent="label-end()">
553 <fo:block></fo:block>
554 </fo:list-item-label>
555 <fo:list-item-body start-indent="body-start()">
557 <xsl:apply-templates/>
562 <xsl:template match="strong">
563 <fo:inline font-weight="bold">
564 <xsl:apply-templates/>
567 <xsl:template match="em">
568 <fo:inline font-style="italic">
569 <xsl:apply-templates/>
572 <xsl:template match="code">
573 <fo:inline font-family="monospace">
574 <xsl:apply-templates/>
577 <xsl:template match="warning">
578 <xsl:variable name="color" select="//skinconfig/colors/color[@name='warning']/@value"/>
581 margin-right="0.25in"
586 border-before-style="solid"
587 border-start-style="solid"
588 border-end-style="solid"
589 border-color="{$color}"
590 background-color="{$color}"
592 <xsl:call-template name="insertPageBreaks"/>
594 <xsl:when test="@label">
595 <xsl:value-of select="@label"/>
597 <xsl:otherwise>Warning: </xsl:otherwise>
599 <xsl:value-of select="title"/>
603 margin-right="0.25in"
606 border-after-style="solid"
607 border-start-style="solid"
608 border-end-style="solid"
609 border-color="{$color}"
610 background-color="#fff0f0"
616 <xsl:apply-templates/>
619 <xsl:template match="note">
620 <xsl:variable name="color" select="//skinconfig/colors/color[@name='note']/@value"/>
623 margin-right="0.25in"
629 border-before-style="solid"
630 border-start-style="solid"
631 border-end-style="solid"
632 border-color="{$color}"
633 background-color="{$color}">
634 <xsl:call-template name="insertPageBreaks"/>
636 <xsl:when test="@label">
637 <xsl:value-of select="@label"/>
639 <!-- insert i18n stuff here -->
640 <xsl:otherwise>Note: </xsl:otherwise>
642 <xsl:value-of select="title"/>
646 margin-right="0.25in"
650 border-after-style="solid"
651 border-start-style="solid"
652 border-end-style="solid"
653 border-color="{$color}"
654 background-color="#F0F0FF"
659 <xsl:apply-templates/>
662 <xsl:template match="fixme">
663 <xsl:variable name="color" select="//skinconfig/colors/color[@name='fixme']/@value"/>
666 margin-right="0.25in"
672 border-before-style="solid"
673 border-start-style="solid"
674 border-end-style="solid"
675 border-color="{$color}"
676 background-color="{$color}">
677 <xsl:call-template name="insertPageBreaks"/>
678 <!-- insert i18n stuff here -->
679 FIXME (<xsl:value-of select="@author"/>): <xsl:value-of select="title"/>
683 margin-right="0.25in"
687 border-after-style="solid"
688 border-start-style="solid"
689 border-end-style="solid"
690 border-color="{$color}"
691 background-color="#FFF0F0"
696 <xsl:apply-templates/>
699 <xsl:template match="link|fork|jump">
700 <xsl:variable name="color" select="//skinconfig/colors/color[@name = 'body']/@link"/>
702 <xsl:when test="starts-with(@href, '#')">
703 <fo:basic-link color="{$color}" text-decoration="underline" internal-destination="{substring(@href,2)}">
704 <xsl:apply-templates/>
708 <fo:basic-link color="{$color}" text-decoration="underline" external-destination="{@href}">
709 <xsl:apply-templates/>
711 <xsl:if test="$show-external-urls = 'true' and @href != string(.)">
712 (<xsl:value-of select="@href"/>)
717 <xsl:template match="figure|img">
718 <fo:block text-align="center">
719 <xsl:call-template name="insertPageBreaks"/>
720 <xsl:if test="normalize-space(@id)!=''">
721 <xsl:attribute name="id">
722 <xsl:value-of select="@id"/>
725 <!-- Make relative paths absolute -->
726 <xsl:variable name="imgpath">
728 <!-- resources image dir -->
729 <xsl:when test="starts-with(string(@src),'images/')">
730 <xsl:value-of select="concat($imagesdir,substring-after(@src,'images'))"/>
732 <xsl:when test="contains(string(@src),'/images/')">
733 <xsl:value-of select="concat($imagesdir,substring-after(@src,'/images'))"/>
735 <!-- already absolute -->
736 <xsl:when test="contains(string(@src),':') or starts-with(string(@src),'/')">
737 <xsl:value-of select="@src"/>
739 <!-- relative to document -->
741 <xsl:value-of select="concat($xmlbasedir,@src)"/>
745 <fo:external-graphic src="{$imgpath}">
746 <xsl:if test="@height">
747 <xsl:attribute name="height">
748 <xsl:value-of select="@height"/>
751 <xsl:if test="@width">
752 <xsl:attribute name="width">
753 <xsl:value-of select="@width"/>
756 </fo:external-graphic>
758 <xsl:if test="//skinconfig/pdf/show-image-alt-text='true'">
759 <xsl:if test="normalize-space(@alt)!=''">
761 <xsl:value-of select="@alt"/>
767 <xsl:template match="table">
768 <!-- FIXME: Apache FOP must have column widths specified at present,
769 this section can be removed when this limitation is removed from Fop.
770 Unfortunately, this means that each column is a fixed width,
771 but at least the table displays! -->
772 <xsl:variable name="max-number-columns-td">
773 <xsl:for-each select="tr">
774 <xsl:sort select="count(td|th)" data-type="number"
776 <xsl:if test="position() = 1">
777 <xsl:value-of select="count(td|th)"/>
781 <xsl:variable name="max-number-columns-colspan">
782 <xsl:for-each select="tr">
783 <xsl:sort select="count(td|th)" data-type="number"
785 <xsl:if test="position() = 1">
787 select="sum(td/@colspan|th/@colspan)"/>
791 <xsl:variable name="max-number-columns">
794 test="$max-number-columns-colspan>$max-number-columns-td">
796 select="$max-number-columns-colspan"/>
799 <xsl:value-of select="$max-number-columns-td"/>
803 <xsl:variable name="column-width">
804 <xsl:value-of select="6.25 div number($max-number-columns)"/>in
808 <xsl:attribute name="column-width">
809 <xsl:value-of select="$column-width"/>
811 <xsl:attribute name="number-columns-repeated">
812 <xsl:value-of select="number($max-number-columns)"/>
815 <!-- End of hack for Fop support (if removing this hack, remember
816 you need the <fo:table> element) -->
819 font-family="sans-serif">
820 <xsl:apply-templates select="tr"/>
823 <!-- FIXME: Apache Fop does not support the caption element yet.
824 This hack will display the table caption accordingly. -->
825 <xsl:if test="caption">
829 <!-- insert i18n stuff here -->
831 <xsl:text> </xsl:text>
832 <xsl:number count="table" level="multiple"/>
833 <xsl:text>: </xsl:text>
834 <xsl:value-of select="caption"/>
838 <xsl:template match="tr">
840 <xsl:apply-templates/>
843 <xsl:template match="th">
844 <xsl:variable name="border-color" select="//skinconfig/colors/color[@name = 'table']/@value"/>
845 <xsl:variable name="background-color" select="$border-color"/>
852 background-color="{$background-color}"
853 border="1pt solid {$border-color}">
854 <xsl:attribute name="number-columns-spanned">
855 <xsl:value-of select="@colspan"/>
857 <xsl:attribute name="number-rows-spanned">
858 <xsl:value-of select="@rowspan"/>
862 <xsl:apply-templates/>
866 <xsl:template match="td">
867 <xsl:variable name="border-color" select="//skinconfig/colors/color[@name = 'table']/@value"/>
868 <xsl:variable name="background-color" select="//skinconfig/colors/color[@name = 'table-cell']/@value"/>
874 background-color="{$background-color}"
875 border="1pt solid {$border-color}">
876 <xsl:attribute name="number-columns-spanned">
877 <xsl:value-of select="@colspan"/>
879 <xsl:attribute name="number-rows-spanned">
880 <xsl:value-of select="@rowspan"/>
883 <xsl:apply-templates/>
887 <xsl:template match="br">
888 <fo:block></fo:block>
890 <xsl:template match="legal">
893 <xsl:apply-templates/>
896 <xsl:template match="body[count(//section) != 0]">
897 <xsl:if test="$toc-max-depth > 0">
898 <fo:block font-family="serif" font-size="14pt" font-weight="bold"
899 space-after="5pt" space-before="5pt" text-align="justify" width="7.5in">
900 <xsl:call-template name="insertPageBreaks"/>
901 <!-- insert i18n stuff here -->
902 <xsl:text>Table of contents</xsl:text>
904 <fo:block font-family="sans" font-size="12pt" space-after="5pt"
905 space-before="0pt" text-align="justify" width="7.5in">
906 <xsl:if test="$page-break-top-sections">
907 <xsl:attribute name="break-after">page</xsl:attribute>
909 <xsl:apply-templates select="section" mode="toc" />
912 <xsl:apply-templates />
914 <xsl:template match="section" mode="toc">
915 <!-- FIXME: see bug FOR-640 -->
916 <xsl:param name="depth" select="'1'"/>
917 <fo:block space-before="5pt" text-align-last="justify" start-indent=".5em" text-indent=".5em">
919 <xsl:variable name="id">
921 <xsl:when test="normalize-space(@id)!=''">
922 <xsl:value-of select="@id"/>
925 <xsl:value-of select="generate-id()"/>
929 <fo:basic-link internal-destination="{$id}">
930 <xsl:value-of select="substring('          ', 0, 2 * $depth - 1)" />
931 <fo:inline font-size="10pt">
932 <xsl:number count="section" format="1.1.1.1.1.1.1" level="multiple" />
934 <xsl:text> </xsl:text>
935 <xsl:value-of select="title" />
936 <fo:leader leader-pattern="dots" />
937 <fo:page-number-citation ref-id="{$id}" />
940 <xsl:if test="$toc-max-depth > $depth">
941 <xsl:apply-templates select="section" mode="toc">
942 <xsl:with-param name="depth" select="$depth + 1"/>
943 </xsl:apply-templates>
947 <!-- ====================================================================== -->
948 <!-- Local Extensions section -->
949 <!-- ====================================================================== -->
950 <xsl:template match="citation">
952 [<xsl:value-of select="@def"/>]
955 <xsl:template match="p[@class='quote']">
956 <fo:block start-indent="1em"
959 background-color="#f0f0f0"
960 font-family="monospace">
961 <xsl:call-template name="insertPageBreaks"/>
962 <xsl:apply-templates/>
965 <xsl:template name="insertPageBreaks">
966 <!-- if marked as a 'pageBreakBefore', and we're breaking on pages, and were not the first node -->
967 <xsl:if test="contains(@class, 'pageBreakBefore') and preceding-sibling::node()">
968 <xsl:attribute name="break-before">page</xsl:attribute>
970 <!-- if marked as a 'pageBreakAfter', and we're breaking on pages, and were not the last node -->
971 <xsl:if test="contains(@class, 'pageBreakAfter') and following-sibling::node()">
972 <xsl:attribute name="break-after">page</xsl:attribute>
975 <!-- Display the document numerotation -->
976 <xsl:template name="insertPageNumber">
977 <xsl:param name="text-align" select="'start'"/>
978 <xsl:variable name="prefixe" select="substring-before($page-numbering-format,'1')"/>
979 <xsl:variable name="sep" select="substring-before(substring-after($page-numbering-format,'1'),'1')"/>
980 <xsl:variable name="postfixe">
982 <xsl:when test="contains(substring-after($page-numbering-format,'1'),'1')">
983 <xsl:value-of select="substring-after(substring-after($page-numbering-format,'1'),'1')"/>
986 <xsl:value-of select="substring-after($page-numbering-format,'1')"/>
990 <!-- if 'page-numbering-format' contains 1 digits, the page number is displayed in the footer -->
991 <xsl:if test="contains($page-numbering-format,'1')">
992 <fo:block font-size="70%" text-align="{$text-align}">
993 <!-- if the separator is not found, the total page number is skipped -->
994 <xsl:value-of select="$prefixe"/>
996 <xsl:if test="$sep != ''">
997 <xsl:value-of select="$sep"/>
998 <fo:page-number-citation ref-id="term"/>
1000 <xsl:value-of select="$postfixe"/>
1004 <!-- ====================================================================== -->
1005 <!-- Temporary section - subject to change on short notice -->
1006 <!-- ====================================================================== -->
1007 <xsl:template match="//style">
1008 <!-- HACK: The OpenOffice.org input plugin currently produces
1009 intermediate documents that contain a style element, invalid per
1010 the Forrest Document DTD. This style element must be ignored
1011 here. To find out why this is done this way, read the comments
1012 attached to issue FOR-433. -->