Project

General

Profile

1 5385 leinfelder
<?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$'
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
	* 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 5536 leinfelder
<xsl:stylesheet
32
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
33
	xmlns:sms="http://ecoinformatics.org/sms/annotation.0.9"
34 5385 leinfelder
	version="1.0">
35 5541 leinfelder
	<xsl:import href="annotation-root.xsl"/>
36 5385 leinfelder
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 5574 leinfelder
			<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
65 5385 leinfelder
				<script language="JavaScript">
66
					insertTemplateOpening('<xsl:value-of select="$contextURL" />'); insertSearchBox('<xsl:value-of select="$contextURL" />');
67
				</script>
68 5574 leinfelder
69
				<div id="content_wrapper">
70
71 5385 leinfelder
				<table style="width:100%;" align="center" border="0"
72
					cellpadding="5" cellspacing="0">
73
					<tr>
74
						<td align="left">
75
							<p class="emphasis">
76
								<xsl:number
77
									value="count(resultset/document)" />
78
								total records found
79
							</p>
80
						</td>
81
					</tr>
82
				</table>
83
84 5536 leinfelder
				<table align="left" border="0" cellpadding="0" cellspacing="5" width="100%">
85 5385 leinfelder
					<tr valign="top">
86
87
						<!-- ANNOTATIONS HERE  -->
88
						<xsl:if test="count(resultset/document[docname='annotation']) &gt; 0">
89 5533 leinfelder
							<td>
90 5385 leinfelder
								<xsl:call-template name="annotationResults"/>
91
							</td>
92 5536 leinfelder
						</xsl:if>
93 5385 leinfelder
94
						<!-- EML HERE  -->
95
						<xsl:if test="count(resultset/document[docname='eml']) &gt; 0">
96 5533 leinfelder
							<td>
97 5385 leinfelder
								<xsl:call-template name="emlResults"/>
98
							</td>
99
						</xsl:if>
100
101
					</tr>
102
				</table>
103
104 5574 leinfelder
				</div>
105
106 5385 leinfelder
				<script language="JavaScript">
107
					insertTemplateClosing('<xsl:value-of select="$contextURL" />');
108
				</script>
109
			</body>
110
		</html>
111
	</xsl:template>
112
113
	<xsl:template name="emlResults">
114 5536 leinfelder
		<table align="center" border="0" cellpadding="5" cellspacing="0" width="100%">
115
			<tr class="subpanel">
116 5385 leinfelder
				<th class="tablehead" colspan="4">
117
					Datapackages
118
				</th>
119
			</tr>
120 5536 leinfelder
			<tr class="subpanel">
121 5385 leinfelder
				<th	style="text-align: left">
122
					Title
123
				</th>
124
				<th	style="text-align: left">
125
					Owners[s]
126
				</th>
127
				<th	style="text-align: left">
128
					Organization[s]
129
				</th>
130
				<th	style="text-align: left">
131
					Keywords
132
				</th>
133
			</tr>
134
135
			<xsl:for-each
136
				select="resultset/document[docname='eml']">
137
				<xsl:sort
138
					select="./param[@name='dataset/title']" />
139
				<tr valign="top" class="subpanel">
140
					<xsl:attribute name="class">
141
	              			<xsl:choose>
142
						    <xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
143
						    <xsl:when test="position() mod 2 = 0">roweven</xsl:when>
144
						</xsl:choose>
145
					</xsl:attribute>
146
147
					<td class="text_plain">
148
						<form action="/knb/metacat"
149
							method="POST">
150
							<xsl:attribute name="name">
151
								<xsl:value-of select="translate(./docid, '()-.', '____')" />
152
							</xsl:attribute>
153
154
							<input type="hidden"
155
								name="qformat" />
156
							<input type="hidden"
157
								name="sessionid" />
158
							<input type="hidden"
159
								name="action" value="read" />
160
							<input type="hidden"
161
								name="docid">
162
								<xsl:attribute name="value">
163
									<xsl:value-of select="./docid" />
164
								</xsl:attribute>
165
							</input>
166
							<a>
167
								<xsl:attribute name="href">javascript:submitform('read',document.<xsl:value-of	select="translate(./docid, '()-.', '____')" />)</xsl:attribute>
168
								<xsl:text>&#187;&#160;</xsl:text>
169
								<xsl:value-of select="./param[@name='dataset/title']"/>
170
							</a>
171
							<br />
172
							<br />
173
							<p>
174
								<pre>ID: <xsl:value-of select="./docid" /></pre>
175
							</p>
176
177
						</form>
178
					</td>
179
180
					<td class="text_plain">
181
						<xsl:for-each
182
							select="./param[@name='creator/individualName/surName']">
183
							<xsl:value-of select="." />
184
							<br />
185
						</xsl:for-each>
186
					</td>
187
188
					<td class="text_plain">
189
						<xsl:for-each
190
							select="./param[@name='creator/organizationName']">
191
							<xsl:value-of select="." />
192
							<br />
193
						</xsl:for-each>
194
					</td>
195
196
					<td class="text_plain">
197
						<xsl:for-each
198
							select="./param[@name='keyword']">
199
							<xsl:value-of select="." />
200
							<br />
201
						</xsl:for-each>
202
					</td>
203
204
				</tr>
205 5536 leinfelder
206
				<!-- annotation content -->
207
				<tr>
208
					<td colspan="5">
209
						<xsl:for-each select="./*[local-name()='annotation']">
210
							<xsl:call-template name="annotation" />
211
						</xsl:for-each>
212
					</td>
213
				</tr>
214
215 5385 leinfelder
				<tr class="searchresultsdivider">
216
					<td colspan="5">
217
					</td>
218
				</tr>
219
220
			</xsl:for-each>
221
		</table>
222
	</xsl:template>
223
224
	<xsl:template name="annotationResults">
225 5536 leinfelder
		<table align="left" border="0" cellpadding="5" cellspacing="0" width="100%">
226 5385 leinfelder
			<tr>
227
				<th class="tablehead" colspan="3">
228
					Annotations
229
				</th>
230
			</tr>
231
232 5536 leinfelder
			<tr class="subpanel">
233 5385 leinfelder
				<th	style="text-align: left">
234
					Identifier
235
				</th>
236
				<th	style="text-align: left">
237
					Datapackage
238
				</th>
239
				<th	style="text-align: left">
240
					Entities
241
				</th>
242
			</tr>
243
244
			<xsl:for-each select="resultset/document[docname='annotation']">
245
				<xsl:sort select="./param[@name='@id']" />
246
				<tr valign="top">
247
					<xsl:attribute name="class">
248
						<xsl:choose>
249
							<xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
250
							<xsl:when test="position() mod 2 = 0">roweven</xsl:when>
251
						</xsl:choose>
252
					</xsl:attribute>
253
254
					<td class="text_plain">
255
						<a>
256
							<xsl:attribute name="href">javascript:submitform('read',document.<xsl:value-of select="translate(./docid, '()-.', '____')" />)</xsl:attribute>
257
							<xsl:text>&#187;&#160;</xsl:text>
258
							<xsl:value-of select="./docid" />
259
						</a>
260
						<form action="{$contextURL}/metacat" method="POST">
261
							<xsl:attribute name="name">
262
								<xsl:value-of select="translate(./docid, '()-.', '____')" />
263
							</xsl:attribute>
264
							<input type="hidden" name="qformat" value="{$qformat}"/>
265
							<input type="hidden" name="sessionid" />
266
							<input type="hidden" name="action" value="read" />
267
							<input type="hidden" name="docid">
268
								<xsl:attribute name="value">
269
									<xsl:value-of select="./docid" />
270
								</xsl:attribute>
271
							</input>
272
						</form>
273
					</td>
274
275
					<td class="text_plain">
276
						<a>
277
							<xsl:attribute name="href">javascript:submitform('read',document.<xsl:value-of select="concat(translate(./param[@name='@emlPackage'], '()-.', '____'), '_annotation')" />)</xsl:attribute>
278
							<xsl:value-of select="./param[@name='@emlPackage']"/>
279
						</a>
280
281
						<form action="{$contextURL}/metacat" method="POST">
282
							<xsl:attribute name="name">
283
								<xsl:value-of select="concat(translate(./param[@name='@emlPackage'], '()-.', '____'), '_annotation')" />
284
							</xsl:attribute>
285
							<input type="hidden" name="qformat" value="{$qformat}"/>
286
							<input type="hidden" name="sessionid" />
287
							<input type="hidden" name="action" value="read" />
288
							<input type="hidden" name="docid">
289
								<xsl:attribute name="value">
290
									<xsl:value-of select="./param[@name='@emlPackage']"/>
291
								</xsl:attribute>
292
							</input>
293
						</form>
294
295
					</td>
296
297
					<td class="text_plain">
298
						<xsl:for-each
299
							select="./param[@name='entity/@id']">
300
							<xsl:value-of select="." />
301
							<br />
302
						</xsl:for-each>
303
					</td>
304
305
306
				</tr>
307
308
				<tr class="searchresultsdivider">
309
					<td colspan="3">
310
					</td>
311
				</tr>
312
313
			</xsl:for-each>
314
		</table>
315
316
	</xsl:template>
317
318
</xsl:stylesheet>