Project

General

Profile

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: tao $'
10
  *     '$Date: 2017-09-07 15:15:33 -0700 (Thu, 07 Sep 2017) $'
11
  * '$Revision: 10407 $'
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

    
34
  <xsl:output method="html" encoding="UTF-8"
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
   <xsl:template name="physical">
40
      <xsl:param name="docid"/>
41
      <xsl:param name="level">entity</xsl:param>
42
      <xsl:param name="entitytype"/>
43
      <xsl:param name="entityindex"/>
44
      <xsl:param name="physicalindex"/>
45
      <xsl:param name="distributionindex"/>
46
      <xsl:param name="physicalfirstColStyle"/>
47
      <xsl:param name="notshowdistribution"/>
48
      
49
      <div class="physicalContainer">
50
      
51
        <xsl:choose>
52
         <xsl:when test="references!=''">
53
          <xsl:variable name="ref_id" select="references"/>
54
          <xsl:variable name="references" select="$ids[@id=$ref_id]" />
55
          <xsl:for-each select="$references">
56
            <xsl:call-template name="physicalcommon">
57
              <xsl:with-param name="physicalfirstColStyle" select="$physicalfirstColStyle"/>
58
              <xsl:with-param name="notshowdistribution" select="$notshowdistribution"/>
59
            </xsl:call-template>
60
          </xsl:for-each>
61
        </xsl:when>
62
        <xsl:otherwise>
63
          <xsl:call-template name="physicalcommon">
64
             <xsl:with-param name="physicalfirstColStyle" select="$physicalfirstColStyle"/>
65
             <xsl:with-param name="notshowdistribution" select="$notshowdistribution"/>
66
          </xsl:call-template>
67
        </xsl:otherwise>
68
      </xsl:choose>
69
      
70
      </div>
71
      
72
  </xsl:template>
73

    
74
  <xsl:template name="physicalcommon">
75
    <xsl:param name="physicalfirstColStyle"/>
76
    <xsl:param name="notshowdistribution"/>
77
    <xsl:param name="docid"/>
78
    <xsl:param name="level">entity</xsl:param>
79
    <xsl:param name="entitytype"/>
80
    <xsl:param name="entityindex"/>
81
    <xsl:param name="physicalindex"/>
82
    <xsl:param name="distributionindex"/>
83

    
84
    <xsl:call-template name="physicalobjectName">
85
      <xsl:with-param name="physicalfirstColStyle" select="$physicalfirstColStyle"/>
86
    </xsl:call-template>
87
    <xsl:if test="$notshowdistribution=''">
88
      <xsl:for-each select="distribution">
89
        <xsl:call-template name="distribution">
90
          <xsl:with-param name="disfirstColStyle" select="$physicalfirstColStyle"/>
91
          <xsl:with-param name="dissubHeaderStyle" select="$subHeaderStyle"/>
92
          <xsl:with-param name="docid" select="$docid"/>
93
          <xsl:with-param name="level">entitylevel</xsl:with-param>
94
          <xsl:with-param name="entitytype" select="$entitytype"/>
95
          <xsl:with-param name="entityindex" select="$entityindex"/>
96
          <xsl:with-param name="physicalindex" select="$physicalindex"/>
97
          <xsl:with-param name="distributionindex" select="position()"/>
98
        </xsl:call-template>
99
      </xsl:for-each>
100
    </xsl:if>
101
    <xsl:call-template name="physicalsize">
102
      <xsl:with-param name="physicalfirstColStyle" select="$physicalfirstColStyle"/>
103
    </xsl:call-template>
104
    <xsl:call-template name="physicalauthentication">
105
      <xsl:with-param name="physicalfirstColStyle" select="$physicalfirstColStyle"/>
106
    </xsl:call-template>
107
    <xsl:call-template name="physicalcompressionMethod">
108
      <xsl:with-param name="physicalfirstColStyle" select="$physicalfirstColStyle"/>
109
    </xsl:call-template>
110
    <xsl:call-template name="physicalencodingMethod">
111
      <xsl:with-param name="physicalfirstColStyle" select="$physicalfirstColStyle"/>
112
    </xsl:call-template>
113
    <xsl:call-template name="physicalcharacterEncoding">
114
      <xsl:with-param name="physicalfirstColStyle" select="$physicalfirstColStyle"/>
115
    </xsl:call-template>
116
    <xsl:call-template name="physicaltextFormat">
117
      <xsl:with-param name="physicalfirstColStyle" select="$physicalfirstColStyle"/>
118
    </xsl:call-template>
119
    <xsl:call-template name="physicalexternallyDefinedFormat">
120
      <xsl:with-param name="physicalfirstColStyle" select="$physicalfirstColStyle"/>
121
    </xsl:call-template>
122
    <xsl:call-template name="physicalbinaryRasterFormat">
123
      <xsl:with-param name="physicalfirstColStyle" select="$physicalfirstColStyle"/>
124
    </xsl:call-template>
125

    
126
  </xsl:template>
127

    
128
  <xsl:template name="physicalobjectName">
129
    <xsl:param name="physicalfirstColStyle"/>
130
    <xsl:for-each select="objectName">
131
      <xsl:variable name="objName"><xsl:value-of select="."/></xsl:variable>
132
      <div class="control-group objectName" data-object-name="{$objName}">
133
		<label class="control-label">Object Name</label>
134
        <div class="controls controls-well">
135
        	<xsl:value-of select="$objName"/>
136
        </div>
137
      </div>
138
    </xsl:for-each>
139
  </xsl:template>
140

    
141
  <xsl:template name="physicalsize">
142
    <xsl:param name="physicalfirstColStyle"/>
143
    <xsl:for-each select="size">
144
      <div class="control-group">
145
		<label class="control-label">Size</label>
146
        <div class="controls controls-well">
147
            <xsl:value-of select="."/><xsl:text> </xsl:text>
148
            <xsl:choose>
149
                <xsl:when test="./@unit">
150
                    <xsl:value-of select="./@unit"/>
151
                </xsl:when>
152
                <xsl:otherwise>
153
                    <xsl:text>bytes</xsl:text>
154
                </xsl:otherwise>
155
            </xsl:choose>
156
        </div>
157
      </div>
158
    </xsl:for-each>
159
  </xsl:template>
160

    
161
  <xsl:template name="physicalauthentication">
162
    <xsl:param name="physicalfirstColStyle"/>
163
    <xsl:for-each select="authentication">
164
      <div class="control-group">
165
		<label class="control-label">Authentication</label>
166
        <div class="controls controls-well">
167
          <xsl:value-of select="."/><xsl:text> </xsl:text>
168
          <xsl:if test="./@method">
169
            Calculated By<xsl:text> </xsl:text><xsl:value-of select="./@method"/>
170
          </xsl:if>
171
        </div>
172
      </div>
173
    </xsl:for-each>
174
  </xsl:template>
175

    
176
  <xsl:template name="physicalcompressionMethod">
177
    <xsl:param name="physicalfirstColStyle"/>
178
    <xsl:for-each select="compressionMethod">
179
      <div class="control-group">
180
		<label class="control-label">Compression Method</label>
181
        <div class="controls controls-well">
182
        <xsl:value-of select="."/></div>
183
      </div>
184
    </xsl:for-each>
185
  </xsl:template>
186

    
187
  <xsl:template name="physicalencodingMethod">
188
    <xsl:param name="physicalfirstColStyle"/>
189
    <xsl:for-each select="encodingMethod">
190
      <div class="control-group">
191
		<label class="control-label">Encoding Method</label>
192
        <div class="controls controls-well">
193
        	<xsl:value-of select="."/>
194
        </div>
195
      </div>
196
    </xsl:for-each>
197
  </xsl:template>
198

    
199
  <xsl:template name="physicalcharacterEncoding">
200
    <xsl:param name="physicalfirstColStyle"/>
201
    <xsl:for-each select="characterEncoding">
202
      <div class="control-group">
203
		<label class="control-label">Character Encoding</label>
204
        <div class="controls controls-well">
205
        <xsl:value-of select="."/></div>
206
      </div>
207
    </xsl:for-each>
208
  </xsl:template>
209

    
210
  <!--***********************************************************
211
      TextFormat templates
212
      ***********************************************************-->
213

    
214
  <xsl:template name="physicaltextFormat">
215
   <xsl:param name="physicalfirstColStyle"/>
216
   <xsl:for-each select="dataFormat/textFormat">
217
      <div class="control-group">
218
		<label class="control-label">Text Format</label>
219
        <div class="controls controls-well">
220
          <table class="table table-striped">
221
            <xsl:apply-templates>
222
              <xsl:with-param name="physicalfirstColStyle" select="$physicalfirstColStyle"/>
223
            </xsl:apply-templates>
224
          </table>
225
        </div>
226
      </div>
227

    
228
   </xsl:for-each>
229

    
230
  </xsl:template>
231

    
232

    
233
  <xsl:template match="numHeaderLines">
234
        <xsl:param name="physicalfirstColStyle"/>
235
        <tr>
236
	        <td class="{$physicalfirstColStyle}">Number of Header Lines</td>
237
	        <td class="{$secondColStyle}"><xsl:value-of select="."/></td>
238
        </tr>
239
  </xsl:template>
240

    
241
  <xsl:template match="numFooterLines">
242
        <xsl:param name="physicalfirstColStyle"/>
243
        <tr>
244
	        <td class="{$physicalfirstColStyle}">Number of Footer Lines</td>
245
	        <td class="{$secondColStyle}"><xsl:value-of select="."/></td>
246
        </tr>
247
  </xsl:template>
248

    
249
  <xsl:template match="recordDelimiter">
250
        <xsl:param name="physicalfirstColStyle"/>
251
        <tr>
252
	        <td class="{$physicalfirstColStyle}">Record Delimiter</td>
253
	        <td class="{$secondColStyle}"><xsl:value-of select="."/></td>
254
        </tr>
255
  </xsl:template>
256

    
257
  <xsl:template match="physicalLineDelimiter">
258
        <xsl:param name="physicalfirstColStyle"/>
259
        <tr>
260
	        <td class="{$physicalfirstColStyle}">Line Delimiter</td>
261
	        <td class="{$secondColStyle}"><xsl:value-of select="."/></td>
262
        </tr>
263
  </xsl:template>
264

    
265
  <xsl:template match="numPhysicalLinesPerRecord">
266
        <xsl:param name="physicalfirstColStyle"/>
267
        <tr>
268
	        <td class="{$physicalfirstColStyle}">Line Number For One Record</td>
269
	        <td class="{$secondColStyle}"><xsl:value-of select="."/></td>
270
        </tr>
271
  </xsl:template>
272

    
273
  <xsl:template match="maxRecordLength">
274
        <xsl:param name="physicalfirstColStyle"/>
275
        <tr>
276
	        <td class="{$physicalfirstColStyle}">Maximum Record Length</td>
277
	        <td class="{$secondColStyle}"><xsl:value-of select="."/></td>
278
        </tr>
279
  </xsl:template>
280

    
281
  <xsl:template match="attributeOrientation">
282
        <xsl:param name="physicalfirstColStyle"/>
283
        <tr>
284
	        <td class="{$physicalfirstColStyle}">Attribute Orientation</td>
285
	        <td class="{$secondColStyle}"><xsl:value-of select="."/></td>
286
        </tr>
287
  </xsl:template>
288

    
289
  <xsl:template match="simpleDelimited">
290
        <xsl:param name="physicalfirstColStyle"/>
291
        <tr>
292
        	<th colspan="2">Simple Text</th>
293
        </tr>
294
        <xsl:apply-templates>
295
           <xsl:with-param name="physicalfirstColStyle" select="$physicalfirstColStyle"/>
296
         </xsl:apply-templates>
297
  </xsl:template>
298

    
299
  <xsl:template match="complex">
300
        <xsl:param name="physicalfirstColStyle"/>
301
        <tr>
302
        	<th colspan="2">Complex Delimited</th>
303
        </tr>
304
        <xsl:call-template name="textFixed">
305
           <xsl:with-param name="physicalfirstColStyle" select="$physicalfirstColStyle"/>
306
        </xsl:call-template>
307
        <xsl:call-template name="textDelimited">
308
          <xsl:with-param name="physicalfirstColStyle" select="$physicalfirstColStyle"/>
309
        </xsl:call-template>
310
           
311
  </xsl:template>
312

    
313

    
314
  <xsl:template name="textFixed">
315
        <xsl:param name="physicalfirstColStyle"/>
316
        <tr>
317
        	<th colspan="2">Text Fixed</th>
318
        </tr>
319
        <xsl:apply-templates>
320
          <xsl:with-param name="physicalfirstColStyle" select="$physicalfirstColStyle"/>
321
        </xsl:apply-templates>
322
          
323
  </xsl:template>
324

    
325
  <xsl:template name="textDelimited">
326
        <xsl:param name="physicalfirstColStyle"/>
327
        <tr>
328
        	<th colspan="2">Text Delimited</th>
329
        </tr>
330
        <xsl:apply-templates>
331
          <xsl:with-param name="physicalfirstColStyle" select="$physicalfirstColStyle"/>
332
        </xsl:apply-templates>
333
  </xsl:template>
334

    
335
  <xsl:template match="quoteCharacter">
336
        <xsl:param name="physicalfirstColStyle"/>
337
        <tr>
338
	        <td class="{$firstColStyle}">Quote Character</td>
339
	        <td class="{$secondColStyle}"><xsl:value-of select="."/></td>
340
        </tr>
341
  </xsl:template>
342

    
343
   <xsl:template match="literalCharacter">
344
       <xsl:param name="physicalfirstColStyle"/>
345
       <tr>
346
	        <td class="{$firstColStyle}">Literal Character</td>
347
	        <td class="{$secondColStyle}"><xsl:value-of select="."/></td>
348
        </tr>
349
  </xsl:template>
350

    
351

    
352
  <xsl:template match="fieldDelimiter">
353
        <xsl:param name="physicalfirstColStyle"/>
354
        <tr>
355
	        <td class="{$firstColStyle}">Field Delimeter</td>
356
	        <td class="{$secondColStyle}"><xsl:value-of select="."/></td>
357
        </tr>
358
  </xsl:template>
359

    
360
  <xsl:template match="fieldWidth">
361
        <xsl:param name="physicalfirstColStyle"/>
362
        <tr>
363
        	<td class="{$firstColStyle}">Field Width</td>
364
        	<td class="{$secondColStyle}"><xsl:value-of select="."/></td>
365
        </tr>
366
  </xsl:template>
367

    
368
  <xsl:template match="lineNumber">
369
        <xsl:param name="physicalfirstColStyle"/>
370
        <tr>
371
	        <td class="{$firstColStyle}">Line Number</td>
372
	        <td class="{$secondColStyle}"><xsl:value-of select="."/></td>
373
        </tr>
374
  </xsl:template>
375

    
376
  <xsl:template match="fieldStartColumn">
377
        <xsl:param name="physicalfirstColStyle"/>
378
        <tr>
379
	        <td class="{$firstColStyle}">Field Start Column</td>
380
	        <td class="{$secondColStyle}"><xsl:value-of select="."/></td>
381
        </tr>
382
  </xsl:template>
383

    
384

    
385
  <!--***********************************************************
386
      externallyDefinedFormat templates
387
      ***********************************************************-->
388
 <xsl:template name="physicalexternallyDefinedFormat">
389
    <xsl:param name="physicalfirstColStyle"/>
390
    <xsl:for-each select="dataFormat/externallyDefinedFormat">
391
      <div class="control-group">
392
		<label class="control-label">Externally Defined Format</label>
393
        <div class="controls controls-well">
394
          <table class="table table-striped">
395
            <xsl:apply-templates>
396
              <xsl:with-param name="physicalfirstColStyle" select="$physicalfirstColStyle"/>
397
            </xsl:apply-templates>
398
          </table>
399
        </div>
400
      </div>
401
    </xsl:for-each>
402
  </xsl:template>
403
  <xsl:template match="formatName">
404
    <xsl:param name="physicalfirstColStyle"/>
405
    <xsl:if test="normalize-space(.)!=''">
406
        <tr>
407
	        <td class="{$firstColStyle}">Format Name</td>
408
	        <td class="{$secondColStyle}"><xsl:value-of select="."/></td>
409
        </tr>
410
    </xsl:if>
411
  </xsl:template>
412

    
413
  <xsl:template match="formatVersion">
414
        <xsl:param name="physicalfirstColStyle"/>
415
        <tr>
416
	        <td class="{$firstColStyle}">Format Version</td>
417
	        <td class="{$secondColStyle}"><xsl:value-of select="."/></td>
418
        </tr>
419
  </xsl:template>
420

    
421
  <xsl:template match="citation">
422
        <xsl:param name="physicalfirstColStyle"/>
423
        <tr>
424
	        <td class="{$physicalfirstColStyle}">Citation</td>
425
	        <td>
426
	          <xsl:call-template name="citation">
427
	            <xsl:with-param name="citationfirstColStyle" select="$physicalfirstColStyle"/>
428
	             <xsl:with-param name="citationsubHeaderStyle" select="$subHeaderStyle"/>
429
	          </xsl:call-template>
430
	        </td>
431
        </tr>
432
  </xsl:template>
433

    
434
  <!--***********************************************************
435
      binaryRasterFormat templates
436
      ***********************************************************-->
437
  <xsl:template name="physicalbinaryRasterFormat">
438
    <xsl:param name="physicalfirstColStyle"/>
439
    <xsl:for-each select="dataFormat/binaryRasterFormat">
440
      <div class="control-group">
441
		<label class="control-label">Binary Raster Format</label>
442
        <div class="controls controls-well">
443
           <table class="table table-striped">
444
             <xsl:apply-templates>
445
               <xsl:with-param name="physicalfirstColStyle" select="$physicalfirstColStyle"/>
446
             </xsl:apply-templates>
447
           </table>
448
        </div>
449
      </div>
450

    
451
   </xsl:for-each>
452
  </xsl:template>
453

    
454
  <xsl:template match="rowColumnOrientation">
455
        <xsl:param name="physicalfirstColStyle"/>
456
        <tr>
457
	        <td class="{$firstColStyle}">Orientation</td>
458
	        <td class="{$secondColStyle}">
459
	          <xsl:value-of select="."/>
460
	        </td>
461
        </tr>
462
  </xsl:template>
463

    
464
  <xsl:template match="multiBand">
465
        <xsl:param name="physicalfirstColStyle"/>
466
        <tr>
467
        	<th colspan="2">Multiple Bands</th>
468
        </tr>
469
        <tr>
470
            <td class="{$firstColStyle}">Number of Spectral Bands</td>
471
            <td class="{$secondColStyle}">
472
            	<xsl:value-of select="./nbands"/>
473
          	</td>
474
        </tr>
475
        <tr>
476
           <td class="{$firstColStyle}">Layout</td>
477
           <td class="{$secondColStyle}">
478
           	<xsl:value-of select="./layout"/>
479
           </td>
480
       </tr>
481

    
482
  </xsl:template>
483

    
484

    
485
  <xsl:template match="nbits">
486
        <xsl:param name="physicalfirstColStyle"/>
487
        <tr>
488
	        <td class="{$firstColStyle}">Number of Bits (/pixel/band)</td>
489
	        <td class="{$secondColStyle}">
490
	          <xsl:value-of select="."/>
491
	        </td>
492
        </tr>
493
  </xsl:template>
494

    
495
  <xsl:template match="byteorder">
496
        <xsl:param name="physicalfirstColStyle"/>
497
        <tr>
498
	        <td class="{$firstColStyle}">Byte Order</td>
499
	        <td class="{$secondColStyle}">
500
	          <xsl:value-of select="."/>
501
	        </td>
502
        </tr>
503
  </xsl:template>
504

    
505
  <xsl:template match="skipbytes">
506
        <xsl:param name="physicalfirstColStyle"/>
507
        <tr>
508
	        <td class="{$firstColStyle}">Skipped Bytes</td>
509
	        <td class="{$secondColStyle}">
510
	          <xsl:value-of select="."/>
511
	        </td>
512
        </tr>
513
  </xsl:template>
514

    
515
  <xsl:template match="bandrowbytes">
516
        <xsl:param name="physicalfirstColStyle"/>
517
        <tr>
518
	        <td class="{$firstColStyle}">Number of Bytes (/band/row)</td>
519
	        <td class="{$secondColStyle}">
520
	          <xsl:value-of select="."/>
521
	        </td>
522
        </tr>
523
  </xsl:template>
524

    
525
  <xsl:template match="totalrowbytes">
526
        <xsl:param name="physicalfirstColStyle"/>
527
        <tr>
528
	        <td class="{$firstColStyle}">Total Number of Byte (/row)</td>
529
	        <td class="{$secondColStyle}">
530
	          <xsl:value-of select="."/>
531
	        </td>
532
        </tr>
533
  </xsl:template>
534

    
535
  <xsl:template match="bandgapbytes">
536
        <xsl:param name="physicalfirstColStyle"/>
537
        <tr>
538
	        <td class="{$firstColStyle}">Number of Bytes between Bands</td>
539
	        <td class="{$secondColStyle}">
540
	          <xsl:value-of select="."/>
541
	        </td>
542
        </tr>
543
  </xsl:template>
544

    
545
</xsl:stylesheet>
(16-16/27)