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-01-06 13:58:13 -0800 (Thu, 06 Jan 2011) $'
11
	* '$Revision: 5781 $'
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.0.9"
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
								<xsl:number
73
									value="count(resultset/document)" />
74
								total records found
75
							</p>
76
						</td>
77
					</tr>
78
				</table>
79

    
80
				<table align="left" border="0" cellpadding="0" cellspacing="5" width="100%">
81
					<tr valign="top">
82
							
83
						<!-- EML HERE  -->
84
						<xsl:if test="count(resultset/document[docname='eml']) &gt; 0">
85
							<td>
86
								<xsl:call-template name="emlResults"/>
87
							</td>	
88
						</xsl:if>
89
						
90
					</tr>	
91
				</table>
92
				
93
				</div>
94
				
95
				<script language="JavaScript">
96
					insertTemplateClosing('<xsl:value-of select="$contextURL" />');
97
				</script>
98
			</body>
99
		</html>
100
	</xsl:template>
101
	
102
	<xsl:template name="emlResults">
103
	
104
		<div id="results">
105
	
106
			<xsl:for-each
107
				select="resultset/document[docname='eml']">
108
				<xsl:sort
109
					select="./param[@name='dataset/title']" />
110
					
111
				<!-- the header portion of the result -->
112
				<div>
113
					<xsl:attribute name="class">
114
	              			<xsl:choose>
115
						    <xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
116
						    <xsl:when test="position() mod 2 = 0">roweven</xsl:when>
117
						</xsl:choose>
118
					</xsl:attribute>
119
					
120
					<a href="#" class="accordian">+</a><xsl:text> </xsl:text>
121
					
122
					<!-- citation -->
123
					<xsl:call-template name="citation"/>
124
					
125
					<!-- edit cart, TODO: reflect status of cart contents -->
126
					<xsl:if test="$showAdd = 'true'">
127
						<a href="javascript:donothing()">
128
							<xsl:attribute name="id">
129
								<xsl:text>add_</xsl:text><xsl:value-of select="replace(./docid, '\.', '_')"/>
130
							</xsl:attribute>
131
							<xsl:attribute name="onclick">
132
								var params = 
133
									{
134
										'action': 'editcart',
135
										'docid': '<xsl:value-of select="./docid"/>',
136
										'operation': 'add',
137
										'qformat': 'semtools'
138
									};
139
								load(
140
									'<xsl:value-of select="$contextURL" />/metacat', //url
141
									params, //params
142
									'<xsl:text>add_</xsl:text><xsl:value-of select="replace(./docid, '\.', '_')"/>' // div 
143
									);
144
								loadCart();	
145
							</xsl:attribute>
146
							Add to cart
147
						</a>
148
					</xsl:if>
149
					<xsl:if test="$showRemove = 'true'">
150
						<a href="javascript:donothing()">
151
							<xsl:attribute name="id">
152
								<xsl:text>remove_</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': 'remove',
160
										'qformat': 'semtools'
161
									};
162
								load(
163
									'<xsl:value-of select="$contextURL" />/metacat', //url
164
									params, //params
165
									'<xsl:text>remove_</xsl:text><xsl:value-of select="replace(./docid, '\.', '_')"/>' // div 
166
									);
167
								loadCart();	
168
							</xsl:attribute>
169
							Remove from cart
170
						</a>
171
					</xsl:if>	
172
				</div>
173
				
174
				<!-- the content part -->	
175
				<div>
176
					<xsl:attribute name="class">
177
	              		<xsl:choose>
178
						    <xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
179
						    <xsl:when test="position() mod 2 = 0">roweven</xsl:when>
180
						</xsl:choose>
181
					</xsl:attribute>
182
					
183
					<table class="onehundred_percent">
184
						<tr>
185
							<td>
186
								<!-- keywords -->
187
								<xsl:call-template name="keywords"/>								
188
							</td>
189
						</tr>
190
						<tr>
191
						
192
							<!-- annotation section -->
193
							<td>
194
								<!-- render the annotation -->
195
								<xsl:for-each select="./*[local-name()='annotation']">
196
									<xsl:call-template name="modelSummary">
197
										 <xsl:with-param name="showAll" select="'false'"/>
198
									</xsl:call-template>	
199
								</xsl:for-each>
200
							</td>
201
							
202
						</tr>
203
					</table>
204
											
205
				</div>
206
		
207
			</xsl:for-each>
208
			
209
		</div>	
210
			
211
	</xsl:template>
212
	
213
	<xsl:template name="citationContainer">
214
		<table class="subGroup subGroup_border onehundred_percent">
215
			<tr>
216
				<td class="rowodd" width="{$labelWidth}">
217
					Citation:
218
				</td>
219
				<td class="roweven">
220
					<xsl:call-template name="citation"/>
221
				</td>
222
			</tr>		
223
		</table>
224
	</xsl:template>
225
	
226
	<xsl:template name="citation">
227
		<!-- the author -->
228
		<xsl:choose>
229
			<xsl:when test="count(./param[@name='creator/individualName/surName']) > 0">
230
				<xsl:for-each select="./param[@name='creator/individualName/surName']">
231
					<xsl:value-of select="." />
232
					<xsl:if test="position() != last()">, </xsl:if>
233
				</xsl:for-each>
234
			</xsl:when>
235
			<xsl:otherwise>
236
				<xsl:for-each select="./param[@name='creator/organizationName']">
237
					<xsl:value-of select="." />
238
					<xsl:if test="position() != last()">, </xsl:if>
239
				</xsl:for-each>
240
			</xsl:otherwise>
241
		</xsl:choose>
242
		<xsl:text>. </xsl:text>
243
		<!-- the pubdate -->
244
		<xsl:value-of select="substring(string(./param[@name='dataset/pubDate']),1,4)"/>
245
		<xsl:if test="substring(string(./param[@name='dataset/pubDate']),1,4) != ''">. </xsl:if>
246
		<!-- the title -->
247
		<b>
248
		<xsl:value-of select="./param[@name='dataset/title']"/>
249
		</b>
250
		<xsl:text>. </xsl:text>
251
		<!-- the id -->
252
		<xsl:value-of select="./docid"/>
253
		<xsl:text>. </xsl:text>
254
		<br/>
255
		<!-- the link -->
256
		(<a>
257
			<xsl:attribute name="href">
258
				<xsl:value-of select="$tripleURI"/><xsl:value-of select="./docid"/>
259
			</xsl:attribute>
260
			<xsl:value-of select="$contextURL" /><![CDATA[/metacat/]]><xsl:value-of select="./docid"/><![CDATA[/]]><xsl:value-of select="$qformat" />										
261
		</a>)
262
	</xsl:template>
263
	
264
	<xsl:template name="keywords">
265
		<!-- render the keywords -->
266
		<table class="subGroup subGroup_border onehundred_percent">	
267
			<tr>
268
				<td class="rowodd" width="{$labelWidth}">
269
					Keywords:
270
				</td>
271
				<td>
272
					<p>
273
					<xsl:for-each select="./param[@name='keyword']">
274
						<xsl:value-of select="." />
275
						<xsl:if test="position() != last()">, </xsl:if>
276
					</xsl:for-each>
277
					</p>
278
				</td>
279
			</tr>			
280
		</table>
281
	</xsl:template>
282
	
283

    
284
</xsl:stylesheet>
(7-7/14)