]> git.stg.codes - stg.git/blob - doc/xslt/slides/xhtml/tables.xsl
Replace istream header with iostream header for some dub compilers
[stg.git] / doc / xslt / slides / xhtml / tables.xsl
1 <?xml version="1.0" encoding="ASCII"?>
2 <!--This file was created automatically by html2xhtml-->
3 <!--from the HTML stylesheets.-->
4 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0">
5
6 <xsl:import href="slides-common.xsl"/>
7
8 <xsl:param name="blank.image" select="'blank.png'"/>
9 <xsl:param name="arrow.image" select="'pointer.png'"/>
10
11 <xsl:param name="toc.bg.color">#6A719C</xsl:param>
12 <xsl:param name="toc.width">220</xsl:param>
13
14 <xsl:param name="css.stylesheet" select="'slides-table.css'"/>
15
16 <!-- ============================================================ -->
17
18 <xsl:template name="foilgroup-body">
19   <table border="0" width="100%" summary="Navigation and body table" cellpadding="0" cellspacing="0">
20     <tr>
21       <td width="{$toc.width}" valign="top" align="left">
22         <xsl:if test="$toc.bg.color != ''">
23           <xsl:attribute name="bgcolor">
24             <xsl:value-of select="$toc.bg.color"/>
25           </xsl:attribute>
26         </xsl:if>
27         <div class="ttoc">
28           <xsl:apply-templates select="." mode="t-toc"/>
29         </div>
30       </td>
31       <td>&#160;</td>
32       <td valign="top" align="left">
33         <xsl:if test="$body.bg.color != ''">
34           <xsl:attribute name="bgcolor">
35             <xsl:value-of select="$body.bg.color"/>
36           </xsl:attribute>
37         </xsl:if>
38         <div class="{name(.)}">
39           <xsl:apply-templates select="*[name(.) != 'foil'                                          and name(.) != 'foilgroup']"/>
40         </div>
41
42         <xsl:if test="$foilgroup.toc != 0">
43           <dl class="toc">
44             <xsl:apply-templates select="foil" mode="toc"/>
45           </dl>
46         </xsl:if>
47       </td>
48     </tr>
49   </table>
50 </xsl:template>
51
52 <xsl:template name="foil-body">
53   <table border="0" width="100%" summary="Navigation and body table" cellpadding="0" cellspacing="0">
54     <tr>
55       <td width="{$toc.width}" valign="top" align="left">
56         <xsl:if test="$toc.bg.color != ''">
57           <xsl:attribute name="bgcolor">
58             <xsl:value-of select="$toc.bg.color"/>
59           </xsl:attribute>
60         </xsl:if>
61         <div class="ttoc">
62           <xsl:apply-templates select="." mode="t-toc"/>
63         </div>
64       </td>
65       <td>&#160;</td>
66       <td valign="top" align="left">
67         <xsl:if test="$body.bg.color != ''">
68           <xsl:attribute name="bgcolor">
69             <xsl:value-of select="$body.bg.color"/>
70           </xsl:attribute>
71         </xsl:if>
72         <div class="{name(.)}">
73           <xsl:apply-templates/>
74         </div>
75       </td>
76     </tr>
77   </table>
78 </xsl:template>
79
80 <!-- ============================================================ -->
81
82 <xsl:template match="foilgroup" mode="t-toc">
83   <xsl:variable name="thisfoilgroup" select="."/>
84
85   <xsl:for-each select="/slides/foil|/slides/foilgroup">
86     <xsl:choose>
87       <xsl:when test="name(.) = 'foilgroup'">
88         <xsl:choose>
89           <xsl:when test="$thisfoilgroup = .">
90             <img alt="+">
91               <xsl:attribute name="src">
92                 <xsl:call-template name="graphics-file">
93                   <xsl:with-param name="image" select="$arrow.image"/>
94                 </xsl:call-template>
95               </xsl:attribute>
96             </img>
97           </xsl:when>
98           <xsl:otherwise>
99             <img alt=" ">
100               <xsl:attribute name="src">
101                 <xsl:call-template name="graphics-file">
102                   <xsl:with-param name="image" select="$blank.image"/>
103                 </xsl:call-template>
104               </xsl:attribute>
105             </img>
106           </xsl:otherwise>
107         </xsl:choose>
108
109         <span class="ttoc-foilgroup">
110           <a>
111             <xsl:attribute name="href">
112               <xsl:apply-templates select="." mode="filename"/>
113             </xsl:attribute>
114             <xsl:apply-templates select="." mode="toc-title"/>
115           </a>
116         </span>
117         <br/>
118
119         <xsl:if test="$thisfoilgroup = .">
120           <xsl:for-each select="foil">
121             <img alt=" ">
122               <xsl:attribute name="src">
123                 <xsl:call-template name="graphics-file">
124                   <xsl:with-param name="image" select="$blank.image"/>
125                 </xsl:call-template>
126               </xsl:attribute>
127             </img>
128             <img alt=" ">
129               <xsl:attribute name="src">
130                 <xsl:call-template name="graphics-file">
131                   <xsl:with-param name="image" select="$blank.image"/>
132                 </xsl:call-template>
133               </xsl:attribute>
134             </img>
135
136             <span class="ttoc-foil">
137               <a>
138                 <xsl:attribute name="href">
139                   <xsl:apply-templates select="." mode="filename"/>
140                 </xsl:attribute>
141                 <xsl:apply-templates select="." mode="toc-title"/>
142               </a>
143             </span>
144             <br/>
145           </xsl:for-each>
146         </xsl:if>
147       </xsl:when>
148       <xsl:otherwise>
149         <img alt=" ">
150           <xsl:attribute name="src">
151             <xsl:call-template name="graphics-file">
152               <xsl:with-param name="image" select="$blank.image"/>
153             </xsl:call-template>
154           </xsl:attribute>
155         </img>
156         <span class="ttoc-foil">
157           <a>
158             <xsl:attribute name="href">
159               <xsl:apply-templates select="." mode="filename"/>
160             </xsl:attribute>
161             <xsl:apply-templates select="." mode="toc-title"/>
162           </a>
163         </span>
164         <br/>
165       </xsl:otherwise>
166     </xsl:choose>
167   </xsl:for-each>
168 </xsl:template>
169
170 <xsl:template match="foil" mode="t-toc">
171   <xsl:variable name="thisfoil" select="."/>
172
173   <xsl:for-each select="/slides/foil|/slides/foilgroup">
174     <xsl:choose>
175       <xsl:when test="name(.) = 'foilgroup'">
176         <img alt=" ">
177           <xsl:attribute name="src">
178             <xsl:call-template name="graphics-file">
179               <xsl:with-param name="image" select="$blank.image"/>
180             </xsl:call-template>
181           </xsl:attribute>
182         </img>
183         <span class="ttoc-foilgroup">
184           <a>
185             <xsl:attribute name="href">
186               <xsl:apply-templates select="." mode="filename"/>
187             </xsl:attribute>
188             <xsl:apply-templates select="." mode="toc-title"/>
189           </a>
190         </span>
191         <br/>
192
193         <xsl:if test="$thisfoil/ancestor::foilgroup = .">
194           <xsl:for-each select="foil">
195             <img alt=" ">
196               <xsl:attribute name="src">
197                 <xsl:call-template name="graphics-file">
198                   <xsl:with-param name="image" select="$blank.image"/>
199                 </xsl:call-template>
200               </xsl:attribute>
201             </img>
202
203             <xsl:choose>
204               <xsl:when test="$thisfoil = .">
205                 <img alt="+">
206                   <xsl:attribute name="src">
207                     <xsl:call-template name="graphics-file">
208                       <xsl:with-param name="image" select="$arrow.image"/>
209                     </xsl:call-template>
210                   </xsl:attribute>
211                 </img>
212               </xsl:when>
213               <xsl:otherwise>
214                 <img alt=" ">
215                   <xsl:attribute name="src">
216                     <xsl:call-template name="graphics-file">
217                       <xsl:with-param name="image" select="$blank.image"/>
218                     </xsl:call-template>
219                   </xsl:attribute>
220                 </img>
221               </xsl:otherwise>
222             </xsl:choose>
223
224             <span class="ttoc-foil">
225               <a>
226                 <xsl:attribute name="href">
227                   <xsl:apply-templates select="." mode="filename"/>
228                 </xsl:attribute>
229                 <xsl:apply-templates select="." mode="toc-title"/>
230               </a>
231             </span>
232             <br/>
233           </xsl:for-each>
234         </xsl:if>
235       </xsl:when>
236       <xsl:otherwise>
237         <!-- foils only -->
238         <xsl:for-each select="/slides/foil">
239           <xsl:choose>
240             <xsl:when test="$thisfoil = .">
241               <img alt="+">
242                 <xsl:attribute name="src">
243                   <xsl:call-template name="graphics-file">
244                     <xsl:with-param name="image" select="$arrow.image"/>
245                   </xsl:call-template>
246                 </xsl:attribute>
247               </img>
248             </xsl:when>
249             <xsl:otherwise>
250               <img alt=" ">
251                 <xsl:attribute name="src">
252                   <xsl:call-template name="graphics-file">
253                     <xsl:with-param name="image" select="$blank.image"/>
254                   </xsl:call-template>
255                 </xsl:attribute>
256               </img>
257             </xsl:otherwise>
258           </xsl:choose>
259           <span class="ttoc-foil">
260             <xsl:apply-templates select="." mode="toc-title"/>
261           </span>
262           <br/>
263         </xsl:for-each>
264       </xsl:otherwise>
265     </xsl:choose>
266   </xsl:for-each>
267 </xsl:template>
268
269 <!-- ============================================================ -->
270
271 <xsl:template match="slides" mode="toc-title">
272   <xsl:call-template name="nobreak">
273     <xsl:with-param name="string">
274       <xsl:choose>
275         <xsl:when test="slidesinfo/titleabbrev">
276           <xsl:value-of select="slidesinfo/titleabbrev"/>
277         </xsl:when>
278         <xsl:otherwise>
279           <xsl:value-of select="slidesinfo/title"/>
280         </xsl:otherwise>
281       </xsl:choose>
282     </xsl:with-param>
283   </xsl:call-template>
284 </xsl:template>
285
286 <xsl:template match="foilgroup" mode="toc-title">
287   <xsl:call-template name="nobreak">
288     <xsl:with-param name="string">
289       <xsl:choose>
290         <xsl:when test="titleabbrev">
291           <xsl:value-of select="titleabbrev"/>
292         </xsl:when>
293         <xsl:otherwise>
294           <xsl:value-of select="title"/>
295         </xsl:otherwise>
296       </xsl:choose>
297     </xsl:with-param>
298   </xsl:call-template>
299 </xsl:template>
300
301 <xsl:template match="foil" mode="toc-title">
302   <xsl:call-template name="nobreak">
303     <xsl:with-param name="string">
304       <xsl:choose>
305         <xsl:when test="titleabbrev">
306           <xsl:value-of select="titleabbrev"/>
307         </xsl:when>
308         <xsl:otherwise>
309           <xsl:value-of select="title"/>
310         </xsl:otherwise>
311       </xsl:choose>
312     </xsl:with-param>
313   </xsl:call-template>
314 </xsl:template>
315
316 <xsl:template name="nobreak">
317   <xsl:param name="string" select="''"/>
318   <xsl:choose>
319     <xsl:when test="contains($string, ' ')">
320       <xsl:value-of select="substring-before($string, ' ')"/>
321       <xsl:text>&#160;</xsl:text>
322       <xsl:call-template name="nobreak">
323         <xsl:with-param name="string" select="substring-after($string, ' ')"/>
324       </xsl:call-template>
325     </xsl:when>
326     <xsl:otherwise>
327       <xsl:value-of select="$string"/>
328     </xsl:otherwise>
329   </xsl:choose>
330 </xsl:template>
331
332 <!-- ============================================================ -->
333
334 </xsl:stylesheet>