]> git.stg.codes - stg.git/blob - doc/xslt/slides/html/w3c.xsl
Added const version of GetPointer.
[stg.git] / doc / xslt / slides / html / w3c.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="logo.image.uri" select="''"/>
8 <xsl:param name="logo.uri" select="''"/>
9 <xsl:param name="logo.title" select="''"/>
10
11 <xsl:param name="next.image" select="'active/w3c-next.png'"/>
12 <xsl:param name="no.next.image" select="'inactive/w3c-next.png'"/>
13
14 <xsl:param name="prev.image" select="'active/w3c-prev.png'"/>
15 <xsl:param name="no.prev.image" select="'inactive/w3c-prev.png'"/>
16
17 <xsl:param name="toc.image" select="'active/w3c-toc.png'"/>
18 <xsl:param name="no.toc.image" select="'inactive/w3c-toc.png'"/>
19
20 <xsl:param name="css.stylesheet" select="'slides-w3c.css'"/>
21
22 <xsl:template name="logo">
23   <xsl:if test="$logo.uri != ''">
24     <a href="{$logo.uri}" title="{$logo.title}">
25       <xsl:choose>
26         <xsl:when test="$logo.image.uri=''">
27           <xsl:value-of select="$logo.title"/>
28         </xsl:when>
29         <xsl:otherwise>
30           <img src="{$logo.image.uri}" alt="{$logo.title}" border="0"/>
31         </xsl:otherwise>
32       </xsl:choose>
33     </a>
34   </xsl:if>
35 </xsl:template>
36
37 <xsl:template name="overlayDiv.attributes">
38   <xsl:if test="$overlay != 0">
39     <xsl:attribute name="style">
40       <xsl:text>position: absolute; visibility: visible;</xsl:text>
41     </xsl:attribute>
42   </xsl:if>
43 </xsl:template>
44
45 <!-- ====================================================================== -->
46
47 <xsl:template name="top-nav">
48   <xsl:param name="home"/>
49   <xsl:param name="up"/>
50   <xsl:param name="next"/>
51   <xsl:param name="prev"/>
52   <xsl:param name="tocfile" select="$toc.html"/>
53
54   <div class="navhead">
55     <table class="navbar" cellspacing="0" cellpadding="0" border="0" width="97%"
56            summary="Navigation buttons">
57       <tr>
58         <td align="left" valign="top">
59           <xsl:call-template name="logo"/>
60         </td>
61         <td valign="top" nowrap="nowrap" width="150">
62           <div align="right">
63             <xsl:choose>
64               <xsl:when test="$prev">
65                 <a rel="previous" accesskey="P">
66                   <xsl:attribute name="href">
67                     <xsl:apply-templates select="$prev" mode="filename"/>
68                   </xsl:attribute>
69                   <img border="0" width="32" height="32"
70                        alt=" Previous" title="{$prev/title}">
71                     <xsl:attribute name="src">
72                       <xsl:call-template name="prev.image"/>
73                     </xsl:attribute>
74                   </img>
75                 </a>
76               </xsl:when>
77               <xsl:otherwise>
78                 <img border="0" width="32" height="32" alt=" Previous" title="">
79                   <xsl:attribute name="src">
80                     <xsl:call-template name="no.prev.image"/>
81                   </xsl:attribute>
82                 </img>
83               </xsl:otherwise>
84             </xsl:choose>
85
86             <xsl:choose>
87               <xsl:when test="$tocfile != ''">
88                 <a rel="contents" href="{$tocfile}" accesskey="C">
89                   <img border="0" width="32" height="32"
90                        alt=" Contents" title="Table of Contents">
91                     <xsl:attribute name="src">
92                       <xsl:call-template name="toc.image"/>
93                     </xsl:attribute>
94                   </img>
95                 </a>
96               </xsl:when>
97               <xsl:otherwise>
98                 <img border="0" width="32" height="32"
99                      alt=" Contents" title="Table of Contents">
100                   <xsl:attribute name="src">
101                     <xsl:call-template name="no.toc.image"/>
102                   </xsl:attribute>
103                 </img>
104               </xsl:otherwise>
105             </xsl:choose>
106
107             <xsl:choose>
108               <xsl:when test="$next">
109                 <a rel="next" accesskey="N">
110                   <xsl:attribute name="href">
111                     <xsl:apply-templates select="$next" mode="filename"/>
112                   </xsl:attribute>
113                   <img border="0" width="32" height="32"
114                        alt=" Next" title="{$next/title}">
115                     <xsl:attribute name="src">
116                       <xsl:call-template name="next.image"/>
117                     </xsl:attribute>
118                   </img>
119                 </a>
120               </xsl:when>
121               <xsl:otherwise>
122                 <img border="0" width="32" height="32" alt=" Next" title="">
123                   <xsl:attribute name="src">
124                     <xsl:call-template name="no.next.image"/>
125                   </xsl:attribute>
126                 </img>
127               </xsl:otherwise>
128             </xsl:choose>
129           </div>
130         </td>
131       </tr>
132     </table>
133
134     <xsl:apply-templates select="title"/>
135     <hr class="top-nav-sep"/>
136   </div>
137 </xsl:template>
138
139 <xsl:template name="bottom-nav">
140   <xsl:param name="home"/>
141   <xsl:param name="up"/>
142   <xsl:param name="next"/>
143   <xsl:param name="prev"/>
144   <xsl:param name="tocfile" select="$toc.html"/>
145
146   <div class="navfoot">
147     <hr class="bottom-nav-sep"/>
148     <table class="footer" cellspacing="0" cellpadding="0" border="0" width="97%"
149            summary="footer">
150       <tr>
151         <td align="left" valign="top">
152           <xsl:variable name="author" select="(/slides/slidesinfo//author
153                                               |/slides/slidesinfo//editor)"/>
154           <xsl:for-each select="$author">
155             <xsl:choose>
156               <xsl:when test=".//email">
157                 <a href="mailto:{.//email[1]}">
158                   <xsl:call-template name="person.name"/>
159                 </a>
160               </xsl:when>
161               <xsl:otherwise>
162                 <xsl:call-template name="person.name"/>
163               </xsl:otherwise>
164             </xsl:choose>
165
166             <xsl:if test="position() &lt; last()">, </xsl:if>
167           </xsl:for-each>
168         </td>
169         <td align="right" valign="top">
170           <span class="index">
171             <xsl:value-of select="count(preceding::foil)
172                                   + count(preceding::foilgroup)
173                                   + count(ancestor::foilgroup)
174                                   + 1"/>
175             <xsl:text> of </xsl:text>
176             <xsl:value-of select="count(//foil|//foilgroup)"/>
177           </span>
178         </td>
179
180         <td valign="top" nowrap="nowrap" width="150">
181           <div align="right">
182             <xsl:choose>
183               <xsl:when test="$prev">
184                 <a rel="previous" accesskey="P">
185                   <xsl:attribute name="href">
186                     <xsl:apply-templates select="$prev" mode="filename"/>
187                   </xsl:attribute>
188                   <img border="0" width="32" height="32"
189                        alt=" Previous" title="{$prev/title}">
190                     <xsl:attribute name="src">
191                       <xsl:call-template name="prev.image"/>
192                     </xsl:attribute>
193                   </img>
194                 </a>
195               </xsl:when>
196               <xsl:otherwise>
197                 <img border="0" width="32" height="32" alt=" Prev" title="">
198                 <xsl:attribute name="src">
199                     <xsl:call-template name="no.prev.image"/>
200                 </xsl:attribute>
201                 </img>
202               </xsl:otherwise>
203             </xsl:choose>
204
205             <xsl:choose>
206               <xsl:when test="$next">
207                 <a rel="next" accesskey="N">
208                   <xsl:attribute name="href">
209                     <xsl:apply-templates select="$next" mode="filename"/>
210                   </xsl:attribute>
211                   <img border="0" width="32" height="32"
212                        alt=" Next" title="{$next/title}">
213                     <xsl:attribute name="src">
214                       <xsl:call-template name="next.image"/>
215                     </xsl:attribute>
216                   </img>
217                 </a>
218               </xsl:when>
219               <xsl:otherwise>
220                 <img border="0" width="32" height="32" alt=" Next" title="">
221                   <xsl:attribute name="src">
222                     <xsl:call-template name="no.next.image"/>
223                   </xsl:attribute>
224                 </img>
225               </xsl:otherwise>
226             </xsl:choose>
227           </div>
228         </td>
229       </tr>
230     </table>
231   </div>
232 </xsl:template>
233
234 <!-- ====================================================================== -->
235
236 <xsl:template name="titlepage-top-nav">
237   <xsl:param name="home"/>
238   <xsl:param name="up"/>
239   <xsl:param name="next"/>
240   <xsl:param name="prev"/>
241   <xsl:param name="tocfile" select="$toc.html"/>
242
243   <div class="navhead">
244     <table class="navbar" cellspacing="0" cellpadding="0" border="0" width="97%"
245            summary="Navigation buttons">
246       <tr>
247         <td align="left" valign="top">
248           <xsl:call-template name="logo"/>
249         </td>
250         <td valign="top" nowrap="nowrap" width="150">
251           <div align="right">
252             <xsl:choose>
253               <xsl:when test="$prev">
254                 <a rel="previous" accesskey="P">
255                   <xsl:attribute name="href">
256                     <xsl:apply-templates select="$prev" mode="filename"/>
257                   </xsl:attribute>
258                   <img border="0" width="32" height="32"
259                        alt=" Previous" title="{$prev/title}">
260                     <xsl:attribute name="src">
261                       <xsl:call-template name="prev.image"/>
262                     </xsl:attribute>
263                   </img>
264                 </a>
265               </xsl:when>
266               <xsl:otherwise>
267                 <img border="0" width="32" height="32" alt=" Previous" title="">
268                   <xsl:attribute name="src">
269                     <xsl:call-template name="no.prev.image"/>
270                   </xsl:attribute>
271                 </img>
272               </xsl:otherwise>
273             </xsl:choose>
274
275             <xsl:choose>
276               <xsl:when test="$tocfile != ''">
277                 <a rel="contents" href="{$tocfile}" accesskey="C">
278                   <img border="0" width="32" height="32"
279                        alt=" Contents" title="Table of Contents">
280                     <xsl:attribute name="src">
281                       <xsl:call-template name="toc.image"/>
282                     </xsl:attribute>
283                   </img>
284                 </a>
285               </xsl:when>
286               <xsl:otherwise>
287                 <img border="0" width="32" height="32"
288                      alt=" Contents" title="Table of Contents">
289                   <xsl:attribute name="src">
290                     <xsl:call-template name="no.toc.image"/>
291                   </xsl:attribute>
292                 </img>
293               </xsl:otherwise>
294             </xsl:choose>
295
296             <xsl:choose>
297               <xsl:when test="$next">
298                 <a rel="next" accesskey="N">
299                   <xsl:attribute name="href">
300                     <xsl:apply-templates select="$next" mode="filename"/>
301                   </xsl:attribute>
302                   <img border="0" width="32" height="32"
303                        alt=" Next" title="{$next/title}">
304                     <xsl:attribute name="src">
305                       <xsl:call-template name="next.image"/>
306                     </xsl:attribute>
307                   </img>
308                 </a>
309               </xsl:when>
310               <xsl:otherwise>
311                 <img border="0" width="32" height="32" alt=" Next" title="">
312                   <xsl:attribute name="src">
313                     <xsl:call-template name="no.next.image"/>
314                   </xsl:attribute>
315                 </img>
316               </xsl:otherwise>
317             </xsl:choose>
318           </div>
319         </td>
320       </tr>
321     </table>
322
323     <hr class="top-nav-sep"/>
324   </div>
325 </xsl:template>
326
327 <!-- ====================================================================== -->
328
329 <xsl:template name="foil-body">
330   <xsl:param name="home"/>
331   <xsl:param name="up"/>
332   <xsl:param name="next"/>
333   <xsl:param name="prev"/>
334   <xsl:param name="tocfile" select="$toc.html"/>
335
336   <!-- skip the title -->
337   <xsl:apply-templates select="*[name(.) != 'title']"/>
338 </xsl:template>
339
340 <xsl:template name="foilgroup-body">
341   <xsl:param name="home"/>
342   <xsl:param name="up"/>
343   <xsl:param name="next"/>
344   <xsl:param name="prev"/>
345   <xsl:param name="tocfile" select="$toc.html"/>
346
347   <!-- skip the title -->
348   <xsl:apply-templates select="*[name(.) != 'title'
349                                 and name(.) != 'foil'
350                                 and name(.) != 'foilgroup']"/>
351
352   <xsl:if test="$foilgroup.toc != 0">
353     <dl class="toc">
354       <xsl:apply-templates select="foil" mode="toc"/>
355     </dl>
356   </xsl:if>
357 </xsl:template>
358
359 <!-- ====================================================================== -->
360
361 <xsl:template match="@*" mode="copy">
362   <xsl:attribute name="{local-name(.)}">
363     <xsl:value-of select="."/>
364   </xsl:attribute>
365 </xsl:template>
366
367 <xsl:template match="html:*" xmlns:html='http://www.w3.org/1999/xhtml'>
368   <xsl:element name="{local-name(.)}" namespace="">
369     <xsl:apply-templates select="@*" mode="copy"/>
370     <xsl:apply-templates/>
371   </xsl:element>
372 </xsl:template>
373
374 <!-- ====================================================================== -->
375
376 </xsl:stylesheet>