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