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