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 5675 leinfelder
		<table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" class="subGroup">
52 5591 leinfelder
			<tr>
53
				<td>
54 5728 leinfelder
					<!-- annotation summary -->
55
					<xsl:call-template name="annotationSummary" />
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>
65 5593 leinfelder
									<th>
66 5591 leinfelder
										Observation
67
									</th>
68
								</tr>
69
								<tr valign="top">
70 5593 leinfelder
									<td>
71 5728 leinfelder
										<!-- observation entity -->
72
										<xsl:call-template name="observation" />
73 5590 leinfelder
									</td>
74 5593 leinfelder
								</tr>
75 5721 leinfelder
								<tr>
76
									<td>
77
										<table>
78
											<tr>
79
												<!-- measurement -->
80
												<xsl:for-each select="./*[local-name()='measurement']">
81 5728 leinfelder
													<td>
82
														<xsl:call-template name="measurement" />
83
													</td>
84 5721 leinfelder
												</xsl:for-each>
85
											</tr>
86
										</table>
87
									</td>
88 5590 leinfelder
								</tr>
89 5591 leinfelder
							</table>
90
						</td>
91
					</tr>
92 5728 leinfelder
				</xsl:for-each><!-- end observation -->
93
			</xsl:if><!--end show all-->
94 5578 leinfelder
95
			<tr class="searchresultsdivider">
96 5721 leinfelder
				<td></td>
97 5536 leinfelder
			</tr>
98 5721 leinfelder
		</table>
99 5590 leinfelder
100 5536 leinfelder
	</xsl:template>
101 5721 leinfelder
102 5728 leinfelder
	<xsl:template name="annotationSummary">
103
		<table class="subGroup subGroup_border">
104
			<tr>
105
				<th colspan="2">
106
					Details
107
				</th>
108
			</tr>
109
			<tr>
110
				<td class="rowodd">
111
     				Annotation:
112
     			</td>
113
     			<td class="roweven">
114
     				<a>
115
						<xsl:attribute name="href">
116
							<xsl:value-of select="$tripleURI"/><xsl:value-of select="./@id"/>
117
						</xsl:attribute>
118
						<xsl:value-of select="./@id"/>
119
					</a>
120
121
					<!-- stats -->
122
					<span id="annotationStats"></span>
123
					<script language="JavaScript">
124
						loadStats(
125
							'annotationStats',
126
							'<xsl:value-of select="./@id" />',
127
							'<xsl:value-of select="$contextURL" />/metacat',
128
							'<xsl:value-of select="$qformat" />');
129
					</script>
130
131
				</td>
132
			</tr>
133
			<tr>
134
				<td class="rowodd">
135
     				Data Package:
136
     			</td>
137
     			<td class="roweven">
138
     				<a>
139
						<xsl:attribute name="href">
140
							<xsl:value-of select="$tripleURI"/><xsl:value-of select="./@emlPackage"/>
141
						</xsl:attribute>
142
						<xsl:value-of select="./@emlPackage"/>
143
					</a>
144
145
					<!-- stats -->
146
					<span id="emlStats"></span>
147
					<script language="JavaScript">
148
						loadStats(
149
							'emlStats',
150
							'<xsl:value-of select="./@emlPackage" />',
151
							'<xsl:value-of select="$contextURL" />/metacat',
152
							'<xsl:value-of select="$qformat" />');
153
					</script>
154
155
				</td>
156
     		</tr>
157
     		<tr>
158
				<td class="rowodd">
159
     				Data Table:
160
     			</td>
161
     			<td class="roweven">
162
     				<a>
163
						<xsl:attribute name="href">
164
							<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"/>
165
						</xsl:attribute>
166
						<xsl:value-of select="./@dataTable"/>
167
					</a>
168
				</td>
169
     		</tr>
170
     	</table>
171
	</xsl:template>
172
173
	<xsl:template name="observation">
174
		<table>
175
			<tr>
176
				<td class="rowodd">
177
					Class:
178
				</td>
179
				<td class="roweven">
180
					<p>
181
						<xsl:attribute name="title">
182
							<xsl:value-of select="fn:namespace-uri-for-prefix(substring-before(./*[local-name()='entity']/@id, ':'), .)"/>
183
							<xsl:text>#</xsl:text>
184
							<xsl:value-of select="substring-after(./*[local-name()='entity']/@id, ':')"/>
185
						</xsl:attribute>
186
						<xsl:value-of select="substring-after(./*[local-name()='entity']/@id, ':')"/>
187
					</p>
188
				</td>
189
			</tr>
190
191
			<tr>
192
				<td class="rowodd">
193
					Ontology:
194
				</td>
195
				<td class="roweven">
196
					<xsl:value-of select="fn:namespace-uri-for-prefix(substring-before(./*[local-name()='entity']/@id, ':'), .)"/>
197
				</td>
198
			</tr>
199
200
			<tr>
201
				<td class="rowodd">
202
					Label:
203
				</td>
204
				<td class="roweven">
205
					<xsl:value-of select="./@label"/>
206
				</td>
207
			</tr>
208
		</table>
209
210
	</xsl:template>
211
212 5721 leinfelder
	<xsl:template name="measurement">
213
		<!-- measurement -->
214 5728 leinfelder
		<table class="subGroup subGroup_border">
215
			<tr>
216
				<th colspan="3">
217
					Measurement (<xsl:value-of select="./@label" />)
218
				</th>
219
			</tr>
220
			<tr>
221
				<td class="rowodd">
222
					Column:
223
				</td>
224
				<td class="roweven">
225
					<xsl:variable name="columnkey">
226
						<xsl:value-of select="concat(../../@id, @label)" />
227
					</xsl:variable>
228
					<xsl:for-each select="key('mapping', $columnkey )">
229
						<xsl:value-of select="./@attribute" />
230
					</xsl:for-each>
231
				</td>
232
				<td class="roweven"></td>
233
			</tr>
234
			<tr>
235
				<td class="rowodd">
236
					Characteristic[s]:
237
				</td>
238
				<td class="roweven">
239
					<xsl:for-each select="./*[local-name()='characteristic']">
240 5722 leinfelder
						<span>
241 5721 leinfelder
							<xsl:attribute name="title">
242 5728 leinfelder
								<xsl:value-of select="fn:namespace-uri-for-prefix(substring-before(./@id, ':'), .)"/>
243 5721 leinfelder
								<xsl:text>#</xsl:text>
244 5728 leinfelder
								<xsl:value-of select="substring-after(./@id, ':')"/>
245
							</xsl:attribute>
246
							<xsl:value-of select="substring-after(./@id, ':')"/>
247
						</span>
248
					</xsl:for-each>
249
				</td>
250
			</tr>
251
			<tr>
252
				<td class="rowodd">
253
					Standard:
254
				</td>
255
				<td class="roweven">
256
					<span>
257
						<xsl:attribute name="title">
258
							<xsl:value-of select="fn:namespace-uri-for-prefix(substring-before(./*[local-name()='standard']/@id, ':'), .)"/>
259
							<xsl:text>#</xsl:text>
260
							<xsl:value-of select="substring-after(./*[local-name()='standard']/@id, ':')"/>
261
						</xsl:attribute>
262
						<xsl:value-of select="substring-after(./*[local-name()='standard']/@id, ':')"/>
263
					</span>
264
				</td>
265
			</tr>
266
			<tr>
267
				<td class="rowodd">
268
					Protocol:
269
				</td>
270
				<td class="roweven">
271
					<span>
272
						<xsl:attribute name="title">
273
							<xsl:value-of select="fn:namespace-uri-for-prefix(substring-before(./*[local-name()='protocol']/@id, ':'), .)"/>
274
							<xsl:text>#</xsl:text>
275 5721 leinfelder
							<xsl:value-of select="substring-after(./*[local-name()='protocol']/@id, ':')"/>
276 5728 leinfelder
						</xsl:attribute>
277
						<xsl:value-of select="substring-after(./*[local-name()='protocol']/@id, ':')"/>
278
					</span>
279
				</td>
280
			</tr>
281
		</table>
282 5721 leinfelder
283
	</xsl:template>
284
285
	<xsl:template name="attributeDetail">
286
		<xsl:param name="attributeLabel"/>
287
		<!-- look up the attribute mapping for the given label -->
288 5727 leinfelder
		<xsl:for-each select="key('attributes', concat(//*[local-name()='annotation']/@id, $attributeLabel))">
289 5721 leinfelder
			<!-- get the <measurement> node using this label -->
290 5726 leinfelder
			<table>
291 5721 leinfelder
				<tr>
292 5727 leinfelder
					<xsl:for-each select="key('measurements', concat(//*[local-name()='annotation']/@id, ./@measurement))">
293 5728 leinfelder
						<td>
294
							<xsl:call-template name="measurement"/>
295
						</td>
296 5721 leinfelder
					</xsl:for-each>
297
				</tr>
298
			</table>
299
		</xsl:for-each>
300
	</xsl:template>
301 5536 leinfelder
302
</xsl:stylesheet>