Project

General

Profile

1 51 jones
<?xml version="1.0"?>
2
<!--
3 666 jones
  *  '$RCSfile$'
4
  *      Authors: Matt Jones, CHad Berkley
5
  *    Copyright: 2000 Regents of the University of California and the
6 51 jones
  *               National Center for Ecological Analysis and Synthesis
7
  *  For Details: http://www.nceas.ucsb.edu/
8
  *
9 666 jones
  *   '$Author$'
10
  *     '$Date$'
11
  * '$Revision$'
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 51 jones
  * 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 505 jones
        <link rel="stylesheet" type="text/css"
37 827 jones
              href="@style-path@/default.css" />
38 505 jones
        <script language="JavaScript">
39
          <![CDATA[
40 737 bojilova
          function submitform(action,form_ref) {
41
              form_ref.action.value=action;
42
              form_ref.abstractpath.value="";
43 833 jones
              form_ref.qformat.value="knb";
44 505 jones
              form_ref.submit();
45
          }
46 737 bojilova
          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 505 jones
          ]]>
59
        </script>
60 51 jones
      </head>
61 505 jones
62
      <body>
63
        <table width="100%">
64 506 jones
          <tr>
65 591 berkley
            <td rowspan="2"><img src="@web-base-url@/images/KNBLogo.gif"/></td>
66 506 jones
            <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 505 jones
         <tr>
85 506 jones
          <td align="right" valign="top" colspan="7">
86 505 jones
            <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 833 jones
             <input type="hidden" name="qformat" value="knb" />
90 505 jones
             <input type="hidden" name="operator" value="UNION" />
91
92
             <input type="hidden" name="returnfield"
93 813 jones
              value="originator/individualName/surName" />
94 505 jones
             <input type="hidden" name="returnfield"
95 813 jones
              value="originator/individualName/givenName" />
96 505 jones
             <input type="hidden" name="returnfield"
97 813 jones
              value="originator/organizationName" />
98 505 jones
             <input type="hidden" name="returnfield"
99 813 jones
              value="title" />
100 505 jones
             <input type="hidden" name="returnfield"
101 813 jones
              value="keyword" />
102 814 jones
             <input type="hidden" name="returndoctype"
103 813 jones
              value="-//NCEAS//eml-dataset-2.0//EN" />
104 814 jones
             <input type="hidden" name="returndoctype"
105 505 jones
              value="-//NCEAS//resource//EN" />
106 814 jones
             <input type="hidden" name="returndoctype"
107 505 jones
              value="-//NCEAS//eml-dataset//EN" />
108
           </form>
109
          </td>
110
        </tr>
111
       </table>
112 51 jones
113 505 jones
       <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 506 jones
             <th class="tablehead">Title</th>
124 833 jones
             <!-- <th class="tablehead">Action</th> -->
125
             <!-- <th class="tablehead">Related Documents</th> -->
126 506 jones
             <th class="tablehead">Contacts</th>
127
             <th class="tablehead">Organization</th>
128
             <th class="tablehead">Keywords</th>
129 505 jones
           </tr>
130
131
         <xsl:for-each select="resultset/document">
132 813 jones
           <xsl:sort select="title"/>
133 505 jones
           <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 85 jones
141 833 jones
<!--
142 505 jones
             <td>
143 813 jones
               <xsl:value-of select="./param[@name='title']"/>
144 505 jones
               <br/>
145
               <p><pre>Document ID: <xsl:value-of select="./docid"/></pre></p>
146
             </td>
147 833 jones
-->
148 505 jones
             <td>
149 566 jones
               <form action="@html-path@/servlet/metacat" method="POST">
150 505 jones
                 <xsl:attribute name="name">
151 566 jones
                   <xsl:value-of select="translate(./docid,'.','')"/>
152 505 jones
                 </xsl:attribute>
153
                 <!-- abstractpath tells the servlet where the abstract is in
154
                      the document.  The % sign is used because the path could
155
                      be resource/literature or resource/dataset. -->
156 737 bojilova
                 <!-- specified down IN javascript:submitform1('read',abstractpath,docid) -->
157
                 <input type="hidden" name="abstractpath" />
158
                 <!-- specified down IN javascript:submitform2('read','zip',docid) -->
159
                 <input type="hidden" name="qformat" />
160 566 jones
                 <input type="hidden" name="action" value="read"/>
161 505 jones
                 <input type="hidden" name="docid">
162
                   <xsl:attribute name="value">
163
                     <xsl:value-of select="./docid"/>
164
                   </xsl:attribute>
165
                 </input>
166
                 <xsl:for-each select="./relation">
167 732 bojilova
                   <input type="hidden" name="docid">
168 505 jones
                     <xsl:attribute name="value" >
169
                       <xsl:value-of select="./relationdoc" />
170
                     </xsl:attribute>
171
                   </input>
172
                 </xsl:for-each>
173 85 jones
174 505 jones
                 <a>
175 566 jones
                   <xsl:attribute name="href">javascript:submitform('read',document.<xsl:value-of select="translate(./docid, '.', '')"/>)</xsl:attribute>
176 833 jones
                   <xsl:value-of select="./param[@name='title']"/>
177 505 jones
                 </a><br />
178 833 jones
                 <br/>
179
                 <p><pre>Document ID: <xsl:value-of select="./docid"/></pre></p>
180
<!--
181 505 jones
                 <a>
182 737 bojilova
                   <xsl:attribute name="href">javascript:submitform1('read','resource/%/abstract',document.<xsl:value-of select="translate(./docid,'.','')"/>)</xsl:attribute>
183 505 jones
                   View Abstract
184
                 </a><br />
185
                 <a>
186 737 bojilova
                   <xsl:attribute name="href">javascript:submitform2('read','zip',document.<xsl:value-of select="translate(./docid,'.','')"/>)</xsl:attribute>
187 505 jones
                    Download Data and Metadata
188
                 </a><br />
189 833 jones
-->
190 505 jones
               </form>
191
             </td>
192 833 jones
<!--
193 505 jones
             <td>
194
               <xsl:if test="count(./relation) &gt; 0">
195
                 <xsl:for-each select="./relation">
196
                   <a>
197 844 berkley
                     <xsl:if test="starts-with(./triple, 'http')">
198 505 jones
                       <xsl:attribute name="href">
199
                         <xsl:value-of select="./relationdoc" />
200
                       </xsl:attribute>
201
                       <xsl:if
202
                        test="./relationdoctype = '-//NCEAS//eml-variable//EN'">
203
                         Variable Information
204
                       </xsl:if>
205
                       <xsl:if
206 844 berkley
                        test="./relationdoctype = '-//NCEAS//eml-entity-2.0//EN'">
207
                         Table Information
208
                       </xsl:if>
209
                       <xsl:if
210
                        test="./relationdoctype = '-//NCEAS//eml-physical-2.0//EN'">
211 505 jones
                         File Information
212
                       </xsl:if>
213
                       <xsl:if
214 844 berkley
                        test="./relationdoctype = '-//NCEAS//eml-distribution-2.0//EN'">
215
                         Distribution Information
216
                       </xsl:if>
217
                       <xsl:if
218
                        test="./relationdoctype = '-//NCEAS//eml-access-2.0//EN'">
219 505 jones
                         Access Information
220
                       </xsl:if>
221
                       <xsl:if
222
                        test="./relationdoctype = '-//NCEAS//eml-context//EN'">
223
                         Context Information
224
                       </xsl:if>
225
                       <xsl:if
226 844 berkley
                        test="./relationdoctype = '-//NCEAS//eml-software-2.0//EN'">
227 505 jones
                         Software Information
228
                       </xsl:if>
229
                       <xsl:if
230
                        test="./relationdoctype = '-//NCEAS//eml-status//EN'">
231
                         Status Information
232
                       </xsl:if>
233
                       <xsl:if
234
                        test="./relationdoctype = '-//NCEAS//eml-supplement//EN'">
235
                         Supplemental Information
236
                       </xsl:if>
237 833 jones
-->
238 505 jones
                       <!-- If the doctype is null, this file is assumed to
239
                            be a data file
240
                        -->
241 833 jones
<!--
242 505 jones
                       <xsl:if test="./relationdoctype = 'null'">
243
                         Data File
244
                       </xsl:if>
245
                     </xsl:if>
246 844 berkley
                     <xsl:if test="starts-with(./triple, '')">
247 505 jones
                       <xsl:attribute name="href">
248 833 jones
                         <xsl:text>http://@server@@servlet-path@?action=read&amp;qformat=knb&amp;docid=</xsl:text>
249 505 jones
                         <xsl:value-of select="./relationdoc" />
250
                       </xsl:attribute>
251
                       <xsl:if
252
                        test="./relationdoctype = '-//NCEAS//eml-variable//EN'">
253
                         Variable Information
254
                       </xsl:if>
255
                       <xsl:if
256 844 berkley
                        test="./relationdoctype = '-//NCEAS//eml-entity-2.0//EN'">
257
                         Table Information
258
                       </xsl:if>
259
                       <xsl:if
260
                        test="./relationdoctype = '-//NCEAS//eml-physical-2.0//EN'">
261 505 jones
                         File Information
262
                       </xsl:if>
263
                       <xsl:if
264 844 berkley
                        test="./relationdoctype = '-//NCEAS//eml-distribution-2.0//EN'">
265
                         Distribution Information
266
                       </xsl:if>
267
                       <xsl:if
268
                        test="./relationdoctype = '-//NCEAS//eml-access-2.0//EN'">
269 505 jones
                         Access Information
270
                       </xsl:if>
271
                       <xsl:if
272
                        test="./relationdoctype = '-//NCEAS//eml-context//EN'">
273
                         Context Information
274
                       </xsl:if>
275
                       <xsl:if
276 844 berkley
                        test="./relationdoctype = '-//NCEAS//eml-software-2.0//EN'">
277 505 jones
                         Software Information
278
                       </xsl:if>
279
                       <xsl:if
280
                        test="./relationdoctype = '-//NCEAS//eml-status//EN'">
281
                         Status Information
282
                       </xsl:if>
283
                       <xsl:if
284
                        test="./relationdoctype = '-//NCEAS//eml-supplement//EN'">
285
                         Supplemental Information
286
                       </xsl:if>
287 833 jones
-->
288 505 jones
                       <!-- If the doctype is null, this file is assumed to
289
                            be a data file
290
                        -->
291 833 jones
<!--
292 505 jones
                       <xsl:if test="./relationdoctype = 'null'">
293
                         Data File
294
                       </xsl:if>
295
                     </xsl:if>
296
                   </a>
297
                   <br/>
298
                 </xsl:for-each>
299
               </xsl:if>
300 833 jones
               <xsl:text> </xsl:text>
301 505 jones
             </td>
302 833 jones
-->
303 505 jones
             <td>
304 813 jones
               <xsl:for-each select="./param[@name='originator/individualName/surName']" >
305 505 jones
                 <xsl:value-of select="." />
306
                 <br/>
307 51 jones
308 505 jones
               </xsl:for-each>
309 833 jones
               <xsl:text> </xsl:text>
310 505 jones
             </td>
311
             <td>
312
                 <xsl:value-of select=
313 813 jones
                 "./param[@name='originator/organizationName']"                 />
314 833 jones
                 <xsl:text> </xsl:text>
315 505 jones
             </td>
316
317
             <td>
318
               <xsl:for-each
319 813 jones
                select="./param[@name='keyword']">
320 505 jones
                 <xsl:value-of select="." />
321
                 <br/>
322
               </xsl:for-each>
323 833 jones
               <xsl:text> </xsl:text>
324 505 jones
             </td>
325
           </tr>
326 51 jones
327 505 jones
          </xsl:for-each>
328
          </table>
329 51 jones
330 505 jones
       </xsl:if>
331 51 jones
      </body>
332
    </html>
333
  </xsl:template>
334
335
</xsl:stylesheet>