]> git.stg.codes - stg.git/blob - doc/xslt/slides/html/vslides.xsl
Strange code removed
[stg.git] / doc / xslt / slides / html / vslides.xsl
1 <?xml version="1.0"?>
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3                 version="1.0">
4
5 <xsl:import href="slides-common.xsl"/>
6
7 <xsl:param name="but-fforward.png"  select="'active/but-fforward.png'"/>
8 <xsl:param name="but-info.png"      select="'active/but-info.png'"/>
9 <xsl:param name="but-next.png"      select="'active/but-next.png'"/>
10 <xsl:param name="but-prev.png"      select="'active/but-prev.png'"/>
11 <xsl:param name="but-rewind.png"    select="'active/but-rewind.png'"/>
12
13 <xsl:param name="but-xfforward.png" select="'inactive/but-fforward.png'"/>
14 <xsl:param name="but-xinfo.png"     select="'inactive/but-info.png'"/>
15 <xsl:param name="but-xnext.png"     select="'inactive/but-next.png'"/>
16 <xsl:param name="but-xprev.png"     select="'inactive/but-prev.png'"/>
17 <xsl:param name="but-xrewind.png"   select="'inactive/but-rewind.png'"/>
18
19 <!-- overrides for this stylesheet -->
20 <xsl:param name="titlefoil.html" select="concat('index', $html.ext)"/>
21 <xsl:param name="toc.width" select="40"/>
22
23 <!-- ============================================================ -->
24
25 <xsl:template match="slides">
26   <xsl:call-template name="write.chunk">
27     <xsl:with-param name="indent" select="$output.indent"/>
28     <xsl:with-param name="filename" select="concat($base.dir, $toc.html)"/>
29     <xsl:with-param name="content">
30       <html>
31         <head>
32           <title><xsl:value-of select="slidesinfo/title"/></title>
33           <xsl:if test="$css.stylesheet != ''">
34             <link type="text/css" rel="stylesheet">
35               <xsl:attribute name="href">
36                 <xsl:call-template name="css.stylesheet"/>
37               </xsl:attribute>
38             </link>
39           </xsl:if>
40           <xsl:apply-templates select="/processing-instruction('dbhtml')" mode="css.pi"/>
41
42           <xsl:call-template name="links">
43             <xsl:with-param name="next" select="/slides"/>
44             <xsl:with-param name="tocfile" select="$toc.html"/>
45           </xsl:call-template>
46
47           <xsl:if test="$keyboard.nav != 0">
48             <script language="javascript" type="text/javascript">
49               <xsl:text> </xsl:text>
50             </script>
51           </xsl:if>
52
53           <xsl:if test="$keyboard.nav != 0">
54             <xsl:call-template name="ua.js"/>
55             <xsl:call-template name="xbDOM.js">
56               <xsl:with-param name="language" select="'javascript'"/>
57             </xsl:call-template>
58             <xsl:call-template name="xbLibrary.js"/>
59             <script language="javascript" type="text/javascript">
60               <xsl:text disable-output-escaping="yes">
61                 &lt;!--
62                 xblibrary = new xbLibrary('../browser');
63                 // --&gt;
64               </xsl:text>
65             </script>
66             <xsl:call-template name="xbStyle.js"/>
67             <xsl:call-template name="xbCollapsibleLists.js"/>
68             <xsl:call-template name="slides.js">
69               <xsl:with-param name="language" select="'javascript'"/>
70             </xsl:call-template>
71           </xsl:if>
72         </head>
73         <body class="tocpage">
74           <xsl:call-template name="body.attributes"/>
75           <xsl:if test="$keyboard.nav != 0">
76             <xsl:attribute name="onkeypress">
77               <xsl:text>navigate(event)</xsl:text>
78             </xsl:attribute>
79           </xsl:if>
80
81           <table border="0" width="100%" summary="Navigation and body table"
82                  cellpadding="0" cellspacing="0">
83             <tr>
84               <td>&#160;</td>
85               <td><xsl:apply-templates select="." mode="header"/></td>
86             </tr>
87
88             <tr>
89               <td width="{$toc.width}" valign="top" align="left">
90                 <xsl:if test="$toc.bg.color != ''">
91                   <xsl:attribute name="bgcolor">
92                     <xsl:value-of select="$toc.bg.color"/>
93                   </xsl:attribute>
94                 </xsl:if>
95
96                 <xsl:call-template name="vertical-navigation">
97                   <xsl:with-param name="next" select="/slides"/>
98                   <xsl:with-param name="tocfile"/>
99                 </xsl:call-template>
100
101               </td>
102               <td valign="top" align="left">
103                 <xsl:if test="$body.bg.color != ''">
104                   <xsl:attribute name="bgcolor">
105                     <xsl:value-of select="$body.bg.color"/>
106                   </xsl:attribute>
107                 </xsl:if>
108
109                 <div class="{name(.)}">
110
111                   <div class="toc-body">
112                     <xsl:call-template name="toc-body"/>
113                   </div>
114
115                 </div>
116               </td>
117             </tr>
118
119             <tr>
120               <td>&#160;</td>
121               <td><xsl:apply-templates select="." mode="footer"/></td>
122             </tr>
123           </table>
124         </body>
125       </html>
126     </xsl:with-param>
127   </xsl:call-template>
128
129   <xsl:apply-templates/>
130 </xsl:template>
131
132 <xsl:template match="slidesinfo">
133   <xsl:call-template name="write.chunk">
134     <xsl:with-param name="indent" select="$output.indent"/>
135     <xsl:with-param name="filename" select="concat($base.dir, $titlefoil.html)"/>
136     <xsl:with-param name="content">
137       <html>
138         <head>
139           <title><xsl:value-of select="title"/></title>
140           <xsl:if test="$css.stylesheet != ''">
141             <link type="text/css" rel="stylesheet">
142               <xsl:attribute name="href">
143                 <xsl:call-template name="css.stylesheet"/>
144               </xsl:attribute>
145             </link>
146           </xsl:if>
147           <xsl:apply-templates select="/processing-instruction('dbhtml')" mode="css.pi"/>
148
149           <xsl:call-template name="links">
150             <xsl:with-param name="next" select="(/slides/foil|/slides/foilgroup)[1]"/>
151             <xsl:with-param name="tocfile" select="$toc.html"/>
152           </xsl:call-template>
153
154           <xsl:if test="$keyboard.nav != 0">
155             <script language="javascript" type="text/javascript">
156               <xsl:text> </xsl:text>
157             </script>
158           </xsl:if>
159
160           <xsl:if test="$keyboard.nav != 0">
161             <xsl:call-template name="ua.js"/>
162             <xsl:call-template name="xbDOM.js">
163               <xsl:with-param name="language" select="'javascript'"/>
164             </xsl:call-template>
165             <xsl:call-template name="xbLibrary.js"/>
166             <script language="javascript" type="text/javascript">
167               <xsl:text disable-output-escaping="yes">
168                 &lt;!--
169                 xblibrary = new xbLibrary('../browser');
170                 // --&gt;
171               </xsl:text>
172             </script>
173             <xsl:call-template name="xbStyle.js"/>
174             <xsl:call-template name="xbCollapsibleLists.js"/>
175             <xsl:call-template name="slides.js">
176               <xsl:with-param name="language" select="'javascript'"/>
177             </xsl:call-template>
178           </xsl:if>
179         </head>
180         <body class="titlepage">
181           <xsl:call-template name="body.attributes"/>
182           <xsl:if test="$keyboard.nav != 0">
183             <xsl:attribute name="onkeypress">
184               <xsl:text>navigate(event)</xsl:text>
185             </xsl:attribute>
186           </xsl:if>
187
188           <table border="0" width="100%" summary="Navigation and body table"
189                  cellpadding="0" cellspacing="0">
190             <tr>
191               <td>&#160;</td>
192               <td><xsl:apply-templates select="." mode="header"/></td>
193             </tr>
194
195             <tr>
196               <td width="{$toc.width}" valign="top" align="left">
197                 <xsl:if test="$toc.bg.color != ''">
198                   <xsl:attribute name="bgcolor">
199                     <xsl:value-of select="$toc.bg.color"/>
200                   </xsl:attribute>
201                 </xsl:if>
202
203                 <xsl:call-template name="vertical-navigation">
204                   <xsl:with-param name="first"/>
205                   <xsl:with-param name="last" select="(following::foilgroup|following::foil)[last()]"/>
206                   <xsl:with-param name="next" select="(following::foilgroup|following::foil)[1]"/>
207                 </xsl:call-template>
208
209               </td>
210               <td valign="top" align="left">
211                 <xsl:if test="$body.bg.color != ''">
212                   <xsl:attribute name="bgcolor">
213                     <xsl:value-of select="$body.bg.color"/>
214                   </xsl:attribute>
215                 </xsl:if>
216                 <div class="{name(.)}">
217                   <xsl:apply-templates mode="titlepage.mode"/>
218                 </div>
219               </td>
220             </tr>
221
222             <tr>
223               <td>&#160;</td>
224               <td><xsl:apply-templates select="." mode="footer"/></td>
225             </tr>
226           </table>
227         </body>
228       </html>
229     </xsl:with-param>
230   </xsl:call-template>
231 </xsl:template>
232
233 <xsl:template match="foilgroup">
234   <xsl:param name="thisfoilgroup">
235     <xsl:apply-templates select="." mode="filename"/>
236   </xsl:param>
237
238   <xsl:variable name="id">
239     <xsl:call-template name="object.id"/>
240   </xsl:variable>
241
242   <xsl:variable name="nextfoil" select="foil[1]"/>
243   <xsl:variable name="lastfoil" select="(descendant::foil|following::foil)[last()]"/>
244   <xsl:variable name="prevfoil" select="(preceding::foil|/slides)[last()]"/>
245
246   <xsl:call-template name="write.chunk">
247     <xsl:with-param name="indent" select="$output.indent"/>
248     <xsl:with-param name="filename" select="concat($base.dir, $thisfoilgroup)"/>
249     <xsl:with-param name="content">
250       <html>
251         <head>
252           <title><xsl:value-of select="title"/></title>
253           <xsl:if test="$css.stylesheet != ''">
254             <link type="text/css" rel="stylesheet">
255               <xsl:attribute name="href">
256                 <xsl:call-template name="css.stylesheet"/>
257               </xsl:attribute>
258             </link>
259           </xsl:if>
260           <xsl:apply-templates select="/processing-instruction('dbhtml')" mode="css.pi"/>
261
262           <xsl:call-template name="links">
263             <xsl:with-param name="prev" select="$prevfoil"/>
264             <xsl:with-param name="next" select="$nextfoil"/>
265           </xsl:call-template>
266           
267           <xsl:if test="$keyboard.nav != 0">
268             <script language="javascript" type="text/javascript">
269               <xsl:text> </xsl:text>
270             </script>
271           </xsl:if>
272
273           <xsl:if test="$keyboard.nav != 0">
274             <xsl:call-template name="ua.js"/>
275             <xsl:call-template name="xbDOM.js">
276               <xsl:with-param name="language" select="'javascript'"/>
277             </xsl:call-template>
278             <xsl:call-template name="xbLibrary.js"/>
279             <script language="javascript" type="text/javascript">
280               <xsl:text disable-output-escaping="yes">
281                 &lt;!--
282                 xblibrary = new xbLibrary('../browser');
283                 // --&gt;
284               </xsl:text>
285             </script>
286             <xsl:call-template name="xbStyle.js"/>
287             <xsl:call-template name="xbCollapsibleLists.js"/>
288             <xsl:call-template name="slides.js">
289               <xsl:with-param name="language" select="'javascript'"/>
290             </xsl:call-template>
291           </xsl:if>
292         </head>
293         <body class="foilgroup">
294           <xsl:call-template name="body.attributes"/>
295           <xsl:if test="$keyboard.nav != 0">
296             <xsl:attribute name="onkeypress">
297               <xsl:text>navigate(event)</xsl:text>
298             </xsl:attribute>
299           </xsl:if>
300
301           <table border="0" width="100%" summary="Navigation and body table"
302                  cellpadding="0" cellspacing="0">
303             <tr>
304               <td>&#160;</td>
305               <td><xsl:apply-templates select="." mode="header"/></td>
306             </tr>
307             
308             <tr>
309               <td width="{$toc.width}" valign="top" align="left">
310                 <xsl:if test="$toc.bg.color != ''">
311                   <xsl:attribute name="bgcolor">
312                     <xsl:value-of select="$toc.bg.color"/>
313                   </xsl:attribute>
314                 </xsl:if>
315                 
316                 <xsl:call-template name="vertical-navigation">
317                   <xsl:with-param name="last" select="$lastfoil"/>
318                   <xsl:with-param name="prev" select="$prevfoil"/>
319                   <xsl:with-param name="next" select="$nextfoil"/>
320                 </xsl:call-template>
321                 
322               </td>
323               <td valign="top" align="left">
324                 <xsl:if test="$body.bg.color != ''">
325                   <xsl:attribute name="bgcolor">
326                     <xsl:value-of select="$body.bg.color"/>
327                   </xsl:attribute>
328                 </xsl:if>
329
330                 <div class="{name(.)}">
331                   <xsl:apply-templates/>
332                 </div>
333               </td>
334             </tr>
335
336             <tr>
337               <td>&#160;</td>
338               <td><xsl:apply-templates select="." mode="footer"/></td>
339             </tr>
340           </table>
341         </body>
342       </html>
343     </xsl:with-param>
344   </xsl:call-template>
345
346   <xsl:apply-templates select="foil"/>
347 </xsl:template>
348
349 <xsl:template match="foil">
350   <xsl:variable name="id">
351     <xsl:call-template name="object.id"/>
352   </xsl:variable>
353
354   <xsl:variable name="foilgroup" select="ancestor::foilgroup"/>
355
356   <xsl:variable name="thisfoil">
357     <xsl:apply-templates select="." mode="filename"/>
358   </xsl:variable>
359
360   <xsl:variable name="nextfoil" select="(following::foil
361                                         |following::foilgroup)[1]"/>
362
363   <xsl:variable name="lastfoil" select="following::foil[last()]"/>
364
365   <xsl:variable name="prevfoil" select="(preceding-sibling::foil[1]
366                                         |parent::foilgroup[1]
367                                         |/slides)[last()]"/>
368
369   <xsl:call-template name="write.chunk">
370     <xsl:with-param name="indent" select="$output.indent"/>
371     <xsl:with-param name="filename" select="concat($base.dir, $thisfoil)"/>
372     <xsl:with-param name="content">
373       <html>
374         <head>
375           <title><xsl:value-of select="title"/></title>
376           <xsl:if test="$css.stylesheet != ''">
377             <link type="text/css" rel="stylesheet">
378               <xsl:attribute name="href">
379                 <xsl:call-template name="css.stylesheet"/>
380               </xsl:attribute>
381             </link>
382           </xsl:if>
383           <xsl:apply-templates select="/processing-instruction('dbhtml')" mode="css.pi"/>
384
385           <xsl:call-template name="links">
386             <xsl:with-param name="prev" select="$prevfoil"/>
387             <xsl:with-param name="next" select="$nextfoil"/>
388           </xsl:call-template>
389
390           <xsl:if test="$keyboard.nav != 0">
391             <script language="javascript" type="text/javascript">
392               <xsl:text> </xsl:text>
393             </script>
394           </xsl:if>
395
396           <xsl:if test="$keyboard.nav != 0">
397             <xsl:call-template name="ua.js"/>
398             <xsl:call-template name="xbDOM.js">
399               <xsl:with-param name="language" select="'javascript'"/>
400             </xsl:call-template>
401             <xsl:call-template name="xbLibrary.js"/>
402             <script language="javascript" type="text/javascript">
403               <xsl:text disable-output-escaping="yes">
404                 &lt;!--
405                 xblibrary = new xbLibrary('../browser');
406                 // --&gt;
407               </xsl:text>
408             </script>
409             <xsl:call-template name="xbStyle.js"/>
410             <xsl:call-template name="xbCollapsibleLists.js"/>
411             <xsl:call-template name="slides.js">
412               <xsl:with-param name="language" select="'javascript'"/>
413             </xsl:call-template>
414           </xsl:if>
415         </head>
416         <body class="foil">
417           <xsl:call-template name="body.attributes"/>
418           <xsl:if test="$keyboard.nav != 0">
419             <xsl:attribute name="onkeypress">
420               <xsl:text>navigate(event)</xsl:text>
421             </xsl:attribute>
422           </xsl:if>
423
424           <table border="0" width="100%" summary="Navigation and body table"
425                  cellpadding="0" cellspacing="0">
426             <tr>
427               <td>&#160;</td>
428               <td><xsl:apply-templates select="." mode="header"/></td>
429             </tr>
430
431             <tr>
432               <td width="{$toc.width}" valign="top" align="left">
433                 <xsl:if test="$toc.bg.color != ''">
434                   <xsl:attribute name="bgcolor">
435                     <xsl:value-of select="$toc.bg.color"/>
436                   </xsl:attribute>
437                 </xsl:if>
438
439                 <xsl:call-template name="vertical-navigation">
440                   <xsl:with-param name="last" select="$lastfoil"/>
441                   <xsl:with-param name="prev" select="$prevfoil"/>
442                   <xsl:with-param name="next" select="$nextfoil"/>
443                 </xsl:call-template>
444
445               </td>
446               <td valign="top" align="left">
447                 <xsl:if test="$body.bg.color != ''">
448                   <xsl:attribute name="bgcolor">
449                     <xsl:value-of select="$body.bg.color"/>
450                   </xsl:attribute>
451                 </xsl:if>
452
453                 <div class="{name(.)}">
454                   <xsl:apply-templates/>
455                 </div>
456               </td>
457             </tr>
458
459             <tr>
460               <td>&#160;</td>
461               <td><xsl:apply-templates select="." mode="footer"/></td>
462             </tr>
463           </table>
464         </body>
465       </html>
466     </xsl:with-param>
467   </xsl:call-template>
468 </xsl:template>
469
470 <!-- ============================================================ -->
471
472 <xsl:template match="slidesinfo" mode="header">
473   <div class="navhead">
474     <!-- nop -->
475   </div>
476 </xsl:template>
477
478 <xsl:template match="foil|foilgroup" mode="header">
479   <div class="navhead">
480     <table border="0" width="100%" summary="Header table"
481            cellpadding="0" cellspacing="0">
482       <tr>
483         <td align="left">
484           <xsl:apply-templates select="/slides/slidesinfo/title"
485                                mode="slide.footer.mode"/>
486         </td>
487         <td align="right">
488           <xsl:value-of select="count(preceding::foil)
489                                 + count(preceding::foilgroup)
490                                 + count(ancestor::foilgroup)
491                                 + 1"/>
492         </td>
493       </tr>
494     </table>
495   </div>
496 </xsl:template>
497
498 <xsl:template match="slidesinfo" mode="footer">
499   <div class="navfoot">
500     <!-- nop -->
501   </div>
502 </xsl:template>
503
504 <xsl:template match="foil|foilgroup" mode="footer">
505   <div class="navfoot">
506     <table border="0" width="100%" summary="Header table"
507            cellpadding="0" cellspacing="0">
508       <tr>
509         <td align="center">
510           <xsl:text>Slide </xsl:text>
511           <xsl:value-of select="count(preceding::foil)
512                                 + count(preceding::foilgroup)
513                                 + count(ancestor::foilgroup)
514                                 + 1"/>
515           <xsl:text> of </xsl:text>
516           <xsl:value-of select="count(//foil) + count(//foilgroup)"/>
517         </td>
518       </tr>
519     </table>
520   </div>
521 </xsl:template>
522
523 <xsl:template match="slides" mode="footer"/>
524
525 <!-- ============================================================ -->
526
527 <xsl:template name="vertical-navigation">
528   <xsl:param name="first" select="/slides"/>
529   <xsl:param name="prev"/>
530   <xsl:param name="last"/>
531   <xsl:param name="next"/>
532   <xsl:param name="tocfile" select="$toc.html"/>
533
534   <div class="vnav">
535     <xsl:choose>
536       <xsl:when test="$first">
537         <a>
538           <xsl:attribute name="href">
539             <xsl:apply-templates select="$first" mode="filename"/>
540           </xsl:attribute>
541           <img border="0" alt="First">
542             <xsl:attribute name="src">
543               <xsl:call-template name="graphics-file">
544                 <xsl:with-param name="image" select="$but-rewind.png"/>
545               </xsl:call-template>
546             </xsl:attribute>
547           </img>
548         </a>
549       </xsl:when>
550       <xsl:otherwise>
551         <img alt="First">
552           <xsl:attribute name="src">
553             <xsl:call-template name="graphics-file">
554               <xsl:with-param name="image" select="$but-xrewind.png"/>
555             </xsl:call-template>
556           </xsl:attribute>
557         </img>
558       </xsl:otherwise>
559     </xsl:choose>
560     <br/>
561     <xsl:choose>
562       <xsl:when test="$prev">
563         <a>
564           <xsl:attribute name="href">
565             <xsl:apply-templates select="$prev" mode="filename"/>
566           </xsl:attribute>
567           <img border="0" alt="Previous">
568             <xsl:attribute name="src">
569               <xsl:call-template name="graphics-file">
570                 <xsl:with-param name="image" select="$but-prev.png"/>
571               </xsl:call-template>
572             </xsl:attribute>
573           </img>
574         </a>
575       </xsl:when>
576       <xsl:otherwise>
577         <img alt="Previous">
578           <xsl:attribute name="src">
579             <xsl:call-template name="graphics-file">
580               <xsl:with-param name="image" select="$but-xprev.png"/>
581             </xsl:call-template>
582           </xsl:attribute>
583         </img>
584       </xsl:otherwise>
585     </xsl:choose>
586     <br/>
587     <xsl:choose>
588       <xsl:when test="$next">
589         <a>
590           <xsl:attribute name="href">
591             <xsl:apply-templates select="$next" mode="filename"/>
592           </xsl:attribute>
593           <img border="0" alt="Last">
594             <xsl:attribute name="src">
595               <xsl:call-template name="graphics-file">
596                 <xsl:with-param name="image" select="$but-next.png"/>
597               </xsl:call-template>
598             </xsl:attribute>
599           </img>
600         </a>
601       </xsl:when>
602       <xsl:otherwise>
603         <img alt="Last">
604           <xsl:attribute name="src">
605             <xsl:call-template name="graphics-file">
606               <xsl:with-param name="image" select="$but-xnext.png"/>
607             </xsl:call-template>
608           </xsl:attribute>
609         </img>
610       </xsl:otherwise>
611     </xsl:choose>
612     <br/>
613     <xsl:choose>
614       <xsl:when test="$last">
615         <a>
616           <xsl:attribute name="href">
617             <xsl:apply-templates select="$last" mode="filename"/>
618           </xsl:attribute>
619           <img border="0" alt="Next">
620             <xsl:attribute name="src">
621               <xsl:call-template name="graphics-file">
622                 <xsl:with-param name="image" select="$but-fforward.png"/>
623               </xsl:call-template>
624             </xsl:attribute>
625           </img>
626         </a>
627       </xsl:when>
628       <xsl:otherwise>
629         <img alt="Next">
630           <xsl:attribute name="src">
631             <xsl:call-template name="graphics-file">
632               <xsl:with-param name="image" select="$but-xfforward.png"/>
633             </xsl:call-template>
634           </xsl:attribute>
635         </img>
636       </xsl:otherwise>
637     </xsl:choose>
638
639     <br/>
640     <br/>
641
642     <xsl:choose>
643       <xsl:when test="$tocfile != ''">
644         <a href="{$tocfile}">
645           <img border="0" alt="ToC">
646             <xsl:attribute name="src">
647               <xsl:call-template name="graphics-file">
648                 <xsl:with-param name="image" select="$but-info.png"/>
649               </xsl:call-template>
650             </xsl:attribute>
651           </img>
652         </a>
653       </xsl:when>
654       <xsl:otherwise>
655         <img border="0" alt="ToC">
656           <xsl:attribute name="src">
657             <xsl:call-template name="graphics-file">
658               <xsl:with-param name="image" select="$but-xinfo.png"/>
659             </xsl:call-template>
660           </xsl:attribute>
661         </img>
662       </xsl:otherwise>
663     </xsl:choose>
664   </div>
665 </xsl:template>
666
667 </xsl:stylesheet>