Project

General

Profile

1
<?xml version="1.0"?>
2
<!--
3
  *  '$RCSfile: eml-distribution-2.0.0.xsl,v $'
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: 2004/10/05 23:50:34 $'
11
  * '$Revision: 1.1 $'
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-2.0.0.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>&#160;</xsl:text>
127
        <xsl:text>View this object after acceptance of Data Use Agreement:</xsl:text>
128
      </td>
129
      <td class="{$secondColStyle}">
130

    
131

    
132

    
133
         <a>
134
           <xsl:choose>
135
           <xsl:when test="starts-with($URL,'ecogrid')">
136
		<xsl:variable name="URL1" select="substring-after($URL, 'ecogrid://')"/>
137
		<xsl:variable name="docID" select="substring-after($URL1, '/')"/>
138
		<xsl:attribute name="href"><xsl:value-of select="$tripleURI"/><xsl:value-of select="$docID"/></xsl:attribute>
139
           </xsl:when>
140
           <xsl:otherwise>
141
		<xsl:attribute name="href"><xsl:value-of select="$URL"/></xsl:attribute>
142
           </xsl:otherwise>
143
          </xsl:choose>
144
          <xsl:attribute name="target">_blank</xsl:attribute>
145
          <xsl:value-of select="."/>
146
        </a>
147
       </td>
148
    </tr>
149
  </xsl:template>
150

    
151
  <xsl:template match="connection">
152
    <xsl:param name="disfirstColStyle"/>
153
    <xsl:choose>
154
      <xsl:when test="references!=''">
155
        <xsl:variable name="ref_id" select="references"/>
156
        <xsl:variable name="references" select="$ids[@id=$ref_id]" />
157
        <xsl:for-each select="$references">
158
          <xsl:call-template name="connectionCommon">
159
            <xsl:with-param name="disfirstColStyle" select="$disfirstColStyle"/>
160
          </xsl:call-template>
161
        </xsl:for-each>
162
      </xsl:when>
163
      <xsl:otherwise>
164
        <xsl:call-template name="connectionCommon">
165
          <xsl:with-param name="disfirstColStyle" select="$disfirstColStyle"/>
166
        </xsl:call-template>
167
      </xsl:otherwise>
168
    </xsl:choose>
169
  </xsl:template>
170

    
171
  <!-- A template shared by connection references and connection in line-->
172
  <xsl:template name="connectionCommon">
173
    <xsl:param name="disfirstColStyle"/>
174
    <xsl:if test="parameter">
175
      <tr>
176
        <td class="{$disfirstColStyle}">
177
          <xsl:text>Parameter(s):</xsl:text>
178
        </td>
179
        <td class="{$secondColStyle}"><xsl:text>&#160;</xsl:text>
180
        </td>
181
      </tr>
182
      <xsl:call-template name="renderParameters">
183
        <xsl:with-param name="disfirstColStyle" select="$disfirstColStyle" />
184
      </xsl:call-template>
185
    </xsl:if>
186
    <xsl:apply-templates select="connectionDefinition">
187
      <xsl:with-param name="disfirstColStyle" select="$disfirstColStyle" />
188
    </xsl:apply-templates>
189
  </xsl:template>
190

    
191
  <xsl:template name="renderParameters">
192
    <xsl:param name="disfirstColStyle"/>
193
    <xsl:for-each select="parameter" >
194
      <tr>
195
        <td class="{$disfirstColStyle}">
196
          <xsl:text>&#160;&#160;&#160;&#160;&#160;</xsl:text><xsl:value-of select="name" />
197
        </td>
198
        <td class="{$secondColStyle}">
199
         <xsl:value-of select="value" />
200
        </td>
201
      </tr>
202
    </xsl:for-each>
203
  </xsl:template>
204

    
205
   <xsl:template match="connectionDefinition">
206
    <xsl:param name="disfirstColStyle"/>
207
    <xsl:choose>
208
      <xsl:when test="references!=''">
209
        <xsl:variable name="ref_id" select="references"/>
210
        <xsl:variable name="references" select="$ids[@id=$ref_id]" />
211
        <xsl:for-each select="$references">
212
          <xsl:call-template name="connectionDefinitionCommon">
213
            <xsl:with-param name="disfirstColStyle" select="$disfirstColStyle"/>
214
          </xsl:call-template>
215
        </xsl:for-each>
216
      </xsl:when>
217
      <xsl:otherwise>
218
        <xsl:call-template name="connectionDefinitionCommon">
219
          <xsl:with-param name="disfirstColStyle" select="$disfirstColStyle"/>
220
        </xsl:call-template>
221
      </xsl:otherwise>
222
    </xsl:choose>
223
   </xsl:template>
224

    
225
   <!-- This template will be shared by both reference and inline connectionDefinition-->
226
   <xsl:template name="connectionDefinitionCommon">
227
    <xsl:param name="disfirstColStyle"/>
228
      <tr>
229
          <td class="{$disfirstColStyle}">
230
            <xsl:text>Schema Name:</xsl:text>
231
          </td>
232
          <td class="{$secondColStyle}">
233
            <xsl:value-of select="schemeName" />
234
          </td>
235
       </tr>
236
       <tr>
237
          <td class="{$disfirstColStyle}">
238
            <xsl:text>Description:</xsl:text>
239
          </td>
240
          <td>
241
           <xsl:apply-templates select="description">
242
              <xsl:with-param name="disfirstColStyle" select="$disfirstColStyle" />
243
            </xsl:apply-templates>
244
          </td>
245
       </tr>
246
       <xsl:for-each select="parameterDefinition">
247
          <xsl:call-template name="renderParameterDefinition">
248
            <xsl:with-param name="disfirstColStyle" select="$disfirstColStyle" />
249
          </xsl:call-template>
250
       </xsl:for-each>
251
   </xsl:template>
252

    
253
   <xsl:template match="description">
254
     <xsl:param name="disfirstColStyle"/>
255
     <xsl:call-template name="text">
256
        <xsl:with-param name="textfirstColStyle" select="$secondColStyle" />
257
     </xsl:call-template>
258
   </xsl:template>
259

    
260
   <xsl:template name="renderParameterDefinition">
261
     <xsl:param name="disfirstColStyle"/>
262
     <tr>
263
        <td class="{$disfirstColStyle}">
264
          <xsl:text>&#160;&#160;&#160;&#160;&#160;</xsl:text><xsl:value-of select="name" /><xsl:text>:</xsl:text>
265
        </td>
266
        <td>
267
          <table class="{$tabledefaultStyle}">
268
            <tr>
269
              <td class="{$disfirstColStyle}">
270
                <xsl:choose>
271
                  <xsl:when test="defaultValue">
272
                    <xsl:value-of select="defaultValue" />
273
                  </xsl:when>
274
                  <xsl:otherwise>
275
                    &#160;
276
                  </xsl:otherwise>
277
                </xsl:choose>
278

    
279
              </td>
280
              <td class="{$secondColStyle}">
281
                <xsl:value-of select="definition" />
282
              </td>
283
            </tr>
284
          </table>
285
        </td>
286
      </tr>
287
   </xsl:template>
288

    
289
  <!-- ********************************************************************* -->
290
  <!-- *******************************  Offline data  ********************** -->
291
  <!-- ********************************************************************* -->
292

    
293
  <xsl:template match="offline">
294
    <xsl:param name="disfirstColStyle"/>
295
    <xsl:param name="dissubHeaderStyle"/>
296
    <tr><td class="{$dissubHeaderStyle}" colspan="2">
297
        <xsl:text>Offline Distribution Info:</xsl:text>
298
    </td></tr>
299
    <xsl:if test="(mediumName) and normalize-space(mediumName)!=''">
300
      <tr><td class="{$disfirstColStyle}"><xsl:text>Medium:</xsl:text></td>
301
      <td class="{$secondColStyle}"><xsl:value-of select="mediumName"/></td></tr>
302
    </xsl:if>
303
    <xsl:if test="(mediumDensity) and normalize-space(mediumDensity)!=''">
304
    <tr><td class="{$disfirstColStyle}"><xsl:text>Medium Density:</xsl:text></td>
305
    <td class="{$secondColStyle}"><xsl:value-of select="mediumDensity"/>
306
    <xsl:if test="(mediumDensityUnits) and normalize-space(mediumDensityUnits)!=''">
307
    <xsl:text> (</xsl:text><xsl:value-of select="mediumDensityUnits"/><xsl:text>)</xsl:text>
308
    </xsl:if>
309
    </td></tr>
310
    </xsl:if>
311
    <xsl:if test="(mediumVol) and normalize-space(mediumVol)!=''">
312
    <tr><td class="{$disfirstColStyle}"><xsl:text>Volume:</xsl:text></td>
313
    <td class="{$secondColStyle}"><xsl:value-of select="mediumVol"/></td></tr>
314
    </xsl:if>
315
    <xsl:if test="(mediumFormat) and normalize-space(mediumFormat)!=''">
316
    <tr><td class="{$disfirstColStyle}"><xsl:text>Format:</xsl:text></td>
317
    <td class="{$secondColStyle}"><xsl:value-of select="mediumFormat"/></td></tr>
318
    </xsl:if>
319
    <xsl:if test="(mediumNote) and normalize-space(mediumNote)!=''">
320
    <tr><td class="{$disfirstColStyle}"><xsl:text>Notes:</xsl:text></td>
321
    <td class="{$secondColStyle}"><xsl:value-of select="mediumNote"/></td></tr>
322
    </xsl:if>
323
  </xsl:template>
324

    
325
  <!-- ********************************************************************* -->
326
  <!-- *******************************  Inline data  *********************** -->
327
  <!-- ********************************************************************* -->
328

    
329

    
330
  <xsl:template match="inline">
331
    <xsl:param name="disfirstColStyle"/>
332
    <xsl:param name="dissubHeaderStyle"/>
333
    <xsl:param name="docid"/>
334
    <xsl:param name="level">entity</xsl:param>
335
    <xsl:param name="entitytype"/>
336
    <xsl:param name="entityindex"/>
337
    <xsl:param name="physicalindex"/>
338
    <xsl:param name="distributionindex"/>
339

    
340
    <tr><td class="{$dissubHeaderStyle}" colspan="2">
341
        <xsl:text>Inline Data:</xsl:text>
342
    </td></tr>
343
    <tr><td class="{$disfirstColStyle}">
344
      <xsl:text>&#160;</xsl:text></td>
345
      <td class="{$secondColStyle}">
346
      <!-- for top top distribution-->
347
      <xsl:if test="$level='toplevel'">
348
        <a><xsl:attribute name="href"><xsl:value-of select="$tripleURI"/><xsl:value-of select="$docid"/>&amp;displaymodule=inlinedata&amp;distributionlevel=<xsl:value-of select="$level"/>&amp;distributionindex=<xsl:value-of select="$distributionindex"/></xsl:attribute>
349
        <b>Inline Data</b></a>
350
      </xsl:if>
351
      <xsl:if test="$level='entitylevel'">
352
        <a><xsl:attribute name="href"><xsl:value-of select="$tripleURI"/><xsl:value-of select="$docid"/>&amp;displaymodule=inlinedata&amp;distributionlevel=<xsl:value-of select="$level"/>&amp;entitytype=<xsl:value-of select="$entitytype"/>&amp;entityindex=<xsl:value-of select="$entityindex"/>&amp;physicalindex=<xsl:value-of select="$physicalindex"/>&amp;distributionindex=<xsl:value-of select="$distributionindex"/></xsl:attribute>
353
        <b>Inline Data</b></a>
354
      </xsl:if>
355
     </td></tr>
356
  </xsl:template>
357

    
358
<!--
359

    
360

    
361
-->
362
    <xsl:template name="data_use_agreement_form">
363
        <xsl:param name="entity_name"/>
364
        <xsl:param name="URL1"/>
365

    
366
         <form action="http://sbcdata.lternet.edu/cgi-bin/data-use-agreement.cgi" method="POST">
367
             <xsl:attribute name="name">
368
                <xsl:value-of select="translate($entity_name,'()-.' ,'')" />
369
             </xsl:attribute>
370
             <input type="hidden" name="qformat" />
371
             <input type="hidden" name="sessionid" />
372
             <input type="hidden" name="url">
373
                 <xsl:attribute name="value">
374
                         <xsl:value-of select="$URL1"/>
375
                 </xsl:attribute>
376
            </input>
377
            <input type="hidden" name="entityName">
378
                 <xsl:attribute name="value">
379
                    <xsl:value-of select="$entity_name"/>
380
                 </xsl:attribute>
381
           </input>
382
           <input type="submit" name="data">
383
               <xsl:attribute name="value">View this object: <xsl:value-of select="$entity_name"/>
384
               </xsl:attribute>
385
           </input>
386

    
387
          <br />
388
         </form>
389
        </xsl:template>
390

    
391

    
392
<!--
393

    
394

    
395

    
396
-->
397

    
398

    
399
</xsl:stylesheet>
(20-20/58)