VirtualBox

source: vbox/trunk/src/libs/dita-ot-1.8.5/plugins/legacypdf/xslfo/topic2foImpl.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
檔案大小: 19.1 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<!-- topic2fo.xsl
8 | DITA topic to FO; "single topic to single printed 'chapter'"-level view
9 *-->
10
11<!-- BUGS:
121. Excluded footnotes still get generated as endnotes.
13 Footnotes located within required cleanup will be rendered whether the doc is output in draft mode or not.
14 This is due to pull-based processing of endnotes, which gets content that would ordinarily be excluded by
15 particular processing settings. This is actually a general problem faced by ANY XSLT processor that
16 has pull-based processors intermingled with push-based exclusion logic. Ideally, exclusion should remove
17 an element from the DOM, then you can depend on pull not to find things it shouldn't find! Two-passes!
18
19 |Bugs:
20 | FO processors are anything but interoperable at the time of this
21 | release of the DITA FO demo (August 2002). There are possibly
22 | other things to work on as well for this FO implementation, but
23 | we know about these:
24 |
25 | - this *demo application* has not been fully localization-enabled
26 | - something causes a page overflow error with XEP
27 | - column numbers do not total correctly for FOP (collapses some tables
28 | to the left, although others do appear to work okay)
29 | - "inherit" as an indent value does not work for FOP
30 | - white-space-collapse="false" is provided as an FOP equivalent to
31 | white-space="pre" but doesn't appear to work
32 | - leader-patter="use-content" is ignored by FOP
33 | - FOP starts a blank initial page; AH does not. layout defs may be the cause
34 | - Antenna House requires changing the "dflt-ext" variable to ".jpg"
35 | (and you must have equivalent graphics in the JPEG format)
36 | - the new simpletable element currently spreads evenly across the number of
37 | defined entries; it has a @relativecols attribute to use for future
38 | methods of passing relative widths to its processor (possibly "* * 3*")
39 | - can't get left indent into "lq" so using surround box instead for now
40 |
41 + added start-indent="2pt" into table-cell procs to eliminate deep offsets w/in cells
42 |
43 +-->
44
45<!DOCTYPE xsl:transform [
46<!-- entities for use in the generated output (must produce correctly in FO) -->
47 <!ENTITY gt "&gt;">
48 <!ENTITY lt "&lt;">
49 <!ENTITY rbl "&#160;">
50 <!ENTITY nbsp "&#160;">
51 <!ENTITY quot "&#34;">
52 <!ENTITY quotedblleft "&#x201C;">
53 <!ENTITY quotedblright "&#x201D;">
54 <!ENTITY bullet "&#x2022;"><!--check these two for better assignments -->
55 <!ENTITY middot "&#x2023;">
56
57 <!ENTITY section "&#xA7;">
58 <!ENTITY endash "&#x2013;">
59 <!ENTITY emdash "&#x2014;">
60
61 <!ENTITY copyr "&#xA9;">
62 <!ENTITY trademark "&#x2122;">
63 <!ENTITY registered "&#xAE;">
64]>
65<xsl:transform version="1.0" xmlns:fo="http://www.w3.org/1999/XSL/Format"
66 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
67 xmlns:saxon="http://icl.com/saxon" extension-element-prefixes="saxon">
68
69 <xsl:import href="../../../xsl/common/output-message.xsl"/>
70
71 <!-- Page setup - used by simple-master-set -->
72 <xsl:param name="paper.type" select="'A4'"/>
73 <xsl:param name="page.orientation" select="'portrait'"/>
74 <xsl:param name="page.margin.bottom" select="'0cm'"/>
75 <xsl:param name="page.margin.top" select="'0cm'"/>
76 <xsl:param name="page.margin.inner">2cm</xsl:param>
77 <xsl:param name="page.margin.outer">2cm</xsl:param>
78 <xsl:param name="body.margin.bottom" select="'2cm'"/>
79 <xsl:param name="body.margin.top" select="'2cm'"/>
80 <xsl:param name="body.font.family" select="'Helvetica'"/>
81 <xsl:param name="body.font.size">9pt</xsl:param>
82 <xsl:include href="dita-page-setup.xsl"/>
83 <!-- Whitespace stripping policy -->
84 <xsl:strip-space elements="*"/>
85 <xsl:preserve-space elements="pre lines"/>
86 <!-- this XSL directive insensitive to DITA specialized elements -->
87 <!-- Here we define default block properties. -->
88 <xsl:attribute-set name="block.properties">
89 <xsl:attribute name="border-bottom-width">0.5em</xsl:attribute>
90 </xsl:attribute-set>
91 <!-- Newline character (capture the native file newline) -->
92 <xsl:variable name="newline"/>
93 <!--null out things that don't apply to PDF -->
94 <xsl:template match="*[contains(@class,' topic/prolog ')]"/>
95 <!-- OTHER STYLESHEET INCLUDES/IMPORTS -->
96 <!-- local, output-specific routines -->
97 <xsl:include href="dita2fo-parms.xsl"/>
98 <!--xsl:include href="dita2fo-prolog.xsl"/-->
99 <xsl:include href="dita2fo-titles.xsl"/>
100 <xsl:include href="dita2fo-elems.xsl"/>
101 <xsl:include href="dita2fo-lists.xsl"/>
102 <xsl:include href="dita2fo-links.xsl"/>
103 <xsl:include href="dita2fo-simpletable.xsl"/>
104 <xsl:include href="dita2fo-calstable.xsl"/>
105 <xsl:include href="dita2fo-subroutines.xsl"/>
106 <!-- common routines -->
107 <xsl:include href="../../../xsl/common/dita-utilities.xsl"/>
108
109 <!-- Define the error message prefix identifier -->
110 <xsl:variable name="msgprefix">DOTX</xsl:variable>
111
112 <!-- null some things that won't be used for now -->
113 <!--xsl:template name="output-message"/-->
114 <!--
115 <xsl:include href="dita2fo-stubs.xsl"/>
116 <xsl:include href="toc2fo.xsl"/>
117-->
118 <!-- OUTPUT METHOD -->
119 <!-- Should this be specified in the including shell? -->
120 <!-- XSLFO output is simple XML syntax) -->
121 <xsl:output method="xml" version="1.0" indent="no"/>
122 <!-- USER SPECIFIC DECLARED VALUES (declared in dit2fo-parms.xsl) -->
123 <!-- "GLOBAL" DECLARATIONS -->
124 <!-- Setup for translation/localization (declared in dit2fo-parms.xsl -->
125 <!-- ROOT RULE -->
126 <xsl:template match="/" priority="3">
127 <xsl:apply-templates mode="toplevel"/>
128 </xsl:template>
129 <!-- This first template rule generates the outer-level shell for a delivery context. -->
130 <!-- In an override stylesheet, the same call to "chapter-setup" must be issued to
131 maintain the consistency of overall look'n'feel of the output FO. -->
132 <xsl:template match="*[contains(@class,' topic/topic ')]" name="toptopic" mode="toplevel">
133 <!-- this is an "h1div" context for standalone documents -->
134 <xsl:call-template name="chapter-setup"/>
135 </xsl:template>
136 <!-- =============== start of contextual topic titles ================= -->
137 <!-- this should be a lower-priority match for all non-toplevel topics in an aggregate -->
138 <xsl:template match="*[contains(@class,' topic/topic ')]">
139 <fo:block>
140 <!-- delete the line which call "gen-toc-id" template to fix bug#1304859 -->
141 <xsl:apply-templates/>
142 </fo:block>
143 </xsl:template>
144 <!-- =================== start of processors ====================== -->
145 <!-- SCRIPT SUPPORT -->
146 <xsl:template name="script-sample">
147 <!-- not applicable for FO output -->
148 </xsl:template>
149 <!-- NAMED TEMPLATES (call by name, only) -->
150 <xsl:template name="gen-att-label">
151 <xsl:if test="@spectitle">
152 <fo:block font-weight="bold">
153 <xsl:value-of select="@spectitle"/>
154 </fo:block>
155 </xsl:if>
156 </xsl:template>
157 <!-- named templates that can be used anywhere -->
158 <!-- this replaces newlines with the BR element, forcing non-concatenation even in flow contexts -->
159 <xsl:template name="br-replace">
160 <xsl:param name="word"/>
161 <!-- capture an actual newline within the xsl:text element -->
162 <xsl:variable name="cr">
163 <xsl:text/>
164 </xsl:variable>
165 <xsl:choose>
166 <xsl:when test="contains($word,$cr)">
167 <xsl:value-of select="substring-before($word,$cr)"/>
168 <!--br class="br"/-->
169 <xsl:call-template name="br-replace">
170 <xsl:with-param name="word" select="substring-after($word,$cr)"/>
171 </xsl:call-template>
172 </xsl:when>
173 <xsl:otherwise>
174 <xsl:value-of select="$word"/>
175 </xsl:otherwise>
176 </xsl:choose>
177 </xsl:template>
178 <!-- diagnostic: call this to generate a path-like view of an element's ancestry! -->
179 <xsl:template name="breadcrumbs">
180 <xsl:variable name="full-path">
181 <xsl:for-each select="ancestor-or-self::*">
182 <xsl:value-of select="concat('/',name())"/>
183 </xsl:for-each>
184 </xsl:variable>
185 <fo:block font-weight="bold">
186 <xsl:value-of select="$full-path"/>
187 </fo:block>
188 </xsl:template>
189 <!-- the following named templates generate inline content for the delivery context -->
190 <!-- generate null filler if the phrase is evidently empty -->
191 <xsl:template name="apply-for-phrases">
192 <xsl:choose>
193 <xsl:when test="not(text()[normalize-space(.)] | *)">
194 <!--xsl:comment>null</xsl:comment-->
195 </xsl:when>
196 <xsl:otherwise>
197 <xsl:apply-templates/>
198 </xsl:otherwise>
199 </xsl:choose>
200 </xsl:template>
201 <!-- "FORMAT" GLOBAL DECLARATIONS -->
202 <xsl:variable name="fmt-fig-lbl-loc">over</xsl:variable>
203 <!-- values: over, under -->
204 <xsl:variable name="fmt-tbl-lbl-loc">over</xsl:variable>
205 <!-- values: over, under -->
206 <xsl:variable name="link-top-section">no</xsl:variable>
207 <!-- values: yes, no (or any not "yes") -->
208 <xsl:variable name="do-place-ing">no</xsl:variable>
209 <!-- values: yes, no (or any not "yes") -->
210 <!-- this value should be created in a named template since it needs to increment per call -->
211 <!-- for now, the static value is null until we can redo this intent -->
212 <xsl:variable name="fig-pfx-txt"/>
213 <xsl:variable name="xfig-pfx-txt">
214 <xsl:call-template name="getString">
215 <xsl:with-param name="stringName" select="'Figure'"/>
216 </xsl:call-template>
217 <xsl:number level="any" count="label" from="/"/> of <xsl:value-of
218 select="count(//fig/label)"/>. </xsl:variable>
219 <!-- values: '' or custom design -->
220 <xsl:variable name="tbl-pfx-txt"/>
221 <!-- "FORMAT" MACROS -->
222 <!--
223 | These macros support globally-defined formatting constants for
224 | document content. Some elements have attributes that permit local
225 | control of formatting; such logic is part of the pertinent template rule.
226 +-->
227 <xsl:template name="place-tbl-width">
228 <xsl:variable name="twidth-fixed">100%</xsl:variable>
229 <xsl:if test="$twidth-fixed != ''">
230 <xsl:attribute name="width">
231 <xsl:value-of select="$twidth-fixed"/>
232 </xsl:attribute>
233 </xsl:if>
234 </xsl:template>
235 <xsl:template name="proc-ing">
236 <xsl:if test="$do-place-ing = 'yes'">
237 <!-- set in a global variable, as with label placement, etc. -->
238 <fo:external-graphic src="url(image/tip-ing.jpg)"/>
239 <!-- this should be an xsl:choose with the approved list and a selection method-->
240
241 <!-- add any other required positioning controls, if needed, but must be valid in the location
242 from which the call to this template was made -->
243 &nbsp; </xsl:if>
244 </xsl:template>
245 <!-- =================== end of processors ====================== -->
246 <!-- =================== start of override stubs ====================== -->
247 <!-- STUBS FOR USER PROVIDED OVERRIDE EXTENSIONS -->
248 <xsl:template name="gen-user-header">
249 <!-- to customize: copy this to your override transform, add whatever content you want! -->
250 <!-- for example, to display logos, search/nav widgets, etc. -->
251 </xsl:template>
252 <xsl:template name="gen-user-footer">
253 <!-- to customize: copy this to your override transform, add whatever content you want! -->
254 <!-- for example, to display compliances for: XHTML, accessibility, content ratings, etc. -->
255 </xsl:template>
256 <xsl:template name="gen-user-sidetoc">
257 <!-- to customize: copy this to your override transform, add whatever content you want! -->
258 <!-- Common implementations use a table with align=right to place generated content
259 adjacent to the start of the body content -->
260 </xsl:template>
261 <xsl:template name="gen-user-scripts">
262 <!-- to customize: copy this to your override transform, add whatever content you want! -->
263 <!-- see (or enable) the named template "script-sample" for an example -->
264 <!--xsl:call-template name="script-sample"/-->
265 </xsl:template>
266 <xsl:template name="gen-user-styles">
267 <!-- to customize: copy this to your override transform, add whatever content you want! -->
268 </xsl:template>
269 <xsl:template name="gen-user-panel-title-pfx">
270 <!-- to customize: copy this to your override transform, add whatever content you want! -->
271 <!-- Generate content based on run-time parameter value, with local logic here -->
272 <!-- This is overrideable -->
273 </xsl:template>
274 <xsl:template name="gen-main-panel-title">
275 <!-- use the searchtitle unless there's no value - else use title -->
276 <xsl:variable name="schtitle">
277 <xsl:value-of select="/*[contains(@class,' topic/topic ')]/*[contains(@class,' topic/titlealts ')]/*[contains(@class,' topic/searchtitle ')]"/>
278 </xsl:variable>
279 <xsl:variable name="ditaschtitle">
280 <xsl:value-of select="/dita/*[contains(@class,' topic/topic ')][1]/*[contains(@class,' topic/titlealts ')]/*[contains(@class,' topic/searchtitle ')]"/>
281 </xsl:variable>
282 <xsl:variable name="maintitle">
283 <xsl:value-of select="/*[contains(@class,' topic/topic ')]/*[contains(@class,' topic/title ')]"/>
284 </xsl:variable>
285 <xsl:variable name="ditamaintitle">
286 <xsl:value-of select="/dita/*[contains(@class,' topic/topic ')][1]/*[contains(@class,' topic/title ')]"/>
287 </xsl:variable>
288 <xsl:choose>
289 <xsl:when test="string-length($schtitle) &gt; 0">
290 <xsl:value-of select="$schtitle"/>
291 </xsl:when>
292 <xsl:when test="string-length($ditaschtitle) &gt; 0">
293 <xsl:value-of select="$ditaschtitle"/>
294 </xsl:when>
295 <xsl:when test="string-length($maintitle) &gt; 0">
296 <xsl:value-of select="$maintitle"/>
297 </xsl:when>
298 <xsl:when test="string-length($ditamaintitle) &gt; 0">
299 <xsl:value-of select="$ditamaintitle"/>
300 </xsl:when>
301 <xsl:otherwise>
302 <xsl:text>***</xsl:text>
303 <xsl:call-template name="output-message">
304 <xsl:with-param name="msgnum">037</xsl:with-param>
305 <xsl:with-param name="msgsev">W</xsl:with-param>
306 </xsl:call-template>
307 </xsl:otherwise>
308 </xsl:choose>
309 </xsl:template>
310 <xsl:template name="gen-user-metadata"/>
311 <!-- not applicable yet within FO -->
312 <!-- =================== end of override stubs ====================== -->
313 <!-- =================== DEFAULT PAGE LAYOUT ====================== -->
314 <xsl:template name="chapter-setup">
315 <!-- Newline character (capture the native file newline) -->
316 <xsl:variable name="newline"/>
317 <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
318 <fo:layout-master-set>
319 <fo:simple-page-master master-name="cover" page-height="792pt"
320 page-width="612pt" margin-top="36pt" margin-bottom="36pt"
321 margin-left="36pt" margin-right="36pt">
322 <fo:region-body margin-top="120pt"/>
323 </fo:simple-page-master>
324 <fo:simple-page-master master-name="leftPage" page-height="792pt"
325 page-width="612pt" margin-top="36pt" margin-bottom="36pt"
326 margin-left="72pt" margin-right="60pt">
327 <fo:region-body margin-bottom="36pt" margin-top="24pt"/>
328 <fo:region-before extent="24pt"/>
329 <fo:region-after extent="36pt"/>
330 </fo:simple-page-master>
331 <fo:simple-page-master master-name="rightPage" page-height="792pt"
332 page-width="612pt" margin-top="36pt" margin-bottom="36pt"
333 margin-left="60pt" margin-right="72pt">
334 <fo:region-body margin-bottom="36pt" margin-top="24pt"/>
335 <fo:region-before extent="24pt"/>
336 <fo:region-after extent="36pt"/>
337 </fo:simple-page-master>
338 <fo:simple-page-master master-name="common-page" page-height="792pt"
339 page-width="612pt" margin-top="36pt" margin-bottom="36pt"
340 margin-left="60pt" margin-right="60pt">
341 <fo:region-body margin-bottom="36pt" margin-top="24pt"/>
342 <fo:region-before extent="24pt"/>
343 <fo:region-after extent="36pt"/>
344 </fo:simple-page-master>
345 </fo:layout-master-set>
346 <!--xsl:call-template name="gen-cover-page"-->
347 <!-- initiate content processing within basic page "shell" -->
348 <fo:page-sequence master-reference="common-page" force-page-count="no-force">
349 <!-- header -->
350 <fo:static-content flow-name="xsl-region-before" font-size="9pt" font-family="Helvetica">
351 <fo:block linefeed-treatment="ignore" text-align-last="justify">
352 <fo:inline text-align="start">
353 <xsl:text>Stub for header content</xsl:text>
354 </fo:inline>
355 <!-- remove use-content for FOP -->
356 <!--<fo:leader rule-style="solid" leader-length.maximum="100%" leader-length.optimum="60%" leader-length.minimum="10pt" leader-pattern="use-content">&nbsp;</fo:leader>-->
357 <fo:leader rule-style="solid" leader-length.maximum="100%"
358 leader-length.optimum="60%" leader-length.minimum="10pt">&nbsp;</fo:leader>
359 <fo:inline text-align="end" font-weight="bold">
360 <xsl:text>right side content</xsl:text>
361 </fo:inline>
362 </fo:block>
363 <!--fo:block><fo:leader leader-pattern="rule" leader-length="100%"/></fo:block-->
364 </fo:static-content>
365 <!-- footer -->
366 <fo:static-content flow-name="xsl-region-after">
367 <fo:block linefeed-treatment="ignore" text-align-last="justify">
368 <fo:inline text-align="start" font-size="10pt" font-family="Helvetica">
369 <xsl:value-of select="//*/*[contains(@class, ' topic/title ')]"/>
370 </fo:inline>
371 <!--fo:leader rule-style="solid" leader-length.maximum="100%" leader-length.optimum="60%" leader-length.minimum="10pt" leader-pattern="use-content">&nbsp;</fo:leader-->
372 <fo:inline text-align="end" font-size="10pt" font-weight="bold" font-family="Helvetica">
373 <xsl:text>Page </xsl:text>
374 <fo:page-number/>
375 </fo:inline>
376 </fo:block>
377 </fo:static-content>
378 <!-- body -->
379 <fo:flow flow-name="xsl-region-body">
380 <fo:block line-height="10pt" font-size="9pt" font-family="Helvetica" id="page1-1">
381 <xsl:apply-templates/>
382 </fo:block>
383 </fo:flow>
384 </fo:page-sequence>
385 </fo:root>
386 </xsl:template>
387 <xsl:template name="gen-cover-page">
388 <!-- generate an "outside-front cover" page -->
389 <fo:page-sequence master-reference="cover">
390 <fo:flow flow-name="xsl-region-body">
391 <fo:block text-align="center">
392 <fo:block space-after.optimum="40pt" space-before.optimum="40pt"
393 line-height="80pt" font-size="32pt" font-family="Helvetica">
394 <xsl:value-of select="/topic/title"/>
395 </fo:block>
396 <fo:block line-height="50pt" font-size="24pt" font-family="Helvetica">
397 <fo:block font-style="italic">
398 <xsl:value-of select="*[contains(@class, ' topic/title ')]"/>
399 </fo:block>
400 </fo:block>
401 </fo:block>
402 </fo:flow>
403 </fo:page-sequence>
404 <!-- generate an "inside front cover" page (left side) -->
405 <fo:page-sequence master-reference="cover">
406 <fo:flow flow-name="xsl-region-body">
407 <fo:block xsl:use-attribute-sets="p" color="purple" text-align="center"/>
408 </fo:flow>
409 </fo:page-sequence>
410 </xsl:template>
411 <!-- domains (should be external) -->
412</xsl:transform>
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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