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