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-06-11 17:00:05 -0700 (Fri, 11 Jun 2010) $'
11
	* '$Revision: 5385 $'
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 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
32
	version="1.0">
33

    
34
	<xsl:output method="html" />
35
	<xsl:param name="sessid" />
36
	<xsl:param name="qformat">semtools</xsl:param>
37
	<xsl:param name="enableediting">false</xsl:param>
38
	<xsl:param name="contextURL"/>
39
	<xsl:template match="/">
40
		<html>
41
			<head>
42
				<title>Search Results</title>
43
				<link rel="stylesheet" type="text/css"
44
					href="/knb/style/skins/{$qformat}/{$qformat}.css" />
45
				<script language="Javascript" type="text/JavaScript"
46
					src="/knb/style/skins/{$qformat}/{$qformat}.js" />
47
				<script language="Javascript" type="text/JavaScript"
48
					src="/knb/style/common/branding.js" />
49
				<script language="JavaScript">
50
					<![CDATA[
51
					function submitform(action,form_ref) {
52
						form_ref.action.value=action;
53
						form_ref.sessionid.value="]]><xsl:value-of select="$sessid" /><![CDATA[";
54
						form_ref.qformat.value="]]><xsl:value-of select="$qformat" /><![CDATA[";
55
						form_ref.submit();
56
					}
57
					]]>
58
				</script>
59
			</head>
60

    
61
			<body leftmargin="0" topmargin="0" marginwidth="0"
62
				marginheight="0">
63
				<script language="JavaScript">
64
					insertTemplateOpening('<xsl:value-of select="$contextURL" />'); insertSearchBox('<xsl:value-of select="$contextURL" />');
65
				</script>
66

    
67
				<table style="width:100%;" align="center" border="0"
68
					cellpadding="5" cellspacing="0">
69
					<tr>
70
						<td align="left">
71
							<br />
72
							<p class="emphasis">
73
								<xsl:number
74
									value="count(resultset/document)" />
75
								total records found
76
							</p>
77
						</td>
78
					</tr>
79
				</table>
80

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

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

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

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

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

    
305
</xsl:stylesheet>
(11-11/19)