source: trunk/third/libxslt/doc/site.xsl @ 19102

Revision 19102, 14.2 KB checked in by ghudson, 21 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r19101, which included commits to RCS files with non-trunk default branches.
Line 
1<?xml version="1.0"?>
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"/>
4<!--
5 - returns the filename associated to an ID in the original file
6 -->
7  <xsl:template name="filename">
8    <xsl:param name="name" select="string(@href)"/>
9    <xsl:choose>
10      <xsl:when test="$name = '#Introducti'">
11        <xsl:text>intro.html</xsl:text>
12      </xsl:when>
13      <xsl:when test="$name = '#Documentat'">
14        <xsl:text>docs.html</xsl:text>
15      </xsl:when>
16      <xsl:when test="$name = '#Reporting'">
17        <xsl:text>bugs.html</xsl:text>
18      </xsl:when>
19      <xsl:when test="$name = '#help'">
20        <xsl:text>help.html</xsl:text>
21      </xsl:when>
22      <xsl:when test="$name = '#Help'">
23        <xsl:text>help.html</xsl:text>
24      </xsl:when>
25      <xsl:when test="$name = '#Downloads'">
26        <xsl:text>downloads.html</xsl:text>
27      </xsl:when>
28      <xsl:when test="$name = '#News'">
29        <xsl:text>news.html</xsl:text>
30      </xsl:when>
31      <xsl:when test="$name = '#Contributi'">
32        <xsl:text>contribs.html</xsl:text>
33      </xsl:when>
34      <xsl:when test="$name = '#xsltproc'">
35        <xsl:text>xsltproc2.html</xsl:text>
36      </xsl:when>
37      <xsl:when test="$name = '#API'">
38        <xsl:text>API.html</xsl:text>
39      </xsl:when>
40      <xsl:when test="$name = '#Extensions'">
41        <xsl:text>extensions.html</xsl:text>
42      </xsl:when>
43      <xsl:when test="$name = '#Internals'">
44        <xsl:text>internals.html</xsl:text>
45      </xsl:when>
46      <xsl:when test="$name = '#DocBook'">
47        <xsl:text>docbook.html</xsl:text>
48      </xsl:when>
49      <xsl:when test="$name = '#FAQ'">
50        <xsl:text>FAQ.html</xsl:text>
51      </xsl:when>
52      <xsl:when test="$name = '#Python'">
53        <xsl:text>python.html</xsl:text>
54      </xsl:when>
55      <xsl:when test="$name = ''">
56        <xsl:text>unknown.html</xsl:text>
57      </xsl:when>
58      <xsl:otherwise>
59        <xsl:value-of select="$name"/>
60      </xsl:otherwise>
61    </xsl:choose>
62  </xsl:template>
63<!--
64 - The table of content
65 -->
66  <xsl:variable name="toc">
67    <form action="search.php"
68          enctype="application/x-www-form-urlencoded" method="GET">
69      <input name="query" type="TEXT" size="20" value=""/>
70      <input name="submit" type="submit" value="Search ..."/>
71    </form>
72    <ul>
73      <li><a href="index.html">Home</a></li>
74      <xsl:for-each select="/html/body/h2">
75        <xsl:variable name="filename">
76          <xsl:call-template name="filename">
77            <xsl:with-param name="name" select="concat('#', string(a[1]/@name))"/>
78          </xsl:call-template>
79        </xsl:variable>
80        <li>
81          <xsl:element name="a">
82            <xsl:attribute name="href">
83              <xsl:value-of select="$filename"/>
84            </xsl:attribute>
85            <xsl:value-of select="."/>
86          </xsl:element>
87        </li>
88      </xsl:for-each>
89      <li><a href="xslt.html">flat page</a>, <a href="site.xsl">stylesheet</a></li>
90    </ul>
91  </xsl:variable>
92  <xsl:variable name="api">
93    <ul>
94      <li><a href="APIchunk0.html">Alphabetic</a></li>
95      <li><a href="APIconstructors.html">Constructors</a></li>
96      <li><a href="APIfunctions.html">Functions/Types</a></li>
97      <li><a href="APIfiles.html">Modules</a></li>
98      <li><a href="APIsymbols.html">Symbols</a></li>
99    </ul>
100  </xsl:variable>
101  <xsl:variable name="related">
102    <ul>
103      <li><a href="tutorial/libxslttutorial.html">Tutorial</a></li>
104      <li><a href="xsltproc.html">Man page for xsltproc</a></li>
105      <li><a href="http://mail.gnome.org/archives/xslt/">Mail archive</a></li>
106      <li><a href="http://xmlsoft.org/">XML libxml</a></li>
107      <li><a href="http://phd.cs.unibo.it/gdome2/">DOM gdome2</a></li>
108      <li><a href="ftp://xmlsoft.org/">FTP</a></li>
109      <li><a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li>
110      <li><a href="http://garypennington.net/libxml2/">Solaris binaries</a></li>
111      <li><a href="http://www.zveno.com/open_source/libxml2xslt.html">MacOsX binaries</a></li>
112      <li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li>
113      <li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxslt">Bug Tracker</a></li>
114      <li><a href="http://xsldbg.sourceforge.net/">Xsldbg Debugger</a></li>
115      <li><a href="http://www.mod-xslt.com/mod-xslt/">Apache module</a></li>
116    </ul>
117  </xsl:variable>
118  <xsl:template name="toc">
119    <table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000">
120      <tr>
121        <td>
122          <table width="100%" border="0" cellspacing="1" cellpadding="3">
123            <tr>
124              <td colspan="1" bgcolor="#eecfa1" align="center">
125                <center>
126                  <b>Main Menu</b>
127                </center>
128              </td>
129            </tr>
130            <tr>
131              <td bgcolor="#fffacd">
132                <xsl:copy-of select="$toc"/>
133              </td>
134            </tr>
135          </table>
136          <table width="100%" border="0" cellspacing="1" cellpadding="3">
137            <tr>
138              <td colspan="1" bgcolor="#eecfa1" align="center">
139                <center>
140                  <b>Related links</b>
141                </center>
142              </td>
143            </tr>
144            <tr>
145              <td bgcolor="#fffacd">
146                <xsl:copy-of select="$related"/>
147              </td>
148            </tr>
149          </table>
150          <table width="100%" border="0" cellspacing="1" cellpadding="3">
151            <tr>
152              <td colspan="1" bgcolor="#eecfa1" align="center">
153                <center>
154                  <b>API Indexes</b>
155                </center>
156              </td>
157            </tr>
158            <tr>
159              <td bgcolor="#fffacd">
160                <xsl:copy-of select="$api"/>
161              </td>
162            </tr>
163          </table>
164        </td>
165      </tr>
166    </table>
167  </xsl:template>
168  <xsl:template mode="head" match="title">
169    <title>
170      <xsl:apply-templates/>
171    </title>
172  </xsl:template>
173  <xsl:template mode="head" match="meta">
174</xsl:template>
175<!--
176 - The global title
177 -->
178  <xsl:variable name="globaltitle" select="string(/html/body/h1[1])"/>
179<!--
180 - Write the styles in the head
181 -->
182  <xsl:template name="style">
183    <style type="text/css"><xsl:text disable-output-escaping="yes">&lt;!--</xsl:text>
184TD {font-family: Verdana,Arial,Helvetica}
185BODY {font-family: Verdana,Arial,Helvetica; margin-top: 2em; margin-left: 0em; margin-right: 0em}
186H1 {font-family: Verdana,Arial,Helvetica}
187H2 {font-family: Verdana,Arial,Helvetica}
188H3 {font-family: Verdana,Arial,Helvetica}
189A:link, A:visited, A:active { text-decoration: underline }
190<xsl:text disable-output-escaping="yes">--&gt;</xsl:text></style>
191  </xsl:template>
192<!--
193 - Write the title box on top
194 -->
195  <xsl:template name="titlebox">
196    <xsl:param name="title" select="'Main Page'"/>
197    <table border="0" width="100%" cellpadding="5" cellspacing="0" align="center">
198    <tr>
199    <td width="100">
200    <a href="http://www.gnome.org/"><img src="gnome2.png" alt="Gnome2 Logo"/></a>
201    <a href="http://www.redhat.com"><img src="redhat.gif" alt="Red Hat Logo"/></a>
202    <div align="left">
203    <a href="http://xmlsoft.org/XSLT/"><img src="Libxslt-Logo-180x168.gif" alt="Made with Libxslt Logo"/></a>
204    </div>
205    </td>
206    <td>
207    <table border="0" width="90%" cellpadding="2" cellspacing="0" align="center" bgcolor="#000000">
208      <tr>
209        <td>
210          <table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#fffacd">
211            <tr>
212              <td align="center">
213                <xsl:element name="h1">
214                  <xsl:value-of select="$globaltitle"/>
215                </xsl:element>
216                <xsl:element name="h2">
217                  <xsl:value-of select="$title"/>
218                </xsl:element>
219              </td>
220            </tr>
221          </table>
222        </td>
223      </tr>
224    </table>
225    </td>
226    </tr>
227    </table>
228  </xsl:template>
229<!--
230 - Handling of nodes in the body before the first H2, table of content
231 - Everything is just copied over, except href which may get rewritten
232 - and h1/h2/a at the top level
233 -->
234  <xsl:template priority="2" mode="subcontent" match="a">
235    <xsl:variable name="filename">
236      <xsl:call-template name="filename">
237        <xsl:with-param name="name" select="string(@href)"/>
238      </xsl:call-template>
239    </xsl:variable>
240    <xsl:copy>
241      <xsl:attribute name="href">
242        <xsl:value-of select="$filename"/>
243      </xsl:attribute>
244      <xsl:apply-templates mode="subcontent" select="node()"/>
245    </xsl:copy>
246  </xsl:template>
247  <xsl:template mode="subcontent" match="@*|node()">
248    <xsl:copy>
249      <xsl:apply-templates mode="subcontent" select="@*|node()"/>
250    </xsl:copy>
251  </xsl:template>
252  <xsl:template mode="content" match="@*|node()">
253    <xsl:if test="name() != 'h1' and name() != 'h2'">
254      <xsl:copy>
255        <xsl:apply-templates mode="subcontent" select="@*|node()"/>
256      </xsl:copy>
257    </xsl:if>
258  </xsl:template>
259<!--
260 - Handling of nodes in the body after an H2
261 - Open a new file and dump all the siblings up to the next H2
262 -->
263  <xsl:template name="subfile">
264    <xsl:param name="header" select="following-sibling::h2[1]"/>
265    <xsl:variable name="filename">
266      <xsl:call-template name="filename">
267        <xsl:with-param name="name" select="concat('#', string($header/a[1]/@name))"/>
268      </xsl:call-template>
269    </xsl:variable>
270    <xsl:variable name="title">
271      <xsl:value-of select="$header"/>
272    </xsl:variable>
273    <xsl:document href="{$filename}" method="html" version="4.01" encoding="ISO-8859-1">
274      <html>
275        <head>
276          <xsl:call-template name="style"/>
277          <xsl:element name="title">
278            <xsl:value-of select="$title"/>
279          </xsl:element>
280        </head>
281        <body bgcolor="#8b7765" text="#000000" link="#000000" vlink="#000000">
282          <xsl:call-template name="titlebox">
283            <xsl:with-param name="title" select="$title"/>
284          </xsl:call-template>
285          <table border="0" cellpadding="4" cellspacing="0" width="100%" align="center">
286            <tr>
287              <td bgcolor="#8b7765">
288                <table border="0" cellspacing="0" cellpadding="2" width="100%">
289                  <tr>
290                    <td valign="top" width="200" bgcolor="#8b7765">
291                      <xsl:call-template name="toc"/>
292                    </td>
293                    <td valign="top" bgcolor="#8b7765">
294                      <table border="0" cellspacing="0" cellpadding="1" width="100%">
295                        <tr>
296                          <td>
297                            <table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000">
298                              <tr>
299                                <td>
300                                  <table border="0" cellpadding="3" cellspacing="1" width="100%">
301                                    <tr>
302                                      <td bgcolor="#fffacd">
303                                        <xsl:apply-templates mode="subfile" select="$header/following-sibling::*[preceding-sibling::h2[1] = $header         and name() != 'h2' ]"/>
304                                        <p><a href="bugs.html">Daniel Veillard</a></p>
305                                      </td>
306                                    </tr>
307                                  </table>
308                                </td>
309                              </tr>
310                            </table>
311                          </td>
312                        </tr>
313                      </table>
314                    </td>
315                  </tr>
316                </table>
317              </td>
318            </tr>
319          </table>
320        </body>
321      </html>
322    </xsl:document>
323  </xsl:template>
324  <xsl:template mode="subfile" match="@*|node()">
325    <xsl:copy>
326      <xsl:apply-templates mode="content" select="@*|node()"/>
327    </xsl:copy>
328  </xsl:template>
329<!--
330 - Handling of the initial body and head HTML document
331 -->
332  <xsl:template match="body">
333    <xsl:variable name="firsth2" select="./h2[1]"/>
334    <xsl:variable name="rest2" select="./h2[position()&gt;1]"/>
335    <body bgcolor="#8b7765" text="#000000" link="#000000" vlink="#000000">
336      <xsl:call-template name="titlebox">
337        <xsl:with-param name="title" select="'libxslt'"/>
338      </xsl:call-template>
339      <table border="0" cellpadding="4" cellspacing="0" width="100%" align="center">
340        <tr>
341          <td bgcolor="#8b7765">
342            <table border="0" cellspacing="0" cellpadding="2" width="100%">
343              <tr>
344                <td valign="top" width="200" bgcolor="#8b7765">
345                  <xsl:call-template name="toc"/>
346                </td>
347                <td valign="top" bgcolor="#8b7765">
348                  <table border="0" cellspacing="0" cellpadding="1" width="100%">
349                    <tr>
350                      <td>
351                        <table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000">
352                          <tr>
353                            <td>
354                              <table border="0" cellpadding="3" cellspacing="1" width="100%">
355                                <tr>
356                                  <td bgcolor="#fffacd">
357                                    <xsl:apply-templates mode="content" select="($firsth2/preceding-sibling::*)"/>
358                                    <xsl:for-each select="./h2">
359                                      <xsl:call-template name="subfile">
360                                        <xsl:with-param name="header" select="."/>
361                                      </xsl:call-template>
362                                    </xsl:for-each>
363                                    <p><a href="bugs.html">Daniel Veillard</a></p>
364                                  </td>
365                                </tr>
366                              </table>
367                            </td>
368                          </tr>
369                        </table>
370                      </td>
371                    </tr>
372                  </table>
373                </td>
374              </tr>
375            </table>
376          </td>
377        </tr>
378      </table>
379    </body>
380  </xsl:template>
381  <xsl:template match="head">
382    <head>
383      <xsl:call-template name="style"/>
384      <xsl:apply-templates mode="head"/>
385    </head>
386  </xsl:template>
387  <xsl:template match="html">
388    <html>
389      <xsl:apply-templates/>
390    </html>
391  </xsl:template>
392</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.