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"/>
6 - returns the filename associated to an ID in the original file
8 <xsl:template name="filename">
9 <xsl:param name="name" select="string(@href)"/>
11 <xsl:when test="$name = '#Introducti'">
12 <xsl:text>intro.html</xsl:text>
14 <xsl:when test="$name = '#Documentat'">
15 <xsl:text>docs.html</xsl:text>
17 <xsl:when test="$name = '#Reporting'">
18 <xsl:text>bugs.html</xsl:text>
20 <xsl:when test="$name = '#help'">
21 <xsl:text>help.html</xsl:text>
23 <xsl:when test="$name = '#Help'">
24 <xsl:text>help.html</xsl:text>
26 <xsl:when test="$name = '#Downloads'">
27 <xsl:text>downloads.html</xsl:text>
29 <xsl:when test="$name = '#News'">
30 <xsl:text>news.html</xsl:text>
32 <xsl:when test="$name = '#Contributi'">
33 <xsl:text>contribs.html</xsl:text>
35 <xsl:when test="$name = '#xsltproc'">
36 <xsl:text>xsltproc2.html</xsl:text>
38 <xsl:when test="$name = '#API'">
39 <xsl:text>API.html</xsl:text>
41 <xsl:when test="$name = '#XSLT'">
42 <xsl:text>XSLT.html</xsl:text>
44 <xsl:when test="$name = '#XML'">
45 <xsl:text>XMLinfo.html</xsl:text>
47 <xsl:when test="$name = '#Validation'">
48 <xsl:text>xmldtd.html</xsl:text>
50 <xsl:when test="$name = '#tree'">
51 <xsl:text>tree.html</xsl:text>
53 <xsl:when test="$name = '#library'">
54 <xsl:text>library.html</xsl:text>
56 <xsl:when test="$name = '#interface'">
57 <xsl:text>interface.html</xsl:text>
59 <xsl:when test="$name = '#Example'">
60 <xsl:text>example.html</xsl:text>
62 <xsl:when test="$name = '#Entities'">
63 <xsl:text>entities.html</xsl:text>
65 <xsl:when test="$name = '#architecture'">
66 <xsl:text>architecture.html</xsl:text>
68 <xsl:when test="$name = '#Namespaces'">
69 <xsl:text>namespaces.html</xsl:text>
71 <xsl:when test="$name = '#DOM'">
72 <xsl:text>DOM.html</xsl:text>
74 <xsl:when test="$name = '#Catalog'">
75 <xsl:text>catalog.html</xsl:text>
77 <xsl:when test="$name = '#Upgrading'">
78 <xsl:text>upgrade.html</xsl:text>
80 <xsl:when test="$name = '#Encodings'">
81 <xsl:text>encoding.html</xsl:text>
83 <xsl:when test="$name = '#IO'">
84 <xsl:text>xmlio.html</xsl:text>
86 <xsl:when test="$name = '#Memory'">
87 <xsl:text>xmlmem.html</xsl:text>
89 <xsl:when test="$name = '#Thread'">
90 <xsl:text>threads.html</xsl:text>
92 <xsl:when test="$name = '#FAQ'">
93 <xsl:text>FAQ.html</xsl:text>
95 <xsl:when test="$name = '#Python'">
96 <xsl:text>python.html</xsl:text>
98 <xsl:when test="$name = ''">
99 <xsl:text>unknown.html</xsl:text>
102 <xsl:value-of select="$name"/>
109 <xsl:variable name="globaltitle" select="string(/html/body/h1[1])"/>
111 - The table of content
113 <xsl:variable name="toc">
114 <form action="search.php"
115 enctype="application/x-www-form-urlencoded" method="GET">
116 <input name="query" type="TEXT" size="20" value=""/>
117 <input name="submit" type="submit" value="Search ..."/>
119 <ul><!-- style="margin-left: -1em" -->
120 <li><a href="index.html">Home</a></li>
121 <xsl:for-each select="/html/body/h2">
122 <xsl:variable name="filename">
123 <xsl:call-template name="filename">
124 <xsl:with-param name="name" select="concat('#', string(a[1]/@name))"/>
128 <xsl:element name="a">
129 <xsl:attribute name="href">
130 <xsl:value-of select="$filename"/>
132 <xsl:value-of select="."/>
136 <li><a href="xmlreader.html">The Reader Interface</a></li>
137 <li><a href="tutorial/index.html">Tutorial</a></li>
138 <li><a href="guidelines.html">XML Guidelines</a></li>
139 <li><a href="xml.html">flat page</a>, <a href="site.xsl">stylesheet</a></li>
142 <xsl:variable name="api">
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>
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>
165 <xsl:template name="toc">
166 <table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000">
169 <table width="100%" border="0" cellspacing="1" cellpadding="3">
171 <td colspan="1" bgcolor="#eecfa1" align="center">
178 <td bgcolor="#fffacd">
179 <xsl:copy-of select="$toc"/>
183 <table width="100%" border="0" cellspacing="1" cellpadding="3">
185 <td colspan="1" bgcolor="#eecfa1" align="center">
192 <td bgcolor="#fffacd">
193 <xsl:copy-of select="$related"/>
197 <table width="100%" border="0" cellspacing="1" cellpadding="3">
199 <td colspan="1" bgcolor="#eecfa1" align="center">
206 <td bgcolor="#fffacd">
207 <xsl:copy-of select="$api"/>
215 <xsl:template mode="head" match="title">
217 <xsl:apply-templates/>
220 <xsl:template mode="head" match="meta">
223 - Write the styles in the head
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>
237 - Write the title box on top
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">
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>
248 <a href="http://xmlsoft.org/"><img src="Libxml2-Logo-180x168.gif" alt="Made with Libxml2 Logo"/></a>
252 <table border="0" width="90%" cellpadding="2" cellspacing="0" align="center" bgcolor="#000000">
255 <table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#fffacd">
258 <xsl:element name="h1">
259 <xsl:value-of select="$globaltitle"/>
261 <xsl:element name="h2">
262 <xsl:value-of select="$title"/>
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
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)"/>
286 <xsl:attribute name="href">
287 <xsl:value-of select="$filename"/>
289 <xsl:apply-templates mode="subcontent" select="node()"/>
292 <xsl:template mode="subcontent" match="@*|node()">
294 <xsl:apply-templates mode="subcontent" select="@*|node()"/>
297 <xsl:template mode="content" match="@*|node()">
298 <xsl:if test="name() != 'h1' and name() != 'h2'">
300 <xsl:apply-templates mode="subcontent" select="@*|node()"/>
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
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))"/>
315 <xsl:variable name="title">
316 <xsl:value-of select="$header"/>
318 <xsl:document href="{$filename}" method="html" version="4.01" encoding="ISO-8859-1">
321 <xsl:call-template name="style"/>
322 <xsl:element name="title">
323 <xsl:value-of select="$title"/>
326 <body bgcolor="#8b7765" text="#000000" link="#000000" vlink="#000000">
327 <xsl:call-template name="titlebox">
328 <xsl:with-param name="title" select="$title"/>
330 <table border="0" cellpadding="4" cellspacing="0" width="100%" align="center">
332 <td bgcolor="#8b7765">
333 <table border="0" cellspacing="0" cellpadding="2" width="100%">
335 <td valign="top" width="200" bgcolor="#8b7765">
336 <xsl:call-template name="toc"/>
338 <td valign="top" bgcolor="#8b7765">
339 <table border="0" cellspacing="0" cellpadding="1" width="100%">
342 <table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000">
345 <table border="0" cellpadding="3" cellspacing="1" width="100%">
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>
369 <xsl:template mode="subfile" match="@*|node()">
371 <xsl:apply-templates mode="content" select="@*|node()"/>
375 - Handling of the initial body and head HTML document
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'"/>
384 <table border="0" cellpadding="4" cellspacing="0" width="100%" align="center">
386 <td bgcolor="#8b7765">
387 <table border="0" cellspacing="0" cellpadding="2" width="100%">
389 <td valign="top" width="200" bgcolor="#8b7765">
390 <xsl:call-template name="toc"/>
392 <td valign="top" bgcolor="#8b7765">
393 <table border="0" cellspacing="0" cellpadding="1" width="100%">
396 <table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000">
399 <table border="0" cellpadding="3" cellspacing="1" width="100%">
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="."/>
408 <p><a href="bugs.html">Daniel Veillard</a></p>
426 <xsl:template match="head">
428 <xsl:call-template name="style"/>
429 <xsl:apply-templates mode="head"/>
432 <xsl:template match="html">
433 <xsl:message>Generating the Web pages</xsl:message>
435 <xsl:apply-templates/>