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