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'>
11 <xsl:import href='xsltsl/stdlib.xsl'/>
12 <xsl:output method='xml' indent='yes' encoding='UTF-8'/>
13 <xsl:strip-space elements='*'/>
15 <doc:article xmlns=''>
17 <title>Keynote Slides</title>
20 <firstname>Steve</firstname>
21 <surname>Ball</surname>
23 <orgname>Zveno</orgname>
26 <ulink url='http://www.zveno.com/'>zveno.com</ulink>
32 <releaseinfo>$Id: default.xsl 3991 2004-11-10 06:51:55Z balls $</releaseinfo>
37 <holder>Steve Ball, Zveno Pty Ltd</holder>
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>
47 <xsl:param name='slides'/>
49 <xsl:variable name='slide-master' select='"Title & 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 & Bullets"'/>
53 <xsl:variable name='bullet-and-image-master' select='"Title & Bullets - Left"'/>
54 <xsl:variable name='title-only-master' select='"SmlTitle"'/>
56 <xsl:variable name='masters' select='/apxl:presentation/apxl:theme/apxl:master-slides'/>
58 <xsl:template match='/'>
60 <xsl:when test='$slides = ""'>
61 <xsl:message terminate='yes'>You must specify your slides document using the "slides" parameter</xsl:message>
64 <xsl:apply-templates/>
69 <xsl:template match='apxl:slide-list'>
71 <xsl:apply-templates select='document($slides)' mode='slides'/>
75 <xsl:template match='slides' mode='slides'>
76 <slide id='slide-1' master-slide-id="{$masters/apxl:master-slide[@name=$slide-master]/@id}">
78 <body visibility='tracks-master' vertical-alignment='tracks-master'/>
79 <title visibility='tracks-master' vertical-alignment='tracks-master'/>
81 <transition-style type='inherited'/>
83 <thumbnail file='thumbs/st0.tiff' byte-size='6520' size='60 45'/>
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()'/>
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'/>
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'/>
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'/>
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'/>
120 <xsl:if test='foilgroup'>
121 <xsl:call-template name='overview'/>
124 <xsl:apply-templates select='foilgroup|foil' mode='slides'/>
127 <xsl:template name='overview'>
128 <xsl:param name='current' select='/'/>
130 <slide id='overview-{generate-id()}' master-slide-id="{$masters/apxl:master-slide[@name=$overview-master]/@id}">
132 <body visibility='tracks-master' vertical-alignment='tracks-master'/>
133 <title visibility='tracks-master' vertical-alignment='tracks-master'/>
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'>
140 <xsl:when test='generate-id() = generate-id($current)'>
141 <xsl:text>1 0.5 0</xsl:text>
143 <xsl:otherwise>g1</xsl:otherwise>
146 <xsl:apply-templates select='title' mode='slides'/>
152 <transition-style type='inherited'/>
154 <thumbnail file='thumbs/st0.tiff' byte-size='6520' size='60 45'/>
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>
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'/>
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>
177 <xsl:template match='foilgroup' mode='slides'>
178 <xsl:variable name='number' select='count(preceding-sibling::foilgroup) + count(preceding::foil) + 1'/>
180 <xsl:call-template name='overview'>
181 <xsl:with-param name='current' select='.'/>
184 <slide id='foilgroup-{generate-id()}'>
185 <xsl:attribute name='master-slide-id'>
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'/>
191 <xsl:value-of select='$masters/apxl:master-slide[@name=$foilgroup-master]/@id'/>
197 <title visibility='tracks-master' vertical-alignment='tracks-master'/>
198 <body visibility='hidden' vertical-alignment='tracks-master'/>
199 <xsl:call-template name='drawables'/>
201 <transition-style type='inherited'/>
203 <thumbnail file='thumbs/st0.tiff' byte-size='6520' size='60 45'/>
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'/>
212 <xsl:apply-templates select='itemizedlist/listitem' mode='slides'/>
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'/>
225 <xsl:apply-templates select='foil' mode='slides'/>
229 <xsl:template match='foil' mode='slides'>
230 <xsl:variable name='number' select='count(preceding::foilgroup) + count(preceding::foil) + count(preceding-sibling::foil) + 1'/>
232 <slide id='foil-{generate-id()}'>
233 <xsl:attribute name='master-slide-id'>
235 <xsl:when test='imageobject'>
236 <xsl:value-of select='$masters/apxl:master-slide[@name=$title-only-master]/@id'/>
238 <xsl:when test='itemizedlist[.//imageobject]'>
239 <xsl:value-of select='$masters/apxl:master-slide[@name=$bullet-and-image-master]/@id'/>
241 <xsl:when test='itemizedlist'>
242 <xsl:value-of select='$masters/apxl:master-slide[@name=$bullet-master]/@id'/>
244 <xsl:when test='example|informalexample'>
245 <xsl:value-of select='$masters/apxl:master-slide[@name=$title-only-master]/@id'/>
248 <xsl:value-of select='$masters/apxl:master-slide[@name=$bullet-master]/@id'/>
253 <body visibility='tracks-master' vertical-alignment='tracks-master'/>
254 <title visibility='tracks-master' vertical-alignment='tracks-master'/>
255 <xsl:call-template name='drawables'/>
257 <transition-style type='inherited'/>
259 <thumbnail file='thumbs/st0.tiff' byte-size='6520' size='60 45'/>
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'>
265 <xsl:apply-templates select='../title' mode='slides'/>
266 <xsl:text>: </xsl:text>
268 <xsl:apply-templates select='title' mode='slides'/>
271 <xsl:apply-templates select='itemizedlist/listitem' mode='slides'/>
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'/>
285 <doc:template xmlns=''>
286 <title>drawables Template</title>
288 <para>This template adds objects to the drawables section of a foil. These include images, as well as unadorned (non-bullet) text.</para>
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>
293 <xsl:template name='drawables'>
295 <xsl:when test='imageobject'>
296 <plugin opacity='1' transformation='1 0 0 1 140 130'>
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>
303 <shadow-style opacity='0' radius='0'/>
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())'/>
314 <plugin transformation='1 0 0 1 200 200'>
316 <plugin:table key='root' version='1.2'>
317 <xsl:attribute name='size'>
318 <xsl:text>{800, 400}</xsl:text>
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)'/>
327 <xsl:attribute name='tr'>
328 <xsl:value-of select='$identbase + (floor(position() div $numcols) * ($numcols + 1)) + (position() mod $numcols) + 1'/>
330 <xsl:attribute name='bl'>
331 <xsl:value-of select='$identbase + (floor(position() div $numcols) * ($numcols + 1) + 1) + (position() mod $numcols)'/>
333 <xsl:attribute name='br'>
334 <xsl:value-of select='$identbase + (floor(position() div $numcols) * ($numcols + 1) + 1) + (position() mod $numcols) + 1'/>
336 <plugin:node ident='5833'>
337 <xsl:attribute name='pos'>
338 <xsl:text>{0, 300}</xsl:text>
341 <plugin:node ident='5834'>
342 <xsl:attribute name='pos'>
343 <xsl:text>{150, 300}</xsl:text>
346 <plugin:node ident='5838'>
347 <xsl:attribute name='pos'>
348 <xsl:text>{0, 200}</xsl:text>
351 <plugin:node ident='5839'>
352 <xsl:attribute name='pos'>
353 <xsl:text>{150, 200}</xsl:text>
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]'/>
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='"/"'/>
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'/>
377 <xsl:apply-templates select='para|informalexample|example' mode='slides'/>
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'/>
388 <xsl:apply-templates select='itemizedlist/listitem' mode='slides'/>
390 <xsl:template match='listitem/para|listitem/informalexample' mode='slides'>
391 <xsl:if test='preceding-sibling::*'>
396 <xsl:apply-templates mode='slides'/>
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'/>
406 <xsl:template name='literallayout'>
407 <xsl:param name='nodes' select='node()'/>
408 <xsl:param name='inCDATA' select='false()'/>
411 <xsl:when test='not($nodes) and $inCDATA'>
412 <xsl:text disable-output-escaping='yes'>]]></xsl:text>
414 <xsl:when test='not($nodes)'/>
415 <xsl:when test='$nodes[1][self::emphasis] and $inCDATA'>
416 <xsl:text disable-output-escaping='yes'>]]></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]'/>
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]'/>
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'/>
436 <xsl:text disable-output-escaping='yes'><![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()'/>
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'>
451 <xsl:when test='@font-style = "italic"'>GillSans-Italic</xsl:when>
452 <xsl:otherwise>GillSans</xsl:otherwise>
456 <xsl:apply-templates mode='slides'/>
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'>"</xsl:with-param>
466 <xsl:with-param name='with'>“</xsl:with-param>
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'>]]></xsl:with-param>
473 <xsl:with-param name='with'>]] ></xsl:with-param>
477 <xsl:when test='ancestor::programlisting'>
478 <xsl:value-of disable-output-escaping='yes' select='$content'/>
481 <xsl:value-of select='$content'/>
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'><</xsl:with-param>
490 <xsl:with-param name='with'><</xsl:with-param>
491 <xsl:with-param name='disable-output-escaping' select='yes'/>
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'>]]></xsl:with-param>
498 <xsl:with-param name='with'>]] ></xsl:with-param>
499 <xsl:with-param name='disable-output-escaping' select='yes'/>
502 <xsl:value-of select='$tmp2' disable-output-escaping='yes'/>
505 <xsl:template match='informalexample|example' mode='slides'>
506 <xsl:apply-templates mode='slides'/>
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='"
"'/>
515 <xsl:variable name='offset'>
517 <xsl:when test='string-length(../preceding-sibling::para) > 45'>20</xsl:when>
518 <xsl:otherwise>0</xsl:otherwise>
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'>
525 <xsl:when test='emphasis'>
526 <xsl:call-template name='literallayout'/>
530 <xsl:call-template name='literallayout'/>
538 <xsl:template match='emphasis' mode='literal'>
541 <xsl:when test='ancestor::programlisting and @font-style = "italic" and @font-weight="bold"'>
542 <xsl:attribute name='font-name'>AmericanTypewriter-CondensedBoldItalic</xsl:attribute>
544 <xsl:when test='@font-style = "italic" and @font-weight="bold"'>
545 <xsl:attribute name='font-name'>GillSans-BoldItalic</xsl:attribute>
547 <xsl:when test='ancestor::programlisting and @font-style = "italic"'>
548 <xsl:attribute name='font-name'>AmericanTypewriter-CondensedItalic</xsl:attribute>
550 <xsl:when test='@font-style = "italic"'>
551 <xsl:attribute name='font-name'>GillSans-Italic</xsl:attribute>
553 <xsl:when test='ancestor::programlisting and @font-weight = "bold"'>
554 <xsl:attribute name='font-name'>AmericanTypewriter-CondensedBold</xsl:attribute>
556 <xsl:when test='@font-weight = "bold"'>
557 <xsl:attribute name='font-name'>GillSans-Bold</xsl:attribute>
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)'/>
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)'/>
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)'/>
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'/>
585 <xsl:call-template name='literallayout'/>
589 <xsl:template match="*">
591 <xsl:for-each select="@*">
594 <xsl:apply-templates/>
597 <xsl:template match="comment()|processing-instruction()">