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
				
55
					<table class="subGroup subGroup_border">
56
						<tr>
57
							<th colspan="2">
58
								Details
59
							</th>
60
						</tr>
61
						<tr>
62
							<td class="rowodd">
63
			     				Annotation:
64
			     			</td>
65
			     			<td class="roweven">
66
			     				<a>
67
									<xsl:attribute name="href">
68
										<xsl:value-of select="$tripleURI"/><xsl:value-of select="./@id"/>
69
									</xsl:attribute>
70
									<xsl:value-of select="./@id"/>
71
								</a>
72
													
73
								<!-- stats -->
74
								<span id="annotationStats"></span>
75
								<script language="JavaScript">
76
									loadStats(
77
										'annotationStats', 
78
										'<xsl:value-of select="./@id" />', 
79
										'<xsl:value-of select="$contextURL" />/metacat',
80
										'<xsl:value-of select="$qformat" />');
81
								</script>
82
								
83
							</td>	
84
						</tr>
85
						<tr>
86
							<td class="rowodd">
87
			     				Data Package:
88
			     			</td>
89
			     			<td class="roweven">
90
			     				<a>
91
									<xsl:attribute name="href">
92
										<xsl:value-of select="$tripleURI"/><xsl:value-of select="./@emlPackage"/>
93
									</xsl:attribute>
94
									<xsl:value-of select="./@emlPackage"/>
95
								</a>
96
														
97
								<!-- stats -->
98
								<span id="emlStats"></span>
99
								<script language="JavaScript">
100
									loadStats(
101
										'emlStats', 
102
										'<xsl:value-of select="./@emlPackage" />', 
103
										'<xsl:value-of select="$contextURL" />/metacat',
104
										'<xsl:value-of select="$qformat" />');
105
								</script>
106
									
107
							</td>
108
			     		</tr>
109
			     		<tr>	
110
							<td class="rowodd">
111
			     				Data Table:
112
			     			</td>
113
			     			<td class="roweven">
114
			     				<a>
115
									<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"/>&amp;annotationId=<xsl:value-of select="./@id"/>
117
									</xsl:attribute>
118
									<xsl:value-of select="./@dataTable"/>
119
								</a>	
120
							</td>
121
			     		</tr>
122
			     	</table>		
123
				</td>
124
			</tr>
125
			
126
			<xsl:if test="$showAll='true'">
127
				<xsl:for-each select="./*[local-name()='observation']">
128
					<tr>
129
						<td class="text_plain">
130
							<table class="subGroup subGroup_border">
131
								<tr>
132
									<th>
133
										Observation
134
									</th>
135
								</tr>
136
								<tr valign="top">
137
									<!-- observation entity -->
138
									<td>
139
										<table>
140
											<tr>
141
												<td class="rowodd">
142
													Class:
143
												</td>
144
												<td class="roweven">
145
													<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
														<xsl:value-of select="substring-after(./*[local-name()='entity']/@id, ':')"/>
152
													</p>	
153
												</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
									</td>
175
								</tr>
176
								<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
								</tr>
189
							</table>
190
						</td>		
191
					</tr>
192
				</xsl:for-each><!-- observation -->	
193
			</xsl:if>
194
			
195
			<tr class="searchresultsdivider">
196
				<td></td>
197
			</tr>
198
		</table>		
199
		
200
	</xsl:template>
201
	
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:variable name="columnkey">
217
							<xsl:value-of select="concat(../../@id, @label)" />
218
						</xsl:variable>
219
						<xsl:for-each select="key('mapping', $columnkey )">
220
							<xsl:value-of select="./@attribute" />
221
						</xsl:for-each>
222
					</td>
223
					<td class="roweven"></td>
224
				</tr>
225
				<tr>
226
					<td class="rowodd">					
227
						Characteristic[s]:
228
					</td>
229
					<td class="roweven">
230
						<xsl:for-each select="./*[local-name()='characteristic']">
231
							<span>
232
								<xsl:attribute name="title">
233
									<xsl:value-of select="fn:namespace-uri-for-prefix(substring-before(./@id, ':'), .)"/>
234
									<xsl:text>#</xsl:text>
235
									<xsl:value-of select="substring-after(./@id, ':')"/>
236
								</xsl:attribute>
237
								<xsl:value-of select="substring-after(./@id, ':')"/>
238
							</span>	
239
						</xsl:for-each>
240
					</td>
241
				</tr>
242
				<tr>
243
					<td class="rowodd">					
244
						Standard:
245
					</td>
246
					<td class="roweven">
247
						<span>
248
							<xsl:attribute name="title">
249
								<xsl:value-of select="fn:namespace-uri-for-prefix(substring-before(./*[local-name()='standard']/@id, ':'), .)"/>
250
								<xsl:text>#</xsl:text>
251
								<xsl:value-of select="substring-after(./*[local-name()='standard']/@id, ':')"/>	
252
							</xsl:attribute>					
253
							<xsl:value-of select="substring-after(./*[local-name()='standard']/@id, ':')"/>
254
						</span>							
255
					</td>
256
				</tr>
257
				<tr>
258
					<td class="rowodd">					
259
						Protocol:
260
					</td>
261
					<td class="roweven">
262
						<span>
263
							<xsl:attribute name="title">
264
								<xsl:value-of select="fn:namespace-uri-for-prefix(substring-before(./*[local-name()='protocol']/@id, ':'), .)"/>
265
								<xsl:text>#</xsl:text>
266
								<xsl:value-of select="substring-after(./*[local-name()='protocol']/@id, ':')"/>
267
							</xsl:attribute>					
268
							<xsl:value-of select="substring-after(./*[local-name()='protocol']/@id, ':')"/>
269
						</span>
270
					</td>
271
				</tr>
272
			</table>
273
		</td>	
274
		
275
	</xsl:template>
276
	
277
	<xsl:template name="attributeDetail">
278
		<xsl:param name="attributeLabel"/>
279
		<!-- look up the attribute mapping for the given label -->
280
		<xsl:for-each select="key('attributes', concat(//*[local-name()='annotation']/@id, $attributeLabel))">
281
			<!-- get the <measurement> node using this label -->
282
			<table>
283
				<tr>
284
					<xsl:for-each select="key('measurements', concat(//*[local-name()='annotation']/@id, ./@measurement))">
285
						<xsl:call-template name="measurement"/>
286
					</xsl:for-each>
287
				</tr>
288
			</table>		
289
		</xsl:for-each>
290
	</xsl:template>
291

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