Project

General

Profile

1
<?xml version="1.0"?> 
2
<!--   
3
  *  '$RCSfile$'
4
  *      Authors: Jivka Bojilova
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: jones $'
10
  *     '$Date: 2001-01-18 11:02:14 -0800 (Thu, 18 Jan 2001) $'
11
  * '$Revision: 666 $'
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-file.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
  <xsl:template match="/">
36
    <html>       
37
      <head> 	
38
        <link rel="stylesheet" type="text/css" 
39
              href="@web-base-url@/default.css" />
40
      </head>   
41
      <body> 	
42
        <center>           
43
          <h2>File structure description</h2>           
44
          <h4>Ecological Metadata Language</h4>         
45
        </center>
46
        <xsl:apply-templates select="eml-file/meta_file_id"/>          
47
        <table width="750" border="0" cellspacing="0" cellpadding="1" class="tablehead">
48
	  <tr>
49
	    <td><b>Data Set File</b></td>
50
	  </tr>
51
	</table>         
52
        <xsl:apply-templates select="eml-file/file"/>          
53

    
54
      </body>
55
    </html>
56
  </xsl:template>
57

    
58
  <xsl:template match="file">
59

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

    
139
        </table>
140
  </xsl:template>
141

    
142
  <xsl:template match="meta_file_id">
143
    <table border="0" cellspacing="0" cellpadding="1">
144
      <tr>
145
        <td class="highlight">
146
          <b><xsl:text>Metadata File ID:</xsl:text></b>
147
        </td>
148
        <td>
149
          <xsl:value-of select="."/>
150
        </td>
151
      </tr>
152
    </table>
153
  </xsl:template>
154

    
155
  <xsl:template match="format">
156
    <xsl:choose>
157
       <xsl:when test="compressed">Compressed - <xsl:value-of select="compressed"/></xsl:when>
158
       <xsl:when test="encoded">Encoded - <xsl:value-of select="encoded"/></xsl:when>
159
       <xsl:when test="base_file_type/ASCII">ASCII file <xsl:value-of select="record_delimiter"/></xsl:when>
160
       <xsl:when test="base_file_type/binary">Binary file</xsl:when>
161
     </xsl:choose>
162
  </xsl:template>
163

    
164
  <xsl:template match="orientation">
165
    <xsl:choose>
166
      <xsl:when test="@columnorrow='columnmajor'">File column is major</xsl:when>
167
      <xsl:when test="@columnorrow='rowmajor'">File row is major</xsl:when>
168
     </xsl:choose>
169
  </xsl:template>
170

    
171
  <xsl:template match="case_sensitive">
172
    <xsl:choose>
173
      <xsl:when test="@yesorno='n'">No case sensitive fields</xsl:when>
174
      <xsl:when test="@yesorno='y'">Fields are case sensitive</xsl:when>
175
    </xsl:choose>
176
  </xsl:template>
177

    
178
  <xsl:template match="datetime">
179
    <xsl:value-of select="year"/><xsl:text>/</xsl:text>
180
    <xsl:value-of select="month"/><xsl:text>/</xsl:text>
181
    <xsl:value-of select="day"/><xsl:text> </xsl:text>
182
    <xsl:value-of select="hour"/><xsl:text>:</xsl:text>
183
    <xsl:value-of select="minute"/><xsl:text>:</xsl:text>
184
    <xsl:value-of select="second"/><xsl:text>:</xsl:text>
185
    <xsl:value-of select="second_fraction"/>
186
  </xsl:template>
187

    
188
</xsl:stylesheet> 
(3-3/8)