2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
3 <xsl:output method="xml" encoding="UTF-8" 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"/>
7 <xsl:variable name="href_base" select="''"/>
8 <xsl:variable name="menu_name">Main Menu</xsl:variable>
10 - returns the filename associated to an ID in the original file
12 <xsl:template name="tocfilename">
13 <xsl:param name="name" select="string(@href)"/>
15 <xsl:when test="$name = '#Introducti'">
16 <xsl:text>intro.html</xsl:text>
18 <xsl:when test="$name = '#Documentat'">
19 <xsl:text>docs.html</xsl:text>
21 <xsl:when test="$name = '#Reporting'">
22 <xsl:text>bugs.html</xsl:text>
24 <xsl:when test="$name = '#help'">
25 <xsl:text>help.html</xsl:text>
27 <xsl:when test="$name = '#Help'">
28 <xsl:text>help.html</xsl:text>
30 <xsl:when test="$name = '#Downloads'">
31 <xsl:text>downloads.html</xsl:text>
33 <xsl:when test="$name = '#News'">
34 <xsl:text>news.html</xsl:text>
36 <xsl:when test="$name = '#Contributi'">
37 <xsl:text>contribs.html</xsl:text>
39 <xsl:when test="$name = '#xsltproc'">
40 <xsl:text>xsltproc2.html</xsl:text>
42 <xsl:when test="$name = '#API'">
45 <xsl:when test="$name = '#XSLT'">
46 <xsl:text>XSLT.html</xsl:text>
48 <xsl:when test="$name = '#XML'">
49 <xsl:text>XMLinfo.html</xsl:text>
51 <xsl:when test="$name = '#Validation'">
52 <xsl:text>xmldtd.html</xsl:text>
54 <xsl:when test="$name = '#tree'">
57 <xsl:when test="$name = '#library'">
60 <xsl:when test="$name = '#interface'">
63 <xsl:when test="$name = '#Example'">
66 <xsl:when test="$name = '#Entities'">
69 <xsl:when test="$name = '#architecture'">
72 <xsl:when test="$name = '#Namespaces'">
73 <xsl:text>namespaces.html</xsl:text>
75 <xsl:when test="$name = '#DOM'">
78 <xsl:when test="$name = '#Catalog'">
79 <xsl:text>catalog.html</xsl:text>
81 <xsl:when test="$name = '#Upgrading'">
84 <xsl:when test="$name = '#Encodings'">
85 <xsl:text>encoding.html</xsl:text>
87 <xsl:when test="$name = '#IO'">
90 <xsl:when test="$name = '#Memory'">
93 <xsl:when test="$name = '#Thread'">
96 <xsl:when test="$name = '#FAQ'">
97 <xsl:text>FAQ.html</xsl:text>
99 <xsl:when test="$name = '#Python'">
100 <xsl:text></xsl:text>
102 <xsl:when test="$name = ''">
103 <xsl:text>unknown.html</xsl:text>
106 <xsl:value-of select="$name"/>
110 <xsl:template name="docfilename">
111 <xsl:param name="name" select="string(@href)"/>
113 <xsl:when test="$name = '#Introducti'">
114 <xsl:text></xsl:text>
116 <xsl:when test="$name = '#Documentat'">
117 <xsl:text></xsl:text>
119 <xsl:when test="$name = '#Reporting'">
120 <xsl:text></xsl:text>
122 <xsl:when test="$name = '#help'">
123 <xsl:text></xsl:text>
125 <xsl:when test="$name = '#Help'">
126 <xsl:text></xsl:text>
128 <xsl:when test="$name = '#Downloads'">
129 <xsl:text></xsl:text>
131 <xsl:when test="$name = '#News'">
132 <xsl:text></xsl:text>
134 <xsl:when test="$name = '#Contributi'">
135 <xsl:text></xsl:text>
137 <xsl:when test="$name = '#xsltproc'">
138 <xsl:text>xsltproc2.html</xsl:text>
140 <xsl:when test="$name = '#API'">
141 <xsl:text>API.html</xsl:text>
143 <xsl:when test="$name = '#XSLT'">
144 <xsl:text>XSLT.html</xsl:text>
146 <xsl:when test="$name = '#XML'">
147 <xsl:text></xsl:text>
149 <xsl:when test="$name = '#Validation'">
150 <xsl:text></xsl:text>
152 <xsl:when test="$name = '#tree'">
153 <xsl:text>tree.html</xsl:text>
155 <xsl:when test="$name = '#library'">
156 <xsl:text>library.html</xsl:text>
158 <xsl:when test="$name = '#interface'">
159 <xsl:text>interface.html</xsl:text>
161 <xsl:when test="$name = '#Example'">
162 <xsl:text>example.html</xsl:text>
164 <xsl:when test="$name = '#Entities'">
165 <xsl:text>entities.html</xsl:text>
167 <xsl:when test="$name = '#architecture'">
168 <xsl:text>architecture.html</xsl:text>
170 <xsl:when test="$name = '#Namespaces'">
171 <xsl:text>namespaces.html</xsl:text>
173 <xsl:when test="$name = '#DOM'">
174 <xsl:text>DOM.html</xsl:text>
176 <xsl:when test="$name = '#Catalog'">
177 <xsl:text></xsl:text>
179 <xsl:when test="$name = '#Upgrading'">
180 <xsl:text>upgrade.html</xsl:text>
182 <xsl:when test="$name = '#Encodings'">
183 <xsl:text></xsl:text>
185 <xsl:when test="$name = '#IO'">
186 <xsl:text>xmlio.html</xsl:text>
188 <xsl:when test="$name = '#Memory'">
189 <xsl:text>xmlmem.html</xsl:text>
191 <xsl:when test="$name = '#Thread'">
192 <xsl:text>threads.html</xsl:text>
194 <xsl:when test="$name = '#FAQ'">
195 <xsl:text></xsl:text>
197 <xsl:when test="$name = '#Python'">
198 <xsl:text>python.html</xsl:text>
200 <xsl:when test="$name = ''">
201 <xsl:text>unknown.html</xsl:text>
204 <xsl:value-of select="$name"/>
208 <xsl:template name="filename">
209 <xsl:param name="name" select="string(@href)"/>
211 <xsl:when test="$name = '#Introducti'">
212 <xsl:text>intro.html</xsl:text>
214 <xsl:when test="$name = '#Documentat'">
215 <xsl:text>docs.html</xsl:text>
217 <xsl:when test="$name = '#Reporting'">
218 <xsl:text>bugs.html</xsl:text>
220 <xsl:when test="$name = '#help'">
221 <xsl:text>help.html</xsl:text>
223 <xsl:when test="$name = '#Help'">
224 <xsl:text>help.html</xsl:text>
226 <xsl:when test="$name = '#Downloads'">
227 <xsl:text>downloads.html</xsl:text>
229 <xsl:when test="$name = '#News'">
230 <xsl:text>news.html</xsl:text>
232 <xsl:when test="$name = '#Contributi'">
233 <xsl:text>contribs.html</xsl:text>
235 <xsl:when test="$name = '#xsltproc'">
236 <xsl:text>xsltproc2.html</xsl:text>
238 <xsl:when test="$name = '#API'">
239 <xsl:text>API.html</xsl:text>
241 <xsl:when test="$name = '#XSLT'">
242 <xsl:text>XSLT.html</xsl:text>
244 <xsl:when test="$name = '#XML'">
245 <xsl:text>XMLinfo.html</xsl:text>
247 <xsl:when test="$name = '#Validation'">
248 <xsl:text>xmldtd.html</xsl:text>
250 <xsl:when test="$name = '#tree'">
251 <xsl:text>tree.html</xsl:text>
253 <xsl:when test="$name = '#library'">
254 <xsl:text>library.html</xsl:text>
256 <xsl:when test="$name = '#interface'">
257 <xsl:text>interface.html</xsl:text>
259 <xsl:when test="$name = '#Example'">
260 <xsl:text>example.html</xsl:text>
262 <xsl:when test="$name = '#Entities'">
263 <xsl:text>entities.html</xsl:text>
265 <xsl:when test="$name = '#architecture'">
266 <xsl:text>architecture.html</xsl:text>
268 <xsl:when test="$name = '#Namespaces'">
269 <xsl:text>namespaces.html</xsl:text>
271 <xsl:when test="$name = '#DOM'">
272 <xsl:text>DOM.html</xsl:text>
274 <xsl:when test="$name = '#Catalog'">
275 <xsl:text>catalog.html</xsl:text>
277 <xsl:when test="$name = '#Upgrading'">
278 <xsl:text>upgrade.html</xsl:text>
280 <xsl:when test="$name = '#Encodings'">
281 <xsl:text>encoding.html</xsl:text>
283 <xsl:when test="$name = '#IO'">
284 <xsl:text>xmlio.html</xsl:text>
286 <xsl:when test="$name = '#Memory'">
287 <xsl:text>xmlmem.html</xsl:text>
289 <xsl:when test="$name = '#Thread'">
290 <xsl:text>threads.html</xsl:text>
292 <xsl:when test="$name = '#FAQ'">
293 <xsl:text>FAQ.html</xsl:text>
295 <xsl:when test="$name = '#Python'">
296 <xsl:text>python.html</xsl:text>
298 <xsl:when test="$name = ''">
299 <xsl:text>unknown.html</xsl:text>
302 <xsl:value-of select="$name"/>
309 <xsl:variable name="globaltitle" select="string(/html/body/h1[1])"/>
311 - The table of content
313 <xsl:variable name="toc">
314 <form action="search.php"
315 enctype="application/x-www-form-urlencoded" method="get">
316 <input name="query" type="text" size="20" value=""/>
317 <input name="submit" type="submit" value="Search ..."/>
319 <ul><!-- style="margin-left: -1em" -->
320 <li><a href="index.html">Home</a></li>
321 <!--<li><a href="http://xmlsoft.org/wiki">Wiki</a></li> -->
322 <li><a href="html/index.html">Reference Manual</a></li>
323 <xsl:for-each select="/html/body/h2">
324 <xsl:variable name="filename">
325 <xsl:call-template name="tocfilename">
326 <xsl:with-param name="name" select="concat('#', string(a[1]/@name))"/>
329 <xsl:if test="$filename != ''">
331 <xsl:element name="a">
332 <xsl:attribute name="href">
333 <xsl:value-of select="$filename"/>
335 <xsl:if test="$filename = 'docs.html'">
336 <xsl:attribute name="style">font-weight:bold</xsl:attribute>
338 <xsl:value-of select="."/>
343 <li><a href="examples/index.html" style="font-weight:bold">Code Examples</a></li>
344 <li><a href="html/index.html" style="font-weight:bold">API Menu</a></li>
345 <li><a href="guidelines.html">XML Guidelines</a></li>
346 <li><a href="ChangeLog.html">Recent Changes</a></li>
349 <xsl:variable name="develtoc">
350 <form action="search.php"
351 enctype="application/x-www-form-urlencoded" method="get">
352 <input name="query" type="text" size="20" value=""/>
353 <input name="submit" type="submit" value="Search ..."/>
355 <ul><!-- style="margin-left: -1em" -->
356 <li><a href="index.html" style="font-weight:bold">Main Menu</a></li>
357 <li><a href="html/index.html" style="font-weight:bold">Reference Manual</a></li>
358 <li><a href="examples/index.html" style="font-weight:bold">Code Examples</a></li>
359 <li><a href="guidelines.html">XML Guidelines</a></li>
360 <li><a href="tutorial/index.html">Tutorial</a></li>
361 <li><a href="xmlreader.html">The Reader Interface</a></li>
362 <li><a href="ChangeLog.html">ChangeLog</a></li>
363 <xsl:for-each select="/html/body/h2">
364 <xsl:variable name="filename">
365 <xsl:call-template name="docfilename">
366 <xsl:with-param name="name" select="concat('#', string(a[1]/@name))"/>
369 <xsl:if test="$filename != ''">
371 <xsl:element name="a">
372 <xsl:attribute name="href">
373 <xsl:value-of select="$filename"/>
375 <xsl:value-of select="."/>
380 <li><a href="xml.html">flat page</a>, <a href="site.xsl">stylesheet</a></li>
383 <xsl:variable name="api">
384 <ul><!-- style="margin-left: -1em" -->
385 <li><a href="{$href_base}APIchunk0.html">Alphabetic</a></li>
386 <li><a href="{$href_base}APIconstructors.html">Constructors</a></li>
387 <li><a href="{$href_base}APIfunctions.html">Functions/Types</a></li>
388 <li><a href="{$href_base}APIfiles.html">Modules</a></li>
389 <li><a href="{$href_base}APIsymbols.html">Symbols</a></li>
392 <xsl:variable name="related">
393 <ul><!-- style="margin-left: -1em" -->
394 <li><a href="http://mail.gnome.org/archives/xml/">Mail archive</a></li>
395 <li><a href="http://xmlsoft.org/XSLT/">XSLT libxslt</a></li>
396 <li><a href="http://phd.cs.unibo.it/gdome2/">DOM gdome2</a></li>
397 <li><a href="http://www.aleksey.com/xmlsec/">XML-DSig xmlsec</a></li>
398 <li><a href="ftp://xmlsoft.org/">FTP</a></li>
399 <li><a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li>
400 <li><a href="http://opencsw.org/packages/libxml2">Solaris binaries</a></li>
401 <li><a href="http://www.explain.com.au/oss/libxml2xslt.html">MacOsX binaries</a></li>
402 <li><a href="http://codespeak.net/lxml/">lxml Python bindings</a></li>
403 <li><a href="http://cpan.uwinnipeg.ca/dist/XML-LibXML">Perl bindings</a></li>
404 <li><a href="http://libxmlplusplus.sourceforge.net/">C++ bindings</a></li>
405 <li><a href="http://www.zend.com/php5/articles/php5-xmlphp.php#Heading4">PHP bindings</a></li>
406 <li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li>
407 <li><a href="http://libxml.rubyforge.org/">Ruby bindings</a></li>
408 <li><a href="http://tclxml.sourceforge.net/">Tcl bindings</a></li>
409 <li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxml2">Bug Tracker</a></li>
412 <xsl:template name="toc">
413 <table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000">
416 <table width="100%" border="0" cellspacing="1" cellpadding="3">
418 <td colspan="1" bgcolor="#eecfa1" align="center">
420 <b><xsl:value-of select="$menu_name"/></b>
425 <td bgcolor="#fffacd">
426 <xsl:copy-of select="$toc"/>
430 <table width="100%" border="0" cellspacing="1" cellpadding="3">
432 <td colspan="1" bgcolor="#eecfa1" align="center">
439 <td bgcolor="#fffacd">
440 <xsl:copy-of select="$related"/>
448 <xsl:template name="develtoc">
449 <table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000">
452 <table width="100%" border="0" cellspacing="1" cellpadding="3">
454 <td colspan="1" bgcolor="#eecfa1" align="center">
456 <b>Developer Menu</b>
461 <td bgcolor="#fffacd">
462 <xsl:copy-of select="$develtoc"/>
466 <table width="100%" border="0" cellspacing="1" cellpadding="3">
468 <td colspan="1" bgcolor="#eecfa1" align="center">
475 <td bgcolor="#fffacd">
476 <xsl:copy-of select="$api"/>
480 <table width="100%" border="0" cellspacing="1" cellpadding="3">
482 <td colspan="1" bgcolor="#eecfa1" align="center">
489 <td bgcolor="#fffacd">
490 <xsl:copy-of select="$related"/>
498 <xsl:template mode="head" match="title">
500 <xsl:apply-templates/>
503 <xsl:template mode="head" match="meta">
506 - Write the styles in the head
508 <xsl:template name="style">
509 <link rel="SHORTCUT ICON" href="/favicon.ico"/>
510 <style type="text/css">
511 TD {font-family: Verdana,Arial,Helvetica}
512 BODY {font-family: Verdana,Arial,Helvetica; margin-top: 2em; margin-left: 0em; margin-right: 0em}
513 H1 {font-family: Verdana,Arial,Helvetica}
514 H2 {font-family: Verdana,Arial,Helvetica}
515 H3 {font-family: Verdana,Arial,Helvetica}
516 A:link, A:visited, A:active { text-decoration: underline }
520 - Write the title box on top
522 <xsl:template name="titlebox">
523 <xsl:param name="title" select="'Main Page'"/>
524 <table border="0" width="100%" cellpadding="5" cellspacing="0" align="center">
527 <a href="http://swpat.ffii.org/"><img src="{$href_base}epatents.png" alt="Action against software patents"/></a>
530 <a href="http://www.gnome.org/"><img src="{$href_base}gnome2.png" alt="Gnome2 Logo"/></a>
531 <a href="http://www.w3.org/Status"><img src="{$href_base}w3c.png" alt="W3C Logo"/></a>
532 <a href="http://www.redhat.com/"><img src="{$href_base}redhat.gif" alt="Red Hat Logo"/></a>
534 <a href="http://xmlsoft.org/"><img src="{$href_base}Libxml2-Logo-180x168.gif" alt="Made with Libxml2 Logo"/></a>
538 <table border="0" width="90%" cellpadding="2" cellspacing="0" align="center" bgcolor="#000000">
541 <table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#fffacd">
544 <xsl:element name="h1">
545 <xsl:value-of select="$globaltitle"/>
547 <xsl:element name="h2">
548 <xsl:value-of select="$title"/>
561 - Handling of nodes in the body before the first H2, table of content
562 - Everything is just copied over, except href which may get rewritten
563 - and h1/h2/a at the top level
565 <xsl:template priority="2" mode="subcontent" match="a">
566 <xsl:variable name="filename">
567 <xsl:call-template name="filename">
568 <xsl:with-param name="name" select="string(@href)"/>
572 <xsl:attribute name="href">
573 <xsl:value-of select="$filename"/>
575 <xsl:apply-templates mode="subcontent" select="node()"/>
578 <xsl:template mode="subcontent" match="@*|node()">
580 <xsl:apply-templates mode="subcontent" select="@*|node()"/>
583 <xsl:template mode="content" match="@*|node()">
584 <xsl:if test="name() != 'h1' and name() != 'h2'">
586 <xsl:apply-templates mode="subcontent" select="@*|node()"/>
591 - Handling of nodes in the body after an H2
592 - Open a new file and dump all the siblings up to the next H2
594 <xsl:template name="subfile">
595 <xsl:param name="header" select="following-sibling::h2[1]"/>
596 <xsl:variable name="filename">
597 <xsl:call-template name="filename">
598 <xsl:with-param name="name" select="concat('#', string($header/a[1]/@name))"/>
601 <xsl:variable name="tocfilename">
602 <xsl:call-template name="tocfilename">
603 <xsl:with-param name="name" select="concat('#', string($header/a[1]/@name))"/>
606 <xsl:variable name="title">
607 <xsl:value-of select="$header"/>
609 <xsl:document href="{$filename}" method="xml" encoding="UTF-8"
610 doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
611 doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
614 <xsl:call-template name="style"/>
615 <xsl:element name="title">
616 <xsl:value-of select="$title"/>
619 <body bgcolor="#8b7765" text="#000000" link="#a06060" vlink="#000000">
620 <xsl:call-template name="titlebox">
621 <xsl:with-param name="title" select="$title"/>
623 <table border="0" cellpadding="4" cellspacing="0" width="100%" align="center">
625 <td bgcolor="#8b7765">
626 <table border="0" cellspacing="0" cellpadding="2" width="100%">
628 <td valign="top" width="200" bgcolor="#8b7765">
630 <xsl:when test="$filename = 'docs.html'">
631 <xsl:call-template name="develtoc"/>
633 <xsl:when test="$tocfilename = ''">
634 <xsl:call-template name="develtoc"/>
637 <xsl:call-template name="toc"/>
641 <td valign="top" bgcolor="#8b7765">
642 <table border="0" cellspacing="0" cellpadding="1" width="100%">
645 <table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000">
648 <table border="0" cellpadding="3" cellspacing="1" width="100%">
650 <td bgcolor="#fffacd">
651 <xsl:apply-templates mode="subfile" select="$header/following-sibling::*[preceding-sibling::h2[1] = $header and name() != 'h2' ]"/>
652 <p><a href="bugs.html">Daniel Veillard</a></p>
672 <xsl:template mode="subfile" match="@*|node()">
674 <xsl:apply-templates mode="content" select="@*|node()"/>
678 - Handling of the initial body and head HTML document
680 <xsl:template match="body">
681 <xsl:variable name="firsth2" select="./h2[1]"/>
682 <xsl:variable name="rest2" select="./h2[position()>1]"/>
683 <body bgcolor="#8b7765" text="#000000" link="#a06060" vlink="#000000">
684 <xsl:call-template name="titlebox">
685 <xsl:with-param name="title" select="'libxml'"/>
687 <table border="0" cellpadding="4" cellspacing="0" width="100%" align="center">
689 <td bgcolor="#8b7765">
690 <table border="0" cellspacing="0" cellpadding="2" width="100%">
692 <td valign="top" width="200" bgcolor="#8b7765">
693 <xsl:call-template name="toc"/>
695 <td valign="top" bgcolor="#8b7765">
696 <table border="0" cellspacing="0" cellpadding="1" width="100%">
699 <table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000">
702 <table border="0" cellpadding="3" cellspacing="1" width="100%">
704 <td bgcolor="#fffacd">
705 <xsl:apply-templates mode="content" select="($firsth2/preceding-sibling::*)"/>
706 <xsl:for-each select="./h2">
707 <xsl:call-template name="subfile">
708 <xsl:with-param name="header" select="."/>
711 <p><a href="bugs.html">Daniel Veillard</a></p>
729 <xsl:template match="head">
731 <xsl:call-template name="style"/>
732 <xsl:apply-templates mode="head"/>
735 <xsl:template match="html">
736 <xsl:message>Generating the Web pages</xsl:message>
738 <xsl:apply-templates/>