Project

General

Profile

1
<?xml version="1.0"?>
2
<!--
3
  *  '$RCSfile$'
4
  *      Authors: Matt Jones
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: mecum $'
10
  *     '$Date: 2017-10-06 16:06:42 -0700 (Fri, 06 Oct 2017) $'
11
  * '$Revision: 10422 $'
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-dataset.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-access.xsl"/>
34
  <xsl:import href="eml-additionalmetadata.xsl"/>
35
  <xsl:import href="eml-attribute.xsl"/>
36
  <xsl:import href="eml-attribute-enumeratedDomain.xsl"/>
37
  <xsl:import href="eml-constraint.xsl"/>
38
  <xsl:import href="eml-coverage.xsl"/>
39
  <xsl:import href="eml-dataset.xsl"/>
40
  <xsl:import href="eml-datatable.xsl"/>
41
  <xsl:import href="eml-distribution.xsl"/>
42
  <xsl:import href="eml-entity.xsl"/>
43
  <xsl:import href="eml-identifier.xsl"/>
44
  <xsl:import href="eml-literature.xsl"/>
45
  <xsl:import href="eml-method.xsl"/>
46
  <xsl:import href="eml-otherentity.xsl"/>
47
  <xsl:import href="eml-party.xsl"/>
48
  <xsl:import href="eml-physical.xsl"/>
49
  <xsl:import href="eml-project.xsl"/>
50
  <xsl:import href="eml-protocol.xsl"/>
51
  <xsl:import href="eml-resource.xsl"/>
52
  <xsl:import href="eml-settings.xsl"/>
53
  <xsl:import href="eml-software.xsl"/>
54
  <xsl:import href="eml-spatialraster.xsl"/>
55
  <xsl:import href="eml-spatialvector.xsl"/>
56
  <xsl:import href="eml-storedprocedure.xsl"/>
57
  <xsl:import href="eml-text.xsl"/>
58
  <xsl:import href="eml-view.xsl"/>
59

    
60
  <!-- global variables to store id node set in case to be referenced-->
61
  <xsl:variable name="ids" select="//*[@id!='']"/>
62

    
63
   <xsl:template match="*[local-name()='eml']">
64
   	<form class="form-horizontal">
65
   	
66
     <xsl:for-each select="dataset">
67
       <xsl:call-template name="emldataset"/>
68
     </xsl:for-each>
69
     <xsl:for-each select="citation">
70
       <xsl:call-template name="emlcitation"/>
71
     </xsl:for-each>
72
     <xsl:for-each select="software">
73
       <xsl:call-template name="emlsoftware"/>
74
     </xsl:for-each>
75
     <xsl:for-each select="protocol">
76
       <xsl:call-template name="emlprotocol"/>
77
     </xsl:for-each>
78
     <xsl:for-each select="access">
79
		<xsl:call-template name="topaccess"/>
80
	 </xsl:for-each>
81
     <!-- Additional metadata-->
82
     <xsl:choose>
83
       <xsl:when test="$displaymodule='additionalmetadata' or $displaymodule='printall'">
84
         <xsl:for-each select="additionalMetadata">
85
           <xsl:if test="$additionalmetadataindex=position()">
86
                 <xsl:call-template name="additionalmetadatapart"/>
87
            </xsl:if>
88
         </xsl:for-each>
89
       </xsl:when>
90
       <xsl:otherwise>
91
         <xsl:if test="$displaymodule='dataset' or $displaymodule='printall'">
92
           <xsl:if test="$withAdditionalMetadataLink='1'">
93
             <xsl:for-each select="additionalMetadata">
94
               <div class="{$tabledefaultStyle}">
95
                 <xsl:call-template name="additionalmetadataURL">
96
                    <xsl:with-param name="index" select="position()"/>
97
                  </xsl:call-template>
98
               </div>
99
             </xsl:for-each>
100
           </xsl:if>
101
         </xsl:if>
102
       </xsl:otherwise>
103
     </xsl:choose>
104
     <!-- xml format-->
105
     <xsl:if test="$displaymodule='dataset'">
106
       <xsl:if test="$withOriginalXMLLink='1'">
107
		<xsl:call-template name="xml"/>			         
108
       </xsl:if>
109
     </xsl:if>
110
     
111
     </form>
112
   </xsl:template>
113

    
114
   <!--********************************************************
115
                       dataset part
116
       ********************************************************-->
117

    
118
   <xsl:template name="emldataset">
119
    <xsl:if test="$displaymodule='dataset'">
120
    	<div>
121
			<xsl:call-template name="datasetpart"/>
122
		</div>	
123
    </xsl:if>
124
    <xsl:if test="$displaymodule='entity'">
125
       <xsl:call-template name="entitypart"/>
126
    </xsl:if>
127
    <xsl:if test="$displaymodule='attribute'">
128
       <xsl:call-template name="attributepart"/>
129
    </xsl:if>
130
    <xsl:if test="$displaymodule='attributedomain'">
131
       <xsl:call-template name="datasetattributedomain"/>
132
    </xsl:if>
133
    <xsl:if test="$displaymodule='attributecoverage'">
134
       <xsl:call-template name="datasetattributecoverage"/>
135
    </xsl:if>
136
    <xsl:if test="$displaymodule='attributemethod'">
137
       <xsl:call-template name="datasetattributemethod"/>
138
    </xsl:if>
139
    <xsl:if test="$displaymodule='inlinedata'">
140
       <xsl:call-template name="emlinlinedata"/>
141
    </xsl:if>
142
    <xsl:if test="$displaymodule='attributedetail'">
143
       <xsl:call-template name="entityparam"/>
144
    </xsl:if>
145
    <xsl:if test="$displaymodule='printall'">
146
		<xsl:call-template name="printalltemplate"/>
147
	</xsl:if>
148
   </xsl:template>
149

    
150
   <!--*************** Data set diaplay *************-->
151
   <xsl:template name="datasetpart">
152
       <xsl:apply-templates select="." mode="dataset"/>
153
   </xsl:template>
154

    
155
   <!--************ Entity diplay *****************-->
156
   <xsl:template name="entitypart">
157
       <xsl:choose>
158
         <xsl:when test="references!=''">
159
            <xsl:variable name="ref_id" select="references"/>
160
            <xsl:variable name="references" select="$ids[@id=$ref_id]" />
161
            <xsl:for-each select="$references">
162
               <xsl:call-template name="entitypartcommon"/>
163
            </xsl:for-each>
164
         </xsl:when>
165
         <xsl:otherwise>
166
            <xsl:call-template name="entitypartcommon"/>
167
        </xsl:otherwise>
168
   </xsl:choose>
169
    </xsl:template>
170

    
171

    
172
    <xsl:template name="entitypartcommon">
173
      <h4>Data Object Details</h4>
174
      
175
      <div class="row-fluid">
176
		<!-- find the subtree to process -->
177
		<xsl:call-template name="entityparam"/>
178
      </div>
179
   </xsl:template>
180

    
181
   <!--************ Attribute display *****************-->
182
   <xsl:template name="attributedetailpart">
183
   </xsl:template>
184

    
185
    <xsl:template name="attributepart">
186
      <h3>Attributes Description</h3>
187
        <!-- find the subtree to process -->
188
      <xsl:if test="$entitytype='dataTable'">
189
        <xsl:for-each select="dataTable">
190
            <xsl:if test="position()=$entityindex">
191
                <xsl:for-each select="attributeList">
192
                   <xsl:call-template name="attributelist">
193
                      <xsl:with-param name="docid" select="$docid"/>
194
                      <xsl:with-param name="entitytype" select="$entitytype"/>
195
                      <xsl:with-param name="entityindex" select="$entityindex"/>
196
                   </xsl:call-template>
197
                </xsl:for-each>
198
            </xsl:if>
199
        </xsl:for-each>
200
      </xsl:if>
201
   </xsl:template>
202

    
203
   <!--************************Attribute Domain display module************************-->
204
   <xsl:template name="datasetattributedomain">
205
   		<h3>Attribute Domain</h3>
206
		<!-- find the subtree to process -->
207
		<xsl:call-template name="entityparam"/>
208
   </xsl:template>
209

    
210

    
211
   <!--************************Attribute Method display module************************-->
212
   <xsl:template name="datasetattributemethod">
213
		<h3>Attribute Method</h3>
214
		<!-- find the subtree to process -->
215
		<xsl:call-template name="entityparam"/>
216
   </xsl:template>
217

    
218

    
219
   <!--************************Attribute Coverage display module************************-->
220
   <xsl:template name="datasetattributecoverage">
221
		<h3>Attribute Coverage</h3>
222
		<!-- find the subtree to process -->
223
		<xsl:call-template name="entityparam"/>
224
   </xsl:template>
225

    
226
   <!--************************Print all display module************************-->
227
   <xsl:template name="printalltemplate">
228
		<!-- find the subtree to process -->
229
		<xsl:call-template name="datasetpart"/>
230
   </xsl:template>
231

    
232
   <xsl:template name="entityparam">
233
     <xsl:choose>
234
      <xsl:when test="$entitytype=''">
235
        <xsl:for-each select="dataTable|spatialRaster|spatialVector|storedProcedure|view|otherEntity">
236

    
237
        <xsl:if test="'dataTable' = name()">
238
           <xsl:variable name="currentNode" select="."/>
239
           <xsl:variable name="dataTableCount">
240
            <xsl:for-each select="../dataTable">
241
                  <xsl:if test=". = $currentNode">
242
                <xsl:value-of select="position()"/>
243
              </xsl:if>
244
            </xsl:for-each>
245
           </xsl:variable>
246
           <xsl:if test="position() = $entityindex">
247
             <xsl:choose>
248
               <xsl:when test="$displaymodule='attributedetail'">
249
                 <xsl:for-each select="attributeList">
250
                   <xsl:call-template name="singleattribute">
251
                    <xsl:with-param name="attributeindex" select="$attributeindex"/>
252
                    <xsl:with-param name="docid" select="$docid"/>
253
                    <xsl:with-param name="entitytype" select="'dataTable'"/>
254
                    <xsl:with-param name="entityindex" select="$dataTableCount"/>
255
                   </xsl:call-template>
256
                 </xsl:for-each>
257
               </xsl:when>
258
               <xsl:otherwise>
259
                 <xsl:for-each select="../.">
260
                   <xsl:call-template name="chooseentity">
261
                    <xsl:with-param name="entitytype" select="'dataTable'"/>
262
                    <xsl:with-param name="entityindex" select="$dataTableCount"/>
263
                   </xsl:call-template>
264
                  </xsl:for-each>
265
                  </xsl:otherwise>
266
                 </xsl:choose>
267
           </xsl:if>
268
        </xsl:if>
269

    
270
        <xsl:if test="'spatialRaster' = name()">
271
          <xsl:variable name="currentNode" select="."/>
272
           <xsl:variable name="spatialRasterCount">
273
            <xsl:for-each select="../spatialRaster">
274
                  <xsl:if test=". = $currentNode">
275
                <xsl:value-of select="position()"/>
276
              </xsl:if>
277
            </xsl:for-each>
278
           </xsl:variable>
279
            <xsl:if test="position() = $entityindex">
280
           <xsl:choose>
281
               <xsl:when test="$displaymodule='attributedetail'">
282
                 <xsl:for-each select="attributeList">
283
                   <xsl:call-template name="singleattribute">
284
                    <xsl:with-param name="attributeindex" select="$attributeindex"/>
285
                    <xsl:with-param name="docid" select="$docid"/>
286
                    <xsl:with-param name="entitytype" select="'spatialRaster'"/>
287
                    <xsl:with-param name="entityindex" select="$spatialRasterCount"/>
288
                   </xsl:call-template>
289
                 </xsl:for-each>
290
               </xsl:when>
291
               <xsl:otherwise>
292
                 <xsl:for-each select="../.">
293
                   <xsl:call-template name="chooseentity">
294
                    <xsl:with-param name="entitytype" select="'spatialRaster'"/>
295
                    <xsl:with-param name="entityindex" select="$spatialRasterCount"/>
296
                   </xsl:call-template>
297
                  </xsl:for-each>
298
                  </xsl:otherwise>
299
                 </xsl:choose>
300
            </xsl:if>
301
        </xsl:if>
302

    
303
        <xsl:if test="'spatialVector' = name()">
304
          <xsl:variable name="currentNode" select="."/>
305
           <xsl:variable name="spatialVectorCount">
306
            <xsl:for-each select="../spatialVector">
307
                  <xsl:if test=". = $currentNode">
308
                <xsl:value-of select="position()"/>
309
              </xsl:if>
310
            </xsl:for-each>
311
           </xsl:variable>
312
           <xsl:if test="position() = $entityindex">
313
             <xsl:choose>
314
               <xsl:when test="$displaymodule='attributedetail'">
315
                 <xsl:for-each select="attributeList">
316
                   <xsl:call-template name="singleattribute">
317
                    <xsl:with-param name="attributeindex" select="$attributeindex"/>
318
                    <xsl:with-param name="docid" select="$docid"/>
319
                    <xsl:with-param name="entitytype" select="'spatialVector'"/>
320
                    <xsl:with-param name="entityindex" select="$spatialVectorCount"/>
321
                   </xsl:call-template>
322
                 </xsl:for-each>
323
               </xsl:when>
324
               <xsl:otherwise>
325
                 <xsl:for-each select="../.">
326
                   <xsl:call-template name="chooseentity">
327
                    <xsl:with-param name="entitytype" select="'spatialVector'"/>
328
                    <xsl:with-param name="entityindex" select="$spatialVectorCount"/>
329
                   </xsl:call-template>
330
                  </xsl:for-each>
331
                  </xsl:otherwise>
332
                 </xsl:choose>
333
           </xsl:if>
334
        </xsl:if>
335

    
336
        <xsl:if test="'storedProcedure' = name()">
337
          <xsl:variable name="currentNode" select="."/>
338
           <xsl:variable name="storedProcedureCount">
339
            <xsl:for-each select="../storedProcedure">
340
                  <xsl:if test=". = $currentNode">
341
                <xsl:value-of select="position()"/>
342
              </xsl:if>
343
            </xsl:for-each>
344
           </xsl:variable>
345
           <xsl:if test="position() = $entityindex">
346
             <xsl:choose>
347
               <xsl:when test="$displaymodule='attributedetail'">
348
                 <xsl:for-each select="attributeList">
349
                   <xsl:call-template name="singleattribute">
350
                    <xsl:with-param name="attributeindex" select="$attributeindex"/>
351
                    <xsl:with-param name="docid" select="$docid"/>
352
                    <xsl:with-param name="entitytype" select="'storedProcedure'"/>
353
                    <xsl:with-param name="entityindex" select="$storedProcedureCount"/>
354
                   </xsl:call-template>
355
                 </xsl:for-each>
356
               </xsl:when>
357
               <xsl:otherwise>
358
                 <xsl:for-each select="../.">
359
                   <xsl:call-template name="chooseentity">
360
                    <xsl:with-param name="entitytype" select="'storedProcedure'"/>
361
                    <xsl:with-param name="entityindex" select="$storedProcedureCount"/>
362
                   </xsl:call-template>
363
                  </xsl:for-each>
364
                  </xsl:otherwise>
365
              </xsl:choose>
366
           </xsl:if>
367
        </xsl:if>
368

    
369
        <xsl:if test="'view' = name()">
370
          <xsl:variable name="currentNode" select="."/>
371
           <xsl:variable name="viewCount">
372
            <xsl:for-each select="../view">
373
                  <xsl:if test=". = $currentNode">
374
                <xsl:value-of select="position()"/>
375
              </xsl:if>
376
            </xsl:for-each>
377
           </xsl:variable>
378
           <xsl:if test="position() = $entityindex">
379
            <xsl:choose>
380
               <xsl:when test="$displaymodule='attributedetail'">
381
                 <xsl:for-each select="attributeList">
382
                   <xsl:call-template name="singleattribute">
383
                    <xsl:with-param name="attributeindex" select="$attributeindex"/>
384
                    <xsl:with-param name="docid" select="$docid"/>
385
                    <xsl:with-param name="entitytype" select="'view'"/>
386
                    <xsl:with-param name="entityindex" select="$viewCount"/>
387
                   </xsl:call-template>
388
                 </xsl:for-each>
389
               </xsl:when>
390
               <xsl:otherwise>
391
                 <xsl:for-each select="../.">
392
                   <xsl:call-template name="chooseentity">
393
                    <xsl:with-param name="entitytype" select="'view'"/>
394
                    <xsl:with-param name="entityindex" select="$viewCount"/>
395
                   </xsl:call-template>
396
                  </xsl:for-each>
397
                  </xsl:otherwise>
398
                 </xsl:choose>
399
            </xsl:if>
400
        </xsl:if>
401

    
402
        <xsl:if test="'otherEntityTable' = name()">
403
          <xsl:variable name="currentNode" select="."/>
404
           <xsl:variable name="otherEntityCount">
405
            <xsl:for-each select="../otherEntity">
406
                  <xsl:if test=". = $currentNode">
407
                <xsl:value-of select="position()"/>
408
              </xsl:if>
409
            </xsl:for-each>
410
           </xsl:variable>
411
           <xsl:if test="position() = $entityindex">
412
            <xsl:choose>
413
               <xsl:when test="$displaymodule='attributedetail'">
414
                 <xsl:for-each select="attributeList">
415
                   <xsl:call-template name="singleattribute">
416
                    <xsl:with-param name="attributeindex" select="$attributeindex"/>
417
                    <xsl:with-param name="docid" select="$docid"/>
418
                    <xsl:with-param name="entitytype" select="'otherEntity'"/>
419
                    <xsl:with-param name="entityindex" select="$otherEntityCount"/>
420
                   </xsl:call-template>
421
                 </xsl:for-each>
422
               </xsl:when>
423
               <xsl:otherwise>
424
                 <xsl:for-each select="../.">
425
                   <xsl:call-template name="chooseentity">
426
                    <xsl:with-param name="entitytype" select="'otherEntity'"/>
427
                    <xsl:with-param name="entityindex" select="$otherEntityCount"/>
428
                   </xsl:call-template>
429
                  </xsl:for-each>
430
                  </xsl:otherwise>
431
                 </xsl:choose>
432
             </xsl:if>
433
          </xsl:if>
434
        </xsl:for-each>
435
      </xsl:when>
436
      <xsl:otherwise>
437
  <xsl:choose>
438
     <xsl:when test="$displaymodule='attributedetail'">
439
      <xsl:for-each select="attributeList">
440
       <xsl:call-template name="singleattribute">
441
         <xsl:with-param name="attributeindex" select="$attributeindex"/>
442
         <xsl:with-param name="docid" select="$docid"/>
443
         <xsl:with-param name="entitytype" select="$entitytype"/>
444
         <xsl:with-param name="entityindex" select="$entityindex"/>
445
       </xsl:call-template>
446
      </xsl:for-each>
447
     </xsl:when>
448
     <xsl:otherwise>
449
       <xsl:call-template name="chooseentity">
450
         <xsl:with-param name="entitytype" select="$entitytype"/>
451
         <xsl:with-param name="entityindex" select="$entityindex"/>
452
       </xsl:call-template>
453
     </xsl:otherwise>
454
    </xsl:choose>
455
       </xsl:otherwise>
456
     </xsl:choose>
457
   </xsl:template>
458

    
459

    
460
   <xsl:template name="chooseentity" match='dataset'>
461
      <xsl:param name="entityindex"/>
462
      <xsl:param name="entitytype"/>
463
     <xsl:if test="$entitytype='dataTable'">
464
        <xsl:for-each select="dataTable">
465
            <xsl:if test="position()=$entityindex">
466
                   <xsl:choose>
467
                     <xsl:when test="references!=''">
468
                        <xsl:variable name="ref_id" select="references"/>
469
                        <xsl:variable name="references" select="$ids[@id=$ref_id]" />
470
                          <xsl:for-each select="$references">
471
                              <xsl:choose>
472
                                 <xsl:when test="$displaymodule='entity' or $displaymodule='printall'">
473
                                    <xsl:call-template name="dataTable">
474
                                        <xsl:with-param name="datatablefirstColStyle" select="$firstColStyle"/>
475
                                        <xsl:with-param name="datatablesubHeaderStyle" select="$subHeaderStyle"/>
476
                                        <xsl:with-param name="docid" select="$docid"/>
477
                                        <xsl:with-param name="entitytype" select="$entitytype"/>
478
                                        <xsl:with-param name="entityindex" select="$entityindex"/>
479
                                    </xsl:call-template>
480
                                 </xsl:when>
481
                                 <xsl:otherwise>
482
                                    <xsl:call-template name="chooseattributelist"/>
483
                                 </xsl:otherwise>
484
                              </xsl:choose>
485
                          </xsl:for-each>
486
                     </xsl:when>
487
                     <xsl:otherwise>
488
                       <xsl:choose>
489
                                 <xsl:when test="$displaymodule='entity' or $displaymodule='printall'">
490
                                    <xsl:call-template name="dataTable">
491
                                        <xsl:with-param name="datatablefirstColStyle" select="$firstColStyle"/>
492
                                        <xsl:with-param name="datatablesubHeaderStyle" select="$subHeaderStyle"/>
493
                                        <xsl:with-param name="docid" select="$docid"/>
494
                                        <xsl:with-param name="entitytype" select="$entitytype"/>
495
                                        <xsl:with-param name="entityindex" select="$entityindex"/>
496
                                    </xsl:call-template>
497
                                 </xsl:when>
498
                                 <xsl:otherwise>
499
                                    <xsl:call-template name="chooseattributelist"/>
500
                                 </xsl:otherwise>
501
                       </xsl:choose>
502
                   </xsl:otherwise>
503
                </xsl:choose>
504
            </xsl:if>
505
        </xsl:for-each>
506
      </xsl:if>
507
      <xsl:if test="$entitytype='spatialRaster'">
508
        <xsl:for-each select="spatialRaster">
509
            <xsl:if test="position()=$entityindex">
510
                   <xsl:choose>
511
                     <xsl:when test="references!=''">
512
                        <xsl:variable name="ref_id" select="references"/>
513
                        <xsl:variable name="references" select="$ids[@id=$ref_id]" />
514
                          <xsl:for-each select="$references">
515
                              <xsl:choose>
516
                                 <xsl:when test="$displaymodule='entity' or $displaymodule='printall'">
517
                                    <xsl:call-template name="spatialRaster">
518
                                        <xsl:with-param name="spatialrasterfirstColStyle" select="$firstColStyle"/>
519
                                        <xsl:with-param name="spatialrastersubHeaderStyle" select="$subHeaderStyle"/>
520
                                        <xsl:with-param name="docid" select="$docid"/>
521
                                        <xsl:with-param name="entitytype" select="$entitytype"/>
522
                                        <xsl:with-param name="entityindex" select="$entityindex"/>
523
                                    </xsl:call-template>
524
                                 </xsl:when>
525
                                 <xsl:otherwise>
526
                                    <xsl:call-template name="chooseattributelist"/>
527
                                 </xsl:otherwise>
528
                              </xsl:choose>
529
                          </xsl:for-each>
530
                     </xsl:when>
531
                     <xsl:otherwise>
532
                       <xsl:choose>
533
                                 <xsl:when test="$displaymodule='entity' or $displaymodule='printall'">
534
                                    <xsl:call-template name="spatialRaster">
535
                                        <xsl:with-param name="spatialrasterfirstColStyle" select="$firstColStyle"/>
536
                                        <xsl:with-param name="spatialrastersubHeaderStyle" select="$subHeaderStyle"/>
537
                                        <xsl:with-param name="docid" select="$docid"/>
538
                                        <xsl:with-param name="entitytype" select="$entitytype"/>
539
                                        <xsl:with-param name="entityindex" select="$entityindex"/>
540
                                    </xsl:call-template>
541
                                 </xsl:when>
542
                                 <xsl:otherwise>
543
                                    <xsl:call-template name="chooseattributelist"/>
544
                                 </xsl:otherwise>
545
                       </xsl:choose>
546
                   </xsl:otherwise>
547
                </xsl:choose>
548
            </xsl:if>
549
        </xsl:for-each>
550
      </xsl:if>
551
      <xsl:if test="$entitytype='spatialVector'">
552
        <xsl:for-each select="spatialVector">
553
            <xsl:if test="position()=$entityindex">
554
                   <xsl:choose>
555
                     <xsl:when test="references!=''">
556
                        <xsl:variable name="ref_id" select="references"/>
557
                        <xsl:variable name="references" select="$ids[@id=$ref_id]" />
558
                          <xsl:for-each select="$references">
559
                              <xsl:choose>
560
                                 <xsl:when test="$displaymodule='entity' or $displaymodule='printall'">
561
                                    <xsl:call-template name="spatialVector">
562
                                       <xsl:with-param name="spatialvectorfirstColStyle" select="$firstColStyle"/>
563
                                        <xsl:with-param name="spatialvectorsubHeaderStyle" select="$subHeaderStyle"/>
564
                                        <xsl:with-param name="docid" select="$docid"/>
565
                                        <xsl:with-param name="entitytype" select="$entitytype"/>
566
                                        <xsl:with-param name="entityindex" select="$entityindex"/>
567
                                    </xsl:call-template>
568
                                 </xsl:when>
569
                                 <xsl:otherwise>
570
                                    <xsl:call-template name="chooseattributelist"/>
571
                                 </xsl:otherwise>
572
                              </xsl:choose>
573
                          </xsl:for-each>
574
                     </xsl:when>
575
                     <xsl:otherwise>
576
                       <xsl:choose>
577
                                 <xsl:when test="$displaymodule='entity' or $displaymodule='printall'">
578
                                    <xsl:call-template name="spatialVector">
579
                                        <xsl:with-param name="spatialvectorfirstColStyle" select="$firstColStyle"/>
580
                                        <xsl:with-param name="spatialvectorsubHeaderStyle" select="$subHeaderStyle"/>
581
                                        <xsl:with-param name="docid" select="$docid"/>
582
                                        <xsl:with-param name="entitytype" select="$entitytype"/>
583
                                        <xsl:with-param name="entityindex" select="$entityindex"/>
584
                                    </xsl:call-template>
585
                                 </xsl:when>
586
                                 <xsl:otherwise>
587
                                    <xsl:call-template name="chooseattributelist"/>
588
                                 </xsl:otherwise>
589
                       </xsl:choose>
590
                   </xsl:otherwise>
591
                </xsl:choose>
592
            </xsl:if>
593
        </xsl:for-each>
594
      </xsl:if>
595
      <xsl:if test="$entitytype='storedProcedure'">
596
        <xsl:for-each select="storedProcedure">
597
            <xsl:if test="position()=$entityindex">
598
                   <xsl:choose>
599
                     <xsl:when test="references!=''">
600
                        <xsl:variable name="ref_id" select="references"/>
601
                        <xsl:variable name="references" select="$ids[@id=$ref_id]" />
602
                          <xsl:for-each select="$references">
603
                              <xsl:choose>
604
                                 <xsl:when test="$displaymodule='entity' or $displaymodule='printall'">
605
                                    <xsl:call-template name="storedProcedure">
606
                                       <xsl:with-param name="storedprocedurefirstColStyle" select="$firstColStyle"/>
607
                                       <xsl:with-param name="storedproceduresubHeaderStyle" select="$subHeaderStyle"/>
608
                                       <xsl:with-param name="docid" select="$docid"/>
609
                                       <xsl:with-param name="entitytype" select="$entitytype"/>
610
                                       <xsl:with-param name="entityindex" select="$entityindex"/>
611
                                    </xsl:call-template>
612
                                 </xsl:when>
613
                                 <xsl:otherwise>
614
                                    <xsl:call-template name="chooseattributelist"/>
615
                                 </xsl:otherwise>
616
                              </xsl:choose>
617
                          </xsl:for-each>
618
                     </xsl:when>
619
                     <xsl:otherwise>
620
                       <xsl:choose>
621
                                 <xsl:when test="$displaymodule='entity' or $displaymodule='printall'">
622
                                    <xsl:call-template name="storedProcedure">
623
                                       <xsl:with-param name="storedprocedurefirstColStyle" select="$firstColStyle"/>
624
                                       <xsl:with-param name="storedproceduresubHeaderStyle" select="$subHeaderStyle"/>
625
                                       <xsl:with-param name="docid" select="$docid"/>
626
                                       <xsl:with-param name="entitytype" select="$entitytype"/>
627
                                       <xsl:with-param name="entityindex" select="$entityindex"/>
628
                                    </xsl:call-template>
629
                                 </xsl:when>
630
                                 <xsl:otherwise>
631
                                    <xsl:call-template name="chooseattributelist"/>
632
                                 </xsl:otherwise>
633
                       </xsl:choose>
634
                   </xsl:otherwise>
635
                </xsl:choose>
636
            </xsl:if>
637
        </xsl:for-each>
638
      </xsl:if>
639
      <xsl:if test="$entitytype='view'">
640
        <xsl:for-each select="view">
641
            <xsl:if test="position()=$entityindex">
642
                   <xsl:choose>
643
                     <xsl:when test="references!=''">
644
                        <xsl:variable name="ref_id" select="references"/>
645
                        <xsl:variable name="references" select="$ids[@id=$ref_id]" />
646
                          <xsl:for-each select="$references">
647
                              <xsl:choose>
648
                                 <xsl:when test="$displaymodule='entity' or $displaymodule='printall'">
649
                                    <xsl:call-template name="view">
650
                                       <xsl:with-param name="viewfirstColStyle" select="$firstColStyle"/>
651
                                       <xsl:with-param name="viewsubHeaderStyle" select="$subHeaderStyle"/>
652
                                       <xsl:with-param name="docid" select="$docid"/>
653
                                       <xsl:with-param name="entitytype" select="$entitytype"/>
654
                                       <xsl:with-param name="entityindex" select="$entityindex"/>
655
                                    </xsl:call-template>
656
                                 </xsl:when>
657
                                 <xsl:otherwise>
658
                                    <xsl:call-template name="chooseattributelist"/>
659
                                 </xsl:otherwise>
660
                              </xsl:choose>
661
                          </xsl:for-each>
662
                     </xsl:when>
663
                     <xsl:otherwise>
664
                       <xsl:choose>
665
                                 <xsl:when test="$displaymodule='entity' or $displaymodule='printall'">
666
                                    <xsl:call-template name="view">
667
                                       <xsl:with-param name="viewfirstColStyle" select="$firstColStyle"/>
668
                                       <xsl:with-param name="viewsubHeaderStyle" select="$subHeaderStyle"/>
669
                                       <xsl:with-param name="docid" select="$docid"/>
670
                                       <xsl:with-param name="entitytype" select="$entitytype"/>
671
                                       <xsl:with-param name="entityindex" select="$entityindex"/>
672
                                    </xsl:call-template>
673
                                 </xsl:when>
674
                                 <xsl:otherwise>
675
                                    <xsl:call-template name="chooseattributelist"/>
676
                                 </xsl:otherwise>
677
                       </xsl:choose>
678
                   </xsl:otherwise>
679
                </xsl:choose>
680
            </xsl:if>
681
        </xsl:for-each>
682
      </xsl:if>
683
      <xsl:if test="$entitytype='otherEntity'">
684
        <xsl:for-each select="otherEntity">
685
            <xsl:if test="position()=$entityindex">
686
                   <xsl:choose>
687
                     <xsl:when test="references!=''">
688
                        <xsl:variable name="ref_id" select="references"/>
689
                        <xsl:variable name="references" select="$ids[@id=$ref_id]" />
690
                          <xsl:for-each select="$references">
691
                              <xsl:choose>
692
                                 <xsl:when test="$displaymodule='entity' or $displaymodule='printall'">
693
                                    <xsl:call-template name="otherEntity">
694
                                       <xsl:with-param name="otherentityfirstColStyle" select="$firstColStyle"/>
695
                                       <xsl:with-param name="otherentitysubHeaderStyle" select="$subHeaderStyle"/>
696
                                       <xsl:with-param name="docid" select="$docid"/>
697
                                       <xsl:with-param name="entitytype" select="$entitytype"/>
698
                                       <xsl:with-param name="entityindex" select="$entityindex"/>
699
                                    </xsl:call-template>
700
                                 </xsl:when>
701
                                 <xsl:otherwise>
702
                                    <xsl:call-template name="chooseattributelist"/>
703
                                 </xsl:otherwise>
704
                              </xsl:choose>
705
                          </xsl:for-each>
706
                     </xsl:when>
707
                     <xsl:otherwise>
708
                       <xsl:choose>
709
                                 <xsl:when test="$displaymodule='entity' or $displaymodule='printall'">
710
                                    <xsl:call-template name="otherEntity">
711
                                       <xsl:with-param name="otherentityfirstColStyle" select="$firstColStyle"/>
712
                                       <xsl:with-param name="otherentitysubHeaderStyle" select="$subHeaderStyle"/>
713
                                       <xsl:with-param name="docid" select="$docid"/>
714
                                       <xsl:with-param name="entitytype" select="$entitytype"/>
715
                                       <xsl:with-param name="entityindex" select="$entityindex"/>
716
                                    </xsl:call-template>
717
                                 </xsl:when>
718
                                 <xsl:otherwise>
719
                                    <xsl:call-template name="chooseattributelist"/>
720
                                 </xsl:otherwise>
721
                       </xsl:choose>
722
                   </xsl:otherwise>
723
                </xsl:choose>
724
            </xsl:if>
725
        </xsl:for-each>
726
      </xsl:if>
727
   </xsl:template>
728

    
729
   <xsl:template name="chooseattributelist">
730
       <xsl:for-each select="attributeList">
731
    <xsl:choose>
732
         <xsl:when test="references!=''">
733
            <xsl:variable name="ref_id" select="references"/>
734
            <xsl:variable name="references" select="$ids[@id=$ref_id]" />
735
            <xsl:for-each select="$references">
736
               <xsl:call-template name="chooseattribute"/>
737
           </xsl:for-each>
738
         </xsl:when>
739
         <xsl:otherwise>
740
             <xsl:call-template name="chooseattribute"/>
741
        </xsl:otherwise>
742
   </xsl:choose>
743
      </xsl:for-each>
744
   </xsl:template>
745

    
746
   <xsl:template name="chooseattribute">
747
       <xsl:for-each select="attribute">
748
    <xsl:if test="position()=$attributeindex">
749
      <xsl:if test="$displaymodule='attributedomain'">
750
        <xsl:for-each select="measurementScale/*/*">
751
          <xsl:call-template name="nonNumericDomain">
752
              <xsl:with-param name="nondomainfirstColStyle" select="$firstColStyle"/>
753
           </xsl:call-template>
754
        </xsl:for-each>
755
     </xsl:if>
756
     <xsl:if test="$displaymodule='attributecoverage'">
757
        <xsl:for-each select="coverage">
758
          <xsl:call-template name="coverage">
759
          </xsl:call-template>
760
        </xsl:for-each>
761
     </xsl:if>
762
     <xsl:if test="$displaymodule='attributemethod'">
763
        <xsl:for-each select="method">
764
          <xsl:call-template name="method">
765
              <xsl:with-param name="methodfirstColStyle" select="$firstColStyle"/>
766
              <xsl:with-param name="methodsubHeaderStyle" select="$firstColStyle"/>
767
           </xsl:call-template>
768
        </xsl:for-each>
769
     </xsl:if>
770
   </xsl:if>
771
       </xsl:for-each>
772
   </xsl:template>
773

    
774

    
775

    
776
   <!--*************************Distribution Inline Data display module*****************-->
777
   <xsl:template name="emlinlinedata">
778
      <h3>Inline Data</h3>
779
      <xsl:if test="$distributionlevel='toplevel'">
780
         <xsl:for-each select="distribution">
781
            <xsl:if test="position()=$distributionindex">
782
               <xsl:choose>
783
                 <xsl:when test="references!=''">
784
                    <xsl:variable name="ref_id1" select="references"/>
785
                    <xsl:variable name="references1" select="$ids[@id=$ref_id1]" />
786
                    <xsl:for-each select="$references1">
787
                        <xsl:for-each select="inline">
788
                            <xsl:value-of select="."/>
789
                        </xsl:for-each>
790
                    </xsl:for-each>
791
                 </xsl:when>
792
                 <xsl:otherwise>
793
                     <xsl:for-each select="inline">
794
                            <xsl:value-of select="."/>
795
                     </xsl:for-each>
796
                 </xsl:otherwise>
797
               </xsl:choose>
798
            </xsl:if>
799
         </xsl:for-each>
800
      </xsl:if>
801
      <xsl:if test="$distributionlevel='entitylevel'">
802
        <xsl:if test="$entitytype='dataTable'">
803
          <xsl:for-each select="dataTable">
804
            <xsl:if test="position()=$entityindex">
805
                <xsl:choose>
806
                 <xsl:when test="references!=''">
807
                    <xsl:variable name="ref_id2" select="references"/>
808
                    <xsl:variable name="references2" select="$ids[@id=$ref_id2]" />
809
                    <xsl:for-each select="$references2">
810
                       <xsl:call-template name="choosephysical"/>
811
                    </xsl:for-each>
812
                 </xsl:when>
813
                 <xsl:otherwise>
814
                     <xsl:call-template name="choosephysical"/>
815
                 </xsl:otherwise>
816
               </xsl:choose>
817
            </xsl:if>
818
          </xsl:for-each>
819
        </xsl:if>
820
        <xsl:if test="$entitytype='spatialRaster'">
821
          <xsl:for-each select="spatialRaster">
822
            <xsl:if test="position()=$entityindex">
823
                <xsl:choose>
824
                 <xsl:when test="references!=''">
825
                    <xsl:variable name="ref_id2" select="references"/>
826
                    <xsl:variable name="references2" select="$ids[@id=$ref_id2]" />
827
                    <xsl:for-each select="$references2">
828
                       <xsl:call-template name="choosephysical"/>
829
                    </xsl:for-each>
830
                 </xsl:when>
831
                 <xsl:otherwise>
832
                     <xsl:call-template name="choosephysical"/>
833
                 </xsl:otherwise>
834
               </xsl:choose>
835
            </xsl:if>
836
          </xsl:for-each>
837
        </xsl:if>
838
        <xsl:if test="$entitytype='spatialVector'">
839
          <xsl:for-each select="spatialVector">
840
            <xsl:if test="position()=$entityindex">
841
                <xsl:choose>
842
                 <xsl:when test="references!=''">
843
                    <xsl:variable name="ref_id2" select="references"/>
844
                    <xsl:variable name="references2" select="$ids[@id=$ref_id2]" />
845
                    <xsl:for-each select="$references2">
846
                       <xsl:call-template name="choosephysical"/>
847
                    </xsl:for-each>
848
                 </xsl:when>
849
                 <xsl:otherwise>
850
                     <xsl:call-template name="choosephysical"/>
851
                 </xsl:otherwise>
852
               </xsl:choose>
853
            </xsl:if>
854
          </xsl:for-each>
855
        </xsl:if>
856
        <xsl:if test="$entitytype='storedProcedure'">
857
          <xsl:for-each select="storedProcedure">
858
            <xsl:if test="position()=$entityindex">
859
                <xsl:choose>
860
                 <xsl:when test="references!=''">
861
                    <xsl:variable name="ref_id2" select="references"/>
862
                    <xsl:variable name="references2" select="$ids[@id=$ref_id2]" />
863
                    <xsl:for-each select="$references2">
864
                       <xsl:call-template name="choosephysical"/>
865
                    </xsl:for-each>
866
                 </xsl:when>
867
                 <xsl:otherwise>
868
                     <xsl:call-template name="choosephysical"/>
869
                 </xsl:otherwise>
870
               </xsl:choose>
871
            </xsl:if>
872
          </xsl:for-each>
873
        </xsl:if>
874
        <xsl:if test="$entitytype='view'">
875
          <xsl:for-each select="view">
876
            <xsl:if test="position()=$entityindex">
877
                <xsl:choose>
878
                 <xsl:when test="references!=''">
879
                    <xsl:variable name="ref_id2" select="references"/>
880
                    <xsl:variable name="references2" select="$ids[@id=$ref_id2]" />
881
                    <xsl:for-each select="$references2">
882
                       <xsl:call-template name="choosephysical"/>
883
                    </xsl:for-each>
884
                 </xsl:when>
885
                 <xsl:otherwise>
886
                     <xsl:call-template name="choosephysical"/>
887
                 </xsl:otherwise>
888
               </xsl:choose>
889
            </xsl:if>
890
          </xsl:for-each>
891
        </xsl:if>
892
        <xsl:if test="$entitytype='otherEntity'">
893
          <xsl:for-each select="otherEntity">
894
            <xsl:if test="position()=$entityindex">
895
                <xsl:choose>
896
                 <xsl:when test="references!=''">
897
                    <xsl:variable name="ref_id2" select="references"/>
898
                    <xsl:variable name="references2" select="$ids[@id=$ref_id2]" />
899
                    <xsl:for-each select="$references2">
900
                       <xsl:call-template name="choosephysical"/>
901
                    </xsl:for-each>
902
                 </xsl:when>
903
                 <xsl:otherwise>
904
                     <xsl:call-template name="choosephysical"/>
905
                 </xsl:otherwise>
906
               </xsl:choose>
907
            </xsl:if>
908
          </xsl:for-each>
909
        </xsl:if>
910
      </xsl:if>
911
   </xsl:template>
912

    
913
   <xsl:template name="choosephysical">
914
      <xsl:for-each select="physical">
915
   <xsl:if test="position()=$physicalindex">
916
      <xsl:choose>
917
         <xsl:when test="references!=''">
918
            <xsl:variable name="ref_id" select="references"/>
919
            <xsl:variable name="references" select="$ids[@id=$ref_id]" />
920
            <xsl:for-each select="$references">
921
               <xsl:call-template name="choosedistribution"/>
922
            </xsl:for-each>
923
         </xsl:when>
924
         <xsl:otherwise>
925
            <xsl:call-template name="choosedistribution"/>
926
        </xsl:otherwise>
927
     </xsl:choose>
928
  </xsl:if>
929
      </xsl:for-each>
930
   </xsl:template>
931

    
932
   <xsl:template name="choosedistribution">
933
      <xsl:for-each select="distribution">
934
   <xsl:if test="$distributionindex=position()">
935
      <xsl:choose>
936
         <xsl:when test="references!=''">
937
            <xsl:variable name="ref_id" select="references"/>
938
            <xsl:variable name="references" select="$ids[@id=$ref_id]" />
939
            <xsl:for-each select="$references">
940
               <xsl:for-each select="inline">
941
                  <xsl:value-of select="."/>
942
                </xsl:for-each>
943
            </xsl:for-each>
944
         </xsl:when>
945
         <xsl:otherwise>
946
            <xsl:for-each select="inline">
947
              <xsl:value-of select="."/>
948
            </xsl:for-each>
949
        </xsl:otherwise>
950
     </xsl:choose>
951
  </xsl:if>
952
      </xsl:for-each>
953
   </xsl:template>
954

    
955

    
956
     <!--********************************************************
957
               Citation part
958
       ********************************************************-->
959
   <xsl:template name="emlcitation">
960
     <xsl:choose>
961
       <xsl:when test="$displaymodule='inlinedata'">
962
    		<xsl:call-template name="emlinlinedata"/>
963
       </xsl:when>
964
       <xsl:otherwise>
965
		  <h3>Citation Description</h3>
966
		  <xsl:call-template name="identifier">
967
		        <xsl:with-param name="packageID" select="../@packageId"/>
968
		        <xsl:with-param name="system" select="../@system"/>
969
		  </xsl:call-template>
970
	      <xsl:call-template name="citation">
971
	         <xsl:with-param name="citationfirstColStyle" select="$firstColStyle"/>
972
	         <xsl:with-param name="citationsubHeaderStyle" select="$subHeaderStyle"/>
973
			</xsl:call-template>
974
		    
975
     </xsl:otherwise>
976
    </xsl:choose>
977
   </xsl:template>
978

    
979

    
980

    
981
     <!--********************************************************
982
              Software part
983
       ********************************************************-->
984

    
985
   <xsl:template name="emlsoftware">
986
     <xsl:choose>
987
       <xsl:when test="$displaymodule='inlinedata'">
988
    	<xsl:call-template name="emlinlinedata"/>
989
       </xsl:when>
990
       <xsl:otherwise>
991
         <h3>Software Description</h3>
992

    
993
	    <xsl:call-template name="identifier">
994
	        <xsl:with-param name="packageID" select="../@packageId"/>
995
	        <xsl:with-param name="system" select="../@system"/>
996
	    </xsl:call-template>
997
	
998
	      <xsl:call-template name="software">
999
	         <xsl:with-param name="softwarefirstColStyle" select="$firstColStyle"/>
1000
	         <xsl:with-param name="softwaresubHeaderStyle" select="$subHeaderStyle"/>
1001
	     </xsl:call-template>
1002

    
1003
      </xsl:otherwise>
1004
     </xsl:choose>
1005
   </xsl:template>
1006

    
1007

    
1008
     <!--********************************************************
1009
              Protocal part
1010
       ********************************************************-->
1011

    
1012
   <xsl:template name="emlprotocol">
1013
    <xsl:choose>
1014
       <xsl:when test="$displaymodule='inlinedata'">
1015
    	<xsl:call-template name="emlinlinedata"/>
1016
       </xsl:when>
1017
       <xsl:otherwise>
1018

    
1019
         <h3>Protocal Description</h3>
1020

    
1021
		   <xsl:call-template name="identifier">
1022
		        <xsl:with-param name="packageID" select="../@packageId"/>
1023
		        <xsl:with-param name="system" select="../@system"/>
1024
		   </xsl:call-template>
1025
	
1026
	      <xsl:call-template name="protocol">
1027
	         <xsl:with-param name="protocolfirstColStyle" select="$firstColStyle"/>
1028
	         <xsl:with-param name="protocolsubHeaderStyle" select="$subHeaderStyle"/>
1029
	     </xsl:call-template>
1030

    
1031
      </xsl:otherwise>
1032
    </xsl:choose>
1033
   </xsl:template>
1034

    
1035
      <!--********************************************************
1036
             additionalmetadata url
1037
       ********************************************************-->
1038
   <xsl:template name="additionalmetadataURL">
1039
     <xsl:param name="index"/>
1040
        <a><xsl:attribute name="href"><xsl:value-of select="$tripleURI"/><xsl:value-of select="$docid"/>&amp;displaymodule=additionalmetadata&amp;additionalmetadataindex=<xsl:value-of select="$index"/></xsl:attribute>
1041
          Additional Metadata
1042
        </a>
1043
   </xsl:template>
1044
	<!--********************************************************
1045
             additionalmetadata part
1046
       ********************************************************-->
1047
   <xsl:template name="additionalmetadatapart">
1048

    
1049
		<div>
1050
			<xsl:call-template name="additionalmetadata"/>
1051
		</div>					
1052

    
1053
   </xsl:template>
1054
     <!--********************************************************
1055
             download xml part
1056
       ********************************************************-->
1057
	<xsl:template name="xml">
1058
		<xsl:param name="index" />
1059
			<div class="control-group">
1060
				<label class="control-label">Technical Metadata</label>
1061
				<div class="controls controls-well">
1062
					<a>
1063
						<xsl:attribute name="href">
1064
           					<!-- <xsl:value-of select="$xmlURI" /><xsl:value-of select="$docid" /> -->
1065
           					<xsl:value-of select="$objectURI" /><xsl:value-of select="$pid" />
1066
           				</xsl:attribute>
1067
						Ecological Metadata Language (EML) File
1068
					</a>
1069
				</div>
1070
			</div>
1071
	</xsl:template>
1072
	
1073
	<!--********************************************************
1074
                   access part
1075
       ********************************************************-->
1076
	<xsl:template name="topaccess">
1077
		<xsl:if test="$displaymodule='dataset' or $displaymodule='printall'">
1078

    
1079
			<xsl:call-template name="access">
1080
				<xsl:with-param name="accessfirstColStyle" select="$firstColStyle"/>
1081
				<xsl:with-param name="accesssubHeaderStyle" select="$subHeaderStyle"/>
1082
			</xsl:call-template>
1083

    
1084
		</xsl:if>
1085
	</xsl:template>
1086
</xsl:stylesheet>
(27-27/27)