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 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>
43 5743 leinfelder
	<xsl:param name="labelWidth">120</xsl:param>
44 5542 leinfelder
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 5738 leinfelder
					<xsl:call-template name="annotationSummary" />
56 5536 leinfelder
				</td>
57
			</tr>
58 5578 leinfelder
59 5740 leinfelder
			<xsl:choose>
60
61
				<xsl:when test="$showAll='true'">
62
63
					<!-- render the full observations and measurements -->
64
					<xsl:for-each select="./*[local-name()='observation']">
65
						<tr>
66
							<td>
67
								<table class="subGroup subGroup_border onehundred_percent">
68
									<tr valign="top">
69
										<td>
70
											<!-- observation entity -->
71
											<xsl:call-template name="observation" />
72
										</td>
73
									</tr>
74
									<tr>
75
										<td>
76
											<table class="onehundred_percent">
77
												<tr>
78
													<!-- measurement -->
79
													<xsl:for-each select="./*[local-name()='measurement']">
80
														<td>
81
															<xsl:call-template name="measurement" />
82
														</td>
83
													</xsl:for-each>
84
												</tr>
85
											</table>
86
										</td>
87
									</tr>
88
								</table>
89
							</td>
90
						</tr>
91
					</xsl:for-each><!-- end observation -->
92
93
				</xsl:when><!--end show all-->
94
				<xsl:otherwise>
95 5591 leinfelder
					<tr>
96 5740 leinfelder
						<td>
97
							<xsl:call-template name="modelSummary" />
98
						</td>
99
					</tr>
100
				</xsl:otherwise>
101
			</xsl:choose>
102 5578 leinfelder
103
			<tr class="searchresultsdivider">
104 5721 leinfelder
				<td></td>
105 5536 leinfelder
			</tr>
106 5721 leinfelder
		</table>
107 5590 leinfelder
108 5536 leinfelder
	</xsl:template>
109 5721 leinfelder
110 5738 leinfelder
	<xsl:template name="annotationSummary">
111 5733 leinfelder
		<table class="subGroup subGroup_border onehundred_percent">
112 5732 leinfelder
			<tr>
113 5733 leinfelder
				<th colspan="2">
114
     				Annotation
115
     				<a>
116
						<xsl:attribute name="href">
117
							<xsl:value-of select="$tripleURI"/><xsl:value-of select="./@id"/>
118
						</xsl:attribute>
119
						(<xsl:value-of select="./@id"/>)
120
					</a>
121
122
					<!-- stats -->
123
					<span id="annotationStats"></span>
124
					<script language="JavaScript">
125
						loadStats(
126
							'annotationStats',
127
							'<xsl:value-of select="./@id" />',
128
							'<xsl:value-of select="$contextURL" />/metacat',
129
							'<xsl:value-of select="$qformat" />');
130
					</script>
131
				</th>
132
			</tr>
133
			<tr>
134 5732 leinfelder
				<xsl:variable name="mapCount">
135
					<xsl:value-of select="count(./*[local-name()='map'])"/>
136
				</xsl:variable>
137 5743 leinfelder
				<td class="rowodd" width="{$labelWidth}">
138 5739 leinfelder
					Data Table <xsl:value-of select="./@dataTable"/>:
139 5732 leinfelder
     			</td>
140
     			<td class="roweven">
141 5739 leinfelder
     				<xsl:for-each select="./*[local-name()='map']">
142
     					<xsl:value-of select="./@attribute"/>
143
     					<xsl:if test="position() != last()">, </xsl:if>
144
     				</xsl:for-each>
145
     				(<a>
146 5732 leinfelder
						<xsl:attribute name="href">
147
							<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"/>
148
						</xsl:attribute>
149 5739 leinfelder
	     				<xsl:value-of select="$mapCount"/>
150
	     				<xsl:text> attributes</xsl:text>
151
					</a>)
152 5732 leinfelder
     			</td>
153
     		</tr>
154
			<tr>
155 5743 leinfelder
				<td class="rowodd" width="{$labelWidth}">
156 5739 leinfelder
     				Data Package:
157 5732 leinfelder
     			</td>
158
     			<td class="roweven">
159 5739 leinfelder
     				<xsl:value-of select="./@emlPackage"/>
160
     				(<a>
161 5732 leinfelder
						<xsl:attribute name="href">
162
							<xsl:value-of select="$tripleURI"/><xsl:value-of select="./@emlPackage"/>
163
						</xsl:attribute>
164 5739 leinfelder
						<xsl:text>View Metadata</xsl:text>
165
					</a>)
166 5732 leinfelder
167
					<!-- stats -->
168
					<span id="emlStats"></span>
169
					<script language="JavaScript">
170
						loadStats(
171
							'emlStats',
172
							'<xsl:value-of select="./@emlPackage" />',
173
							'<xsl:value-of select="$contextURL" />/metacat',
174
							'<xsl:value-of select="$qformat" />');
175
					</script>
176
177
				</td>
178
     		</tr>
179
     	</table>
180
	</xsl:template>
181
182 5728 leinfelder
	<xsl:template name="observation">
183 5733 leinfelder
		<table class="onehundred_percent">
184 5728 leinfelder
			<tr>
185 5732 leinfelder
				<th colspan="2">
186
					Observation (<xsl:value-of select="./@label"/>)
187
				</th>
188
			</tr>
189
			<tr>
190 5743 leinfelder
				<td class="rowodd" width="{$labelWidth}">
191 5732 leinfelder
					Entity:
192 5728 leinfelder
				</td>
193
				<td class="roweven">
194
					<p>
195
						<xsl:attribute name="title">
196
							<xsl:value-of select="fn:namespace-uri-for-prefix(substring-before(./*[local-name()='entity']/@id, ':'), .)"/>
197
							<xsl:text>#</xsl:text>
198
							<xsl:value-of select="substring-after(./*[local-name()='entity']/@id, ':')"/>
199
						</xsl:attribute>
200
						<xsl:value-of select="substring-after(./*[local-name()='entity']/@id, ':')"/>
201
					</p>
202
				</td>
203
			</tr>
204
205
			<tr>
206 5743 leinfelder
				<td class="rowodd" width="{$labelWidth}">
207 5728 leinfelder
					Ontology:
208
				</td>
209
				<td class="roweven">
210
					<xsl:value-of select="fn:namespace-uri-for-prefix(substring-before(./*[local-name()='entity']/@id, ':'), .)"/>
211
				</td>
212
			</tr>
213
214
		</table>
215
216
	</xsl:template>
217
218 5721 leinfelder
	<xsl:template name="measurement">
219
		<!-- measurement -->
220 5733 leinfelder
		<table class="subGroup subGroup_border onehundred_percent">
221 5728 leinfelder
			<tr>
222 5733 leinfelder
				<th colspan="2">
223 5728 leinfelder
					Measurement (<xsl:value-of select="./@label" />)
224
				</th>
225
			</tr>
226
			<tr>
227 5743 leinfelder
				<td class="rowodd" width="{$labelWidth}">
228 5728 leinfelder
					Column:
229
				</td>
230
				<td class="roweven">
231
					<xsl:variable name="columnkey">
232
						<xsl:value-of select="concat(../../@id, @label)" />
233
					</xsl:variable>
234
					<xsl:for-each select="key('mapping', $columnkey )">
235
						<xsl:value-of select="./@attribute" />
236
					</xsl:for-each>
237
				</td>
238
			</tr>
239
			<tr>
240 5743 leinfelder
				<td class="rowodd" width="{$labelWidth}">
241 5728 leinfelder
					Characteristic[s]:
242
				</td>
243
				<td class="roweven">
244
					<xsl:for-each select="./*[local-name()='characteristic']">
245 5722 leinfelder
						<span>
246 5721 leinfelder
							<xsl:attribute name="title">
247 5728 leinfelder
								<xsl:value-of select="fn:namespace-uri-for-prefix(substring-before(./@id, ':'), .)"/>
248 5721 leinfelder
								<xsl:text>#</xsl:text>
249 5728 leinfelder
								<xsl:value-of select="substring-after(./@id, ':')"/>
250
							</xsl:attribute>
251
							<xsl:value-of select="substring-after(./@id, ':')"/>
252
						</span>
253
					</xsl:for-each>
254
				</td>
255
			</tr>
256
			<tr>
257 5743 leinfelder
				<td class="rowodd" width="{$labelWidth}">
258 5728 leinfelder
					Standard:
259
				</td>
260
				<td class="roweven">
261
					<span>
262
						<xsl:attribute name="title">
263
							<xsl:value-of select="fn:namespace-uri-for-prefix(substring-before(./*[local-name()='standard']/@id, ':'), .)"/>
264
							<xsl:text>#</xsl:text>
265
							<xsl:value-of select="substring-after(./*[local-name()='standard']/@id, ':')"/>
266
						</xsl:attribute>
267
						<xsl:value-of select="substring-after(./*[local-name()='standard']/@id, ':')"/>
268
					</span>
269
				</td>
270
			</tr>
271
			<tr>
272 5743 leinfelder
				<td class="rowodd" width="{$labelWidth}">
273 5728 leinfelder
					Protocol:
274
				</td>
275
				<td class="roweven">
276
					<span>
277
						<xsl:attribute name="title">
278
							<xsl:value-of select="fn:namespace-uri-for-prefix(substring-before(./*[local-name()='protocol']/@id, ':'), .)"/>
279
							<xsl:text>#</xsl:text>
280 5721 leinfelder
							<xsl:value-of select="substring-after(./*[local-name()='protocol']/@id, ':')"/>
281 5728 leinfelder
						</xsl:attribute>
282
						<xsl:value-of select="substring-after(./*[local-name()='protocol']/@id, ':')"/>
283
					</span>
284
				</td>
285
			</tr>
286
		</table>
287 5721 leinfelder
288
	</xsl:template>
289
290 5740 leinfelder
	<xsl:template name="measurementSummary">
291
		<!-- entity -->
292
		<xsl:for-each select="../*[local-name()='entity']">
293
			<span>
294
				<xsl:attribute name="title">
295
					<xsl:value-of select="fn:namespace-uri-for-prefix(substring-before(./@id, ':'), .)"/>
296
					<xsl:text>#</xsl:text>
297
					<xsl:value-of select="substring-after(./@id, ':')"/>
298
				</xsl:attribute>
299
				<xsl:value-of select="substring-after(./@id, ':')"/>
300
			</span>
301
			(<xsl:value-of select="../@label"/>)
302
			<xsl:if test="position() != last()">, </xsl:if>
303
		</xsl:for-each>
304
		<xsl:text> / </xsl:text>
305
		<!-- measurement -->
306
		<!--
307
		<xsl:value-of select="./@label" />
308
		-->
309
		<!-- characteristic -->
310
		<xsl:for-each select="./*[local-name()='characteristic']">
311
			<span>
312
				<xsl:attribute name="title">
313
					<xsl:value-of select="fn:namespace-uri-for-prefix(substring-before(./@id, ':'), .)"/>
314
					<xsl:text>#</xsl:text>
315
					<xsl:value-of select="substring-after(./@id, ':')"/>
316
				</xsl:attribute>
317
				<xsl:value-of select="substring-after(./@id, ':')"/>
318
			</span>
319
			<xsl:if test="position() != last()">, </xsl:if>
320
		</xsl:for-each>
321
		<xsl:text> / </xsl:text>
322
		<!-- standard -->
323
		<span>
324
			<xsl:attribute name="title">
325
				<xsl:value-of select="fn:namespace-uri-for-prefix(substring-before(./*[local-name()='standard']/@id, ':'), .)"/>
326
				<xsl:text>#</xsl:text>
327
				<xsl:value-of select="substring-after(./*[local-name()='standard']/@id, ':')"/>
328
			</xsl:attribute>
329
			<xsl:value-of select="substring-after(./*[local-name()='standard']/@id, ':')"/>
330
		</span>
331
		<xsl:text> / </xsl:text>
332
		<!-- protocol -->
333
		<span>
334
			<xsl:attribute name="title">
335
				<xsl:value-of select="fn:namespace-uri-for-prefix(substring-before(./*[local-name()='protocol']/@id, ':'), .)"/>
336
				<xsl:text>#</xsl:text>
337
				<xsl:value-of select="substring-after(./*[local-name()='protocol']/@id, ':')"/>
338
			</xsl:attribute>
339
			<xsl:value-of select="substring-after(./*[local-name()='protocol']/@id, ':')"/>
340
		</span>
341
	</xsl:template>
342
343
	<xsl:template name="modelSummary">
344 5743 leinfelder
		<table class="subGroup subGroup_border onehundred_percent">
345 5740 leinfelder
			<tr>
346
				<th colspan="2">
347
					Attribute Summary
348
				</th>
349
			</tr>
350
351
			<!-- reference to the annotation parent -->
352
			<xsl:variable name="thisAnnotationId">
353
				<xsl:value-of select="./@id"/>
354
			</xsl:variable>
355
356
			<xsl:for-each select="./*[local-name()='map']">
357
				<tr>
358
					<!-- look up the attribute -->
359
					<xsl:variable name="attributeLabel">
360
						<xsl:value-of select="./@attribute"/>
361
					</xsl:variable>
362
					<td class="rowodd">
363
						<xsl:value-of select="$attributeLabel"/>
364
					</td>
365
					<td>
366
						<!-- look up the attribute mapping for the given attribute -->
367
						<xsl:for-each select="key('attributes', concat($thisAnnotationId, $attributeLabel))">
368
							<table>
369
								<tr>
370
									<!-- get the <measurement> node using this label -->
371
									<xsl:for-each select="key('measurements', concat($thisAnnotationId, ./@measurement))">
372
										<td>
373
											<xsl:call-template name="measurementSummary"/>
374
										</td>
375
									</xsl:for-each>
376
								</tr>
377
							</table>
378
						</xsl:for-each>
379
					</td>
380
				</tr>
381
382
			</xsl:for-each>
383
384
		</table>
385
386
	</xsl:template>
387
388 5721 leinfelder
	<xsl:template name="attributeDetail">
389
		<xsl:param name="attributeLabel"/>
390
		<!-- look up the attribute mapping for the given label -->
391 5727 leinfelder
		<xsl:for-each select="key('attributes', concat(//*[local-name()='annotation']/@id, $attributeLabel))">
392 5721 leinfelder
			<!-- get the <measurement> node using this label -->
393 5726 leinfelder
			<table>
394 5721 leinfelder
				<tr>
395 5727 leinfelder
					<xsl:for-each select="key('measurements', concat(//*[local-name()='annotation']/@id, ./@measurement))">
396 5728 leinfelder
						<td>
397
							<xsl:call-template name="measurement"/>
398
						</td>
399 5721 leinfelder
					</xsl:for-each>
400
				</tr>
401
			</table>
402
		</xsl:for-each>
403
	</xsl:template>
404 5536 leinfelder
405
</xsl:stylesheet>