Debian Codegraph @

ru/stylesheets/tdgfo.xsl

raw symbols SCIP
1 <?xml version="1.0"?>
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:fo="http://www.w3.org/1999/XSL/Format"
4 version="1.0">
5
6 <!-- this stylesheet somewhat dangerously does its own profiling -->
7
8 <xsl:import href="/sourceforge/docbook/xsl/fo/docbook.xsl"/>
9
10 <xsl:param name="draft.watermark.image" select="''"/>
11 <xsl:param name="refentry.generate.title" select="1"/>
12 <xsl:param name="variablelist.as.blocks" select="1"/>
13 <xsl:param name="ulink.footnotes" select="1"/>
14 <xsl:param name="title.margin.left" select="'0pt'"/>
15
16 <xsl:param name="output.media" select="'print'"/>
17 <xsl:param name="output.type" select="'expanded'"/>
18 <xsl:param name="toc.section.depth" select="1"/>
19 <xsl:param name="callout.graphics.path" select="'figures/callouts/'"/>
20 <xsl:param name="refentry.generate.name" select="0"/>
21
22 <xsl:param name="generate.toc">
23 /appendix nop
24 /article nop
25 book toc,figure,table,example,equation
26 /chapter nop
27 part nop
28 /preface nop
29 qandadiv nop
30 qandaset nop
31 reference nop
32 /section nop
33 set nop
34 </xsl:param>
35
36 <xsl:param name="local.l10n.xml" select="document('')"/>
37 <l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">
38 <l:l10n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" language="en">
39 <l:context name="title-numbered">
40 <l:template name="appendix" text="%t"/>
41 <l:template name="chapter" text="%t"/>
42 </l:context>
43 </l:l10n>
44 </l:i18n>
45
46 <xsl:template match="processing-instruction('lb')">
47 <fo:block>
48 <xsl:text> </xsl:text>
49 </fo:block>
50 </xsl:template>
51
52 <xsl:template name="revision.graphic">
53 <xsl:param name="large" select="'0'"/>
54
55 <xsl:if test="@revision">
56 <xsl:choose>
57 <xsl:when test="@revision='5.0'">
58 <fo:external-graphic src="figures/100dpi/rev_5.0.png"/>
59 </xsl:when>
60 <xsl:when test="@revision='4.2'">
61 <fo:external-graphic src="figures/100dpi/rev_4.2.png"/>
62 </xsl:when>
63 <xsl:when test="@revision='4.0'">
64 <fo:external-graphic src="figures/100dpi/rev_4.0.png"/>
65 </xsl:when>
66 <xsl:when test="@revision='3.1'">
67 <!-- nop; 3.1 isn't interesting anymore -->
68 </xsl:when>
69 <xsl:when test="@revision='EBNF'">
70 <fo:external-graphic src="figures/100dpi/rev_ebnf.png"/>
71 </xsl:when>
72 <xsl:when test="@revision='SVG'">
73 <fo:external-graphic src="figures/100dpi/rev_svg.png"/>
74 </xsl:when>
75 <xsl:when test="@revision='MathML'">
76 <fo:external-graphic src="figures/100dpi/rev_mathml.png"/>
77 </xsl:when>
78 <xsl:when test="@revision='HTMLForms'">
79 <fo:external-graphic src="figures/100dpi/rev_htmlforms.png"/>
80 </xsl:when>
81 <xsl:otherwise>
82 <xsl:message>
83 <xsl:text>Unexpected revision '</xsl:text>
84 <xsl:value-of select="@revision"/>
85 <xsl:text>' on </xsl:text>
86 <xsl:value-of select="local-name(.)"/>
87 </xsl:message>
88 </xsl:otherwise>
89 </xsl:choose>
90 </xsl:if>
91 </xsl:template>
92
93 <xsl:template match="para">
94 <xsl:if test="not(@condition)
95 or (@condition = $output.media)">
96 <fo:block xsl:use-attribute-sets="normal.para.spacing">
97 <xsl:if test="@id">
98 <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
99 </xsl:if>
100 <xsl:call-template name="revision.graphic"/>
101 <xsl:apply-templates/>
102 </fo:block>
103 </xsl:if>
104 </xsl:template>
105
106 <xsl:template match="footnote/para[1]">
107 <xsl:apply-imports/>
108 </xsl:template>
109
110 <xsl:template match="phrase">
111 <xsl:if test="not(@condition)
112 or (@condition = $output.media)">
113 <xsl:apply-imports/>
114 </xsl:if>
115 </xsl:template>
116
117 <xsl:template match="ulink">
118 <xsl:choose>
119 <xsl:when test="not(@condition)
120 or (@condition = $output.media)">
121 <xsl:apply-imports/>
122 </xsl:when>
123 <xsl:otherwise>
124 <xsl:apply-templates/>
125 </xsl:otherwise>
126 </xsl:choose>
127 </xsl:template>
128
129 <xsl:template match="anchor[@role='HACK-ex.out.start']">
130 <!-- FIXME: -->
131 </xsl:template>
132
133 <xsl:template match="anchor[@role='HACK-ex.out.end']">
134 <!-- FIXME: -->
135 </xsl:template>
136
137 <xsl:template match="title" mode="book.titlepage.recto.mode">
138 <fo:block font-size="24.8832pt" fo:font-family="{$title.font.family}">
139 <xsl:apply-templates/>
140 <xsl:apply-templates select="../subtitle[1]"
141 mode="book.titlepage.recto.mode"/>
142 </fo:block>
143 </xsl:template>
144
145 <xsl:template match="subtitle" mode="book.titlepage.recto.mode">
146 <xsl:text>: </xsl:text>
147 <xsl:apply-templates/>
148 </xsl:template>
149
150 <!-- ============================================================ -->
151
152 <!-- FIXME:
153 <xsl:template match="informaltable">
154 <xsl:choose>
155 <xsl:when test="@role='elemsynop'">
156 ...
157 -->
158
159 <!-- ============================================================ -->
160
161 <!-- FIXME:
162 <xsl:template name="titlepage-block">
163 ...
164 -->
165
166 <!-- ============================================================ -->
167
168 <!-- FIXME: make link -->
169 <xsl:template match="sgmltag">
170 <xsl:variable name="class">
171 <xsl:choose>
172 <xsl:when test="@class">
173 <xsl:value-of select="@class"/>
174 </xsl:when>
175 <xsl:otherwise>element</xsl:otherwise>
176 </xsl:choose>
177 </xsl:variable>
178
179 <xsl:choose>
180 <xsl:when test="$class = 'element'
181 and count(id(concat(.,'.element'))) &gt; 0">
182 <xsl:variable name="targets" select="id(concat(.,'.element'))"/>
183 <xsl:variable name="target" select="$targets[1]"/>
184
185 <xsl:apply-imports/>
186
187 </xsl:when>
188 <xsl:when test="$class = 'paramentity'
189 and count(id(concat(.,'.parament'))) &gt; 0">
190 <xsl:variable name="targets" select="id(concat(.,'.parament'))"/>
191 <xsl:variable name="target" select="$targets[1]"/>
192
193 <xsl:apply-imports/>
194
195 </xsl:when>
196 <xsl:otherwise>
197 <xsl:apply-imports/>
198 </xsl:otherwise>
199 </xsl:choose>
200 </xsl:template>
201
202 <!-- ============================================================ -->
203 <!-- Reference Entries -->
204
205 <xsl:template match="refnamediv">
206 <fo:block>
207 <xsl:choose>
208 <xsl:when test="$refentry.generate.name != 0">
209 <fo:block xsl:use-attribute-sets="refentry.title.properties">
210 <xsl:call-template name="gentext">
211 <xsl:with-param name="key" select="'RefName'"/>
212 </xsl:call-template>
213 </fo:block>
214 </xsl:when>
215
216 <xsl:when test="$refentry.generate.title != 0">
217 <fo:block xsl:use-attribute-sets="refentry.title.properties">
218 <xsl:choose>
219 <xsl:when test="../refmeta/refentrytitle">
220 <xsl:apply-templates select="../refmeta/refentrytitle"/>
221 </xsl:when>
222 <xsl:otherwise>
223 <xsl:apply-templates select="refname[1]"/>
224 </xsl:otherwise>
225 </xsl:choose>
226 </fo:block>
227 </xsl:when>
228 </xsl:choose>
229
230 <fo:block>
231 <xsl:choose>
232 <xsl:when test="../refmeta/refentrytitle">
233 <xsl:apply-templates select="../refmeta/refentrytitle"/>
234 </xsl:when>
235 <xsl:otherwise>
236 <xsl:apply-templates select="refname[1]"/>
237 </xsl:otherwise>
238 </xsl:choose>
239 <xsl:apply-templates select="refpurpose"/>
240 </fo:block>
241 </fo:block>
242 </xsl:template>
243
244 <!-- ============================================================ -->
245
246 <xsl:template match="informaltable">
247 <xsl:choose>
248 <xsl:when test="@role='elemsynop'">
249 <xsl:apply-templates select=".//row" mode="elemsynop"/>
250 </xsl:when>
251 <xsl:otherwise>
252 <xsl:apply-imports/>
253 </xsl:otherwise>
254 </xsl:choose>
255 </xsl:template>
256
257 <xsl:attribute-set name="synop.table.title.properties">
258 <xsl:attribute name="font-family">
259 <xsl:value-of select="$title.font.family"/>
260 </xsl:attribute>
261 <xsl:attribute name="font-weight">normal</xsl:attribute>
262 <xsl:attribute name="font-size">11pt</xsl:attribute>
263 <xsl:attribute name="space-before">1em</xsl:attribute>
264 </xsl:attribute-set>
265
266 <xsl:template match="row" mode="elemsynop">
267 <xsl:variable name="entry" select="entry[1]"/>
268 <xsl:variable name="entry2" select="entry[2]"/>
269
270 <xsl:choose>
271 <xsl:when test="@role = 'cmtitle'">
272 <fo:block xsl:use-attribute-sets="synop.table.title.properties"
273 space-before="5pt">
274 <xsl:apply-templates select="$entry/*"/>
275 </fo:block>
276 </xsl:when>
277 <xsl:when test="@role = 'cmsynop'">
278 <xsl:apply-templates select="$entry/*"/>
279 </xsl:when>
280 <xsl:when test="@role = 'incltitle'">
281 <fo:block xsl:use-attribute-sets="synop.table.title.properties">
282 <xsl:apply-templates select="$entry/*"/>
283 </fo:block>
284 </xsl:when>
285 <xsl:when test="@role = 'inclsynop'">
286 <xsl:apply-templates select="$entry/*"/>
287 </xsl:when>
288 <xsl:when test="@role = 'excltitle'">
289 <fo:block xsl:use-attribute-sets="synop.table.title.properties">
290 <xsl:apply-templates select="$entry/*"/>
291 </fo:block>
292 </xsl:when>
293 <xsl:when test="@role = 'exclsynop'">
294 <xsl:apply-templates select="$entry/*"/>
295 </xsl:when>
296 <xsl:when test="@role = 'attrtitle'">
297 <fo:block xsl:use-attribute-sets="synop.table.title.properties">
298 <xsl:apply-templates select="$entry/*"/>
299 </fo:block>
300 <fo:block>
301 <xsl:apply-templates select="$entry2/*"/>
302 </fo:block>
303 </xsl:when>
304 <xsl:when test="@role = 'attrheader'">
305 <xsl:variable name="attrrows" select="../row[@role='attr']"/>
306 <fo:table space-before="5pt">
307 <fo:table-body>
308 <fo:table-row>
309 <xsl:apply-templates select="entry[1]">
310 <xsl:with-param name="spans">
311 <xsl:call-template name="blank.spans">
312 <xsl:with-param name="cols" select="3"/>
313 </xsl:call-template>
314 </xsl:with-param>
315 </xsl:apply-templates>
316 </fo:table-row>
317 <xsl:for-each select="$attrrows">
318 <fo:table-row>
319 <xsl:apply-templates select="entry[1]">
320 <xsl:with-param name="spans">
321 <xsl:call-template name="blank.spans">
322 <xsl:with-param name="cols" select="3"/>
323 </xsl:call-template>
324 </xsl:with-param>
325 </xsl:apply-templates>
326 </fo:table-row>
327 </xsl:for-each>
328 </fo:table-body>
329 </fo:table>
330 </xsl:when>
331 <xsl:when test="@role = 'attr'">
332 <!-- nop -->
333 </xsl:when>
334 <xsl:when test="@role = 'tmtitle'">
335 <fo:block xsl:use-attribute-sets="synop.table.title.properties">
336 <xsl:apply-templates select="$entry/*"/>
337 </fo:block>
338 </xsl:when>
339 <xsl:when test="@role = 'tmsynop'">
340 <xsl:apply-templates select="$entry/*"/>
341 </xsl:when>
342 <xsl:when test="@role = 'petitle'">
343 <xsl:if test="$output.type = 'unexpanded'">
344 <xsl:variable name="attrrows" select="../row[@role='pe']"/>
345 <fo:block xsl:use-attribute-sets="synop.table.title.properties">
346 <xsl:apply-templates select="$entry/*"/>
347 </fo:block>
348
349 <fo:block>
350 <xsl:text>The following parameter entities contain </xsl:text>
351 <xsl:value-of select="ancestor::refentry/refnamediv/refname"/>
352 <xsl:text>:</xsl:text>
353 </fo:block>
354
355 <fo:table>
356 <fo:table-body>
357 <fo:table-row>
358 <xsl:apply-templates select="entry[1]">
359 <xsl:with-param name="spans">
360 <xsl:call-template name="blank.spans">
361 <xsl:with-param name="cols" select="3"/>
362 </xsl:call-template>
363 </xsl:with-param>
364 </xsl:apply-templates>
365 </fo:table-row>
366 <xsl:for-each select="$attrrows">
367 <fo:table-row>
368 <xsl:apply-templates select="entry[1]">
369 <xsl:with-param name="spans">
370 <xsl:call-template name="blank.spans">
371 <xsl:with-param name="cols" select="3"/>
372 </xsl:call-template>
373 </xsl:with-param>
374 </xsl:apply-templates>
375 </fo:table-row>
376 </xsl:for-each>
377 </fo:table-body>
378 </fo:table>
379 </xsl:if>
380 </xsl:when>
381 <xsl:when test="@role = 'pe'">
382 <!-- nop -->
383 </xsl:when>
384 <xsl:when test="@role = 'vle-pe'">
385 <!-- nop -->
386 </xsl:when>
387 <xsl:when test="@role = 'vle-el'">
388 <!-- nop -->
389 </xsl:when>
390 <xsl:when test="@role = 'vle-iel'">
391 <!-- nop -->
392 </xsl:when>
393 <xsl:when test="@role = 'vle-petitle'">
394 <xsl:variable name="attrrows" select="../row[@role='vle-pe']"/>
395 <fo:block xsl:use-attribute-sets="synop.table.title.properties">
396 <xsl:apply-templates select="$entry/*"/>
397 </fo:block>
398 <fo:table>
399 <fo:table-body>
400 <fo:table-row>
401 <xsl:apply-templates select="entry[1]">
402 <xsl:with-param name="spans">
403 <xsl:call-template name="blank.spans">
404 <xsl:with-param name="cols" select="3"/>
405 </xsl:call-template>
406 </xsl:with-param>
407 </xsl:apply-templates>
408 </fo:table-row>
409 <xsl:for-each select="$attrrows">
410 <fo:table-row>
411 <xsl:apply-templates select="entry[1]">
412 <xsl:with-param name="spans">
413 <xsl:call-template name="blank.spans">
414 <xsl:with-param name="cols" select="3"/>
415 </xsl:call-template>
416 </xsl:with-param>
417 </xsl:apply-templates>
418 </fo:table-row>
419 </xsl:for-each>
420 </fo:table-body>
421 </fo:table>
422 </xsl:when>
423 <xsl:when test="@role = 'vle-eltitle'">
424 <xsl:variable name="attrrows" select="../row[@role='vle-el']"/>
425 <fo:block xsl:use-attribute-sets="synop.table.title.properties">
426 <xsl:apply-templates select="$entry/*"/>
427 </fo:block>
428 <fo:table>
429 <fo:table-body>
430 <fo:table-row>
431 <xsl:apply-templates select="entry[1]">
432 <xsl:with-param name="spans">
433 <xsl:call-template name="blank.spans">
434 <xsl:with-param name="cols" select="3"/>
435 </xsl:call-template>
436 </xsl:with-param>
437 </xsl:apply-templates>
438 </fo:table-row>
439 <xsl:for-each select="$attrrows">
440 <fo:table-row>
441 <xsl:apply-templates select="entry[1]">
442 <xsl:with-param name="spans">
443 <xsl:call-template name="blank.spans">
444 <xsl:with-param name="cols" select="3"/>
445 </xsl:call-template>
446 </xsl:with-param>
447 </xsl:apply-templates>
448 </fo:table-row>
449 </xsl:for-each>
450 </fo:table-body>
451 </fo:table>
452 </xsl:when>
453 <xsl:when test="@role = 'vle-ieltitle'">
454 <xsl:variable name="attrrows" select="../row[@role='vle-iel']"/>
455 <fo:block xsl:use-attribute-sets="synop.table.title.properties">
456 <xsl:apply-templates select="$entry/*"/>
457 </fo:block>
458 <fo:table>
459 <fo:table-body>
460 <fo:table-row>
461 <xsl:apply-templates select="entry[1]">
462 <xsl:with-param name="spans">
463 <xsl:call-template name="blank.spans">
464 <xsl:with-param name="cols" select="3"/>
465 </xsl:call-template>
466 </xsl:with-param>
467 </xsl:apply-templates>
468 </fo:table-row>
469 <xsl:for-each select="$attrrows">
470 <fo:table-row>
471 <xsl:apply-templates select="entry[1]">
472 <xsl:with-param name="spans">
473 <xsl:call-template name="blank.spans">
474 <xsl:with-param name="cols" select="3"/>
475 </xsl:call-template>
476 </xsl:with-param>
477 </xsl:apply-templates>
478 </fo:table-row>
479 </xsl:for-each>
480 </fo:table-body>
481 </fo:table>
482 </xsl:when>
483 <xsl:when test="@role = 'vle-cmtitle'">
484 <fo:block xsl:use-attribute-sets="synop.table.title.properties">
485 <xsl:text>Parameter entity content:</xsl:text>
486 </fo:block>
487 </xsl:when>
488 </xsl:choose>
489 </xsl:template>
490
491 <!-- ============================================================ -->
492
493 <xsl:template name="component.title">
494 <xsl:param name="node" select="."/>
495 <xsl:param name="pagewide" select="0"/>
496 <xsl:variable name="id">
497 <xsl:call-template name="object.id">
498 <xsl:with-param name="object" select="$node"/>
499 </xsl:call-template>
500 </xsl:variable>
501 <xsl:variable name="title">
502 <xsl:apply-templates select="$node" mode="object.title.markup">
503 <xsl:with-param name="allow-anchors" select="1"/>
504 </xsl:apply-templates>
505 </xsl:variable>
506
507 <xsl:if test="$passivetex.extensions != 0">
508 <fotex:bookmark xmlns:fotex="http://www.tug.org/fotex"
509 fotex-bookmark-level="2"
510 fotex-bookmark-label="{$id}">
511 <xsl:value-of select="$title"/>
512 </fotex:bookmark>
513 </xsl:if>
514
515 <fo:block text-align="right" font-size="100pt">
516 <xsl:apply-templates select="$node" mode="label.markup">
517 <xsl:with-param name="allow-anchors" select="1"/>
518 </xsl:apply-templates>
519 </fo:block>
520
521 <fo:block keep-with-next.within-column="always"
522 hyphenate="false"
523 text-align="right">
524 <xsl:if test="$pagewide != 0">
525 <xsl:attribute name="span">all</xsl:attribute>
526 </xsl:if>
527 <xsl:copy-of select="$title"/>
528 </fo:block>
529 </xsl:template>
530
531 <!-- ============================================================ -->
532
533 <xsl:template match="*" mode="running.foot.mode">
534 <xsl:param name="master-reference" select="'unknown'"/>
535
536 <xsl:variable name="foot">
537 <fo:page-number/>
538 </xsl:variable>
539
540 <xsl:choose>
541 <xsl:when test="$master-reference='titlepage1'">
542 <fo:static-content flow-name="xsl-region-after-first">
543 <fo:block text-align="center" font-size="{$body.font.size}">
544 <xsl:text>This is an </xsl:text>
545 <fo:inline font-style="italic">alpha</fo:inline>
546 <xsl:text> version of this book.</xsl:text>
547 </fo:block>
548 </fo:static-content>
549 </xsl:when>
550 <xsl:when test="$master-reference='oneside1'">
551 <fo:static-content flow-name="xsl-region-after-first">
552 <fo:block text-align="center" font-size="{$body.font.size}">
553 <xsl:text>This is an </xsl:text>
554 <fo:inline font-style="italic">alpha</fo:inline>
555 <xsl:text> version of this book.</xsl:text>
556 </fo:block>
557 </fo:static-content>
558 <fo:static-content flow-name="xsl-region-after">
559 <fo:block text-align-last="justify" font-size="{$body.font.size}">
560 <fo:inline keep-with-next.within-line="always">
561 <xsl:text>This is an </xsl:text>
562 <fo:inline font-style="italic">alpha</fo:inline>
563 <xsl:text> version of this book.</xsl:text>
564 </fo:inline>
565 <fo:inline keep-together.within-line="always">
566 <xsl:text> </xsl:text>
567 <fo:leader leader-pattern="space"
568 keep-with-next.within-line="always"/>
569 <xsl:text> </xsl:text>
570 <xsl:copy-of select="$foot"/>
571 </fo:inline>
572 </fo:block>
573 </fo:static-content>
574 </xsl:when>
575 <xsl:otherwise>
576 <xsl:message>
577 <xsl:text>Unexpected master-reference (</xsl:text>
578 <xsl:value-of select="$master-reference"/>
579 <xsl:text>) in running.foot.mode for </xsl:text>
580 <xsl:value-of select="name(.)"/>
581 <xsl:text>. No footer generated.</xsl:text>
582 </xsl:message>
583 </xsl:otherwise>
584 </xsl:choose>
585 </xsl:template>
586
587 <!-- ============================================================ -->
588
589 </xsl:stylesheet>