fixed a typecast bug.
[swftools.git] / doc / guide.xsl
1 <?xml version="1.0" encoding="UTF-8"?>
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
3 <!--
4    SWFTools documentation stylesheet.
5
6    Major portions shamelessly stolen from the gentoo documentation project (www.gentoo.org).
7
8    This file is distributed under the GPL, see file COPYING for details.
9 -->
10   <xsl:output encoding="iso-8859-15" method="html" indent="yes" doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"/>
11   <xsl:preserve-space elements="code"/>
12   <xsl:template match="img">
13       <img src="{@src}"/>
14   </xsl:template>
15
16   <xsl:template match="/guide">
17         <html>
18         <head>
19          <link title="new" rel="stylesheet" href="caiviar.css" type="text/css"/>
20          <link REL="shortcut icon" HREF="/favicon.ico" TYPE="image/x-icon"/>
21          <title>
22          <xsl:value-of select="title"/>
23          </title>
24         </head>
25         <body style="margin-left:0px;margin-top:0px;" bgcolor="#ffffff">
26          <table>
27           <tr>
28            <td>
29                 <h1>
30                  <b>
31                  <font class="dochead">
32                     <xsl:value-of select="title"/>
33                  </font>
34                  </b>
35                 </h1>
36            </td>
37           </tr>
38           <tr>
39            <td>
40              <img src="line.gif" alt="line"/>
41            </td>
42           </tr>
43           <tr>
44            <td class="alttext"><b>Summary:</b>&#160;<xsl:apply-templates select="abstract"/></td>
45           </tr>
46           <tr>
47            <td>
48              <img src="line.gif" alt="line"/>
49            </td>
50           </tr>
51         </table>
52
53         <xsl:apply-templates select="chapter"/>
54         </body>
55         </html>
56   </xsl:template>
57     
58   <xsl:template match="mail">
59     <a href="mailto:{@link}">
60       <xsl:value-of select="."/>
61     </a>
62   </xsl:template>
63
64   <xsl:template match="chapter">
65     <xsl:variable name="chid"><xsl:number/></xsl:variable>
66     <xsl:choose>
67       <xsl:when test="title">
68         <p class="chaphead">
69           <font class="chapnum">
70             <a name="doc_chap{$chid}"><xsl:number/>.</a>
71           </font>
72           <xsl:value-of select="title"/>
73         </p>
74       </xsl:when>
75       <xsl:otherwise>
76         <p class="chaphead">
77           <font class="chapnum">
78             <a name="doc_chap{$chid}"><xsl:number/>.</a>
79           </font>
80         </p>
81       </xsl:otherwise>
82     </xsl:choose>
83     <xsl:apply-templates>
84       <xsl:with-param name="chid" select="$chid"/>
85     </xsl:apply-templates>
86   </xsl:template>
87
88   <xsl:template match="section">
89     <xsl:param name="chid"/>
90     <xsl:variable name="sid"><xsl:number/></xsl:variable>
91     <xsl:if test="title">
92       <p class="secthead">
93         <xsl:value-of select="$chid"/>.<xsl:value-of select="$sid"/>&#160;
94         <a name=""><xsl:value-of select="title"/>&#160;</a>
95       </p>
96     </xsl:if>
97     <xsl:apply-templates>
98       <xsl:with-param name="chid" select="$chid"/>
99       <xsl:with-param name="sid" select="$sid"/>
100     </xsl:apply-templates>
101   </xsl:template>
102
103   <xsl:template match="subsection">
104     <xsl:param name="chid"/>
105     <xsl:param name="sid"/>
106     <xsl:variable name="ssid"><xsl:number/></xsl:variable>
107     <xsl:if test="title">
108       <p class="subsecthead">
109         <xsl:value-of select="$chid"/>.<xsl:value-of select="$sid"/>.<xsl:value-of select="$ssid"/>&#160;
110         <a name=""><xsl:value-of select="title"/>&#160;</a>
111       </p>
112     </xsl:if>
113     <xsl:apply-templates>
114       <xsl:with-param name="chid" select="$chid"/>
115       <xsl:with-param name="sid" select="$sid"/>
116       <xsl:with-param name="ssid" select="$ssid"/>
117     </xsl:apply-templates>
118   </xsl:template>
119
120   <xsl:template match="subsubsection">
121     <xsl:param name="chid"/>
122     <xsl:param name="sid"/>
123     <xsl:param name="ssid"/>
124     <xsl:variable name="sssid"><xsl:number/></xsl:variable>
125     <xsl:if test="title">
126       <p class="subsubsecthead">
127         <xsl:value-of select="$chid"/>.<xsl:value-of select="$sid"/>.<xsl:value-of select="$ssid"/>.<xsl:value-of select="$sssid"/>&#160;
128         <a name=""><xsl:value-of select="title"/>&#160;</a>
129       </p>
130     </xsl:if>
131     <xsl:apply-templates>
132       <xsl:with-param name="chid" select="$chid"/>
133       <xsl:with-param name="sid" select="$sid"/>
134       <xsl:with-param name="ssid" select="$ssid"/>
135       <xsl:with-param name="sssid" select="$sssid"/>
136     </xsl:apply-templates>
137   </xsl:template>
138
139   <xsl:template match="figure">
140     <xsl:with-param name="chid"/>
141     <xsl:variable name="fignum">
142       <xsl:number level="any" from="chapter" count="figure"/>
143     </xsl:variable>
144     <xsl:variable name="figid">doc_chap<xsl:value-of select="$chid"/>_fig<xsl:value-of select="$fignum"/></xsl:variable>
145     <br/>
146     <a name="{$figid}"/>
147     <table cellspacing="0" cellpadding="0" border="0">
148       <tr>
149         <td class="infohead" bgcolor="#7a5ada">
150           <p class="caption">
151             <xsl:choose>
152               <xsl:when test="@caption">
153                                 Figure <xsl:value-of select="$chid"/>.<xsl:value-of select="$fignum"/>: <xsl:value-of select="@caption"/>
154                         </xsl:when>
155               <xsl:otherwise>
156                                 Figure <xsl:value-of select="$chid"/>.<xsl:value-of select="$fignum"/>
157                         </xsl:otherwise>
158             </xsl:choose>
159           </p>
160         </td>
161       </tr>
162       <tr>
163         <td align="center" bgcolor="#ddddff">
164           <xsl:choose>
165             <xsl:when test="@short">
166               <img src="{@link}" alt="Fig. {$fignum}: {@short}"/>
167             </xsl:when>
168             <xsl:otherwise>
169               <img src="{@link}" alt="Fig. {$fignum}"/>
170             </xsl:otherwise>
171           </xsl:choose>
172         </td>
173       </tr>
174     </table>
175     <br/>
176   </xsl:template>
177
178   <!--figure without a caption; just a graphical element-->
179   <xsl:template match="fig">
180     <center>
181       <xsl:choose>
182         <xsl:when test="@linkto">
183           <a href="{@linkto}">
184             <img src="{@link}" alt="{@short}"/>
185           </a>
186         </xsl:when>
187         <xsl:otherwise>
188           <img src="{@link}" alt="{@short}"/>
189         </xsl:otherwise>
190       </xsl:choose>
191     </center>
192   </xsl:template>
193
194   <xsl:template match="br">
195     <br/>
196   </xsl:template>
197
198   <xsl:template match="note">
199     <table class="ncontent" width="100%" border="0" cellspacing="0" cellpadding="0">
200       <tr>
201         <td bgcolor="#bbffbb">
202           <p class="note">
203             <b>Note: </b>
204             <xsl:apply-templates/>
205           </p>
206         </td>
207       </tr>
208     </table>
209   </xsl:template>
210
211   <xsl:template match="impo">
212     <table class="ncontent" width="100%" border="0" cellspacing="0" cellpadding="0">
213       <tr>
214         <td bgcolor="#ffffbb">
215           <p class="note">
216             <b>Important: </b>
217             <xsl:apply-templates/>
218           </p>
219         </td>
220       </tr>
221     </table>
222   </xsl:template>
223
224   <xsl:template match="warn">
225     <table class="ncontent" width="100%" border="0" cellspacing="0" cellpadding="0">
226       <tr>
227         <td bgcolor="#ffbbbb">
228           <p class="note">
229             <b>Warning: </b>
230             <xsl:apply-templates/>
231           </p>
232         </td>
233       </tr>
234     </table>
235   </xsl:template>
236
237   <xsl:template match="codenote">
238     <font class="comment">// <xsl:value-of select="."/></font>
239   </xsl:template>
240
241   <xsl:template match="comment">
242     <font class="comment">
243       <xsl:apply-templates/>
244     </font>
245   </xsl:template>
246
247   <xsl:template match="i">
248     <font class="input">
249       <xsl:apply-templates/>
250     </font>
251   </xsl:template>
252
253   <xsl:template match="b">
254     <b>
255       <xsl:apply-templates/>
256     </b>
257   </xsl:template>
258
259   <xsl:template match="brite">
260     <font class="brite">
261       <b>
262         <xsl:apply-templates/>
263       </b>
264     </font>
265   </xsl:template>
266
267   <xsl:template match="c">
268     <font class="code">
269       <xsl:apply-templates/>
270     </font>
271   </xsl:template>
272
273   <xsl:template match="box">
274     <p class="infotext">
275       <xsl:apply-templates/>
276     </p>
277   </xsl:template>
278
279   <xsl:template match="shell">
280     <table class="ntable" width="100%" cellspacing="0" cellpadding="0" border="0">
281       <tr>
282         <td bgcolor="#f0f0f0">
283           <pre>
284             <font><xsl:apply-templates/></font>
285           </pre>
286         </td>
287       </tr>
288     </table>
289     <br/>
290   </xsl:template>
291
292   <xsl:template match="property">
293     <table class="itable" width="100%" cellspacing="0" cellpadding="0" border="0">
294     <tr><td width="2%"></td><td></td></tr> <!-- FIXME -->
295       <tr>
296         <td width="2%">
297         </td>
298         <td>
299             <font><b><xsl:apply-templates/></b></font>
300         </td>
301       </tr>
302     <tr></tr>
303     <tr><td width="2%"></td><td></td></tr> <!-- FIXME -->
304     </table>
305   </xsl:template>
306
307   <xsl:template match="code">
308     <xsl:param name="chid"/>
309     <xsl:variable name="prenum">
310       <xsl:number level="any" from="chapter" count="code"/>
311     </xsl:variable>
312     <xsl:variable name="preid">doc_chap<xsl:value-of select="$chid"/>_pre<xsl:value-of select="$prenum"/></xsl:variable>
313     <a name="{$preid}"/>
314     <table class="ntable" width="100%" cellspacing="0" cellpadding="0" border="0">
315       <tr>
316         <td></td><td width="32"></td>
317         <td class="infohead" bgcolor="#6c6cff">
318           <p class="caption">
319             <xsl:choose>
320               <xsl:when test="@caption">
321                         Code listing <xsl:value-of select="$chid"/>.<xsl:value-of select="$prenum"/>: <xsl:value-of select="@caption"/>
322                 </xsl:when>
323               <xsl:otherwise>
324                         Code listing <xsl:value-of select="$chid"/>.<xsl:value-of select="$prenum"/>
325                 </xsl:otherwise>
326             </xsl:choose>
327           </p>
328         </td>
329       </tr>
330       <tr>
331       <!-- <td> is inserted by perl -->
332 [CALLPERL <xsl:value-of select="@lang"/> left]
333 <xsl:apply-templates/>
334 [CALLPERL end]
335       <!-- </td> is inserted by perl -->
336         <td width="32">
337         </td>
338         <td bgcolor="#e0ffff" valign="top">
339 [CALLPERL <xsl:value-of select="@lang"/> right]
340 <xsl:apply-templates/>
341 [CALLPERL end]
342         </td>
343       </tr>
344     </table>
345     <br/>
346   </xsl:template>
347
348   <xsl:template match="f">
349     <font class="path">
350       <xsl:value-of select="."/>
351     </font>
352   </xsl:template>
353
354   <xsl:template match="uri">
355   <!-- expand templates to handle things like <uri link="http://bar"><c>foo</c></uri> -->
356     <xsl:choose>
357       <xsl:when test="@link">
358         <a href="{@link}">
359           <xsl:apply-templates/>
360         </a>
361       </xsl:when>
362       <xsl:otherwise>
363         <xsl:variable name="loc" select="."/>
364         <a href="{$loc}">
365           <xsl:apply-templates/>
366         </a>
367       </xsl:otherwise>
368     </xsl:choose>
369   </xsl:template>
370
371   <xsl:template match="p">
372     <xsl:param name="chid"/>
373       <xsl:choose>
374       <xsl:when test="@class">
375                 <p class="{@class}">
376                 <xsl:apply-templates>
377                 <xsl:with-param name="chid" select="$chid"/>
378                 </xsl:apply-templates>
379                 </p>
380         </xsl:when>
381         <xsl:otherwise>
382                 <p>
383                 <xsl:apply-templates>
384                 <xsl:with-param name="chid" select="$chid"/>
385                 </xsl:apply-templates>
386                 </p>
387         </xsl:otherwise>
388         </xsl:choose>
389   </xsl:template>
390
391   <xsl:template match="title">
392   </xsl:template>
393
394   <xsl:template match="e">
395     <font class="emphasis">
396       <xsl:apply-templates/>
397     </font>
398   </xsl:template>
399
400   <xsl:template match="mail">
401     <a href="mailto:{@link}">
402       <xsl:value-of select="."/>
403     </a>
404   </xsl:template>
405
406   <xsl:template match="table">
407     <table class="ntable">
408       <xsl:apply-templates/>
409     </table>
410   </xsl:template>
411
412   <xsl:template match="tr">
413     <tr>
414       <xsl:apply-templates/>
415     </tr>
416   </xsl:template>
417
418   <xsl:template match="ti">
419     <td bgcolor="#cccccc" class="tableinfo">
420       <xsl:apply-templates/>
421     </td>
422   </xsl:template>
423
424   <xsl:template match="th">
425     <td bgcolor="#6c6cff" class="infohead">
426       <b>
427         <xsl:apply-templates/>
428       </b>
429     </td>
430   </xsl:template>
431
432   <xsl:template match="ul">
433     <ul>
434       <xsl:apply-templates/>
435     </ul>
436   </xsl:template>
437
438   <xsl:template match="ol">
439     <ol>
440       <xsl:apply-templates/>
441     </ol>
442   </xsl:template>
443
444   <xsl:template match="li">
445     <li>
446       <xsl:apply-templates/>
447     </li>
448   </xsl:template>
449
450 <!--  <xsl:template match="text()">
451    [
452    <xsl:value-of select="value()"/>
453    ]
454   </xsl:template>
455 -->
456 </xsl:stylesheet>