1 | <?xml version='1.0'?>
|
---|
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 | <!DOCTYPE xsl:transform [
|
---|
8 | <!-- entities for use in the generated output (must produce correctly in FO) -->
|
---|
9 | <!ENTITY rbl " ">
|
---|
10 | <!ENTITY quotedblleft "“">
|
---|
11 | <!ENTITY quotedblright "”">
|
---|
12 | <!ENTITY bullet "•"><!--check these two for better assignments -->
|
---|
13 | ]>
|
---|
14 |
|
---|
15 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
16 | xmlns:fo="http://www.w3.org/1999/XSL/Format"
|
---|
17 | version='1.0'>
|
---|
18 |
|
---|
19 |
|
---|
20 |
|
---|
21 | <!-- =================== start of element rules ====================== -->
|
---|
22 |
|
---|
23 | <!--==== pre-body subset ====-->
|
---|
24 | <!-- note that topic titles are handled in the calling stylesheet -->
|
---|
25 |
|
---|
26 | <!-- renamed titlealts to cause it not to match. Its content is extraneous for PDF output -->
|
---|
27 |
|
---|
28 | <xsl:template match="*[contains(@class,' topic/xtitlealts ')]">
|
---|
29 | <fo:block background-color="#f0f0d0">
|
---|
30 | <xsl:attribute name="border-style">solid</xsl:attribute>
|
---|
31 | <xsl:attribute name="border-color">black</xsl:attribute>
|
---|
32 | <xsl:attribute name="border-width">thin</xsl:attribute>
|
---|
33 | <xsl:attribute name="start-indent"><xsl:value-of select="$basic-start-indent"/></xsl:attribute>
|
---|
34 | <xsl:attribute name="start-indent"><xsl:value-of select="$basic-start-indent"/></xsl:attribute>
|
---|
35 | <xsl:apply-templates/>
|
---|
36 | </fo:block>
|
---|
37 | </xsl:template>
|
---|
38 |
|
---|
39 | <xsl:template match="*[contains(@class,' topic/navtitle ')]">
|
---|
40 | <fo:block>
|
---|
41 | <fo:inline font-weight="bold">Navigation title: </fo:inline>
|
---|
42 | <xsl:apply-templates/>
|
---|
43 | </fo:block>
|
---|
44 | </xsl:template>
|
---|
45 |
|
---|
46 | <xsl:template match="*[contains(@class,' topic/searchtitle ')]">
|
---|
47 | <fo:block>
|
---|
48 | <fo:inline font-weight="bold">Search title: </fo:inline>
|
---|
49 | <xsl:apply-templates/>
|
---|
50 | </fo:block>
|
---|
51 | </xsl:template>
|
---|
52 |
|
---|
53 | <!-- Added for DITA 1.1 "Shortdesc proposal" -->
|
---|
54 | <xsl:template match="*[contains(@class,' topic/abstract ')]" mode="outofline">
|
---|
55 | <fo:block xsl:use-attribute-sets="p" start-indent="{$basic-start-indent}">
|
---|
56 | <xsl:apply-templates/>
|
---|
57 | </fo:block>
|
---|
58 | </xsl:template>
|
---|
59 |
|
---|
60 | <!-- Added for DITA 1.1 "Shortdesc proposal" -->
|
---|
61 | <xsl:template match="*[contains(@class,' topic/abstract ')]">
|
---|
62 | <xsl:if test="not(following-sibling::*[contains(@class,' topic/body ')])">
|
---|
63 | <xsl:apply-templates select="." mode="outofline"/>
|
---|
64 | </xsl:if>
|
---|
65 | </xsl:template>
|
---|
66 |
|
---|
67 | <!-- shortdesc is called outside of body thus needs to set up its own indent. also relatedlinks -->
|
---|
68 | <xsl:template match="*[contains(@class,' topic/shortdesc ')]" mode="outofline">
|
---|
69 | <fo:block xsl:use-attribute-sets="p" start-indent="{$basic-start-indent}">
|
---|
70 | <xsl:apply-templates/>
|
---|
71 | </fo:block>
|
---|
72 | </xsl:template>
|
---|
73 |
|
---|
74 | <!-- Updated for DITA 1.1 "Shortdesc proposal" -->
|
---|
75 | <!-- Added for SF 1363055: Shortdesc disappears when optional body is removed -->
|
---|
76 | <xsl:template match="*[contains(@class,' topic/shortdesc ')]">
|
---|
77 | <xsl:choose>
|
---|
78 | <xsl:when test="parent::*[contains(@class, ' topic/abstract ')]">
|
---|
79 | <xsl:apply-templates select="." mode="outofline"/>
|
---|
80 | </xsl:when>
|
---|
81 | <xsl:when test="not(following-sibling::*[contains(@class,' topic/body ')])">
|
---|
82 | <xsl:apply-templates select="." mode="outofline"/>
|
---|
83 | </xsl:when>
|
---|
84 | <xsl:otherwise></xsl:otherwise>
|
---|
85 | </xsl:choose>
|
---|
86 | </xsl:template>
|
---|
87 |
|
---|
88 | <xsl:template match="*[contains(@class,' topic/xshortdesc ')]">
|
---|
89 | <fo:block start-indent="{$basic-start-indent}" background-color="#F0C0F0">
|
---|
90 | <fo:block background-color="red">The <shortdesc> element is also reflected following the prolog.</fo:block>
|
---|
91 | <xsl:apply-templates/>
|
---|
92 | </fo:block>
|
---|
93 | </xsl:template>
|
---|
94 |
|
---|
95 |
|
---|
96 | <!--==== body content subset ===-->
|
---|
97 |
|
---|
98 | <!-- this is the first body called, which sets the indent and overall organization -->
|
---|
99 | <xsl:template match="*[contains(@class,' topic/body ')]" name="topbody" priority="3">
|
---|
100 | <fo:block start-indent="{$basic-start-indent}">
|
---|
101 | <xsl:attribute name="font-size">10pt</xsl:attribute>
|
---|
102 | <!-- here, you can generate a toc based on what's a child of body -->
|
---|
103 | <!--xsl:call-template name="gen-sect-ptoc"/-->
|
---|
104 |
|
---|
105 | <!-- Added for DITA 1.1 "Shortdesc proposal" -->
|
---|
106 | <xsl:apply-templates select="preceding-sibling::*[contains(@class,' topic/abstract ')]" mode="outofline"/>
|
---|
107 |
|
---|
108 | <xsl:apply-templates select="preceding-sibling::*[contains(@class,' topic/shortdesc ')]" mode="outofline"/>
|
---|
109 | <xsl:apply-templates/>
|
---|
110 | </fo:block>
|
---|
111 | </xsl:template>
|
---|
112 |
|
---|
113 | <!-- this is the fallthrough body for nested topics -->
|
---|
114 | <xsl:template match="*[contains(@class,' topic/body ')]">
|
---|
115 | <fo:block start-indent="{$basic-start-indent}">
|
---|
116 | <xsl:attribute name="font-size">10pt</xsl:attribute>
|
---|
117 |
|
---|
118 | <!-- Added for DITA 1.1 "Shortdesc proposal" -->
|
---|
119 | <xsl:apply-templates select="preceding-sibling::*[contains(@class,' topic/abstract ')]" mode="outofline"/>
|
---|
120 |
|
---|
121 | <xsl:apply-templates select="preceding-sibling::*[contains(@class,' topic/shortdesc ')]" mode="outofline"/>
|
---|
122 | <xsl:apply-templates/>
|
---|
123 | </fo:block>
|
---|
124 | </xsl:template>
|
---|
125 |
|
---|
126 | <xsl:template match="*[contains(@class,' topic/section ')]">
|
---|
127 | <fo:block line-height="12pt">
|
---|
128 | <xsl:attribute name="space-before">0.6em</xsl:attribute>
|
---|
129 | <xsl:attribute name="font-size">10pt</xsl:attribute>
|
---|
130 | <!-- set id -->
|
---|
131 | <xsl:call-template name="gen-toc-id"/>
|
---|
132 | <!-- preferentially pull the head here; process in place for now -->
|
---|
133 | <xsl:apply-templates/>
|
---|
134 | </fo:block>
|
---|
135 | </xsl:template>
|
---|
136 |
|
---|
137 |
|
---|
138 | <xsl:template match="*[contains(@class,' topic/example ')]">
|
---|
139 | <fo:block line-height="12pt">
|
---|
140 | <xsl:attribute name="space-before">0.6em</xsl:attribute>
|
---|
141 | <xsl:attribute name="font-size">10pt</xsl:attribute>
|
---|
142 | <!-- set id -->
|
---|
143 | <xsl:call-template name="gen-toc-id"/>
|
---|
144 | <!-- preferentially pull the head here; process in place for now -->
|
---|
145 | <xsl:apply-templates/>
|
---|
146 | </fo:block>
|
---|
147 | </xsl:template>
|
---|
148 |
|
---|
149 |
|
---|
150 | <xsl:template match="*[contains(@class,' topic/p ')]">
|
---|
151 | <!-- set id -->
|
---|
152 | <xsl:choose>
|
---|
153 | <xsl:when test="descendant::*[contains(@class,' topic/pre ')]">
|
---|
154 | <xsl:call-template name="divlikepara"/>
|
---|
155 | </xsl:when>
|
---|
156 | <xsl:when test="descendant::*[contains(@class,' topic/ul ')]">
|
---|
157 | <xsl:call-template name="divlikepara"/>
|
---|
158 | </xsl:when>
|
---|
159 | <xsl:when test="descendant::*[contains(@class,' topic/ol ')]">
|
---|
160 | <xsl:call-template name="divlikepara"/>
|
---|
161 | </xsl:when>
|
---|
162 | <xsl:when test="descendant::*[contains(@class,' topic/lq ')]">
|
---|
163 | <xsl:call-template name="divlikepara"/>
|
---|
164 | </xsl:when>
|
---|
165 | <xsl:when test="descendant::*[contains(@class,' topic/dl ')]">
|
---|
166 | <xsl:call-template name="divlikepara"/>
|
---|
167 | </xsl:when>
|
---|
168 | <xsl:when test="descendant::*[contains(@class,' topic/note ')]">
|
---|
169 | <xsl:call-template name="divlikepara"/>
|
---|
170 | </xsl:when>
|
---|
171 | <xsl:when test="descendant::*[contains(@class,' topic/lines ')]">
|
---|
172 | <xsl:call-template name="divlikepara"/>
|
---|
173 | </xsl:when>
|
---|
174 | <xsl:when test="descendant::*[contains(@class,' topic/fig ')]">
|
---|
175 | <xsl:call-template name="divlikepara"/>
|
---|
176 | </xsl:when>
|
---|
177 | <xsl:when test="descendant::*[contains(@class,' topic/table ')]">
|
---|
178 | <xsl:call-template name="divlikepara"/>
|
---|
179 | </xsl:when>
|
---|
180 | <xsl:when test="descendant::*[contains(@class,' topic/simpletable ')]">
|
---|
181 | <xsl:call-template name="divlikepara"/>
|
---|
182 | </xsl:when>
|
---|
183 | <xsl:otherwise>
|
---|
184 | <fo:block xsl:use-attribute-sets="p">
|
---|
185 | <xsl:if test="string(@id)"><xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute></xsl:if>
|
---|
186 | <xsl:apply-templates/>
|
---|
187 | </fo:block>
|
---|
188 | </xsl:otherwise>
|
---|
189 | </xsl:choose>
|
---|
190 | </xsl:template>
|
---|
191 |
|
---|
192 | <xsl:template name="divlikepara">
|
---|
193 | <fo:block xsl:use-attribute-sets="divlike.p">
|
---|
194 | <xsl:apply-templates/>
|
---|
195 | </fo:block>
|
---|
196 | </xsl:template>
|
---|
197 |
|
---|
198 | <xsl:template match="*[contains(@class,' topic/note ')]">
|
---|
199 | <fo:block>
|
---|
200 | <!-- setclass -->
|
---|
201 | <!-- set id -->
|
---|
202 | <fo:inline border-left-width="0pt" border-right-width="0pt" font-weight="bold">
|
---|
203 | <!--[<xsl:value-of select="@type"/>] was wrapper -->
|
---|
204 | <xsl:choose>
|
---|
205 | <xsl:when test="@type='note'">
|
---|
206 | <xsl:call-template name="getString">
|
---|
207 | <xsl:with-param name="stringName" select="'Note'"/>
|
---|
208 | </xsl:call-template>
|
---|
209 | </xsl:when>
|
---|
210 | <xsl:when test="@type='tip'">
|
---|
211 | <xsl:call-template name="proc-ing"/>
|
---|
212 | <xsl:call-template name="getString">
|
---|
213 | <xsl:with-param name="stringName" select="'Tip'"/>
|
---|
214 | </xsl:call-template>
|
---|
215 | </xsl:when>
|
---|
216 | <xsl:when test="@type='fastpath'">
|
---|
217 | <xsl:call-template name="getString">
|
---|
218 | <xsl:with-param name="stringName" select="'Fastpath'"/>
|
---|
219 | </xsl:call-template>
|
---|
220 | </xsl:when>
|
---|
221 | <xsl:when test="@type='restriction'">
|
---|
222 | <xsl:call-template name="getString">
|
---|
223 | <xsl:with-param name="stringName" select="'Restriction'"/>
|
---|
224 | </xsl:call-template>
|
---|
225 | </xsl:when>
|
---|
226 | <xsl:when test="@type='important'">>
|
---|
227 | <xsl:call-template name="getString">
|
---|
228 | <xsl:with-param name="stringName" select="'Important'"/>
|
---|
229 | </xsl:call-template>
|
---|
230 | </xsl:when>
|
---|
231 | <xsl:when test="@type='remember'">
|
---|
232 | <xsl:call-template name="getString">
|
---|
233 | <xsl:with-param name="stringName" select="'Remember'"/>
|
---|
234 | </xsl:call-template>
|
---|
235 | </xsl:when>
|
---|
236 | <xsl:when test="@type='attention'">
|
---|
237 | <xsl:call-template name="getString">
|
---|
238 | <xsl:with-param name="stringName" select="'Attention'"/>
|
---|
239 | </xsl:call-template>
|
---|
240 | </xsl:when>
|
---|
241 | <xsl:when test="@type='caution'">
|
---|
242 | <xsl:call-template name="getString">
|
---|
243 | <xsl:with-param name="stringName" select="'Caution'"/>
|
---|
244 | </xsl:call-template>
|
---|
245 | </xsl:when>
|
---|
246 | <xsl:when test="@type='danger'">
|
---|
247 | <xsl:call-template name="getString">
|
---|
248 | <xsl:with-param name="stringName" select="'Danger'"/>
|
---|
249 | </xsl:call-template>
|
---|
250 | </xsl:when>
|
---|
251 | <xsl:when test="@type='other'">
|
---|
252 | <xsl:choose>
|
---|
253 | <xsl:when test="@othertype">
|
---|
254 | <!-- othertype is a key that should look up external, translateable text. -->
|
---|
255 | <xsl:value-of select="@othertype"/>
|
---|
256 | </xsl:when>
|
---|
257 | <xsl:otherwise>
|
---|
258 | [<xsl:value-of select="@type"/>]
|
---|
259 | </xsl:otherwise>
|
---|
260 | </xsl:choose>
|
---|
261 | </xsl:when>
|
---|
262 | <xsl:otherwise>
|
---|
263 | <!-- nop --><xsl:text>Note</xsl:text>
|
---|
264 | </xsl:otherwise>
|
---|
265 | </xsl:choose><xsl:text>: </xsl:text>
|
---|
266 | </fo:inline><xsl:text> </xsl:text>
|
---|
267 | <xsl:apply-templates/>
|
---|
268 | </fo:block>
|
---|
269 | </xsl:template>
|
---|
270 |
|
---|
271 |
|
---|
272 | <xsl:template match="*[contains(@class,' topic/desc ')]">
|
---|
273 | <fo:inline border-left-width="0pt" border-right-width="0pt">
|
---|
274 | <xsl:apply-templates/>
|
---|
275 | </fo:inline>
|
---|
276 | </xsl:template>
|
---|
277 |
|
---|
278 |
|
---|
279 | <xsl:template match="*[contains(@class,' topic/lq ')]">
|
---|
280 | <fo:block xsl:use-attribute-sets="lq">
|
---|
281 | <!-- setclass -->
|
---|
282 | <!-- set id -->
|
---|
283 | <xsl:apply-templates/>
|
---|
284 | <xsl:choose>
|
---|
285 | <xsl:when test="@href">
|
---|
286 | <fo:block text-align="right"><xsl:value-of select="@href"/>,
|
---|
287 | <xsl:value-of select="@reftitle"/></fo:block>
|
---|
288 | </xsl:when>
|
---|
289 | <xsl:when test="@reftitle">
|
---|
290 | <fo:block text-align="right"><xsl:value-of select="@reftitle"/></fo:block>
|
---|
291 | </xsl:when>
|
---|
292 | <xsl:otherwise><!--nop--></xsl:otherwise>
|
---|
293 | </xsl:choose>
|
---|
294 | </fo:block>
|
---|
295 | </xsl:template>
|
---|
296 |
|
---|
297 |
|
---|
298 | <xsl:template match="*[contains(@class,' topic/q ')]">
|
---|
299 | <fo:inline border-left-width="0pt" border-right-width="0pt">
|
---|
300 | "edblleft;<xsl:apply-templates />"edblright;
|
---|
301 | </fo:inline>
|
---|
302 | </xsl:template>
|
---|
303 |
|
---|
304 |
|
---|
305 |
|
---|
306 |
|
---|
307 | <!-- figure setup -->
|
---|
308 |
|
---|
309 | <xsl:template match="*[contains(@class,' topic/fig ')]">
|
---|
310 | <fo:block xsl:use-attribute-sets="fig">
|
---|
311 | <!-- setclass -->
|
---|
312 | <!-- set id -->
|
---|
313 | <xsl:if test="@id">
|
---|
314 | <xsl:apply-templates select="@id"/>
|
---|
315 | </xsl:if>
|
---|
316 | <xsl:call-template name="setframe"/>
|
---|
317 | <xsl:if test="@expanse = 'page'">
|
---|
318 | <xsl:attribute name="start-indent">-<xsl:value-of select="$basic-start-indent"/></xsl:attribute>
|
---|
319 | </xsl:if>
|
---|
320 | <!-- this is where the main fig rendering happens -->
|
---|
321 | <xsl:apply-templates/>
|
---|
322 | </fo:block>
|
---|
323 | </xsl:template>
|
---|
324 |
|
---|
325 |
|
---|
326 | <xsl:template match="*[contains(@class,' topic/figgroup ')]">
|
---|
327 | <fo:inline border-left-width="0pt" border-right-width="0pt">
|
---|
328 | <!-- setclass -->
|
---|
329 | <!-- set id -->
|
---|
330 | <xsl:apply-templates/>
|
---|
331 | </fo:inline>
|
---|
332 | </xsl:template>
|
---|
333 |
|
---|
334 | <!-- record end respecting data -->
|
---|
335 |
|
---|
336 |
|
---|
337 | <xsl:template match="*[contains(@class,' topic/pre ')]">
|
---|
338 | <xsl:call-template name="gen-att-label"/>
|
---|
339 | <fo:block xsl:use-attribute-sets="pre">
|
---|
340 | <!-- setclass -->
|
---|
341 | <!-- set id -->
|
---|
342 | <xsl:call-template name="setscale"/>
|
---|
343 | <xsl:call-template name="setframe"/>
|
---|
344 | <xsl:apply-templates/>
|
---|
345 | </fo:block>
|
---|
346 | </xsl:template>
|
---|
347 |
|
---|
348 | <xsl:template match="*[contains(@class,' topic/lines ')]">
|
---|
349 | <xsl:call-template name="gen-att-label"/>
|
---|
350 | <fo:block xsl:use-attribute-sets="lines">
|
---|
351 | <!-- setclass -->
|
---|
352 | <!-- set id -->
|
---|
353 | <xsl:call-template name="setscale"/>
|
---|
354 | <xsl:call-template name="setframe"/>
|
---|
355 | <xsl:apply-templates/>
|
---|
356 | </fo:block>
|
---|
357 | </xsl:template>
|
---|
358 |
|
---|
359 |
|
---|
360 |
|
---|
361 | <!-- phrase elements -->
|
---|
362 |
|
---|
363 | <xsl:template match="*[contains(@class,' topic/term ')]">
|
---|
364 | <fo:inline border-left-width="0pt" border-right-width="0pt">
|
---|
365 | <!-- setclass -->
|
---|
366 | <!-- set id -->
|
---|
367 | <xsl:apply-templates/>
|
---|
368 | </fo:inline>
|
---|
369 | </xsl:template>
|
---|
370 |
|
---|
371 |
|
---|
372 | <xsl:template match="*[contains(@class,' topic/ph ')]">
|
---|
373 | <fo:inline border-left-width="0pt" border-right-width="0pt"><!-- color="purple"-->
|
---|
374 | <!-- setclass -->
|
---|
375 |
|
---|
376 | <!-- set id -->
|
---|
377 | <xsl:apply-templates/>
|
---|
378 | </fo:inline>
|
---|
379 | </xsl:template>
|
---|
380 |
|
---|
381 |
|
---|
382 |
|
---|
383 | <xsl:template match="*[contains(@class,' topic/tm ')]">
|
---|
384 | <fo:inline border-left-width="0pt" border-right-width="0pt">
|
---|
385 | <!-- setclass -->
|
---|
386 | <!-- set id -->
|
---|
387 | <xsl:apply-templates/>
|
---|
388 | <fo:inline baseline-shift="super" font-size="75%">
|
---|
389 | <xsl:choose>
|
---|
390 | <xsl:when test="@tmtype='tm'">(TM)</xsl:when>
|
---|
391 | <xsl:when test="@tmtype='reg'">(R)</xsl:when>
|
---|
392 | <xsl:when test="@tmtype='service'">(SM)</xsl:when>
|
---|
393 | <xsl:otherwise>
|
---|
394 | <xsl:text>Error in tm type.</xsl:text>
|
---|
395 | </xsl:otherwise>
|
---|
396 | </xsl:choose>
|
---|
397 | </fo:inline>
|
---|
398 | </fo:inline>
|
---|
399 | </xsl:template>
|
---|
400 |
|
---|
401 |
|
---|
402 | <xsl:template match="*[contains(@class,' topic/boolean ')]">
|
---|
403 | <fo:inline border-left-width="0pt" border-right-width="0pt" color="green">
|
---|
404 | <!-- setclass -->
|
---|
405 | <!-- set id -->
|
---|
406 | <xsl:value-of select="name()"/><xsl:text>: </xsl:text><xsl:value-of select="@state"/>
|
---|
407 | </fo:inline>
|
---|
408 | </xsl:template>
|
---|
409 |
|
---|
410 |
|
---|
411 | <xsl:template match="*[contains(@class,' topic/state ')]">
|
---|
412 | <fo:inline border-left-width="0pt" border-right-width="0pt" color="red">
|
---|
413 | <!-- setclass -->
|
---|
414 | <!-- set id -->
|
---|
415 | <xsl:value-of select="name()"/><xsl:text>: </xsl:text><xsl:value-of select="@name"/><xsl:text>=</xsl:text><xsl:value-of select="@value"/>
|
---|
416 | </fo:inline>
|
---|
417 | </xsl:template>
|
---|
418 |
|
---|
419 |
|
---|
420 | <!-- image and object data -->
|
---|
421 | <xsl:template match="*[contains(@class,' topic/image ')]">
|
---|
422 | <!-- build any pre break indicated by style -->
|
---|
423 | <xsl:choose>
|
---|
424 | <xsl:when test="parent::fig[contains(@frame,'top')]">
|
---|
425 | <!-- NOP if there is already a break implied by a parent property -->
|
---|
426 | </xsl:when>
|
---|
427 | <xsl:otherwise>
|
---|
428 | <xsl:if test="not(@placement='inline')">
|
---|
429 | <!-- generate an FO break here -->
|
---|
430 | <fo:block>&rbl;</fo:block>
|
---|
431 | </xsl:if>
|
---|
432 | </xsl:otherwise>
|
---|
433 | </xsl:choose>
|
---|
434 |
|
---|
435 | <xsl:choose>
|
---|
436 | <xsl:when test="@placement='break'">
|
---|
437 | <fo:block>
|
---|
438 | <xsl:choose>
|
---|
439 | <xsl:when test="@align='left'"><xsl:attribute name="text-align">left</xsl:attribute></xsl:when>
|
---|
440 | <xsl:when test="@align='right'"><xsl:attribute name="text-align">right</xsl:attribute></xsl:when>
|
---|
441 | <xsl:when test="@align='center'"><xsl:attribute name="text-align">center</xsl:attribute></xsl:when>
|
---|
442 | <xsl:when test="@align='justify'"><xsl:attribute name="text-align">justify</xsl:attribute></xsl:when>
|
---|
443 | <xsl:otherwise/>
|
---|
444 | </xsl:choose>
|
---|
445 | <!--xsl:call-template name="topic-image"/-->
|
---|
446 | <xsl:call-template name="insert-graphic"/>
|
---|
447 | </fo:block>
|
---|
448 | </xsl:when>
|
---|
449 | <xsl:otherwise>
|
---|
450 | <!--xsl:call-template name="topic-image"/-->
|
---|
451 | <xsl:call-template name="insert-graphic"/>
|
---|
452 | </xsl:otherwise>
|
---|
453 | </xsl:choose>
|
---|
454 |
|
---|
455 | <!-- build any post break indicated by style -->
|
---|
456 | <xsl:choose>
|
---|
457 | <xsl:when test="parent::fig[contains(@frame,'bot')]">
|
---|
458 | <!-- NOP if there is already a break implied by a parent property -->
|
---|
459 | </xsl:when>
|
---|
460 | <xsl:otherwise>
|
---|
461 | <xsl:if test="not(@placement='inline')">
|
---|
462 | <!-- generate an FO break here -->
|
---|
463 | <fo:block> </fo:block>
|
---|
464 | </xsl:if>
|
---|
465 | </xsl:otherwise>
|
---|
466 | </xsl:choose>
|
---|
467 | <!-- build optional echo of the image name for review -->
|
---|
468 | <xsl:if test="$ARTLBL='yes'">
|
---|
469 | <fo:block font-weight="bold">[<xsl:value-of select="$IP"/> <xsl:value-of select="@href"/>]</fo:block>
|
---|
470 | </xsl:if>
|
---|
471 | </xsl:template>
|
---|
472 |
|
---|
473 | <xsl:template name="insert-graphic">
|
---|
474 | <fo:external-graphic> <!-- apply scaling attributes here? -->
|
---|
475 | <xsl:attribute name="src">url(<xsl:call-template name="get-image-uri"/>)</xsl:attribute>
|
---|
476 | <xsl:choose>
|
---|
477 | <xsl:when test="@scale"><xsl:attribute name="content-width"><xsl:value-of select="concat(@scale,'%')"/></xsl:attribute></xsl:when>
|
---|
478 | <xsl:otherwise><!--xsl:attribute name="content-width">scale-to-fit</xsl:attribute--></xsl:otherwise> <!-- no effect -->
|
---|
479 | </xsl:choose>
|
---|
480 | </fo:external-graphic>
|
---|
481 | </xsl:template>
|
---|
482 |
|
---|
483 | <!-- Get image URI -->
|
---|
484 | <xsl:template name="get-image-uri">
|
---|
485 | <xsl:param name="href" select="@href" />
|
---|
486 | <!--hard force the extension to jpg -->
|
---|
487 | <!--xsl:choose>
|
---|
488 | <xsl:when test="contains($href,'.gif')">
|
---|
489 | <xsl:value-of select="concat($img-path, substring-before($href,'.gif'), $dflt-ext)"/>
|
---|
490 | </xsl:when>
|
---|
491 | <xsl:when test="contains($href,'.jpg')">
|
---|
492 | <xsl:value-of select="concat($img-path, substring-before($href,'.jpg'), $dflt-ext)"/>
|
---|
493 | </xsl:when>
|
---|
494 | <xsl:otherwise>
|
---|
495 | <xsl:value-of select="$href"/>
|
---|
496 | </xsl:otherwise-->
|
---|
497 | <xsl:value-of select="$href"/>
|
---|
498 | <!--</xsl:choose> -->
|
---|
499 | </xsl:template>
|
---|
500 | <!-- this is unused for now, but is browser specific; must be converted! -->
|
---|
501 | <xsl:template name="topic-image">
|
---|
502 | <!-- now invoke the actual content and its alt text -->
|
---|
503 | <xsl:element name="img">
|
---|
504 | <!-- setclass -->
|
---|
505 | <xsl:attribute name="src">
|
---|
506 | <xsl:value-of select="$IP"/>
|
---|
507 | <xsl:choose>
|
---|
508 | <xsl:when test="@objname">
|
---|
509 | <!--xsl:call-template name="get-objdescinfo"/-->
|
---|
510 | </xsl:when>
|
---|
511 | <xsl:when test="@href">
|
---|
512 | <xsl:value-of select="@href"/>
|
---|
513 | </xsl:when>
|
---|
514 | <xsl:otherwise>
|
---|
515 | <!-- no action -->
|
---|
516 | </xsl:otherwise>
|
---|
517 | </xsl:choose>
|
---|
518 | </xsl:attribute>
|
---|
519 | <xsl:if test="@height"><xsl:attribute name="height"><xsl:value-of select="@height"/></xsl:attribute></xsl:if>
|
---|
520 | <xsl:if test="@width"><xsl:attribute name="width"><xsl:value-of select="@width"/></xsl:attribute></xsl:if>
|
---|
521 | <xsl:choose>
|
---|
522 | <xsl:when test="@alt">
|
---|
523 | <xsl:attribute name="alt"><xsl:value-of select="@alt"/></xsl:attribute>
|
---|
524 | </xsl:when>
|
---|
525 | <xsl:otherwise>
|
---|
526 | <xsl:attribute name="alt"><xsl:value-of select="*[contains(@class,' topic/textalt')]"/></xsl:attribute>
|
---|
527 | </xsl:otherwise>
|
---|
528 | </xsl:choose>
|
---|
529 | </xsl:element>
|
---|
530 | </xsl:template>
|
---|
531 |
|
---|
532 |
|
---|
533 | <xsl:template match="*[contains(@class,' topic/object ')]">
|
---|
534 | <fo:block>
|
---|
535 | <!-- copy through for browsers; unused for FO -->
|
---|
536 | </fo:block>
|
---|
537 | </xsl:template>
|
---|
538 |
|
---|
539 |
|
---|
540 | <xsl:template match="*[contains(@class,' topic/param ')]">
|
---|
541 | <fo:block>
|
---|
542 | <!-- copy through for browsers; unused for FO -->
|
---|
543 | </fo:block>
|
---|
544 | </xsl:template>
|
---|
545 |
|
---|
546 |
|
---|
547 |
|
---|
548 |
|
---|
549 | <!-- content usually rendered out of sequence -->
|
---|
550 |
|
---|
551 | <!-- by adding the [$DRAFT='yes'] predicate to this rule, you can cause
|
---|
552 | the content to disappear in the ordinary case. When parameterization
|
---|
553 | becomes possible, consider adding yes/no views so that content is not
|
---|
554 | "lost" by being invisible!!!! -->
|
---|
555 |
|
---|
556 | <!-- this template needs to be parametrically controlled by user for visibility -->
|
---|
557 | <xsl:template match="*[contains(@class,' topic/draft-comment ')]">
|
---|
558 | <xsl:if test="$DRAFT='yes'">
|
---|
559 | <fo:block background-color="#FF99FF" color="#CC3333">
|
---|
560 | <xsl:attribute name="border-style">solid</xsl:attribute>
|
---|
561 | <xsl:attribute name="border-color">black</xsl:attribute>
|
---|
562 | <xsl:attribute name="border-width">thin</xsl:attribute>
|
---|
563 | <fo:block font-weight="bold">
|
---|
564 | Disposition: <xsl:value-of select="@disposition"/> /
|
---|
565 | Status: <xsl:value-of select="@status"/>
|
---|
566 | </fo:block>
|
---|
567 | <xsl:apply-templates/>
|
---|
568 | </fo:block>
|
---|
569 | </xsl:if>
|
---|
570 | </xsl:template>
|
---|
571 |
|
---|
572 |
|
---|
573 | <!-- this template needs to be parametrically controlled by user for visibility -->
|
---|
574 | <xsl:template match="*[contains(@class,' topic/required-cleanup ')]">
|
---|
575 | <xsl:if test="$DRAFT='yes'">
|
---|
576 | <fo:inline background="yellow" color="#CC3333"> <!-- indents won't apply here; not a block context -->
|
---|
577 | <xsl:attribute name="border-style">solid</xsl:attribute>
|
---|
578 | <xsl:attribute name="border-color">black</xsl:attribute>
|
---|
579 | <xsl:attribute name="border-width">thin</xsl:attribute>
|
---|
580 | <!-- set id -->
|
---|
581 | <fo:inline font-weight="bold">Required Cleanup <xsl:if test="string(@remap)">(<xsl:value-of select="@remap"/>) </xsl:if><xsl:text>: </xsl:text></fo:inline>
|
---|
582 | <xsl:apply-templates />
|
---|
583 | </fo:inline>
|
---|
584 | </xsl:if>
|
---|
585 | </xsl:template>
|
---|
586 |
|
---|
587 |
|
---|
588 | <xsl:template match="*[contains(@class,' topic/fn ')]">
|
---|
589 | <fo:block font-size="8pt" color="purple">
|
---|
590 | <xsl:if test="@id">
|
---|
591 | <fo:inline font-style="italic">
|
---|
592 | <xsl:text>[Footnote: </xsl:text>
|
---|
593 | <xsl:value-of select="@id"/>
|
---|
594 | <xsl:text>]</xsl:text>
|
---|
595 | </fo:inline>
|
---|
596 | </xsl:if>
|
---|
597 | <xsl:if test="@callout">
|
---|
598 | <fo:inline baseline-shift="super" font-size="75%">
|
---|
599 | <xsl:value-of select="@callout"/>
|
---|
600 | <!--xsl:number level="multiple" count="//fn" format="1 "/-->
|
---|
601 | </fo:inline>
|
---|
602 | </xsl:if>
|
---|
603 | <xsl:apply-templates/>
|
---|
604 | </fo:block>
|
---|
605 | </xsl:template>
|
---|
606 |
|
---|
607 | <xsl:template match="footnotex">
|
---|
608 | <fo:footnote>
|
---|
609 | <fo:inline baseline-shift="super" font-size="7pt" font-family="Helvetica">
|
---|
610 | <xsl:number count="//fn" format="1" />
|
---|
611 | </fo:inline>
|
---|
612 | <fo:footnote-body>
|
---|
613 | <!--fo:block space-after="0pt">
|
---|
614 | <fo:leader leader-pattern="rule" leader-length="1in" rule-thickness=".5pt" color="black"/>
|
---|
615 | <fo:leader leader-pattern="rule" leader-length="30%" rule-thickness="1pt" rule-style="solid"/>
|
---|
616 | </fo:block-->
|
---|
617 | <fo:block xsl:use-attribute-sets="footnote">
|
---|
618 | <fo:inline baseline-shift="super" font-size="75%">
|
---|
619 | <xsl:number level="multiple" count="//fn" format="1 "/>
|
---|
620 | </fo:inline>
|
---|
621 | <xsl:apply-templates />
|
---|
622 | </fo:block>
|
---|
623 | </fo:footnote-body>
|
---|
624 | </fo:footnote>
|
---|
625 | </xsl:template>
|
---|
626 |
|
---|
627 |
|
---|
628 |
|
---|
629 | <!-- other special data -->
|
---|
630 |
|
---|
631 | <!-- this rule is prolog-specific; can move it into dita-prolog.xsl if desired -->
|
---|
632 | <xsl:template match="*[contains(@class,' topic/keywords ')]/*[contains(@class,' topic/keyword ')]" priority="2">
|
---|
633 | <fo:inline>
|
---|
634 | <xsl:text> [</xsl:text><xsl:apply-templates /><xsl:text>] </xsl:text>
|
---|
635 | </fo:inline>
|
---|
636 | </xsl:template>
|
---|
637 |
|
---|
638 | <xsl:template match="*[contains(@class,' topic/keyword ')]">
|
---|
639 | <fo:inline border-left-width="0pt" border-right-width="0pt">
|
---|
640 | <!-- setclass -->
|
---|
641 | <!-- set id -->
|
---|
642 | <xsl:apply-templates />
|
---|
643 | </fo:inline>
|
---|
644 | </xsl:template>
|
---|
645 |
|
---|
646 |
|
---|
647 | <xsl:template match="*[contains(@class,' topic/cite ')]">
|
---|
648 | <fo:inline font-style="italic">
|
---|
649 | <!-- setclass -->
|
---|
650 | <!-- set id -->
|
---|
651 | <xsl:apply-templates />
|
---|
652 | </fo:inline>
|
---|
653 | </xsl:template>
|
---|
654 |
|
---|
655 |
|
---|
656 | <xsl:template match="*[contains(@class,' topic/indextermref ')]">
|
---|
657 | <fo:inline font-style="italic">
|
---|
658 | <!-- setclass -->
|
---|
659 | <!-- set id -->
|
---|
660 | <xsl:apply-templates />
|
---|
661 | </fo:inline>
|
---|
662 | </xsl:template>
|
---|
663 |
|
---|
664 |
|
---|
665 | <xsl:template match="*[contains(@class,' topic/indexterm ')]" priority="3"/>
|
---|
666 | <xsl:template name="nulled-indexterm">
|
---|
667 | <fo:inline margin="1pt" background-color="#ffddff"><!-- border="1pt black solid;"-->
|
---|
668 | <!-- setclass -->
|
---|
669 | [ <xsl:apply-templates/> ]
|
---|
670 | </fo:inline>
|
---|
671 | </xsl:template>
|
---|
672 |
|
---|
673 | <!-- Add for "New <data> element (#9)" in DITA 1.1 -->
|
---|
674 | <xsl:template match="*[contains(@class,' topic/data ')]"/>
|
---|
675 |
|
---|
676 | <!-- Add for "Support foreign content vocabularies such as
|
---|
677 | MathML and SVG with <unknown> (#35) " in DITA 1.1 -->
|
---|
678 | <xsl:template match="*[contains(@class,' topic/foreign ') or contains(@class,' topic/unknown ')]"/>
|
---|
679 |
|
---|
680 | <!-- =================== end of element rules ====================== -->
|
---|
681 |
|
---|
682 |
|
---|
683 |
|
---|
684 | </xsl:stylesheet>
|
---|