Project

General

Profile

metacat / lib / style / resultset.xsl @ 963

1
<?xml version="1.0"?>
2
<!--
3
  *  '$RCSfile$'
4
  *      Authors: Matt Jones, CHad Berkley
5
  *    Copyright: 2000 Regents of the University of California and the
6
  *               National Center for Ecological Analysis and Synthesis
7
  *  For Details: http://www.nceas.ucsb.edu/
8
  *
9
  *   '$Author: berkley $'
10
  *     '$Date: 2002-03-06 16:17:02 -0800 (Wed, 06 Mar 2002) $'
11
  * '$Revision: 963 $'
12
  * 
13
  * This program is free software; you can redistribute it and/or modify
14
  * it under the terms of the GNU General Public License as published by
15
  * the Free Software Foundation; either version 2 of the License, or
16
  * (at your option) any later version.
17
  *
18
  * This program is distributed in the hope that it will be useful,
19
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
  * GNU General Public License for more details.
22
  *
23
  * You should have received a copy of the GNU General Public License
24
  * along with this program; if not, write to the Free Software
25
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26
  *
27
  * This is an XSLT (http://www.w3.org/TR/xslt) stylesheet designed to
28
  * convert an XML file showing the resultset of a query
29
  * into an HTML format suitable for rendering with modern web browsers.
30
-->
31
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
32
  <xsl:output method="html"/>
33
  <xsl:template match="/">
34
    <html>
35
      <head>
36
        <link rel="stylesheet" type="text/css" 
37
              href="@style-path@/default.css" />
38
        <script language="JavaScript">
39
          <![CDATA[
40
          function submitform(action,form_ref) {
41
              form_ref.action.value=action;
42
              form_ref.abstractpath.value="";
43
              form_ref.qformat.value="knb";
44
              form_ref.submit();
45
          }
46
          function submitform1(action, abstractpath, form_ref) {
47
              form_ref.action.value=action;
48
              form_ref.abstractpath.value=abstractpath;
49
              form_ref.qformat.value="";
50
              form_ref.submit();
51
          }
52
          function submitform2(action, qformat, form_ref) {
53
              form_ref.action.value=action;
54
              form_ref.qformat.value=qformat;
55
              form_ref.abstractpath.value="";
56
              form_ref.submit();
57
          }
58
          ]]>
59
        </script>
60
      </head>
61

    
62
      <body>
63
        <table width="100%">
64
          <tr>
65
            <td rowspan="2"><img src="@web-base-url@/images/KNBLogo.gif"/></td>
66
            <td colspan="7"><div class="title">Biocomplexity Data Search</div>
67
            </td>
68
          </tr>
69
          <tr>
70
            <td><a href="@web-base-url@" class="toollink"> KNB </a></td>
71
            <td><a href="@web-base-url@/data.html" class="toollink"> 
72
                Data </a></td>
73
            <td><a href="@web-base-url@/people.html" class="toollink"> 
74
                People </a></td>
75
            <td><a href="@web-base-url@/informatics" class="toollink"> 
76
                Informatics </a></td>
77
            <td><a href="@web-base-url@/biodiversity" class="toollink"> 
78
                Biodiversity </a></td>
79
            <td><a href="@web-base-url@/education" class="toollink"> 
80
                Education </a></td>
81
            <td><a href="@web-base-url@/software" class="toollink"> 
82
                Software </a></td>
83
         </tr>
84
         <tr>
85
          <td align="right" valign="top" colspan="7">
86
            <form action="@html-path@/servlet/metacat" method="POST">
87
             Data Search: <input type="text" name="anyfield" size="10" />
88
             <input type="hidden" name="action" value="query" />   
89
             <input type="hidden" name="qformat" value="knb" />
90
             <input type="hidden" name="operator" value="UNION" />
91
            
92
             <input type="hidden" name="returnfield" 
93
              value="originator/individualName/surName" />
94
             <input type="hidden" name="returnfield" 
95
              value="originator/individualName/givenName" />
96
             <input type="hidden" name="returnfield" 
97
              value="originator/organizationName" />
98
             <input type="hidden" name="returnfield" 
99
              value="title" />
100
             <input type="hidden" name="returnfield" 
101
              value="keyword" />
102
             <input type="hidden" name="returndoctype"
103
              value="-//NCEAS//eml-dataset-2.0//EN" />
104
             <input type="hidden" name="returndoctype"
105
              value="-//NCEAS//resource//EN" />
106
             <input type="hidden" name="returndoctype"
107
              value="-//NCEAS//eml-dataset//EN" />
108
              <input type="hidden" name="returndoctype"
109
              value="-//ecoinformatics.org//eml-dataset-2.0.0beta6//EN" />
110
              <input type="hidden" name="returndoctype"
111
              value="-//ecoinformatics.org//eml-dataset-2.0.0beta4//EN" />
112
           </form>
113
          </td>
114
        </tr>  
115
       </table>
116
        
117
       <p><xsl:number value="count(resultset/document)" /> documents found.</p>
118
       <!-- This tests to see if there are returned documents,
119
            if there are not then don't show the query results -->
120
       <xsl:if test="count(resultset/document) &gt; 0">
121
         <center>
122
           <u><h2>Results</h2></u>
123
         </center>
124
          
125
         <table width="100%">
126
           <tr>
127
             <th class="tablehead">Title</th>
128
             <!-- <th class="tablehead">Action</th> -->
129
             <!-- <th class="tablehead">Related Documents</th> -->
130
             <th class="tablehead">Contacts</th>
131
             <th class="tablehead">Organization</th>
132
             <th class="tablehead">Keywords</th>
133
           </tr>
134
        
135
         <xsl:for-each select="resultset/document">
136
           <xsl:sort select="title"/>
137
           <tr valign="top">
138
             <xsl:attribute name="class">
139
               <xsl:choose>
140
                 <xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
141
                 <xsl:when test="position() mod 2 = 0">roweven</xsl:when>
142
               </xsl:choose>
143
             </xsl:attribute>
144

    
145
<!--
146
             <td>
147
               <xsl:value-of select="./param[@name='title']"/>
148
               <br/>
149
               <p><pre>Document ID: <xsl:value-of select="./docid"/></pre></p>
150
             </td>
151
-->
152
             <td>
153
               <form action="@html-path@/servlet/metacat" method="POST">
154
                 <xsl:attribute name="name">
155
                   <xsl:value-of select="translate(./docid,'.','')"/>
156
                 </xsl:attribute>
157
                 <!-- abstractpath tells the servlet where the abstract is in 
158
                      the document.  The % sign is used because the path could 
159
                      be resource/literature or resource/dataset. -->
160
                 <!-- specified down IN javascript:submitform1('read',abstractpath,docid) -->
161
                 <input type="hidden" name="abstractpath" />
162
                 <!-- specified down IN javascript:submitform2('read','zip',docid) -->
163
                 <input type="hidden" name="qformat" />
164
                 <input type="hidden" name="action" value="read"/>
165
                 <input type="hidden" name="docid">
166
                   <xsl:attribute name="value">
167
                     <xsl:value-of select="./docid"/>
168
                   </xsl:attribute>
169
                 </input>
170
                 <xsl:for-each select="./relation">
171
                   <input type="hidden" name="docid">
172
                     <xsl:attribute name="value" >
173
                       <xsl:value-of select="./relationdoc" />
174
                     </xsl:attribute>
175
                   </input>
176
                 </xsl:for-each>
177

    
178
                 <a>
179
                   <xsl:attribute name="href">javascript:submitform('read',document.<xsl:value-of select="translate(./docid, '.', '')"/>)</xsl:attribute>
180
                   <xsl:value-of select="./param[@name='title']"/>
181
                 </a><br />
182
                 <br/>
183
                 <p><pre>Document ID: <xsl:value-of select="./docid"/></pre></p>
184
<!--
185
                 <a>
186
                   <xsl:attribute name="href">javascript:submitform1('read','resource/%/abstract',document.<xsl:value-of select="translate(./docid,'.','')"/>)</xsl:attribute>
187
                   View Abstract
188
                 </a><br />
189
                 <a>
190
                   <xsl:attribute name="href">javascript:submitform2('read','zip',document.<xsl:value-of select="translate(./docid,'.','')"/>)</xsl:attribute>
191
                    Download Data and Metadata
192
                 </a><br />
193
-->
194
               </form>
195
             </td>
196
<!--
197
             <td>
198
               <xsl:if test="count(./relation) &gt; 0">
199
                 <xsl:for-each select="./relation">
200
                   <a>
201
                     <xsl:if test="starts-with(./triple, 'http')">
202
                       <xsl:attribute name="href">
203
                         <xsl:value-of select="./relationdoc" />
204
                       </xsl:attribute>
205
                       <xsl:if 
206
                        test="./relationdoctype = '-//NCEAS//eml-variable//EN'">
207
                         Variable Information
208
                       </xsl:if>
209
                       <xsl:if 
210
                        test="./relationdoctype = '-//NCEAS//eml-entity-2.0//EN'">
211
                         Table Information
212
                       </xsl:if>
213
                       <xsl:if 
214
                        test="./relationdoctype = '-//NCEAS//eml-physical-2.0//EN'">
215
                         File Information
216
                       </xsl:if>
217
                       <xsl:if 
218
                        test="./relationdoctype = '-//NCEAS//eml-distribution-2.0//EN'">
219
                         Distribution Information
220
                       </xsl:if>
221
                       <xsl:if 
222
                        test="./relationdoctype = '-//NCEAS//eml-access-2.0//EN'">
223
                         Access Information
224
                       </xsl:if>
225
                       <xsl:if 
226
                        test="./relationdoctype = '-//NCEAS//eml-context//EN'">
227
                         Context Information
228
                       </xsl:if>
229
                       <xsl:if 
230
                        test="./relationdoctype = '-//NCEAS//eml-software-2.0//EN'">
231
                         Software Information
232
                       </xsl:if>
233
                       <xsl:if 
234
                        test="./relationdoctype = '-//NCEAS//eml-status//EN'">
235
                         Status Information
236
                       </xsl:if>
237
                       <xsl:if 
238
                        test="./relationdoctype = '-//NCEAS//eml-supplement//EN'">
239
                         Supplemental Information
240
                       </xsl:if>
241
-->
242
                       <!-- If the doctype is null, this file is assumed to 
243
                            be a data file
244
                        -->
245
<!--
246
                       <xsl:if test="./relationdoctype = 'null'">
247
                         Data File
248
                       </xsl:if>
249
                     </xsl:if>
250
                     <xsl:if test="starts-with(./triple, '')">
251
                       <xsl:attribute name="href">
252
                         <xsl:text>@server@@servlet-path@?action=read&amp;qformat=knb&amp;docid=</xsl:text>
253
                         <xsl:value-of select="./relationdoc" />
254
                       </xsl:attribute>
255
                       <xsl:if 
256
                        test="./relationdoctype = '-//NCEAS//eml-variable//EN'">
257
                         Variable Information
258
                       </xsl:if>
259
                       <xsl:if 
260
                        test="./relationdoctype = '-//NCEAS//eml-entity-2.0//EN'">
261
                         Table Information
262
                       </xsl:if>
263
                       <xsl:if 
264
                        test="./relationdoctype = '-//NCEAS//eml-physical-2.0//EN'">
265
                         File Information
266
                       </xsl:if>
267
                       <xsl:if 
268
                        test="./relationdoctype = '-//NCEAS//eml-distribution-2.0//EN'">
269
                         Distribution Information
270
                       </xsl:if>
271
                       <xsl:if 
272
                        test="./relationdoctype = '-//NCEAS//eml-access-2.0//EN'">
273
                         Access Information
274
                       </xsl:if>
275
                       <xsl:if 
276
                        test="./relationdoctype = '-//NCEAS//eml-context//EN'">
277
                         Context Information
278
                       </xsl:if>
279
                       <xsl:if 
280
                        test="./relationdoctype = '-//NCEAS//eml-software-2.0//EN'">
281
                         Software Information
282
                       </xsl:if>
283
                       <xsl:if 
284
                        test="./relationdoctype = '-//NCEAS//eml-status//EN'">
285
                         Status Information
286
                       </xsl:if>
287
                       <xsl:if 
288
                        test="./relationdoctype = '-//NCEAS//eml-supplement//EN'">
289
                         Supplemental Information
290
                       </xsl:if>
291
-->
292
                       <!-- If the doctype is null, this file is assumed to 
293
                            be a data file
294
                        -->
295
<!--
296
                       <xsl:if test="./relationdoctype = 'null'">
297
                         Data File
298
                       </xsl:if>
299
                     </xsl:if>
300
                   </a>
301
                   <br/>
302
                 </xsl:for-each>  
303
               </xsl:if>
304
               <xsl:text> </xsl:text>
305
             </td>
306
-->
307
             <td>
308
               <xsl:for-each select="./param[@name='originator/individualName/surName']" >  
309
                 <xsl:value-of select="." />
310
                 <br/>
311

    
312
               </xsl:for-each>
313
               <xsl:text> </xsl:text>
314
             </td>
315
             <td>
316
                 <xsl:value-of select=
317
                 "./param[@name='originator/organizationName']"                 />
318
                 <xsl:text> </xsl:text>
319
             </td>
320
  
321
             <td>
322
               <xsl:for-each
323
                select="./param[@name='keyword']">
324
                 <xsl:value-of select="." />
325
                 <br/>
326
               </xsl:for-each>
327
               <xsl:text> </xsl:text>
328
             </td>
329
           </tr>
330

    
331
          </xsl:for-each>
332
          </table>
333

    
334
       </xsl:if>
335
      </body>
336
    </html>
337
  </xsl:template>
338

    
339
</xsl:stylesheet>