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: 2010-09-23 14:33:45 -0700 (Thu, 23 Sep 2010) $'
11
	* '$Revision: 5592 $'
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
	<xsl:template match="/">
43
		<html>
44
			<head>
45
				<title>Search Results</title>
46
				<link rel="stylesheet" type="text/css"
47
					href="/knb/style/skins/{$qformat}/{$qformat}.css" />
48
				<script language="Javascript" type="text/JavaScript"
49
					src="/knb/style/skins/{$qformat}/{$qformat}.js" />
50
				<script language="Javascript" type="text/JavaScript"
51
					src="/knb/style/common/branding.js" />
52
				<script language="JavaScript">
53
					<![CDATA[
54
					function submitform(action,form_ref) {
55
						form_ref.action.value=action;
56
						form_ref.sessionid.value="]]><xsl:value-of select="$sessid" /><![CDATA[";
57
						form_ref.qformat.value="]]><xsl:value-of select="$qformat" /><![CDATA[";
58
						form_ref.submit();
59
					}
60
					]]>
61
				</script>
62
			</head>
63

    
64
			<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
65
				<script language="JavaScript">
66
					insertTemplateOpening('<xsl:value-of select="$contextURL" />'); insertSearchBox('<xsl:value-of select="$contextURL" />');
67
				</script>
68
				
69
				<div id="content_wrapper">
70
				
71
				<table style="width:100%;" align="center" border="0"
72
					cellpadding="5" cellspacing="0">
73
					<tr>
74
						<td align="left">
75
							<p class="emphasis">
76
								<xsl:number
77
									value="count(resultset/document)" />
78
								total records found
79
							</p>
80
						</td>
81
					</tr>
82
				</table>
83

    
84
				<table align="left" border="0" cellpadding="0" cellspacing="5" width="100%">
85
					<tr valign="top">
86
						
87
						<!-- ANNOTATIONS HERE  -->
88
						<xsl:if test="count(resultset/document[docname='annotation']) &gt; 0">
89
							<td>
90
								<xsl:call-template name="annotationResults"/>
91
							</td>	
92
						</xsl:if>	
93
							
94
						<!-- EML HERE  -->
95
						<xsl:if test="count(resultset/document[docname='eml']) &gt; 0">
96
							<td>
97
								<xsl:call-template name="emlResults"/>
98
							</td>	
99
						</xsl:if>
100
						
101
					</tr>	
102
				</table>
103
				
104
				</div>
105
				
106
				<script language="JavaScript">
107
					insertTemplateClosing('<xsl:value-of select="$contextURL" />');
108
				</script>
109
			</body>
110
		</html>
111
	</xsl:template>
112
	
113
	<xsl:template name="emlResults">
114
		<table align="center" border="0" cellpadding="5" cellspacing="0" width="100%">
115
			<tr class="subpanel">
116
				<th	style="text-align: left">
117
					Title
118
				</th>
119
				<th	style="text-align: left">
120
					Owners[s]
121
				</th>
122
				<th	style="text-align: left">
123
					Organization[s]
124
				</th>
125
				<th	style="text-align: left">
126
					Keywords
127
				</th>
128
			</tr>
129
	
130
			<xsl:for-each
131
				select="resultset/document[docname='eml']">
132
				<xsl:sort
133
					select="./param[@name='dataset/title']" />
134
				<tr valign="top" class="subpanel">
135
					<xsl:attribute name="class">
136
	              			<xsl:choose>
137
						    <xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
138
						    <xsl:when test="position() mod 2 = 0">roweven</xsl:when>
139
						</xsl:choose>
140
					</xsl:attribute>
141
	
142
					<td class="text_plain">
143
						<form action="/knb/metacat"
144
							method="POST">
145
							<xsl:attribute name="name">
146
								<xsl:value-of select="translate(./docid, '()-.', '____')" />
147
							</xsl:attribute>
148
	
149
							<input type="hidden"
150
								name="qformat" />
151
							<input type="hidden"
152
								name="sessionid" />
153
							<input type="hidden"
154
								name="action" value="read" />
155
							<input type="hidden"
156
								name="docid">
157
								<xsl:attribute name="value">
158
									<xsl:value-of select="./docid" />
159
								</xsl:attribute>
160
							</input>
161
							<a>
162
								<xsl:attribute name="href">javascript:submitform('read',document.<xsl:value-of	select="translate(./docid, '()-.', '____')" />)</xsl:attribute>
163
								<b>
164
									<xsl:text>&#187;&#160;</xsl:text>
165
									<xsl:value-of select="./param[@name='dataset/title']"/>
166
								</b>
167
							</a>
168
							
169
							<pre>ID: <xsl:value-of select="./docid" /></pre>
170
							
171
						</form>
172
						
173
						<!-- render the annotation -->
174
							<xsl:for-each select="./*[local-name()='annotation']">
175
								<xsl:call-template name="annotation">
176
									 <xsl:with-param name="showAll" select="false"/>
177
								</xsl:call-template>	
178
							</xsl:for-each>
179
	
180
							
181
					</td>
182
					
183
					<td class="text_plain">
184
						<xsl:for-each
185
							select="./param[@name='creator/individualName/surName']">
186
							<xsl:value-of select="." />
187
							<br />
188
						</xsl:for-each>
189
					</td>
190
					
191
					<td class="text_plain">
192
						<xsl:for-each
193
							select="./param[@name='creator/organizationName']">
194
							<xsl:value-of select="." />
195
							<br />
196
						</xsl:for-each>
197
					</td>
198
	
199
					<td class="text_plain">
200
						<xsl:for-each
201
							select="./param[@name='keyword']">
202
							<xsl:value-of select="." />
203
							<br />
204
						</xsl:for-each>
205
					</td>
206
	
207
				</tr>
208
				
209
				<tr class="searchresultsdivider">
210
					<td colspan="5">
211
					</td>
212
				</tr>
213
	
214
			</xsl:for-each>
215
		</table>
216
	</xsl:template>
217
	
218
	<xsl:template name="annotationResults">
219
		<table align="left" border="0" cellpadding="5" cellspacing="0" width="100%">		
220
				
221
			<tr class="subpanel">
222
				<th	style="text-align: left">
223
					Identifier
224
				</th>
225
				<th	style="text-align: left">
226
					Datapackage
227
				</th>
228
				<th	style="text-align: left">
229
					Entities
230
				</th>
231
			</tr>
232

    
233
			<xsl:for-each select="resultset/document[docname='annotation']">
234
				<xsl:sort select="./param[@name='@id']" />
235
				<tr valign="top">
236
					<xsl:attribute name="class">
237
						<xsl:choose>
238
							<xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
239
							<xsl:when test="position() mod 2 = 0">roweven</xsl:when>
240
						</xsl:choose>
241
					</xsl:attribute>
242

    
243
					<td class="text_plain">
244
						<a>
245
							<xsl:attribute name="href">javascript:submitform('read',document.<xsl:value-of select="translate(./docid, '()-.', '____')" />)</xsl:attribute>
246
							<xsl:text>&#187;&#160;</xsl:text>
247
							<xsl:value-of select="./docid" />
248
						</a>
249
						<form action="{$contextURL}/metacat" method="POST">
250
							<xsl:attribute name="name">
251
								<xsl:value-of select="translate(./docid, '()-.', '____')" />
252
							</xsl:attribute>
253
							<input type="hidden" name="qformat" value="{$qformat}"/>
254
							<input type="hidden" name="sessionid" />
255
							<input type="hidden" name="action" value="read" />
256
							<input type="hidden" name="docid">
257
								<xsl:attribute name="value">
258
									<xsl:value-of select="./docid" />
259
								</xsl:attribute>
260
							</input>
261
						</form>	
262
					</td>
263
					
264
					<td class="text_plain">
265
						<a>
266
							<xsl:attribute name="href">javascript:submitform('read',document.<xsl:value-of select="concat(translate(./param[@name='@emlPackage'], '()-.', '____'), '_annotation')" />)</xsl:attribute>
267
							<xsl:value-of select="./param[@name='@emlPackage']"/>
268
						</a>
269
						
270
						<form action="{$contextURL}/metacat" method="POST">
271
							<xsl:attribute name="name">
272
								<xsl:value-of select="concat(translate(./param[@name='@emlPackage'], '()-.', '____'), '_annotation')" />
273
							</xsl:attribute>
274
							<input type="hidden" name="qformat" value="{$qformat}"/>
275
							<input type="hidden" name="sessionid" />
276
							<input type="hidden" name="action" value="read" />
277
							<input type="hidden" name="docid">
278
								<xsl:attribute name="value">
279
									<xsl:value-of select="./param[@name='@emlPackage']"/>
280
								</xsl:attribute>
281
							</input>
282
						</form>
283
						
284
					</td>
285
					
286
					<td class="text_plain">
287
						<xsl:for-each
288
							select="./param[@name='entity/@id']">
289
							<xsl:value-of select="." />
290
							<br />
291
						</xsl:for-each>
292
					</td>
293
							
294

    
295
				</tr>
296
				
297
				<tr class="searchresultsdivider">
298
					<td colspan="3">
299
					</td>
300
				</tr>
301

    
302
			</xsl:for-each>
303
		</table>
304
	
305
	</xsl:template>
306

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