VirtualBox

source: vbox/trunk/src/libs/dita-ot-1.8.5/plugins/legacypdf/dita2fo-shell_template.xsl@ 99507

最後變更 在這個檔案從99507是 98584,由 vboxsync 提交於 2 年 前

Docs: bugref:10302. Setting svn properties of DITA-OT library.

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 21.0 KB
 
1<?xml version="1.0" encoding="UTF-8" ?>
2<!-- This file is part of the DITA Open Toolkit project hosted on
3 Sourceforge.net. See the accompanying license.txt file for
4 applicable licenses.-->
5<!-- (c) Copyright IBM Corp. 2004, 2005 All Rights Reserved. -->
6
7<!--
8 | Composite DITA topics to FO
9
10 *-->
11
12<!DOCTYPE xsl:stylesheet [
13<!-- entities for use in the generated output (Unicode typographic glyphs) -->
14 <!ENTITY gt "&gt;">
15 <!ENTITY lt "&lt;">
16 <!ENTITY rbl "&#160;">
17 <!ENTITY nbsp "&#160;">
18 <!ENTITY quot "&#34;">
19 <!ENTITY quotedblleft "&#x201C;">
20 <!ENTITY quotedblright "&#x201D;">
21 <!ENTITY sqbull "[]">
22 <!ENTITY middot "&#x00A5;">
23
24 <!ENTITY section "&#xA7;">
25 <!ENTITY endash "&#x2013;">
26 <!ENTITY emdash "&#x2014;">
27
28 <!ENTITY copyr "&#xA9;">
29 <!ENTITY trademark "&#x2122;">
30 <!ENTITY registered "&#xAE;">
31<!-- create some fixed values for now for customizing later -->
32 <!ENTITY copyrowner "Sample Company">
33 <!ENTITY copyrdate "2001">
34 <!ENTITY headerstub "(stub for header content)">
35
36]>
37<xsl:stylesheet version="1.0"
38 xmlns:fo="http://www.w3.org/1999/XSL/Format"
39 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
40 <!-- stylesheet imports -->
41 <xsl:import href="xslfo/topic2foImpl.xsl"/>
42 <xsl:import href="xslfo/domains2fo.xsl"/>
43 <!-- XSL-FO output with XML syntax; no actual doctype for FO -->
44 <xsl:output method="xml" version="1.0" indent="yes"/>
45 <!-- CONTROL PARAMETERS: -->
46 <!-- offset -->
47 <xsl:param name="basic-start-indent">72pt</xsl:param>
48 <xsl:param name="basic-end-indent">24pt</xsl:param>
49 <xsl:param name="output-related-links" select="'no'"/>
50 <!-- GLOBALS: -->
51 <xsl:param name="dflt-ext">.jpg</xsl:param>
52 <!-- For Antenna House, set to ".jpg" -->
53 <!-- Set the prefix for error message numbers -->
54 <xsl:variable name="msgprefix">DOTX</xsl:variable>
55 <!-- =============== start of override tweaks ============== -->
56 <!-- force draft mode on all the time -->
57 <xsl:param name="DRAFT" select="'no'"/>
58 <!-- ====================== template rules for merged content ==================== -->
59 <xsl:template match="dita" mode="toplevel">
60 <xsl:call-template name="dita-setup"/>
61 </xsl:template>
62 <xsl:template match="*[contains(@class,' map/map ')]" mode="toplevel">
63 <xsl:call-template name="dita-setup"/>
64 </xsl:template>
65 <!-- note that bkinfo provides information for a cover in a bookmap application,
66 hence bkinfo does not need to be instanced. In an application that processes
67 only maps, bkinfo should process as a topic based on default processing. -->
68 <xsl:template match="*[contains(@class,' bkinfo/bkinfo ')]" priority="2">
69 <!-- no operation for bkinfo -->
70 </xsl:template>
71 <!-- =========================== overall output organization ========================= -->
72 <!-- this template rule defines the overall output organization -->
73 <xsl:template name="dita-setup">
74 <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
75 <!-- get the overall master page defs here -->
76 <xsl:call-template name="define-page-masters-dita"/>
77 <fo:bookmark-tree>
78 <!-- create FOP outline elements for PDF bookmarks -->
79 <xsl:apply-templates mode="outline"/>
80 </fo:bookmark-tree>
81 <!-- place generated content -->
82 <xsl:call-template name="front-covers"/>
83 <!--xsl:call-template name="titlepage-ednotice"/-->
84 <xsl:call-template name="generated-frontmatter"/>
85 <!-- place main content (fall through occurs here) -->
86 <xsl:call-template name="main-doc3"/>
87 <!-- return to place closing generated content -->
88 <!--xsl:call-template name="index-chapter"/-->
89 <!--xsl:call-template name="back-covers"/-->
90 </fo:root>
91 </xsl:template>
92 <!-- create FOP outline elements for PDF bookmarks -->
93 <xsl:template match="*[contains(@class,' topic/topic ')]" mode="outline">
94 <xsl:variable name="id-value">
95 <xsl:choose>
96 <xsl:when test="@id">
97 <xsl:value-of select="@id"/>
98 </xsl:when>
99 <xsl:otherwise>
100 <xsl:value-of select="generate-id()"/>
101 </xsl:otherwise>
102 </xsl:choose>
103 </xsl:variable>
104
105 <fo:bookmark>
106 <xsl:attribute name="internal-destination">
107 <!-- use id attribute node to generate anchor for PDF bookmark fix bug#1304859 -->
108 <xsl:value-of select="$id-value"/>
109 </xsl:attribute>
110 <fo:bookmark-title>
111 <!-- if topic contains navtitle, use that as label for PDF bookmark
112 otherwise, use title -->
113 <xsl:choose>
114 <xsl:when test="*[contains(@class,' topic/titlealts ')]/*[contains(@class, ' topic/navtitle ')]">
115 <xsl:apply-templates select="*[contains(@class,' topic/titlealts ')]/*[contains(@class, ' topic/navtitle ')]" mode="text-only"/>
116 </xsl:when>
117 <xsl:otherwise>
118 <xsl:apply-templates select="title" mode="text-only"/>
119 </xsl:otherwise>
120 </xsl:choose>
121 </fo:bookmark-title>
122 <xsl:apply-templates select="child::*[contains(@class,' topic/topic ')]" mode="outline" />
123 </fo:bookmark>
124 </xsl:template>
125
126 <xsl:template match="*" mode="text-only">
127 <xsl:apply-templates select="text()|*" mode="text-only"/>
128 </xsl:template>
129 <xsl:template name="define-page-masters-dita">
130 <fo:layout-master-set>
131 <!-- master set for chapter pages, first page is the title page -->
132 <fo:page-sequence-master master-name="chapter-master">
133 <fo:repeatable-page-master-alternatives>
134 <fo:conditional-page-master-reference page-position="first"
135 odd-or-even="odd" master-reference="common-page"/>
136 <!-- chapter-first-odd -->
137 <fo:conditional-page-master-reference page-position="first"
138 odd-or-even="even" master-reference="common-page"/>
139 <!--chapter-first-even"/-->
140 <fo:conditional-page-master-reference page-position="rest"
141 odd-or-even="odd" master-reference="common-page"/>
142 <!--chapter-rest-odd"/-->
143 <fo:conditional-page-master-reference page-position="rest"
144 odd-or-even="even" master-reference="common-page"/>
145 <!--chapter-rest-even"/-->
146 </fo:repeatable-page-master-alternatives>
147 </fo:page-sequence-master>
148 <fo:simple-page-master master-name="cover" xsl:use-attribute-sets="common-grid">
149 <fo:region-body margin-top="72pt"/>
150 </fo:simple-page-master>
151 <fo:simple-page-master master-name="common-page" xsl:use-attribute-sets="common-grid">
152 <fo:region-body margin-bottom="36pt" margin-top="12pt"/>
153 <fo:region-before extent="12pt"/>
154 <fo:region-after extent="24pt"/>
155 </fo:simple-page-master>
156 </fo:layout-master-set>
157 </xsl:template>
158 <xsl:template name="front-covers">
159 <!-- generate an "outside front cover" page (right side) (sheet 1) -->
160 <fo:page-sequence master-reference="cover">
161 <fo:flow flow-name="xsl-region-body">
162 <fo:block text-align="right" font-family="Helvetica">
163 <!-- set the title -->
164 <fo:block font-size="30pt" font-weight="bold" line-height="140%">
165 <xsl:choose>
166 <xsl:when test="//*[contains(@class,' bkinfo/bkinfo ')]">
167 <xsl:value-of select="//*[contains(@class,' bkinfo/bkinfo ')]/*[contains(@class,' topic/title ')]"/>
168 <!-- use the id attribute of the bkinfo element as an anchor for a PDF bookmark to the cover page -->
169 <xsl:apply-templates select="//*[contains(@class,' bkinfo/bkinfo ')]/@id"/>
170 </xsl:when>
171 <xsl:when test="@title"><xsl:value-of select="@title"/></xsl:when>
172 <xsl:otherwise><xsl:value-of select="//*/title"/></xsl:otherwise>
173 </xsl:choose>
174 </fo:block>
175 <!-- set the subtitle -->
176 <fo:block font-size="24pt" font-weight="bold" line-height="140%" margin-bottom="1in">
177 <xsl:value-of select="//*[contains(@class,' bkinfo/bkinfo ')]/*[contains(@class,' bkinfo/bktitlealts ')]/*[contains(@class,' bkinfo/bksubtitle ')]"/>
178 </fo:block>
179 <!-- place authors as a vertical list -->
180 <fo:block font-size="11pt" font-weight="bold" line-height="1.5">
181 <xsl:text>[vertical list of authors]</xsl:text>
182 </fo:block>
183 <xsl:for-each select="//author">
184 <xsl:variable name="authorid1" select="generate-id(.)"></xsl:variable>
185 <xsl:variable name="authorid2" select="generate-id(//author[.=current()])"></xsl:variable>
186 <xsl:if test="$authorid1=$authorid2">
187 <fo:block font-size="11pt" font-weight="bold" line-height="1.5">
188 [<xsl:value-of select="."></xsl:value-of>]
189 </fo:block>
190 </xsl:if>
191 </xsl:for-each>
192 <!-- set the brief copyright notice -->
193 <fo:block margin-top="3pc" font-size="11pt" font-weight="bold"
194 line-height="normal"> &copyr; &nbsp;&nbsp; Copyright
195 &nbsp;&nbsp;<xsl:value-of select="//*[contains(@class,' bkinfo/orgname ')]"/>
196 <xsl:text/>
197 <xsl:value-of
198 select="//*[contains(@class,' bkinfo/bkcopyrfirst ')]"/>,<xsl:value-of
199 select="//*[contains(@class,' bkinfo/bkcopyrlast ')]"/>. </fo:block>
200 </fo:block>
201 <!-- Custom cover art/text goes here -->
202 <xsl:call-template name="place-cover-art"/>
203 <!-- End of custom art section -->
204 </fo:flow>
205 </fo:page-sequence>
206 <!-- generate an "inside front cover" page (left side) (sheet 2) -->
207 <fo:page-sequence master-reference="cover">
208 <fo:flow flow-name="xsl-region-body">
209 <fo:block xsl:use-attribute-sets="p" color="purple" text-align="center"/>
210 </fo:flow>
211 </fo:page-sequence>
212 </xsl:template>
213 <xsl:template name="place-cover-art">
214 <!-- product specific art, etc. -->
215 <fo:block margin-top="2pc" font-family="Helvetica" border-style="dashed"
216 border-color="black" border-width="thin" padding="6pt">
217 <fo:block font-size="12pt" line-height="100%" margin-top="12pc"
218 margin-bottom="12pc" text-align="center">
219 <fo:inline color="purple" font-weight="bold">[cover art/text goes here]</fo:inline>
220 <!-- one might imbed SVG directly here for use with FOP, for instance -->
221 </fo:block>
222 </fo:block>
223 </xsl:template>
224 <!-- internal title page -->
225 <!-- edition notices -->
226 <!-- document notice data -->
227 <!-- grant of usage data -->
228 <!-- copyright info -->
229 <!-- disclaimers -->
230 <!-- redirect to notices page -->
231 <!-- definitions for placement of Front Matter content -->
232 <xsl:template name="generated-frontmatter">
233 <fo:page-sequence master-reference="common-page" format="i" initial-page-number="1">
234 <!-- Static setup for the generated pages -->
235 <!-- header -->
236 <fo:static-content flow-name="xsl-region-before">
237 <!-- SF Bug 1407646: uses the map title when it is specified.
238 If the map title is not specified, we fall back to the
239 title of the first topic. -->
240 <xsl:variable name="booktitle">
241 <xsl:choose>
242 <xsl:when test="//*[contains(@class,' bkinfo/bkinfo ')]">
243 <xsl:value-of select="//*[contains(@class,' bkinfo/bkinfo ')]/*[contains(@class,' topic/title ')]"/>
244 <!-- use the id attribute of the bkinfo element as an anchor for a PDF bookmark to the cover page -->
245 <xsl:apply-templates select="//*[contains(@class,' bkinfo/bkinfo ')]/@id"/>
246 </xsl:when>
247 <xsl:when test="@title">
248 <xsl:value-of select="@title"/>
249 </xsl:when>
250 <xsl:otherwise><xsl:value-of select="//*/title"/></xsl:otherwise>
251 </xsl:choose>
252 </xsl:variable>
253 <fo:block font-size="8pt" line-height="8pt">
254 <xsl:value-of select="$booktitle"/>
255 </fo:block>
256 </fo:static-content>
257 <!-- footer -->
258 <fo:static-content flow-name="xsl-region-after">
259 <fo:block text-align="center" font-size="10pt" font-weight="bold" font-family="Helvetica">
260 <fo:page-number/>
261 </fo:block>
262 </fo:static-content>
263 <!-- Flow setup for the Front Matter "body" (new "chapters" start on odd pages) -->
264 <fo:flow flow-name="xsl-region-body">
265 <!-- first, generate a compulsory Table of Contents -->
266 <fo:block line-height="12pt" font-size="10pt" font-family="Helvetica" id="page1-1">
267 <fo:block text-align="left" font-family="Helvetica">
268 <fo:block>
269 <fo:leader color="black" leader-pattern="rule"
270 rule-thickness="3pt" leader-length="2in"/>
271 </fo:block>
272 <fo:block font-size="20pt" font-weight="bold" line-height="140%">
273 Contents </fo:block>
274 <xsl:call-template name="gen-toc"/>
275 </fo:block>
276 </fo:block>
277 </fo:flow>
278 </fo:page-sequence>
279 </xsl:template>
280 <xsl:template name="unused-toc">
281 <!-- generate the List of Figures -->
282 <!-- To be done
283 <fo:block text-align="left" font-family="Helvetica" break-before="page">
284 <fo:block><fo:leader color="black" leader-pattern="rule" rule-thickness="3pt" leader-length="2in"/></fo:block>
285 <fo:block font-size="20pt" font-weight="bold" line-height="140%">
286 Figures
287 </fo:block>
288 <xsl:call-template name="gen-figlist"/>
289 </fo:block>
290-->
291 <!-- generate the List of Tables -->
292 <!-- To be done
293 <fo:block text-align="left" font-family="Helvetica" break-before="page">
294 <fo:block><fo:leader color="black" leader-pattern="rule" rule-thickness="3pt" leader-length="2in"/></fo:block>
295 <fo:block font-size="20pt" font-weight="bold" line-height="140%">
296 Tables
297 </fo:block>
298 <xsl:call-template name="gen-tlist"/>
299 </fo:block>
300-->
301 <!-- To be done: while still in Roman numbering, all the bkfrontm content... -->
302 </xsl:template>
303 <!-- initiate main content processing within basic page "shell" -->
304 <xsl:template name="main-doc3">
305 <fo:page-sequence master-reference="chapter-master">
306 <!-- header: single page -->
307 <fo:static-content flow-name="xsl-region-before">
308 <!-- SF Bug 1407646: uses the map title when it is specified.
309 If the map title is not specified, we fall back to the
310 title of the first topic. -->
311 <!-- book title here -->
312 <xsl:variable name="booktitle">
313 <xsl:choose>
314 <xsl:when test="//*[contains(@class,' bkinfo/bkinfo ')]">
315 <xsl:value-of select="//*[contains(@class,' bkinfo/bkinfo ')]/*[contains(@class,' topic/title ')]"/>
316 <!-- use the id attribute of the bkinfo element as an anchor for a PDF bookmark to the cover page -->
317 <xsl:apply-templates select="//*[contains(@class,' bkinfo/bkinfo ')]/@id"/>
318 </xsl:when>
319 <xsl:when test="@title">
320 <xsl:value-of select="@title"/>
321 </xsl:when>
322 <xsl:otherwise><xsl:value-of select="//*/title"/></xsl:otherwise>
323 </xsl:choose>
324 </xsl:variable>
325 <fo:block font-size="8pt" line-height="8pt">
326 <xsl:value-of select="$booktitle"/>
327 </fo:block>
328 </fo:static-content>
329 <!-- footer static stuff -->
330 <fo:static-content flow-name="xsl-region-after">
331 <fo:block text-align="center" font-size="10pt" font-weight="bold" font-family="Helvetica">
332 <fo:page-number/>
333 </fo:block>
334 </fo:static-content>
335 <!-- special footers for first page of new chapter -->
336 <!-- Flow setup for the main content (frontm, body, backm) (new "chapters" start on odd pages) -->
337 <fo:flow flow-name="xsl-region-body">
338 <!-- chapter body content here -->
339 <fo:block text-align="left" font-size="10pt" font-family="Helvetica" break-before="page">
340 <xsl:apply-templates/>
341 </fo:block>
342 </fo:flow>
343 </fo:page-sequence>
344 </xsl:template>
345 <!-- set up common attributes for all page definitions -->
346 <xsl:attribute-set name="common-grid">
347 <xsl:attribute name="page-width">51pc</xsl:attribute>
348 <!-- A4: 210mm -->
349 <xsl:attribute name="page-height">66pc</xsl:attribute>
350 <!-- A4: 297mm -->
351 <xsl:attribute name="margin-top">3pc</xsl:attribute>
352 <xsl:attribute name="margin-bottom">3pc</xsl:attribute>
353 <xsl:attribute name="margin-left">6pc</xsl:attribute>
354 <xsl:attribute name="margin-right">6pc</xsl:attribute>
355 </xsl:attribute-set>
356 <!-- set up common attributes for all page definitions -->
357 <xsl:attribute-set name="maptitle">
358 <xsl:attribute name="font-size">16pt</xsl:attribute>
359 <xsl:attribute name="font-weight">bold</xsl:attribute>
360 </xsl:attribute-set>
361 <!-- set up common attributes for all page definitions -->
362 <xsl:attribute-set name="mapabstract">
363 <xsl:attribute name="margin-top">3pc</xsl:attribute>
364 <xsl:attribute name="margin-bottom">3pc</xsl:attribute>
365 <xsl:attribute name="margin-left">6pc</xsl:attribute>
366 <xsl:attribute name="margin-right">6pc</xsl:attribute>
367 </xsl:attribute-set>
368 <!-- main toc generator -->
369 <xsl:template name="gen-toc">
370 <!-- get by main part: body -->
371 <xsl:for-each select="//bookmap//*[contains(@class,' topic/topic ')]|//map/*[contains(@class,' topic/topic ')]">
372 <fo:block text-align-last="justify" margin-top="6pt" margin-left="4.9pc">
373 <fo:inline font-weight="bold">
374 <!--Chapter <xsl:number level="any" from="bookmap"/>. -->
375 <xsl:value-of select="*[contains(@class,' topic/title ')]"/>
376 </fo:inline>
377 <fo:leader leader-pattern="dots"/>
378 <xsl:variable name="id-value">
379 <xsl:choose>
380 <xsl:when test="@id">
381 <xsl:value-of select="@id"/>
382 </xsl:when>
383 <xsl:otherwise>
384 <xsl:value-of select="generate-id()"/>
385 </xsl:otherwise>
386 </xsl:choose>
387 </xsl:variable>
388 <fo:page-number-citation ref-id="{$id-value}"/>
389 </fo:block>
390 <xsl:call-template name="get-tce2-section"/>
391 </xsl:for-each>
392 </xsl:template>
393 <!-- 2nd level header -->
394 <xsl:template name="get-tce2-section">
395 <xsl:for-each select="*[contains(@class,' topic/topic ')]">
396 <fo:block text-align-last="justify" margin-left="7.5pc">
397 <fo:inline font-weight="bold">
398 <xsl:value-of select="*[contains(@class,' topic/title ')]"/>
399 </fo:inline>
400 <fo:leader leader-pattern="dots"/>
401 <xsl:variable name="id-value">
402 <xsl:choose>
403 <xsl:when test="@id">
404 <xsl:value-of select="@id"/>
405 </xsl:when>
406 <xsl:otherwise>
407 <xsl:value-of select="generate-id()"/>
408 </xsl:otherwise>
409 </xsl:choose>
410 </xsl:variable>
411 <fo:page-number-citation ref-id="{$id-value}"/>
412 </fo:block>
413 <xsl:call-template name="get-tce3-section"/>
414 </xsl:for-each>
415 </xsl:template>
416 <!-- 3nd level header -->
417 <xsl:template name="get-tce3-section">
418 <xsl:for-each select="*[contains(@class,' topic/topic ')]">
419 <fo:block text-align-last="justify" margin-left="9pc">
420 <xsl:value-of select="*[contains(@class,' topic/title ')]"/>
421 <fo:leader leader-pattern="dots"/>
422 <xsl:variable name="id-value">
423 <xsl:choose>
424 <xsl:when test="@id">
425 <xsl:value-of select="@id"/>
426 </xsl:when>
427 <xsl:otherwise>
428 <xsl:value-of select="generate-id()"/>
429 </xsl:otherwise>
430 </xsl:choose>
431 </xsl:variable>
432 <fo:page-number-citation ref-id="{$id-value}"/>
433 </fo:block>
434 <xsl:call-template name="get-tce4-section"/>
435 </xsl:for-each>
436 </xsl:template>
437 <!-- 4th level header -->
438 <xsl:template name="get-tce4-section">
439 <xsl:for-each select="bksubsect1">
440 <fo:block text-align-last="justify" margin-left="+5.9pc">
441 <xsl:value-of select="*/title"/>
442 <fo:leader leader-pattern="dots"/>
443 <xsl:variable name="id-value">
444 <xsl:choose>
445 <xsl:when test="@id">
446 <xsl:value-of select="@id"/>
447 </xsl:when>
448 <xsl:otherwise>
449 <xsl:value-of select="generate-id()"/>
450 </xsl:otherwise>
451 </xsl:choose>
452 </xsl:variable>
453 <fo:page-number-citation ref-id="{$id-value}"/>
454 </fo:block>
455 <xsl:call-template name="get-tce5-section"/>
456 </xsl:for-each>
457 </xsl:template>
458 <!-- 5th level header -->
459 <xsl:template name="get-tce5-section">
460 <xsl:for-each select="bksubsect2">
461 <fo:block text-align-last="justify" margin-left="+5.9pc">
462 <xsl:value-of select="*/title"/>
463 <fo:leader leader-pattern="dots"/>
464 <xsl:variable name="id-value">
465 <xsl:choose>
466 <xsl:when test="@id">
467 <xsl:value-of select="@id"/>
468 </xsl:when>
469 <xsl:otherwise>
470 <xsl:value-of select="generate-id()"/>
471 </xsl:otherwise>
472 </xsl:choose>
473 </xsl:variable>
474 <fo:page-number-citation ref-id="{$id-value}"/>
475 </fo:block>
476 <!--xsl:call-template name="get-tce6-section"/-->
477 </xsl:for-each>
478 </xsl:template>
479</xsl:stylesheet>
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette