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