Project

General

Profile

metacat / lib / style / resultset.xsl @ 666

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-01-18 11:02:14 -0800 (Thu, 18 Jan 2001) $'
11
  * '$Revision: 666 $'
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(current_action,form_ref) {
41
              form_ref.action.value=current_action;
42
              form_ref.submit();
43
          }
44
          ]]>
45
        </script>
46
      </head>
47

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

    
127
             <td>
128
               <xsl:value-of select="./param[@name='resource/dataset/title']"/>
129
               <xsl:value-of select="./param[@name='eml-dataset/title']"/>
130
               <br/>
131
               <p><pre>Document ID: <xsl:value-of select="./docid"/></pre></p>
132
             </td>
133
             <td>
134
               <form action="@html-path@/servlet/metacat" method="POST">
135
                 <xsl:attribute name="name">
136
                   <xsl:value-of select="translate(./docid,'.','')"/>
137
                 </xsl:attribute>
138
                 <!-- abstractpath tells the servlet where the abstract is in 
139
                      the document.  The % sign is used because the path could 
140
                      be resource/literature or resource/dataset. -->
141
                 <input type="hidden" name="abstractpath" 
142
                        value="resource/%/abstract" />
143
                 <input type="hidden" name="action" value="read"/>
144
                 <input type="hidden" name="docid">
145
                   <xsl:attribute name="value">
146
                     <xsl:value-of select="./docid"/>
147
                   </xsl:attribute>
148
                 </input>
149
                 <xsl:for-each select="./relation">
150
                   <input type="hidden" name="relation">
151
                     <xsl:attribute name="value" >
152
                       <xsl:value-of select="./relationdoc" />
153
                     </xsl:attribute>
154
                   </input>
155
                 </xsl:for-each>
156

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

    
265
               </xsl:for-each>
266
               <xsl:text>&nbsp;</xsl:text>
267
             </td>
268
             <td>
269
                 <xsl:value-of select=
270
                 "./param[@name='resource/dataset/originator/organizationName']"                 />
271
                 <xsl:text>&nbsp;</xsl:text>
272
             </td>
273
  
274
             <td>
275
               <xsl:for-each
276
                select="./param[@name='resource/dataset/keywordInfo/keyword']">
277
                 <xsl:value-of select="." />
278
                 <br/>
279
               </xsl:for-each>
280
               <xsl:text>&nbsp;</xsl:text>
281
             </td>
282
           </tr>
283

    
284
          </xsl:for-each>
285
          </table>
286

    
287
       </xsl:if>
288
      </body>
289
    </html>
290
  </xsl:template>
291

    
292
</xsl:stylesheet>