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 12:12:08 -0700 (Thu, 23 Sep 2010) $'
11
	* '$Revision: 5588 $'
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
								<xsl:text>&#187;&#160;</xsl:text>
164
								<xsl:value-of select="./param[@name='dataset/title']"/>
165
							</a>
166
							<p>
167
								<pre>ID: <xsl:value-of select="./docid" /></pre>
168
							</p>
169
						</form>
170
						
171
						<!-- render the annotation -->
172
						<xsl:for-each select="./*[local-name()='annotation']">
173
							<xsl:call-template name="annotation">
174
								 <xsl:with-param name="showAll" select="false"/>
175
							</xsl:call-template>	
176
						</xsl:for-each>
177
							
178
					</td>
179
					
180
					<td class="text_plain">
181
						<xsl:for-each
182
							select="./param[@name='creator/individualName/surName']">
183
							<xsl:value-of select="." />
184
							<br />
185
						</xsl:for-each>
186
					</td>
187
					
188
					<td class="text_plain">
189
						<xsl:for-each
190
							select="./param[@name='creator/organizationName']">
191
							<xsl:value-of select="." />
192
							<br />
193
						</xsl:for-each>
194
					</td>
195
	
196
					<td class="text_plain">
197
						<xsl:for-each
198
							select="./param[@name='keyword']">
199
							<xsl:value-of select="." />
200
							<br />
201
						</xsl:for-each>
202
					</td>
203
	
204
				</tr>
205
				
206
				<tr class="searchresultsdivider">
207
					<td colspan="5">
208
					</td>
209
				</tr>
210
	
211
			</xsl:for-each>
212
		</table>
213
	</xsl:template>
214
	
215
	<xsl:template name="annotationResults">
216
		<table align="left" border="0" cellpadding="5" cellspacing="0" width="100%">		
217
				
218
			<tr class="subpanel">
219
				<th	style="text-align: left">
220
					Identifier
221
				</th>
222
				<th	style="text-align: left">
223
					Datapackage
224
				</th>
225
				<th	style="text-align: left">
226
					Entities
227
				</th>
228
			</tr>
229

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

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

    
292
				</tr>
293
				
294
				<tr class="searchresultsdivider">
295
					<td colspan="3">
296
					</td>
297
				</tr>
298

    
299
			</xsl:for-each>
300
		</table>
301
	
302
	</xsl:template>
303

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