blob: aa58934770017387e9d703f1a1ef41aa4324bbe0 [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"/>
4<!--
5 - returns the filename associated to an ID in the original file
6 -->
7 <xsl:template name="filename">
8 <xsl:param name="name" select="string(@href)"/>
9 <xsl:choose>
10 <xsl:when test="$name = '#Introducti'">
11 <xsl:text>intro.html</xsl:text>
12 </xsl:when>
13 <xsl:when test="$name = '#Documentat'">
14 <xsl:text>docs.html</xsl:text>
15 </xsl:when>
16 <xsl:when test="$name = '#Reporting'">
17 <xsl:text>bugs.html</xsl:text>
18 </xsl:when>
19 <xsl:when test="$name = '#help'">
20 <xsl:text>help.html</xsl:text>
21 </xsl:when>
22 <xsl:when test="$name = '#Help'">
23 <xsl:text>help.html</xsl:text>
24 </xsl:when>
25 <xsl:when test="$name = '#Downloads'">
26 <xsl:text>downloads.html</xsl:text>
27 </xsl:when>
28 <xsl:when test="$name = '#News'">
29 <xsl:text>news.html</xsl:text>
30 </xsl:when>
31 <xsl:when test="$name = '#Contributi'">
32 <xsl:text>contribs.html</xsl:text>
33 </xsl:when>
34 <xsl:when test="$name = '#xsltproc'">
35 <xsl:text>xsltproc2.html</xsl:text>
36 </xsl:when>
37 <xsl:when test="$name = '#API'">
38 <xsl:text>API.html</xsl:text>
39 </xsl:when>
40 <xsl:when test="$name = '#XSLT'">
41 <xsl:text>XSLT.html</xsl:text>
42 </xsl:when>
43 <xsl:when test="$name = '#XML'">
44 <xsl:text>XML.html</xsl:text>
45 </xsl:when>
46 <xsl:when test="$name = '#Validation'">
47 <xsl:text>xmldtd.html</xsl:text>
48 </xsl:when>
49 <xsl:when test="$name = '#tree'">
50 <xsl:text>tree.html</xsl:text>
51 </xsl:when>
52 <xsl:when test="$name = '#library'">
53 <xsl:text>library.html</xsl:text>
54 </xsl:when>
55 <xsl:when test="$name = '#interface'">
56 <xsl:text>interface.html</xsl:text>
57 </xsl:when>
58 <xsl:when test="$name = '#Example'">
59 <xsl:text>example.html</xsl:text>
60 </xsl:when>
61 <xsl:when test="$name = '#Entities'">
62 <xsl:text>entities.html</xsl:text>
63 </xsl:when>
64 <xsl:when test="$name = '#architecture'">
65 <xsl:text>architecture.html</xsl:text>
66 </xsl:when>
67 <xsl:when test="$name = '#Namespaces'">
68 <xsl:text>namespaces.html</xsl:text>
69 </xsl:when>
70 <xsl:when test="$name = '#DOM'">
71 <xsl:text>DOM.html</xsl:text>
72 </xsl:when>
73 <xsl:when test="$name = '#Catalog'">
74 <xsl:text>catalog.html</xsl:text>
75 </xsl:when>
76 <xsl:when test="$name = '#Upgrading'">
77 <xsl:text>upgrade.html</xsl:text>
78 </xsl:when>
79 <xsl:when test="$name = '#Encodings'">
80 <xsl:text>encoding.html</xsl:text>
81 </xsl:when>
82 <xsl:when test="$name = '#IO'">
83 <xsl:text>xmlio.html</xsl:text>
84 </xsl:when>
85 <xsl:when test="$name = '#Memory'">
86 <xsl:text>xmlmem.html</xsl:text>
87 </xsl:when>
88 <xsl:when test="$name = '#FAQ'">
89 <xsl:text>FAQ.html</xsl:text>
90 </xsl:when>
91 <xsl:when test="$name = ''">
92 <xsl:text>unknown.html</xsl:text>
93 </xsl:when>
94 <xsl:otherwise>
95 <xsl:value-of select="$name"/>
96 </xsl:otherwise>
97 </xsl:choose>
98 </xsl:template>
Daniel Veillardc9484202001-10-24 12:35:52 +000099<!--
100 - The global title
101 -->
Daniel Veillardc9484202001-10-24 12:35:52 +0000102 <xsl:variable name="globaltitle" select="string(/html/body/h1[1])"/>
103<!--
104 - The table of content
105 -->
106 <xsl:variable name="toc">
107 <ul style="margin-left: -2pt">
108 <li><a href="index.html">Home</a></li>
Daniel Veillardc9484202001-10-24 12:35:52 +0000109 <xsl:for-each select="/html/body/h2">
110 <xsl:variable name="filename">
111 <xsl:call-template name="filename">
112 <xsl:with-param name="name" select="concat('#', string(a[1]/@name))"/>
113 </xsl:call-template>
114 </xsl:variable>
115 <li>
116 <xsl:element name="a">
117 <xsl:attribute name="href">
118 <xsl:value-of select="$filename"/>
119 </xsl:attribute>
120 <xsl:value-of select="."/>
121 </xsl:element>
122 </li>
123 </xsl:for-each>
Daniel Veillard594cf0b2001-10-25 08:09:12 +0000124 <li><a href="xml.html">flat page</a>, <a href="site.xsl">stylesheet</a></li>
125 </ul>
126 </xsl:variable>
127 <xsl:variable name="related">
128 <ul style="margin-left: -2pt">
129 <li><a href="http://mail.gnome.org/archives/xml/">Mail archive</a></li>
130 <li><a href="http://xmlsoft.org/XSLT/">XSLT libxslt</a></li>
131 <li><a href="http://www.cs.unibo.it/~casarini/gdome2/">DOM gdome2</a></li>
132 <li><a href="ftp://xmlsoft.org/">FTP</a></li>
133 <li><a href="http://www.fh-frankfurt.de/~igor/projects/libxml/">Windows binaries</a></li>
134 <li><a href="http://pages.eidosnet.co.uk/~garypen/libxml/">Solaris binaries</a></li>
Daniel Veillardc6271d22001-10-27 07:50:58 +0000135 <li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxml">Bug Tracker</a></li>
Daniel Veillardc9484202001-10-24 12:35:52 +0000136 </ul>
137 </xsl:variable>
138 <xsl:template name="toc">
139 <table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000">
140 <tr>
141 <td>
142 <table width="100%" border="0" cellspacing="1" cellpadding="3">
143 <tr>
144 <td colspan="1" bgcolor="#eecfa1" align="center">
145 <center>
146 <b>Main Menu</b>
147 </center>
148 </td>
149 </tr>
150 <tr>
151 <td bgcolor="#fffacd">
152 <xsl:copy-of select="$toc"/>
153 </td>
154 </tr>
155 </table>
Daniel Veillard594cf0b2001-10-25 08:09:12 +0000156 <table width="100%" border="0" cellspacing="1" cellpadding="3">
157 <tr>
158 <td colspan="1" bgcolor="#eecfa1" align="center">
159 <center>
160 <b>Related links</b>
161 </center>
162 </td>
163 </tr>
164 <tr>
165 <td bgcolor="#fffacd">
166 <xsl:copy-of select="$related"/>
167 </td>
168 </tr>
169 </table>
Daniel Veillardc9484202001-10-24 12:35:52 +0000170 </td>
171 </tr>
172 </table>
173 </xsl:template>
174 <xsl:template mode="head" match="title">
175 <title>
176 <xsl:apply-templates/>
177 </title>
178 </xsl:template>
179 <xsl:template mode="head" match="meta">
180</xsl:template>
181<!--
182 - Write the styles in the head
183 -->
184 <xsl:template name="style">
185 <style type="text/css"><xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
186TD {font-size: 10pt; font-family: Verdana,Arial,Helvetica}
187BODY {font-size: 10pt; font-family: Verdana,Arial,Helvetica; margin-top: 5pt; margin-left: 0pt; margin-right: 0pt}
188H1 {font-size: 16pt; font-family: Verdana,Arial,Helvetica}
189H2 {font-size: 14pt; font-family: Verdana,Arial,Helvetica}
190H3 {font-size: 12pt; font-family: Verdana,Arial,Helvetica}
Daniel Veillardb8cfbd12001-10-25 10:53:28 +0000191A:link, A:visited, A:active { text-decoration: underline }
Daniel Veillardc9484202001-10-24 12:35:52 +0000192<xsl:text disable-output-escaping="yes">--&gt;</xsl:text></style>
193 </xsl:template>
194<!--
195 - Write the title box on top
196 -->
197 <xsl:template name="titlebox">
198 <xsl:param name="title" select="'Main Page'"/>
199 <table border="0" width="100%" cellpadding="5" cellspacing="0" align="center">
200 <tr>
201 <td width="180">
202 <a href="http://www.gnome.org/"><img src="smallfootonly.gif" alt="Gnome Logo"/></a>
203 <a href="http://www.w3.org/Status"><img src="w3c.png" alt="W3C Logo"/></a>
204 <a href="http://www.redhat.com/"><img src="redhat.gif" alt="Red Hat Logo"/></a>
205 </td>
206 <td>
207 <table border="0" width="90%" cellpadding="2" cellspacing="0" align="center" bgcolor="#000000">
208 <tr>
209 <td>
210 <table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#fffacd">
211 <tr>
212 <td align="center">
213 <xsl:element name="h1">
214 <xsl:value-of select="$globaltitle"/>
215 </xsl:element>
216 <xsl:element name="h2">
217 <xsl:value-of select="$title"/>
218 </xsl:element>
219 </td>
220 </tr>
221 </table>
222 </td>
223 </tr>
224 </table>
225 </td>
226 </tr>
227 </table>
228 </xsl:template>
229<!--
Daniel Veillardc9484202001-10-24 12:35:52 +0000230 - Handling of nodes in the body before the first H2, table of content
231 - Everything is just copied over, except href which may get rewritten
232 - and h1/h2/a at the top level
233 -->
234 <xsl:template priority="2" mode="subcontent" match="a">
235 <xsl:variable name="filename">
236 <xsl:call-template name="filename">
237 <xsl:with-param name="name" select="string(@href)"/>
238 </xsl:call-template>
239 </xsl:variable>
240 <xsl:copy>
241 <xsl:attribute name="href">
242 <xsl:value-of select="$filename"/>
243 </xsl:attribute>
244 <xsl:apply-templates mode="subcontent" select="node()"/>
245 </xsl:copy>
246 </xsl:template>
247 <xsl:template mode="subcontent" match="@*|node()">
248 <xsl:copy>
249 <xsl:apply-templates mode="subcontent" select="@*|node()"/>
250 </xsl:copy>
251 </xsl:template>
252 <xsl:template mode="content" match="@*|node()">
253 <xsl:if test="name() != 'h1' and name() != 'h2'">
254 <xsl:copy>
255 <xsl:apply-templates mode="subcontent" select="@*|node()"/>
256 </xsl:copy>
257 </xsl:if>
258 </xsl:template>
259<!--
260 - Handling of nodes in the body after an H2
261 - Open a new file and dump all the siblings up to the next H2
262 -->
263 <xsl:template name="subfile">
264 <xsl:param name="header" select="following-sibling::h2[1]"/>
265 <xsl:variable name="filename">
266 <xsl:call-template name="filename">
267 <xsl:with-param name="name" select="concat('#', string($header/a[1]/@name))"/>
268 </xsl:call-template>
269 </xsl:variable>
270 <xsl:variable name="title">
271 <xsl:value-of select="$header"/>
272 </xsl:variable>
273 <xsl:document href="{$filename}" method="html" version="4.01" encoding="ISO-8859-1">
274 <html>
275 <head>
276 <xsl:call-template name="style"/>
277 <xsl:element name="title">
278 <xsl:value-of select="$title"/>
279 </xsl:element>
280 </head>
281 <body bgcolor="#8b7765" text="#000000" link="#000000" vlink="#000000">
282 <xsl:call-template name="titlebox">
283 <xsl:with-param name="title" select="$title"/>
284 </xsl:call-template>
285 <table border="0" cellpadding="4" cellspacing="0" width="100%" align="center">
286 <tr>
287 <td bgcolor="#8b7765">
288 <table border="0" cellspacing="0" cellpadding="2" width="100%">
289 <tr>
290 <td valign="top" width="200" bgcolor="#8b7765">
291 <xsl:call-template name="toc"/>
292 </td>
293 <td valign="top" bgcolor="#8b7765">
294 <table border="0" cellspacing="0" cellpadding="1" width="100%">
295 <tr>
296 <td>
297 <table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000">
298 <tr>
299 <td>
300 <table border="0" cellpadding="3" cellspacing="1" width="100%">
301 <tr>
302 <td bgcolor="#fffacd">
303 <xsl:apply-templates mode="subfile" select="$header/following-sibling::*[preceding-sibling::h2[1] = $header and name() != 'h2' ]"/>
304 <p><a href="mailto:daniel@veillard.com">Daniel Veillard</a></p>
305 </td>
306 </tr>
307 </table>
308 </td>
309 </tr>
310 </table>
311 </td>
312 </tr>
313 </table>
314 </td>
315 </tr>
316 </table>
317 </td>
318 </tr>
319 </table>
320 </body>
321 </html>
322 </xsl:document>
323 </xsl:template>
324 <xsl:template mode="subfile" match="@*|node()">
325 <xsl:copy>
326 <xsl:apply-templates mode="content" select="@*|node()"/>
327 </xsl:copy>
328 </xsl:template>
329<!--
330 - Handling of the initial body and head HTML document
331 -->
332 <xsl:template match="body">
333 <xsl:variable name="firsth2" select="./h2[1]"/>
334 <xsl:variable name="rest2" select="./h2[position()&gt;1]"/>
335 <body bgcolor="#8b7765" text="#000000" link="#000000" vlink="#000000">
336 <xsl:call-template name="titlebox">
337 <xsl:with-param name="title" select="'libxml'"/>
338 </xsl:call-template>
339 <table border="0" cellpadding="4" cellspacing="0" width="100%" align="center">
340 <tr>
341 <td bgcolor="#8b7765">
342 <table border="0" cellspacing="0" cellpadding="2" width="100%">
343 <tr>
344 <td valign="top" width="200" bgcolor="#8b7765">
345 <xsl:call-template name="toc"/>
346 </td>
347 <td valign="top" bgcolor="#8b7765">
348 <table border="0" cellspacing="0" cellpadding="1" width="100%">
349 <tr>
350 <td>
351 <table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000">
352 <tr>
353 <td>
354 <table border="0" cellpadding="3" cellspacing="1" width="100%">
355 <tr>
356 <td bgcolor="#fffacd">
357 <xsl:apply-templates mode="content" select="($firsth2/preceding-sibling::*)"/>
358 <xsl:for-each select="./h2">
359 <xsl:call-template name="subfile">
360 <xsl:with-param name="header" select="."/>
361 </xsl:call-template>
362 </xsl:for-each>
363 <p><a href="mailto:daniel@veillard.com">Daniel Veillard</a></p>
364 </td>
365 </tr>
366 </table>
367 </td>
368 </tr>
369 </table>
370 </td>
371 </tr>
372 </table>
373 </td>
374 </tr>
375 </table>
376 </td>
377 </tr>
378 </table>
379 </body>
380 </xsl:template>
381 <xsl:template match="head">
382 <head>
383 <xsl:call-template name="style"/>
384 <xsl:apply-templates mode="head"/>
385 </head>
386 </xsl:template>
387 <xsl:template match="html">
388 <html>
389 <xsl:apply-templates/>
390 </html>
391 </xsl:template>
392</xsl:stylesheet>