source: documentation/branches/3.03/manuals/processing/xml-to-pdf.xsl@ 14624

Last change on this file since 14624 was 14099, checked in by lh92, 17 years ago

Added the copyright information

  • Property svn:keywords set to Author Date Id Revision
File size: 10.5 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
3
4<xsl:include href="fo-common.xsl"/>
5<xsl:include href="crossref-pdf.xsl"/>
6
7<xsl:variable name="licence" select="document('GNUFDL.xml')/Licence"/>
8
9<xsl:attribute-set name="toc-heading-style">
10 <xsl:attribute name="text-align">right</xsl:attribute>
11 <xsl:attribute name="font-family"><xsl:value-of select="$font"/></xsl:attribute>
12 <xsl:attribute name="font-size">24.0pt</xsl:attribute>
13 <xsl:attribute name="line-height">24.0pt</xsl:attribute>
14 <xsl:attribute name="padding-top">3pt</xsl:attribute>
15 <xsl:attribute name="space-after.optimum">25pt</xsl:attribute>
16</xsl:attribute-set>
17<xsl:attribute-set name="toc-chapter-style">
18 <xsl:attribute name="text-align">start</xsl:attribute>
19 <xsl:attribute name="font-family"><xsl:value-of select="$font"/></xsl:attribute>
20 <xsl:attribute name="font-size">15.0pt</xsl:attribute>
21 <xsl:attribute name="line-height">15.0pt</xsl:attribute>
22 <xsl:attribute name="text-align-last">justify</xsl:attribute>
23 <xsl:attribute name="padding-top">3pt</xsl:attribute>
24 <xsl:attribute name="space-before.optimum">15pt</xsl:attribute>
25</xsl:attribute-set>
26<xsl:attribute-set name="toc-section-style">
27 <xsl:attribute name="text-align">start</xsl:attribute>
28 <xsl:attribute name="font-family"><xsl:value-of select="$font"/></xsl:attribute>
29 <xsl:attribute name="font-size">10.0pt</xsl:attribute>
30 <xsl:attribute name="font-weight">bold</xsl:attribute>
31 <xsl:attribute name="margin-left">12pt</xsl:attribute>
32 <xsl:attribute name="text-align-last">justify</xsl:attribute>
33 <xsl:attribute name="padding-top">3pt</xsl:attribute>
34 <xsl:attribute name="space-before.optimum">15pt</xsl:attribute>
35</xsl:attribute-set>
36<xsl:attribute-set name="page-heading-style">
37 <xsl:attribute name="text-align">start</xsl:attribute>
38 <xsl:attribute name="font-family"><xsl:value-of select="$font"/></xsl:attribute>
39 <xsl:attribute name="font-size">10.0pt</xsl:attribute>
40 <xsl:attribute name="line-height">12pt</xsl:attribute>
41</xsl:attribute-set>
42
43<xsl:template match="Manual">
44<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
45<fo:layout-master-set>
46<!-- template set for different types of pages -->
47<!-- the first page template -->
48<fo:simple-page-master master-name="first" page-height="29.7cm" page-width="21cm" margin-top="1cm" margin-bottom="2cm" margin-left="2.5cm" margin-right="2.5cm">
49<fo:region-start extent="1cm"/>
50<fo:region-body margin-top="2cm" margin-left="2cm"/>
51<fo:region-before precedence="true" extent="2cm"/>
52<fo:region-after extent="1.5cm"/>
53</fo:simple-page-master>
54
55<!-- the preface page template -->
56<fo:simple-page-master master-name="preface" page-height="29.7cm" page-width="21cm" margin-top="1cm" margin-bottom="2cm" margin-left="2.5cm" margin-right="2.5cm">
57<fo:region-body margin-top="2cm"/>
58<fo:region-before extent="2cm"/>
59<fo:region-after extent="1.5cm"/>
60</fo:simple-page-master>
61
62<!-- the acknowledgements page template -->
63<fo:simple-page-master master-name="acknowledgements" page-height="29.7cm" page-width="21cm"
64margin-top="1cm" margin-bottom="2cm" margin-left="2.5cm" margin-right="2.5cm">
65<fo:region-body margin-top="2cm"/>
66<fo:region-before extent="2cm"/>
67<fo:region-after extent="1.5cm"/>
68</fo:simple-page-master>
69
70<!-- the table of content page template -->
71<fo:simple-page-master master-name="ToC" page-height="29.7cm" page-width="21cm" margin-top="1cm" margin-bottom="2cm" margin-left="2.5cm" margin-right="2.5cm">
72<fo:region-body margin-top="2cm"/>
73<fo:region-before extent="2cm"/>
74<fo:region-after extent="1.5cm"/>
75</fo:simple-page-master>
76
77<!-- the document page template -->
78<fo:simple-page-master master-name="document" page-height="29.7cm" page-width="21cm" margin-top="1cm" margin-bottom="2cm" margin-left="2.5cm" margin-right="2.5cm">
79<fo:region-body margin-top="2cm"/>
80<fo:region-before extent="2cm" precedence="true" display-align="after"/>
81<fo:region-after extent="1.5cm"/>
82</fo:simple-page-master>
83</fo:layout-master-set>
84
85
86
87<!-- Cover Page-->
88
89<fo:page-sequence master-reference="first">
90<fo:static-content flow-name="xsl-region-start">
91<!-- left banner image -->
92<fo:block-container height="29cm" width="2cm" left="0cm" top="0cm">
93<fo:block><!--<fo:external-graphic src="url('Install_files/image001.jpg')" height="29cm"/>--></fo:block>
94</fo:block-container>
95</fo:static-content>
96<fo:flow flow-name="xsl-region-body">
97<xsl:apply-templates select="Heading/Text" mode="heading"/>
98<xsl:apply-templates select="Title"/>
99<xsl:apply-templates select="Author"/>
100<xsl:apply-templates select="Affiliation"/>
101<xsl:apply-templates select="Text"/>
102<xsl:apply-templates select="Comment"/>
103<xsl:apply-templates select="Version"/>
104</fo:flow>
105</fo:page-sequence>
106
107
108
109<!-- Preface -->
110<fo:page-sequence master-reference="preface">
111<fo:flow flow-name="xsl-region-body"><xsl:for-each select="Section[not(@id='acknowledgements')]"><xsl:apply-templates/></xsl:for-each></fo:flow>
112</fo:page-sequence>
113<!-- Start a new page for acknowledgement -->
114<fo:page-sequence master-reference="acknowledgements">
115<fo:flow flow-name="xsl-region-body"><xsl:apply-templates select="Section[@id='acknowledgements']"/></fo:flow>
116</fo:page-sequence>
117
118
119<!-- ToC Page -->
120<fo:page-sequence master-reference="ToC">
121<fo:flow flow-name="xsl-region-body">
122<fo:block xsl:use-attribute-sets="toc-heading-style">Contents</fo:block>
123<xsl:for-each select="Chapter">
124 <xsl:variable name="show_number">
125 <xsl:if test="starts-with(@id, 'appendix') or starts-with(@id, 'biblio')">n</xsl:if>
126 <xsl:if test="not(starts-with(@id, 'appendix')) and not(starts-with(@id, 'biblio'))">y</xsl:if>
127 </xsl:variable>
128 <fo:block xsl:use-attribute-sets="toc-chapter-style">
129 <fo:basic-link color="black" internal-destination="Chapter_{@id}">
130 <xsl:if test="$show_number='y'"><xsl:number/>&#160;&#160;</xsl:if>
131 <xsl:apply-templates select="Title/Text"/>
132 <fo:leader leader-pattern="space"/>
133 <fo:page-number-citation ref-id="Chapter_{@id}"/>
134 </fo:basic-link>
135 </fo:block>
136 <xsl:for-each select="Content/Section">
137 <fo:block xsl:use-attribute-sets="toc-section-style">
138 <fo:basic-link color="black" internal-destination="Section_{@id}">
139 <xsl:if test="$show_number='y'"><xsl:number level="multiple" count="Chapter|Chapter/Content/Section" format="1.1"/>&#160;&#160;</xsl:if>
140 <xsl:apply-templates select="Title/Text"/>
141 <fo:leader leader-pattern="space"/>
142 <fo:page-number-citation ref-id="Section_{@id}"/>
143 </fo:basic-link>
144 <xsl:for-each select="Content/Subsection"><xsl:call-template name="SubsectionLink"/></xsl:for-each>
145 </fo:block>
146 </xsl:for-each>
147</xsl:for-each>
148
149<!-- GNUFDL -->
150<fo:block xsl:use-attribute-sets="toc-chapter-style">
151<fo:basic-link color="black" internal-destination="{$licence/@id}"><xsl:apply-templates select="$licence/Title/Text"/>
152 <fo:leader leader-pattern="space"/><fo:page-number-citation ref-id="{$licence/@id}"/>
153</fo:basic-link>
154</fo:block>
155
156<!-- figure and table lists -->
157<!--
158<xsl:if test="not(count(//Figure[not(normalize-space(Title/Text)='')])=0)">
159<fo:block break-before="page" space-before.optimum="50pt" space-after.optimum="15pt" font-size="15pt" font-weight="bold">Figures</fo:block>
160<xsl:for-each select="//Figure">
161<fo:block text-align="start" font-size="10.0pt" font-weight="bold" text-align-last="justify">
162<fo:basic-link color="black" internal-destination="Figure_{@id}">
163<xsl:apply-templates select="Title/Text"/>
164<fo:leader leader-pattern="space"/>
165<fo:page-number-citation ref-id="Figure_{@id}"/>
166</fo:basic-link>
167</fo:block>
168</xsl:for-each>
169</xsl:if>
170<xsl:if test="not(count(//Table[not(normalize-space(Title/Text)='')])=0)">
171<fo:block break-before="page" space-before.optimum="50pt" space-after.optimum="15pt" font-size="15pt" font-weight="bold">Tables</fo:block>
172<xsl:for-each select="//Table[not(@class='hidden')]">
173<fo:block text-align="start" font-size="10.0pt" font-weight="bold" text-align-last="justify">
174<fo:basic-link color="black" internal-destination="Table_{@id}">
175<xsl:apply-templates select="Title/Text"/>
176<fo:leader leader-pattern="space"/>
177<fo:page-number-citation ref-id="Table_{@id}"/>
178</fo:basic-link>
179</fo:block>
180</xsl:for-each>
181</xsl:if>
182-->
183</fo:flow>
184</fo:page-sequence>
185
186
187<!-- Document -->
188<fo:page-sequence master-reference="document" initial-page-number="1">
189<!-- defines header of a page -->
190<fo:static-content flow-name="xsl-region-before">
191<xsl:variable name="pageno"><fo:page-number/></xsl:variable>
192<xsl:choose>
193<xsl:when test="$pageno='1'"><!--<fo:block-container height="1cm" width="18cm" left="0cm" top="0cm" display-align="after"><fo:block text-align="start" font-size="10pt" font-family="{$font}" line-height="14pt">greenstone.org<fo:external-graphic src="url('_files/header.gif')"/></fo:block></fo:block-container>--></xsl:when>
194<xsl:otherwise><fo:block-container height="1cm" width="18cm" left="0cm" top="0cm" display-align="after"><fo:block xsl:use-attribute-sets="page-heading-style"><fo:page-number/>&#160;&#160;<fo:retrieve-marker retrieve-class-name="head" retrieve-position="first-including-carryover" retrieve-boundary="page-sequence"/></fo:block></fo:block-container>
195</xsl:otherwise>
196</xsl:choose>
197</fo:static-content>
198
199<!-- footer of a page -->
200<fo:static-content flow-name="xsl-footnote-separator"><fo:block><fo:leader leader-pattern="rule" leader-length="100%" rule-style="solid" rule-thickness="0.5pt"/></fo:block></fo:static-content>
201
202<fo:flow flow-name="xsl-region-body">
203<xsl:for-each select="Chapter">
204<!-- header -->
205<fo:block xsl:use-attribute-sets="page-heading-style"><fo:marker marker-class-name="head"><xsl:value-of select="Title"/></fo:marker></fo:block>
206<xsl:apply-templates/>
207<xsl:if test="not(count(following-sibling::*[not(name()='FootnoteList')])=0)">
208<fo:block break-after="page"/>
209</xsl:if>
210</xsl:for-each>
211
212<fo:block break-after="page"/>
213
214<!-- the GNU FDL -->
215<!-- header -->
216<fo:block xsl:use-attribute-sets="page-heading-style"><fo:marker marker-class-name="head"><xsl:value-of select="$licence/Title"/></fo:marker></fo:block>
217<!-- licence content -->
218<fo:block><xsl:apply-templates select="$licence/*[not(Filename)]"/></fo:block>
219
220</fo:flow>
221</fo:page-sequence>
222</fo:root>
223</xsl:template>
224
225
226
227<xsl:template name="SubsectionLink">
228<fo:block text-align="start" font-size="10.0pt" text-align-last="justify" margin-left="25pt" padding-top="3pt">
229<fo:basic-link color="black">
230<xsl:attribute name="internal-destination">Subsection_<xsl:value-of select="@id"/></xsl:attribute>
231<xsl:apply-templates select="Title/Text"/>
232<fo:leader leader-pattern="space"/>
233<fo:page-number-citation ref-id="Subsection_{@id}"/>
234</fo:basic-link>
235</fo:block>
236</xsl:template>
237</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.