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