Project

General

Profile

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" border="0" cellpadding="0" cellspacing="0" width="100%" class="subGroup">
52
			<tr>
53
				<td>
54
					<!-- annotation summary -->
55
					<xsl:call-template name="annotationSummary" />
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">
64
								<tr>
65
									<th>
66
										Observation
67
									</th>
68
								</tr>
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>
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
			</xsl:if><!--end show all-->	
94
			
95
			<tr class="searchresultsdivider">
96
				<td></td>
97
			</tr>
98
		</table>		
99
		
100
	</xsl:template>
101
	
102
	<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
	<xsl:template name="measurement">
213
		<!-- measurement -->
214
		<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
						<span>
241
							<xsl:attribute name="title">
242
								<xsl:value-of select="fn:namespace-uri-for-prefix(substring-before(./@id, ':'), .)"/>
243
								<xsl:text>#</xsl:text>
244
								<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
							<xsl:value-of select="substring-after(./*[local-name()='protocol']/@id, ':')"/>
276
						</xsl:attribute>					
277
						<xsl:value-of select="substring-after(./*[local-name()='protocol']/@id, ':')"/>
278
					</span>
279
				</td>
280
			</tr>
281
		</table>
282
		
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
		<xsl:for-each select="key('attributes', concat(//*[local-name()='annotation']/@id, $attributeLabel))">
289
			<!-- get the <measurement> node using this label -->
290
			<table>
291
				<tr>
292
					<xsl:for-each select="key('measurements', concat(//*[local-name()='annotation']/@id, ./@measurement))">
293
						<td>
294
							<xsl:call-template name="measurement"/>
295
						</td>	
296
					</xsl:for-each>
297
				</tr>
298
			</table>		
299
		</xsl:for-each>
300
	</xsl:template>
301

    
302
</xsl:stylesheet>
(1-1/14)