Project

General

Profile

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: leinfelder $'
10
	*     '$Date: 2010-09-07 15:06:47 -0700 (Tue, 07 Sep 2010) $'
11
	* '$Revision: 5541 $'
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 
32
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
33
	xmlns:sms="http://ecoinformatics.org/sms/annotation.0.9"
34
	version="1.0">
35
	<xsl:import href="annotation-root.xsl"/>
36

    
37
	<xsl:output method="html" />
38
	<xsl:param name="sessid" />
39
	<xsl:param name="qformat">semtools</xsl:param>
40
	<xsl:param name="enableediting">false</xsl:param>
41
	<xsl:param name="contextURL"/>
42
	<xsl:template match="/">
43
		<html>
44
			<head>
45
				<title>Search Results</title>
46
				<link rel="stylesheet" type="text/css"
47
					href="/knb/style/skins/{$qformat}/{$qformat}.css" />
48
				<script language="Javascript" type="text/JavaScript"
49
					src="/knb/style/skins/{$qformat}/{$qformat}.js" />
50
				<script language="Javascript" type="text/JavaScript"
51
					src="/knb/style/common/branding.js" />
52
				<script language="JavaScript">
53
					<![CDATA[
54
					function submitform(action,form_ref) {
55
						form_ref.action.value=action;
56
						form_ref.sessionid.value="]]><xsl:value-of select="$sessid" /><![CDATA[";
57
						form_ref.qformat.value="]]><xsl:value-of select="$qformat" /><![CDATA[";
58
						form_ref.submit();
59
					}
60
					]]>
61
				</script>
62
			</head>
63

    
64
			<body leftmargin="0" topmargin="0" marginwidth="0"
65
				marginheight="0">
66
				<script language="JavaScript">
67
					insertTemplateOpening('<xsl:value-of select="$contextURL" />'); insertSearchBox('<xsl:value-of select="$contextURL" />');
68
				</script>
69

    
70
				<table style="width:100%;" align="center" border="0"
71
					cellpadding="5" cellspacing="0">
72
					<tr>
73
						<td align="left">
74
							<p class="emphasis">
75
								<xsl:number
76
									value="count(resultset/document)" />
77
								total records found
78
							</p>
79
						</td>
80
					</tr>
81
				</table>
82

    
83
				<table align="left" border="0" cellpadding="0" cellspacing="5" width="100%">
84
					<tr valign="top">
85
						
86
						<!-- ANNOTATIONS HERE  -->
87
						<xsl:if test="count(resultset/document[docname='annotation']) &gt; 0">
88
							<td>
89
								<xsl:call-template name="annotationResults"/>
90
							</td>	
91
						</xsl:if>	
92
							
93
						<!-- EML HERE  -->
94
						<xsl:if test="count(resultset/document[docname='eml']) &gt; 0">
95
							<td>
96
								<xsl:call-template name="emlResults"/>
97
							</td>	
98
						</xsl:if>
99
						
100
					</tr>	
101
				</table>
102
				
103
				<script language="JavaScript">
104
					insertTemplateClosing('<xsl:value-of select="$contextURL" />');
105
				</script>
106
			</body>
107
		</html>
108
	</xsl:template>
109
	
110
	<xsl:template name="emlResults">
111
		<table align="center" border="0" cellpadding="5" cellspacing="0" width="100%">
112
			<tr class="subpanel">
113
				<th class="tablehead" colspan="4">
114
					Datapackages
115
				</th>
116
			</tr>	
117
			<tr class="subpanel">
118
				<th	style="text-align: left">
119
					Title
120
				</th>
121
				<th	style="text-align: left">
122
					Owners[s]
123
				</th>
124
				<th	style="text-align: left">
125
					Organization[s]
126
				</th>
127
				<th	style="text-align: left">
128
					Keywords
129
				</th>
130
			</tr>
131
	
132
			<xsl:for-each
133
				select="resultset/document[docname='eml']">
134
				<xsl:sort
135
					select="./param[@name='dataset/title']" />
136
				<tr valign="top" class="subpanel">
137
					<xsl:attribute name="class">
138
	              			<xsl:choose>
139
						    <xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
140
						    <xsl:when test="position() mod 2 = 0">roweven</xsl:when>
141
						</xsl:choose>
142
					</xsl:attribute>
143
	
144
					<td class="text_plain">
145
						<form action="/knb/metacat"
146
							method="POST">
147
							<xsl:attribute name="name">
148
								<xsl:value-of select="translate(./docid, '()-.', '____')" />
149
							</xsl:attribute>
150
	
151
							<input type="hidden"
152
								name="qformat" />
153
							<input type="hidden"
154
								name="sessionid" />
155
							<input type="hidden"
156
								name="action" value="read" />
157
							<input type="hidden"
158
								name="docid">
159
								<xsl:attribute name="value">
160
									<xsl:value-of select="./docid" />
161
								</xsl:attribute>
162
							</input>
163
							<a>
164
								<xsl:attribute name="href">javascript:submitform('read',document.<xsl:value-of	select="translate(./docid, '()-.', '____')" />)</xsl:attribute>
165
								<xsl:text>&#187;&#160;</xsl:text>
166
								<xsl:value-of select="./param[@name='dataset/title']"/>
167
							</a>
168
							<br />
169
							<br />
170
							<p>
171
								<pre>ID: <xsl:value-of select="./docid" /></pre>
172
							</p>
173
	
174
						</form>
175
					</td>
176
					
177
					<td class="text_plain">
178
						<xsl:for-each
179
							select="./param[@name='creator/individualName/surName']">
180
							<xsl:value-of select="." />
181
							<br />
182
						</xsl:for-each>
183
					</td>
184
					
185
					<td class="text_plain">
186
						<xsl:for-each
187
							select="./param[@name='creator/organizationName']">
188
							<xsl:value-of select="." />
189
							<br />
190
						</xsl:for-each>
191
					</td>
192
	
193
					<td class="text_plain">
194
						<xsl:for-each
195
							select="./param[@name='keyword']">
196
							<xsl:value-of select="." />
197
							<br />
198
						</xsl:for-each>
199
					</td>
200
	
201
				</tr>
202
				
203
				<!-- annotation content -->
204
				<tr>
205
					<td colspan="5">
206
						<xsl:for-each select="./*[local-name()='annotation']">
207
							<xsl:call-template name="annotation" />	
208
						</xsl:for-each>
209
					</td>
210
				</tr>
211
				
212
				<tr class="searchresultsdivider">
213
					<td colspan="5">
214
					</td>
215
				</tr>
216
	
217
			</xsl:for-each>
218
		</table>
219
	</xsl:template>
220
	
221
	<xsl:template name="annotationResults">
222
		<table align="left" border="0" cellpadding="5" cellspacing="0" width="100%">		
223
			<tr>
224
				<th class="tablehead" colspan="3">
225
					Annotations
226
				</th>
227
			</tr>
228
				
229
			<tr class="subpanel">
230
				<th	style="text-align: left">
231
					Identifier
232
				</th>
233
				<th	style="text-align: left">
234
					Datapackage
235
				</th>
236
				<th	style="text-align: left">
237
					Entities
238
				</th>
239
			</tr>
240

    
241
			<xsl:for-each select="resultset/document[docname='annotation']">
242
				<xsl:sort select="./param[@name='@id']" />
243
				<tr valign="top">
244
					<xsl:attribute name="class">
245
						<xsl:choose>
246
							<xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
247
							<xsl:when test="position() mod 2 = 0">roweven</xsl:when>
248
						</xsl:choose>
249
					</xsl:attribute>
250

    
251
					<td class="text_plain">
252
						<a>
253
							<xsl:attribute name="href">javascript:submitform('read',document.<xsl:value-of select="translate(./docid, '()-.', '____')" />)</xsl:attribute>
254
							<xsl:text>&#187;&#160;</xsl:text>
255
							<xsl:value-of select="./docid" />
256
						</a>
257
						<form action="{$contextURL}/metacat" method="POST">
258
							<xsl:attribute name="name">
259
								<xsl:value-of select="translate(./docid, '()-.', '____')" />
260
							</xsl:attribute>
261
							<input type="hidden" name="qformat" value="{$qformat}"/>
262
							<input type="hidden" name="sessionid" />
263
							<input type="hidden" name="action" value="read" />
264
							<input type="hidden" name="docid">
265
								<xsl:attribute name="value">
266
									<xsl:value-of select="./docid" />
267
								</xsl:attribute>
268
							</input>
269
						</form>	
270
					</td>
271
					
272
					<td class="text_plain">
273
						<a>
274
							<xsl:attribute name="href">javascript:submitform('read',document.<xsl:value-of select="concat(translate(./param[@name='@emlPackage'], '()-.', '____'), '_annotation')" />)</xsl:attribute>
275
							<xsl:value-of select="./param[@name='@emlPackage']"/>
276
						</a>
277
						
278
						<form action="{$contextURL}/metacat" method="POST">
279
							<xsl:attribute name="name">
280
								<xsl:value-of select="concat(translate(./param[@name='@emlPackage'], '()-.', '____'), '_annotation')" />
281
							</xsl:attribute>
282
							<input type="hidden" name="qformat" value="{$qformat}"/>
283
							<input type="hidden" name="sessionid" />
284
							<input type="hidden" name="action" value="read" />
285
							<input type="hidden" name="docid">
286
								<xsl:attribute name="value">
287
									<xsl:value-of select="./param[@name='@emlPackage']"/>
288
								</xsl:attribute>
289
							</input>
290
						</form>
291
						
292
					</td>
293
					
294
					<td class="text_plain">
295
						<xsl:for-each
296
							select="./param[@name='entity/@id']">
297
							<xsl:value-of select="." />
298
							<br />
299
						</xsl:for-each>
300
					</td>
301
							
302

    
303
				</tr>
304
				
305
				<tr class="searchresultsdivider">
306
					<td colspan="3">
307
					</td>
308
				</tr>
309

    
310
			</xsl:for-each>
311
		</table>
312
	
313
	</xsl:template>
314

    
315
</xsl:stylesheet>
(8-8/16)