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