source: trunk/gsdl-documentation/manuals/processing/fo-common.xsl@ 13861

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

updated XSLs

  • Property svn:keywords set to Author Date Id Revision
File size: 24.7 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:variable name="font">
5<xsl:choose>
6<xsl:when test="//Manual[@lang='ru']">Cyrillic</xsl:when>
7<xsl:otherwise>Helvetica</xsl:otherwise>
8</xsl:choose>
9</xsl:variable>
10
11<xsl:attribute-set name="manual-title-style">
12 <xsl:attribute name="font-family"><xsl:value-of select="$font"/></xsl:attribute>
13 <xsl:attribute name="font-size">24.0pt</xsl:attribute>
14 <xsl:attribute name="line-height">24pt</xsl:attribute>
15 <xsl:attribute name="space-after.optimum">25pt</xsl:attribute>
16 <xsl:attribute name="text-align">right</xsl:attribute>
17 <xsl:attribute name="padding-top">3pt</xsl:attribute>
18</xsl:attribute-set>
19
20<xsl:attribute-set name="chapter-title-number">
21 <xsl:attribute name="font-family"><xsl:value-of select="$font"/></xsl:attribute>
22 <xsl:attribute name="font-size">24.0pt</xsl:attribute>
23 <xsl:attribute name="line-height">24pt</xsl:attribute>
24 <xsl:attribute name="text-align">right</xsl:attribute>
25 <xsl:attribute name="padding-top">3pt</xsl:attribute>
26</xsl:attribute-set>
27
28<xsl:attribute-set name="chapter-title-text">
29 <xsl:attribute name="font-family"><xsl:value-of select="$font"/></xsl:attribute>
30 <xsl:attribute name="font-size">24.0pt</xsl:attribute>
31 <xsl:attribute name="line-height">24pt</xsl:attribute>
32 <xsl:attribute name="text-align">right</xsl:attribute>
33 <xsl:attribute name="padding-top">3pt</xsl:attribute>
34 <xsl:attribute name="text-indent">3cm</xsl:attribute>
35 <xsl:attribute name="keep-with-next">always</xsl:attribute>
36</xsl:attribute-set>
37
38<xsl:attribute-set name="table-title-style">
39 <xsl:attribute name="font-family"><xsl:value-of select="$font"/></xsl:attribute>
40 <xsl:attribute name="font-size">10.0pt</xsl:attribute>
41 <xsl:attribute name="font-weight">bold</xsl:attribute>
42 <xsl:attribute name="line-height">15pt</xsl:attribute>
43 <xsl:attribute name="background-color">grey</xsl:attribute>
44 <xsl:attribute name="margin-left">25pt</xsl:attribute>
45 <xsl:attribute name="space-after">3pt</xsl:attribute>
46 <xsl:attribute name="space-before.optimum">10pt</xsl:attribute>
47</xsl:attribute-set>
48
49<xsl:attribute-set name="section-title-style">
50 <xsl:attribute name="font-family"><xsl:value-of select="$font"/></xsl:attribute>
51 <xsl:attribute name="font-size">12.0pt</xsl:attribute>
52 <xsl:attribute name="padding-top">3pt</xsl:attribute>
53 <xsl:attribute name="font-weight">bold</xsl:attribute>
54 <xsl:attribute name="text-align">left</xsl:attribute>
55 <xsl:attribute name="space-before.optimum">25pt</xsl:attribute>
56</xsl:attribute-set>
57
58<xsl:attribute-set name="subsection-title-style">
59 <xsl:attribute name="font-family"><xsl:value-of select="$font"/></xsl:attribute>
60 <xsl:attribute name="font-size">10.0pt</xsl:attribute>
61 <xsl:attribute name="font-weight">bold</xsl:attribute>
62 <xsl:attribute name="text-align">left</xsl:attribute>
63</xsl:attribute-set>
64
65<xsl:attribute-set name="codeline-in-table-style">
66 <xsl:attribute name="font-family">Courier</xsl:attribute>
67 <xsl:attribute name="font-size">8pt</xsl:attribute>
68 <xsl:attribute name="space-before.optimum">3pt</xsl:attribute>
69 <xsl:attribute name="text-align">right</xsl:attribute>
70</xsl:attribute-set>
71
72
73
74
75
76<!-- display title in different formats -->
77<xsl:template match="Title">
78<xsl:choose>
79<!-- manual title -->
80<xsl:when test="parent::Manual"><fo:block xsl:use-attribute-sets="manual-title-style"><xsl:apply-templates/></fo:block></xsl:when>
81<!-- chapter title -->
82<xsl:when test="parent::Chapter"><fo:block xsl:use-attribute-sets="chapter-title-number" id="Chapter_{../@id}"><xsl:if test="not(starts-with(@id, 'appendix')) and not(starts-with(@id, 'biblio'))"><xsl:number count="Chapter" format="1"/></xsl:if></fo:block>
83<fo:block xsl:use-attribute-sets="chapter-title-text"><xsl:apply-templates/></fo:block></xsl:when>
84<!-- sections' title, with section number -->
85<!--<xsl:when test="parent::Section and not(../Manual)"><fo:block xsl:use-attribute-sets="section-title-style" id="Section_{../@id}"><xsl:if test="not(starts-with(../../../@id, 'appendix'))"><xsl:number level="multiple" count="Chapter|Chapter/Content/Section" format="1.1"/>&#160;&#160;</xsl:if><xsl:apply-templates select="Text"/></fo:block></xsl:when>-->
86<xsl:when test="parent::Section"><fo:block xsl:use-attribute-sets="section-title-style" id="Section_{../@id}"><xsl:if test="not(starts-with(../../../@id, 'appendix')) and not(../Manual)"><xsl:number level="multiple" count="Chapter|Chapter/Content/Section" format="1.1"/>&#160;&#160;</xsl:if><xsl:apply-templates select="Text"/></fo:block></xsl:when>
87<!-- tables(not hidden) title, in grey background and with unique number -->
88<xsl:when test="parent::Table"><fo:block id="Table_{../@id}" xsl:use-attribute-sets="table-title-style">Table&#160;<xsl:number level="any" count="Table[not(@class='hidden')]"/>&#160;&#160;<xsl:apply-templates select="Text"/><xsl:value-of select="SubTitle"/></fo:block></xsl:when>
89<!-- title of subsections -->
90<xsl:when test="parent::Subsection"><fo:block xsl:use-attribute-sets="subsection-title-style" id="{../@id}" space-before.optimum="25pt"><xsl:apply-templates select="Text"/></fo:block></xsl:when>
91<!-- title of parts -->
92<xsl:when test="parent::Part"><fo:block xsl:use-attribute-sets="subsection-title-style" id="{../@id}" space-before.optimum="15pt"><xsl:apply-templates select="Text"/></fo:block></xsl:when>
93</xsl:choose>
94</xsl:template>
95
96
97<xsl:template match="Title" mode="Figure">
98<xsl:param name="no"/>
99<fo:block id="Figure_{../@id}" xsl:use-attribute-sets="table-title-style">Figure&#160;<xsl:value-of select="$no"/><xsl:if test="SubTitle"><xsl:value-of select="SubTitle"/></xsl:if>&#160;<xsl:apply-templates select="Text"/></fo:block>
100</xsl:template>
101
102
103<!-- text paragraph with various formats -->
104<xsl:attribute-set name="indented-text-style">
105 <xsl:attribute name="font-family"><xsl:value-of select="$font"/></xsl:attribute>
106 <xsl:attribute name="font-size">11.0pt</xsl:attribute>
107 <xsl:attribute name="space-before.optimum">15pt</xsl:attribute>
108 <xsl:attribute name="text-align">justify</xsl:attribute>
109 <xsl:attribute name="margin-left">35pt</xsl:attribute>
110</xsl:attribute-set>
111<xsl:attribute-set name="normal-text-style">
112 <xsl:attribute name="font-family"><xsl:value-of select="$font"/></xsl:attribute>
113 <xsl:attribute name="font-size">11.0pt</xsl:attribute>
114 <xsl:attribute name="color">black</xsl:attribute>
115 <xsl:attribute name="space-before.optimum">15pt</xsl:attribute>
116 <xsl:attribute name="text-align">justify</xsl:attribute>
117 <xsl:attribute name="margin-left">25pt</xsl:attribute>
118</xsl:attribute-set>
119<xsl:attribute-set name="normal-table-text-style">
120 <xsl:attribute name="font-family"><xsl:value-of select="$font"/></xsl:attribute>
121 <xsl:attribute name="font-size">9.0pt</xsl:attribute>
122 <xsl:attribute name="color">black</xsl:attribute>
123 <xsl:attribute name="text-align">left</xsl:attribute>
124</xsl:attribute-set>
125<xsl:template match="Text">
126<xsl:choose>
127<!-- these text display directly -->
128<xsl:when test="parent::Title|parent::Author|parent::Affiliation|parent::Version|parent::Date|parent::Bullet|parent::Footnote"><xsl:apply-templates/></xsl:when>
129<!-- text in table cells display with 11pt font size -->
130<xsl:when test="parent::th"><fo:block xsl:use-attribute-sets="normal-table-text-style"><xsl:apply-templates select="node()"/></fo:block></xsl:when>
131<!-- indented text -->
132<xsl:when test="parent::Indented"><fo:block xsl:use-attribute-sets="indented-text-style"><xsl:apply-templates/></fo:block></xsl:when>
133<!-- normal text paragraphs -->
134<xsl:otherwise><fo:block xsl:use-attribute-sets="normal-text-style"><xsl:apply-templates/></fo:block></xsl:otherwise>
135</xsl:choose>
136</xsl:template>
137
138<xsl:attribute-set name="version-text-style">
139 <xsl:attribute name="font-family"><xsl:value-of select="$font"/></xsl:attribute>
140 <xsl:attribute name="font-size">12.0pt</xsl:attribute>
141 <xsl:attribute name="color">black</xsl:attribute>
142 <xsl:attribute name="font-weight">bold</xsl:attribute>
143 <xsl:attribute name="space-before.optimum">60pt</xsl:attribute>
144 <xsl:attribute name="padding-top">3pt</xsl:attribute>
145 <xsl:attribute name="text-align-last">justify</xsl:attribute>
146 <xsl:attribute name="margin-left">25pt</xsl:attribute>
147</xsl:attribute-set>
148<xsl:template match="Version">
149<fo:block xsl:use-attribute-sets="version-text-style">
150<xsl:apply-templates/><fo:leader leader-pattern="space"/><xsl:value-of select="following-sibling::Date"/>
151</fo:block>
152</xsl:template>
153
154
155<xsl:attribute-set name="list-style">
156 <xsl:attribute name="font-family"><xsl:value-of select="$font"/></xsl:attribute>
157 <xsl:attribute name="start-indent">2cm</xsl:attribute>
158 <xsl:attribute name="provisional-distance-between-starts">12pt</xsl:attribute>
159 <xsl:attribute name="space-before.optimum">15pt</xsl:attribute>
160</xsl:attribute-set>
161<xsl:attribute-set name="contained-list-style">
162 <xsl:attribute name="font-family"><xsl:value-of select="$font"/></xsl:attribute>
163 <xsl:attribute name="start-indent">3cm</xsl:attribute>
164 <xsl:attribute name="provisional-distance-between-starts">12pt</xsl:attribute>
165 <xsl:attribute name="space-before.optimum">5pt</xsl:attribute>
166</xsl:attribute-set>
167<xsl:template match="BulletList">
168<xsl:if test="not(parent::Bullet)">
169<fo:list-block xsl:use-attribute-sets="list-style">
170<xsl:for-each select="Bullet">
171<fo:list-item><fo:list-item-label end-indent="label-end()">
172<fo:block><fo:inline font-family="Symbol">&#x2022;</fo:inline></fo:block>
173</fo:list-item-label>
174<fo:list-item-body start-indent="body-start()">
175<fo:block><xsl:apply-templates/></fo:block>
176
177<!-- if contains a child BulletList node -->
178<xsl:if test="BulletList">
179<xsl:for-each select="BulletList">
180<fo:list-block xsl:use-attribute-sets="contained-list-style">
181<xsl:for-each select="Bullet">
182<fo:list-item><fo:list-item-label end-indent="label-end()">
183<fo:block><fo:inline font-family="Symbol">&#x2022;</fo:inline></fo:block>
184</fo:list-item-label>
185<fo:list-item-body start-indent="body-start()">
186<fo:block><xsl:apply-templates/></fo:block>
187</fo:list-item-body>
188</fo:list-item>
189</xsl:for-each>
190</fo:list-block>
191</xsl:for-each>
192</xsl:if>
193</fo:list-item-body></fo:list-item></xsl:for-each></fo:list-block></xsl:if>
194</xsl:template>
195
196
197<xsl:attribute-set name="contained-number-list-style">
198 <xsl:attribute name="font-family"><xsl:value-of select="$font"/></xsl:attribute>
199 <xsl:attribute name="start-indent">3cm</xsl:attribute>
200 <xsl:attribute name="provisional-distance-between-starts">12pt</xsl:attribute>
201 <xsl:attribute name="space-before.optimum">15pt</xsl:attribute>
202 <xsl:attribute name="space-after.optimum">15pt</xsl:attribute>
203</xsl:attribute-set>
204<xsl:template match="NumberedList">
205<fo:list-block xsl:use-attribute-sets="list-style">
206<xsl:for-each select="NumberedItem">
207<fo:list-item><fo:list-item-label end-indent="label-end()">
208<fo:block><fo:inline font-family="Symbol"><xsl:number/>.</fo:inline></fo:block>
209</fo:list-item-label>
210<fo:list-item-body start-indent="body-start()">
211<xsl:choose>
212<!-- does not contain child (indented) Text or CodeLines -->
213<xsl:when test="(count(Text)+count(CodeLine))=1">
214<fo:block><xsl:apply-templates select="Text/node()"/></fo:block>
215</xsl:when>
216
217<!-- contains child (indented) Text or CodeLines -->
218<xsl:otherwise>
219<fo:block><xsl:apply-templates select="Text[1]/node()"/></fo:block>
220<fo:list-block xsl:use-attribute-sets="contained-number-list-style">
221<xsl:for-each select="child::*[position()>1]">
222<fo:list-item><fo:list-item-label end-indent="label-end()"><fo:block/></fo:list-item-label>
223<fo:list-item-body><fo:block><xsl:apply-templates/></fo:block></fo:list-item-body>
224</fo:list-item>
225</xsl:for-each>
226</fo:list-block>
227</xsl:otherwise>
228</xsl:choose>
229</fo:list-item-body>
230</fo:list-item>
231</xsl:for-each>
232</fo:list-block>
233</xsl:template>
234
235
236
237<xsl:template match="CodeLine">
238<fo:block font-size="8.0pt" font-family="Courier" color="black" text-align="left">
239<xsl:choose>
240<xsl:when test="parent::NumberedItem or parent::Bullet"/>
241<!-- normal code lines -->
242<xsl:when test="not(parent::Figure) and not(parent::th)">
243<xsl:attribute name="margin-left">50pt</xsl:attribute>
244<xsl:if test="not(name(preceding-sibling::*[position()=1])='CodeLine')">
245<xsl:attribute name="space-before.optimum">8pt</xsl:attribute>
246</xsl:if>
247</xsl:when>
248
249<!-- codeline in a hidden table -->
250<xsl:when test="parent::th and ../../../../@class='hidden'">
251<xsl:attribute name="margin-left">10pt</xsl:attribute>
252<xsl:attribute name="space-before.optimum">8pt</xsl:attribute>
253<xsl:attribute name="space-after.optimum">8pt</xsl:attribute>
254</xsl:when>
255<!-- normal table -->
256<xsl:otherwise>
257<xsl:if test="not(parent::th)">
258<xsl:attribute name="space-before.optimum">3pt</xsl:attribute>
259</xsl:if>
260</xsl:otherwise>
261</xsl:choose>
262
263<xsl:apply-templates/>
264</fo:block>
265
266<!--
267<xsl:param name="withLineNumber">n</xsl:param>
268<xsl:choose>
269<xsl:when test="not(parent::Figure) and not(parent::th)">
270<fo:block font-size="8.0pt" font-family="Courier" color="black" text-align="left" margin-left="50pt">
271<xsl:if test="not(name(preceding-sibling::*[position()=1])='CodeLine')">
272<xsl:attribute name="space-before.optimum">8pt</xsl:attribute>
273</xsl:if>
274<xsl:apply-templates/>
275</fo:block>
276</xsl:when>
277
278<xsl:when test="parent::th and ../../../../@class='hidden'">
279<fo:block font-size="8.0pt" font-family="Courier" color="black"
280text-align="left" margin-left="10pt" space-before.optimum="8pt" space-after.optimum="8pt">
281<xsl:apply-templates/>
282</fo:block>
283</xsl:when>
284
285<xsl:otherwise>
286<fo:block font-size="8.0pt" font-family="Courier" color="black" text-align="left">
287<xsl:if test="not(parent::th)">
288<xsl:attribute name="space-before.optimum">3pt</xsl:attribute>
289</xsl:if>
290<xsl:if test="$withLineNumber='y'"><xsl:number/></xsl:if>
291<xsl:apply-templates/>
292</fo:block>
293</xsl:otherwise>
294</xsl:choose>
295-->
296</xsl:template>
297
298
299<!-- table -->
300<xsl:attribute-set name="first-table-in-chapter-style">
301 <xsl:attribute name="space-before.optimum">30pt</xsl:attribute>
302</xsl:attribute-set>
303<xsl:template match="Table">
304<fo:table table-layout="fixed" width="100%" keep-with-previous="always">
305<xsl:if test="not(preceding-sibling::*)"><fo:block space-before.optimum="25pt"/></xsl:if>
306<fo:table-column column-width="proportional-column-width(1)"/>
307<fo:table-body>
308<!-- table title -->
309<!--
310<fo:table-row>-->
311<!-- always keep the table title with the table -->
312<!--<xsl:if test="not(normalize-space(Title/Text)='')"><xsl:attribute name="keep-with-next">always</xsl:attribute></xsl:if>
313<fo:table-cell>
314<fo:block>
315<xsl:if test="not(normalize-space(Title/Text)='')"><xsl:apply-templates select="Title"/></xsl:if>
316</fo:block>
317</fo:table-cell>
318</fo:table-row>-->
319<xsl:if test="not(normalize-space(Title/Text)='')">
320<fo:table-row keep-with-next="always"><fo:table-cell><fo:block><xsl:apply-templates select="Title"/></fo:block></fo:table-cell></fo:table-row></xsl:if>
321<!-- table content -->
322<fo:table-row>
323<fo:table-cell>
324<fo:block>
325<!-- use nested table to center-align the table -->
326<fo:table table-layout="fixed" width="100%">
327<fo:table-column column-width="25pt"/>
328<fo:table-column column-width="60pt"/>
329<fo:table-body>
330<fo:table-row>
331<fo:table-cell column-number="1"/>
332<fo:table-cell column-number="2">
333<fo:table table-layout="fixed">
334<xsl:for-each select="TableContent/tr[1]/th">
335<fo:table-column>
336<!-- calculate the column width based on the width in the original html file -->
337<xsl:attribute name="column-width">
338<xsl:value-of select="concat(number(@width) * 0.8, 'px')"/>
339</xsl:attribute>
340</fo:table-column>
341</xsl:for-each>
342<fo:table-body>
343<xsl:for-each select="TableContent/tr">
344<fo:table-row>
345<!-- the table is not at the beginning of a chapter, otherwise, it will start from a new page, doesn't look nice -->
346<xsl:if test="../../preceding-sibling::*"><xsl:attribute name="keep-with-next">always</xsl:attribute></xsl:if>
347<xsl:for-each select="th">
348<xsl:choose>
349<!-- when the cell contains only text -->
350<xsl:when test="not(../../../@class='hidden') and not(File)">
351<fo:table-cell column-number="{position()}" vertical-align="top" padding="2pt" border="0.5pt" border-color="black" border-style="solid">
352<xsl:if test="position()=1 and normalize-space(../../tr[1]/th[1])=''"><xsl:attribute name="text-align">right</xsl:attribute></xsl:if>
353<xsl:if test="position()>1 and not(last())"><xsl:attribute name="text-align">left</xsl:attribute></xsl:if>
354<xsl:if test="last()"><xsl:attribute name="text-align">justify</xsl:attribute></xsl:if>
355<xsl:apply-templates/>
356</fo:table-cell>
357</xsl:when>
358<!-- when the cell is an image -->
359<xsl:when test="not(../../../@class='hidden') and File">
360<fo:table-cell column-number="{position()}" vertical-align="top" text-align="right" padding="2pt" border="0.5pt" border-color="black" border-style="solid">
361<xsl:apply-templates/>
362</fo:table-cell>
363</xsl:when>
364<!-- deal with hidden table -->
365<xsl:when test="../../../@class='hidden'">
366<fo:table-cell column-number="{position()}" vertical-align="top" padding="2pt">
367<xsl:if test="position()=1"><xsl:attribute name="text-align">left</xsl:attribute></xsl:if>
368<xsl:if test="position()>1"><xsl:attribute name="text-align">justify</xsl:attribute></xsl:if>
369<xsl:apply-templates/>
370</fo:table-cell></xsl:when></xsl:choose></xsl:for-each></fo:table-row></xsl:for-each></fo:table-body></fo:table></fo:table-cell>
371</fo:table-row></fo:table-body></fo:table></fo:block></fo:table-cell></fo:table-row></fo:table-body></fo:table>
372</xsl:template>
373
374
375
376<!-- Figure -->
377<xsl:template match="Figure">
378<fo:table table-layout="fixed" width="100%">
379<fo:table-column column-width="proportional-column-width(1)"/>
380<fo:table-body>
381<!-- figure title -->
382<!-- number of current figure = total_number_of_previous_figure - total_number_of_previous_sub_figures-->
383<xsl:variable name="temp_total_figs"><xsl:number count="Figure" level="any"/></xsl:variable>
384<xsl:variable name="temp_num_of_sub_figs">
385 <xsl:number count="Figure[Title/SubTitle and substring(translate(@id, '_0123456789', '99999999999'), string-length(@id)-1, string-length(@id))='99']" level="any"/>
386</xsl:variable>
387<xsl:variable name="no"><xsl:value-of select="$temp_total_figs - $temp_num_of_sub_figs"/></xsl:variable>
388
389<fo:table-row keep-with-next="always"><fo:table-cell><fo:block>
390<xsl:apply-templates select="Title" mode="Figure"><xsl:with-param name="no" select="$no"/></xsl:apply-templates>
391</fo:block></fo:table-cell></fo:table-row>
392
393<fo:table-row><fo:table-cell>
394<xsl:if test="File"><xsl:apply-templates select="File"/></xsl:if>
395<xsl:if test="CodeLine">
396<fo:block text-align="left">
397<fo:table start-indent="3pt" table-layout="fixed" width="100%" border-spacing="3pt">
398<fo:table-column column-width="proportional-column-width(1)"/>
399<fo:table-column column-width="100mm"/>
400<fo:table-column column-width="proportional-column-width(1)"/>
401<fo:table-body>
402<fo:table-row>
403<fo:table-cell column-number="2">
404<xsl:if test="not(@calss='withLineNumber')">
405 <xsl:attribute name="border-width">0.1pt</xsl:attribute><xsl:attribute name="border-style">solid</xsl:attribute>
406 <xsl:attribute name="border-color">black</xsl:attribute><xsl:attribute name="border-collapse">separate</xsl:attribute>
407</xsl:if>
408
409<xsl:choose>
410<!-- display the codeline number besides each codeline using nested table -->
411<xsl:when test="@class='withLineNumber'">
412<fo:table start-indent="3pt" table-layout="fixed" width="100%" border-spacing="3pt">
413<fo:table-column column-width="28pt"/>
414<fo:table-column column-width="proportional-column-width(1)" border-width="0.1pt" border-style="solid" border-color="black" border-collapse="separate"/>
415<fo:table-body>
416<xsl:for-each select="CodeLine">
417<fo:table-row>
418<fo:table-cell column-number="1">
419<fo:block xsl:use-attribute-sets="codeline-in-table-style"><xsl:number/></fo:block>
420</fo:table-cell>
421<fo:table-cell column-number="2"><xsl:apply-templates select="."/></fo:table-cell>
422</fo:table-row>
423</xsl:for-each>
424</fo:table-body>
425</fo:table>
426</xsl:when>
427<xsl:otherwise><xsl:apply-templates select="CodeLine"/></xsl:otherwise>
428</xsl:choose></fo:table-cell></fo:table-row></fo:table-body></fo:table></fo:block></xsl:if>
429</fo:table-cell></fo:table-row></fo:table-body></fo:table>
430</xsl:template>
431
432
433
434<xsl:template match="File">
435<xsl:variable name="height"><xsl:value-of select="@height"/>em</xsl:variable>
436<xsl:variable name="width"><xsl:value-of select="@width"/>em</xsl:variable>
437<xsl:variable name="url">
438<xsl:choose>
439<xsl:when test="contains(@url, 'User_Fig_17.png') or contains(@url, 'User_Fig_18')"><xsl:value-of select="concat(substring-before(@url, '.png'), '_resized.png')"/></xsl:when>
440<xsl:otherwise><xsl:value-of select="@url"/></xsl:otherwise>
441</xsl:choose>
442</xsl:variable>
443<fo:block display-align="center" text-align="center" space-after.optimum="15pt" space-before.optimum="3pt">
444<xsl:if test="not(parent::th)"><xsl:attribute name="margin-left">25pt</xsl:attribute></xsl:if>
445<fo:external-graphic display-align="center" src="{$url}" content-height="{$height}" content-width="{$width}"/>
446</fo:block>
447</xsl:template>
448
449
450<!-- reference in the text to a footnote -->
451<xsl:template match="FootnoteRef">
452<xsl:variable name="no"><xsl:value-of select="@id"/></xsl:variable>
453<fo:footnote>
454<fo:inline baseline-shift="super" font-size="smaller">[<xsl:value-of select="$no"/>]</fo:inline>
455<fo:footnote-body>
456<fo:list-block provisional-label-separation="0pt" provisional-distance-between-starts="18pt" space-after.optimum="6pt">
457<fo:list-item>
458<fo:list-item-label end-indent="label-end()"><fo:block>[<xsl:number count="//FootnoteRef" level="any"/>]</fo:block></fo:list-item-label>
459<fo:list-item-body start-indent="body-start()"><fo:block><xsl:apply-templates select="//Footnote[@id=$no]"/></fo:block></fo:list-item-body>
460</fo:list-item>
461</fo:list-block>
462</fo:footnote-body>
463</fo:footnote>
464</xsl:template>
465
466
467<xsl:attribute-set name="bibitem-text-style">
468 <xsl:attribute name="font-family"><xsl:value-of select="$font"/></xsl:attribute>
469 <xsl:attribute name="font-size">11.0pt</xsl:attribute>
470 <xsl:attribute name="color">black</xsl:attribute>
471 <xsl:attribute name="text-align">justify</xsl:attribute>
472 <xsl:attribute name="space-before.optimum">15pt</xsl:attribute>
473 <xsl:attribute name="margin-left">25pt</xsl:attribute>
474</xsl:attribute-set>
475<xsl:template match="BibItem">
476<fo:block xsl:use-attribute-sets="bibitem-text-style"><xsl:apply-templates/></fo:block>
477</xsl:template>
478
479
480<xsl:attribute-set name="author-text-style">
481 <xsl:attribute name="font-family"><xsl:value-of select="$font"/></xsl:attribute>
482 <xsl:attribute name="font-size">15pt</xsl:attribute>
483 <xsl:attribute name="text-align">right</xsl:attribute>
484 <xsl:attribute name="space-before.optimum">25pt</xsl:attribute>
485</xsl:attribute-set>
486<xsl:template match="Author">
487<fo:block xsl:use-attribute-sets="author-text-style"><xsl:apply-templates/></fo:block>
488</xsl:template>
489
490
491<xsl:attribute-set name="affiliation-text-style">
492 <xsl:attribute name="font-family"><xsl:value-of select="$font"/></xsl:attribute>
493 <xsl:attribute name="font-size">10.0pt</xsl:attribute>
494 <xsl:attribute name="text-align">right</xsl:attribute>
495 <xsl:attribute name="space-before.optimum">25pt</xsl:attribute>
496 <xsl:attribute name="space-after.optimum">125pt</xsl:attribute>
497</xsl:attribute-set>
498<xsl:template match="Affiliation">
499<fo:block xsl:use-attribute-sets="affiliation-text-style"><xsl:apply-templates/></fo:block>
500</xsl:template>
501
502<xsl:attribute-set name="comment-text-style">
503 <xsl:attribute name="font-family"><xsl:value-of select="$font"/></xsl:attribute>
504 <xsl:attribute name="font-size">10.0pt</xsl:attribute>
505 <xsl:attribute name="text-align">right</xsl:attribute>
506 <xsl:attribute name="space-before.optimum">25pt</xsl:attribute>
507 <xsl:attribute name="margin-left">25pt</xsl:attribute>
508</xsl:attribute-set>
509<xsl:template match="Comment">
510<fo:block xsl:use-attribute-sets="comment-text-style"><xsl:apply-templates/></fo:block>
511</xsl:template>
512
513
514<xsl:attribute-set name="heading-text-style">
515 <xsl:attribute name="font-family"><xsl:value-of select="$font"/></xsl:attribute>
516 <xsl:attribute name="font-size">18.0pt</xsl:attribute>
517 <xsl:attribute name="text-align">right</xsl:attribute>
518 <xsl:attribute name="color">gray</xsl:attribute>
519</xsl:attribute-set>
520<xsl:template match="Text" mode="heading"><fo:block xsl:use-attribute-sets="heading-text-style"><xsl:apply-templates/></fo:block></xsl:template>
521
522
523<xsl:template match="text()"><xsl:value-of select="."/></xsl:template>
524<xsl:template match="br"><fo:block/></xsl:template>
525<xsl:template match="Footnote"><xsl:apply-templates/></xsl:template>
526<xsl:template match="Section"><xsl:apply-templates/></xsl:template>
527<xsl:template match="Content"><xsl:if test="contains(parent::Chapter/@id, 'appendix')"><fo:block><xsl:apply-templates/></fo:block></xsl:if><xsl:if test="not(contains(parent::Chapter/@id, 'appendix'))"><xsl:apply-templates/></xsl:if></xsl:template>
528<xsl:template match="b"><fo:inline font-weight="bold"><xsl:apply-templates/></fo:inline></xsl:template>
529<xsl:template match="i"><fo:inline font-style="italic"><xsl:apply-templates/></fo:inline></xsl:template>
530<xsl:template match="u"><fo:inline text-decoration="underline" color="blue"><xsl:apply-templates/></fo:inline></xsl:template>
531</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.