]> git.stg.codes - stg.git/blob - doc/xslt/slides/keynote/default.xsl
USER_STAT refactoring.
[stg.git] / doc / xslt / slides / keynote / default.xsl
1 <xsl:stylesheet version='1.0'
2   xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
3   xmlns='http://developer.apple.com/schemas/APXL'
4   xmlns:apxl='http://developer.apple.com/schemas/APXL'
5   xmlns:plugin='http://developer.apple.com/schemas/APXLPlugins'
6   xmlns:doc='http://nwalsh.com/xsl/documentation/1.0'
7   xmlns:str='http://xsltsl.org/string'
8   xmlns:math='http://xsltsl.org/math'
9   exclude-result-prefixes='doc str math'>
10
11   <xsl:import href='xsltsl/stdlib.xsl'/>
12   <xsl:output method='xml' indent='yes' encoding='UTF-8'/>
13   <xsl:strip-space elements='*'/>
14
15   <doc:article xmlns=''>
16     <articleinfo>
17       <title>Keynote Slides</title>
18
19       <author>
20         <firstname>Steve</firstname>
21         <surname>Ball</surname>
22         <affiliation>
23           <orgname>Zveno</orgname>
24           <address>
25             <otheraddr>
26               <ulink url='http://www.zveno.com/'>zveno.com</ulink>
27             </otheraddr>
28           </address>
29         </affiliation>
30       </author>
31
32       <releaseinfo>$Id: default.xsl 3991 2004-11-10 06:51:55Z balls $</releaseinfo>
33
34       <copyright>
35         <year>2004</year>
36         <year>2003</year>
37         <holder>Steve Ball, Zveno Pty Ltd</holder>
38       </copyright>
39
40       <legalnotice>
41         <para>Zveno Pty Ltd makes this software and associated documentation available free of charge for any purpose.  You may make copies of the software but you must include all of this notice on any copy.</para>
42         <para>Zveno Pty Ltd does not warrant that this software is error free or fit for any purpose.  Zveno Pty Ltd disclaims any liability for all claims, expenses, losses, damages and costs any user may incur as a result of using, copying or modifying the software.</para>
43       </legalnotice>
44     </articleinfo>
45   </doc:article>
46
47   <xsl:param name='slides'/>
48
49   <xsl:variable name='slide-master' select='"Title &amp; Subtitle"'/>
50   <xsl:variable name='foilgroup-master' select='"Title - Center"'/>
51   <xsl:variable name='overview-master' select='"Title - Top"'/>
52   <xsl:variable name='bullet-master' select='"SmlTitle &amp; Bullets"'/>
53   <xsl:variable name='bullet-and-image-master' select='"Title &amp; Bullets - Left"'/>
54   <xsl:variable name='title-only-master' select='"SmlTitle"'/>
55
56   <xsl:variable name='masters' select='/apxl:presentation/apxl:theme/apxl:master-slides'/>
57
58   <xsl:template match='/'>
59     <xsl:choose>
60       <xsl:when test='$slides = ""'>
61         <xsl:message terminate='yes'>You must specify your slides document using the "slides" parameter</xsl:message>
62       </xsl:when>
63       <xsl:otherwise>
64         <xsl:apply-templates/>
65       </xsl:otherwise>
66     </xsl:choose>
67   </xsl:template>
68
69   <xsl:template match='apxl:slide-list'>
70     <slide-list>
71       <xsl:apply-templates select='document($slides)' mode='slides'/>
72     </slide-list>
73   </xsl:template>
74
75   <xsl:template match='slides' mode='slides'>
76     <slide id='slide-1' master-slide-id="{$masters/apxl:master-slide[@name=$slide-master]/@id}">
77       <drawables>
78         <body visibility='tracks-master' vertical-alignment='tracks-master'/>
79         <title visibility='tracks-master' vertical-alignment='tracks-master'/>
80       </drawables>
81       <transition-style type='inherited'/>
82       <thumbnails>
83         <thumbnail file='thumbs/st0.tiff' byte-size='6520' size='60 45'/>
84       </thumbnails>
85       <bullets>
86         <bullet marker-type='inherited' level='0'>
87           <content tab-stops='L 96' font-size='84' font-color='g1' font-name='GillSans' paragraph-alignment='center'>
88             <xsl:apply-templates select='slidesinfo/title/node()'/>
89           </content>
90         </bullet>
91         <xsl:choose>
92           <xsl:when test='slidesinfo/subtitle'>
93             <bullet marker-type='inherited' level='1'>
94               <content tab-stops='L 96' font-size='36' font-color='g1' font-name='GillSans' paragraph-alignment='center'>
95                 <xsl:apply-templates select='slidesinfo/subtitle/node()' mode='slides'/>
96               </content>
97             </bullet>
98           </xsl:when>
99           <xsl:when test='slidesinfo/corpauthor'>
100             <bullet marker-type='inherited' level='1'>
101               <content tab-stops='L 96' font-size='36' font-color='g1' font-name='GillSans' paragraph-alignment='center'>
102                 <xsl:apply-templates select='slidesinfo/corpauthor/node()' mode='slides'/>
103               </content>
104             </bullet>
105           </xsl:when>
106           <xsl:when test='slidesinfo/author'>
107             <bullet marker-type='inherited' level='1'>
108               <content tab-stops='L 96' font-size='36' font-color='g1' font-name='GillSans' paragraph-alignment='center'>
109                 <xsl:apply-templates select='slidesinfo/author' mode='slides'/>
110               </content>
111             </bullet>
112           </xsl:when>
113         </xsl:choose>
114       </bullets>
115       <notes font-size='18' font-name='LucidaGrande'>
116         <xsl:apply-templates select='slidesinfo/*[not(self::title|self::subtitle|self::corpauthor|self::author)]' mode='slides'/>
117       </notes>
118     </slide>
119
120     <xsl:if test='foilgroup'>
121       <xsl:call-template name='overview'/>
122     </xsl:if>
123
124     <xsl:apply-templates select='foilgroup|foil' mode='slides'/>
125   </xsl:template>
126
127   <xsl:template name='overview'>
128     <xsl:param name='current' select='/'/>
129
130     <slide id='overview-{generate-id()}' master-slide-id="{$masters/apxl:master-slide[@name=$overview-master]/@id}">
131       <drawables>
132         <body visibility='tracks-master' vertical-alignment='tracks-master'/>
133         <title visibility='tracks-master' vertical-alignment='tracks-master'/>
134
135         <xsl:for-each select='ancestor-or-self::slides/foilgroup'>
136           <textbox id='textbox-{position()}' grow-horizontally='true' transformation='1 0 0 1 {100 + floor((position() - 1) div 10) * 400} {200 + floor((position() - 1) mod 10) * 50}' size='200 50'>
137             <content tab-stops='L 84' font-size='36' paragraph-alignment='left'>
138               <xsl:attribute name='font-color'>
139                 <xsl:choose>
140                   <xsl:when test='generate-id() = generate-id($current)'>
141                     <xsl:text>1 0.5 0</xsl:text>
142                   </xsl:when>
143                   <xsl:otherwise>g1</xsl:otherwise>
144                 </xsl:choose>
145               </xsl:attribute>
146               <xsl:apply-templates select='title' mode='slides'/>
147             </content>
148           </textbox>
149         </xsl:for-each>
150
151       </drawables>
152       <transition-style type='inherited'/>
153       <thumbnails>
154         <thumbnail file='thumbs/st0.tiff' byte-size='6520' size='60 45'/>
155       </thumbnails>
156       <bullets>
157         <bullet marker-type='inherited' level='0'>
158           <content tab-stops='L 96' font-size='84' font-color='g1' font-name='GillSans' paragraph-alignment='center'>Overview</content>
159         </bullet>
160       </bullets>
161     </slide>
162   </xsl:template>
163
164   <xsl:template match='author' mode='slides'>
165     <xsl:apply-templates select='firstname/node()' mode='slides'/>
166     <xsl:text> </xsl:text>
167     <xsl:apply-templates select='surname/node()' mode='slides'/>
168   </xsl:template>
169   <xsl:template match='copyright' mode='slides'>
170     <xsl:text>Copyright (c) </xsl:text>
171     <xsl:value-of select='year'/>
172     <xsl:text> </xsl:text>
173     <xsl:apply-templates select='holder' mode='slides'/>
174     <xsl:text>.  </xsl:text>
175   </xsl:template>
176
177   <xsl:template match='foilgroup' mode='slides'>
178     <xsl:variable name='number' select='count(preceding-sibling::foilgroup) + count(preceding::foil) + 1'/>
179
180     <xsl:call-template name='overview'>
181       <xsl:with-param name='current' select='.'/>
182     </xsl:call-template>
183
184     <slide id='foilgroup-{generate-id()}'>
185       <xsl:attribute name='master-slide-id'>
186         <xsl:choose>
187           <xsl:when test='*[not(self::foil|self::foilgroupinfo|self::speakernotes)]'>
188             <xsl:value-of select='$masters/apxl:master-slide[@name=$title-only-master]/@id'/>
189           </xsl:when>
190           <xsl:otherwise>
191             <xsl:value-of select='$masters/apxl:master-slide[@name=$foilgroup-master]/@id'/>
192           </xsl:otherwise>
193         </xsl:choose>
194       </xsl:attribute>
195
196       <drawables>
197         <title visibility='tracks-master' vertical-alignment='tracks-master'/>
198         <body visibility='hidden' vertical-alignment='tracks-master'/>
199         <xsl:call-template name='drawables'/>
200       </drawables>
201       <transition-style type='inherited'/>
202       <thumbnails>
203         <thumbnail file='thumbs/st0.tiff' byte-size='6520' size='60 45'/>
204       </thumbnails>
205       <bullets>
206         <bullet marker-type='inherited' level='0'>
207           <content tab-stops='L 96' font-size='84' font-color='g1' font-name='GillSans' paragraph-alignment='center'>
208             <xsl:apply-templates select='title' mode='slides'/>
209           </content>
210         </bullet>
211
212         <xsl:apply-templates select='itemizedlist/listitem' mode='slides'/>
213       </bullets>
214       <xsl:if test='speakernotes'>
215         <notes font-size='18' font-name='LucidaGrande'>
216           <xsl:apply-templates select='speakernotes/para[1]/node()' mode='slides'/>
217           <xsl:for-each select='speakernotes/para[position() != 1]'>
218             <xsl:text>; </xsl:text>
219             <xsl:apply-templates select='node()' mode='slides'/>
220           </xsl:for-each>
221         </notes>
222       </xsl:if>
223     </slide>
224
225     <xsl:apply-templates select='foil' mode='slides'/>
226
227   </xsl:template>
228
229   <xsl:template match='foil' mode='slides'>
230     <xsl:variable name='number' select='count(preceding::foilgroup) + count(preceding::foil) + count(preceding-sibling::foil) + 1'/>
231
232     <slide id='foil-{generate-id()}'>
233       <xsl:attribute name='master-slide-id'>
234         <xsl:choose>
235           <xsl:when test='imageobject'>
236             <xsl:value-of select='$masters/apxl:master-slide[@name=$title-only-master]/@id'/>
237           </xsl:when>
238           <xsl:when test='itemizedlist[.//imageobject]'>
239             <xsl:value-of select='$masters/apxl:master-slide[@name=$bullet-and-image-master]/@id'/>
240           </xsl:when>
241           <xsl:when test='itemizedlist'>
242             <xsl:value-of select='$masters/apxl:master-slide[@name=$bullet-master]/@id'/>
243           </xsl:when>
244           <xsl:when test='example|informalexample'>
245             <xsl:value-of select='$masters/apxl:master-slide[@name=$title-only-master]/@id'/>
246           </xsl:when>
247           <xsl:otherwise>
248             <xsl:value-of select='$masters/apxl:master-slide[@name=$bullet-master]/@id'/>
249           </xsl:otherwise>
250         </xsl:choose>
251       </xsl:attribute>
252       <drawables>
253         <body visibility='tracks-master' vertical-alignment='tracks-master'/>
254         <title visibility='tracks-master' vertical-alignment='tracks-master'/>
255         <xsl:call-template name='drawables'/>
256       </drawables>
257       <transition-style type='inherited'/>
258       <thumbnails>
259         <thumbnail file='thumbs/st0.tiff' byte-size='6520' size='60 45'/>
260       </thumbnails>
261       <bullets>
262         <bullet marker-type='inherited' level='0'>
263           <content tab-stops='L 96' font-size='64' font-color='g1' font-name='GillSans' paragraph-alignment='inherited'>
264             <!--
265             <xsl:apply-templates select='../title' mode='slides'/>
266             <xsl:text>: </xsl:text>
267 -->
268             <xsl:apply-templates select='title' mode='slides'/>
269           </content>
270         </bullet>
271         <xsl:apply-templates select='itemizedlist/listitem' mode='slides'/>
272       </bullets>
273       <xsl:if test='speakernotes'>
274         <notes font-size='18' font-name='LucidaGrande'>
275           <xsl:apply-templates select='speakernotes/para[1]/node()' mode='slides'/>
276           <xsl:for-each select='speakernotes/para[position() != 1]'>
277             <xsl:text>; </xsl:text>
278             <xsl:apply-templates select='node()' mode='slides'/>
279           </xsl:for-each>
280         </notes>
281       </xsl:if>
282     </slide>
283   </xsl:template>
284
285   <doc:template xmlns=''>
286     <title>drawables Template</title>
287
288     <para>This template adds objects to the drawables section of a foil.  These include images, as well as unadorned (non-bullet) text.</para>
289
290     <para>A single image is placed centered on the foil.  An image on a foil that contains other text is placed on the right-hand-side.</para>
291   </doc:template>
292
293   <xsl:template name='drawables'>
294     <xsl:choose>
295       <xsl:when test='imageobject'>
296         <plugin opacity='1' transformation='1 0 0 1 140 130'>
297           <plugin-data>
298             <plugin:movie bundled='true' src='{imageobject/imagedata/@fileref}' key='root' width='740' height='560'/>
299             <string key='CPVersion'>1.0</string>
300             <string key='MIMEType'>video/quicktime</string>
301           </plugin-data>
302           <styles>
303             <shadow-style opacity='0' radius='0'/>
304           </styles>
305         </plugin>
306       </xsl:when>
307       <xsl:when test='false() and .//informaltable|.//table'>
308         <xsl:variable name='table' select='.//informaltable|.//table[1]'/>
309         <xsl:variable name='cells' select='$table/tgroup/*/row/entry'/>
310         <xsl:variable name='numrows' select='count($table/tgroup/*/row)'/>
311         <xsl:variable name='numcols' select='count($table/tgroup/*[1]/row[1]/entry)'/>
312         <xsl:variable name='identbase' select='count($table/preceding::node())'/>
313
314         <plugin transformation='1 0 0 1 200 200'>
315           <plugin-data>
316             <plugin:table key='root' version='1.2'>
317               <xsl:attribute name='size'>
318                 <xsl:text>{800, 400}</xsl:text>
319               </xsl:attribute>
320
321               <dict/>
322               <xsl:for-each select='$cells'>
323                 <plugin:element type='text' tr='5834' bl='5838' tl='5833' br='5839'>
324                   <xsl:attribute name='tl'>
325                     <xsl:value-of select='$identbase + (floor(position() div $numcols) * ($numcols + 1)) + (position() mod $numcols)'/>
326                   </xsl:attribute>
327                   <xsl:attribute name='tr'>
328                     <xsl:value-of select='$identbase + (floor(position() div $numcols) * ($numcols + 1)) + (position() mod $numcols) + 1'/>
329                   </xsl:attribute>
330                   <xsl:attribute name='bl'>
331                     <xsl:value-of select='$identbase + (floor(position() div $numcols) * ($numcols + 1) + 1) + (position() mod $numcols)'/>
332                   </xsl:attribute>
333                   <xsl:attribute name='br'>
334                     <xsl:value-of select='$identbase + (floor(position() div $numcols) * ($numcols + 1) + 1) + (position() mod $numcols) + 1'/>
335                   </xsl:attribute>
336                   <plugin:node ident='5833'>
337                   <xsl:attribute name='pos'>
338                     <xsl:text>{0, 300}</xsl:text>
339                   </xsl:attribute>
340                 </plugin:node>
341                 <plugin:node ident='5834'>
342                   <xsl:attribute name='pos'>
343                     <xsl:text>{150, 300}</xsl:text>
344                   </xsl:attribute>
345                 </plugin:node>
346                 <plugin:node ident='5838'>
347                   <xsl:attribute name='pos'>
348                     <xsl:text>{0, 200}</xsl:text>
349                   </xsl:attribute>
350                 </plugin:node>
351                 <plugin:node ident='5839'>
352                   <xsl:attribute name='pos'>
353                     <xsl:text>{150, 200}</xsl:text>
354                   </xsl:attribute>
355                 </plugin:node>
356                 <content tab-stops='L 84' font-size='32' font-color='g1' font-name='GillSans' paragraph-alignment='center'>
357                   <xsl:value-of select='$cells[1]'/>
358                 </content>
359                 <dict/>
360               </plugin:element>
361                 
362               </xsl:for-each>
363             </plugin:table>
364           </plugin-data>
365         </plugin>
366       </xsl:when>
367       <xsl:otherwise>
368         <xsl:if test='not(self::foilgroup) and .//imageobject'>
369           <xsl:variable name='base'>
370             <xsl:call-template name='str:substring-after-last'>
371               <xsl:with-param name='text' select='.//imageobject/imagedata/@fileref'/>
372               <xsl:with-param name='chars' select='"/"'/>
373             </xsl:call-template>
374           </xsl:variable>
375           <image display-name='{$base}' id='image-1' image-data='{.//imageobject/imagedata/@fileref}' byte-size='1' transformation='1 0 0 1 500 200' natural-size='{.//imageobject/imagedata/@width} {.//imageobject/imagedata/@height}' lock-aspect-ratio='true'/>
376         </xsl:if>
377         <xsl:apply-templates select='para|informalexample|example' mode='slides'/>
378       </xsl:otherwise>
379     </xsl:choose>
380   </xsl:template>
381
382   <xsl:template match='itemizedlist/listitem' mode='slides'>
383     <bullet marker-type='inherited' level='{count(ancestor::itemizedlist)}'>
384       <content tab-stops='L 96' font-size='36' font-color='g1' font-name='GillSans' paragraph-alignment='left'>
385         <xsl:apply-templates select='para|informalexample' mode='slides'/>
386       </content>
387     </bullet>
388     <xsl:apply-templates select='itemizedlist/listitem' mode='slides'/>
389   </xsl:template>
390   <xsl:template match='listitem/para|listitem/informalexample' mode='slides'>
391     <xsl:if test='preceding-sibling::*'>
392       <xsl:text>
393
394 </xsl:text>
395     </xsl:if>
396     <xsl:apply-templates mode='slides'/>
397   </xsl:template>
398   <xsl:template match='listitem/informalexample/programlisting' mode='slides'>
399     <textbox transformation='1 0 0 1 110 260' size='830 82'>
400       <content tab-stops='L 84' font-size='36' font-color='g1' font-name='AmericanTypewriter-CondensedBold' paragraph-alignment='left'>
401         <xsl:call-template name='literallayout'/>
402       </content>
403     </textbox>
404   </xsl:template>
405
406   <xsl:template name='literallayout'>
407     <xsl:param name='nodes' select='node()'/>
408     <xsl:param name='inCDATA' select='false()'/>
409
410     <xsl:choose>
411       <xsl:when test='not($nodes) and $inCDATA'>
412         <xsl:text disable-output-escaping='yes'>]]&gt;</xsl:text>
413       </xsl:when>
414       <xsl:when test='not($nodes)'/>
415       <xsl:when test='$nodes[1][self::emphasis] and $inCDATA'>
416         <xsl:text disable-output-escaping='yes'>]]&gt;</xsl:text>
417         <xsl:apply-templates select='$nodes[1]' mode='literal'/>
418         <xsl:call-template name='literallayout'>
419           <xsl:with-param name='nodes' select='$nodes[position() != 1]'/>
420         </xsl:call-template>
421       </xsl:when>
422       <xsl:when test='$nodes[1][self::emphasis]'>
423         <xsl:apply-templates select='$nodes[1]' mode='literal'/>
424         <xsl:call-template name='literallayout'>
425           <xsl:with-param name='nodes' select='$nodes[position() != 1]'/>
426         </xsl:call-template>
427       </xsl:when>
428       <xsl:when test='$inCDATA'>
429         <xsl:apply-templates select='$nodes[1]' mode='literal'/>
430         <xsl:call-template name='literallayout'>
431           <xsl:with-param name='nodes' select='$nodes[position() != 1]'/>
432           <xsl:with-param name='inCDATA' select='$inCDATA'/>
433         </xsl:call-template>
434       </xsl:when>
435       <xsl:otherwise>
436         <xsl:text disable-output-escaping='yes'>&lt;![CDATA[</xsl:text>
437         <xsl:apply-templates select='$nodes[1]' mode='literal'/>
438         <xsl:call-template name='literallayout'>
439           <xsl:with-param name='nodes' select='$nodes[position() != 1]'/>
440           <xsl:with-param name='inCDATA' select='true()'/>
441         </xsl:call-template>
442       </xsl:otherwise>
443     </xsl:choose>
444   </xsl:template>
445
446   <xsl:template match='para' mode='slides'>
447     <textbox transformation='1 0 0 1 110 {200 + count(preceding-sibling::para|preceding-sibling::informalexample) * 60}' size='830 41'>
448       <content tab-stops='L 84' font-size='36' font-color='g1' paragraph-alignment='left'>
449         <xsl:attribute name='font-name'>
450           <xsl:choose>
451             <xsl:when test='@font-style = "italic"'>GillSans-Italic</xsl:when>
452             <xsl:otherwise>GillSans</xsl:otherwise>
453           </xsl:choose>
454         </xsl:attribute>
455
456         <xsl:apply-templates mode='slides'/>
457       </content>
458     </textbox>
459   </xsl:template>
460
461   <xsl:template match='text()' mode='slides'>
462     <xsl:variable name='tmp'>
463       <xsl:call-template name='str:subst'>
464         <xsl:with-param name='text' select='.'/>
465         <xsl:with-param name='replace'>&quot;</xsl:with-param>
466         <xsl:with-param name='with'>“</xsl:with-param>
467       </xsl:call-template>
468     </xsl:variable>
469     <xsl:variable name='content'>
470       <xsl:call-template name='str:subst'>
471         <xsl:with-param name='text' select='$tmp'/>
472         <xsl:with-param name='replace'>]]&gt;</xsl:with-param>
473         <xsl:with-param name='with'>]] &gt;</xsl:with-param>
474       </xsl:call-template>
475     </xsl:variable>
476     <xsl:choose>
477       <xsl:when test='ancestor::programlisting'>
478         <xsl:value-of disable-output-escaping='yes' select='$content'/>
479       </xsl:when>
480       <xsl:otherwise>
481         <xsl:value-of select='$content'/>
482       </xsl:otherwise>
483     </xsl:choose>
484   </xsl:template>
485   <xsl:template match='text()' mode='literal'>
486     <xsl:variable name='tmp'>
487       <xsl:call-template name='str:subst'>
488         <xsl:with-param name='text' select='.'/>
489         <xsl:with-param name='replace'>&lt;</xsl:with-param>
490         <xsl:with-param name='with'>&lt;</xsl:with-param>
491         <xsl:with-param name='disable-output-escaping' select='yes'/>
492       </xsl:call-template>
493     </xsl:variable>
494     <xsl:variable name='tmp2'>
495       <xsl:call-template name='str:subst'>
496         <xsl:with-param name='text' select='$tmp'/>
497         <xsl:with-param name='replace'>]]&gt;</xsl:with-param>
498         <xsl:with-param name='with'>]] &gt;</xsl:with-param>
499         <xsl:with-param name='disable-output-escaping' select='yes'/>
500       </xsl:call-template>
501     </xsl:variable>
502     <xsl:value-of select='$tmp2' disable-output-escaping='yes'/>
503   </xsl:template>
504
505   <xsl:template match='informalexample|example' mode='slides'>
506     <xsl:apply-templates mode='slides'/>
507   </xsl:template>
508   <xsl:template match='programlisting' mode='slides'>
509     <xsl:variable name='lines'>
510       <xsl:call-template name='str:count-substring'>
511         <xsl:with-param name='text' select='text()'/>
512         <xsl:with-param name='chars' select='"&#x0a;"'/>
513       </xsl:call-template>
514     </xsl:variable>
515     <xsl:variable name='offset'>
516       <xsl:choose>
517         <xsl:when test='string-length(../preceding-sibling::para) > 45'>20</xsl:when>
518         <xsl:otherwise>0</xsl:otherwise>
519       </xsl:choose>
520     </xsl:variable>
521     <!-- xsl:comment> layout programlisting with offset <xsl:value-of select='$offset'/> have preceding-sibling para? <xsl:value-of select='count(../preceding-sibling::para)'/> length <xsl:value-of select='string-length(../preceding-sibling::para)'/></xsl:comment -->
522     <textbox transformation='1 0 0 1 110 {200 + $offset + count(preceding-sibling::para|../preceding-sibling::para|preceding-sibling::informalexample|preceding-sibling::example) * 60}' size='830 {($lines + 1) * 41}'>     
523       <content tab-stops='L 84' font-size='36' font-color='g1' font-name='AmericanTypewriter-CondensedBold' paragraph-alignment='left'>
524         <xsl:choose>
525           <xsl:when test='emphasis'>
526             <xsl:call-template name='literallayout'/>
527           </xsl:when>
528           <xsl:otherwise>
529             <span>
530               <xsl:call-template name='literallayout'/>
531             </span>
532           </xsl:otherwise>
533         </xsl:choose>
534       </content>
535     </textbox>
536   </xsl:template>
537
538   <xsl:template match='emphasis' mode='literal'>
539     <span>
540       <xsl:choose>
541         <xsl:when test='ancestor::programlisting and @font-style = "italic" and @font-weight="bold"'>
542           <xsl:attribute name='font-name'>AmericanTypewriter-CondensedBoldItalic</xsl:attribute>
543         </xsl:when>
544         <xsl:when test='@font-style = "italic" and @font-weight="bold"'>
545           <xsl:attribute name='font-name'>GillSans-BoldItalic</xsl:attribute>
546         </xsl:when>
547         <xsl:when test='ancestor::programlisting and @font-style = "italic"'>
548           <xsl:attribute name='font-name'>AmericanTypewriter-CondensedItalic</xsl:attribute>
549         </xsl:when>
550         <xsl:when test='@font-style = "italic"'>
551           <xsl:attribute name='font-name'>GillSans-Italic</xsl:attribute>
552         </xsl:when>
553         <xsl:when test='ancestor::programlisting and @font-weight = "bold"'>
554           <xsl:attribute name='font-name'>AmericanTypewriter-CondensedBold</xsl:attribute>
555         </xsl:when>
556         <xsl:when test='@font-weight = "bold"'>
557           <xsl:attribute name='font-name'>GillSans-Bold</xsl:attribute>
558         </xsl:when>
559       </xsl:choose>
560       <xsl:if test='@fill'>
561         <xsl:attribute name='font-color'>
562           <xsl:variable name='red'>
563             <xsl:call-template name='math:cvt-hex-decimal'>
564               <xsl:with-param name='value' select='substring(@fill, 2, 2)'/>
565             </xsl:call-template>
566           </xsl:variable>
567           <xsl:variable name='green'>
568             <xsl:call-template name='math:cvt-hex-decimal'>
569               <xsl:with-param name='value' select='substring(@fill, 4, 2)'/>
570             </xsl:call-template>
571           </xsl:variable>
572           <xsl:variable name='blue'>
573             <xsl:call-template name='math:cvt-hex-decimal'>
574               <xsl:with-param name='value' select='substring(@fill, 6, 2)'/>
575             </xsl:call-template>
576           </xsl:variable>
577
578           <xsl:value-of select='$red div 255'/>
579           <xsl:text> </xsl:text>
580           <xsl:value-of select='$green div 255'/>
581           <xsl:text> </xsl:text>
582           <xsl:value-of select='$blue div 255'/>
583         </xsl:attribute>
584       </xsl:if>
585       <xsl:call-template name='literallayout'/>
586     </span>
587   </xsl:template>
588
589   <xsl:template match="*">
590     <xsl:copy>
591       <xsl:for-each select="@*">
592         <xsl:copy/>
593       </xsl:for-each>
594       <xsl:apply-templates/>
595     </xsl:copy>
596   </xsl:template>
597   <xsl:template match="comment()|processing-instruction()">
598     <xsl:copy/>
599   </xsl:template>
600 </xsl:stylesheet>