Project

General

Profile

metacat / lib / style / resultset.xsl @ 737

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: bojilova $'
10
  *     '$Date: 2001-05-04 14:25:08 -0700 (Fri, 04 May 2001) $'
11
  * '$Revision: 737 $'
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="@web-base-url@/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="";
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="html" />
90
             <input type="hidden" name="operator" value="UNION" />
91
            
92
             <input type="hidden" name="returnfield" 
93
              value="resource/dataset/originator/individualName/surName" />
94
             <input type="hidden" name="returnfield" 
95
              value="resource/dataset/originator/individualName/givenName" />
96
             <input type="hidden" name="returnfield" 
97
              value="resource/dataset/originator/organizationName" />
98
             <input type="hidden" name="returnfield" 
99
              value="resource/dataset/title" />
100
             <input type="hidden" name="returnfield" 
101
              value="eml-dataset/title" />
102
             <input type="hidden" name="returnfield" 
103
              value="resource/dataset/keywordInfo/keyword" />
104
             <input type="hidden" name="returndoc"
105
              value="-//NCEAS//resource//EN" />
106
             <input type="hidden" name="returndoc"
107
              value="-//NCEAS//eml-dataset//EN" />
108
           </form>
109
          </td>
110
        </tr>  
111
       </table>
112
        
113
       <p><xsl:number value="count(resultset/document)" /> documents found.</p>
114
       <!-- This tests to see if there are returned documents,
115
            if there are not then don't show the query results -->
116
       <xsl:if test="count(resultset/document) &gt; 0">
117
         <center>
118
           <u><h2>Results</h2></u>
119
         </center>
120
          
121
         <table width="100%">
122
           <tr>
123
             <th class="tablehead">Title</th>
124
             <th class="tablehead">Action</th>
125
             <th class="tablehead">Related Documents</th>
126
             <th class="tablehead">Contacts</th>
127
             <th class="tablehead">Organization</th>
128
             <th class="tablehead">Keywords</th>
129
           </tr>
130
        
131
         <xsl:for-each select="resultset/document">
132
           <xsl:sort select="doctitle"/>
133
           <tr valign="top">
134
             <xsl:attribute name="class">
135
               <xsl:choose>
136
                 <xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
137
                 <xsl:when test="position() mod 2 = 0">roweven</xsl:when>
138
               </xsl:choose>
139
             </xsl:attribute>
140

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

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

    
281
               </xsl:for-each>
282
               <xsl:text>&nbsp;</xsl:text>
283
             </td>
284
             <td>
285
                 <xsl:value-of select=
286
                 "./param[@name='resource/dataset/originator/organizationName']"                 />
287
                 <xsl:text>&nbsp;</xsl:text>
288
             </td>
289
  
290
             <td>
291
               <xsl:for-each
292
                select="./param[@name='resource/dataset/keywordInfo/keyword']">
293
                 <xsl:value-of select="." />
294
                 <br/>
295
               </xsl:for-each>
296
               <xsl:text>&nbsp;</xsl:text>
297
             </td>
298
           </tr>
299

    
300
          </xsl:for-each>
301
          </table>
302

    
303
       </xsl:if>
304
      </body>
305
    </html>
306
  </xsl:template>
307

    
308
</xsl:stylesheet>