Project

General

Profile

1
<?xml version="1.0"?> 
2
<!--   
3
* eml-file-display.xsl   
4
*   
5
*      Authors: Jivka Bojilova   
6
*    Copyright: 2000 Regents of the University of California and the    
7
*               National Center for Ecological Analysis and Synthesis   
8
*  For Details: http://www.nceas.ucsb.edu/   
9
*      Created: 2000 April 17   
10
*    File Info: '$Id: eml-file-display.xsl 506 2000-10-31 01:12:16Z jones $'   
11
*   
12
* This is an XSLT (http://www.w3.org/TR/xslt) stylesheet designed to   
13
* convert an XML file that is valid with respect to the eml-file.dtd   
14
* module of the Ecological Metadata Language (EML) into an HTML format    
15
* suitable for rendering with modern web browsers. 
16
--> 
17
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">   
18

    
19
  <xsl:output method="html" encoding="iso-8859-1"/>
20
  <xsl:template match="/">
21
    <html>       
22
      <head> 	
23
        <link rel="stylesheet" type="text/css" 
24
              href="@web-base-url@/default.css" />
25
      </head>   
26
      <body> 	
27
        <center>           
28
          <h2>File structure description</h2>           
29
          <h4>Ecological Metadata Language</h4>         
30
        </center>
31
        <xsl:apply-templates select="eml-file/meta_file_id"/>          
32
        <table width="750" border="0" cellspacing="0" cellpadding="1" class="tablehead">
33
	  <tr>
34
	    <td><b>Data Set File</b></td>
35
	  </tr>
36
	</table>         
37
        <xsl:apply-templates select="eml-file/file"/>          
38

    
39
      </body>
40
    </html>
41
  </xsl:template>
42

    
43
  <xsl:template match="file">
44

    
45
	<table width="750" border="1" cellspacing="0" cellpadding="1">
46
          <tr>         
47
            <th width="25%" align="left"><xsl:text>File Name</xsl:text></th>         
48
            <td><xsl:value-of select="file_name"/>         
49
                <xsl:text>&nbsp;</xsl:text></td>           
50
          </tr>          
51
          <tr>          
52
            <th align="left"><xsl:text>File Size</xsl:text></th>         
53
            <td>
54
		<xsl:value-of select="file_size/amount"/>
55
                <xsl:value-of select="file_size/unit"/>
56
                <xsl:text>&nbsp;</xsl:text></td>           
57
          </tr>          
58
          <tr>          
59
            <th align="left"><xsl:text>File Format</xsl:text></th>         
60
            <td><xsl:apply-templates select="format"/>               
61
                <xsl:text>&nbsp;</xsl:text></td>           
62
          </tr>          
63
          <tr>          
64
            <th align="left"><xsl:text>Orientation</xsl:text></th>         
65
            <td><xsl:apply-templates select="orientation"/>               
66
                <xsl:text>&nbsp;</xsl:text></td>           
67
          </tr>          
68
          <tr>          
69
            <th align="left"><xsl:text>Header Lines</xsl:text></th>         
70
            <td><xsl:value-of select="header_lines"/>               
71
                <xsl:text>&nbsp;</xsl:text></td>           
72
          </tr>          
73
          <tr>          
74
            <th align="left"><xsl:text>Case Sensitive</xsl:text></th>         
75
            <td><xsl:apply-templates select="case_sensitive"/>               
76
                <xsl:text>&nbsp;</xsl:text></td>           
77
          </tr>          
78
          <tr>          
79
            <th align="left"><xsl:text>Geographic Coverage</xsl:text></th>         
80
            <td>
81
		<xsl:if test="geographic_coverage/paragraph/text() or geographic_coverage/coordinates/lattitude/text() or geographic_coverage/coordinates/longitude/text()"><ul>
82
                <xsl:for-each select="geographic_coverage">
83
                <li><xsl:for-each select="paragraph">
84
                      <xsl:value-of select="."/><br/>
85
                    </xsl:for-each>                     
86
                    <xsl:for-each select="coordinates">                        
87
                      <xsl:value-of select="lattitude"/>la -                         
88
                      <xsl:value-of select="longitude"/>lo<br/>
89
                    </xsl:for-each>                 
90
                </li>               
91
                </xsl:for-each>               
92
                </ul></xsl:if>
93
                <xsl:text>&nbsp;</xsl:text></td>           
94
          </tr>          
95
          <tr>          
96
            <th align="left"><xsl:text>Temporal Coverage</xsl:text></th>         
97
            <td>
98
		<xsl:if test="temporal_coverage/*/*/*/text()"><ul>
99
                <xsl:for-each select="temporal_coverage">                 
100
                <li><xsl:text>Start Date </xsl:text>
101
                    <xsl:apply-templates select="start_date/datetime"/> 
102
                    <xsl:text> - Stop Date </xsl:text>
103
                    <xsl:apply-templates select="stop_date/datetime"/>
104
                </li>
105
                </xsl:for-each>
106
                </ul></xsl:if>
107
                <xsl:text>&nbsp;</xsl:text></td>
108
          </tr>          
109
          <tr>          
110
            <th align="left"><xsl:text>Authentication</xsl:text></th>         
111
            <td><xsl:for-each select="authentication">
112
                  <xsl:value-of select="."/><br/>
113
                </xsl:for-each></td>
114
          </tr>          
115
          <tr>          
116
            <th align="left"><xsl:text>Data Problem</xsl:text></th>         
117
            <td><xsl:for-each select="data_problem">
118
                  <xsl:for-each select="paragraph">
119
                    <xsl:value-of select="."/><br/>
120
                  </xsl:for-each>
121
                </xsl:for-each></td>
122
          </tr>          
123

    
124
        </table>
125
  </xsl:template>
126

    
127
  <xsl:template match="meta_file_id">
128
    <table border="0" cellspacing="0" cellpadding="1">
129
      <tr>
130
        <td class="highlight">
131
          <b><xsl:text>Metadata File ID:</xsl:text></b>
132
        </td>
133
        <td>
134
          <xsl:value-of select="."/>
135
        </td>
136
      </tr>
137
    </table>
138
  </xsl:template>
139

    
140
  <xsl:template match="format">
141
    <xsl:choose>
142
       <xsl:when test="compressed">Compressed - <xsl:value-of select="compressed"/></xsl:when>
143
       <xsl:when test="encoded">Encoded - <xsl:value-of select="encoded"/></xsl:when>
144
       <xsl:when test="base_file_type/ASCII">ASCII file <xsl:value-of select="record_delimiter"/></xsl:when>
145
       <xsl:when test="base_file_type/binary">Binary file</xsl:when>
146
     </xsl:choose>
147
  </xsl:template>
148

    
149
  <xsl:template match="orientation">
150
    <xsl:choose>
151
      <xsl:when test="@columnorrow='columnmajor'">File column is major</xsl:when>
152
      <xsl:when test="@columnorrow='rowmajor'">File row is major</xsl:when>
153
     </xsl:choose>
154
  </xsl:template>
155

    
156
  <xsl:template match="case_sensitive">
157
    <xsl:choose>
158
      <xsl:when test="@yesorno='n'">No case sensitive fields</xsl:when>
159
      <xsl:when test="@yesorno='y'">Fields are case sensitive</xsl:when>
160
    </xsl:choose>
161
  </xsl:template>
162

    
163
  <xsl:template match="datetime">
164
    <xsl:value-of select="year"/><xsl:text>/</xsl:text>
165
    <xsl:value-of select="month"/><xsl:text>/</xsl:text>
166
    <xsl:value-of select="day"/><xsl:text> </xsl:text>
167
    <xsl:value-of select="hour"/><xsl:text>:</xsl:text>
168
    <xsl:value-of select="minute"/><xsl:text>:</xsl:text>
169
    <xsl:value-of select="second"/><xsl:text>:</xsl:text>
170
    <xsl:value-of select="second_fraction"/>
171
  </xsl:template>
172

    
173
</xsl:stylesheet> 
(2-2/6)