You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

417 lines
15 KiB

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:srw="http://www.loc.gov/zing/srw/" xmlns:zr="http://explain.z3950.org/dtd/2.0/" xmlns:diag="http://www.loc.gov/zing/srw/diagnostic/" xmlns:refb="http://refbase.net/">
  3. <!-- Author: Rob Sanderson (azaroth@liv.ac.uk)
  4. Version: 0.6
  5. Last Updated: 27/11/2003
  6. Licence: GPL
  7. Modified by: Matthias Steffens (refbase@extracts.de) -->
  8. <xsl:output method="html" />
  9. <xsl:template match="/srw:explainResponse">
  10. <html>
  11. <head>
  12. <title>
  13. <xsl:value-of select="srw:record/srw:recordData/zr:explain/zr:databaseInfo/zr:title" />
  14. </title>
  15. <meta http-equiv="Content-Style-Type" content="text/css" />
  16. <link rel="stylesheet" href="css/style.css" type="text/css" title="CSS Definition" />
  17. <style type="text/css">
  18. /* H2 {font-family: sans-serif; color: #990000; background-color: #CCCCCC; padding-top: 10px; padding-bottom: 10px; border: 1px solid #CCCCCC }*/
  19. /* H3 {font-family: sans-serif; color: #990000; text-indent: 5px; border-left: solid 1px #CCCCCC; border-top: solid 1px #CCCCCC; padding-top: 5px }*/
  20. /* .paramTable { vertical-align: top; border: 1px solid; padding: 3px; border-collapse: collapse }*/
  21. /* .paramTable TD {border: 1px solid}*/
  22. /* TH {border: 1px solid; background-color: #eeeeff}*/
  23. </style>
  24. <script language="JavaScript" type="text/javascript">
  25. <xsl:text>
  26. function mungeForm() {
  27. inform = document.CQLForm;
  28. outform = document.SRUForm;
  29. max = inform.maxIndex.value;
  30. cql = "";
  31. prevIdx = 0;
  32. // Step through elements in form to create CQL
  33. for (var idx = 1; idx &lt;= max; idx++) {
  34. term = inform["term"+idx].value;
  35. if (term) {
  36. if (prevIdx) {
  37. cql += " " + inform["bool" + prevIdx].value + " ";
  38. }
  39. if (term.indexOf(' ')) {
  40. term = '"' + term + '"';
  41. }
  42. cql += inform["index" + idx].value + " " + inform["relat" + idx].value + " " + term;
  43. prevIdx = idx;
  44. }
  45. }
  46. if (!cql) {
  47. alert("At least one term is required to search.");
  48. return false;
  49. }
  50. outform.query.value = cql;
  51. outform.submit();
  52. return false;
  53. }
  54. function mungeScanForm() {
  55. inform = document.ScanIndexes;
  56. outform = document.ScanSubmit;
  57. index = inform.scanIndex.value;
  58. term = inform.term.value;
  59. relat = inform.relat.value;
  60. outform.scanClause.value = index + " " + relat +" \"" + term + "\""
  61. outform.submit();
  62. return false;
  63. }
  64. </xsl:text>
  65. </script>
  66. </head>
  67. <body bgcolor="#FFFFFF">
  68. <!-- page header: -->
  69. <table class="pageheader" align="center" border="0" cellpadding="0" cellspacing="10" width="95%" summary="This holds the title logo and info">
  70. <tr>
  71. <td valign="bottom" rowspan="2" align="left" width="120">
  72. <a>
  73. <xsl:attribute name="href">
  74. <!-- note that the logo should point to the URL given in '$hostInstitutionURL' but this information is currently not available in the SRU explain response -->
  75. <xsl:value-of select='srw:record/srw:recordData/zr:explain/zr:databaseInfo/zr:links/zr:link[@type="www"]' />
  76. </xsl:attribute>
  77. <img src="img/logo.png" alt="" border="0" />
  78. </a>
  79. </td>
  80. <td>
  81. <h2><xsl:value-of select="srw:record/srw:recordData/zr:explain/zr:databaseInfo/zr:title" /></h2>
  82. <span class="smallup">
  83. <a href="index.php" title="go to main page">Home</a><xsl:text> | </xsl:text>
  84. <a href="show.php?records=all" title="show all records in the database">Show All</a><xsl:text> | </xsl:text>
  85. <a href="simple_search.php" title="search the main fields of the database">Simple Search</a><xsl:text> | </xsl:text>
  86. <a href="advanced_search.php" title="search all fields of the database">Advanced Search</a>
  87. </span>
  88. </td>
  89. <td class="small" align="right" valign="middle"><br /></td>
  90. </tr>
  91. <tr>
  92. <td>Search the SRU web service:</td>
  93. <td class="small" align="right" valign="middle"><a href="user_login.php" title="login to the database">Login</a></td>
  94. </tr>
  95. </table>
  96. <hr class="pageheader" align="center" width="95%" />
  97. <!-- search forms: -->
  98. <xsl:apply-templates select="srw:diagnostics" />
  99. <table align="center" border="0" cellpadding="2" cellspacing="5" width="95%" summary="This table holds the search form">
  100. <tr>
  101. <td></td>
  102. <td>
  103. <form name="CQLForm" onsubmit="return mungeForm();">
  104. <table align="center" border="0" cellpadding="2" cellspacing="5" class="paramTable">
  105. <tr>
  106. <th>Index</th>
  107. <th>Relation</th>
  108. <th>Term</th>
  109. <th>Boolean</th>
  110. </tr>
  111. <input type="hidden" name="maxIndex">
  112. <xsl:attribute name="value">
  113. <xsl:value-of select="count(srw:record/srw:recordData/zr:explain/zr:indexInfo/zr:index)" />
  114. </xsl:attribute>
  115. </input>
  116. <xsl:for-each select="srw:record/srw:recordData/zr:explain/zr:indexInfo/zr:index">
  117. <!-- <xsl:sort select="." /> -->
  118. <tr>
  119. <td align="right">
  120. <b><xsl:value-of select="zr:map[1]/zr:name/@set" />.<xsl:value-of select="zr:map[1]/zr:name" /></b>
  121. <input type="hidden">
  122. <xsl:attribute name="name">index<xsl:value-of select="position()" /></xsl:attribute>
  123. <xsl:attribute name="value"><xsl:value-of select="zr:map[1]/zr:name/@set" />.<xsl:value-of select="zr:map[1]/zr:name" /></xsl:attribute>
  124. </input>
  125. </td>
  126. <td>
  127. <select>
  128. <xsl:attribute name="name">relat<xsl:value-of select="position()" /></xsl:attribute>
  129. <option value="=">=</option>
  130. <option value="exact">exact</option>
  131. <option value="any">any</option>
  132. <option value="all">all</option>
  133. <option value="&lt;">&lt;</option>
  134. <option value="&gt;">&gt;</option>
  135. <option value="&lt;=">&lt;=</option>
  136. <option value="&gt;=">&gt;=</option>
  137. <option value="&lt;&gt;">not</option>
  138. </select>
  139. </td>
  140. <td>
  141. <input type="text" value="">
  142. <xsl:attribute name="name">term<xsl:value-of select="position()" /></xsl:attribute>
  143. <xsl:attribute name="title"><xsl:value-of select="zr:title" /> (refbase: <xsl:value-of select="substring-after(@refb:index,'-')" />)</xsl:attribute>
  144. </input>
  145. </td>
  146. <td>
  147. <select>
  148. <xsl:attribute name="name">bool<xsl:value-of select="position()" /></xsl:attribute>
  149. <option value="and">and</option>
  150. <option value="or">or</option>
  151. <option value="not">not</option>
  152. </select>
  153. </td>
  154. </tr>
  155. </xsl:for-each>
  156. </table>
  157. </form>
  158. <form method="GET" name="SRUForm" onsubmit="return mungeForm();">
  159. <input type="hidden" name="query" value="" />
  160. <input type="hidden" name="version" value="1.1" />
  161. <input type="hidden" name="operation" value="searchRetrieve" />
  162. <table align="center" border="0" cellpadding="2" cellspacing="5">
  163. <tr>
  164. <td>
  165. <b>Record Schema:</b>
  166. </td>
  167. <td>
  168. <select name="recordSchema">
  169. <xsl:for-each select="srw:record/srw:recordData/zr:explain/zr:schemaInfo/zr:schema">
  170. <option>
  171. <xsl:attribute name="value">
  172. <xsl:value-of select="@identifier" />
  173. </xsl:attribute>
  174. <xsl:value-of select="zr:title" />
  175. </option>
  176. </xsl:for-each>
  177. </select>
  178. </td>
  179. </tr>
  180. <tr>
  181. <td>
  182. <b>Record Packing:</b>
  183. </td>
  184. <td>
  185. <select name="recordPacking">
  186. <xsl:choose>
  187. <xsl:when test='srw:record/srw:recordData/zr:explain/zr:configInfo/zr:setting[@type="recordPacking"]'>
  188. <option>
  189. <xsl:attribute name="value">
  190. <xsl:value-of select='srw:record/srw:recordData/zr:explain/zr:configInfo/zr:setting[@type="recordPacking"]' />
  191. </xsl:attribute>
  192. <xsl:value-of select='srw:record/srw:recordData/zr:explain/zr:configInfo/zr:setting[@type="recordPacking"]' />
  193. </option>
  194. </xsl:when>
  195. <xsl:otherwise>
  196. <option value="xml">xml</option>
  197. <option value="string">string</option>
  198. </xsl:otherwise>
  199. </xsl:choose>
  200. </select>
  201. </td>
  202. </tr>
  203. <tr>
  204. <td>
  205. <b>Number of Records:</b>
  206. </td>
  207. <td>
  208. <input type="text" name="maximumRecords">
  209. <xsl:attribute name="value">
  210. <xsl:choose>
  211. <xsl:when test='srw:record/srw:recordData/zr:explain/zr:configInfo/zr:default[@type="numberOfRecords"]'>
  212. <xsl:value-of select='srw:record/srw:recordData/zr:explain/zr:configInfo/zr:default[@type="numberOfRecords"]' />
  213. </xsl:when>
  214. <xsl:otherwise>
  215. <xsl:text>1</xsl:text>
  216. </xsl:otherwise>
  217. </xsl:choose>
  218. </xsl:attribute>
  219. </input>
  220. </td>
  221. </tr>
  222. <tr>
  223. <td>
  224. <b>Record Position:</b>
  225. </td>
  226. <td>
  227. <input type="text" name="startRecord" value="1" />
  228. </td>
  229. </tr>
  230. <xsl:if test='srw:record/srw:recordData/zr:explain/zr:configInfo/zr:supports[@type="resultSets"] != "false"'>
  231. <tr>
  232. <td>
  233. <b>Result Set TTL:</b>
  234. </td>
  235. <td>
  236. <input type="text" name="resultSetTTL" value="0" />
  237. </td>
  238. </tr>
  239. </xsl:if>
  240. <xsl:if test='srw:record/srw:recordData/zr:explain/zr:configInfo/zr:supports[@type="recordXPath"] != "false"'>
  241. <tr>
  242. <td>
  243. <b>Record XPath:</b>
  244. </td>
  245. <td>
  246. <input type="text" name="recordXPath" value="" />
  247. </td>
  248. </tr>
  249. </xsl:if>
  250. <xsl:if test='srw:record/srw:recordData/zr:explain/zr:configInfo/zr:supports[@type="sort"] != "false"'>
  251. <tr>
  252. <td>
  253. <b>Sort Keys:</b>
  254. </td>
  255. <td>
  256. <input type="text" name="sortKeys" value="" />
  257. </td>
  258. </tr>
  259. </xsl:if>
  260. <tr>
  261. <td colspan="2" align="right">
  262. <input type="submit" value="Search" onclick="return mungeForm();" />
  263. </td>
  264. </tr>
  265. </table>
  266. </form>
  267. </td>
  268. <!--
  269. <td valign="top">
  270. <h3>Browse</h3>
  271. <!~~ Some browsers won't display when forms inside tables :( ~~>
  272. <form name="ScanIndexes" onsubmit="return mungeScanForm();">
  273. <table>
  274. <tr>
  275. <th>Index</th>
  276. <th>Relation</th>
  277. <th>Term</th>
  278. <th>Boolean</th>
  279. </tr>
  280. <tr>
  281. <td>
  282. <select name="scanIndex">
  283. <xsl:for-each select="srw:record/srw:recordData/zr:explain/zr:indexInfo/zr:index">
  284. <xsl:sort select="." />
  285. <option>
  286. <xsl:attribute name="value"><xsl:value-of select="zr:map[1]/zr:name/@set" />.<xsl:value-of select="zr:map[1]/zr:name" /></xsl:attribute>
  287. <xsl:value-of select="zr:title" />
  288. </option>
  289. </xsl:for-each>
  290. </select>
  291. </td>
  292. <td>
  293. <select name="relat">
  294. <option value="=">=</option>
  295. <option value="exact">exact</option>
  296. <option value="any">any</option>
  297. <option value="all">all</option>
  298. <option value="&lt;">&lt;</option>
  299. <option value="&gt;">&gt;</option>
  300. <option value="&lt;=">&lt;=</option>
  301. <option value="&gt;=">&gt;=</option>
  302. <option value="&lt;&gt;">not</option>
  303. </select>
  304. </td>
  305. <td>
  306. <input name="term" type="text" value="" />
  307. </td>
  308. </tr>
  309. </table>
  310. </form>
  311. <form name="ScanSubmit" method="GET">
  312. <xsl:attribute name="action">http://<xsl:value-of select="srw:record/srw:recordData/zr:explain/zr:serverInfo/zr:host" />:<xsl:value-of select="srw:record/srw:recordData/zr:explain/zr:serverInfo/zr:port" />/<xsl:value-of select="srw:record/srw:recordData/zr:explain/zr:serverInfo/zr:database" /></xsl:attribute>
  313. <table>
  314. <tr>
  315. <td>
  316. <b>Response Position:</b>
  317. </td>
  318. <td>
  319. <input type="text" name="responsePosition" value="1" size="5" />
  320. </td>
  321. </tr>
  322. <tr>
  323. <td>
  324. <b>Maximum Terms:</b>
  325. </td>
  326. <td>
  327. <input type="text" name="maximumTerms" value="20" size="5" />
  328. </td>
  329. </tr>
  330. <tr>
  331. <td colspan="2">
  332. <input type="submit" value="Browse" onclick="return mungeScanForm();" />
  333. </td>
  334. </tr>
  335. </table>
  336. <input type="hidden" name="operation" value="scan" />
  337. <input type="hidden" name="scanClause" value="" />
  338. <input type="hidden" name="version" value="1.1" />
  339. </form>
  340. </td>
  341. -->
  342. </tr>
  343. <tr>
  344. <td valign="top">
  345. <b>Help:</b>
  346. </td>
  347. <td valign="top">
  348. <xsl:text>This form gets dynamically created from the </xsl:text><a href="http://www.loc.gov/standards/sru/" target="top">SRU</a><xsl:text> explain response, it exposes indexes and capabilities offered by the refbase SRU server.</xsl:text>
  349. <xsl:text> Queries must be specified as </xsl:text><a href="http://www.loc.gov/standards/sru/specs/cql.html" target="top">CQL (Common Query Language)</a><xsl:text>, an introduction to CQL is given </xsl:text><a href="http://zing.z3950.org/cql/intro.html" target="top">here</a><xsl:text>.</xsl:text>
  350. <xsl:text> Please see the </xsl:text><a href="http://sru.refbase.net/" target="top">refbase online documentation</a>
  351. <xsl:text> for more information about the SRU web service.</xsl:text>
  352. </td>
  353. </tr>
  354. </table>
  355. <!-- page footer: -->
  356. <hr class="pagefooter" align="center" width="95%" />
  357. <table class="pagefooter" align="center" border="0" cellpadding="0" cellspacing="10" width="95%" summary="This table holds the footer">
  358. <tr>
  359. <td class="small" width="105"><a href="index.php" title="go to main page">Home</a></td>
  360. <td class="small" align="center">
  361. <a href="sru.php" title="search the SRU web service">SRU Search</a><xsl:text> | </xsl:text>
  362. <a href="library_search.php">
  363. <xsl:attribute name="title">
  364. <xsl:text>search the library of the </xsl:text><xsl:value-of select="srw:record/srw:recordData/zr:explain/zr:databaseInfo/zr:author" />
  365. </xsl:attribute>
  366. <xsl:text>Library Search</xsl:text>
  367. </a><xsl:text> | </xsl:text>
  368. <a href="show.php" title="display details for a particular record by entering its database serial number">Show Record</a><xsl:text> | </xsl:text>
  369. <a href="extract.php" title="extract citations from a text and build an appropriate reference list">Extract Citations</a>
  370. </td>
  371. <td class="small" align="right" width="105"><a href="http://wiki.refbase.net/" title="display help">Help</a></td>
  372. </tr>
  373. </table>
  374. </body>
  375. </html>
  376. </xsl:template>
  377. <xsl:template match="srw:diagnostics">
  378. <h3>Diagnostics</h3>
  379. <xsl:apply-templates />
  380. </xsl:template>
  381. <xsl:template match="diag:diagnostic">
  382. <table>
  383. <xsl:apply-templates />
  384. </table>
  385. </xsl:template>
  386. <xsl:template match="diag:code">
  387. <tr>
  388. <td>
  389. <b>Code:</b>
  390. </td>
  391. <td>
  392. <xsl:value-of select="." />
  393. </td>
  394. </tr>
  395. </xsl:template>
  396. <xsl:template match="diag:message">
  397. <tr>
  398. <td>
  399. <b>Message:</b>
  400. </td>
  401. <td>
  402. <xsl:value-of select="." />
  403. </td>
  404. </tr>
  405. </xsl:template>
  406. <xsl:template match="diag:details">
  407. <tr>
  408. <td>
  409. <b>Details:</b>
  410. </td>
  411. <td>
  412. <xsl:value-of select="." />
  413. </td>
  414. </tr>
  415. </xsl:template>
  416. </xsl:stylesheet>