2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
3 <xsl:output method="xml" encoding="ISO-8859-1" indent="yes"
4 doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
5 doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
8 - returns the filename associated to an ID in the original file
10 <xsl:template name="tocfilename">
11 <xsl:param name="name" select="string(@href)"/>
13 <xsl:when test="$name = '#Introducti'">
14 <xsl:text>intro.html</xsl:text>
16 <xsl:when test="$name = '#Documentat'">
17 <xsl:text>docs.html</xsl:text>
19 <xsl:when test="$name = '#Reporting'">
20 <xsl:text>bugs.html</xsl:text>
22 <xsl:when test="$name = '#help'">
23 <xsl:text>help.html</xsl:text>
25 <xsl:when test="$name = '#Help'">
26 <xsl:text>help.html</xsl:text>
28 <xsl:when test="$name = '#Downloads'">
29 <xsl:text>downloads.html</xsl:text>
31 <xsl:when test="$name = '#News'">
32 <xsl:text>news.html</xsl:text>
34 <xsl:when test="$name = '#Contributi'">
35 <xsl:text>contribs.html</xsl:text>
37 <xsl:when test="$name = '#xsltproc'">
38 <xsl:text>xsltproc2.html</xsl:text>
40 <xsl:when test="$name = '#API'">
43 <xsl:when test="$name = '#XSLT'">
44 <xsl:text>XSLT.html</xsl:text>
46 <xsl:when test="$name = '#XML'">
47 <xsl:text>XMLinfo.html</xsl:text>
49 <xsl:when test="$name = '#Validation'">
50 <xsl:text>xmldtd.html</xsl:text>
52 <xsl:when test="$name = '#tree'">
55 <xsl:when test="$name = '#library'">
58 <xsl:when test="$name = '#interface'">
61 <xsl:when test="$name = '#Example'">
64 <xsl:when test="$name = '#Entities'">
67 <xsl:when test="$name = '#architecture'">
70 <xsl:when test="$name = '#Namespaces'">
71 <xsl:text>namespaces.html</xsl:text>
73 <xsl:when test="$name = '#DOM'">
76 <xsl:when test="$name = '#Catalog'">
77 <xsl:text>catalog.html</xsl:text>
79 <xsl:when test="$name = '#Upgrading'">
82 <xsl:when test="$name = '#Encodings'">
83 <xsl:text>encoding.html</xsl:text>
85 <xsl:when test="$name = '#IO'">
88 <xsl:when test="$name = '#Memory'">
91 <xsl:when test="$name = '#Thread'">
94 <xsl:when test="$name = '#FAQ'">
95 <xsl:text>FAQ.html</xsl:text>
97 <xsl:when test="$name = '#Python'">
100 <xsl:when test="$name = ''">
101 <xsl:text>unknown.html</xsl:text>
104 <xsl:value-of select="$name"/>
108 <xsl:template name="docfilename">
109 <xsl:param name="name" select="string(@href)"/>
111 <xsl:when test="$name = '#Introducti'">
112 <xsl:text></xsl:text>
114 <xsl:when test="$name = '#Documentat'">
115 <xsl:text></xsl:text>
117 <xsl:when test="$name = '#Reporting'">
118 <xsl:text></xsl:text>
120 <xsl:when test="$name = '#help'">
121 <xsl:text></xsl:text>
123 <xsl:when test="$name = '#Help'">
124 <xsl:text></xsl:text>
126 <xsl:when test="$name = '#Downloads'">
127 <xsl:text></xsl:text>
129 <xsl:when test="$name = '#News'">
130 <xsl:text></xsl:text>
132 <xsl:when test="$name = '#Contributi'">
133 <xsl:text></xsl:text>
135 <xsl:when test="$name = '#xsltproc'">
136 <xsl:text>xsltproc2.html</xsl:text>
138 <xsl:when test="$name = '#API'">
139 <xsl:text>API.html</xsl:text>
141 <xsl:when test="$name = '#XSLT'">
142 <xsl:text>XSLT.html</xsl:text>
144 <xsl:when test="$name = '#XML'">
145 <xsl:text></xsl:text>
147 <xsl:when test="$name = '#Validation'">
148 <xsl:text></xsl:text>
150 <xsl:when test="$name = '#tree'">
151 <xsl:text>tree.html</xsl:text>
153 <xsl:when test="$name = '#library'">
154 <xsl:text>library.html</xsl:text>
156 <xsl:when test="$name = '#interface'">
157 <xsl:text>interface.html</xsl:text>
159 <xsl:when test="$name = '#Example'">
160 <xsl:text>example.html</xsl:text>
162 <xsl:when test="$name = '#Entities'">
163 <xsl:text>entities.html</xsl:text>
165 <xsl:when test="$name = '#architecture'">
166 <xsl:text>architecture.html</xsl:text>
168 <xsl:when test="$name = '#Namespaces'">
169 <xsl:text>namespaces.html</xsl:text>
171 <xsl:when test="$name = '#DOM'">
172 <xsl:text>DOM.html</xsl:text>
174 <xsl:when test="$name = '#Catalog'">
175 <xsl:text></xsl:text>
177 <xsl:when test="$name = '#Upgrading'">
178 <xsl:text>upgrade.html</xsl:text>
180 <xsl:when test="$name = '#Encodings'">
181 <xsl:text></xsl:text>
183 <xsl:when test="$name = '#IO'">
184 <xsl:text>xmlio.html</xsl:text>
186 <xsl:when test="$name = '#Memory'">
187 <xsl:text>xmlmem.html</xsl:text>
189 <xsl:when test="$name = '#Thread'">
190 <xsl:text>threads.html</xsl:text>
192 <xsl:when test="$name = '#FAQ'">
193 <xsl:text></xsl:text>
195 <xsl:when test="$name = '#Python'">
196 <xsl:text>python.html</xsl:text>
198 <xsl:when test="$name = ''">
199 <xsl:text>unknown.html</xsl:text>
202 <xsl:value-of select="$name"/>
206 <xsl:template name="filename">
207 <xsl:param name="name" select="string(@href)"/>
209 <xsl:when test="$name = '#Introducti'">
210 <xsl:text>intro.html</xsl:text>
212 <xsl:when test="$name = '#Documentat'">
213 <xsl:text>docs.html</xsl:text>
215 <xsl:when test="$name = '#Reporting'">
216 <xsl:text>bugs.html</xsl:text>
218 <xsl:when test="$name = '#help'">
219 <xsl:text>help.html</xsl:text>
221 <xsl:when test="$name = '#Help'">
222 <xsl:text>help.html</xsl:text>
224 <xsl:when test="$name = '#Downloads'">
225 <xsl:text>downloads.html</xsl:text>
227 <xsl:when test="$name = '#News'">
228 <xsl:text>news.html</xsl:text>
230 <xsl:when test="$name = '#Contributi'">
231 <xsl:text>contribs.html</xsl:text>
233 <xsl:when test="$name = '#xsltproc'">
234 <xsl:text>xsltproc2.html</xsl:text>
236 <xsl:when test="$name = '#API'">
237 <xsl:text>API.html</xsl:text>
239 <xsl:when test="$name = '#XSLT'">
240 <xsl:text>XSLT.html</xsl:text>
242 <xsl:when test="$name = '#XML'">
243 <xsl:text>XMLinfo.html</xsl:text>
245 <xsl:when test="$name = '#Validation'">
246 <xsl:text>xmldtd.html</xsl:text>
248 <xsl:when test="$name = '#tree'">
249 <xsl:text>tree.html</xsl:text>
251 <xsl:when test="$name = '#library'">
252 <xsl:text>library.html</xsl:text>
254 <xsl:when test="$name = '#interface'">
255 <xsl:text>interface.html</xsl:text>
257 <xsl:when test="$name = '#Example'">
258 <xsl:text>example.html</xsl:text>
260 <xsl:when test="$name = '#Entities'">
261 <xsl:text>entities.html</xsl:text>
263 <xsl:when test="$name = '#architecture'">
264 <xsl:text>architecture.html</xsl:text>
266 <xsl:when test="$name = '#Namespaces'">
267 <xsl:text>namespaces.html</xsl:text>
269 <xsl:when test="$name = '#DOM'">
270 <xsl:text>DOM.html</xsl:text>
272 <xsl:when test="$name = '#Catalog'">
273 <xsl:text>catalog.html</xsl:text>
275 <xsl:when test="$name = '#Upgrading'">
276 <xsl:text>upgrade.html</xsl:text>
278 <xsl:when test="$name = '#Encodings'">
279 <xsl:text>encoding.html</xsl:text>
281 <xsl:when test="$name = '#IO'">
282 <xsl:text>xmlio.html</xsl:text>
284 <xsl:when test="$name = '#Memory'">
285 <xsl:text>xmlmem.html</xsl:text>
287 <xsl:when test="$name = '#Thread'">
288 <xsl:text>threads.html</xsl:text>
290 <xsl:when test="$name = '#FAQ'">
291 <xsl:text>FAQ.html</xsl:text>
293 <xsl:when test="$name = '#Python'">
294 <xsl:text>python.html</xsl:text>
296 <xsl:when test="$name = ''">
297 <xsl:text>unknown.html</xsl:text>
300 <xsl:value-of select="$name"/>
307 <xsl:variable name="globaltitle" select="string(/html/body/h1[1])"/>
309 - The table of content
311 <xsl:variable name="toc">
312 <form action="search.php"
313 enctype="application/x-www-form-urlencoded" method="get">
314 <input name="query" type="text" size="20" value=""/>
315 <input name="submit" type="submit" value="Search ..."/>
317 <ul><!-- style="margin-left: -1em" -->
318 <li><a href="index.html">Home</a></li>
319 <xsl:for-each select="/html/body/h2">
320 <xsl:variable name="filename">
321 <xsl:call-template name="tocfilename">
322 <xsl:with-param name="name" select="concat('#', string(a[1]/@name))"/>
325 <xsl:if test="$filename != ''">
327 <xsl:element name="a">
328 <xsl:attribute name="href">
329 <xsl:value-of select="$filename"/>
331 <xsl:value-of select="."/>
336 <li><a href="guidelines.html">XML Guidelines</a></li>
339 <xsl:variable name="develtoc">
340 <form action="search.php"
341 enctype="application/x-www-form-urlencoded" method="get">
342 <input name="query" type="text" size="20" value=""/>
343 <input name="submit" type="submit" value="Search ..."/>
345 <ul><!-- style="margin-left: -1em" -->
346 <li><a href="index.html">Home</a></li>
347 <li><a href="guidelines.html">XML Guidelines</a></li>
348 <li><a href="tutorial/index.html">Tutorial</a></li>
349 <li><a href="xmlreader.html">The Reader Interface</a></li>
350 <xsl:for-each select="/html/body/h2">
351 <xsl:variable name="filename">
352 <xsl:call-template name="docfilename">
353 <xsl:with-param name="name" select="concat('#', string(a[1]/@name))"/>
356 <xsl:if test="$filename != ''">
358 <xsl:element name="a">
359 <xsl:attribute name="href">
360 <xsl:value-of select="$filename"/>
362 <xsl:value-of select="."/>
367 <li><a href="xml.html">flat page</a>, <a href="site.xsl">stylesheet</a></li>
370 <xsl:variable name="api">
371 <ul><!-- style="margin-left: -1em" -->
372 <li><a href="APIchunk0.html">Alphabetic</a></li>
373 <li><a href="APIconstructors.html">Constructors</a></li>
374 <li><a href="APIfunctions.html">Functions/Types</a></li>
375 <li><a href="APIfiles.html">Modules</a></li>
376 <li><a href="APIsymbols.html">Symbols</a></li>
379 <xsl:variable name="related">
380 <ul><!-- style="margin-left: -1em" -->
381 <li><a href="http://mail.gnome.org/archives/xml/">Mail archive</a></li>
382 <li><a href="http://xmlsoft.org/XSLT/">XSLT libxslt</a></li>
383 <li><a href="http://phd.cs.unibo.it/gdome2/">DOM gdome2</a></li>
384 <li><a href="http://www.aleksey.com/xmlsec/">XML-DSig xmlsec</a></li>
385 <li><a href="ftp://xmlsoft.org/">FTP</a></li>
386 <li><a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li>
387 <li><a href="http://garypennington.net/libxml2/">Solaris binaries</a></li>
388 <li><a href="http://www.zveno.com/open_source/libxml2xslt.html">MacOsX binaries</a></li>
389 <li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li>
390 <li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxml2">Bug Tracker</a></li>
393 <xsl:template name="toc">
394 <table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000">
397 <table width="100%" border="0" cellspacing="1" cellpadding="3">
399 <td colspan="1" bgcolor="#eecfa1" align="center">
406 <td bgcolor="#fffacd">
407 <xsl:copy-of select="$toc"/>
411 <table width="100%" border="0" cellspacing="1" cellpadding="3">
413 <td colspan="1" bgcolor="#eecfa1" align="center">
420 <td bgcolor="#fffacd">
421 <xsl:copy-of select="$related"/>
429 <xsl:template name="develtoc">
430 <table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000">
433 <table width="100%" border="0" cellspacing="1" cellpadding="3">
435 <td colspan="1" bgcolor="#eecfa1" align="center">
437 <b>Developer Menu</b>
442 <td bgcolor="#fffacd">
443 <xsl:copy-of select="$develtoc"/>
447 <table width="100%" border="0" cellspacing="1" cellpadding="3">
449 <td colspan="1" bgcolor="#eecfa1" align="center">
456 <td bgcolor="#fffacd">
457 <xsl:copy-of select="$api"/>
461 <table width="100%" border="0" cellspacing="1" cellpadding="3">
463 <td colspan="1" bgcolor="#eecfa1" align="center">
470 <td bgcolor="#fffacd">
471 <xsl:copy-of select="$related"/>
479 <xsl:template mode="head" match="title">
481 <xsl:apply-templates/>
484 <xsl:template mode="head" match="meta">
487 - Write the styles in the head
489 <xsl:template name="style">
490 <link rel="SHORTCUT ICON" href="/favicon.ico"/>
491 <style type="text/css">
492 TD {font-family: Verdana,Arial,Helvetica}
493 BODY {font-family: Verdana,Arial,Helvetica; margin-top: 2em; margin-left: 0em; margin-right: 0em}
494 H1 {font-family: Verdana,Arial,Helvetica}
495 H2 {font-family: Verdana,Arial,Helvetica}
496 H3 {font-family: Verdana,Arial,Helvetica}
497 A:link, A:visited, A:active { text-decoration: underline }
501 - Write the title box on top
503 <xsl:template name="titlebox">
504 <xsl:param name="title" select="'Main Page'"/>
505 <table border="0" width="100%" cellpadding="5" cellspacing="0" align="center">
508 <a href="http://www.gnome.org/"><img src="gnome2.png" alt="Gnome2 Logo"/></a>
509 <a href="http://www.w3.org/Status"><img src="w3c.png" alt="W3C Logo"/></a>
510 <a href="http://www.redhat.com/"><img src="redhat.gif" alt="Red Hat Logo"/></a>
512 <a href="http://xmlsoft.org/"><img src="Libxml2-Logo-180x168.gif" alt="Made with Libxml2 Logo"/></a>
516 <table border="0" width="90%" cellpadding="2" cellspacing="0" align="center" bgcolor="#000000">
519 <table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#fffacd">
522 <xsl:element name="h1">
523 <xsl:value-of select="$globaltitle"/>
525 <xsl:element name="h2">
526 <xsl:value-of select="$title"/>
539 - Handling of nodes in the body before the first H2, table of content
540 - Everything is just copied over, except href which may get rewritten
541 - and h1/h2/a at the top level
543 <xsl:template priority="2" mode="subcontent" match="a">
544 <xsl:variable name="filename">
545 <xsl:call-template name="filename">
546 <xsl:with-param name="name" select="string(@href)"/>
550 <xsl:attribute name="href">
551 <xsl:value-of select="$filename"/>
553 <xsl:apply-templates mode="subcontent" select="node()"/>
556 <xsl:template mode="subcontent" match="@*|node()">
558 <xsl:apply-templates mode="subcontent" select="@*|node()"/>
561 <xsl:template mode="content" match="@*|node()">
562 <xsl:if test="name() != 'h1' and name() != 'h2'">
564 <xsl:apply-templates mode="subcontent" select="@*|node()"/>
569 - Handling of nodes in the body after an H2
570 - Open a new file and dump all the siblings up to the next H2
572 <xsl:template name="subfile">
573 <xsl:param name="header" select="following-sibling::h2[1]"/>
574 <xsl:variable name="filename">
575 <xsl:call-template name="filename">
576 <xsl:with-param name="name" select="concat('#', string($header/a[1]/@name))"/>
579 <xsl:variable name="tocfilename">
580 <xsl:call-template name="tocfilename">
581 <xsl:with-param name="name" select="concat('#', string($header/a[1]/@name))"/>
584 <xsl:variable name="title">
585 <xsl:value-of select="$header"/>
587 <xsl:document href="{$filename}" method="xml" encoding="ISO-8859-1"
588 doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
589 doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
592 <xsl:call-template name="style"/>
593 <xsl:element name="title">
594 <xsl:value-of select="$title"/>
597 <body bgcolor="#8b7765" text="#000000" link="#000000" vlink="#000000">
598 <xsl:call-template name="titlebox">
599 <xsl:with-param name="title" select="$title"/>
601 <table border="0" cellpadding="4" cellspacing="0" width="100%" align="center">
603 <td bgcolor="#8b7765">
604 <table border="0" cellspacing="0" cellpadding="2" width="100%">
606 <td valign="top" width="200" bgcolor="#8b7765">
608 <xsl:when test="$filename = 'docs.html'">
609 <xsl:call-template name="develtoc"/>
611 <xsl:when test="$tocfilename = ''">
612 <xsl:call-template name="develtoc"/>
615 <xsl:call-template name="toc"/>
619 <td valign="top" bgcolor="#8b7765">
620 <table border="0" cellspacing="0" cellpadding="1" width="100%">
623 <table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000">
626 <table border="0" cellpadding="3" cellspacing="1" width="100%">
628 <td bgcolor="#fffacd">
629 <xsl:apply-templates mode="subfile" select="$header/following-sibling::*[preceding-sibling::h2[1] = $header and name() != 'h2' ]"/>
630 <p><a href="bugs.html">Daniel Veillard</a></p>
650 <xsl:template mode="subfile" match="@*|node()">
652 <xsl:apply-templates mode="content" select="@*|node()"/>
656 - Handling of the initial body and head HTML document
658 <xsl:template match="body">
659 <xsl:variable name="firsth2" select="./h2[1]"/>
660 <xsl:variable name="rest2" select="./h2[position()>1]"/>
661 <body bgcolor="#8b7765" text="#000000" link="#000000" vlink="#000000">
662 <xsl:call-template name="titlebox">
663 <xsl:with-param name="title" select="'libxml'"/>
665 <table border="0" cellpadding="4" cellspacing="0" width="100%" align="center">
667 <td bgcolor="#8b7765">
668 <table border="0" cellspacing="0" cellpadding="2" width="100%">
670 <td valign="top" width="200" bgcolor="#8b7765">
671 <xsl:call-template name="toc"/>
673 <td valign="top" bgcolor="#8b7765">
674 <table border="0" cellspacing="0" cellpadding="1" width="100%">
677 <table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000">
680 <table border="0" cellpadding="3" cellspacing="1" width="100%">
682 <td bgcolor="#fffacd">
683 <xsl:apply-templates mode="content" select="($firsth2/preceding-sibling::*)"/>
684 <xsl:for-each select="./h2">
685 <xsl:call-template name="subfile">
686 <xsl:with-param name="header" select="."/>
689 <p><a href="bugs.html">Daniel Veillard</a></p>
707 <xsl:template match="head">
709 <xsl:call-template name="style"/>
710 <xsl:apply-templates mode="head"/>
713 <xsl:template match="html">
714 <xsl:message>Generating the Web pages</xsl:message>
716 <xsl:apply-templates/>