Project

General

Profile

metacat / lib / style / resultset.xsl @ 882

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: jones $'
10
  *     '$Date: 2001-12-18 12:27:52 -0800 (Tue, 18 Dec 2001) $'
11
  * '$Revision: 882 $'
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.0beta4//EN" />
110
           </form>
111
          </td>
112
        </tr>  
113
       </table>
114
        
115
       <p><xsl:number value="count(resultset/document)" /> documents found.</p>
116
       <!-- This tests to see if there are returned documents,
117
            if there are not then don't show the query results -->
118
       <xsl:if test="count(resultset/document) &gt; 0">
119
         <center>
120
           <u><h2>Results</h2></u>
121
         </center>
122
          
123
         <table width="100%">
124
           <tr>
125
             <th class="tablehead">Title</th>
126
             <!-- <th class="tablehead">Action</th> -->
127
             <!-- <th class="tablehead">Related Documents</th> -->
128
             <th class="tablehead">Contacts</th>
129
             <th class="tablehead">Organization</th>
130
             <th class="tablehead">Keywords</th>
131
           </tr>
132
        
133
         <xsl:for-each select="resultset/document">
134
           <xsl:sort select="title"/>
135
           <tr valign="top">
136
             <xsl:attribute name="class">
137
               <xsl:choose>
138
                 <xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
139
                 <xsl:when test="position() mod 2 = 0">roweven</xsl:when>
140
               </xsl:choose>
141
             </xsl:attribute>
142

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

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

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

    
329
          </xsl:for-each>
330
          </table>
331

    
332
       </xsl:if>
333
      </body>
334
    </html>
335
  </xsl:template>
336

    
337
</xsl:stylesheet>