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-07 10:33:05 -0800 (Fri, 07 Jan 2011) $'
11
	* '$Revision: 5783 $'
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 
142
									);
143
								loadCart();	
144
							</xsl:attribute>
145
							Add to cart
146
						</a>
147
					</xsl:if>
148
					<xsl:if test="$showRemove = 'true'">
149
						<a href="javascript:donothing()">
150
							<xsl:attribute name="id">
151
								<xsl:text>remove_</xsl:text><xsl:value-of select="replace(./docid, '\.', '_')"/>
152
							</xsl:attribute>
153
							<xsl:attribute name="onclick">
154
								var params = 
155
									{
156
										'action': 'editcart',
157
										'docid': '<xsl:value-of select="./docid"/>',
158
										'operation': 'remove',
159
										'qformat': 'semtools'
160
									};
161
								load(
162
									'<xsl:value-of select="$contextURL" />/metacat', //url
163
									params 
164
									);
165
								loadCart();	
166
							</xsl:attribute>
167
							Remove from cart
168
						</a>
169
					</xsl:if>	
170
				</div>
171
				
172
				<!-- the content part -->	
173
				<div>
174
					<xsl:attribute name="class">
175
	              		<xsl:choose>
176
						    <xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
177
						    <xsl:when test="position() mod 2 = 0">roweven</xsl:when>
178
						</xsl:choose>
179
					</xsl:attribute>
180
					
181
					<table class="onehundred_percent">
182
						<tr>
183
							<td>
184
								<!-- keywords -->
185
								<xsl:call-template name="keywords"/>								
186
							</td>
187
						</tr>
188
						<tr>
189
						
190
							<!-- annotation section -->
191
							<td>
192
								<!-- render the annotation -->
193
								<xsl:for-each select="./*[local-name()='annotation']">
194
									<xsl:call-template name="modelSummary">
195
										 <xsl:with-param name="showAll" select="'false'"/>
196
									</xsl:call-template>	
197
								</xsl:for-each>
198
							</td>
199
							
200
						</tr>
201
					</table>
202
											
203
				</div>
204
		
205
			</xsl:for-each>
206
			
207
		</div>	
208
			
209
	</xsl:template>
210
	
211
	<xsl:template name="citationContainer">
212
		<table class="subGroup subGroup_border onehundred_percent">
213
			<tr>
214
				<td class="rowodd" width="{$labelWidth}">
215
					Citation:
216
				</td>
217
				<td class="roweven">
218
					<xsl:call-template name="citation"/>
219
				</td>
220
			</tr>		
221
		</table>
222
	</xsl:template>
223
	
224
	<xsl:template name="citation">
225
		<!-- the author -->
226
		<xsl:choose>
227
			<xsl:when test="count(./param[@name='creator/individualName/surName']) > 0">
228
				<xsl:for-each select="./param[@name='creator/individualName/surName']">
229
					<xsl:value-of select="." />
230
					<xsl:if test="position() != last()">, </xsl:if>
231
				</xsl:for-each>
232
			</xsl:when>
233
			<xsl:otherwise>
234
				<xsl:for-each select="./param[@name='creator/organizationName']">
235
					<xsl:value-of select="." />
236
					<xsl:if test="position() != last()">, </xsl:if>
237
				</xsl:for-each>
238
			</xsl:otherwise>
239
		</xsl:choose>
240
		<xsl:text>. </xsl:text>
241
		<!-- the pubdate -->
242
		<xsl:value-of select="substring(string(./param[@name='dataset/pubDate']),1,4)"/>
243
		<xsl:if test="substring(string(./param[@name='dataset/pubDate']),1,4) != ''">. </xsl:if>
244
		<!-- the title -->
245
		<b>
246
		<xsl:value-of select="./param[@name='dataset/title']"/>
247
		</b>
248
		<xsl:text>. </xsl:text>
249
		<!-- the id -->
250
		<xsl:value-of select="./docid"/>
251
		<xsl:text>. </xsl:text>
252
		<br/>
253
		<!-- the link -->
254
		(<a>
255
			<xsl:attribute name="href">
256
				<xsl:value-of select="$tripleURI"/><xsl:value-of select="./docid"/>
257
			</xsl:attribute>
258
			<xsl:value-of select="$contextURL" /><![CDATA[/metacat/]]><xsl:value-of select="./docid"/><![CDATA[/]]><xsl:value-of select="$qformat" />										
259
		</a>)
260
	</xsl:template>
261
	
262
	<xsl:template name="keywords">
263
		<!-- render the keywords -->
264
		<table class="subGroup subGroup_border onehundred_percent">	
265
			<tr>
266
				<td class="rowodd" width="{$labelWidth}">
267
					Keywords:
268
				</td>
269
				<td>
270
					<p>
271
					<xsl:for-each select="./param[@name='keyword']">
272
						<xsl:value-of select="." />
273
						<xsl:if test="position() != last()">, </xsl:if>
274
					</xsl:for-each>
275
					</p>
276
				</td>
277
			</tr>			
278
		</table>
279
	</xsl:template>
280
	
281

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