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 5574 leinfelder
				</div>
96
97 5385 leinfelder
				<script language="JavaScript">
98
					insertTemplateClosing('<xsl:value-of select="$contextURL" />');
99
				</script>
100
			</body>
101
		</html>
102
	</xsl:template>
103
104
	<xsl:template name="emlResults">
105
106 5677 leinfelder
		<div id="results">
107
108 5385 leinfelder
			<xsl:for-each
109
				select="resultset/document[docname='eml']">
110
				<xsl:sort
111
					select="./param[@name='dataset/title']" />
112 5675 leinfelder
113
				<!-- the header portion of the result -->
114 5677 leinfelder
				<div>
115 5385 leinfelder
					<xsl:attribute name="class">
116
	              			<xsl:choose>
117 5762 leinfelder
						    <xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
118
						    <xsl:when test="position() mod 2 = 0">roweven</xsl:when>
119 5385 leinfelder
						</xsl:choose>
120
					</xsl:attribute>
121 5765 leinfelder
122
					<a href="#" class="accordian">+</a><xsl:text> </xsl:text>
123
124 5762 leinfelder
					<!-- citation -->
125
					<xsl:call-template name="citation"/>
126 5739 leinfelder
127 5790 leinfelder
					<!-- edit cart -->
128 5781 leinfelder
					<xsl:if test="$showAdd = 'true'">
129 5790 leinfelder
						<input type="button" class="addCartButton">
130 5781 leinfelder
							<xsl:attribute name="id">
131
								<xsl:text>add_</xsl:text><xsl:value-of select="replace(./docid, '\.', '_')"/>
132
							</xsl:attribute>
133
							<xsl:attribute name="onclick">
134
								var params =
135
									{
136
										'action': 'editcart',
137
										'docid': '<xsl:value-of select="./docid"/>',
138
										'operation': 'add',
139
										'qformat': 'semtools'
140
									};
141
								load(
142
									'<xsl:value-of select="$contextURL" />/metacat', //url
143 5783 leinfelder
									params
144 5781 leinfelder
									);
145
								loadCart();
146
							</xsl:attribute>
147 5790 leinfelder
							<xsl:attribute name="value">
148
								Add to cart
149
							</xsl:attribute>
150
						</input>
151 5781 leinfelder
					</xsl:if>
152
					<xsl:if test="$showRemove = 'true'">
153 5790 leinfelder
						<input type="button" class="removeCartButton">
154 5781 leinfelder
							<xsl:attribute name="id">
155
								<xsl:text>remove_</xsl:text><xsl:value-of select="replace(./docid, '\.', '_')"/>
156
							</xsl:attribute>
157
							<xsl:attribute name="onclick">
158
								var params =
159
									{
160
										'action': 'editcart',
161
										'docid': '<xsl:value-of select="./docid"/>',
162
										'operation': 'remove',
163
										'qformat': 'semtools'
164
									};
165
								load(
166
									'<xsl:value-of select="$contextURL" />/metacat', //url
167 5783 leinfelder
									params
168 5781 leinfelder
									);
169
								loadCart();
170
							</xsl:attribute>
171 5790 leinfelder
							<xsl:attribute name="value">
172
								Remove from cart
173
							</xsl:attribute>
174
						</input>
175 5781 leinfelder
					</xsl:if>
176 5677 leinfelder
				</div>
177 5536 leinfelder
178 5675 leinfelder
				<!-- the content part -->
179 5677 leinfelder
				<div>
180 5385 leinfelder
					<xsl:attribute name="class">
181 5675 leinfelder
	              		<xsl:choose>
182
						    <xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
183
						    <xsl:when test="position() mod 2 = 0">roweven</xsl:when>
184 5385 leinfelder
						</xsl:choose>
185
					</xsl:attribute>
186
187 5677 leinfelder
					<table class="onehundred_percent">
188
						<tr>
189 5743 leinfelder
							<td>
190
								<!-- keywords -->
191
								<xsl:call-template name="keywords"/>
192
							</td>
193
						</tr>
194
						<tr>
195 5727 leinfelder
196 5690 leinfelder
							<!-- annotation section -->
197 5743 leinfelder
							<td>
198 5690 leinfelder
								<!-- render the annotation -->
199
								<xsl:for-each select="./*[local-name()='annotation']">
200 5766 leinfelder
									<xsl:call-template name="modelSummary">
201 5740 leinfelder
										 <xsl:with-param name="showAll" select="'false'"/>
202 5690 leinfelder
									</xsl:call-template>
203
								</xsl:for-each>
204
							</td>
205
206 5677 leinfelder
						</tr>
207 5999 leinfelder
208
						<!-- data -->
209 6002 leinfelder
						<xsl:if test="count(./data) != 0">
210
							<tr>
211
								<td>
212
									<xsl:call-template name="data"/>
213
								</td>
214
							</tr>
215
						</xsl:if>
216 5999 leinfelder
217 5677 leinfelder
					</table>
218
219
				</div>
220
221 5385 leinfelder
			</xsl:for-each>
222 5677 leinfelder
223
		</div>
224
225 5675 leinfelder
	</xsl:template>
226 5385 leinfelder
227 5762 leinfelder
	<xsl:template name="citationContainer">
228 5737 leinfelder
		<table class="subGroup subGroup_border onehundred_percent">
229
			<tr>
230 5743 leinfelder
				<td class="rowodd" width="{$labelWidth}">
231 5737 leinfelder
					Citation:
232
				</td>
233
				<td class="roweven">
234 5762 leinfelder
					<xsl:call-template name="citation"/>
235 5737 leinfelder
				</td>
236
			</tr>
237
		</table>
238
	</xsl:template>
239
240 5762 leinfelder
	<xsl:template name="citation">
241
		<!-- the author -->
242
		<xsl:choose>
243
			<xsl:when test="count(./param[@name='creator/individualName/surName']) > 0">
244
				<xsl:for-each select="./param[@name='creator/individualName/surName']">
245
					<xsl:value-of select="." />
246
					<xsl:if test="position() != last()">, </xsl:if>
247
				</xsl:for-each>
248
			</xsl:when>
249
			<xsl:otherwise>
250
				<xsl:for-each select="./param[@name='creator/organizationName']">
251
					<xsl:value-of select="." />
252
					<xsl:if test="position() != last()">, </xsl:if>
253
				</xsl:for-each>
254
			</xsl:otherwise>
255
		</xsl:choose>
256
		<xsl:text>. </xsl:text>
257
		<!-- the pubdate -->
258
		<xsl:value-of select="substring(string(./param[@name='dataset/pubDate']),1,4)"/>
259
		<xsl:if test="substring(string(./param[@name='dataset/pubDate']),1,4) != ''">. </xsl:if>
260
		<!-- the title -->
261
		<b>
262
		<xsl:value-of select="./param[@name='dataset/title']"/>
263
		</b>
264
		<xsl:text>. </xsl:text>
265
		<!-- the id -->
266
		<xsl:value-of select="./docid"/>
267
		<xsl:text>. </xsl:text>
268
		<br/>
269
		<!-- the link -->
270
		(<a>
271
			<xsl:attribute name="href">
272
				<xsl:value-of select="$tripleURI"/><xsl:value-of select="./docid"/>
273
			</xsl:attribute>
274
			<xsl:value-of select="$contextURL" /><![CDATA[/metacat/]]><xsl:value-of select="./docid"/><![CDATA[/]]><xsl:value-of select="$qformat" />
275
		</a>)
276
	</xsl:template>
277
278 5743 leinfelder
	<xsl:template name="keywords">
279
		<!-- render the keywords -->
280
		<table class="subGroup subGroup_border onehundred_percent">
281 5727 leinfelder
			<tr>
282 5743 leinfelder
				<td class="rowodd" width="{$labelWidth}">
283
					Keywords:
284 5727 leinfelder
				</td>
285
				<td>
286 5743 leinfelder
					<p>
287
					<xsl:for-each select="./param[@name='keyword']">
288 5727 leinfelder
						<xsl:value-of select="." />
289 5743 leinfelder
						<xsl:if test="position() != last()">, </xsl:if>
290 5727 leinfelder
					</xsl:for-each>
291 5743 leinfelder
					</p>
292 5727 leinfelder
				</td>
293
			</tr>
294
		</table>
295
	</xsl:template>
296
297 5999 leinfelder
	<xsl:template name="data">
298
		<!-- render the data -->
299
		<table class="subGroup subGroup_border onehundred_percent">
300
			<tr>
301
				<td class="rowodd" width="{$labelWidth}">
302
					Data:
303
				</td>
304
				<td>
305
					<pre>
306
						<xsl:value-of select="./data" />
307
					</pre>
308
				</td>
309
			</tr>
310
		</table>
311
	</xsl:template>
312
313 5385 leinfelder
314
</xsl:stylesheet>