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: 2011-03-04 14:52:09 -0800 (Fri, 04 Mar 2011) $'
11
	* '$Revision: 6008 $'
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.1.0beta1"
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
	
43
	<xsl:param name="labelWidth">120</xsl:param>
44
	
45
	<xsl:param name="showAdd">true</xsl:param>
46
	<xsl:param name="showRemove">true</xsl:param>	
47
	
48
	<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
			<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
61
				<script language="JavaScript">
62
					insertTemplateOpening('<xsl:value-of select="$contextURL" />'); insertSearchBox('<xsl:value-of select="$contextURL" />');
63
				</script>
64
				
65
				<div id="content_wrapper">
66
				
67
				<table style="width:100%;" align="center" border="0"
68
					cellpadding="5" cellspacing="0">
69
					<tr>
70
						<td align="left">
71
							<p class="emphasis">
72
								<span class="resultCount">
73
									<xsl:number
74
										value="count(resultset/document)" />
75
								</span>		
76
								total records found
77
							</p>
78
						</td>
79
					</tr>
80
				</table>
81

    
82
				<table align="left" border="0" cellpadding="0" cellspacing="5" width="100%">
83
					<tr valign="top">
84
							
85
						<!-- EML HERE  -->
86
						<xsl:if test="count(resultset/document[docname='eml']) &gt; 0">
87
							<td>
88
								<xsl:call-template name="emlResults"/>
89
							</td>	
90
						</xsl:if>
91
						
92
					</tr>	
93
				</table>
94
				
95
				<!-- 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
				</div>
117
				
118
				<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
		<div id="results">
128
	
129
			<xsl:for-each
130
				select="resultset/document[docname='eml']">
131
				<xsl:sort
132
					select="./param[@name='dataset/title']" />
133
					
134
				<!-- the header portion of the result -->
135
				<div>
136
					<xsl:attribute name="class">
137
	              			<xsl:choose>
138
						    <xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
139
						    <xsl:when test="position() mod 2 = 0">roweven</xsl:when>
140
						</xsl:choose>
141
					</xsl:attribute>
142
					
143
					<a href="#" class="accordian">+</a><xsl:text> </xsl:text>
144
					
145
					<!-- citation -->
146
					<xsl:call-template name="citation"/>
147
					
148
					<!-- edit cart -->
149
					<xsl:if test="$showAdd = 'true'">
150
						<input type="button" class="addCartButton">
151
							<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
									params 
165
									);
166
								loadCart();	
167
							</xsl:attribute>
168
							<xsl:attribute name="value">
169
								Add to cart
170
							</xsl:attribute>	
171
						</input>
172
					</xsl:if>
173
					<xsl:if test="$showRemove = 'true'">
174
						<input type="button" class="removeCartButton">
175
							<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
									params 
189
									);
190
								loadCart();	
191
							</xsl:attribute>
192
							<xsl:attribute name="value">
193
								Remove from cart
194
							</xsl:attribute>	
195
						</input>
196
					</xsl:if>	
197
				</div>
198
				
199
				<!-- the content part -->	
200
				<div>
201
					<xsl:attribute name="class">
202
	              		<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
						</xsl:choose>
206
					</xsl:attribute>
207
					
208
					<table class="onehundred_percent">
209
						<tr>
210
							<td>
211
								<!-- keywords -->
212
								<xsl:call-template name="keywords"/>								
213
							</td>
214
						</tr>
215
						<tr>
216
						
217
							<!-- annotation section -->
218
							<td>
219
								<!-- render the annotation -->
220
								<xsl:for-each select="./*[local-name()='annotation']">
221
									<xsl:call-template name="modelSummary">
222
										 <xsl:with-param name="showAll" select="'false'"/>
223
									</xsl:call-template>	
224
								</xsl:for-each>
225
							</td>
226
							
227
						</tr>
228
						
229
						<!-- data -->
230
						<xsl:if test="count(./data) != 0">
231
							<tr>
232
								<td>
233
									<xsl:call-template name="data"/>	
234
								</td>
235
							</tr>
236
						</xsl:if>
237
						
238
					</table>
239
											
240
				</div>
241
		
242
			</xsl:for-each>
243
			
244
		</div>	
245
			
246
	</xsl:template>
247
	
248
	<xsl:template name="citationContainer">
249
		<table class="subGroup subGroup_border onehundred_percent">
250
			<tr>
251
				<td class="rowodd" width="{$labelWidth}">
252
					Citation:
253
				</td>
254
				<td class="roweven">
255
					<xsl:call-template name="citation"/>
256
				</td>
257
			</tr>		
258
		</table>
259
	</xsl:template>
260
	
261
	<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
	<xsl:template name="keywords">
300
		<!-- render the keywords -->
301
		<table class="subGroup subGroup_border onehundred_percent">	
302
			<tr>
303
				<td class="rowodd" width="{$labelWidth}">
304
					Keywords:
305
				</td>
306
				<td>
307
					<p>
308
					<xsl:for-each select="./param[@name='keyword']">
309
						<xsl:value-of select="." />
310
						<xsl:if test="position() != last()">, </xsl:if>
311
					</xsl:for-each>
312
					</p>
313
				</td>
314
			</tr>			
315
		</table>
316
	</xsl:template>
317
	
318
	<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

    
335
</xsl:stylesheet>
(9-9/16)