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-01 14:00:52 -0800 (Tue, 01 Mar 2011) $'
11
	* '$Revision: 5999 $'
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
				</div>
96
				
97
				<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
		<div id="results">
107
	
108
			<xsl:for-each
109
				select="resultset/document[docname='eml']">
110
				<xsl:sort
111
					select="./param[@name='dataset/title']" />
112
					
113
				<!-- the header portion of the result -->
114
				<div>
115
					<xsl:attribute name="class">
116
	              			<xsl:choose>
117
						    <xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
118
						    <xsl:when test="position() mod 2 = 0">roweven</xsl:when>
119
						</xsl:choose>
120
					</xsl:attribute>
121
					
122
					<a href="#" class="accordian">+</a><xsl:text> </xsl:text>
123
					
124
					<!-- citation -->
125
					<xsl:call-template name="citation"/>
126
					
127
					<!-- edit cart -->
128
					<xsl:if test="$showAdd = 'true'">
129
						<input type="button" class="addCartButton">
130
							<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
									params 
144
									);
145
								loadCart();	
146
							</xsl:attribute>
147
							<xsl:attribute name="value">
148
								Add to cart
149
							</xsl:attribute>	
150
						</input>
151
					</xsl:if>
152
					<xsl:if test="$showRemove = 'true'">
153
						<input type="button" class="removeCartButton">
154
							<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
									params 
168
									);
169
								loadCart();	
170
							</xsl:attribute>
171
							<xsl:attribute name="value">
172
								Remove from cart
173
							</xsl:attribute>	
174
						</input>
175
					</xsl:if>	
176
				</div>
177
				
178
				<!-- the content part -->	
179
				<div>
180
					<xsl:attribute name="class">
181
	              		<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
						</xsl:choose>
185
					</xsl:attribute>
186
					
187
					<table class="onehundred_percent">
188
						<tr>
189
							<td>
190
								<!-- keywords -->
191
								<xsl:call-template name="keywords"/>								
192
							</td>
193
						</tr>
194
						<tr>
195
						
196
							<!-- annotation section -->
197
							<td>
198
								<!-- render the annotation -->
199
								<xsl:for-each select="./*[local-name()='annotation']">
200
									<xsl:call-template name="modelSummary">
201
										 <xsl:with-param name="showAll" select="'false'"/>
202
									</xsl:call-template>	
203
								</xsl:for-each>
204
							</td>
205
							
206
						</tr>
207
						
208
						<!-- data -->
209
						<tr>
210
							<td>
211
								<xsl:call-template name="data"/>	
212
							</td>
213
						</tr>
214
						
215
					</table>
216
											
217
				</div>
218
		
219
			</xsl:for-each>
220
			
221
		</div>	
222
			
223
	</xsl:template>
224
	
225
	<xsl:template name="citationContainer">
226
		<table class="subGroup subGroup_border onehundred_percent">
227
			<tr>
228
				<td class="rowodd" width="{$labelWidth}">
229
					Citation:
230
				</td>
231
				<td class="roweven">
232
					<xsl:call-template name="citation"/>
233
				</td>
234
			</tr>		
235
		</table>
236
	</xsl:template>
237
	
238
	<xsl:template name="citation">
239
		<!-- the author -->
240
		<xsl:choose>
241
			<xsl:when test="count(./param[@name='creator/individualName/surName']) > 0">
242
				<xsl:for-each select="./param[@name='creator/individualName/surName']">
243
					<xsl:value-of select="." />
244
					<xsl:if test="position() != last()">, </xsl:if>
245
				</xsl:for-each>
246
			</xsl:when>
247
			<xsl:otherwise>
248
				<xsl:for-each select="./param[@name='creator/organizationName']">
249
					<xsl:value-of select="." />
250
					<xsl:if test="position() != last()">, </xsl:if>
251
				</xsl:for-each>
252
			</xsl:otherwise>
253
		</xsl:choose>
254
		<xsl:text>. </xsl:text>
255
		<!-- the pubdate -->
256
		<xsl:value-of select="substring(string(./param[@name='dataset/pubDate']),1,4)"/>
257
		<xsl:if test="substring(string(./param[@name='dataset/pubDate']),1,4) != ''">. </xsl:if>
258
		<!-- the title -->
259
		<b>
260
		<xsl:value-of select="./param[@name='dataset/title']"/>
261
		</b>
262
		<xsl:text>. </xsl:text>
263
		<!-- the id -->
264
		<xsl:value-of select="./docid"/>
265
		<xsl:text>. </xsl:text>
266
		<br/>
267
		<!-- the link -->
268
		(<a>
269
			<xsl:attribute name="href">
270
				<xsl:value-of select="$tripleURI"/><xsl:value-of select="./docid"/>
271
			</xsl:attribute>
272
			<xsl:value-of select="$contextURL" /><![CDATA[/metacat/]]><xsl:value-of select="./docid"/><![CDATA[/]]><xsl:value-of select="$qformat" />										
273
		</a>)
274
	</xsl:template>
275
	
276
	<xsl:template name="keywords">
277
		<!-- render the keywords -->
278
		<table class="subGroup subGroup_border onehundred_percent">	
279
			<tr>
280
				<td class="rowodd" width="{$labelWidth}">
281
					Keywords:
282
				</td>
283
				<td>
284
					<p>
285
					<xsl:for-each select="./param[@name='keyword']">
286
						<xsl:value-of select="." />
287
						<xsl:if test="position() != last()">, </xsl:if>
288
					</xsl:for-each>
289
					</p>
290
				</td>
291
			</tr>			
292
		</table>
293
	</xsl:template>
294
	
295
	<xsl:template name="data">
296
		<!-- render the data -->
297
		<table class="subGroup subGroup_border onehundred_percent">	
298
			<tr>
299
				<td class="rowodd" width="{$labelWidth}">
300
					Data:
301
				</td>
302
				<td>
303
					<pre>
304
						<xsl:value-of select="./data" />
305
					</pre>
306
				</td>
307
			</tr>			
308
		</table>
309
	</xsl:template>
310
	
311

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