1 | <?xml version="1.0"?> |
---|
2 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> |
---|
3 | <xsl:output method="html" version="4.01" encoding="ISO-8859-1"/> |
---|
4 | |
---|
5 | <!-- |
---|
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'"> |
---|
45 | <xsl:text>XMLinfo.html</xsl:text> |
---|
46 | </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> |
---|
89 | <xsl:when test="$name = '#Thread'"> |
---|
90 | <xsl:text>threads.html</xsl:text> |
---|
91 | </xsl:when> |
---|
92 | <xsl:when test="$name = '#FAQ'"> |
---|
93 | <xsl:text>FAQ.html</xsl:text> |
---|
94 | </xsl:when> |
---|
95 | <xsl:when test="$name = '#Python'"> |
---|
96 | <xsl:text>python.html</xsl:text> |
---|
97 | </xsl:when> |
---|
98 | <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> |
---|
106 | <!-- |
---|
107 | - The global title |
---|
108 | --> |
---|
109 | <xsl:variable name="globaltitle" select="string(/html/body/h1[1])"/> |
---|
110 | <!-- |
---|
111 | - The table of content |
---|
112 | --> |
---|
113 | <xsl:variable name="toc"> |
---|
114 | <ul><!-- style="margin-left: -1em" --> |
---|
115 | <li><a href="index.html">Home</a></li> |
---|
116 | <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> |
---|
131 | <li><a href="xmlreader.html">The Reader Interface</a></li> |
---|
132 | <li><a href="tutorial/index.html">Tutorial</a></li> |
---|
133 | <li><a href="guidelines.html">XML Guidelines</a></li> |
---|
134 | <li><a href="xml.html">flat page</a>, <a href="site.xsl">stylesheet</a></li> |
---|
135 | </ul> |
---|
136 | </xsl:variable> |
---|
137 | <xsl:variable name="api"> |
---|
138 | <form action="search.php" |
---|
139 | enctype="application/x-www-form-urlencoded" method="GET"> |
---|
140 | <input name="query" type="TEXT" size="20" value=""/> |
---|
141 | <input name="submit" type="submit" value="Search ..."/> |
---|
142 | </form> |
---|
143 | <ul><!-- style="margin-left: -1em" --> |
---|
144 | <li><a href="APIchunk0.html">Alphabetic</a></li> |
---|
145 | <li><a href="APIconstructors.html">Constructors</a></li> |
---|
146 | <li><a href="APIfunctions.html">Functions/Types</a></li> |
---|
147 | <li><a href="APIfiles.html">Modules</a></li> |
---|
148 | <li><a href="APIsymbols.html">Symbols</a></li> |
---|
149 | </ul> |
---|
150 | </xsl:variable> |
---|
151 | <xsl:variable name="related"> |
---|
152 | <ul><!-- style="margin-left: -1em" --> |
---|
153 | <li><a href="http://mail.gnome.org/archives/xml/">Mail archive</a></li> |
---|
154 | <li><a href="http://xmlsoft.org/XSLT/">XSLT libxslt</a></li> |
---|
155 | <li><a href="http://phd.cs.unibo.it/gdome2/">DOM gdome2</a></li> |
---|
156 | <li><a href="http://www.aleksey.com/xmlsec/">XML-DSig xmlsec</a></li> |
---|
157 | <li><a href="ftp://xmlsoft.org/">FTP</a></li> |
---|
158 | <li><a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li> |
---|
159 | <li><a href="http://garypennington.net/libxml2/">Solaris binaries</a></li> |
---|
160 | <li><a href="http://www.zveno.com/open_source/libxml2xslt.html">MacOsX binaries</a></li> |
---|
161 | <li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li> |
---|
162 | <li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxml&product=libxml2">Bug Tracker</a></li> |
---|
163 | </ul> |
---|
164 | </xsl:variable> |
---|
165 | <xsl:template name="toc"> |
---|
166 | <table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"> |
---|
167 | <tr> |
---|
168 | <td> |
---|
169 | <table width="100%" border="0" cellspacing="1" cellpadding="3"> |
---|
170 | <tr> |
---|
171 | <td colspan="1" bgcolor="#eecfa1" align="center"> |
---|
172 | <center> |
---|
173 | <b>Main Menu</b> |
---|
174 | </center> |
---|
175 | </td> |
---|
176 | </tr> |
---|
177 | <tr> |
---|
178 | <td bgcolor="#fffacd"> |
---|
179 | <xsl:copy-of select="$toc"/> |
---|
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> |
---|
187 | <b>API Indexes</b> |
---|
188 | </center> |
---|
189 | </td> |
---|
190 | </tr> |
---|
191 | <tr> |
---|
192 | <td bgcolor="#fffacd"> |
---|
193 | <xsl:copy-of select="$api"/> |
---|
194 | </td> |
---|
195 | </tr> |
---|
196 | </table> |
---|
197 | <table width="100%" border="0" cellspacing="1" cellpadding="3"> |
---|
198 | <tr> |
---|
199 | <td colspan="1" bgcolor="#eecfa1" align="center"> |
---|
200 | <center> |
---|
201 | <b>Related links</b> |
---|
202 | </center> |
---|
203 | </td> |
---|
204 | </tr> |
---|
205 | <tr> |
---|
206 | <td bgcolor="#fffacd"> |
---|
207 | <xsl:copy-of select="$related"/> |
---|
208 | </td> |
---|
209 | </tr> |
---|
210 | </table> |
---|
211 | </td> |
---|
212 | </tr> |
---|
213 | </table> |
---|
214 | </xsl:template> |
---|
215 | <xsl:template mode="head" match="title"> |
---|
216 | <title> |
---|
217 | <xsl:apply-templates/> |
---|
218 | </title> |
---|
219 | </xsl:template> |
---|
220 | <xsl:template mode="head" match="meta"> |
---|
221 | </xsl:template> |
---|
222 | <!-- |
---|
223 | - Write the styles in the head |
---|
224 | --> |
---|
225 | <xsl:template name="style"> |
---|
226 | <link rel="SHORTCUT ICON" href="/favicon.ico"/> |
---|
227 | <style type="text/css"><xsl:text disable-output-escaping="yes"><!--</xsl:text> |
---|
228 | TD {font-family: Verdana,Arial,Helvetica} |
---|
229 | BODY {font-family: Verdana,Arial,Helvetica; margin-top: 2em; margin-left: 0em; margin-right: 0em} |
---|
230 | H1 {font-family: Verdana,Arial,Helvetica} |
---|
231 | H2 {font-family: Verdana,Arial,Helvetica} |
---|
232 | H3 {font-family: Verdana,Arial,Helvetica} |
---|
233 | A:link, A:visited, A:active { text-decoration: underline } |
---|
234 | <xsl:text disable-output-escaping="yes">--></xsl:text></style> |
---|
235 | </xsl:template> |
---|
236 | <!-- |
---|
237 | - Write the title box on top |
---|
238 | --> |
---|
239 | <xsl:template name="titlebox"> |
---|
240 | <xsl:param name="title" select="'Main Page'"/> |
---|
241 | <table border="0" width="100%" cellpadding="5" cellspacing="0" align="center"> |
---|
242 | <tr> |
---|
243 | <td width="180"> |
---|
244 | <a href="http://www.gnome.org/"><img src="gnome2.png" alt="Gnome2 Logo"/></a> |
---|
245 | <a href="http://www.w3.org/Status"><img src="w3c.png" alt="W3C Logo"/></a> |
---|
246 | <a href="http://www.redhat.com/"><img src="redhat.gif" alt="Red Hat Logo"/></a> |
---|
247 | <div align="left"> |
---|
248 | <a href="http://xmlsoft.org/"><img src="Libxml2-Logo-180x168.gif" alt="Made with Libxml2 Logo"/></a> |
---|
249 | </div> |
---|
250 | </td> |
---|
251 | <td> |
---|
252 | <table border="0" width="90%" cellpadding="2" cellspacing="0" align="center" bgcolor="#000000"> |
---|
253 | <tr> |
---|
254 | <td> |
---|
255 | <table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#fffacd"> |
---|
256 | <tr> |
---|
257 | <td align="center"> |
---|
258 | <xsl:element name="h1"> |
---|
259 | <xsl:value-of select="$globaltitle"/> |
---|
260 | </xsl:element> |
---|
261 | <xsl:element name="h2"> |
---|
262 | <xsl:value-of select="$title"/> |
---|
263 | </xsl:element> |
---|
264 | </td> |
---|
265 | </tr> |
---|
266 | </table> |
---|
267 | </td> |
---|
268 | </tr> |
---|
269 | </table> |
---|
270 | </td> |
---|
271 | </tr> |
---|
272 | </table> |
---|
273 | </xsl:template> |
---|
274 | <!-- |
---|
275 | - Handling of nodes in the body before the first H2, table of content |
---|
276 | - Everything is just copied over, except href which may get rewritten |
---|
277 | - and h1/h2/a at the top level |
---|
278 | --> |
---|
279 | <xsl:template priority="2" mode="subcontent" match="a"> |
---|
280 | <xsl:variable name="filename"> |
---|
281 | <xsl:call-template name="filename"> |
---|
282 | <xsl:with-param name="name" select="string(@href)"/> |
---|
283 | </xsl:call-template> |
---|
284 | </xsl:variable> |
---|
285 | <xsl:copy> |
---|
286 | <xsl:attribute name="href"> |
---|
287 | <xsl:value-of select="$filename"/> |
---|
288 | </xsl:attribute> |
---|
289 | <xsl:apply-templates mode="subcontent" select="node()"/> |
---|
290 | </xsl:copy> |
---|
291 | </xsl:template> |
---|
292 | <xsl:template mode="subcontent" match="@*|node()"> |
---|
293 | <xsl:copy> |
---|
294 | <xsl:apply-templates mode="subcontent" select="@*|node()"/> |
---|
295 | </xsl:copy> |
---|
296 | </xsl:template> |
---|
297 | <xsl:template mode="content" match="@*|node()"> |
---|
298 | <xsl:if test="name() != 'h1' and name() != 'h2'"> |
---|
299 | <xsl:copy> |
---|
300 | <xsl:apply-templates mode="subcontent" select="@*|node()"/> |
---|
301 | </xsl:copy> |
---|
302 | </xsl:if> |
---|
303 | </xsl:template> |
---|
304 | <!-- |
---|
305 | - Handling of nodes in the body after an H2 |
---|
306 | - Open a new file and dump all the siblings up to the next H2 |
---|
307 | --> |
---|
308 | <xsl:template name="subfile"> |
---|
309 | <xsl:param name="header" select="following-sibling::h2[1]"/> |
---|
310 | <xsl:variable name="filename"> |
---|
311 | <xsl:call-template name="filename"> |
---|
312 | <xsl:with-param name="name" select="concat('#', string($header/a[1]/@name))"/> |
---|
313 | </xsl:call-template> |
---|
314 | </xsl:variable> |
---|
315 | <xsl:variable name="title"> |
---|
316 | <xsl:value-of select="$header"/> |
---|
317 | </xsl:variable> |
---|
318 | <xsl:document href="{$filename}" method="html" version="4.01" encoding="ISO-8859-1"> |
---|
319 | <html> |
---|
320 | <head> |
---|
321 | <xsl:call-template name="style"/> |
---|
322 | <xsl:element name="title"> |
---|
323 | <xsl:value-of select="$title"/> |
---|
324 | </xsl:element> |
---|
325 | </head> |
---|
326 | <body bgcolor="#8b7765" text="#000000" link="#000000" vlink="#000000"> |
---|
327 | <xsl:call-template name="titlebox"> |
---|
328 | <xsl:with-param name="title" select="$title"/> |
---|
329 | </xsl:call-template> |
---|
330 | <table border="0" cellpadding="4" cellspacing="0" width="100%" align="center"> |
---|
331 | <tr> |
---|
332 | <td bgcolor="#8b7765"> |
---|
333 | <table border="0" cellspacing="0" cellpadding="2" width="100%"> |
---|
334 | <tr> |
---|
335 | <td valign="top" width="200" bgcolor="#8b7765"> |
---|
336 | <xsl:call-template name="toc"/> |
---|
337 | </td> |
---|
338 | <td valign="top" bgcolor="#8b7765"> |
---|
339 | <table border="0" cellspacing="0" cellpadding="1" width="100%"> |
---|
340 | <tr> |
---|
341 | <td> |
---|
342 | <table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"> |
---|
343 | <tr> |
---|
344 | <td> |
---|
345 | <table border="0" cellpadding="3" cellspacing="1" width="100%"> |
---|
346 | <tr> |
---|
347 | <td bgcolor="#fffacd"> |
---|
348 | <xsl:apply-templates mode="subfile" select="$header/following-sibling::*[preceding-sibling::h2[1] = $header and name() != 'h2' ]"/> |
---|
349 | <p><a href="bugs.html">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 | </html> |
---|
367 | </xsl:document> |
---|
368 | </xsl:template> |
---|
369 | <xsl:template mode="subfile" match="@*|node()"> |
---|
370 | <xsl:copy> |
---|
371 | <xsl:apply-templates mode="content" select="@*|node()"/> |
---|
372 | </xsl:copy> |
---|
373 | </xsl:template> |
---|
374 | <!-- |
---|
375 | - Handling of the initial body and head HTML document |
---|
376 | --> |
---|
377 | <xsl:template match="body"> |
---|
378 | <xsl:variable name="firsth2" select="./h2[1]"/> |
---|
379 | <xsl:variable name="rest2" select="./h2[position()>1]"/> |
---|
380 | <body bgcolor="#8b7765" text="#000000" link="#000000" vlink="#000000"> |
---|
381 | <xsl:call-template name="titlebox"> |
---|
382 | <xsl:with-param name="title" select="'libxml'"/> |
---|
383 | </xsl:call-template> |
---|
384 | <table border="0" cellpadding="4" cellspacing="0" width="100%" align="center"> |
---|
385 | <tr> |
---|
386 | <td bgcolor="#8b7765"> |
---|
387 | <table border="0" cellspacing="0" cellpadding="2" width="100%"> |
---|
388 | <tr> |
---|
389 | <td valign="top" width="200" bgcolor="#8b7765"> |
---|
390 | <xsl:call-template name="toc"/> |
---|
391 | </td> |
---|
392 | <td valign="top" bgcolor="#8b7765"> |
---|
393 | <table border="0" cellspacing="0" cellpadding="1" width="100%"> |
---|
394 | <tr> |
---|
395 | <td> |
---|
396 | <table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"> |
---|
397 | <tr> |
---|
398 | <td> |
---|
399 | <table border="0" cellpadding="3" cellspacing="1" width="100%"> |
---|
400 | <tr> |
---|
401 | <td bgcolor="#fffacd"> |
---|
402 | <xsl:apply-templates mode="content" select="($firsth2/preceding-sibling::*)"/> |
---|
403 | <xsl:for-each select="./h2"> |
---|
404 | <xsl:call-template name="subfile"> |
---|
405 | <xsl:with-param name="header" select="."/> |
---|
406 | </xsl:call-template> |
---|
407 | </xsl:for-each> |
---|
408 | <p><a href="bugs.html">Daniel Veillard</a></p> |
---|
409 | </td> |
---|
410 | </tr> |
---|
411 | </table> |
---|
412 | </td> |
---|
413 | </tr> |
---|
414 | </table> |
---|
415 | </td> |
---|
416 | </tr> |
---|
417 | </table> |
---|
418 | </td> |
---|
419 | </tr> |
---|
420 | </table> |
---|
421 | </td> |
---|
422 | </tr> |
---|
423 | </table> |
---|
424 | </body> |
---|
425 | </xsl:template> |
---|
426 | <xsl:template match="head"> |
---|
427 | <head> |
---|
428 | <xsl:call-template name="style"/> |
---|
429 | <xsl:apply-templates mode="head"/> |
---|
430 | </head> |
---|
431 | </xsl:template> |
---|
432 | <xsl:template match="html"> |
---|
433 | <xsl:message>Generating the Web pages</xsl:message> |
---|
434 | <html> |
---|
435 | <xsl:apply-templates/> |
---|
436 | </html> |
---|
437 | </xsl:template> |
---|
438 | </xsl:stylesheet> |
---|