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="@measurement" />
46
	<xsl:key name="attributes" match="//*[local-name()='map']" use="@attribute" />
47
	<xsl:key name="measurements" match="//*[local-name()='measurement']" use="@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"/>
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: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
							<span>
229
								<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
							</span>	
236
						</xsl:for-each>
237
					</td>
238
				</tr>
239
				<tr>
240
					<td class="rowodd">					
241
						Standard:
242
					</td>
243
					<td class="roweven">
244
						<span>
245
							<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
						</span>							
252
					</td>
253
				</tr>
254
				<tr>
255
					<td class="rowodd">					
256
						Protocol:
257
					</td>
258
					<td class="roweven">
259
						<span>
260
							<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
						</span>
267
					</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

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