blob: 3e263c03eb03e3f8556330dae110351bc370795a [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>
Daniel Veillard6dbcaf82002-02-20 14:37:47 +000095 <xsl:when test="$name = '#Python'">
96 <xsl:text>python.html</xsl:text>
97 </xsl:when>
Daniel Veillardb8cfbd12001-10-25 10:53:28 +000098 <xsl:when test="$name = ''">
99 <xsl:text>unknown.html</xsl:text>
100 </xsl:when>
101 <xsl:otherwise>
102 <xsl:value-of select="$name"/>
103 </xsl:otherwise>
104 </xsl:choose>
105 </xsl:template>
Daniel Veillardc9484202001-10-24 12:35:52 +0000106<!--
107 - The global title
108 -->
Daniel Veillardc9484202001-10-24 12:35:52 +0000109 <xsl:variable name="globaltitle" select="string(/html/body/h1[1])"/>
110<!--
111 - The table of content
112 -->
113 <xsl:variable name="toc">
Daniel Veillard8acca112002-01-21 09:52:27 +0000114 <ul><!-- style="margin-left: -1em" -->
Daniel Veillardc9484202001-10-24 12:35:52 +0000115 <li><a href="index.html">Home</a></li>
Daniel Veillardc9484202001-10-24 12:35:52 +0000116 <xsl:for-each select="/html/body/h2">
117 <xsl:variable name="filename">
118 <xsl:call-template name="filename">
119 <xsl:with-param name="name" select="concat('#', string(a[1]/@name))"/>
120 </xsl:call-template>
121 </xsl:variable>
122 <li>
123 <xsl:element name="a">
124 <xsl:attribute name="href">
125 <xsl:value-of select="$filename"/>
126 </xsl:attribute>
127 <xsl:value-of select="."/>
128 </xsl:element>
129 </li>
130 </xsl:for-each>
Daniel Veillardfc59c092002-06-05 14:48:26 +0000131 <li><a href="tutorial/index.html">Tutorial</a></li>
Daniel Veillard594cf0b2001-10-25 08:09:12 +0000132 <li><a href="xml.html">flat page</a>, <a href="site.xsl">stylesheet</a></li>
133 </ul>
134 </xsl:variable>
Daniel Veillard3bf65be2002-01-23 12:36:34 +0000135 <xsl:variable name="api">
136 <ul><!-- style="margin-left: -1em" -->
Daniel Veillardf8592562002-01-23 17:58:17 +0000137 <li><a href="APIchunk0.html">Alphabetic</a></li>
Daniel Veillard3bf65be2002-01-23 12:36:34 +0000138 <li><a href="APIconstructors.html">Constructors</a></li>
139 <li><a href="APIfunctions.html">Functions/Types</a></li>
140 <li><a href="APIfiles.html">Modules</a></li>
141 <li><a href="APIsymbols.html">Symbols</a></li>
142 </ul>
143 </xsl:variable>
Daniel Veillard594cf0b2001-10-25 08:09:12 +0000144 <xsl:variable name="related">
Daniel Veillard8acca112002-01-21 09:52:27 +0000145 <ul><!-- style="margin-left: -1em" -->
Daniel Veillard594cf0b2001-10-25 08:09:12 +0000146 <li><a href="http://mail.gnome.org/archives/xml/">Mail archive</a></li>
147 <li><a href="http://xmlsoft.org/XSLT/">XSLT libxslt</a></li>
Daniel Veillard4a859202002-01-08 11:49:22 +0000148 <li><a href="http://phd.cs.unibo.it/gdome2/">DOM gdome2</a></li>
Daniel Veillard2d347fa2002-03-17 10:34:11 +0000149 <li><a href="http://www.aleksey.com/xmlsec/">XML-DSig xmlsec</a></li>
Daniel Veillard594cf0b2001-10-25 08:09:12 +0000150 <li><a href="ftp://xmlsoft.org/">FTP</a></li>
151 <li><a href="http://www.fh-frankfurt.de/~igor/projects/libxml/">Windows binaries</a></li>
Daniel Veillarddb9dfd92001-11-26 17:25:02 +0000152 <li><a href="http://garypennington.net/libxml2/">Solaris binaries</a></li>
Daniel Veillardcb7543b2002-09-09 10:54:06 +0000153 <li><a href="http://www.zveno.com/open_source/libxml2xslt.html">MacOsX binaries</a></li>
Daniel Veillarde6d8e202002-05-02 06:11:10 +0000154 <li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li>
Daniel Veillard2d347fa2002-03-17 10:34:11 +0000155 <li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxml&amp;product=libxml2">Bug Tracker</a></li>
Daniel Veillardc9484202001-10-24 12:35:52 +0000156 </ul>
157 </xsl:variable>
158 <xsl:template name="toc">
159 <table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000">
160 <tr>
161 <td>
162 <table width="100%" border="0" cellspacing="1" cellpadding="3">
163 <tr>
164 <td colspan="1" bgcolor="#eecfa1" align="center">
165 <center>
166 <b>Main Menu</b>
167 </center>
168 </td>
169 </tr>
170 <tr>
171 <td bgcolor="#fffacd">
172 <xsl:copy-of select="$toc"/>
173 </td>
174 </tr>
175 </table>
Daniel Veillard594cf0b2001-10-25 08:09:12 +0000176 <table width="100%" border="0" cellspacing="1" cellpadding="3">
177 <tr>
178 <td colspan="1" bgcolor="#eecfa1" align="center">
179 <center>
Daniel Veillard3bf65be2002-01-23 12:36:34 +0000180 <b>API Indexes</b>
181 </center>
182 </td>
183 </tr>
184 <tr>
185 <td bgcolor="#fffacd">
186 <xsl:copy-of select="$api"/>
187 </td>
188 </tr>
189 </table>
190 <table width="100%" border="0" cellspacing="1" cellpadding="3">
191 <tr>
192 <td colspan="1" bgcolor="#eecfa1" align="center">
193 <center>
Daniel Veillard594cf0b2001-10-25 08:09:12 +0000194 <b>Related links</b>
195 </center>
196 </td>
197 </tr>
198 <tr>
199 <td bgcolor="#fffacd">
200 <xsl:copy-of select="$related"/>
201 </td>
202 </tr>
203 </table>
Daniel Veillardc9484202001-10-24 12:35:52 +0000204 </td>
205 </tr>
206 </table>
207 </xsl:template>
208 <xsl:template mode="head" match="title">
209 <title>
210 <xsl:apply-templates/>
211 </title>
212 </xsl:template>
213 <xsl:template mode="head" match="meta">
214</xsl:template>
215<!--
216 - Write the styles in the head
217 -->
218 <xsl:template name="style">
Daniel Veillardc332dab2002-03-29 14:08:27 +0000219 <link rel="SHORTCUT ICON" href="/favicon.ico"/>
Daniel Veillardc9484202001-10-24 12:35:52 +0000220 <style type="text/css"><xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
Daniel Veillard373a4752002-02-21 14:46:29 +0000221TD {font-family: Verdana,Arial,Helvetica}
222BODY {font-family: Verdana,Arial,Helvetica; margin-top: 2em; margin-left: 0em; margin-right: 0em}
223H1 {font-family: Verdana,Arial,Helvetica}
224H2 {font-family: Verdana,Arial,Helvetica}
225H3 {font-family: Verdana,Arial,Helvetica}
Daniel Veillardb8cfbd12001-10-25 10:53:28 +0000226A:link, A:visited, A:active { text-decoration: underline }
Daniel Veillardc9484202001-10-24 12:35:52 +0000227<xsl:text disable-output-escaping="yes">--&gt;</xsl:text></style>
228 </xsl:template>
229<!--
230 - Write the title box on top
231 -->
232 <xsl:template name="titlebox">
233 <xsl:param name="title" select="'Main Page'"/>
234 <table border="0" width="100%" cellpadding="5" cellspacing="0" align="center">
235 <tr>
236 <td width="180">
Daniel Veillard8f40f1e2002-08-28 21:18:45 +0000237 <a href="http://www.gnome.org/"><img src="gnome2.png" alt="Gnome2 Logo"/></a>
Daniel Veillardc9484202001-10-24 12:35:52 +0000238 <a href="http://www.w3.org/Status"><img src="w3c.png" alt="W3C Logo"/></a>
239 <a href="http://www.redhat.com/"><img src="redhat.gif" alt="Red Hat Logo"/></a>
Daniel Veillarde1662542002-08-28 11:50:59 +0000240 <div align="left">
241 <a href="http://xmlsoft.org/"><img src="Libxml2-Logo-180x168.gif" alt="Made with Libxml2 Logo"/></a>
242 </div>
Daniel Veillardc9484202001-10-24 12:35:52 +0000243 </td>
244 <td>
245 <table border="0" width="90%" cellpadding="2" cellspacing="0" align="center" bgcolor="#000000">
246 <tr>
247 <td>
248 <table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#fffacd">
249 <tr>
250 <td align="center">
251 <xsl:element name="h1">
252 <xsl:value-of select="$globaltitle"/>
253 </xsl:element>
254 <xsl:element name="h2">
255 <xsl:value-of select="$title"/>
256 </xsl:element>
257 </td>
258 </tr>
259 </table>
260 </td>
261 </tr>
262 </table>
263 </td>
264 </tr>
265 </table>
266 </xsl:template>
267<!--
Daniel Veillardc9484202001-10-24 12:35:52 +0000268 - Handling of nodes in the body before the first H2, table of content
269 - Everything is just copied over, except href which may get rewritten
270 - and h1/h2/a at the top level
271 -->
272 <xsl:template priority="2" mode="subcontent" match="a">
273 <xsl:variable name="filename">
274 <xsl:call-template name="filename">
275 <xsl:with-param name="name" select="string(@href)"/>
276 </xsl:call-template>
277 </xsl:variable>
278 <xsl:copy>
279 <xsl:attribute name="href">
280 <xsl:value-of select="$filename"/>
281 </xsl:attribute>
282 <xsl:apply-templates mode="subcontent" select="node()"/>
283 </xsl:copy>
284 </xsl:template>
285 <xsl:template mode="subcontent" match="@*|node()">
286 <xsl:copy>
287 <xsl:apply-templates mode="subcontent" select="@*|node()"/>
288 </xsl:copy>
289 </xsl:template>
290 <xsl:template mode="content" match="@*|node()">
291 <xsl:if test="name() != 'h1' and name() != 'h2'">
292 <xsl:copy>
293 <xsl:apply-templates mode="subcontent" select="@*|node()"/>
294 </xsl:copy>
295 </xsl:if>
296 </xsl:template>
297<!--
298 - Handling of nodes in the body after an H2
299 - Open a new file and dump all the siblings up to the next H2
300 -->
301 <xsl:template name="subfile">
302 <xsl:param name="header" select="following-sibling::h2[1]"/>
303 <xsl:variable name="filename">
304 <xsl:call-template name="filename">
305 <xsl:with-param name="name" select="concat('#', string($header/a[1]/@name))"/>
306 </xsl:call-template>
307 </xsl:variable>
308 <xsl:variable name="title">
309 <xsl:value-of select="$header"/>
310 </xsl:variable>
311 <xsl:document href="{$filename}" method="html" version="4.01" encoding="ISO-8859-1">
312 <html>
313 <head>
314 <xsl:call-template name="style"/>
315 <xsl:element name="title">
316 <xsl:value-of select="$title"/>
317 </xsl:element>
318 </head>
319 <body bgcolor="#8b7765" text="#000000" link="#000000" vlink="#000000">
320 <xsl:call-template name="titlebox">
321 <xsl:with-param name="title" select="$title"/>
322 </xsl:call-template>
323 <table border="0" cellpadding="4" cellspacing="0" width="100%" align="center">
324 <tr>
325 <td bgcolor="#8b7765">
326 <table border="0" cellspacing="0" cellpadding="2" width="100%">
327 <tr>
328 <td valign="top" width="200" bgcolor="#8b7765">
329 <xsl:call-template name="toc"/>
330 </td>
331 <td valign="top" bgcolor="#8b7765">
332 <table border="0" cellspacing="0" cellpadding="1" width="100%">
333 <tr>
334 <td>
335 <table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000">
336 <tr>
337 <td>
338 <table border="0" cellpadding="3" cellspacing="1" width="100%">
339 <tr>
340 <td bgcolor="#fffacd">
341 <xsl:apply-templates mode="subfile" select="$header/following-sibling::*[preceding-sibling::h2[1] = $header and name() != 'h2' ]"/>
Daniel Veillard3f4c40f2002-02-13 09:19:28 +0000342 <p><a href="bugs.html">Daniel Veillard</a></p>
Daniel Veillardc9484202001-10-24 12:35:52 +0000343 </td>
344 </tr>
345 </table>
346 </td>
347 </tr>
348 </table>
349 </td>
350 </tr>
351 </table>
352 </td>
353 </tr>
354 </table>
355 </td>
356 </tr>
357 </table>
358 </body>
359 </html>
360 </xsl:document>
361 </xsl:template>
362 <xsl:template mode="subfile" match="@*|node()">
363 <xsl:copy>
364 <xsl:apply-templates mode="content" select="@*|node()"/>
365 </xsl:copy>
366 </xsl:template>
367<!--
368 - Handling of the initial body and head HTML document
369 -->
370 <xsl:template match="body">
371 <xsl:variable name="firsth2" select="./h2[1]"/>
372 <xsl:variable name="rest2" select="./h2[position()&gt;1]"/>
373 <body bgcolor="#8b7765" text="#000000" link="#000000" vlink="#000000">
374 <xsl:call-template name="titlebox">
375 <xsl:with-param name="title" select="'libxml'"/>
376 </xsl:call-template>
377 <table border="0" cellpadding="4" cellspacing="0" width="100%" align="center">
378 <tr>
379 <td bgcolor="#8b7765">
380 <table border="0" cellspacing="0" cellpadding="2" width="100%">
381 <tr>
382 <td valign="top" width="200" bgcolor="#8b7765">
383 <xsl:call-template name="toc"/>
384 </td>
385 <td valign="top" bgcolor="#8b7765">
386 <table border="0" cellspacing="0" cellpadding="1" width="100%">
387 <tr>
388 <td>
389 <table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000">
390 <tr>
391 <td>
392 <table border="0" cellpadding="3" cellspacing="1" width="100%">
393 <tr>
394 <td bgcolor="#fffacd">
395 <xsl:apply-templates mode="content" select="($firsth2/preceding-sibling::*)"/>
396 <xsl:for-each select="./h2">
397 <xsl:call-template name="subfile">
398 <xsl:with-param name="header" select="."/>
399 </xsl:call-template>
400 </xsl:for-each>
Daniel Veillard3f4c40f2002-02-13 09:19:28 +0000401 <p><a href="bugs.html">Daniel Veillard</a></p>
Daniel Veillardc9484202001-10-24 12:35:52 +0000402 </td>
403 </tr>
404 </table>
405 </td>
406 </tr>
407 </table>
408 </td>
409 </tr>
410 </table>
411 </td>
412 </tr>
413 </table>
414 </td>
415 </tr>
416 </table>
417 </body>
418 </xsl:template>
419 <xsl:template match="head">
420 <head>
421 <xsl:call-template name="style"/>
422 <xsl:apply-templates mode="head"/>
423 </head>
424 </xsl:template>
425 <xsl:template match="html">
Daniel Veillard3bf65be2002-01-23 12:36:34 +0000426 <xsl:message>Generating the Web pages</xsl:message>
Daniel Veillardc9484202001-10-24 12:35:52 +0000427 <html>
428 <xsl:apply-templates/>
429 </html>
430 </xsl:template>
431</xsl:stylesheet>