blob: 07033703481f89efe76b9d2ffdbe3f94c9afd009 [file] [log] [blame]
Daniel Veillardc9484202001-10-24 12:35:52 +00001<?xml version="1.0"?>
2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
Daniel Veillardb8cfbd12001-10-25 10:53:28 +00003 <xsl:output method="html" version="4.01" encoding="ISO-8859-1"/>
Daniel Veillard3bf65be2002-01-23 12:36:34 +00004
Daniel Veillardb8cfbd12001-10-25 10:53:28 +00005<!--
6 - returns the filename associated to an ID in the original file
7 -->
8 <xsl:template name="filename">
9 <xsl:param name="name" select="string(@href)"/>
10 <xsl:choose>
11 <xsl:when test="$name = '#Introducti'">
12 <xsl:text>intro.html</xsl:text>
13 </xsl:when>
14 <xsl:when test="$name = '#Documentat'">
15 <xsl:text>docs.html</xsl:text>
16 </xsl:when>
17 <xsl:when test="$name = '#Reporting'">
18 <xsl:text>bugs.html</xsl:text>
19 </xsl:when>
20 <xsl:when test="$name = '#help'">
21 <xsl:text>help.html</xsl:text>
22 </xsl:when>
23 <xsl:when test="$name = '#Help'">
24 <xsl:text>help.html</xsl:text>
25 </xsl:when>
26 <xsl:when test="$name = '#Downloads'">
27 <xsl:text>downloads.html</xsl:text>
28 </xsl:when>
29 <xsl:when test="$name = '#News'">
30 <xsl:text>news.html</xsl:text>
31 </xsl:when>
32 <xsl:when test="$name = '#Contributi'">
33 <xsl:text>contribs.html</xsl:text>
34 </xsl:when>
35 <xsl:when test="$name = '#xsltproc'">
36 <xsl:text>xsltproc2.html</xsl:text>
37 </xsl:when>
38 <xsl:when test="$name = '#API'">
39 <xsl:text>API.html</xsl:text>
40 </xsl:when>
41 <xsl:when test="$name = '#XSLT'">
42 <xsl:text>XSLT.html</xsl:text>
43 </xsl:when>
44 <xsl:when test="$name = '#XML'">
Daniel Veillard7b602b42002-01-08 13:26:00 +000045 <xsl:text>XMLinfo.html</xsl:text>
Daniel Veillardb8cfbd12001-10-25 10:53:28 +000046 </xsl:when>
47 <xsl:when test="$name = '#Validation'">
48 <xsl:text>xmldtd.html</xsl:text>
49 </xsl:when>
50 <xsl:when test="$name = '#tree'">
51 <xsl:text>tree.html</xsl:text>
52 </xsl:when>
53 <xsl:when test="$name = '#library'">
54 <xsl:text>library.html</xsl:text>
55 </xsl:when>
56 <xsl:when test="$name = '#interface'">
57 <xsl:text>interface.html</xsl:text>
58 </xsl:when>
59 <xsl:when test="$name = '#Example'">
60 <xsl:text>example.html</xsl:text>
61 </xsl:when>
62 <xsl:when test="$name = '#Entities'">
63 <xsl:text>entities.html</xsl:text>
64 </xsl:when>
65 <xsl:when test="$name = '#architecture'">
66 <xsl:text>architecture.html</xsl:text>
67 </xsl:when>
68 <xsl:when test="$name = '#Namespaces'">
69 <xsl:text>namespaces.html</xsl:text>
70 </xsl:when>
71 <xsl:when test="$name = '#DOM'">
72 <xsl:text>DOM.html</xsl:text>
73 </xsl:when>
74 <xsl:when test="$name = '#Catalog'">
75 <xsl:text>catalog.html</xsl:text>
76 </xsl:when>
77 <xsl:when test="$name = '#Upgrading'">
78 <xsl:text>upgrade.html</xsl:text>
79 </xsl:when>
80 <xsl:when test="$name = '#Encodings'">
81 <xsl:text>encoding.html</xsl:text>
82 </xsl:when>
83 <xsl:when test="$name = '#IO'">
84 <xsl:text>xmlio.html</xsl:text>
85 </xsl:when>
86 <xsl:when test="$name = '#Memory'">
87 <xsl:text>xmlmem.html</xsl:text>
88 </xsl:when>
Daniel Veillard52dcab32001-10-30 12:51:17 +000089 <xsl:when test="$name = '#Thread'">
90 <xsl:text>threads.html</xsl:text>
91 </xsl:when>
Daniel Veillardb8cfbd12001-10-25 10:53:28 +000092 <xsl:when test="$name = '#FAQ'">
93 <xsl:text>FAQ.html</xsl:text>
94 </xsl:when>
95 <xsl:when test="$name = ''">
96 <xsl:text>unknown.html</xsl:text>
97 </xsl:when>
98 <xsl:otherwise>
99 <xsl:value-of select="$name"/>
100 </xsl:otherwise>
101 </xsl:choose>
102 </xsl:template>
Daniel Veillardc9484202001-10-24 12:35:52 +0000103<!--
104 - The global title
105 -->
Daniel Veillardc9484202001-10-24 12:35:52 +0000106 <xsl:variable name="globaltitle" select="string(/html/body/h1[1])"/>
107<!--
108 - The table of content
109 -->
110 <xsl:variable name="toc">
Daniel Veillard8acca112002-01-21 09:52:27 +0000111 <ul><!-- style="margin-left: -1em" -->
Daniel Veillardc9484202001-10-24 12:35:52 +0000112 <li><a href="index.html">Home</a></li>
Daniel Veillardc9484202001-10-24 12:35:52 +0000113 <xsl:for-each select="/html/body/h2">
114 <xsl:variable name="filename">
115 <xsl:call-template name="filename">
116 <xsl:with-param name="name" select="concat('#', string(a[1]/@name))"/>
117 </xsl:call-template>
118 </xsl:variable>
119 <li>
120 <xsl:element name="a">
121 <xsl:attribute name="href">
122 <xsl:value-of select="$filename"/>
123 </xsl:attribute>
124 <xsl:value-of select="."/>
125 </xsl:element>
126 </li>
127 </xsl:for-each>
Daniel Veillard594cf0b2001-10-25 08:09:12 +0000128 <li><a href="xml.html">flat page</a>, <a href="site.xsl">stylesheet</a></li>
129 </ul>
130 </xsl:variable>
Daniel Veillard3bf65be2002-01-23 12:36:34 +0000131 <xsl:variable name="api">
132 <ul><!-- style="margin-left: -1em" -->
Daniel Veillardf8592562002-01-23 17:58:17 +0000133 <li><a href="APIchunk0.html">Alphabetic</a></li>
Daniel Veillard3bf65be2002-01-23 12:36:34 +0000134 <li><a href="APIconstructors.html">Constructors</a></li>
135 <li><a href="APIfunctions.html">Functions/Types</a></li>
136 <li><a href="APIfiles.html">Modules</a></li>
137 <li><a href="APIsymbols.html">Symbols</a></li>
138 </ul>
139 </xsl:variable>
Daniel Veillard594cf0b2001-10-25 08:09:12 +0000140 <xsl:variable name="related">
Daniel Veillard8acca112002-01-21 09:52:27 +0000141 <ul><!-- style="margin-left: -1em" -->
Daniel Veillard594cf0b2001-10-25 08:09:12 +0000142 <li><a href="http://mail.gnome.org/archives/xml/">Mail archive</a></li>
143 <li><a href="http://xmlsoft.org/XSLT/">XSLT libxslt</a></li>
Daniel Veillard4a859202002-01-08 11:49:22 +0000144 <li><a href="http://phd.cs.unibo.it/gdome2/">DOM gdome2</a></li>
Daniel Veillard594cf0b2001-10-25 08:09:12 +0000145 <li><a href="ftp://xmlsoft.org/">FTP</a></li>
146 <li><a href="http://www.fh-frankfurt.de/~igor/projects/libxml/">Windows binaries</a></li>
Daniel Veillarddb9dfd92001-11-26 17:25:02 +0000147 <li><a href="http://garypennington.net/libxml2/">Solaris binaries</a></li>
Daniel Veillardc6271d22001-10-27 07:50:58 +0000148 <li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxml">Bug Tracker</a></li>
Daniel Veillardc9484202001-10-24 12:35:52 +0000149 </ul>
150 </xsl:variable>
151 <xsl:template name="toc">
152 <table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000">
153 <tr>
154 <td>
155 <table width="100%" border="0" cellspacing="1" cellpadding="3">
156 <tr>
157 <td colspan="1" bgcolor="#eecfa1" align="center">
158 <center>
159 <b>Main Menu</b>
160 </center>
161 </td>
162 </tr>
163 <tr>
164 <td bgcolor="#fffacd">
165 <xsl:copy-of select="$toc"/>
166 </td>
167 </tr>
168 </table>
Daniel Veillard594cf0b2001-10-25 08:09:12 +0000169 <table width="100%" border="0" cellspacing="1" cellpadding="3">
170 <tr>
171 <td colspan="1" bgcolor="#eecfa1" align="center">
172 <center>
Daniel Veillard3bf65be2002-01-23 12:36:34 +0000173 <b>API Indexes</b>
174 </center>
175 </td>
176 </tr>
177 <tr>
178 <td bgcolor="#fffacd">
179 <xsl:copy-of select="$api"/>
180 </td>
181 </tr>
182 </table>
183 <table width="100%" border="0" cellspacing="1" cellpadding="3">
184 <tr>
185 <td colspan="1" bgcolor="#eecfa1" align="center">
186 <center>
Daniel Veillard594cf0b2001-10-25 08:09:12 +0000187 <b>Related links</b>
188 </center>
189 </td>
190 </tr>
191 <tr>
192 <td bgcolor="#fffacd">
193 <xsl:copy-of select="$related"/>
194 </td>
195 </tr>
196 </table>
Daniel Veillardc9484202001-10-24 12:35:52 +0000197 </td>
198 </tr>
199 </table>
200 </xsl:template>
201 <xsl:template mode="head" match="title">
202 <title>
203 <xsl:apply-templates/>
204 </title>
205 </xsl:template>
206 <xsl:template mode="head" match="meta">
207</xsl:template>
208<!--
209 - Write the styles in the head
210 -->
211 <xsl:template name="style">
212 <style type="text/css"><xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
Daniel Veillard2c748c62002-01-16 15:37:50 +0000213TD {font-size: 14pt; font-family: Verdana,Arial,Helvetica}
214BODY {font-size: 14pt; font-family: Verdana,Arial,Helvetica; margin-top: 2em; margin-left: 0em; margin-right: 0em}
215H1 {font-size: 20pt; font-family: Verdana,Arial,Helvetica}
216H2 {font-size: 18pt; font-family: Verdana,Arial,Helvetica}
217H3 {font-size: 16pt; font-family: Verdana,Arial,Helvetica}
Daniel Veillardb8cfbd12001-10-25 10:53:28 +0000218A:link, A:visited, A:active { text-decoration: underline }
Daniel Veillardc9484202001-10-24 12:35:52 +0000219<xsl:text disable-output-escaping="yes">--&gt;</xsl:text></style>
220 </xsl:template>
221<!--
222 - Write the title box on top
223 -->
224 <xsl:template name="titlebox">
225 <xsl:param name="title" select="'Main Page'"/>
226 <table border="0" width="100%" cellpadding="5" cellspacing="0" align="center">
227 <tr>
228 <td width="180">
229 <a href="http://www.gnome.org/"><img src="smallfootonly.gif" alt="Gnome Logo"/></a>
230 <a href="http://www.w3.org/Status"><img src="w3c.png" alt="W3C Logo"/></a>
231 <a href="http://www.redhat.com/"><img src="redhat.gif" alt="Red Hat Logo"/></a>
232 </td>
233 <td>
234 <table border="0" width="90%" cellpadding="2" cellspacing="0" align="center" bgcolor="#000000">
235 <tr>
236 <td>
237 <table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#fffacd">
238 <tr>
239 <td align="center">
240 <xsl:element name="h1">
241 <xsl:value-of select="$globaltitle"/>
242 </xsl:element>
243 <xsl:element name="h2">
244 <xsl:value-of select="$title"/>
245 </xsl:element>
246 </td>
247 </tr>
248 </table>
249 </td>
250 </tr>
251 </table>
252 </td>
253 </tr>
254 </table>
255 </xsl:template>
256<!--
Daniel Veillardc9484202001-10-24 12:35:52 +0000257 - Handling of nodes in the body before the first H2, table of content
258 - Everything is just copied over, except href which may get rewritten
259 - and h1/h2/a at the top level
260 -->
261 <xsl:template priority="2" mode="subcontent" match="a">
262 <xsl:variable name="filename">
263 <xsl:call-template name="filename">
264 <xsl:with-param name="name" select="string(@href)"/>
265 </xsl:call-template>
266 </xsl:variable>
267 <xsl:copy>
268 <xsl:attribute name="href">
269 <xsl:value-of select="$filename"/>
270 </xsl:attribute>
271 <xsl:apply-templates mode="subcontent" select="node()"/>
272 </xsl:copy>
273 </xsl:template>
274 <xsl:template mode="subcontent" match="@*|node()">
275 <xsl:copy>
276 <xsl:apply-templates mode="subcontent" select="@*|node()"/>
277 </xsl:copy>
278 </xsl:template>
279 <xsl:template mode="content" match="@*|node()">
280 <xsl:if test="name() != 'h1' and name() != 'h2'">
281 <xsl:copy>
282 <xsl:apply-templates mode="subcontent" select="@*|node()"/>
283 </xsl:copy>
284 </xsl:if>
285 </xsl:template>
286<!--
287 - Handling of nodes in the body after an H2
288 - Open a new file and dump all the siblings up to the next H2
289 -->
290 <xsl:template name="subfile">
291 <xsl:param name="header" select="following-sibling::h2[1]"/>
292 <xsl:variable name="filename">
293 <xsl:call-template name="filename">
294 <xsl:with-param name="name" select="concat('#', string($header/a[1]/@name))"/>
295 </xsl:call-template>
296 </xsl:variable>
297 <xsl:variable name="title">
298 <xsl:value-of select="$header"/>
299 </xsl:variable>
300 <xsl:document href="{$filename}" method="html" version="4.01" encoding="ISO-8859-1">
301 <html>
302 <head>
303 <xsl:call-template name="style"/>
304 <xsl:element name="title">
305 <xsl:value-of select="$title"/>
306 </xsl:element>
307 </head>
308 <body bgcolor="#8b7765" text="#000000" link="#000000" vlink="#000000">
309 <xsl:call-template name="titlebox">
310 <xsl:with-param name="title" select="$title"/>
311 </xsl:call-template>
312 <table border="0" cellpadding="4" cellspacing="0" width="100%" align="center">
313 <tr>
314 <td bgcolor="#8b7765">
315 <table border="0" cellspacing="0" cellpadding="2" width="100%">
316 <tr>
317 <td valign="top" width="200" bgcolor="#8b7765">
318 <xsl:call-template name="toc"/>
319 </td>
320 <td valign="top" bgcolor="#8b7765">
321 <table border="0" cellspacing="0" cellpadding="1" width="100%">
322 <tr>
323 <td>
324 <table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000">
325 <tr>
326 <td>
327 <table border="0" cellpadding="3" cellspacing="1" width="100%">
328 <tr>
329 <td bgcolor="#fffacd">
330 <xsl:apply-templates mode="subfile" select="$header/following-sibling::*[preceding-sibling::h2[1] = $header and name() != 'h2' ]"/>
Daniel Veillard3f4c40f2002-02-13 09:19:28 +0000331 <p><a href="bugs.html">Daniel Veillard</a></p>
Daniel Veillardc9484202001-10-24 12:35:52 +0000332 </td>
333 </tr>
334 </table>
335 </td>
336 </tr>
337 </table>
338 </td>
339 </tr>
340 </table>
341 </td>
342 </tr>
343 </table>
344 </td>
345 </tr>
346 </table>
347 </body>
348 </html>
349 </xsl:document>
350 </xsl:template>
351 <xsl:template mode="subfile" match="@*|node()">
352 <xsl:copy>
353 <xsl:apply-templates mode="content" select="@*|node()"/>
354 </xsl:copy>
355 </xsl:template>
356<!--
357 - Handling of the initial body and head HTML document
358 -->
359 <xsl:template match="body">
360 <xsl:variable name="firsth2" select="./h2[1]"/>
361 <xsl:variable name="rest2" select="./h2[position()&gt;1]"/>
362 <body bgcolor="#8b7765" text="#000000" link="#000000" vlink="#000000">
363 <xsl:call-template name="titlebox">
364 <xsl:with-param name="title" select="'libxml'"/>
365 </xsl:call-template>
366 <table border="0" cellpadding="4" cellspacing="0" width="100%" align="center">
367 <tr>
368 <td bgcolor="#8b7765">
369 <table border="0" cellspacing="0" cellpadding="2" width="100%">
370 <tr>
371 <td valign="top" width="200" bgcolor="#8b7765">
372 <xsl:call-template name="toc"/>
373 </td>
374 <td valign="top" bgcolor="#8b7765">
375 <table border="0" cellspacing="0" cellpadding="1" width="100%">
376 <tr>
377 <td>
378 <table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000">
379 <tr>
380 <td>
381 <table border="0" cellpadding="3" cellspacing="1" width="100%">
382 <tr>
383 <td bgcolor="#fffacd">
384 <xsl:apply-templates mode="content" select="($firsth2/preceding-sibling::*)"/>
385 <xsl:for-each select="./h2">
386 <xsl:call-template name="subfile">
387 <xsl:with-param name="header" select="."/>
388 </xsl:call-template>
389 </xsl:for-each>
Daniel Veillard3f4c40f2002-02-13 09:19:28 +0000390 <p><a href="bugs.html">Daniel Veillard</a></p>
Daniel Veillardc9484202001-10-24 12:35:52 +0000391 </td>
392 </tr>
393 </table>
394 </td>
395 </tr>
396 </table>
397 </td>
398 </tr>
399 </table>
400 </td>
401 </tr>
402 </table>
403 </td>
404 </tr>
405 </table>
406 </body>
407 </xsl:template>
408 <xsl:template match="head">
409 <head>
410 <xsl:call-template name="style"/>
411 <xsl:apply-templates mode="head"/>
412 </head>
413 </xsl:template>
414 <xsl:template match="html">
Daniel Veillard3bf65be2002-01-23 12:36:34 +0000415 <xsl:message>Generating the Web pages</xsl:message>
Daniel Veillardc9484202001-10-24 12:35:52 +0000416 <html>
417 <xsl:apply-templates/>
418 </html>
419 </xsl:template>
420</xsl:stylesheet>