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 5951 leinfelder
	xmlns:sms="http://ecoinformatics.org/sms/annotation.1.0beta1"
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 5743 leinfelder
43
	<xsl:param name="labelWidth">120</xsl:param>
44
45 5781 leinfelder
	<xsl:param name="showAdd">true</xsl:param>
46
	<xsl:param name="showRemove">true</xsl:param>
47
48 5385 leinfelder
	<xsl:template match="/">
49
		<html>
50
			<head>
51
				<title>Search Results</title>
52
				<link rel="stylesheet" type="text/css"
53
					href="/knb/style/skins/{$qformat}/{$qformat}.css" />
54
				<script language="Javascript" type="text/JavaScript"
55
					src="/knb/style/skins/{$qformat}/{$qformat}.js" />
56
				<script language="Javascript" type="text/JavaScript"
57
					src="/knb/style/common/branding.js" />
58
			</head>
59
60 5574 leinfelder
			<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
61 5385 leinfelder
				<script language="JavaScript">
62
					insertTemplateOpening('<xsl:value-of select="$contextURL" />'); insertSearchBox('<xsl:value-of select="$contextURL" />');
63
				</script>
64 5574 leinfelder
65
				<div id="content_wrapper">
66
67 5385 leinfelder
				<table style="width:100%;" align="center" border="0"
68
					cellpadding="5" cellspacing="0">
69
					<tr>
70
						<td align="left">
71
							<p class="emphasis">
72 5784 leinfelder
								<span class="resultCount">
73
									<xsl:number
74
										value="count(resultset/document)" />
75
								</span>
76 5385 leinfelder
								total records found
77
							</p>
78
						</td>
79
					</tr>
80
				</table>
81
82 5536 leinfelder
				<table align="left" border="0" cellpadding="0" cellspacing="5" width="100%">
83 5385 leinfelder
					<tr valign="top">
84
85
						<!-- EML HERE  -->
86
						<xsl:if test="count(resultset/document[docname='eml']) &gt; 0">
87 5533 leinfelder
							<td>
88 5385 leinfelder
								<xsl:call-template name="emlResults"/>
89
							</td>
90
						</xsl:if>
91
92
					</tr>
93
				</table>
94
95 6008 leinfelder
				<!-- render the unioned data -->
96
				<xsl:if test="count(resultset/data) &gt; 0">
97
					<table class="subGroup subGroup_border onehundred_percent" align="center" border="0"
98
						cellpadding="5" cellspacing="0">
99
						<tr>
100
							<th align="left">
101
								<p class="emphasis">
102
									Combined Data
103
								</p>
104
							</th>
105
						</tr>
106
						<tr>
107
							<td align="left">
108
								<pre>
109
									<xsl:value-of select="resultset/data" />
110
								</pre>
111
							</td>
112
						</tr>
113
					</table>
114
				</xsl:if>
115
116 5574 leinfelder
				</div>
117
118 5385 leinfelder
				<script language="JavaScript">
119
					insertTemplateClosing('<xsl:value-of select="$contextURL" />');
120
				</script>
121
			</body>
122
		</html>
123
	</xsl:template>
124
125
	<xsl:template name="emlResults">
126
127 5677 leinfelder
		<div id="results">
128
129 5385 leinfelder
			<xsl:for-each
130
				select="resultset/document[docname='eml']">
131
				<xsl:sort
132
					select="./param[@name='dataset/title']" />
133 5675 leinfelder
134
				<!-- the header portion of the result -->
135 5677 leinfelder
				<div>
136 5385 leinfelder
					<xsl:attribute name="class">
137
	              			<xsl:choose>
138 5762 leinfelder
						    <xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
139
						    <xsl:when test="position() mod 2 = 0">roweven</xsl:when>
140 5385 leinfelder
						</xsl:choose>
141
					</xsl:attribute>
142 5765 leinfelder
143
					<a href="#" class="accordian">+</a><xsl:text> </xsl:text>
144
145 5762 leinfelder
					<!-- citation -->
146
					<xsl:call-template name="citation"/>
147 5739 leinfelder
148 5790 leinfelder
					<!-- edit cart -->
149 5781 leinfelder
					<xsl:if test="$showAdd = 'true'">
150 5790 leinfelder
						<input type="button" class="addCartButton">
151 5781 leinfelder
							<xsl:attribute name="id">
152
								<xsl:text>add_</xsl:text><xsl:value-of select="replace(./docid, '\.', '_')"/>
153
							</xsl:attribute>
154
							<xsl:attribute name="onclick">
155
								var params =
156
									{
157
										'action': 'editcart',
158
										'docid': '<xsl:value-of select="./docid"/>',
159
										'operation': 'add',
160
										'qformat': 'semtools'
161
									};
162
								load(
163
									'<xsl:value-of select="$contextURL" />/metacat', //url
164 5783 leinfelder
									params
165 5781 leinfelder
									);
166
								loadCart();
167
							</xsl:attribute>
168 5790 leinfelder
							<xsl:attribute name="value">
169
								Add to cart
170
							</xsl:attribute>
171
						</input>
172 5781 leinfelder
					</xsl:if>
173
					<xsl:if test="$showRemove = 'true'">
174 5790 leinfelder
						<input type="button" class="removeCartButton">
175 5781 leinfelder
							<xsl:attribute name="id">
176
								<xsl:text>remove_</xsl:text><xsl:value-of select="replace(./docid, '\.', '_')"/>
177
							</xsl:attribute>
178
							<xsl:attribute name="onclick">
179
								var params =
180
									{
181
										'action': 'editcart',
182
										'docid': '<xsl:value-of select="./docid"/>',
183
										'operation': 'remove',
184
										'qformat': 'semtools'
185
									};
186
								load(
187
									'<xsl:value-of select="$contextURL" />/metacat', //url
188 5783 leinfelder
									params
189 5781 leinfelder
									);
190
								loadCart();
191
							</xsl:attribute>
192 5790 leinfelder
							<xsl:attribute name="value">
193
								Remove from cart
194
							</xsl:attribute>
195
						</input>
196 5781 leinfelder
					</xsl:if>
197 5677 leinfelder
				</div>
198 5536 leinfelder
199 5675 leinfelder
				<!-- the content part -->
200 5677 leinfelder
				<div>
201 5385 leinfelder
					<xsl:attribute name="class">
202 5675 leinfelder
	              		<xsl:choose>
203
						    <xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
204
						    <xsl:when test="position() mod 2 = 0">roweven</xsl:when>
205 5385 leinfelder
						</xsl:choose>
206
					</xsl:attribute>
207
208 5677 leinfelder
					<table class="onehundred_percent">
209
						<tr>
210 5743 leinfelder
							<td>
211
								<!-- keywords -->
212
								<xsl:call-template name="keywords"/>
213
							</td>
214
						</tr>
215
						<tr>
216 5727 leinfelder
217 5690 leinfelder
							<!-- annotation section -->
218 5743 leinfelder
							<td>
219 5690 leinfelder
								<!-- render the annotation -->
220
								<xsl:for-each select="./*[local-name()='annotation']">
221 5766 leinfelder
									<xsl:call-template name="modelSummary">
222 5740 leinfelder
										 <xsl:with-param name="showAll" select="'false'"/>
223 5690 leinfelder
									</xsl:call-template>
224
								</xsl:for-each>
225
							</td>
226
227 5677 leinfelder
						</tr>
228 5999 leinfelder
229
						<!-- data -->
230 6002 leinfelder
						<xsl:if test="count(./data) != 0">
231
							<tr>
232
								<td>
233
									<xsl:call-template name="data"/>
234
								</td>
235
							</tr>
236
						</xsl:if>
237 5999 leinfelder
238 5677 leinfelder
					</table>
239
240
				</div>
241
242 5385 leinfelder
			</xsl:for-each>
243 5677 leinfelder
244
		</div>
245
246 5675 leinfelder
	</xsl:template>
247 5385 leinfelder
248 5762 leinfelder
	<xsl:template name="citationContainer">
249 5737 leinfelder
		<table class="subGroup subGroup_border onehundred_percent">
250
			<tr>
251 5743 leinfelder
				<td class="rowodd" width="{$labelWidth}">
252 5737 leinfelder
					Citation:
253
				</td>
254
				<td class="roweven">
255 5762 leinfelder
					<xsl:call-template name="citation"/>
256 5737 leinfelder
				</td>
257
			</tr>
258
		</table>
259
	</xsl:template>
260
261 5762 leinfelder
	<xsl:template name="citation">
262
		<!-- the author -->
263
		<xsl:choose>
264
			<xsl:when test="count(./param[@name='creator/individualName/surName']) > 0">
265
				<xsl:for-each select="./param[@name='creator/individualName/surName']">
266
					<xsl:value-of select="." />
267
					<xsl:if test="position() != last()">, </xsl:if>
268
				</xsl:for-each>
269
			</xsl:when>
270
			<xsl:otherwise>
271
				<xsl:for-each select="./param[@name='creator/organizationName']">
272
					<xsl:value-of select="." />
273
					<xsl:if test="position() != last()">, </xsl:if>
274
				</xsl:for-each>
275
			</xsl:otherwise>
276
		</xsl:choose>
277
		<xsl:text>. </xsl:text>
278
		<!-- the pubdate -->
279
		<xsl:value-of select="substring(string(./param[@name='dataset/pubDate']),1,4)"/>
280
		<xsl:if test="substring(string(./param[@name='dataset/pubDate']),1,4) != ''">. </xsl:if>
281
		<!-- the title -->
282
		<b>
283
		<xsl:value-of select="./param[@name='dataset/title']"/>
284
		</b>
285
		<xsl:text>. </xsl:text>
286
		<!-- the id -->
287
		<xsl:value-of select="./docid"/>
288
		<xsl:text>. </xsl:text>
289
		<br/>
290
		<!-- the link -->
291
		(<a>
292
			<xsl:attribute name="href">
293
				<xsl:value-of select="$tripleURI"/><xsl:value-of select="./docid"/>
294
			</xsl:attribute>
295
			<xsl:value-of select="$contextURL" /><![CDATA[/metacat/]]><xsl:value-of select="./docid"/><![CDATA[/]]><xsl:value-of select="$qformat" />
296
		</a>)
297
	</xsl:template>
298
299 5743 leinfelder
	<xsl:template name="keywords">
300
		<!-- render the keywords -->
301
		<table class="subGroup subGroup_border onehundred_percent">
302 5727 leinfelder
			<tr>
303 5743 leinfelder
				<td class="rowodd" width="{$labelWidth}">
304
					Keywords:
305 5727 leinfelder
				</td>
306
				<td>
307 5743 leinfelder
					<p>
308
					<xsl:for-each select="./param[@name='keyword']">
309 5727 leinfelder
						<xsl:value-of select="." />
310 5743 leinfelder
						<xsl:if test="position() != last()">, </xsl:if>
311 5727 leinfelder
					</xsl:for-each>
312 5743 leinfelder
					</p>
313 5727 leinfelder
				</td>
314
			</tr>
315
		</table>
316
	</xsl:template>
317
318 5999 leinfelder
	<xsl:template name="data">
319
		<!-- render the data -->
320
		<table class="subGroup subGroup_border onehundred_percent">
321
			<tr>
322
				<td class="rowodd" width="{$labelWidth}">
323
					Data:
324
				</td>
325
				<td>
326
					<pre>
327
						<xsl:value-of select="./data" />
328
					</pre>
329
				</td>
330
			</tr>
331
		</table>
332
	</xsl:template>
333
334 5385 leinfelder
335
</xsl:stylesheet>