3 This stylesheet is imported by the other stylesheets (e.g. newapi.xsl
4 and api.xsl). For flexibility, it depends upon a global param
5 which is normally defined in the importing stylesheet. This is:
6 href_base The most superior documentation directory (e.g. XML/)
8 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
9 <xsl:output method="xml" encoding="ISO-8859-1" indent="yes"
10 doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
11 doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
13 <!-- dirname is used to 'choose' between libxslt and libexslt -->
14 <xsl:param name="dirname" select="''"/>
15 <!-- libname is the name of the library being documented -->
16 <xsl:param name="libname" select="libxslt"/>
17 <!-- logo_base points to the *.png logos used in headers -->
18 <xsl:param name="logo_base" select="''"/>
20 <!-- href_base gives the location of 'base documentation' files
21 and is often changed by importing stylesheets -->
22 <xsl:variable name="href_base" select="''"/>
25 - returns the filename associated to an ID in the original file
27 <xsl:template name="filename">
28 <xsl:param name="name" select="string(@href)"/>
30 <xsl:when test="$name = '#Introducti'">
31 <xsl:text>intro.html</xsl:text>
33 <xsl:when test="$name = '#Documentat'">
34 <xsl:text>docs.html</xsl:text>
36 <xsl:when test="$name = '#Reporting'">
37 <xsl:text>bugs.html</xsl:text>
39 <xsl:when test="$name = '#help'">
40 <xsl:text>help.html</xsl:text>
42 <xsl:when test="$name = '#Help'">
43 <xsl:text>help.html</xsl:text>
45 <xsl:when test="$name = '#Downloads'">
46 <xsl:text>downloads.html</xsl:text>
48 <xsl:when test="$name = '#News'">
49 <xsl:text>news.html</xsl:text>
51 <xsl:when test="$name = '#Contributi'">
52 <xsl:text>contribs.html</xsl:text>
54 <xsl:when test="$name = '#xsltproc'">
55 <xsl:text>xsltproc2.html</xsl:text>
57 <xsl:when test="$name = '#API'">
58 <xsl:text>API.html</xsl:text>
60 <xsl:when test="$name = '#Extensions'">
61 <xsl:text>extensions.html</xsl:text>
63 <xsl:when test="$name = '#Internals'">
64 <xsl:text>internals.html</xsl:text>
66 <xsl:when test="$name = '#DocBook'">
67 <xsl:text>docbook.html</xsl:text>
69 <xsl:when test="$name = '#FAQ'">
70 <xsl:text>FAQ.html</xsl:text>
72 <xsl:when test="$name = '#Python'">
73 <xsl:text>python.html</xsl:text>
75 <xsl:when test="$name = ''">
76 <xsl:text>unknown.html</xsl:text>
79 <xsl:value-of select="$name"/>
84 - The table of content
86 <xsl:variable name="toc">
87 <form action="search.php"
88 enctype="application/x-www-form-urlencoded" method="get">
89 <input name="query" type="text" size="20" value=""/>
90 <input name="submit" type="submit" value="Search ..."/>
93 <li><a href="index.html">Home</a></li>
94 <xsl:for-each select="/html/body/h2">
95 <xsl:variable name="filename">
96 <xsl:call-template name="filename">
97 <xsl:with-param name="name" select="concat('#', string(a[1]/@name))"/>
101 <xsl:element name="a">
102 <xsl:attribute name="href">
103 <xsl:value-of select="$filename"/>
105 <xsl:value-of select="."/>
111 <xsl:when test="$dirname != ''">
112 <li><a href="{$href_base}index.html" style="font-weight:bold">libxslt</a></li>
115 <li><a href="EXSLT/index.html" style="font-weight:bold">libexslt</a></li>
116 <li><a href="xslt.html">flat page</a>, <a href="site.xsl">stylesheet</a></li>
120 <li><a href="html/index.html" style="font-weight:bold">API Menu</a></li>
123 <xsl:variable name="api">
125 <li><a href="{$href_base}APIchunk0.html">Alphabetic</a></li>
126 <li><a href="{$href_base}APIconstructors.html">Constructors</a></li>
127 <li><a href="{$href_base}APIfunctions.html">Functions/Types</a></li>
128 <li><a href="{$href_base}APIfiles.html">Modules</a></li>
129 <li><a href="{$href_base}APIsymbols.html">Symbols</a></li>
132 <xsl:variable name="related">
135 <xsl:when test="$dirname = ''">
136 <li><a href="{$href_base}tutorial/libxslttutorial.html">Tutorial</a></li>
137 <li><a href="{$href_base}xsltproc.html">Man page for xsltproc</a></li>
140 <li><a href="http://mail.gnome.org/archives/xslt/">Mail archive</a></li>
141 <li><a href="http://xmlsoft.org/">XML libxml</a></li>
142 <li><a href="http://phd.cs.unibo.it/gdome2/">DOM gdome2</a></li>
143 <li><a href="ftp://xmlsoft.org/">FTP</a></li>
144 <li><a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li>
145 <li><a href="http://garypennington.net/libxml2/">Solaris binaries</a></li>
146 <li><a href="http://www.zveno.com/open_source/libxml2xslt.html">MacOsX binaries</a></li>
147 <li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li>
148 <li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxslt">Bug Tracker</a></li>
149 <li><a href="http://xsldbg.sourceforge.net/">Xsldbg Debugger</a></li>
150 <li><a href="http://www.mod-xslt.com/mod-xslt/">Apache module</a></li>
153 <xsl:template name="develtoc">
154 <table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000">
157 <table width="100%" border="0" cellspacing="1" cellpadding="3">
159 <td colspan="1" bgcolor="#eecfa1" align="center">
166 <td bgcolor="#fffacd">
167 <xsl:copy-of select="$toc"/>
171 <table width="100%" border="0" cellspacing="1" cellpadding="3">
173 <td colspan="1" bgcolor="#eecfa1" align="center">
180 <td bgcolor="#fffacd">
181 <xsl:copy-of select="$related"/>
185 <table width="100%" border="0" cellspacing="1" cellpadding="3">
187 <td colspan="1" bgcolor="#eecfa1" align="center">
194 <td bgcolor="#fffacd">
195 <xsl:copy-of select="$api"/>
203 <xsl:template mode="head" match="title">
205 <xsl:apply-templates/>
208 <xsl:template mode="head" match="meta">
213 <xsl:variable name="globaltitle" select="string(/html/body/h1[1])"/>
215 - Write the styles in the head
217 <xsl:template name="style">
218 <style type="text/css">
219 TD {font-family: Verdana,Arial,Helvetica}
220 BODY {font-family: Verdana,Arial,Helvetica; margin-top: 2em; margin-left: 0em; margin-right: 0em}
221 H1 {font-family: Verdana,Arial,Helvetica}
222 H2 {font-family: Verdana,Arial,Helvetica}
223 H3 {font-family: Verdana,Arial,Helvetica}
224 A:link, A:visited, A:active { text-decoration: underline }
228 - Write the title box on top
230 <xsl:template name="titlebox">
231 <xsl:param name="title" select="'Main Page'"/>
232 <table border="0" width="100%" cellpadding="5" cellspacing="0" align="center">
235 <a href="http://swpat.ffii.org/"><img src="{$logo_base}epatents.png" alt="Action against software patents"/></a>
238 <a href="http://www.gnome.org/"><img src="{$logo_base}gnome2.png" alt="Gnome2 Logo"/></a>
239 <a href="http://www.redhat.com"><img src="{$logo_base}redhat.gif" alt="Red Hat Logo"/></a>
241 <a href="http://xmlsoft.org/XSLT/"><img src="{$logo_base}Libxslt-Logo-180x168.gif" alt="Made with Libxslt Logo"/></a>
245 <table border="0" width="90%" cellpadding="2" cellspacing="0" align="center" bgcolor="#000000">
248 <table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#fffacd">
251 <xsl:element name="h1">
252 <xsl:value-of select="$globaltitle"/>
254 <xsl:element name="h2">
255 <xsl:value-of select="$title"/>
268 - Handling of nodes in the body before the first H2, table of content
269 - Everything is just copied over, except href which may get rewritten
270 - and h1/h2/a at the top level
272 <xsl:template priority="2" mode="subcontent" match="a">
273 <xsl:variable name="filename">
274 <xsl:call-template name="filename">
275 <xsl:with-param name="name" select="string(@href)"/>
279 <xsl:attribute name="href">
280 <xsl:value-of select="$filename"/>
282 <xsl:apply-templates mode="subcontent" select="node()"/>
285 <xsl:template mode="subcontent" match="@*|node()">
287 <xsl:apply-templates mode="subcontent" select="@*|node()"/>
290 <xsl:template mode="content" match="@*|node()">
291 <xsl:if test="name() != 'h1' and name() != 'h2'">
293 <xsl:apply-templates mode="subcontent" select="@*|node()"/>
298 - Handling of nodes in the body after an H2
299 - Open a new file and dump all the siblings up to the next H2
301 <xsl:template name="subfile">
302 <xsl:param name="header" select="following-sibling::h2[1]"/>
303 <xsl:variable name="filename">
304 <xsl:call-template name="filename">
305 <xsl:with-param name="name" select="concat('#', string($header/a[1]/@name))"/>
308 <xsl:variable name="title">
309 <xsl:value-of select="$header"/>
311 <xsl:document href="{$dirname}{$filename}" method="xml" encoding="ISO-8859-1"
312 doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
313 doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
316 <xsl:call-template name="style"/>
317 <xsl:element name="title">
318 <xsl:value-of select="$title"/>
321 <body bgcolor="#8b7765" text="#000000" link="#000000" vlink="#000000">
322 <xsl:call-template name="titlebox">
323 <xsl:with-param name="title" select="$title"/>
325 <table border="0" cellpadding="4" cellspacing="0" width="100%" align="center">
327 <td bgcolor="#8b7765">
328 <table border="0" cellspacing="0" cellpadding="2" width="100%">
330 <td valign="top" width="200" bgcolor="#8b7765">
331 <xsl:call-template name="develtoc"/>
333 <td valign="top" bgcolor="#8b7765">
334 <table border="0" cellspacing="0" cellpadding="1" width="100%">
337 <table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000">
340 <table border="0" cellpadding="3" cellspacing="1" width="100%">
342 <td bgcolor="#fffacd">
343 <xsl:apply-templates mode="subfile" select="$header/following-sibling::*[preceding-sibling::h2[1] = $header and name() != 'h2' ]"/>
344 <p><a href="bugs.html">Daniel Veillard</a></p>
364 <xsl:template mode="subfile" match="@*|node()">
366 <xsl:apply-templates mode="content" select="@*|node()"/>
370 - Handling of the initial body and head HTML document
372 <xsl:template match="body">
373 <xsl:variable name="firsth2" select="./h2[1]"/>
374 <xsl:variable name="rest2" select="./h2[position()>1]"/>
375 <body bgcolor="#8b7765" text="#000000" link="#000000" vlink="#000000">
376 <xsl:call-template name="titlebox">
377 <xsl:with-param name="title" select="$libname"/>
379 <table border="0" cellpadding="4" cellspacing="0" width="100%" align="center">
381 <td bgcolor="#8b7765">
382 <table border="0" cellspacing="0" cellpadding="2" width="100%">
384 <td valign="top" width="200" bgcolor="#8b7765">
385 <xsl:call-template name="develtoc"/>
387 <td valign="top" bgcolor="#8b7765">
388 <table border="0" cellspacing="0" cellpadding="1" width="100%">
391 <table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000">
394 <table border="0" cellpadding="3" cellspacing="1" width="100%">
396 <td bgcolor="#fffacd">
397 <xsl:apply-templates mode="content" select="($firsth2/preceding-sibling::*)"/>
398 <xsl:for-each select="./h2">
399 <xsl:call-template name="subfile">
400 <xsl:with-param name="header" select="."/>
403 <p><a href="bugs.html">Daniel Veillard</a></p>
421 <xsl:template match="head">
423 <xsl:call-template name="style"/>
424 <xsl:apply-templates mode="head"/>
427 <xsl:template match="html">
429 <xsl:apply-templates/>