Project

General

Profile

1 51 jones
<?xml version="1.0"?>
2
<!--
3
  * resultset.xsl
4
  *
5 505 jones
  *      Authors: Matt Jones, Chad Berkley
6 51 jones
  *    Copyright: 2000 Regents of the University of California and the
7
  *               National Center for Ecological Analysis and Synthesis
8
  *  For Details: http://www.nceas.ucsb.edu/
9 505 jones
  *      Created: 2000 July 20
10
  *    File Info: '$Id$'
11 51 jones
  *
12
  * This is an XSLT (http://www.w3.org/TR/xslt) stylesheet designed to
13
  * convert an XML file showing the resultset of a query
14
  * into an HTML format suitable for rendering with modern web browsers.
15
-->
16
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
17
  <xsl:output method="html"/>
18
  <xsl:template match="/">
19
    <html>
20
      <head>
21 505 jones
        <link rel="stylesheet" type="text/css"
22 506 jones
              href="@web-base-url@/default.css" />
23 505 jones
        <script language="JavaScript">
24
          <![CDATA[
25
          function submitform(current_action,form_ref) {
26
              form_ref.action.value=current_action;
27
              form_ref.submit();
28
          }
29
          ]]>
30
        </script>
31 51 jones
      </head>
32 505 jones
33
      <body>
34
        <table width="100%">
35 506 jones
          <tr>
36 591 berkley
            <td rowspan="2"><img src="@web-base-url@/images/KNBLogo.gif"/></td>
37 506 jones
            <td colspan="7"><div class="title">Biocomplexity Data Search</div>
38
            </td>
39
          </tr>
40
          <tr>
41
            <td><a href="@web-base-url@" class="toollink"> KNB </a></td>
42
            <td><a href="@web-base-url@/data.html" class="toollink">
43
                Data </a></td>
44
            <td><a href="@web-base-url@/people.html" class="toollink">
45
                People </a></td>
46
            <td><a href="@web-base-url@/informatics" class="toollink">
47
                Informatics </a></td>
48
            <td><a href="@web-base-url@/biodiversity" class="toollink">
49
                Biodiversity </a></td>
50
            <td><a href="@web-base-url@/education" class="toollink">
51
                Education </a></td>
52
            <td><a href="@web-base-url@/software" class="toollink">
53
                Software </a></td>
54
         </tr>
55 505 jones
         <tr>
56 506 jones
          <td align="right" valign="top" colspan="7">
57 505 jones
            <form action="@html-path@/servlet/metacat" method="POST">
58
             Data Search: <input type="text" name="anyfield" size="10" />
59
             <input type="hidden" name="action" value="query" />
60
             <input type="hidden" name="qformat" value="html" />
61
             <input type="hidden" name="operator" value="UNION" />
62
63
             <input type="hidden" name="returnfield"
64
              value="resource/dataset/originator/individualName/surName" />
65
             <input type="hidden" name="returnfield"
66
              value="resource/dataset/originator/individualName/givenName" />
67
             <input type="hidden" name="returnfield"
68
              value="resource/dataset/originator/organizationName" />
69
             <input type="hidden" name="returnfield"
70
              value="resource/dataset/title" />
71
             <input type="hidden" name="returnfield"
72
              value="eml-dataset/title" />
73
             <input type="hidden" name="returnfield"
74
              value="resource/dataset/keywordInfo/keyword" />
75
             <input type="hidden" name="returndoc"
76
              value="-//NCEAS//resource//EN" />
77
             <input type="hidden" name="returndoc"
78
              value="-//NCEAS//eml-dataset//EN" />
79
           </form>
80
          </td>
81
        </tr>
82
       </table>
83 51 jones
84 505 jones
       <p><xsl:number value="count(resultset/document)" /> documents found.</p>
85
       <!-- This tests to see if there are returned documents,
86
            if there are not then don't show the query results -->
87
       <xsl:if test="count(resultset/document) &gt; 0">
88
         <center>
89
           <u><h2>Results</h2></u>
90
         </center>
91
92
         <table width="100%">
93
           <tr>
94 506 jones
             <th class="tablehead">Title</th>
95
             <th class="tablehead">Action</th>
96
             <th class="tablehead">Related Documents</th>
97
             <th class="tablehead">Contacts</th>
98
             <th class="tablehead">Organization</th>
99
             <th class="tablehead">Keywords</th>
100 505 jones
           </tr>
101
102
         <xsl:for-each select="resultset/document">
103
           <xsl:sort select="doctitle"/>
104
           <tr valign="top">
105
             <xsl:attribute name="class">
106
               <xsl:choose>
107
                 <xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
108
                 <xsl:when test="position() mod 2 = 0">roweven</xsl:when>
109
               </xsl:choose>
110
             </xsl:attribute>
111 85 jones
112 505 jones
             <td>
113
               <xsl:value-of select="./param[@name='resource/dataset/title']"/>
114
               <xsl:value-of select="./param[@name='eml-dataset/title']"/>
115
               <br/>
116
               <p><pre>Document ID: <xsl:value-of select="./docid"/></pre></p>
117
             </td>
118
             <td>
119 566 jones
               <form action="@html-path@/servlet/metacat" method="POST">
120 505 jones
                 <xsl:attribute name="name">
121 566 jones
                   <xsl:value-of select="translate(./docid,'.','')"/>
122 505 jones
                 </xsl:attribute>
123
                 <!-- abstractpath tells the servlet where the abstract is in
124
                      the document.  The % sign is used because the path could
125
                      be resource/literature or resource/dataset. -->
126
                 <input type="hidden" name="abstractpath"
127
                        value="resource/%/abstract" />
128 566 jones
                 <input type="hidden" name="action" value="read"/>
129 505 jones
                 <input type="hidden" name="docid">
130
                   <xsl:attribute name="value">
131
                     <xsl:value-of select="./docid"/>
132
                   </xsl:attribute>
133
                 </input>
134
                 <xsl:for-each select="./relation">
135
                   <input type="hidden" name="relation">
136
                     <xsl:attribute name="value" >
137
                       <xsl:value-of select="./relationdoc" />
138
                     </xsl:attribute>
139
                   </input>
140
                 </xsl:for-each>
141 85 jones
142 505 jones
                 <a>
143 566 jones
                   <xsl:attribute name="href">javascript:submitform('read',document.<xsl:value-of select="translate(./docid, '.', '')"/>)</xsl:attribute>
144 505 jones
                   Dataset Information
145
                 </a><br />
146
                 <a>
147 566 jones
                   <xsl:attribute name="href">javascript:submitform('getabstract',document.<xsl:value-of select="translate(./docid,'.','')"/>)</xsl:attribute>
148 505 jones
                   View Abstract
149
                 </a><br />
150
                 <a>
151 566 jones
                   <xsl:attribute name="href">javascript:submitform('getdatadoc',document.<xsl:value-of select="translate(./docid,'.','')"/>)</xsl:attribute>
152 505 jones
                    Download Data and Metadata
153
                 </a><br />
154
               </form>
155
             </td>
156
             <td>
157
               <xsl:if test="count(./relation) &gt; 0">
158
                 <xsl:for-each select="./relation">
159
                   <a>
160
                     <xsl:if test="starts-with(./relationdoc, 'http')">
161
                       <xsl:attribute name="href">
162
                         <xsl:value-of select="./relationdoc" />
163
                       </xsl:attribute>
164
                       <xsl:if
165
                        test="./relationdoctype = '-//NCEAS//eml-variable//EN'">
166
                         Variable Information
167
                       </xsl:if>
168
                       <xsl:if
169
                        test="./relationdoctype = '-//NCEAS//eml-file//EN'">
170
                         File Information
171
                       </xsl:if>
172
                       <xsl:if
173
                        test="./relationdoctype = '-//NCEAS//eml-access//EN'">
174
                         Access Information
175
                       </xsl:if>
176
                       <xsl:if
177
                        test="./relationdoctype = '-//NCEAS//eml-context//EN'">
178
                         Context Information
179
                       </xsl:if>
180
                       <xsl:if
181
                        test="./relationdoctype = '-//NCEAS//eml-software//EN'">
182
                         Software Information
183
                       </xsl:if>
184
                       <xsl:if
185
                        test="./relationdoctype = '-//NCEAS//eml-status//EN'">
186
                         Status Information
187
                       </xsl:if>
188
                       <xsl:if
189
                        test="./relationdoctype = '-//NCEAS//eml-supplement//EN'">
190
                         Supplemental Information
191
                       </xsl:if>
192
                       <!-- If the doctype is null, this file is assumed to
193
                            be a data file
194
                        -->
195
                       <xsl:if test="./relationdoctype = 'null'">
196
                         Data File
197
                       </xsl:if>
198
                     </xsl:if>
199
                     <xsl:if test="starts-with(./relationdoc, 'metacat')">
200
                       <xsl:attribute name="href">
201 621 berkley
                         <xsl:text>http://@server@@servlet-path@?action=read&amp;qformat=html&amp;docid=</xsl:text>
202 505 jones
                         <xsl:value-of select="./relationdoc" />
203
                       </xsl:attribute>
204
                       <xsl:if
205
                        test="./relationdoctype = '-//NCEAS//eml-variable//EN'">
206
                         Variable Information
207
                       </xsl:if>
208
                       <xsl:if
209
                        test="./relationdoctype = '-//NCEAS//eml-file//EN'">
210
                         File Information
211
                       </xsl:if>
212
                       <xsl:if
213
                        test="./relationdoctype = '-//NCEAS//eml-access//EN'">
214
                         Access Information
215
                       </xsl:if>
216
                       <xsl:if
217
                        test="./relationdoctype = '-//NCEAS//eml-context//EN'">
218
                         Context Information
219
                       </xsl:if>
220
                       <xsl:if
221
                        test="./relationdoctype = '-//NCEAS//eml-software//EN'">
222
                         Software Information
223
                       </xsl:if>
224
                       <xsl:if
225
                        test="./relationdoctype = '-//NCEAS//eml-status//EN'">
226
                         Status Information
227
                       </xsl:if>
228
                       <xsl:if
229
                        test="./relationdoctype = '-//NCEAS//eml-supplement//EN'">
230
                         Supplemental Information
231
                       </xsl:if>
232
                       <!-- If the doctype is null, this file is assumed to
233
                            be a data file
234
                        -->
235
                       <xsl:if test="./relationdoctype = 'null'">
236
                         Data File
237
                       </xsl:if>
238
                     </xsl:if>
239
                   </a>
240
                   <br/>
241
                 </xsl:for-each>
242
               </xsl:if>
243 506 jones
               <xsl:text>&nbsp;</xsl:text>
244 505 jones
             </td>
245
             <td>
246
               <xsl:for-each select="./param[@name='resource/dataset/originator/individualName/surName']" >
247
                 <xsl:value-of select="." />
248
                 <br/>
249 51 jones
250 505 jones
               </xsl:for-each>
251
               <xsl:text>&nbsp;</xsl:text>
252
             </td>
253
             <td>
254
                 <xsl:value-of select=
255
                 "./param[@name='resource/dataset/originator/organizationName']"                 />
256
                 <xsl:text>&nbsp;</xsl:text>
257
             </td>
258
259
             <td>
260
               <xsl:for-each
261
                select="./param[@name='resource/dataset/keywordInfo/keyword']">
262
                 <xsl:value-of select="." />
263
                 <br/>
264
               </xsl:for-each>
265
               <xsl:text>&nbsp;</xsl:text>
266
             </td>
267
           </tr>
268 51 jones
269 505 jones
          </xsl:for-each>
270
          </table>
271 51 jones
272 505 jones
       </xsl:if>
273 51 jones
      </body>
274
    </html>
275
  </xsl:template>
276
277
</xsl:stylesheet>