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: cjones $'
10
  *     '$Date: 2006-11-17 13:37:07 -0800 (Fri, 17 Nov 2006) $'
11
  * '$Revision: 3094 $'
12
  *
13
  * This program is free software; you can redistribute it and/or modify
14
  * it under the terms of the GNU General Public License as published by
15
  * the Free Software Foundation; either version 2 of the License, or
16
  * (at your option) any later version.
17
  *
18
  * This program is distributed in the hope that it will be useful,
19
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
  * GNU General Public License for more details.
22
  *
23
  * You should have received a copy of the GNU General Public License
24
  * along with this program; if not, write to the Free Software
25
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26
  *
27
  * This is an XSLT (http://www.w3.org/TR/xslt) stylesheet designed to
28
  * convert an XML file that is valid with respect to the eml-variable.dtd
29
  * module of the Ecological Metadata Language (EML) into an HTML format
30
  * suitable for rendering with modern web browsers.
31
-->
32
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
33

    
34
  <xsl:output method="html" encoding="iso-8859-1"
35
              doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
36
              doctype-system="http://www.w3.org/TR/html4/loose.dtd"
37
              indent="yes" />  
38

    
39
   <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
      <table class="{$tabledefaultStyle}">
49
        <xsl:choose>
50
         <xsl:when test="references!=''">
51
          <xsl:variable name="ref_id" select="references"/>
52
          <xsl:variable name="references" select="$ids[@id=$ref_id]" />
53
          <xsl:for-each select="$references">
54
            <xsl:call-template name="physicalcommon">
55
              <xsl:with-param name="physicalfirstColStyle" select="$physicalfirstColStyle"/>
56
              <xsl:with-param name="notshowdistribution" select="$notshowdistribution"/>
57
            </xsl:call-template>
58
          </xsl:for-each>
59
        </xsl:when>
60
        <xsl:otherwise>
61
          <xsl:call-template name="physicalcommon">
62
             <xsl:with-param name="physicalfirstColStyle" select="$physicalfirstColStyle"/>
63
             <xsl:with-param name="notshowdistribution" select="$notshowdistribution"/>
64
          </xsl:call-template>
65
        </xsl:otherwise>
66
      </xsl:choose>
67
      </table>
68
  </xsl:template>
69

    
70
  <xsl:template name="physicalcommon">
71
    <xsl:param name="physicalfirstColStyle"/>
72
    <xsl:param name="notshowdistribution"/>
73
    <xsl:param name="docid"/>
74
    <xsl:param name="level">entity</xsl:param>
75
    <xsl:param name="entitytype"/>
76
    <xsl:param name="entityindex"/>
77
    <xsl:param name="physicalindex"/>
78
    <xsl:param name="distributionindex"/>
79

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

    
122
  </xsl:template>
123

    
124
  <xsl:template name="physicalobjectName">
125
    <xsl:param name="physicalfirstColStyle"/>
126
    <xsl:for-each select="objectName">
127
      <tr>
128
        <td class="{$physicalfirstColStyle}">
129
        Object Name:</td>
130
        <td class="{$secondColStyle}">
131
        <xsl:value-of select="."/></td>
132
      </tr>
133
    </xsl:for-each>
134
  </xsl:template>
135

    
136
  <xsl:template name="physicalsize">
137
    <xsl:param name="physicalfirstColStyle"/>
138
    <xsl:for-each select="size">
139
      <tr>
140
        <td class="{$physicalfirstColStyle}">
141
        Size:</td>
142
        <td class="{$secondColStyle}">
143
        <xsl:value-of select="."/><xsl:text> </xsl:text><xsl:value-of select="./@unit"/></td>
144
      </tr>
145
    </xsl:for-each>
146
  </xsl:template>
147

    
148
  <xsl:template name="physicalauthentication">
149
    <xsl:param name="physicalfirstColStyle"/>
150
    <xsl:for-each select="authentication">
151
      <tr>
152
        <td class="{$physicalfirstColStyle}">
153
        Authentication:</td>
154
        <td class="{$secondColStyle}">
155
          <xsl:value-of select="."/><xsl:text> </xsl:text>
156
          <xsl:if test="./@method">
157
            Caculated By<xsl:text> </xsl:text><xsl:value-of select="./@method"/>
158
          </xsl:if>
159
        </td>
160
      </tr>
161
    </xsl:for-each>
162
  </xsl:template>
163

    
164
  <xsl:template name="physicalcompressionMethod">
165
    <xsl:param name="physicalfirstColStyle"/>
166
    <xsl:for-each select="compressionMethod">
167
      <tr>
168
        <td class="{$physicalfirstColStyle}">
169
        Compression Method:</td>
170
        <td class="{$secondColStyle}">
171
        <xsl:value-of select="."/></td>
172
      </tr>
173
    </xsl:for-each>
174
  </xsl:template>
175

    
176
  <xsl:template name="physicalencodingMethod">
177
    <xsl:param name="physicalfirstColStyle"/>
178
    <xsl:for-each select="encodingMethod">
179
      <tr>
180
        <td class="{$physicalfirstColStyle}">
181
        Encoding Method:</td>
182
        <td class="{$secondColStyle}">
183
        <xsl:value-of select="."/></td>
184
      </tr>
185
    </xsl:for-each>
186
  </xsl:template>
187

    
188
  <xsl:template name="physicalcharacterEncoding">
189
    <xsl:param name="physicalfirstColStyle"/>
190
    <xsl:for-each select="characterEncoding">
191
      <tr>
192
        <td class="{$physicalfirstColStyle}">
193
        Character Encoding:</td>
194
        <td class="{$secondColStyle}">
195
        <xsl:value-of select="."/></td>
196
      </tr>
197
    </xsl:for-each>
198
  </xsl:template>
199

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

    
204
  <xsl:template name="physicaltextFormat">
205
   <xsl:param name="physicalfirstColStyle"/>
206
   <xsl:for-each select="dataFormat/textFormat">
207
      <tr>
208
        <td class="{$physicalfirstColStyle}">
209
        Text Format:</td>
210
        <td>
211
          <table class="{$tabledefaultStyle}">
212
            <xsl:apply-templates>
213
              <xsl:with-param name="physicalfirstColStyle" select="$physicalfirstColStyle"/>
214
            </xsl:apply-templates>
215
          </table>
216
        </td>
217
      </tr>
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 Foot 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}">Maximum Record Length:</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
        <td class="{$physicalfirstColStyle}">Simple Delimited:</td>
284
        <td >
285
          <table class="{$tabledefaultStyle}">
286
            <xsl:apply-templates>
287
              <xsl:with-param name="physicalfirstColStyle" select="$physicalfirstColStyle"/>
288
            </xsl:apply-templates>
289
          </table>
290
        </td>
291
        </tr>
292
  </xsl:template>
293

    
294
  <xsl:template match="complex">
295
        <xsl:param name="physicalfirstColStyle"/>
296
        <tr>
297
        <td class="{$physicalfirstColStyle}">Complex Delimited:</td>
298
        <td >
299
           <table class="{$tabledefaultStyle}">
300
             <xsl:call-template name="textFixed">
301
                <xsl:with-param name="physicalfirstColStyle" select="$physicalfirstColStyle"/>
302
             </xsl:call-template>
303
             <xsl:call-template name="textDelimited">
304
               <xsl:with-param name="physicalfirstColStyle" select="$physicalfirstColStyle"/>
305
             </xsl:call-template>
306
           </table>
307
         </td>
308
        </tr>
309
  </xsl:template>
310

    
311

    
312
  <xsl:template name="textFixed">
313
        <xsl:param name="physicalfirstColStyle"/>
314
        <tr>
315
        <td class="{$physicalfirstColStyle}">Text Fixed:</td>
316
        <td >
317
          <table class="{$tabledefaultStyle}">
318
            <xsl:apply-templates>
319
              <xsl:with-param name="physicalfirstColStyle" select="$physicalfirstColStyle"/>
320
            </xsl:apply-templates>
321
          </table>
322
        </td>
323
        </tr>
324
  </xsl:template>
325

    
326
  <xsl:template name="textDelimited">
327
        <xsl:param name="physicalfirstColStyle"/>
328
        <tr>
329
        <td class="{$physicalfirstColStyle}">Text Delimited:</td>
330
        <td >
331
          <table class="{$tabledefaultStyle}">
332
            <xsl:apply-templates>
333
              <xsl:with-param name="physicalfirstColStyle" select="$physicalfirstColStyle"/>
334
            </xsl:apply-templates>
335
          </table>
336
        </td>
337
        </tr>
338
  </xsl:template>
339

    
340
  <xsl:template match="quoteCharacter">
341
        <xsl:param name="physicalfirstColStyle"/>
342
        <tr>
343
        <td class="{$firstColStyle}">Quote Character:</td>
344
        <td class="{$secondColStyle}"><xsl:value-of select="."/></td>
345
        </tr>
346
  </xsl:template>
347

    
348
   <xsl:template match="literalCharacter">
349
       <xsl:param name="physicalfirstColStyle"/>
350
       <tr>
351
        <td class="{$firstColStyle}">Literal Character:</td>
352
        <td class="{$secondColStyle}"><xsl:value-of select="."/></td>
353
        </tr>
354
  </xsl:template>
355

    
356

    
357
  <xsl:template match="fieldDelimiter">
358
        <xsl:param name="physicalfirstColStyle"/>
359
        <tr>
360
        <td class="{$firstColStyle}">Field Delimeter:</td>
361
        <td class="{$secondColStyle}"><xsl:value-of select="."/></td>
362
        </tr>
363
  </xsl:template>
364

    
365
  <xsl:template match="fieldWidth">
366
        <xsl:param name="physicalfirstColStyle"/>
367
        <tr><td class="{$firstColStyle}">Field Width:</td>
368
        <td class="{$secondColStyle}"><xsl:value-of select="."/></td>
369
        </tr>
370
  </xsl:template>
371

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

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

    
387

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

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

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

    
438
  <!--***********************************************************
439
      binaryRasterFormat templates
440
      ***********************************************************-->
441
  <xsl:template name="physicalbinaryRasterFormat">
442
    <xsl:param name="physicalfirstColStyle"/>
443
    <xsl:for-each select="dataFormat/binaryRasterFormat">
444
      <tr>
445
        <td class="{$physicalfirstColStyle}">
446
        Binary Raster Format:</td>
447
        <td>
448
           <table class="{$tabledefaultStyle}">
449
             <xsl:apply-templates>
450
               <xsl:with-param name="physicalfirstColStyle" select="$physicalfirstColStyle"/>
451
             </xsl:apply-templates>
452
           </table>
453
        </td>
454
      </tr>
455

    
456
   </xsl:for-each>
457
  </xsl:template>
458

    
459
  <xsl:template match="rowColumnOrientation">
460
        <xsl:param name="physicalfirstColStyle"/>
461
        <tr>
462
        <td class="{$firstColStyle}">Orientation:</td>
463
        <td class="{$secondColStyle}">
464
          <xsl:value-of select="."/>
465
        </td>
466
        </tr>
467
  </xsl:template>
468

    
469
  <xsl:template match="multiBand">
470
        <xsl:param name="physicalfirstColStyle"/>
471
        <tr>
472
        <td class="{$firstColStyle}">Multiple Bands:</td>
473
        <td>
474
         <table class="{$tabledefaultStyle}">
475
            <tr>
476
                <td class="{$firstColStyle}">Number of Spectral Bands:</td>
477
                <td class="{$secondColStyle}">
478
                <xsl:value-of select="./nbands"/>
479
              </td>
480
            </tr>
481
            <tr>
482
               <td class="{$firstColStyle}">Layout:</td>
483
               <td class="{$secondColStyle}">
484
               <xsl:value-of select="./layout"/>
485
               </td>
486
           </tr>
487
        </table>
488
        </td>
489
        </tr>
490
  </xsl:template>
491

    
492

    
493
  <xsl:template match="nbits">
494
        <xsl:param name="physicalfirstColStyle"/>
495
        <tr>
496
        <td class="{$firstColStyle}">Number of Bits (/pixel/band):</td>
497
        <td class="{$secondColStyle}">
498
          <xsl:value-of select="."/>
499
        </td>
500
        </tr>
501
  </xsl:template>
502

    
503
  <xsl:template match="byteorder">
504
        <xsl:param name="physicalfirstColStyle"/>
505
        <tr>
506
        <td class="{$firstColStyle}">Byte Order:</td>
507
        <td class="{$secondColStyle}">
508
          <xsl:value-of select="."/>
509
        </td>
510
        </tr>
511
  </xsl:template>
512

    
513
  <xsl:template match="skipbytes">
514
        <xsl:param name="physicalfirstColStyle"/>
515
        <tr>
516
        <td class="{$firstColStyle}">Skipped Bytes:</td>
517
        <td class="{$secondColStyle}">
518
          <xsl:value-of select="."/>
519
        </td>
520
        </tr>
521
  </xsl:template>
522

    
523
  <xsl:template match="bandrowbytes">
524
        <xsl:param name="physicalfirstColStyle"/>
525
        <tr>
526
        <td class="{$firstColStyle}">Number of Bytes (/band/row):</td>
527
        <td class="{$secondColStyle}">
528
          <xsl:value-of select="."/>
529
        </td>
530
        </tr>
531
  </xsl:template>
532

    
533
  <xsl:template match="totalrowbytes">
534
        <xsl:param name="physicalfirstColStyle"/>
535
        <tr>
536
        <td class="{$firstColStyle}">Total Number of Byte (/row):</td>
537
        <td class="{$secondColStyle}">
538
          <xsl:value-of select="."/>
539
        </td>
540
        </tr>
541
  </xsl:template>
542

    
543
  <xsl:template match="bandgapbytes">
544
        <xsl:param name="physicalfirstColStyle"/>
545
        <tr>
546
        <td class="{$firstColStyle}">Number of Bytes between Bands:</td>
547
        <td class="{$secondColStyle}">
548
          <xsl:value-of select="."/>
549
        </td>
550
        </tr>
551
  </xsl:template>
552

    
553
</xsl:stylesheet>
(16-16/28)