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