source: trunk/gsdl-documentation/manuals/processing/xml-to-pdf.xsl@ 13861

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

updated XSLs

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