Release of libxslt-1.1.26
[platform/upstream/libxslt.git] / doc / newapi.xsl
1 <?xml version="1.0"?>
2 <!--
3   Stylesheet to generate the HTML documentation from an XML API descriptions:
4   xsltproc newapi.xsl libxslt-api.xml
5
6   Daniel Veillard
7
8   Note: This stylesheet was adapted from the original (written for libxml2)
9         by William Brack, who is fully responsible for any mistakes or
10         problems.  The major enhancement is changing all references to the
11         library and to the output directory into references to global
12         parameters ('libdir' and 'html_dir' respectively).
13 -->
14 <xsl:stylesheet version="1.0"
15   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
16   xmlns:exsl="http://exslt.org/common"
17   xmlns:str="http://exslt.org/strings"
18   extension-element-prefixes="exsl str"
19   exclude-result-prefixes="exsl str">
20
21   <!-- Import the main part of the site stylesheets -->
22   <xsl:import href="site.xsl"/>
23
24   <!-- Generate XHTML-1.0 transitional -->
25   <xsl:output method="xml" encoding="ISO-8859-1" indent="yes"
26       doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
27       doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
28
29   <!-- Build keys for all symbols -->
30   <xsl:key name="symbols" match="/api/symbols/*" use="@name"/>
31
32   <!--
33     Note that variables declared as "param" may be changed at runtime
34   <-->
35   <!-- the name of the library being documented -->
36   <xsl:param name="libname">libxslt</xsl:param>
37
38   <!-- the directory for the 'home' files-->
39   <xsl:param name="dirname" select="'../'"/>
40
41   <!-- the location of logos for the pages -->
42   <xsl:param name="logo_base" select="'../'"/>
43
44   <!-- these override the definition in site.xsl -->
45   <xsl:variable name="href_base" select="'../'"/>
46   <xsl:variable name="html_dir" select="'html/'"/>
47   <xsl:variable name="api_base" select="''"/>
48   <xsl:variable name="globaltitle">
49     <xsl:choose>
50       <xsl:when test="$libname='libxslt'">
51         <xsl:value-of select="'The XSLT C library for GNOME'"/>
52      </xsl:when>
53      <xsl:when test="$libname='libxml'">
54           <xsl:value-of select="'The XML C library for GNOME'"/>
55         </xsl:when>
56         <xsl:when test="$libname='libexslt'">
57           <xsl:value-of select="'The EXSLT C library for GNOME'"/>
58         </xsl:when>
59      <xsl:otherwise>
60        <xsl:value-of select="'Unknown Library'"/>
61      </xsl:otherwise>
62    </xsl:choose>
63   </xsl:variable>
64
65   <!-- The table of content for the HTML API pages -->
66   <xsl:variable name="menu_name">API Menu</xsl:variable>
67   <xsl:variable name="toc">
68     <form action="../search.php"
69           enctype="application/x-www-form-urlencoded" method="get">
70       <input name="query" type="text" size="20" value=""/>
71       <input name="submit" type="submit" value="Search ..."/>
72     </form>
73     <ul><!-- style="margin-left: -1em" -->
74       <li><a style="font-weight:bold"
75              href="{$href_base}index.html">Main Menu</a></li>
76       <li><a style="font-weight:bold" 
77              href="{$href_base}docs.html">Developer Menu</a></li>
78       <!--   Coming soon .....
79       <li><a style="font-weight:bold" 
80              href="{$href_base}examples/index.html">Code Examples</a></li>
81       -->
82       <li><a style="font-weight:bold"
83              href="index.html">API Menu</a></li>
84       <!--   Coming soon .....
85       <li><a href="{$href_base}guidelines.html">XSLT Guidelines</a></li>
86       -->
87       <li><a href="{$href_base}ChangeLog.html">ChangeLog</a></li>
88     </ul>
89   </xsl:variable>
90   <xsl:template name="toc">
91     <table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000">
92       <tr>
93         <td>
94           <table width="100%" border="0" cellspacing="1" cellpadding="3">
95             <tr>
96               <td colspan="1" bgcolor="#eecfa1" align="center">
97                 <center>
98                   <b><xsl:value-of select="$menu_name"/></b>
99                 </center>
100               </td>
101             </tr>
102             <tr>
103               <td bgcolor="#fffacd">
104                 <xsl:copy-of select="$toc"/>
105               </td>
106             </tr>
107           </table>
108           <table width="100%" border="0" cellspacing="1" cellpadding="3">
109             <tr>
110               <td colspan="1" bgcolor="#eecfa1" align="center">
111                 <center>
112                   <b>API Indexes</b>
113                 </center>
114               </td>
115             </tr>
116             <tr>
117               <td bgcolor="#fffacd">
118                 <xsl:copy-of select="$api"/>
119               </td>
120             </tr>
121           </table>
122           <table width="100%" border="0" cellspacing="1" cellpadding="3">
123             <tr>
124               <td colspan="1" bgcolor="#eecfa1" align="center">
125                 <center>
126                   <b>Related links</b>
127                 </center>
128               </td>
129             </tr>
130             <tr>
131               <td bgcolor="#fffacd">
132                 <xsl:copy-of select="$related"/>
133               </td>
134             </tr>
135           </table>
136         </td>
137       </tr>
138     </table>
139   </xsl:template>
140
141   <xsl:template name="docstyle">
142     <style type="text/css">
143       div.deprecated pre.programlisting {border-style: double;border-color:red}
144       pre.programlisting {border-style: double;background: #EECFA1}
145     </style>
146   </xsl:template>
147   <xsl:template name="navbar">
148     <xsl:variable name="previous" select="preceding-sibling::file[1]"/>
149     <xsl:variable name="next" select="following-sibling::file[1]"/>
150     <table class="navigation" width="100%" summary="Navigation header"
151            cellpadding="2" cellspacing="2">
152       <tr valign="middle">
153         <xsl:if test="$previous">
154           <td><a accesskey="p" href="{$libname}-{$previous/@name}.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></img></a></td>
155           <th align="left"><a href="{$libname}-{$previous/@name}.html"><xsl:value-of select="$previous/@name"/></a></th>
156         </xsl:if>
157         <td><a accesskey="u" href="index.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></img></a></td>
158         <th align="left"><a href="index.html">API documentation</a></th>
159         <td><a accesskey="h" href="../index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></img></a></td>
160         <th align="center"><a href="../index.html">Home</a></th>
161         <xsl:if test="$next">
162           <th align="right"><a href="{$libname}-{$next/@name}.html"><xsl:value-of select="$next/@name"/></a></th>
163           <td><a accesskey="n" href="{$libname}-{$next/@name}.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></img></a></td>
164         </xsl:if>
165       </tr>
166     </table>
167   </xsl:template>
168
169   <!-- This is convoluted but needed to force the current document to
170        be the API one and not the result tree from the tokenize() result,
171        because the keys are only defined on the main document -->
172   <xsl:template mode="dumptoken" match='*'>
173     <xsl:param name="token"/>
174     <xsl:variable name="ref" select="key('symbols', $token)"/>
175     <xsl:choose>
176       <xsl:when test="$ref">
177         <a href="{$libname}-{$ref/@file}.html#{$ref/@name}"><xsl:value-of select="$token"/></a>
178       </xsl:when>
179       <xsl:otherwise>
180         <xsl:value-of select="$token"/>
181       </xsl:otherwise>
182     </xsl:choose>
183   </xsl:template>
184
185   <!-- dumps a string, making cross-reference links -->
186   <xsl:template name="dumptext">
187     <xsl:param name="text"/>
188     <xsl:variable name="ctxt" select='.'/>
189     <!-- <xsl:value-of select="$text"/> -->
190     <xsl:for-each select="str:tokenize($text, ' &#9;')">
191       <xsl:apply-templates select="$ctxt" mode='dumptoken'>
192         <xsl:with-param name="token" select="string(.)"/>
193       </xsl:apply-templates>
194       <xsl:if test="position() != last()">
195         <xsl:text> </xsl:text>
196       </xsl:if>
197     </xsl:for-each>
198   </xsl:template>
199
200   <xsl:template match="macro" mode="toc">
201     <pre class="programlisting">
202     <xsl:text>#define </xsl:text><a href="#{@name}"><xsl:value-of select="@name"/></a>
203     </pre>
204   </xsl:template>
205
206   <xsl:template match="variable" mode="toc">
207     <pre class="programlisting">
208     <xsl:text>Variable </xsl:text>
209     <xsl:call-template name="dumptext">
210       <xsl:with-param name="text" select="string(@type)"/>
211     </xsl:call-template>
212     <xsl:text> </xsl:text>
213     <a name="{@name}"></a>
214     <xsl:value-of select="@name"/>
215     <xsl:text>
216
217 </xsl:text>
218     </pre>
219   </xsl:template>
220
221   <xsl:template match="typedef" mode="toc">
222     <xsl:variable name="name" select="string(@name)"/>
223     <pre class="programlisting">
224     <xsl:choose>
225       <xsl:when test="@type = 'enum'">
226         <xsl:text>Enum </xsl:text>
227         <a href="#{$name}"><xsl:value-of select="$name"/></a>
228         <xsl:text>
229 </xsl:text>
230       </xsl:when>
231       <xsl:otherwise>
232         <xsl:text>Typedef </xsl:text>
233         <xsl:call-template name="dumptext">
234           <xsl:with-param name="text" select="@type"/>
235         </xsl:call-template>
236         <xsl:text> </xsl:text>
237         <a name="{$name}"><xsl:value-of select="$name"/></a>
238         <xsl:text>
239 </xsl:text>
240       </xsl:otherwise>
241     </xsl:choose>
242     </pre>
243   </xsl:template>
244
245   <xsl:template match="typedef[@type = 'enum']">
246     <xsl:variable name="name" select="string(@name)"/>
247     <h3>Enum <a name="{$name}"><xsl:value-of select="$name"/></a></h3>
248     <pre class="programlisting">
249       <xsl:text>Enum </xsl:text>
250       <xsl:value-of select="$name"/>
251       <xsl:text> {
252 </xsl:text>
253       <xsl:for-each select="/api/symbols/enum[@type = $name]">
254         <xsl:sort select="@value" data-type="number" order="ascending"/>
255         <xsl:text>    </xsl:text>
256         <a name="{@name}"><xsl:value-of select="@name"/></a>
257         <xsl:text> = </xsl:text>
258         <xsl:value-of select="@value"/>
259         <xsl:if test="@info != ''">
260           <xsl:text> : </xsl:text>
261           <xsl:call-template name="dumptext">
262             <xsl:with-param name="text" select="@info"/>
263           </xsl:call-template>
264         </xsl:if>
265         <xsl:text>
266 </xsl:text>
267       </xsl:for-each>
268       <xsl:text>}
269 </xsl:text>
270     </pre>
271   </xsl:template>
272
273   <xsl:template match="struct" mode="toc">
274     <pre class="programlisting">
275     <xsl:text>Structure </xsl:text><a href="#{@name}"><xsl:value-of select="@name"/></a><br/>
276     <xsl:value-of select="@type"/><xsl:text>
277 </xsl:text>
278     <xsl:if test="not(field)">
279       <xsl:text>The content of this structure is not made public by the API.
280 </xsl:text>
281     </xsl:if>
282     </pre>
283   </xsl:template>
284
285   <xsl:template match="struct">
286     <h3><a name="{@name}">Structure <xsl:value-of select="@name"/></a></h3>
287     <pre class="programlisting">
288     <xsl:text>Structure </xsl:text><xsl:value-of select="@name"/><br/>
289     <xsl:value-of select="@type"/><xsl:text> {
290 </xsl:text>
291     <xsl:if test="not(field)">
292       <xsl:text>The content of this structure is not made public by the API.
293 </xsl:text>
294     </xsl:if>
295     <xsl:for-each select="field">
296         <xsl:text>    </xsl:text>
297         <xsl:call-template name="dumptext">
298           <xsl:with-param name="text" select="@type"/>
299         </xsl:call-template>
300         <xsl:text>&#9;</xsl:text>
301         <xsl:value-of select="@name"/>
302         <xsl:if test="@info != ''">
303           <xsl:text>&#9;: </xsl:text>
304           <xsl:call-template name="dumptext">
305             <xsl:with-param name="text" select="substring(@info, 1, 40)"/>
306           </xsl:call-template>
307         </xsl:if>
308         <xsl:text>
309 </xsl:text>
310     </xsl:for-each>
311     <xsl:text>}</xsl:text>
312     </pre>
313   </xsl:template>
314
315   <xsl:template match="macro">
316     <xsl:variable name="name" select="string(@name)"/>
317     <h3><a name="{$name}"></a>Macro: <xsl:value-of select="$name"/></h3>
318     <pre><xsl:text>#define </xsl:text><xsl:value-of select="$name"/></pre>
319     <p>
320     <xsl:call-template name="dumptext">
321       <xsl:with-param name="text" select="info"/>
322     </xsl:call-template>
323     </p><xsl:text>
324 </xsl:text>
325   </xsl:template>
326
327   <xsl:template match="function" mode="toc">
328     <xsl:variable name="name" select="string(@name)"/>
329     <xsl:variable name="nlen" select="string-length($name)"/>
330     <xsl:variable name="tlen" select="string-length(return/@type)"/>
331     <xsl:variable name="blen" select="(($nlen + 8) - (($nlen + 8) mod 8)) + (($tlen + 8) - (($tlen + 8) mod 8))"/>
332     <pre class="programlisting">
333     <xsl:call-template name="dumptext">
334       <xsl:with-param name="text" select="return/@type"/>
335     </xsl:call-template>
336     <xsl:text>&#9;</xsl:text>
337     <a href="#{@name}"><xsl:value-of select="@name"/></a>
338     <xsl:if test="$blen - 40 &lt; -8">
339       <xsl:text>&#9;</xsl:text>
340     </xsl:if>
341     <xsl:if test="$blen - 40 &lt; 0">
342       <xsl:text>&#9;</xsl:text>
343     </xsl:if>
344     <xsl:text>&#9;(</xsl:text>
345     <xsl:if test="not(arg)">
346       <xsl:text>void</xsl:text>
347     </xsl:if>
348     <xsl:for-each select="arg">
349       <xsl:call-template name="dumptext">
350         <xsl:with-param name="text" select="@type"/>
351       </xsl:call-template>
352       <xsl:text> </xsl:text>
353       <xsl:value-of select="@name"/>
354       <xsl:if test="position() != last()">
355         <xsl:text>, </xsl:text><br/>
356         <xsl:if test="$blen - 40 &gt; 8">
357           <xsl:text>&#9;</xsl:text>
358         </xsl:if>
359         <xsl:if test="$blen - 40 &gt; 0">
360           <xsl:text>&#9;</xsl:text>
361         </xsl:if>
362         <xsl:text>&#9;&#9;&#9;&#9;&#9; </xsl:text>
363       </xsl:if>
364     </xsl:for-each>
365     <xsl:text>)</xsl:text>
366     </pre><xsl:text>
367 </xsl:text>
368   </xsl:template>
369
370   <xsl:template match="functype" mode="toc">
371     <xsl:variable name="name" select="string(@name)"/>
372     <xsl:variable name="nlen" select="string-length($name)"/>
373     <xsl:variable name="tlen" select="string-length(return/@type)"/>
374     <xsl:variable name="blen" select="(($nlen + 8) - (($nlen + 8) mod 8)) + (($tlen + 8) - (($tlen + 8) mod 8))"/>
375     <pre class="programlisting">
376     <xsl:text>Function type: </xsl:text>
377     <a href="#{$name}"><xsl:value-of select="$name"/></a>
378     <xsl:text>
379 </xsl:text>
380     <xsl:call-template name="dumptext">
381       <xsl:with-param name="text" select="return/@type"/>
382     </xsl:call-template>
383     <xsl:text>&#9;</xsl:text>
384     <a href="#{$name}"><xsl:value-of select="$name"/></a>
385     <xsl:if test="$blen - 40 &lt; -8">
386       <xsl:text>&#9;</xsl:text>
387     </xsl:if>
388     <xsl:if test="$blen - 40 &lt; 0">
389       <xsl:text>&#9;</xsl:text>
390     </xsl:if>
391     <xsl:text>&#9;(</xsl:text>
392     <xsl:if test="not(arg)">
393       <xsl:text>void</xsl:text>
394     </xsl:if>
395     <xsl:for-each select="arg">
396       <xsl:call-template name="dumptext">
397         <xsl:with-param name="text" select="@type"/>
398       </xsl:call-template>
399       <xsl:text> </xsl:text>
400       <xsl:value-of select="@name"/>
401       <xsl:if test="position() != last()">
402         <xsl:text>, </xsl:text><br/>
403         <xsl:if test="$blen - 40 &gt; 8">
404           <xsl:text>&#9;</xsl:text>
405         </xsl:if>
406         <xsl:if test="$blen - 40 &gt; 0">
407           <xsl:text>&#9;</xsl:text>
408         </xsl:if>
409         <xsl:text>&#9;&#9;&#9;&#9;&#9; </xsl:text>
410       </xsl:if>
411     </xsl:for-each>
412     <xsl:text>)
413 </xsl:text>
414     </pre>
415     <xsl:text>
416 </xsl:text>
417   </xsl:template>
418
419   <xsl:template match="functype">
420     <xsl:variable name="name" select="string(@name)"/>
421     <xsl:variable name="nlen" select="string-length($name)"/>
422     <xsl:variable name="tlen" select="string-length(return/@type)"/>
423     <xsl:variable name="blen" select="(($nlen + 8) - (($nlen + 8) mod 8)) + (($tlen + 8) - (($tlen + 8) mod 8))"/>
424     <h3>
425       <a name="{$name}"></a>
426       <xsl:text>Function type: </xsl:text>
427       <xsl:value-of select="$name"/>
428     </h3>
429     <pre class="programlisting">
430     <xsl:text>Function type: </xsl:text>
431     <xsl:value-of select="$name"/>
432     <xsl:text>
433 </xsl:text>
434     <xsl:call-template name="dumptext">
435       <xsl:with-param name="text" select="return/@type"/>
436     </xsl:call-template>
437     <xsl:text>&#9;</xsl:text>
438     <xsl:value-of select="@name"/>
439     <xsl:if test="$blen - 40 &lt; -8">
440       <xsl:text>&#9;</xsl:text>
441     </xsl:if>
442     <xsl:if test="$blen - 40 &lt; 0">
443       <xsl:text>&#9;</xsl:text>
444     </xsl:if>
445     <xsl:text>&#9;(</xsl:text>
446     <xsl:if test="not(arg)">
447       <xsl:text>void</xsl:text>
448     </xsl:if>
449     <xsl:for-each select="arg">
450       <xsl:call-template name="dumptext">
451         <xsl:with-param name="text" select="@type"/>
452       </xsl:call-template>
453       <xsl:text> </xsl:text>
454       <xsl:value-of select="@name"/>
455       <xsl:if test="position() != last()">
456         <xsl:text>, </xsl:text><br/>
457         <xsl:if test="$blen - 40 &gt; 8">
458           <xsl:text>&#9;</xsl:text>
459         </xsl:if>
460         <xsl:if test="$blen - 40 &gt; 0">
461           <xsl:text>&#9;</xsl:text>
462         </xsl:if>
463         <xsl:text>&#9;&#9;&#9;&#9;&#9; </xsl:text>
464       </xsl:if>
465     </xsl:for-each>
466     <xsl:text>)
467 </xsl:text>
468     </pre>
469     <p>
470     <xsl:call-template name="dumptext">
471       <xsl:with-param name="text" select="info"/>
472     </xsl:call-template>
473     </p>
474     <xsl:if test="arg | return">
475       <div class="variablelist"><table border="0"><col align="left"/><tbody>
476       <xsl:for-each select="arg">
477         <tr>
478           <td><span class="term"><i><tt><xsl:value-of select="@name"/></tt></i>:</span></td>
479           <td>
480             <xsl:call-template name="dumptext">
481               <xsl:with-param name="text" select="@info"/>
482             </xsl:call-template>
483           </td>
484         </tr>
485       </xsl:for-each>
486       <xsl:if test="return/@info">
487         <tr>
488           <td><span class="term"><i><tt>Returns</tt></i>:</span></td>
489           <td>
490             <xsl:call-template name="dumptext">
491               <xsl:with-param name="text" select="return/@info"/>
492             </xsl:call-template>
493           </td>
494         </tr>
495       </xsl:if>
496       </tbody></table></div>
497     </xsl:if>
498     <br/>
499     <xsl:text>
500 </xsl:text>
501   </xsl:template>
502
503   <xsl:template match="function">
504     <xsl:variable name="name" select="string(@name)"/>
505     <xsl:variable name="nlen" select="string-length($name)"/>
506     <xsl:variable name="tlen" select="string-length(return/@type)"/>
507     <xsl:variable name="blen" select="(($nlen + 8) - (($nlen + 8) mod 8)) + (($tlen + 8) - (($tlen + 8) mod 8))"/>
508     <h3><a name="{$name}"></a>Function: <xsl:value-of select="$name"/></h3>
509     <pre class="programlisting">
510     <xsl:call-template name="dumptext">
511       <xsl:with-param name="text" select="return/@type"/>
512     </xsl:call-template>
513     <xsl:text>&#9;</xsl:text>
514     <xsl:value-of select="@name"/>
515     <xsl:if test="$blen - 40 &lt; -8">
516       <xsl:text>&#9;</xsl:text>
517     </xsl:if>
518     <xsl:if test="$blen - 40 &lt; 0">
519       <xsl:text>&#9;</xsl:text>
520     </xsl:if>
521     <xsl:text>&#9;(</xsl:text>
522     <xsl:if test="not(arg)">
523       <xsl:text>void</xsl:text>
524     </xsl:if>
525     <xsl:for-each select="arg">
526       <xsl:call-template name="dumptext">
527         <xsl:with-param name="text" select="@type"/>
528       </xsl:call-template>
529       <xsl:text> </xsl:text>
530       <xsl:value-of select="@name"/>
531       <xsl:if test="position() != last()">
532         <xsl:text>, </xsl:text><br/>
533         <xsl:if test="$blen - 40 &gt; 8">
534           <xsl:text>&#9;</xsl:text>
535         </xsl:if>
536         <xsl:if test="$blen - 40 &gt; 0">
537           <xsl:text>&#9;</xsl:text>
538         </xsl:if>
539         <xsl:text>&#9;&#9;&#9;&#9;&#9; </xsl:text>
540       </xsl:if>
541     </xsl:for-each>
542     <xsl:text>)</xsl:text><br/>
543     <xsl:text>
544 </xsl:text>
545     </pre>
546     <p>
547     <xsl:call-template name="dumptext">
548       <xsl:with-param name="text" select="info"/>
549     </xsl:call-template>
550     </p><xsl:text>
551 </xsl:text>
552     <xsl:if test="arg | return/@info">
553       <div class="variablelist"><table border="0"><col align="left"/><tbody>
554       <xsl:for-each select="arg">
555         <tr>
556           <td><span class="term"><i><tt><xsl:value-of select="@name"/></tt></i>:</span></td>
557           <td>
558             <xsl:call-template name="dumptext">
559               <xsl:with-param name="text" select="@info"/>
560             </xsl:call-template>
561           </td>
562         </tr>
563       </xsl:for-each>
564       <xsl:if test="return/@info">
565         <tr>
566           <td><span class="term"><i><tt>Returns</tt></i>:</span></td>
567           <td>
568             <xsl:call-template name="dumptext">
569               <xsl:with-param name="text" select="return/@info"/>
570             </xsl:call-template>
571           </td>
572         </tr>
573       </xsl:if>
574       </tbody></table></div>
575     </xsl:if>
576   </xsl:template>
577
578   <xsl:template match="exports" mode="toc">
579     <xsl:apply-templates select="key('symbols', string(@symbol))[1]" mode="toc"/>
580   </xsl:template>
581
582   <xsl:template match="exports">
583     <xsl:apply-templates select="key('symbols', string(@symbol))[1]"/>
584   </xsl:template>
585
586   <xsl:template name="description">
587     <xsl:if test="deprecated">
588       <h2 style="font-weight:bold;color:red;text-align:center">This module is deprecated</h2>
589     </xsl:if>
590     <xsl:if test="description">
591       <p><xsl:value-of select="description"/></p>
592     </xsl:if>
593   </xsl:template>
594
595   <xsl:template match="file">
596     <xsl:variable name="name" select="@name"/>
597     <xsl:variable name="title">Module <xsl:value-of select="$name"/> from <xsl:value-of select="/api/@name"/></xsl:variable>
598     <xsl:variable name="content">
599       <xsl:call-template name="navbar"/>
600       <xsl:call-template name="description"/>
601       <xsl:choose>
602         <xsl:when test="deprecated">
603           <div class="deprecated">
604           <h2>Table of Contents</h2>
605           <xsl:apply-templates select="exports" mode="toc"/>
606             <h2>Description</h2>
607             <xsl:text>
608 </xsl:text>
609           <xsl:apply-templates select="exports"/>
610           </div>
611         </xsl:when>
612         <xsl:otherwise>
613           <h2>Table of Contents</h2>
614           <xsl:apply-templates select="exports[@type='macro']" mode="toc">
615             <xsl:sort select='@symbol'/>
616           </xsl:apply-templates>
617           <xsl:apply-templates select="exports[@type='enum']" mode="toc">
618             <xsl:sort select='@symbol'/>
619           </xsl:apply-templates>
620           <xsl:apply-templates select="exports[@type='typedef']" mode="toc">
621             <xsl:sort select='@symbol'/>
622           </xsl:apply-templates>
623           <xsl:apply-templates select="exports[@type='struct']" mode="toc">
624             <xsl:sort select='@symbol'/>
625           </xsl:apply-templates>
626           <xsl:apply-templates select="exports[@type='function']" mode="toc">
627             <xsl:sort select='@symbol'/>
628           </xsl:apply-templates>
629           <h2>Description</h2>
630           <xsl:text>
631 </xsl:text>
632           <xsl:apply-templates select="exports[@type='macro']">
633             <xsl:sort select='@symbol'/>
634           </xsl:apply-templates>
635           <xsl:apply-templates select="exports[@type='enum']">
636             <xsl:sort select='@symbol'/>
637           </xsl:apply-templates>
638           <xsl:apply-templates select="exports[@type='typedef']">
639             <xsl:sort select='@symbol'/>
640           </xsl:apply-templates>
641           <xsl:apply-templates select="exports[@type='struct']">
642             <xsl:sort select='@symbol'/>
643           </xsl:apply-templates>
644           <xsl:apply-templates select="exports[@type='function']">
645             <xsl:sort select='@symbol'/>
646           </xsl:apply-templates>
647         </xsl:otherwise>
648       </xsl:choose>
649     </xsl:variable>
650     <xsl:call-template name="new_page">
651       <xsl:with-param name="filename"
652           select="concat($html_dir, $libname, '-', $name, '.html')"/>
653       <xsl:with-param name="title" select="$title"/>
654       <xsl:with-param name="target" select="$content"/>
655     </xsl:call-template>
656   </xsl:template>
657
658   <xsl:template match="file" mode="toc">
659     <xsl:variable name="name" select="@name"/>
660     <li>
661       <a href="{$libname}-{$name}.html"><xsl:value-of select="$name"/></a>
662       <xsl:text>: </xsl:text>
663       <xsl:value-of select="summary"/>
664     </li>
665   </xsl:template>
666
667   <xsl:template name="mainpage">
668     <xsl:param name="file" select="concat($html_dir, 'index.html')"/>
669     <xsl:variable name="title">Reference Manual for <xsl:value-of select="/api/@name"/></xsl:variable>
670     <xsl:variable name="content">
671       <h2>Table of Contents</h2>
672       <ul>
673         <xsl:apply-templates select="/api/files/file" mode="toc"/>
674       </ul>
675     </xsl:variable>
676     <xsl:call-template name="new_page">
677       <xsl:with-param name="filename" select="$file"/>
678       <xsl:with-param name="title" select="$title"/>
679       <xsl:with-param name="target" select="$content"/>
680     </xsl:call-template>
681   </xsl:template>
682
683   <xsl:template match="/">
684     <xsl:message>Processing library <xsl:value-of select="$libname"
685       />, output directory is <xsl:value-of select="$html_dir"
686       /></xsl:message>
687     <!-- Save the main index.html as well as a couple of copies -->
688     <xsl:call-template name="mainpage"/>
689     <xsl:call-template name="mainpage">
690       <xsl:with-param name="file" select="concat($html_dir, '/book1.html')"/>
691     </xsl:call-template>
692     <xsl:call-template name="mainpage">
693       <xsl:with-param name="file" select="concat($html_dir, '/',
694             $libname, '-lib.html')"/>
695     </xsl:call-template>
696     <!-- now build the file for each of the modules -->
697     <xsl:apply-templates select="/api/files/file"/>
698   </xsl:template>
699
700 </xsl:stylesheet>