Project

General

Profile

1 5536 leinfelder
<?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-08-30 23:34:14 +0000 (Mon, 30 Aug 2010) $'
11
	* '$Revision: 5533 $'
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
	xmlns:fn="http://www.w3.org/2005/xpath-functions"
35
	version="2.0">
36
37
	<xsl:output method="html" />
38 5542 leinfelder
	<xsl:param name="sessionid" />
39 5536 leinfelder
	<xsl:param name="qformat">semtools</xsl:param>
40
	<xsl:param name="enableediting">false</xsl:param>
41
	<xsl:param name="contextURL"/>
42
43 5542 leinfelder
	<xsl:param name="tripleURI"><xsl:value-of select="$contextURL" /><![CDATA[/metacat?action=read&qformat=]]><xsl:value-of select="$qformat" /><![CDATA[&sessionid=]]><xsl:value-of select="$sessionid" /><![CDATA[&docid=]]></xsl:param>
44
45 5727 leinfelder
	<xsl:key name="mapping" match="//*[local-name()='map']" use="concat(../@id, @measurement)" />
46
	<xsl:key name="attributes" match="//*[local-name()='map']" use="concat(../@id, @attribute)" />
47
	<xsl:key name="measurements" match="//*[local-name()='measurement']" use="concat(../../@id, @label)" />
48 5540 leinfelder
49 5536 leinfelder
	<xsl:template name="annotation">
50 5590 leinfelder
		<xsl:param name="showAll">true</xsl:param>
51 5732 leinfelder
		<table align="center" width="100%" class="subGroup">
52 5591 leinfelder
			<tr>
53
				<td>
54 5728 leinfelder
					<!-- annotation summary -->
55 5732 leinfelder
					<xsl:call-template name="annotationSearchResult" />
56 5536 leinfelder
				</td>
57
			</tr>
58 5578 leinfelder
59
			<xsl:if test="$showAll='true'">
60 5591 leinfelder
				<xsl:for-each select="./*[local-name()='observation']">
61
					<tr>
62 5721 leinfelder
						<td class="text_plain">
63 5591 leinfelder
							<table class="subGroup subGroup_border">
64
								<tr valign="top">
65 5593 leinfelder
									<td>
66 5728 leinfelder
										<!-- observation entity -->
67
										<xsl:call-template name="observation" />
68 5590 leinfelder
									</td>
69 5593 leinfelder
								</tr>
70 5721 leinfelder
								<tr>
71
									<td>
72
										<table>
73
											<tr>
74
												<!-- measurement -->
75
												<xsl:for-each select="./*[local-name()='measurement']">
76 5728 leinfelder
													<td>
77
														<xsl:call-template name="measurement" />
78
													</td>
79 5721 leinfelder
												</xsl:for-each>
80
											</tr>
81
										</table>
82
									</td>
83 5590 leinfelder
								</tr>
84 5591 leinfelder
							</table>
85
						</td>
86
					</tr>
87 5728 leinfelder
				</xsl:for-each><!-- end observation -->
88
			</xsl:if><!--end show all-->
89 5578 leinfelder
90
			<tr class="searchresultsdivider">
91 5721 leinfelder
				<td></td>
92 5536 leinfelder
			</tr>
93 5721 leinfelder
		</table>
94 5590 leinfelder
95 5536 leinfelder
	</xsl:template>
96 5721 leinfelder
97 5732 leinfelder
	<xsl:template name="annotationSearchResult">
98
		<table class="subGroup subGroup_border">
99
			<tr>
100
				<xsl:variable name="mapCount">
101
					<xsl:value-of select="count(./*[local-name()='map'])"/>
102
				</xsl:variable>
103
				<td class="rowodd">
104
					Data Table (<xsl:value-of select="./@dataTable"/>):
105
     			</td>
106
     			<td class="roweven">
107
     				<a>
108
						<xsl:attribute name="href">
109
							<xsl:value-of select="$tripleURI"/><xsl:value-of select="./@emlPackage"/>&amp;displaymodule=entity&amp;entitytype=dataTable&amp;entityindex=<xsl:value-of select="number(./@dataTable)+1"/>&amp;annotationId=<xsl:value-of select="./@id"/>
110
						</xsl:attribute>
111
112
	     				<xsl:for-each select="./*[local-name()='map']">
113
	     					<xsl:value-of select="./@attribute"/>
114
	     					<xsl:if test="position() != last()">, </xsl:if>
115
	     				</xsl:for-each>
116
	     				(<xsl:value-of select="$mapCount"/> attributes)
117
					</a>
118
     			</td>
119
     		</tr>
120
			<tr>
121
				<td class="rowodd">
122
     				Annotation (<xsl:value-of select="./@id"/>):
123
     			</td>
124
     			<td class="roweven">
125
     				<a>
126
						<xsl:attribute name="href">
127
							<xsl:value-of select="$tripleURI"/><xsl:value-of select="./@id"/>
128
						</xsl:attribute>
129
						View
130
					</a>
131
132
					<!-- stats -->
133
					<span id="annotationStats"></span>
134
					<script language="JavaScript">
135
						loadStats(
136
							'annotationStats',
137
							'<xsl:value-of select="./@id" />',
138
							'<xsl:value-of select="$contextURL" />/metacat',
139
							'<xsl:value-of select="$qformat" />');
140
					</script>
141
142
				</td>
143
			</tr>
144
			<tr>
145
				<td class="rowodd">
146
     				Data Package (<xsl:value-of select="./@emlPackage"/>):
147
     			</td>
148
     			<td class="roweven">
149
     				<a>
150
						<xsl:attribute name="href">
151
							<xsl:value-of select="$tripleURI"/><xsl:value-of select="./@emlPackage"/>
152
						</xsl:attribute>
153
						View Metadata
154
					</a>
155
156
					<!-- stats -->
157
					<span id="emlStats"></span>
158
					<script language="JavaScript">
159
						loadStats(
160
							'emlStats',
161
							'<xsl:value-of select="./@emlPackage" />',
162
							'<xsl:value-of select="$contextURL" />/metacat',
163
							'<xsl:value-of select="$qformat" />');
164
					</script>
165
166
				</td>
167
     		</tr>
168
     	</table>
169
	</xsl:template>
170
171 5728 leinfelder
	<xsl:template name="annotationSummary">
172
		<table class="subGroup subGroup_border">
173
			<tr>
174
				<th colspan="2">
175
					Details
176
				</th>
177
			</tr>
178
			<tr>
179
				<td class="rowodd">
180
     				Annotation:
181
     			</td>
182
     			<td class="roweven">
183
     				<a>
184
						<xsl:attribute name="href">
185
							<xsl:value-of select="$tripleURI"/><xsl:value-of select="./@id"/>
186
						</xsl:attribute>
187
						<xsl:value-of select="./@id"/>
188
					</a>
189
190
					<!-- stats -->
191
					<span id="annotationStats"></span>
192
					<script language="JavaScript">
193
						loadStats(
194
							'annotationStats',
195
							'<xsl:value-of select="./@id" />',
196
							'<xsl:value-of select="$contextURL" />/metacat',
197
							'<xsl:value-of select="$qformat" />');
198
					</script>
199
200
				</td>
201
			</tr>
202
			<tr>
203
				<td class="rowodd">
204
     				Data Package:
205
     			</td>
206
     			<td class="roweven">
207
     				<a>
208
						<xsl:attribute name="href">
209
							<xsl:value-of select="$tripleURI"/><xsl:value-of select="./@emlPackage"/>
210
						</xsl:attribute>
211
						<xsl:value-of select="./@emlPackage"/>
212
					</a>
213
214
					<!-- stats -->
215
					<span id="emlStats"></span>
216
					<script language="JavaScript">
217
						loadStats(
218
							'emlStats',
219
							'<xsl:value-of select="./@emlPackage" />',
220
							'<xsl:value-of select="$contextURL" />/metacat',
221
							'<xsl:value-of select="$qformat" />');
222
					</script>
223
224
				</td>
225
     		</tr>
226
     		<tr>
227
				<td class="rowodd">
228
     				Data Table:
229
     			</td>
230
     			<td class="roweven">
231
     				<a>
232
						<xsl:attribute name="href">
233
							<xsl:value-of select="$tripleURI"/><xsl:value-of select="./@emlPackage"/>&amp;displaymodule=entity&amp;entitytype=dataTable&amp;entityindex=<xsl:value-of select="number(./@dataTable)+1"/>&amp;annotationId=<xsl:value-of select="./@id"/>
234
						</xsl:attribute>
235
						<xsl:value-of select="./@dataTable"/>
236
					</a>
237
				</td>
238
     		</tr>
239
     	</table>
240
	</xsl:template>
241
242
	<xsl:template name="observation">
243
		<table>
244
			<tr>
245 5732 leinfelder
				<th colspan="2">
246
					Observation (<xsl:value-of select="./@label"/>)
247
				</th>
248
			</tr>
249
			<tr>
250 5728 leinfelder
				<td class="rowodd">
251 5732 leinfelder
					Entity:
252 5728 leinfelder
				</td>
253
				<td class="roweven">
254
					<p>
255
						<xsl:attribute name="title">
256
							<xsl:value-of select="fn:namespace-uri-for-prefix(substring-before(./*[local-name()='entity']/@id, ':'), .)"/>
257
							<xsl:text>#</xsl:text>
258
							<xsl:value-of select="substring-after(./*[local-name()='entity']/@id, ':')"/>
259
						</xsl:attribute>
260
						<xsl:value-of select="substring-after(./*[local-name()='entity']/@id, ':')"/>
261
					</p>
262
				</td>
263
			</tr>
264
265
			<tr>
266
				<td class="rowodd">
267
					Ontology:
268
				</td>
269
				<td class="roweven">
270
					<xsl:value-of select="fn:namespace-uri-for-prefix(substring-before(./*[local-name()='entity']/@id, ':'), .)"/>
271
				</td>
272
			</tr>
273
274
		</table>
275
276
	</xsl:template>
277
278 5721 leinfelder
	<xsl:template name="measurement">
279
		<!-- measurement -->
280 5728 leinfelder
		<table class="subGroup subGroup_border">
281
			<tr>
282
				<th colspan="3">
283
					Measurement (<xsl:value-of select="./@label" />)
284
				</th>
285
			</tr>
286
			<tr>
287
				<td class="rowodd">
288
					Column:
289
				</td>
290
				<td class="roweven">
291
					<xsl:variable name="columnkey">
292
						<xsl:value-of select="concat(../../@id, @label)" />
293
					</xsl:variable>
294
					<xsl:for-each select="key('mapping', $columnkey )">
295
						<xsl:value-of select="./@attribute" />
296
					</xsl:for-each>
297
				</td>
298
				<td class="roweven"></td>
299
			</tr>
300
			<tr>
301
				<td class="rowodd">
302
					Characteristic[s]:
303
				</td>
304
				<td class="roweven">
305
					<xsl:for-each select="./*[local-name()='characteristic']">
306 5722 leinfelder
						<span>
307 5721 leinfelder
							<xsl:attribute name="title">
308 5728 leinfelder
								<xsl:value-of select="fn:namespace-uri-for-prefix(substring-before(./@id, ':'), .)"/>
309 5721 leinfelder
								<xsl:text>#</xsl:text>
310 5728 leinfelder
								<xsl:value-of select="substring-after(./@id, ':')"/>
311
							</xsl:attribute>
312
							<xsl:value-of select="substring-after(./@id, ':')"/>
313
						</span>
314
					</xsl:for-each>
315
				</td>
316
			</tr>
317
			<tr>
318
				<td class="rowodd">
319
					Standard:
320
				</td>
321
				<td class="roweven">
322
					<span>
323
						<xsl:attribute name="title">
324
							<xsl:value-of select="fn:namespace-uri-for-prefix(substring-before(./*[local-name()='standard']/@id, ':'), .)"/>
325
							<xsl:text>#</xsl:text>
326
							<xsl:value-of select="substring-after(./*[local-name()='standard']/@id, ':')"/>
327
						</xsl:attribute>
328
						<xsl:value-of select="substring-after(./*[local-name()='standard']/@id, ':')"/>
329
					</span>
330
				</td>
331
			</tr>
332
			<tr>
333
				<td class="rowodd">
334
					Protocol:
335
				</td>
336
				<td class="roweven">
337
					<span>
338
						<xsl:attribute name="title">
339
							<xsl:value-of select="fn:namespace-uri-for-prefix(substring-before(./*[local-name()='protocol']/@id, ':'), .)"/>
340
							<xsl:text>#</xsl:text>
341 5721 leinfelder
							<xsl:value-of select="substring-after(./*[local-name()='protocol']/@id, ':')"/>
342 5728 leinfelder
						</xsl:attribute>
343
						<xsl:value-of select="substring-after(./*[local-name()='protocol']/@id, ':')"/>
344
					</span>
345
				</td>
346
			</tr>
347
		</table>
348 5721 leinfelder
349
	</xsl:template>
350
351
	<xsl:template name="attributeDetail">
352
		<xsl:param name="attributeLabel"/>
353
		<!-- look up the attribute mapping for the given label -->
354 5727 leinfelder
		<xsl:for-each select="key('attributes', concat(//*[local-name()='annotation']/@id, $attributeLabel))">
355 5721 leinfelder
			<!-- get the <measurement> node using this label -->
356 5726 leinfelder
			<table>
357 5721 leinfelder
				<tr>
358 5727 leinfelder
					<xsl:for-each select="key('measurements', concat(//*[local-name()='annotation']/@id, ./@measurement))">
359 5728 leinfelder
						<td>
360
							<xsl:call-template name="measurement"/>
361
						</td>
362 5721 leinfelder
					</xsl:for-each>
363
				</tr>
364
			</table>
365
		</xsl:for-each>
366
	</xsl:template>
367 5536 leinfelder
368
</xsl:stylesheet>