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	style="text-align: left">
117
					Title
118
				</th>
119
				<th	style="text-align: left">
120
					Owners[s]
121
				</th>
122
				<th	style="text-align: left">
123
					Organization[s]
124
				</th>
125
				<th	style="text-align: left">
126
					Keywords
127
				</th>
128
			</tr>
129
130
			<xsl:for-each
131
				select="resultset/document[docname='eml']">
132
				<xsl:sort
133
					select="./param[@name='dataset/title']" />
134
				<tr valign="top" class="subpanel">
135
					<xsl:attribute name="class">
136
	              			<xsl:choose>
137
						    <xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
138
						    <xsl:when test="position() mod 2 = 0">roweven</xsl:when>
139
						</xsl:choose>
140
					</xsl:attribute>
141
142
					<td class="text_plain">
143
						<form action="/knb/metacat"
144
							method="POST">
145
							<xsl:attribute name="name">
146
								<xsl:value-of select="translate(./docid, '()-.', '____')" />
147
							</xsl:attribute>
148
149
							<input type="hidden"
150
								name="qformat" />
151
							<input type="hidden"
152
								name="sessionid" />
153
							<input type="hidden"
154
								name="action" value="read" />
155
							<input type="hidden"
156
								name="docid">
157
								<xsl:attribute name="value">
158
									<xsl:value-of select="./docid" />
159
								</xsl:attribute>
160
							</input>
161
							<a>
162
								<xsl:attribute name="href">javascript:submitform('read',document.<xsl:value-of	select="translate(./docid, '()-.', '____')" />)</xsl:attribute>
163
								<xsl:text>&#187;&#160;</xsl:text>
164
								<xsl:value-of select="./param[@name='dataset/title']"/>
165
							</a>
166
							<br />
167
							<br />
168
							<p>
169
								<pre>ID: <xsl:value-of select="./docid" /></pre>
170
							</p>
171
172
						</form>
173
					</td>
174
175
					<td class="text_plain">
176
						<xsl:for-each
177
							select="./param[@name='creator/individualName/surName']">
178
							<xsl:value-of select="." />
179
							<br />
180
						</xsl:for-each>
181
					</td>
182
183
					<td class="text_plain">
184
						<xsl:for-each
185
							select="./param[@name='creator/organizationName']">
186
							<xsl:value-of select="." />
187
							<br />
188
						</xsl:for-each>
189
					</td>
190
191
					<td class="text_plain">
192
						<xsl:for-each
193
							select="./param[@name='keyword']">
194
							<xsl:value-of select="." />
195
							<br />
196
						</xsl:for-each>
197
					</td>
198
199
				</tr>
200 5536 leinfelder
201
				<!-- annotation content -->
202
				<tr>
203
					<td colspan="5">
204
						<xsl:for-each select="./*[local-name()='annotation']">
205 5578 leinfelder
							<xsl:call-template name="annotation">
206
								 <xsl:with-param name="showAll" select="false"/>
207
							</xsl:call-template>
208 5536 leinfelder
						</xsl:for-each>
209
					</td>
210
				</tr>
211
212 5385 leinfelder
				<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 5536 leinfelder
		<table align="left" border="0" cellpadding="5" cellspacing="0" width="100%">
223 5385 leinfelder
224 5536 leinfelder
			<tr class="subpanel">
225 5385 leinfelder
				<th	style="text-align: left">
226
					Identifier
227
				</th>
228
				<th	style="text-align: left">
229
					Datapackage
230
				</th>
231
				<th	style="text-align: left">
232
					Entities
233
				</th>
234
			</tr>
235
236
			<xsl:for-each select="resultset/document[docname='annotation']">
237
				<xsl:sort select="./param[@name='@id']" />
238
				<tr valign="top">
239
					<xsl:attribute name="class">
240
						<xsl:choose>
241
							<xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
242
							<xsl:when test="position() mod 2 = 0">roweven</xsl:when>
243
						</xsl:choose>
244
					</xsl:attribute>
245
246
					<td class="text_plain">
247
						<a>
248
							<xsl:attribute name="href">javascript:submitform('read',document.<xsl:value-of select="translate(./docid, '()-.', '____')" />)</xsl:attribute>
249
							<xsl:text>&#187;&#160;</xsl:text>
250
							<xsl:value-of select="./docid" />
251
						</a>
252
						<form action="{$contextURL}/metacat" method="POST">
253
							<xsl:attribute name="name">
254
								<xsl:value-of select="translate(./docid, '()-.', '____')" />
255
							</xsl:attribute>
256
							<input type="hidden" name="qformat" value="{$qformat}"/>
257
							<input type="hidden" name="sessionid" />
258
							<input type="hidden" name="action" value="read" />
259
							<input type="hidden" name="docid">
260
								<xsl:attribute name="value">
261
									<xsl:value-of select="./docid" />
262
								</xsl:attribute>
263
							</input>
264
						</form>
265
					</td>
266
267
					<td class="text_plain">
268
						<a>
269
							<xsl:attribute name="href">javascript:submitform('read',document.<xsl:value-of select="concat(translate(./param[@name='@emlPackage'], '()-.', '____'), '_annotation')" />)</xsl:attribute>
270
							<xsl:value-of select="./param[@name='@emlPackage']"/>
271
						</a>
272
273
						<form action="{$contextURL}/metacat" method="POST">
274
							<xsl:attribute name="name">
275
								<xsl:value-of select="concat(translate(./param[@name='@emlPackage'], '()-.', '____'), '_annotation')" />
276
							</xsl:attribute>
277
							<input type="hidden" name="qformat" value="{$qformat}"/>
278
							<input type="hidden" name="sessionid" />
279
							<input type="hidden" name="action" value="read" />
280
							<input type="hidden" name="docid">
281
								<xsl:attribute name="value">
282
									<xsl:value-of select="./param[@name='@emlPackage']"/>
283
								</xsl:attribute>
284
							</input>
285
						</form>
286
287
					</td>
288
289
					<td class="text_plain">
290
						<xsl:for-each
291
							select="./param[@name='entity/@id']">
292
							<xsl:value-of select="." />
293
							<br />
294
						</xsl:for-each>
295
					</td>
296
297
298
				</tr>
299
300
				<tr class="searchresultsdivider">
301
					<td colspan="3">
302
					</td>
303
				</tr>
304
305
			</xsl:for-each>
306
		</table>
307
308
	</xsl:template>
309
310
</xsl:stylesheet>