1
|
<?xml version="1.0"?>
|
2
|
<!--
|
3
|
* '$RCSfile$'
|
4
|
* Authors: Matthew Brooke
|
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: cjones $'
|
10
|
* '$Date: 2006-11-17 13:37:07 -0800 (Fri, 17 Nov 2006) $'
|
11
|
* '$Revision: 3094 $'
|
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 that is valid with respect to the eml-variable.dtd
|
29
|
* module of the Ecological Metadata Language (EML) into an HTML format
|
30
|
* suitable for rendering with modern web browsers.
|
31
|
-->
|
32
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
33
|
<xsl:import href="eml-text.xsl" />
|
34
|
<xsl:output method="html" encoding="iso-8859-1"
|
35
|
doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
|
36
|
doctype-system="http://www.w3.org/TR/html4/loose.dtd"
|
37
|
indent="yes" />
|
38
|
|
39
|
|
40
|
<!-- This module is for distribution and it is self-contained-->
|
41
|
|
42
|
<xsl:template name="distribution">
|
43
|
<xsl:param name="disfirstColStyle"/>
|
44
|
<xsl:param name="dissubHeaderStyle"/>
|
45
|
<xsl:param name="docid"/>
|
46
|
<xsl:param name="level">entitylevel</xsl:param>
|
47
|
<xsl:param name="entitytype"/>
|
48
|
<xsl:param name="entityindex"/>
|
49
|
<xsl:param name="physicalindex"/>
|
50
|
<xsl:param name="distributionindex"/>
|
51
|
<table class="{$tabledefaultStyle}">
|
52
|
<xsl:choose>
|
53
|
<xsl:when test="references!=''">
|
54
|
<xsl:variable name="ref_id" select="references"/>
|
55
|
<xsl:variable name="references" select="$ids[@id=$ref_id]" />
|
56
|
<xsl:for-each select="$references">
|
57
|
<xsl:apply-templates select="online">
|
58
|
<xsl:with-param name="dissubHeaderStyle" select="$dissubHeaderStyle"/>
|
59
|
<xsl:with-param name="disfirstColStyle" select="$disfirstColStyle" />
|
60
|
</xsl:apply-templates>
|
61
|
<xsl:apply-templates select="offline">
|
62
|
<xsl:with-param name="dissubHeaderStyle" select="$dissubHeaderStyle"/>
|
63
|
<xsl:with-param name="disfirstColStyle" select="$disfirstColStyle" />
|
64
|
</xsl:apply-templates>
|
65
|
<xsl:apply-templates select="inline">
|
66
|
<xsl:with-param name="dissubHeaderStyle" select="$dissubHeaderStyle"/>
|
67
|
<xsl:with-param name="disfirstColStyle" select="$disfirstColStyle" />
|
68
|
<xsl:with-param name="docid" select="$docid"/>
|
69
|
<xsl:with-param name="level" select="$level"/>
|
70
|
<xsl:with-param name="entitytype" select="$entitytype"/>
|
71
|
<xsl:with-param name="entityindex" select="$entityindex"/>
|
72
|
<xsl:with-param name="physicalindex" select="$physicalindex"/>
|
73
|
<xsl:with-param name="distributionindex" select="$distributionindex"/>
|
74
|
</xsl:apply-templates>
|
75
|
</xsl:for-each>
|
76
|
</xsl:when>
|
77
|
<xsl:otherwise>
|
78
|
<xsl:apply-templates select="online">
|
79
|
<xsl:with-param name="dissubHeaderStyle" select="$dissubHeaderStyle"/>
|
80
|
<xsl:with-param name="disfirstColStyle" select="$disfirstColStyle" />
|
81
|
</xsl:apply-templates>
|
82
|
<xsl:apply-templates select="offline">
|
83
|
<xsl:with-param name="dissubHeaderStyle" select="$dissubHeaderStyle"/>
|
84
|
<xsl:with-param name="disfirstColStyle" select="$disfirstColStyle" />
|
85
|
</xsl:apply-templates>
|
86
|
<xsl:apply-templates select="inline">
|
87
|
<xsl:with-param name="dissubHeaderStyle" select="$dissubHeaderStyle"/>
|
88
|
<xsl:with-param name="disfirstColStyle" select="$disfirstColStyle" />
|
89
|
<xsl:with-param name="docid" select="$docid"/>
|
90
|
<xsl:with-param name="level" select="$level"/>
|
91
|
<xsl:with-param name="entitytype" select="$entitytype"/>
|
92
|
<xsl:with-param name="entityindex" select="$entityindex"/>
|
93
|
<xsl:with-param name="physicalindex" select="$physicalindex"/>
|
94
|
<xsl:with-param name="distributionindex" select="$distributionindex"/>
|
95
|
</xsl:apply-templates>
|
96
|
</xsl:otherwise>
|
97
|
</xsl:choose>
|
98
|
</table>
|
99
|
</xsl:template>
|
100
|
|
101
|
<!-- ********************************************************************* -->
|
102
|
<!-- ******************************* Online data *********************** -->
|
103
|
<!-- ********************************************************************* -->
|
104
|
<xsl:template match="online">
|
105
|
<xsl:param name="disfirstColStyle"/>
|
106
|
<xsl:param name="dissubHeaderStyle"/>
|
107
|
<tr><td class="{$dissubHeaderStyle}" colspan="2">
|
108
|
<xsl:text>Online Distribution Info:</xsl:text>
|
109
|
</td></tr>
|
110
|
<xsl:apply-templates select="url">
|
111
|
<xsl:with-param name="disfirstColStyle" select="$disfirstColStyle" />
|
112
|
</xsl:apply-templates>
|
113
|
<xsl:apply-templates select="connection">
|
114
|
<xsl:with-param name="disfirstColStyle" select="$disfirstColStyle" />
|
115
|
</xsl:apply-templates>
|
116
|
<xsl:apply-templates select="connectionDefinition">
|
117
|
<xsl:with-param name="disfirstColStyle" select="$disfirstColStyle" />
|
118
|
</xsl:apply-templates>
|
119
|
</xsl:template>
|
120
|
|
121
|
<xsl:template match="url">
|
122
|
<xsl:param name="disfirstColStyle"/>
|
123
|
<xsl:variable name="URL" select="."/>
|
124
|
<tr>
|
125
|
<td class="{$disfirstColStyle}">
|
126
|
<xsl:text> </xsl:text>
|
127
|
</td>
|
128
|
<td class="{$secondColStyle}">
|
129
|
<a>
|
130
|
<xsl:choose>
|
131
|
<xsl:when test="starts-with($URL,'ecogrid')">
|
132
|
<xsl:variable name="URL1" select="substring-after($URL, 'ecogrid://')"/>
|
133
|
<xsl:variable name="docID" select="substring-after($URL1, '/')"/>
|
134
|
<xsl:attribute name="href"><xsl:value-of select="$tripleURI"/><xsl:value-of select="$docID"/></xsl:attribute>
|
135
|
</xsl:when>
|
136
|
<xsl:otherwise>
|
137
|
<xsl:attribute name="href"><xsl:value-of select="$URL"/></xsl:attribute>
|
138
|
</xsl:otherwise>
|
139
|
</xsl:choose>
|
140
|
<xsl:attribute name="target">_blank</xsl:attribute>
|
141
|
<xsl:value-of select="."/>
|
142
|
</a>
|
143
|
<!-- stats for hosted documents loaded with ajax call -->
|
144
|
<xsl:if test="starts-with($URL,'ecogrid')">
|
145
|
<xsl:variable name="URL1" select="substring-after($URL, 'ecogrid://')"/>
|
146
|
<xsl:variable name="docID" select="substring-after($URL1, '/')"/>
|
147
|
<xsl:variable name="divID">dataStats</xsl:variable>
|
148
|
<span>
|
149
|
<xsl:attribute name="id">
|
150
|
<xsl:value-of select="$divID" />
|
151
|
</xsl:attribute>
|
152
|
</span>
|
153
|
<script language="JavaScript">
|
154
|
if (window.loadStats) {
|
155
|
loadStats(
|
156
|
'<xsl:value-of select="$divID" />',
|
157
|
'<xsl:value-of select="$docID" />',
|
158
|
'<xsl:value-of select="$contextURL" />/metacat',
|
159
|
'<xsl:value-of select="$qformat" />');
|
160
|
}
|
161
|
</script>
|
162
|
</xsl:if>
|
163
|
</td>
|
164
|
</tr>
|
165
|
</xsl:template>
|
166
|
|
167
|
<xsl:template match="connection">
|
168
|
<xsl:param name="disfirstColStyle"/>
|
169
|
<xsl:choose>
|
170
|
<xsl:when test="references!=''">
|
171
|
<xsl:variable name="ref_id" select="references"/>
|
172
|
<xsl:variable name="references" select="$ids[@id=$ref_id]" />
|
173
|
<xsl:for-each select="$references">
|
174
|
<xsl:call-template name="connectionCommon">
|
175
|
<xsl:with-param name="disfirstColStyle" select="$disfirstColStyle"/>
|
176
|
</xsl:call-template>
|
177
|
</xsl:for-each>
|
178
|
</xsl:when>
|
179
|
<xsl:otherwise>
|
180
|
<xsl:call-template name="connectionCommon">
|
181
|
<xsl:with-param name="disfirstColStyle" select="$disfirstColStyle"/>
|
182
|
</xsl:call-template>
|
183
|
</xsl:otherwise>
|
184
|
</xsl:choose>
|
185
|
</xsl:template>
|
186
|
|
187
|
<!-- A template shared by connection references and connection in line-->
|
188
|
<xsl:template name="connectionCommon">
|
189
|
<xsl:param name="disfirstColStyle"/>
|
190
|
<xsl:if test="parameter">
|
191
|
<tr>
|
192
|
<td class="{$disfirstColStyle}">
|
193
|
<xsl:text>Parameter(s):</xsl:text>
|
194
|
</td>
|
195
|
<td class="{$secondColStyle}"><xsl:text> </xsl:text>
|
196
|
</td>
|
197
|
</tr>
|
198
|
<xsl:call-template name="renderParameters">
|
199
|
<xsl:with-param name="disfirstColStyle" select="$disfirstColStyle" />
|
200
|
</xsl:call-template>
|
201
|
</xsl:if>
|
202
|
<xsl:apply-templates select="connectionDefinition">
|
203
|
<xsl:with-param name="disfirstColStyle" select="$disfirstColStyle" />
|
204
|
</xsl:apply-templates>
|
205
|
</xsl:template>
|
206
|
|
207
|
<xsl:template name="renderParameters">
|
208
|
<xsl:param name="disfirstColStyle"/>
|
209
|
<xsl:for-each select="parameter" >
|
210
|
<tr>
|
211
|
<td class="{$disfirstColStyle}">
|
212
|
<xsl:text>     </xsl:text><xsl:value-of select="name" />
|
213
|
</td>
|
214
|
<td class="{$secondColStyle}">
|
215
|
<xsl:value-of select="value" />
|
216
|
</td>
|
217
|
</tr>
|
218
|
</xsl:for-each>
|
219
|
</xsl:template>
|
220
|
|
221
|
<xsl:template match="connectionDefinition">
|
222
|
<xsl:param name="disfirstColStyle"/>
|
223
|
<xsl:choose>
|
224
|
<xsl:when test="references!=''">
|
225
|
<xsl:variable name="ref_id" select="references"/>
|
226
|
<xsl:variable name="references" select="$ids[@id=$ref_id]" />
|
227
|
<xsl:for-each select="$references">
|
228
|
<xsl:call-template name="connectionDefinitionCommon">
|
229
|
<xsl:with-param name="disfirstColStyle" select="$disfirstColStyle"/>
|
230
|
</xsl:call-template>
|
231
|
</xsl:for-each>
|
232
|
</xsl:when>
|
233
|
<xsl:otherwise>
|
234
|
<xsl:call-template name="connectionDefinitionCommon">
|
235
|
<xsl:with-param name="disfirstColStyle" select="$disfirstColStyle"/>
|
236
|
</xsl:call-template>
|
237
|
</xsl:otherwise>
|
238
|
</xsl:choose>
|
239
|
</xsl:template>
|
240
|
|
241
|
<!-- This template will be shared by both reference and inline connectionDefinition-->
|
242
|
<xsl:template name="connectionDefinitionCommon">
|
243
|
<xsl:param name="disfirstColStyle"/>
|
244
|
<tr>
|
245
|
<td class="{$disfirstColStyle}">
|
246
|
<xsl:text>Schema Name:</xsl:text>
|
247
|
</td>
|
248
|
<td class="{$secondColStyle}">
|
249
|
<xsl:value-of select="schemeName" />
|
250
|
</td>
|
251
|
</tr>
|
252
|
<tr>
|
253
|
<td class="{$disfirstColStyle}">
|
254
|
<xsl:text>Description:</xsl:text>
|
255
|
</td>
|
256
|
<td>
|
257
|
<xsl:apply-templates select="description">
|
258
|
<xsl:with-param name="disfirstColStyle" select="$disfirstColStyle" />
|
259
|
</xsl:apply-templates>
|
260
|
</td>
|
261
|
</tr>
|
262
|
<xsl:for-each select="parameterDefinition">
|
263
|
<xsl:call-template name="renderParameterDefinition">
|
264
|
<xsl:with-param name="disfirstColStyle" select="$disfirstColStyle" />
|
265
|
</xsl:call-template>
|
266
|
</xsl:for-each>
|
267
|
</xsl:template>
|
268
|
|
269
|
<xsl:template match="description">
|
270
|
<xsl:param name="disfirstColStyle"/>
|
271
|
<xsl:call-template name="text">
|
272
|
<xsl:with-param name="textfirstColStyle" select="$secondColStyle" />
|
273
|
</xsl:call-template>
|
274
|
</xsl:template>
|
275
|
|
276
|
<xsl:template name="renderParameterDefinition">
|
277
|
<xsl:param name="disfirstColStyle"/>
|
278
|
<tr>
|
279
|
<td class="{$disfirstColStyle}">
|
280
|
<xsl:text>     </xsl:text><xsl:value-of select="name" /><xsl:text>:</xsl:text>
|
281
|
</td>
|
282
|
<td>
|
283
|
<table class="{$tabledefaultStyle}">
|
284
|
<tr>
|
285
|
<td class="{$disfirstColStyle}">
|
286
|
<xsl:choose>
|
287
|
<xsl:when test="defaultValue">
|
288
|
<xsl:value-of select="defaultValue" />
|
289
|
</xsl:when>
|
290
|
<xsl:otherwise>
|
291
|
 
|
292
|
</xsl:otherwise>
|
293
|
</xsl:choose>
|
294
|
|
295
|
</td>
|
296
|
<td class="{$secondColStyle}">
|
297
|
<xsl:value-of select="definition" />
|
298
|
</td>
|
299
|
</tr>
|
300
|
</table>
|
301
|
</td>
|
302
|
</tr>
|
303
|
</xsl:template>
|
304
|
|
305
|
<!-- ********************************************************************* -->
|
306
|
<!-- ******************************* Offline data ********************** -->
|
307
|
<!-- ********************************************************************* -->
|
308
|
|
309
|
<xsl:template match="offline">
|
310
|
<xsl:param name="disfirstColStyle"/>
|
311
|
<xsl:param name="dissubHeaderStyle"/>
|
312
|
<tr><td class="{$dissubHeaderStyle}" colspan="2">
|
313
|
<xsl:text>Offline Distribution Info:</xsl:text>
|
314
|
</td></tr>
|
315
|
<xsl:if test="(mediumName) and normalize-space(mediumName)!=''">
|
316
|
<tr><td class="{$disfirstColStyle}"><xsl:text>Medium:</xsl:text></td>
|
317
|
<td class="{$secondColStyle}"><xsl:value-of select="mediumName"/></td></tr>
|
318
|
</xsl:if>
|
319
|
<xsl:if test="(mediumDensity) and normalize-space(mediumDensity)!=''">
|
320
|
<tr><td class="{$disfirstColStyle}"><xsl:text>Medium Density:</xsl:text></td>
|
321
|
<td class="{$secondColStyle}"><xsl:value-of select="mediumDensity"/>
|
322
|
<xsl:if test="(mediumDensityUnits) and normalize-space(mediumDensityUnits)!=''">
|
323
|
<xsl:text> (</xsl:text><xsl:value-of select="mediumDensityUnits"/><xsl:text>)</xsl:text>
|
324
|
</xsl:if>
|
325
|
</td></tr>
|
326
|
</xsl:if>
|
327
|
<xsl:if test="(mediumVol) and normalize-space(mediumVol)!=''">
|
328
|
<tr><td class="{$disfirstColStyle}"><xsl:text>Volume:</xsl:text></td>
|
329
|
<td class="{$secondColStyle}"><xsl:value-of select="mediumVol"/></td></tr>
|
330
|
</xsl:if>
|
331
|
<xsl:if test="(mediumFormat) and normalize-space(mediumFormat)!=''">
|
332
|
<tr><td class="{$disfirstColStyle}"><xsl:text>Format:</xsl:text></td>
|
333
|
<td class="{$secondColStyle}"><xsl:value-of select="mediumFormat"/></td></tr>
|
334
|
</xsl:if>
|
335
|
<xsl:if test="(mediumNote) and normalize-space(mediumNote)!=''">
|
336
|
<tr><td class="{$disfirstColStyle}"><xsl:text>Notes:</xsl:text></td>
|
337
|
<td class="{$secondColStyle}"><xsl:value-of select="mediumNote"/></td></tr>
|
338
|
</xsl:if>
|
339
|
</xsl:template>
|
340
|
|
341
|
<!-- ********************************************************************* -->
|
342
|
<!-- ******************************* Inline data *********************** -->
|
343
|
<!-- ********************************************************************* -->
|
344
|
|
345
|
|
346
|
<xsl:template match="inline">
|
347
|
<xsl:param name="disfirstColStyle"/>
|
348
|
<xsl:param name="dissubHeaderStyle"/>
|
349
|
<xsl:param name="docid"/>
|
350
|
<xsl:param name="level">entity</xsl:param>
|
351
|
<xsl:param name="entitytype"/>
|
352
|
<xsl:param name="entityindex"/>
|
353
|
<xsl:param name="physicalindex"/>
|
354
|
<xsl:param name="distributionindex"/>
|
355
|
|
356
|
<tr><td class="{$dissubHeaderStyle}" colspan="2">
|
357
|
<xsl:text>Inline Data:</xsl:text>
|
358
|
</td></tr>
|
359
|
<tr><td class="{$disfirstColStyle}">
|
360
|
<xsl:text> </xsl:text></td>
|
361
|
<td class="{$secondColStyle}">
|
362
|
<!-- for top top distribution-->
|
363
|
<xsl:if test="$level='toplevel'">
|
364
|
<a><xsl:attribute name="href"><xsl:value-of select="$tripleURI"/><xsl:value-of select="$docid"/>&displaymodule=inlinedata&distributionlevel=<xsl:value-of select="$level"/>&distributionindex=<xsl:value-of select="$distributionindex"/></xsl:attribute>
|
365
|
<b>Inline Data</b></a>
|
366
|
</xsl:if>
|
367
|
<xsl:if test="$level='entitylevel'">
|
368
|
<a><xsl:attribute name="href"><xsl:value-of select="$tripleURI"/><xsl:value-of select="$docid"/>&displaymodule=inlinedata&distributionlevel=<xsl:value-of select="$level"/>&entitytype=<xsl:value-of select="$entitytype"/>&entityindex=<xsl:value-of select="$entityindex"/>&physicalindex=<xsl:value-of select="$physicalindex"/>&distributionindex=<xsl:value-of select="$distributionindex"/></xsl:attribute>
|
369
|
<b>Inline Data</b></a>
|
370
|
</xsl:if>
|
371
|
</td></tr>
|
372
|
</xsl:template>
|
373
|
|
374
|
|
375
|
</xsl:stylesheet>
|