blob: 2d79464686936a2a6b113bb33bf4c23f26db6372 [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 Veillardc9484202001-10-24 12:35:52 +0000135 </ul>
136 </xsl:variable>
137 <xsl:template name="toc">
138 <table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000">
139 <tr>
140 <td>
141 <table width="100%" border="0" cellspacing="1" cellpadding="3">
142 <tr>
143 <td colspan="1" bgcolor="#eecfa1" align="center">
144 <center>
145 <b>Main Menu</b>
146 </center>
147 </td>
148 </tr>
149 <tr>
150 <td bgcolor="#fffacd">
151 <xsl:copy-of select="$toc"/>
152 </td>
153 </tr>
154 </table>
Daniel Veillard594cf0b2001-10-25 08:09:12 +0000155 <table width="100%" border="0" cellspacing="1" cellpadding="3">
156 <tr>
157 <td colspan="1" bgcolor="#eecfa1" align="center">
158 <center>
159 <b>Related links</b>
160 </center>
161 </td>
162 </tr>
163 <tr>
164 <td bgcolor="#fffacd">
165 <xsl:copy-of select="$related"/>
166 </td>
167 </tr>
168 </table>
Daniel Veillardc9484202001-10-24 12:35:52 +0000169 </td>
170 </tr>
171 </table>
172 </xsl:template>
173 <xsl:template mode="head" match="title">
174 <title>
175 <xsl:apply-templates/>
176 </title>
177 </xsl:template>
178 <xsl:template mode="head" match="meta">
179</xsl:template>
180<!--
181 - Write the styles in the head
182 -->
183 <xsl:template name="style">
184 <style type="text/css"><xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
185TD {font-size: 10pt; font-family: Verdana,Arial,Helvetica}
186BODY {font-size: 10pt; font-family: Verdana,Arial,Helvetica; margin-top: 5pt; margin-left: 0pt; margin-right: 0pt}
187H1 {font-size: 16pt; font-family: Verdana,Arial,Helvetica}
188H2 {font-size: 14pt; font-family: Verdana,Arial,Helvetica}
189H3 {font-size: 12pt; font-family: Verdana,Arial,Helvetica}
Daniel Veillardb8cfbd12001-10-25 10:53:28 +0000190A:link, A:visited, A:active { text-decoration: underline }
Daniel Veillardc9484202001-10-24 12:35:52 +0000191<xsl:text disable-output-escaping="yes">--&gt;</xsl:text></style>
192 </xsl:template>
193<!--
194 - Write the title box on top
195 -->
196 <xsl:template name="titlebox">
197 <xsl:param name="title" select="'Main Page'"/>
198 <table border="0" width="100%" cellpadding="5" cellspacing="0" align="center">
199 <tr>
200 <td width="180">
201 <a href="http://www.gnome.org/"><img src="smallfootonly.gif" alt="Gnome Logo"/></a>
202 <a href="http://www.w3.org/Status"><img src="w3c.png" alt="W3C Logo"/></a>
203 <a href="http://www.redhat.com/"><img src="redhat.gif" alt="Red Hat Logo"/></a>
204 </td>
205 <td>
206 <table border="0" width="90%" cellpadding="2" cellspacing="0" align="center" bgcolor="#000000">
207 <tr>
208 <td>
209 <table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#fffacd">
210 <tr>
211 <td align="center">
212 <xsl:element name="h1">
213 <xsl:value-of select="$globaltitle"/>
214 </xsl:element>
215 <xsl:element name="h2">
216 <xsl:value-of select="$title"/>
217 </xsl:element>
218 </td>
219 </tr>
220 </table>
221 </td>
222 </tr>
223 </table>
224 </td>
225 </tr>
226 </table>
227 </xsl:template>
228<!--
Daniel Veillardc9484202001-10-24 12:35:52 +0000229 - Handling of nodes in the body before the first H2, table of content
230 - Everything is just copied over, except href which may get rewritten
231 - and h1/h2/a at the top level
232 -->
233 <xsl:template priority="2" mode="subcontent" match="a">
234 <xsl:variable name="filename">
235 <xsl:call-template name="filename">
236 <xsl:with-param name="name" select="string(@href)"/>
237 </xsl:call-template>
238 </xsl:variable>
239 <xsl:copy>
240 <xsl:attribute name="href">
241 <xsl:value-of select="$filename"/>
242 </xsl:attribute>
243 <xsl:apply-templates mode="subcontent" select="node()"/>
244 </xsl:copy>
245 </xsl:template>
246 <xsl:template mode="subcontent" match="@*|node()">
247 <xsl:copy>
248 <xsl:apply-templates mode="subcontent" select="@*|node()"/>
249 </xsl:copy>
250 </xsl:template>
251 <xsl:template mode="content" match="@*|node()">
252 <xsl:if test="name() != 'h1' and name() != 'h2'">
253 <xsl:copy>
254 <xsl:apply-templates mode="subcontent" select="@*|node()"/>
255 </xsl:copy>
256 </xsl:if>
257 </xsl:template>
258<!--
259 - Handling of nodes in the body after an H2
260 - Open a new file and dump all the siblings up to the next H2
261 -->
262 <xsl:template name="subfile">
263 <xsl:param name="header" select="following-sibling::h2[1]"/>
264 <xsl:variable name="filename">
265 <xsl:call-template name="filename">
266 <xsl:with-param name="name" select="concat('#', string($header/a[1]/@name))"/>
267 </xsl:call-template>
268 </xsl:variable>
269 <xsl:variable name="title">
270 <xsl:value-of select="$header"/>
271 </xsl:variable>
272 <xsl:document href="{$filename}" method="html" version="4.01" encoding="ISO-8859-1">
273 <html>
274 <head>
275 <xsl:call-template name="style"/>
276 <xsl:element name="title">
277 <xsl:value-of select="$title"/>
278 </xsl:element>
279 </head>
280 <body bgcolor="#8b7765" text="#000000" link="#000000" vlink="#000000">
281 <xsl:call-template name="titlebox">
282 <xsl:with-param name="title" select="$title"/>
283 </xsl:call-template>
284 <table border="0" cellpadding="4" cellspacing="0" width="100%" align="center">
285 <tr>
286 <td bgcolor="#8b7765">
287 <table border="0" cellspacing="0" cellpadding="2" width="100%">
288 <tr>
289 <td valign="top" width="200" bgcolor="#8b7765">
290 <xsl:call-template name="toc"/>
291 </td>
292 <td valign="top" bgcolor="#8b7765">
293 <table border="0" cellspacing="0" cellpadding="1" width="100%">
294 <tr>
295 <td>
296 <table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000">
297 <tr>
298 <td>
299 <table border="0" cellpadding="3" cellspacing="1" width="100%">
300 <tr>
301 <td bgcolor="#fffacd">
302 <xsl:apply-templates mode="subfile" select="$header/following-sibling::*[preceding-sibling::h2[1] = $header and name() != 'h2' ]"/>
303 <p><a href="mailto:daniel@veillard.com">Daniel Veillard</a></p>
304 </td>
305 </tr>
306 </table>
307 </td>
308 </tr>
309 </table>
310 </td>
311 </tr>
312 </table>
313 </td>
314 </tr>
315 </table>
316 </td>
317 </tr>
318 </table>
319 </body>
320 </html>
321 </xsl:document>
322 </xsl:template>
323 <xsl:template mode="subfile" match="@*|node()">
324 <xsl:copy>
325 <xsl:apply-templates mode="content" select="@*|node()"/>
326 </xsl:copy>
327 </xsl:template>
328<!--
329 - Handling of the initial body and head HTML document
330 -->
331 <xsl:template match="body">
332 <xsl:variable name="firsth2" select="./h2[1]"/>
333 <xsl:variable name="rest2" select="./h2[position()&gt;1]"/>
334 <body bgcolor="#8b7765" text="#000000" link="#000000" vlink="#000000">
335 <xsl:call-template name="titlebox">
336 <xsl:with-param name="title" select="'libxml'"/>
337 </xsl:call-template>
338 <table border="0" cellpadding="4" cellspacing="0" width="100%" align="center">
339 <tr>
340 <td bgcolor="#8b7765">
341 <table border="0" cellspacing="0" cellpadding="2" width="100%">
342 <tr>
343 <td valign="top" width="200" bgcolor="#8b7765">
344 <xsl:call-template name="toc"/>
345 </td>
346 <td valign="top" bgcolor="#8b7765">
347 <table border="0" cellspacing="0" cellpadding="1" width="100%">
348 <tr>
349 <td>
350 <table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000">
351 <tr>
352 <td>
353 <table border="0" cellpadding="3" cellspacing="1" width="100%">
354 <tr>
355 <td bgcolor="#fffacd">
356 <xsl:apply-templates mode="content" select="($firsth2/preceding-sibling::*)"/>
357 <xsl:for-each select="./h2">
358 <xsl:call-template name="subfile">
359 <xsl:with-param name="header" select="."/>
360 </xsl:call-template>
361 </xsl:for-each>
362 <p><a href="mailto:daniel@veillard.com">Daniel Veillard</a></p>
363 </td>
364 </tr>
365 </table>
366 </td>
367 </tr>
368 </table>
369 </td>
370 </tr>
371 </table>
372 </td>
373 </tr>
374 </table>
375 </td>
376 </tr>
377 </table>
378 </body>
379 </xsl:template>
380 <xsl:template match="head">
381 <head>
382 <xsl:call-template name="style"/>
383 <xsl:apply-templates mode="head"/>
384 </head>
385 </xsl:template>
386 <xsl:template match="html">
387 <html>
388 <xsl:apply-templates/>
389 </html>
390 </xsl:template>
391</xsl:stylesheet>