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