Project

General

Profile

metacat / lib / style / resultset.xsl @ 505

1
<?xml version="1.0"?>
2
<!--
3
  * resultset.xsl
4
  *
5
  *      Authors: Matt Jones, Chad Berkley
6
  *    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
  *      Created: 2000 July 20
10
  *    File Info: '$Id: resultset.xsl 505 2000-10-28 02:07:29Z jones $' 
11
  *
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
        <link rel="stylesheet" type="text/css" 
22
              href="@html-path@/style/rowcol.css" />
23
        <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
      </head>
32

    
33
      <body>
34
        <table width="100%">
35
         <tr>
36
          <td align="right" valign="top">
37
            <form action="@html-path@/servlet/metacat" method="POST">
38
             Data Search: <input type="text" name="anyfield" size="10" />
39
             <input type="hidden" name="action" value="query" />   
40
             <input type="hidden" name="qformat" value="html" />
41
             <input type="hidden" name="operator" value="UNION" />
42
            
43
             <input type="hidden" name="returnfield" 
44
              value="resource/dataset/originator/individualName/surName" />
45
             <input type="hidden" name="returnfield" 
46
              value="resource/dataset/originator/individualName/givenName" />
47
             <input type="hidden" name="returnfield" 
48
              value="resource/dataset/originator/organizationName" />
49
             <input type="hidden" name="returnfield" 
50
              value="resource/dataset/title" />
51
             <input type="hidden" name="returnfield" 
52
              value="eml-dataset/title" />
53
             <input type="hidden" name="returnfield" 
54
              value="resource/dataset/keywordInfo/keyword" />
55
             <input type="hidden" name="returndoc"
56
              value="-//NCEAS//resource//EN" />
57
             <input type="hidden" name="returndoc"
58
              value="-//NCEAS//eml-dataset//EN" />
59
           </form>
60
          </td>
61
        </tr>  
62
       </table>
63
        
64
       <p><xsl:number value="count(resultset/document)" /> documents found.</p>
65
       <!-- This tests to see if there are returned documents,
66
            if there are not then don't show the query results -->
67
       <xsl:if test="count(resultset/document) &gt; 0">
68
         <center>
69
           <u><h2>Results</h2></u>
70
         </center>
71
          
72
         <table width="100%">
73
           <tr>
74
             <th class="sectionhead">Title</th>
75
             <th class="sectionhead">Action</th>
76
             <th class="sectionhead">Related Documents</th>
77
             <th class="sectionhead">Contacts</th>
78
             <th class="sectionhead">Organization</th>
79
             <th class="sectionhead">Keywords</th>
80
           </tr>
81
        
82
         <xsl:for-each select="resultset/document">
83
           <xsl:sort select="doctitle"/>
84
           <tr valign="top">
85
             <xsl:attribute name="class">
86
               <xsl:choose>
87
                 <xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
88
                 <xsl:when test="position() mod 2 = 0">roweven</xsl:when>
89
               </xsl:choose>
90
             </xsl:attribute>
91

    
92
             <td>
93
               <xsl:value-of select="./param[@name='resource/dataset/title']"/>
94
               <xsl:value-of select="./param[@name='eml-dataset/title']"/>
95
               <br/>
96
               <p><pre>Document ID: <xsl:value-of select="./docid"/></pre></p>
97
             </td>
98
             <td>
99
               <form action="@html-path@/servlet/marine" method="POST">
100
                 <xsl:attribute name="name">
101
                   <xsl:value-of select="translate(./docid,':','')"/>
102
                 </xsl:attribute>
103
                 <!-- abstractpath tells the servlet where the abstract is in 
104
                      the document.  The % sign is used because the path could 
105
                      be resource/literature or resource/dataset. -->
106
                 <input type="hidden" name="abstractpath" 
107
                        value="resource/%/abstract" />
108
                 <input type="hidden" name="action" value="getdocument"/>
109
                 <input type="hidden" name="docid">
110
                   <xsl:attribute name="value">
111
                     <xsl:value-of select="./docid"/>
112
                   </xsl:attribute>
113
                 </input>
114
                 <xsl:for-each select="./relation">
115
                   <input type="hidden" name="relation">
116
                     <xsl:attribute name="value" >
117
                       <xsl:value-of select="./relationdoc" />
118
                     </xsl:attribute>
119
                   </input>
120
                 </xsl:for-each>
121

    
122
                 <a>
123
                   <xsl:attribute name="href">javascript:submitform('getdocument',document.<xsl:value-of select="translate(./docid, ':', '')"/>)</xsl:attribute>
124
                   Dataset Information
125
                 </a><br />
126
                 <a>
127
                   <xsl:attribute name="href">javascript:submitform('getabstract',document.<xsl:value-of select="translate(./docid,':','')"/>)</xsl:attribute>
128
                   View Abstract
129
                 </a><br />
130
                 <a>
131
                   <xsl:attribute name="href">javascript:submitform('getdatadoc',document.<xsl:value-of select="translate(./docid,':','')"/>)</xsl:attribute>
132
                    Download Data and Metadata
133
                 </a><br />
134
               </form>
135
             </td>
136
             <td>
137
               <xsl:if test="count(./relation) &gt; 0">
138
                 <xsl:for-each select="./relation">
139
                   <a>
140
                     <xsl:if test="starts-with(./relationdoc, 'http')">
141
                       <xsl:attribute name="href">
142
                         <xsl:value-of select="./relationdoc" />
143
                       </xsl:attribute>
144
                       <xsl:if 
145
                        test="./relationdoctype = '-//NCEAS//eml-variable//EN'">
146
                         Variable Information
147
                       </xsl:if>
148
                       <xsl:if 
149
                        test="./relationdoctype = '-//NCEAS//eml-file//EN'">
150
                         File Information
151
                       </xsl:if>
152
                       <xsl:if 
153
                        test="./relationdoctype = '-//NCEAS//eml-access//EN'">
154
                         Access Information
155
                       </xsl:if>
156
                       <xsl:if 
157
                        test="./relationdoctype = '-//NCEAS//eml-context//EN'">
158
                         Context Information
159
                       </xsl:if>
160
                       <xsl:if 
161
                        test="./relationdoctype = '-//NCEAS//eml-software//EN'">
162
                         Software Information
163
                       </xsl:if>
164
                       <xsl:if 
165
                        test="./relationdoctype = '-//NCEAS//eml-status//EN'">
166
                         Status Information
167
                       </xsl:if>
168
                       <xsl:if 
169
                        test="./relationdoctype = '-//NCEAS//eml-supplement//EN'">
170
                         Supplemental Information
171
                       </xsl:if>
172
                       <!-- If the doctype is null, this file is assumed to 
173
                            be a data file
174
                        -->
175
                       <xsl:if test="./relationdoctype = 'null'">
176
                         Data File
177
                       </xsl:if>
178
                     </xsl:if>
179
                     <xsl:if test="starts-with(./relationdoc, 'metacat')">
180
                       <xsl:attribute name="href">
181
                         <xsl:text>http://dev.nceas.ucsb.edu@html-path@/servlet/marine/?action=getrelateddocument&amp;qformat=html&amp;url=</xsl:text>
182
                         <xsl:value-of select="./relationdoc" />
183
                       </xsl:attribute>
184
                       <xsl:if 
185
                        test="./relationdoctype = '-//NCEAS//eml-variable//EN'">
186
                         Variable Information
187
                       </xsl:if>
188
                       <xsl:if 
189
                        test="./relationdoctype = '-//NCEAS//eml-file//EN'">
190
                         File Information
191
                       </xsl:if>
192
                       <xsl:if 
193
                        test="./relationdoctype = '-//NCEAS//eml-access//EN'">
194
                         Access Information
195
                       </xsl:if>
196
                       <xsl:if 
197
                        test="./relationdoctype = '-//NCEAS//eml-context//EN'">
198
                         Context Information
199
                       </xsl:if>
200
                       <xsl:if 
201
                        test="./relationdoctype = '-//NCEAS//eml-software//EN'">
202
                         Software Information
203
                       </xsl:if>
204
                       <xsl:if 
205
                        test="./relationdoctype = '-//NCEAS//eml-status//EN'">
206
                         Status Information
207
                       </xsl:if>
208
                       <xsl:if 
209
                        test="./relationdoctype = '-//NCEAS//eml-supplement//EN'">
210
                         Supplemental Information
211
                       </xsl:if>
212
                       <!-- If the doctype is null, this file is assumed to 
213
                            be a data file
214
                        -->
215
                       <xsl:if test="./relationdoctype = 'null'">
216
                         Data File
217
                       </xsl:if>
218
                     </xsl:if>
219
                   </a>
220
                   <br/>
221
                 </xsl:for-each>  
222
               </xsl:if>
223
             </td>
224
             <td>
225
               <xsl:for-each select="./param[@name='resource/dataset/originator/individualName/surName']" >  
226
                 <xsl:value-of select="." />
227
                 <br/>
228

    
229
               </xsl:for-each>
230
               <xsl:text>&nbsp;</xsl:text>
231
             </td>
232
             <td>
233
                 <xsl:value-of select=
234
                 "./param[@name='resource/dataset/originator/organizationName']"                 />
235
                 <xsl:text>&nbsp;</xsl:text>
236
             </td>
237
  
238
             <td>
239
               <xsl:for-each
240
                select="./param[@name='resource/dataset/keywordInfo/keyword']">
241
                 <xsl:value-of select="." />
242
                 <br/>
243
               </xsl:for-each>
244
               <xsl:text>&nbsp;</xsl:text>
245
             </td>
246
           </tr>
247

    
248
          </xsl:for-each>
249
          </table>
250

    
251
       </xsl:if>
252
      </body>
253
    </html>
254
  </xsl:template>
255

    
256
</xsl:stylesheet>