9a65afc4e9558f963db04f0f5752098e01df766e
[platform/upstream/libxslt.git] / doc / api.xsl
1 <?xml version="1.0"?>
2 <!--
3   this stylesheet builds the API*.html , it works based on the api
4   reference file defined in the first 'document' below below.
5   -->
6 <xsl:stylesheet version="1.0"
7   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
8   xmlns:exsl="http://exslt.org/common"
9   extension-element-prefixes="exsl"
10   exclude-result-prefixes="exsl">
11
12   <!-- Import the rest of the site stylesheets -->
13   <xsl:import href="site.xsl"/>
14
15   <!-- Generate XHTML-1.0 transitional -->
16   <xsl:output method="xml" encoding="ISO-8859-1" indent="yes"
17       doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
18       doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
19
20   <xsl:variable name="href_base" select="''"/>
21   <xsl:variable name="apirefs" select="document('libxslt-refs.xml')"/>
22   <xsl:variable name="module" select="$apirefs/apirefs/@name"/>
23   <xsl:key name="refhref" match="reference" use="@name"/>
24
25   <xsl:template match="ref" mode="anchor">
26     <xsl:variable name="name" select="@name"/>
27     <xsl:for-each select="document('libxslt-refs.xml')">
28         <a href="{key('refhref', $name)/@href}"><xsl:value-of select="$name"/></a><br/>
29     </xsl:for-each>
30   </xsl:template>
31   <xsl:template match="type" mode="reflist">
32     <h2>Type <xsl:value-of select="@name"/>:</h2>
33     <p>
34       <xsl:for-each select="ref">
35         <xsl:apply-templates mode="anchor" select="."/>
36         <xsl:text>
37 </xsl:text>
38       </xsl:for-each>
39     </p>
40   </xsl:template>
41   <xsl:template match="letter" mode="reflist">
42     <h2>Letter <xsl:value-of select="@name"/>:</h2>
43     <p>
44       <xsl:for-each select="ref">
45         <xsl:apply-templates mode="anchor" select="."/>
46         <xsl:text>
47 </xsl:text>
48       </xsl:for-each>
49     </p>
50   </xsl:template>
51   <xsl:template match="file" mode="reflist">
52     <h2><a name="{@name}">Module <xsl:value-of select="@name"/></a>:</h2>
53     <p>
54       <xsl:for-each select="ref">
55         <xsl:apply-templates mode="anchor" select="."/>
56         <xsl:text>
57 </xsl:text>
58       </xsl:for-each>
59     </p>
60   </xsl:template>
61   <xsl:template match="letter" mode="wordlist">
62     <h2>Letter <xsl:value-of select="@name"/>:</h2>
63     <dl>
64       <xsl:for-each select="word">
65         <dt><xsl:value-of select="@name"/></dt>
66         <dd>
67         <xsl:for-each select="ref">
68           <xsl:apply-templates mode="anchor" select="."/>
69           <xsl:text>
70 </xsl:text>
71         </xsl:for-each>
72         </dd>
73       </xsl:for-each>
74     </dl>
75   </xsl:template>
76
77   <xsl:template match="constructors">
78     <xsl:message>Generating API Constructors</xsl:message>
79     <xsl:variable name="title">List of constructors for <xsl:value-of select="$module"/></xsl:variable>
80     <xsl:document href="APIconstructors.html" method="xml" encoding="ISO-8859-1"
81       doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
82       doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
83       <html>
84         <head>
85         <xsl:call-template name="style"/>
86         <xsl:element name="title">
87           <xsl:value-of select="$title"/>
88         </xsl:element>
89         </head>
90         <body bgcolor="#8b7765" text="#000000" link="#000000" vlink="#000000">
91           <xsl:call-template name="titlebox">
92             <xsl:with-param name="title" select="$title"/>
93           </xsl:call-template>
94           <table border="0" cellpadding="4" cellspacing="0" width="100%" align="center">
95             <tr>
96               <td bgcolor="#8b7765">
97                 <table border="0" cellspacing="0" cellpadding="2" width="100%">
98                   <tr>
99                     <td valign="top" width="200" bgcolor="#8b7765">
100                       <xsl:call-template name="develtoc"/>
101                     </td>
102                     <td valign="top" bgcolor="#8b7765">
103                       <table border="0" cellspacing="0" cellpadding="1" width="100%">
104                         <tr>
105                           <td>
106                             <table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000">
107                               <tr>
108                                 <td>
109                                   <table border="0" cellpadding="3" cellspacing="1" width="100%">
110                                     <tr>
111                                       <td bgcolor="#fffacd">
112                                         <xsl:apply-templates mode="reflist" select="type"/>
113                                         <p><a href="{$href_base}bugs.html">Daniel Veillard</a></p>
114                                       </td>
115                                     </tr>
116                                   </table>
117                                 </td>
118                               </tr>
119                             </table>
120                           </td>
121                         </tr>
122                       </table>
123                     </td>
124                   </tr>
125                 </table>
126               </td>
127             </tr>
128           </table>
129         </body>
130       </html>
131     </xsl:document>
132   </xsl:template>
133   <xsl:template match="files">
134     <xsl:message>Generating API List of synbols per file</xsl:message>
135     <xsl:variable name="title">List of Symbols per Module for <xsl:value-of select="$module"/></xsl:variable>
136     <xsl:document href="APIfiles.html" method="xml" encoding="ISO-8859-1"
137       doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
138       doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
139       <html>
140         <head>
141         <xsl:call-template name="style"/>
142         <xsl:element name="title">
143           <xsl:value-of select="$title"/>
144         </xsl:element>
145         </head>
146         <body bgcolor="#8b7765" text="#000000" link="#000000" vlink="#000000">
147           <xsl:call-template name="titlebox">
148             <xsl:with-param name="title" select="$title"/>
149           </xsl:call-template>
150           <table border="0" cellpadding="4" cellspacing="0" width="100%" align="center">
151             <tr>
152               <td bgcolor="#8b7765">
153                 <table border="0" cellspacing="0" cellpadding="2" width="100%">
154                   <tr>
155                     <td valign="top" width="200" bgcolor="#8b7765">
156                       <xsl:call-template name="develtoc"/>
157                     </td>
158                     <td valign="top" bgcolor="#8b7765">
159                       <table border="0" cellspacing="0" cellpadding="1" width="100%">
160                         <tr>
161                           <td>
162                             <table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000">
163                               <tr>
164                                 <td>
165                                   <table border="0" cellpadding="3" cellspacing="1" width="100%">
166                                     <tr>
167                                       <td bgcolor="#fffacd">
168                                         <xsl:apply-templates mode="reflist" select="file"/>
169                                         <p><a href="{$href_base}bugs.html">Daniel Veillard</a></p>
170                                       </td>
171                                     </tr>
172                                   </table>
173                                 </td>
174                               </tr>
175                             </table>
176                           </td>
177                         </tr>
178                       </table>
179                     </td>
180                   </tr>
181                 </table>
182               </td>
183             </tr>
184           </table>
185         </body>
186       </html>
187     </xsl:document>
188   </xsl:template>
189   <xsl:template match="functions">
190     <xsl:message>Generating API Functions by Type</xsl:message>
191     <xsl:variable name="title">List of function manipulating types in <xsl:value-of select="$module"/></xsl:variable>
192     <xsl:document href="APIfunctions.html" method="xml" encoding="ISO-8859-1"
193       doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
194       doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
195       <html>
196         <head>
197         <xsl:call-template name="style"/>
198         <xsl:element name="title">
199           <xsl:value-of select="$title"/>
200         </xsl:element>
201         </head>
202         <body bgcolor="#8b7765" text="#000000" link="#000000" vlink="#000000">
203           <xsl:call-template name="titlebox">
204             <xsl:with-param name="title" select="$title"/>
205           </xsl:call-template>
206           <table border="0" cellpadding="4" cellspacing="0" width="100%" align="center">
207             <tr>
208               <td bgcolor="#8b7765">
209                 <table border="0" cellspacing="0" cellpadding="2" width="100%">
210                   <tr>
211                     <td valign="top" width="200" bgcolor="#8b7765">
212                       <xsl:call-template name="develtoc"/>
213                     </td>
214                     <td valign="top" bgcolor="#8b7765">
215                       <table border="0" cellspacing="0" cellpadding="1" width="100%">
216                         <tr>
217                           <td>
218                             <table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000">
219                               <tr>
220                                 <td>
221                                   <table border="0" cellpadding="3" cellspacing="1" width="100%">
222                                     <tr>
223                                       <td bgcolor="#fffacd">
224                                         <xsl:apply-templates mode="reflist" select="type"/>
225                                         <p><a href="{$href_base}bugs.html">Daniel Veillard</a></p>
226                                       </td>
227                                     </tr>
228                                   </table>
229                                 </td>
230                               </tr>
231                             </table>
232                           </td>
233                         </tr>
234                       </table>
235                     </td>
236                   </tr>
237                 </table>
238               </td>
239             </tr>
240           </table>
241         </body>
242       </html>
243     </xsl:document>
244   </xsl:template>
245   <xsl:template match="alpha">
246     <xsl:message>Generating API Alphabetic list</xsl:message>
247     <xsl:variable name="title">Alphabetic List of Symbols in <xsl:value-of select="$module"/></xsl:variable>
248     <xsl:document href="APIsymbols.html" method="xml" encoding="ISO-8859-1"
249       doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
250       doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
251       <html>
252         <head>
253         <xsl:call-template name="style"/>
254         <xsl:element name="title">
255           <xsl:value-of select="$title"/>
256         </xsl:element>
257         </head>
258         <body bgcolor="#8b7765" text="#000000" link="#000000" vlink="#000000">
259           <xsl:call-template name="titlebox">
260             <xsl:with-param name="title" select="$title"/>
261           </xsl:call-template>
262           <table border="0" cellpadding="4" cellspacing="0" width="100%" align="center">
263             <tr>
264               <td bgcolor="#8b7765">
265                 <table border="0" cellspacing="0" cellpadding="2" width="100%">
266                   <tr>
267                     <td valign="top" width="200" bgcolor="#8b7765">
268                       <xsl:call-template name="develtoc"/>
269                     </td>
270                     <td valign="top" bgcolor="#8b7765">
271                       <table border="0" cellspacing="0" cellpadding="1" width="100%">
272                         <tr>
273                           <td>
274                             <table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000">
275                               <tr>
276                                 <td>
277                                   <table border="0" cellpadding="3" cellspacing="1" width="100%">
278                                     <tr>
279                                       <td bgcolor="#fffacd">
280                                         <xsl:apply-templates mode="reflist" select="letter"/>
281                                         <p><a href="{$href_base}bugs.html">Daniel Veillard</a></p>
282                                       </td>
283                                     </tr>
284                                   </table>
285                                 </td>
286                               </tr>
287                             </table>
288                           </td>
289                         </tr>
290                       </table>
291                     </td>
292                   </tr>
293                 </table>
294               </td>
295             </tr>
296           </table>
297         </body>
298       </html>
299     </xsl:document>
300   </xsl:template>
301   <xsl:template name="apichunks">
302     <h2 align="center">
303     <xsl:for-each select="/apirefs/index/chunks/chunk">
304       <xsl:variable name="name" select="@name"/>
305       <xsl:variable name="start" select="@start"/>
306       <xsl:variable name="end" select="@end"/>
307       <xsl:variable name="block" select="concat($start, '-', $end)"/>
308       <a href="API{$name}.html"><xsl:value-of select="$block"/></a>
309       <xsl:text>
310 </xsl:text>
311     </xsl:for-each>
312     </h2>
313   </xsl:template>
314   <xsl:template match="chunk">
315     <xsl:variable name="name" select="@name"/>
316     <xsl:variable name="start" select="@start"/>
317     <xsl:variable name="end" select="@end"/>
318     <xsl:variable name="block" select="concat($start, '-', $end)"/>
319     <xsl:variable name="target" select="/apirefs/index/chunk[@name = $name]"/>
320     <xsl:variable name="title">API Alphabetic Index <xsl:value-of select="$block"/> for <xsl:value-of select="$module"/></xsl:variable>
321     <xsl:document href="API{$name}.html" method="xml" encoding="ISO-8859-1"
322       doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
323       doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
324       <html>
325         <head>
326         <xsl:call-template name="style"/>
327         <xsl:element name="title">
328           <xsl:value-of select="$title"/>
329         </xsl:element>
330         </head>
331         <body bgcolor="#8b7765" text="#000000" link="#000000" vlink="#000000">
332           <xsl:call-template name="titlebox">
333             <xsl:with-param name="title" select="$title"/>
334           </xsl:call-template>
335           <table border="0" cellpadding="4" cellspacing="0" width="100%" align="center">
336             <tr>
337               <td bgcolor="#8b7765">
338                 <table border="0" cellspacing="0" cellpadding="2" width="100%">
339                   <tr>
340                     <td valign="top" width="200" bgcolor="#8b7765">
341                       <xsl:call-template name="develtoc"/>
342                     </td>
343                     <td valign="top" bgcolor="#8b7765">
344                       <table border="0" cellspacing="0" cellpadding="1" width="100%">
345                         <tr>
346                           <td>
347                             <table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000">
348                               <tr>
349                                 <td>
350                                   <table border="0" cellpadding="3" cellspacing="1" width="100%">
351                                     <tr>
352                                       <td bgcolor="#fffacd">
353                                         <xsl:call-template name="apichunks"/>
354                                         <xsl:apply-templates mode="wordlist"
355                                                    select="$target/letter"/>
356                                         <xsl:call-template name="apichunks"/>
357                                         <p><a href="{$href_base}bugs.html">Daniel Veillard</a></p>
358                                       </td>
359                                     </tr>
360                                   </table>
361                                 </td>
362                               </tr>
363                             </table>
364                           </td>
365                         </tr>
366                       </table>
367                     </td>
368                   </tr>
369                 </table>
370               </td>
371             </tr>
372           </table>
373         </body>
374       </html>
375     </xsl:document>
376   </xsl:template>
377
378   <xsl:template match="index">
379     <xsl:message>Generating API Index</xsl:message>
380     <xsl:apply-templates select="chunks/chunk"/>
381   </xsl:template>
382
383   <xsl:template match="apirefs">
384     <xsl:message>Generating API Cross References</xsl:message>
385     <xsl:apply-templates select="constructors"/>
386     <xsl:apply-templates select="functions"/>
387     <xsl:apply-templates select="alpha"/>
388     <xsl:apply-templates select="files"/>
389     <xsl:apply-templates select="index"/>
390   </xsl:template>
391
392   <xsl:template match="/">
393     <xsl:apply-templates select="$apirefs/apirefs"/>
394   </xsl:template>
395
396 </xsl:stylesheet>