Initial revision
[TestXSLT.git] / libxml2 / doc / search.php
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
5 <link rel="SHORTCUT ICON" href="/favicon.ico">
6 <style type="text/css"><!--
7 TD {font-family: Verdana,Arial,Helvetica}
8 BODY {font-family: Verdana,Arial,Helvetica; margin-top: 2em; margin-left: 0em; margin-right: 0em}
9 H1 {font-family: Verdana,Arial,Helvetica}
10 H2 {font-family: Verdana,Arial,Helvetica}
11 H3 {font-family: Verdana,Arial,Helvetica}
12 A:link, A:visited, A:active { text-decoration: underline }
13 --></style>
14 <title>Search the documentation on XMLSoft.org</title>
15 </head>
16 <body bgcolor="#8b7765" text="#000000" link="#000000" vlink="#000000">
17 <table border="0" width="100%" cellpadding="5" cellspacing="0" align="center"><tr>
18 <td width="180">
19 <a href="http://www.gnome.org/"><img src="gnome2.png" alt="Gnome2 Logo"></a><a href="http://www.w3.org/Status"><img src="w3c.png" alt="W3C Logo"></a><a href="http://www.redhat.com/"><img src="redhat.gif" alt="Red Hat Logo"></a><div align="left"><a href="http://xmlsoft.org/"><img src="Libxml2-Logo-180x168.gif" alt="Made with Libxml2 Logo"></a></div>
20 </td>
21 <td><table border="0" width="90%" cellpadding="2" cellspacing="0" align="center" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#fffacd"><tr><td align="center">
22 <h1>The XML C library for Gnome</h1>
23 <h2>Search engine</h2>
24 </td></tr></table></td></tr></table></td>
25 </tr></table>
26 <table border="0" cellpadding="4" cellspacing="0" width="100%" align="center"><tr><td bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="2" width="100%"><tr>
27 <td valign="top" width="200" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td>
28 <table width="100%" border="0" cellspacing="1" cellpadding="3">
29 <tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Main Menu</b></center></td></tr>
30 <tr><td bgcolor="#fffacd"><ul>
31 <li><a href="index.html">Home</a></li>
32 <li><a href="intro.html">Introduction</a></li>
33 <li><a href="FAQ.html">FAQ</a></li>
34 <li><a href="docs.html">Documentation</a></li>
35 <li><a href="bugs.html">Reporting bugs and getting help</a></li>
36 <li><a href="help.html">How to help</a></li>
37 <li><a href="downloads.html">Downloads</a></li>
38 <li><a href="news.html">News</a></li>
39 <li><a href="XMLinfo.html">XML</a></li>
40 <li><a href="XSLT.html">XSLT</a></li>
41 <li><a href="python.html">Python and bindings</a></li>
42 <li><a href="architecture.html">libxml architecture</a></li>
43 <li><a href="tree.html">The tree output</a></li>
44 <li><a href="interface.html">The SAX interface</a></li>
45 <li><a href="xmldtd.html">Validation &amp; DTDs</a></li>
46 <li><a href="xmlmem.html">Memory Management</a></li>
47 <li><a href="encoding.html">Encodings support</a></li>
48 <li><a href="xmlio.html">I/O Interfaces</a></li>
49 <li><a href="catalog.html">Catalog support</a></li>
50 <li><a href="library.html">The parser interfaces</a></li>
51 <li><a href="entities.html">Entities or no entities</a></li>
52 <li><a href="namespaces.html">Namespaces</a></li>
53 <li><a href="upgrade.html">Upgrading 1.x code</a></li>
54 <li><a href="threads.html">Thread safety</a></li>
55 <li><a href="DOM.html">DOM Principles</a></li>
56 <li><a href="example.html">A real example</a></li>
57 <li><a href="contribs.html">Contributions</a></li>
58 <li><a href="tutorial/index.html">Tutorial</a></li>
59 <li>
60 <a href="xml.html">flat page</a>, <a href="site.xsl">stylesheet</a>
61 </li>
62 </ul></td></tr>
63 </table>
64 <table width="100%" border="0" cellspacing="1" cellpadding="3">
65 <tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>API Indexes</b></center></td></tr>
66 <tr><td bgcolor="#fffacd"><ul>
67 <li><a href="APIchunk0.html">Alphabetic</a></li>
68 <li><a href="APIconstructors.html">Constructors</a></li>
69 <li><a href="APIfunctions.html">Functions/Types</a></li>
70 <li><a href="APIfiles.html">Modules</a></li>
71 <li><a href="APIsymbols.html">Symbols</a></li>
72 </ul></td></tr>
73 </table>
74 <table width="100%" border="0" cellspacing="1" cellpadding="3">
75 <tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Related links</b></center></td></tr>
76 <tr><td bgcolor="#fffacd"><ul>
77 <li><a href="http://mail.gnome.org/archives/xml/">Mail archive</a></li>
78 <li><a href="http://xmlsoft.org/XSLT/">XSLT libxslt</a></li>
79 <li><a href="http://phd.cs.unibo.it/gdome2/">DOM gdome2</a></li>
80 <li><a href="http://www.aleksey.com/xmlsec/">XML-DSig xmlsec</a></li>
81 <li><a href="ftp://xmlsoft.org/">FTP</a></li>
82 <li><a href="http://ww.zlatkovic.com/projects/libxml/">Windows binaries</a></li>
83 <li><a href="http://garypennington.net/libxml2/">Solaris binaries</a></li>
84 <li><a href="http://www.zveno.com/open_source/libxml2xslt.html">MacOsX binaries</a></li>
85 <li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li>
86 <li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxml&amp;product=libxml2">Bug Tracker</a></li>
87 </ul></td></tr>
88 </table>
89 </td></tr></table></td>
90 <td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd">
91 <?php
92     // We handle only the first argument so far
93     $query = ltrim ($query);
94     if (! $query) {
95         echo "<h1 align='center'>Search the documentation on XMLSoft.org</h1>";
96     }
97     if ($scope == NULL)
98         $scope = "any";
99     $scope = ltrim ($scope);
100     if ($scope == "")
101         $scope = "any";
102
103 ?>
104 <p> The search service indexes the libxml2 and libxslt APIs and documentation as well as the xml@gnome.org and xslt@gnome.org mailing-list archives. To use it simply provide a set of keywords:
105 <p>
106 <form action="<?php echo "$PHP_SELF", "?query=", rawurlencode($query) ?>"
107       enctype="application/x-www-form-urlencoded" method="GET">
108   <input name="query" type="TEXT" size="50" value="<?php echo $query?>">
109   <select name="scope">
110     <option value="any">Search All</option>
111     <option value="XML" <?php if ($scope == 'XML') print "selected"?>>XML resources</option>
112     <option value="XSLT" <?php if ($scope == 'XSLT') print "selected"?>>XSLT resources</option>
113     <option value="API" <?php if ($scope == 'API') print "selected"?>>Only the APIs</option>
114     <option value="XMLAPI" <?php if ($scope == 'XMLAPI') print "selected"?>>Only the XML API</option>
115     <option value="XSLTAPI" <?php if ($scope == 'XSLTAPI') print "selected"?>>Only the XSLT API</option>
116     <option value="DOCS" <?php if ($scope == 'DOCS') print "selected"?>>Only the Documentation</option>
117     <option value="XMLDOC" <?php if ($scope == 'XMLDOC') print "selected"?>>Only the XML Documentation</option>
118     <option value="XSLTDOC" <?php if ($scope == 'XSLTDOC') print "selected"?>>Only the XSLT Documentation</option>
119     <option value="LISTS" <?php if ($scope == 'LISTS') print "selected"?>>Only the lists archives</option>
120     <option value="XMLLIST" <?php if ($scope == 'XMLLIST') print "selected"?>>Only the XML list archive</option>
121     <option value="XSLTLIST" <?php if ($scope == 'XSLTLIST') print "selected"?>>Only the XSLT list archive</option>
122   </select>
123   <input name=submit type=submit value="Search ...">
124 </form>
125 <?php
126     function logQueryWord($word) {
127         $result = mysql_query ("SELECT ID,Count FROM Queries WHERE Value='$word'");
128         if ($result) {
129             $i = mysql_num_rows($result);
130             if ($i == 0) {
131                 mysql_free_result($result);
132                 mysql_query ("INSERT INTO Queries (Value,Count) VALUES ('$word',1)");
133             } else {
134                 $id = mysql_result($result, 0, 0);
135                 $count = mysql_result($result, 0, 1);
136                 $count ++;
137                 mysql_query ("UPDATE Queries SET Count=$count WHERE ID=$id");
138             }
139         } else {
140             mysql_query ("INSERT INTO Queries (Value,Count) VALUES ('$word',1)");
141         }
142     }
143     function queryWord($word) {
144         $result = NULL;
145         $j = 0;
146         if ($word) {
147             $result = mysql_query ("SELECT words.relevance, symbols.name, symbols.type, symbols.module, symbols.descr FROM words, symbols WHERE LCASE(words.name) LIKE LCASE('$word') and words.symbol = symbols.name ORDER BY words.relevance DESC LIMIT 75");
148             if ($result) {
149                 $j = mysql_num_rows($result);
150                 if ($j == 0) 
151                     mysql_free_result($result);
152             }
153             logQueryWord($word);
154         }
155         return array($result, $j);
156     }
157     function queryHTMLWord($word) {
158         $result = NULL;
159         $j = 0;
160         if ($word) {
161             $result = mysql_query ("SELECT relevance, name, id, resource, section FROM wordsHTML WHERE LCASE(name) LIKE LCASE('$word') ORDER BY relevance DESC LIMIT 75");
162             if ($result) {
163                 $j = mysql_num_rows($result);
164                 if ($j == 0) 
165                     mysql_free_result($result);
166             }
167             logQueryWord($word);
168         }
169         return array($result, $j);
170     }
171     function queryArchiveWord($word) {
172         $result = NULL;
173         $j = 0;
174         if ($word) {
175             $result = mysql_query ("SELECT wordsArchive.relevance, wordsArchive.name, 'xml-list', archives.resource, archives.title FROM wordsArchive, archives WHERE LCASE(wordsArchive.name) LIKE LCASE('$word') and wordsArchive.ID = archives.ID ORDER BY relevance DESC LIMIT 75");
176             if ($result) {
177                 $j = mysql_num_rows($result);
178                 if ($j == 0) 
179                     mysql_free_result($result);
180             }
181             logQueryWord($word);
182         }
183         return array($result, $j);
184     }
185     function XSLTqueryWord($word) {
186         $result = NULL;
187         $j = 0;
188         if ($word) {
189             $result = mysql_query ("SELECT XSLTwords.relevance, XSLTsymbols.name, XSLTsymbols.type, XSLTsymbols.module, XSLTsymbols.descr FROM XSLTwords, XSLTsymbols WHERE LCASE(XSLTwords.name) LIKE LCASE('$word') and XSLTwords.symbol = XSLTsymbols.name ORDER BY XSLTwords.relevance DESC LIMIT 75");
190             if ($result) {
191                 $j = mysql_num_rows($result);
192                 if ($j == 0) 
193                     mysql_free_result($result);
194             }
195             logQueryWord($word);
196         }
197         return array($result, $j);
198     }
199     function XSLTqueryHTMLWord($word) {
200         $result = NULL;
201         $j = 0;
202         if ($word) {
203             $result = mysql_query ("SELECT relevance, name, id, resource, section FROM XSLTwordsHTML WHERE LCASE(name) LIKE LCASE('$word') ORDER BY relevance DESC LIMIT 75");
204             if ($result) {
205                 $j = mysql_num_rows($result);
206                 if ($j == 0) 
207                     mysql_free_result($result);
208             }
209             logQueryWord($word);
210         }
211         return array($result, $j);
212     }
213     function XSLTqueryArchiveWord($word) {
214         $result = NULL;
215         $j = 0;
216         if ($word) {
217             $result = mysql_query ("SELECT XSLTwordsArchive.relevance, XSLTwordsArchive.name, 'xslt-list', archives.resource, archives.title FROM XSLTwordsArchive, archives WHERE LCASE(XSLTwordsArchive.name) LIKE LCASE('$word') and XSLTwordsArchive.ID = archives.ID ORDER BY relevance DESC LIMIT 75");
218             if ($result) {
219                 $j = mysql_num_rows($result);
220                 if ($j == 0) 
221                     mysql_free_result($result);
222             }
223             logQueryWord($word);
224         }
225         return array($result, $j);
226     }
227     function resSort ($a, $b) {
228         list($ra,$ta,$ma,$na,$da) = $a;
229         list($rb,$tb,$mb,$nb,$db) = $b;
230         if ($ra == $rb) return 0;
231         return ($ra > $rb) ? -1 : 1;
232     }
233     if (($query) && (strlen($query) <= 50)) {
234         $link = mysql_connect ("localhost", "nobody");
235         if (!$link) {
236             echo "<p> Could not connect to the database: ", mysql_error();
237         } else {
238             mysql_select_db("xmlsoft", $link);
239             $list = explode (" ", $query);
240             $results = array();
241             $number = 0;
242             for ($number = 0;$number < count($list);$number++) {
243
244                 $word = $list[$number];
245                 if (($scope == 'any') || ($scope == 'XML') ||
246                     ($scope == 'API') || ($scope == 'XMLAPI')) {
247                     list($result, $j) = queryWord($word);
248                     if ($j > 0) {
249                         for ($i = 0; $i < $j; $i++) {
250                             $relevance = mysql_result($result, $i, 0);
251                             $name = mysql_result($result, $i, 1);
252                             $type = mysql_result($result, $i, 2);
253                             $module = mysql_result($result, $i, 3);
254                             $desc = mysql_result($result, $i, 4);
255                             if (array_key_exists($name, $results)) {
256                                 list($r,$t,$m,$d,$w,$u) = $results[$name];
257                                 $results[$name] = array(($r + $relevance) * 2,
258                                                         $t,$m,$d,$w,$u);
259                             } else {
260                                 $id = strtoupper($name);
261                                 $m = strtolower($module);
262                                 $url = "html/libxml-$m.html#$id";
263                                 $results[$name] = array($relevance,$type,
264                                                 $module, $desc, $name, $url);
265                             }
266                         }
267                         mysql_free_result($result);
268                     }
269                 }
270                 if (($scope == 'any') || ($scope == 'XSLT') ||
271                     ($scope == 'API') || ($scope == 'XSLTAPI')) {
272                     list($result, $j) = XSLTqueryWord($word);
273                     if ($j > 0) {
274                         for ($i = 0; $i < $j; $i++) {
275                             $relevance = mysql_result($result, $i, 0);
276                             $name = mysql_result($result, $i, 1);
277                             $type = mysql_result($result, $i, 2);
278                             $module = mysql_result($result, $i, 3);
279                             $desc = mysql_result($result, $i, 4);
280                             if (array_key_exists($name, $results)) {
281                                 list($r,$t,$m,$d,$w,$u) = $results[$name];
282                                 $results[$name] = array(($r + $relevance) * 2,
283                                                         $t,$m,$d,$w,$u);
284                             } else {
285                                 $id = strtoupper($name);
286                                 $m = strtolower($module);
287                                 $url = "XSLT/html/libxslt-$m.html#$id";
288                                 $results[$name] = array($relevance,$type,
289                                                 $module, $desc, $name, $url);
290                             }
291                         }
292                         mysql_free_result($result);
293                     }
294                 }
295                 if (($scope == 'any') || ($scope == 'XML') ||
296                     ($scope == 'DOCS') || ($scope == 'XMLDOC')) {
297                     list($result, $k) = queryHTMLWord($word);
298                     if ($k > 0) {
299                         for ($i = 0; $i < $k; $i++) {
300                             $relevance = mysql_result($result, $i, 0);
301                             $name = mysql_result($result, $i, 1);
302                             $id = mysql_result($result, $i, 2);
303                             $module = mysql_result($result, $i, 3);
304                             $desc = mysql_result($result, $i, 4);
305                             $url = $module;
306                             if ($id != "") {
307                                 $url = $url + "#$id";
308                             }
309                             $results["$name _html_ $number _ $i"] =
310                                           array($relevance, "XML docs",
311                                                 $module, $desc, $name, $url);
312                         }
313                         mysql_free_result($result);
314                     }
315                 }
316                 if (($scope == 'any') || ($scope == 'XSLT') ||
317                     ($scope == 'DOCS') || ($scope == 'XSLTDOC')) {
318                     list($result, $k) = XSLTqueryHTMLWord($word);
319                     if ($k > 0) {
320                         for ($i = 0; $i < $k; $i++) {
321                             $relevance = mysql_result($result, $i, 0);
322                             $name = mysql_result($result, $i, 1);
323                             $id = mysql_result($result, $i, 2);
324                             $module = mysql_result($result, $i, 3);
325                             $desc = mysql_result($result, $i, 4);
326                             $url = "XSLT/$module";
327                             if ($id != "") {
328                                 $url = $url + "#$id";
329                             }
330                             $results["$name xslthtml $number _ $i "] =
331                                           array($relevance, "XSLT docs",
332                                                 $module, $desc, $name, $url);
333                         }
334                         mysql_free_result($result);
335                     }
336                 }
337                 if (($scope == 'any') || ($scope == 'XML') ||
338                     ($scope == 'LISTS') || ($scope == 'XMLLIST')) {
339                     list($result, $j) = queryArchiveWord($word);
340                     if ($j > 0) {
341                         for ($i = 0; $i < $j; $i++) {
342                             $relevance = mysql_result($result, $i, 0);
343                             $name = mysql_result($result, $i, 1);
344                             $type = mysql_result($result, $i, 2);
345                             $url = mysql_result($result, $i, 3);
346                             $desc = mysql_result($result, $i, 4);
347                             if (array_key_exists($url, $results)) {
348                                 list($r,$t,$m,$d,$w,$u) = $results[$url];
349                                 $results[$name] = array(($r + $relevance) * 2,
350                                                         $t,$m,$d,$w,$u);
351                             } else {
352                                 $id = strtoupper($name);
353                                 $m = strtolower($module);
354                                 $u = str_replace(
355                         "http://mail.gnome.org/archives/xml/", "", $url);
356                                 $results[$url] = array($relevance,$type,
357                                                 $u, $desc, $name, $url);
358                             }
359                         }
360                         mysql_free_result($result);
361                     }
362                 }
363                 if (($scope == 'any') || ($scope == 'XSLT') ||
364                     ($scope == 'LISTS') || ($scope == 'XSLTLIST')) {
365                     list($result, $j) = XSLTqueryArchiveWord($word);
366                     if ($j > 0) {
367                         for ($i = 0; $i < $j; $i++) {
368                             $relevance = mysql_result($result, $i, 0);
369                             $name = mysql_result($result, $i, 1);
370                             $type = mysql_result($result, $i, 2);
371                             $url = mysql_result($result, $i, 3);
372                             $desc = mysql_result($result, $i, 4);
373                             if (array_key_exists($url, $results)) {
374                                 list($r,$t,$m,$d,$w,$u) = $results[$url];
375                                 $results[$name] = array(($r + $relevance) * 2,
376                                                         $t,$m,$d,$w,$u);
377                             } else {
378                                 $id = strtoupper($name);
379                                 $m = strtolower($module);
380                                 $u = str_replace(
381                         "http://mail.gnome.org/archives/xslt/", "", $url);
382                                 $results[$url] = array($relevance,$type,
383                                                 $u, $desc, $name, $url);
384                             }
385                         }
386                         mysql_free_result($result);
387                     }
388                 }
389                 if (($j <= 0) && ($k <= 0)) {
390                     echo "<p> No result found for $word\n";
391                 }
392             }
393             mysql_close($link);
394             $nb = count($results);
395             echo "<h3 align='center'>Found $nb results for query $query</h3>\n";
396             usort($results, "resSort");
397
398             if ($nb > 0) {
399                 printf("<table><tbody>\n");
400                 printf("<tr><td>Quality</td><td>Symbol</td><td>Type</td><td>module</td><td>Description</td></tr>\n");
401                 $i = 0;
402                 while (list ($name, $val) = each ($results)) {
403                     list($r,$t,$m,$d,$s,$u) = $val;
404                     $m = str_replace("<", "&lt;", $m);
405                     $s = str_replace("<", "&lt;", $s);
406                     $d = str_replace("<", "&lt;", $d);
407                     echo "<tr><td>$r</td><td><a href='$u'>$s</a></td><td>$t</td><td>$m</td><td>$d</td></tr>";
408                     $i = $i + 1;
409                     if ($i > 75)
410                         break;
411                 }
412                 printf("</tbody></table>\n");
413             }
414         }
415     }
416 ?>
417
418 </td></tr></table></td></tr></table></td></tr></table></td>
419 </tr></table></td></tr></table>
420 </body>
421 </html>
422