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: walker $'
10
  *     '$Date: 2015-03-09 15:37:19 -0700 (Mon, 09 Mar 2015) $'
11
  * '$Revision: 9145 $'
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><xsl:value-of select="./@unit"/></div>
148
      </div>
149
    </xsl:for-each>
150
  </xsl:template>
151

    
152
  <xsl:template name="physicalauthentication">
153
    <xsl:param name="physicalfirstColStyle"/>
154
    <xsl:for-each select="authentication">
155
      <div class="control-group">
156
		<label class="control-label">Authentication</label>
157
        <div class="controls controls-well">
158
          <xsl:value-of select="."/><xsl:text> </xsl:text>
159
          <xsl:if test="./@method">
160
            Calculated By<xsl:text> </xsl:text><xsl:value-of select="./@method"/>
161
          </xsl:if>
162
        </div>
163
      </div>
164
    </xsl:for-each>
165
  </xsl:template>
166

    
167
  <xsl:template name="physicalcompressionMethod">
168
    <xsl:param name="physicalfirstColStyle"/>
169
    <xsl:for-each select="compressionMethod">
170
      <div class="control-group">
171
		<label class="control-label">Compression Method</label>
172
        <div class="controls controls-well">
173
        <xsl:value-of select="."/></div>
174
      </div>
175
    </xsl:for-each>
176
  </xsl:template>
177

    
178
  <xsl:template name="physicalencodingMethod">
179
    <xsl:param name="physicalfirstColStyle"/>
180
    <xsl:for-each select="encodingMethod">
181
      <div class="control-group">
182
		<label class="control-label">Encoding Method</label>
183
        <div class="controls controls-well">
184
        	<xsl:value-of select="."/>
185
        </div>
186
      </div>
187
    </xsl:for-each>
188
  </xsl:template>
189

    
190
  <xsl:template name="physicalcharacterEncoding">
191
    <xsl:param name="physicalfirstColStyle"/>
192
    <xsl:for-each select="characterEncoding">
193
      <div class="control-group">
194
		<label class="control-label">Character Encoding</label>
195
        <div class="controls controls-well">
196
        <xsl:value-of select="."/></div>
197
      </div>
198
    </xsl:for-each>
199
  </xsl:template>
200

    
201
  <!--***********************************************************
202
      TextFormat templates
203
      ***********************************************************-->
204

    
205
  <xsl:template name="physicaltextFormat">
206
   <xsl:param name="physicalfirstColStyle"/>
207
   <xsl:for-each select="dataFormat/textFormat">
208
      <div class="control-group">
209
		<label class="control-label">Text Format</label>
210
        <div class="controls controls-well">
211
          <table class="table table-striped">
212
            <xsl:apply-templates>
213
              <xsl:with-param name="physicalfirstColStyle" select="$physicalfirstColStyle"/>
214
            </xsl:apply-templates>
215
          </table>
216
        </div>
217
      </div>
218

    
219
   </xsl:for-each>
220

    
221
  </xsl:template>
222

    
223

    
224
  <xsl:template match="numHeaderLines">
225
        <xsl:param name="physicalfirstColStyle"/>
226
        <tr>
227
	        <td class="{$physicalfirstColStyle}">Number of Header Lines</td>
228
	        <td class="{$secondColStyle}"><xsl:value-of select="."/></td>
229
        </tr>
230
  </xsl:template>
231

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

    
240
  <xsl:template match="recordDelimiter">
241
        <xsl:param name="physicalfirstColStyle"/>
242
        <tr>
243
	        <td class="{$physicalfirstColStyle}">Record Delimiter</td>
244
	        <td class="{$secondColStyle}"><xsl:value-of select="."/></td>
245
        </tr>
246
  </xsl:template>
247

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

    
256
  <xsl:template match="numPhysicalLinesPerRecord">
257
        <xsl:param name="physicalfirstColStyle"/>
258
        <tr>
259
	        <td class="{$physicalfirstColStyle}">Line Number For One Record</td>
260
	        <td class="{$secondColStyle}"><xsl:value-of select="."/></td>
261
        </tr>
262
  </xsl:template>
263

    
264
  <xsl:template match="maxRecordLength">
265
        <xsl:param name="physicalfirstColStyle"/>
266
        <tr>
267
	        <td class="{$physicalfirstColStyle}">Maximum Record Length</td>
268
	        <td class="{$secondColStyle}"><xsl:value-of select="."/></td>
269
        </tr>
270
  </xsl:template>
271

    
272
  <xsl:template match="attributeOrientation">
273
        <xsl:param name="physicalfirstColStyle"/>
274
        <tr>
275
	        <td class="{$physicalfirstColStyle}">Attribute Orientation</td>
276
	        <td class="{$secondColStyle}"><xsl:value-of select="."/></td>
277
        </tr>
278
  </xsl:template>
279

    
280
  <xsl:template match="simpleDelimited">
281
        <xsl:param name="physicalfirstColStyle"/>
282
        <tr>
283
        	<th colspan="2">Simple Text</th>
284
        </tr>
285
        <xsl:apply-templates>
286
           <xsl:with-param name="physicalfirstColStyle" select="$physicalfirstColStyle"/>
287
         </xsl:apply-templates>
288
  </xsl:template>
289

    
290
  <xsl:template match="complex">
291
        <xsl:param name="physicalfirstColStyle"/>
292
        <tr>
293
        	<th colspan="2">Complex Delimited</th>
294
        </tr>
295
        <xsl:call-template name="textFixed">
296
           <xsl:with-param name="physicalfirstColStyle" select="$physicalfirstColStyle"/>
297
        </xsl:call-template>
298
        <xsl:call-template name="textDelimited">
299
          <xsl:with-param name="physicalfirstColStyle" select="$physicalfirstColStyle"/>
300
        </xsl:call-template>
301
           
302
  </xsl:template>
303

    
304

    
305
  <xsl:template name="textFixed">
306
        <xsl:param name="physicalfirstColStyle"/>
307
        <tr>
308
        	<th colspan="2">Text Fixed</th>
309
        </tr>
310
        <xsl:apply-templates>
311
          <xsl:with-param name="physicalfirstColStyle" select="$physicalfirstColStyle"/>
312
        </xsl:apply-templates>
313
          
314
  </xsl:template>
315

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

    
326
  <xsl:template match="quoteCharacter">
327
        <xsl:param name="physicalfirstColStyle"/>
328
        <tr>
329
	        <td class="{$firstColStyle}">Quote Character</td>
330
	        <td class="{$secondColStyle}"><xsl:value-of select="."/></td>
331
        </tr>
332
  </xsl:template>
333

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

    
342

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

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

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

    
367
  <xsl:template match="fieldStartColumn">
368
        <xsl:param name="physicalfirstColStyle"/>
369
        <tr>
370
	        <td class="{$firstColStyle}">Field Start Column</td>
371
	        <td class="{$secondColStyle}"><xsl:value-of select="."/></td>
372
        </tr>
373
  </xsl:template>
374

    
375

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

    
404
  <xsl:template match="formatVersion">
405
        <xsl:param name="physicalfirstColStyle"/>
406
        <tr>
407
	        <td class="{$firstColStyle}">Format Version</td>
408
	        <td class="{$secondColStyle}"><xsl:value-of select="."/></td>
409
        </tr>
410
  </xsl:template>
411

    
412
  <xsl:template match="citation">
413
        <xsl:param name="physicalfirstColStyle"/>
414
        <tr>
415
	        <td class="{$physicalfirstColStyle}">Citation</td>
416
	        <td>
417
	          <xsl:call-template name="citation">
418
	            <xsl:with-param name="citationfirstColStyle" select="$physicalfirstColStyle"/>
419
	             <xsl:with-param name="citationsubHeaderStyle" select="$subHeaderStyle"/>
420
	          </xsl:call-template>
421
	        </td>
422
        </tr>
423
  </xsl:template>
424

    
425
  <!--***********************************************************
426
      binaryRasterFormat templates
427
      ***********************************************************-->
428
  <xsl:template name="physicalbinaryRasterFormat">
429
    <xsl:param name="physicalfirstColStyle"/>
430
    <xsl:for-each select="dataFormat/binaryRasterFormat">
431
      <div class="control-group">
432
		<label class="control-label">Binary Raster Format</label>
433
        <div class="controls controls-well">
434
           <table class="table table-striped">
435
             <xsl:apply-templates>
436
               <xsl:with-param name="physicalfirstColStyle" select="$physicalfirstColStyle"/>
437
             </xsl:apply-templates>
438
           </table>
439
        </div>
440
      </div>
441

    
442
   </xsl:for-each>
443
  </xsl:template>
444

    
445
  <xsl:template match="rowColumnOrientation">
446
        <xsl:param name="physicalfirstColStyle"/>
447
        <tr>
448
	        <td class="{$firstColStyle}">Orientation</td>
449
	        <td class="{$secondColStyle}">
450
	          <xsl:value-of select="."/>
451
	        </td>
452
        </tr>
453
  </xsl:template>
454

    
455
  <xsl:template match="multiBand">
456
        <xsl:param name="physicalfirstColStyle"/>
457
        <tr>
458
        	<th colspan="2">Multiple Bands</th>
459
        </tr>
460
        <tr>
461
            <td class="{$firstColStyle}">Number of Spectral Bands</td>
462
            <td class="{$secondColStyle}">
463
            	<xsl:value-of select="./nbands"/>
464
          	</td>
465
        </tr>
466
        <tr>
467
           <td class="{$firstColStyle}">Layout</td>
468
           <td class="{$secondColStyle}">
469
           	<xsl:value-of select="./layout"/>
470
           </td>
471
       </tr>
472

    
473
  </xsl:template>
474

    
475

    
476
  <xsl:template match="nbits">
477
        <xsl:param name="physicalfirstColStyle"/>
478
        <tr>
479
	        <td class="{$firstColStyle}">Number of Bits (/pixel/band)</td>
480
	        <td class="{$secondColStyle}">
481
	          <xsl:value-of select="."/>
482
	        </td>
483
        </tr>
484
  </xsl:template>
485

    
486
  <xsl:template match="byteorder">
487
        <xsl:param name="physicalfirstColStyle"/>
488
        <tr>
489
	        <td class="{$firstColStyle}">Byte Order</td>
490
	        <td class="{$secondColStyle}">
491
	          <xsl:value-of select="."/>
492
	        </td>
493
        </tr>
494
  </xsl:template>
495

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

    
506
  <xsl:template match="bandrowbytes">
507
        <xsl:param name="physicalfirstColStyle"/>
508
        <tr>
509
	        <td class="{$firstColStyle}">Number of Bytes (/band/row)</td>
510
	        <td class="{$secondColStyle}">
511
	          <xsl:value-of select="."/>
512
	        </td>
513
        </tr>
514
  </xsl:template>
515

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

    
526
  <xsl:template match="bandgapbytes">
527
        <xsl:param name="physicalfirstColStyle"/>
528
        <tr>
529
	        <td class="{$firstColStyle}">Number of Bytes between Bands</td>
530
	        <td class="{$secondColStyle}">
531
	          <xsl:value-of select="."/>
532
	        </td>
533
        </tr>
534
  </xsl:template>
535

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