Project

General

Profile

1 57 bojilova
<?xml version="1.0"?>
2
<!--
3 666 jones
  *  '$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$'
10
  *     '$Date$'
11
  * '$Revision$'
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 57 bojilova
-->
32 63 bojilova
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
33 57 bojilova
34 63 bojilova
  <xsl:output method="html" encoding="iso-8859-1"/>
35 57 bojilova
  <xsl:template match="/">
36
    <html>
37
      <head>
38 506 jones
        <link rel="stylesheet" type="text/css"
39 827 jones
              href="@style-path@/default.css" />
40 57 bojilova
      </head>
41 506 jones
      <body>
42 57 bojilova
        <center>
43 61 bojilova
          <h2>File structure description</h2>
44
          <h4>Ecological Metadata Language</h4>
45 57 bojilova
        </center>
46
        <xsl:apply-templates select="eml-file/meta_file_id"/>
47 506 jones
        <table width="750" border="0" cellspacing="0" cellpadding="1" class="tablehead">
48 61 bojilova
	  <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 497 jones
	<table width="750" border="1" cellspacing="0" cellpadding="1">
61 61 bojilova
          <tr>
62 62 bojilova
            <th width="25%" align="left"><xsl:text>File Name</xsl:text></th>
63
            <td><xsl:value-of select="file_name"/>
64 63 bojilova
                <xsl:text>&nbsp;</xsl:text></td>
65 57 bojilova
          </tr>
66 61 bojilova
          <tr>
67 62 bojilova
            <th align="left"><xsl:text>File Size</xsl:text></th>
68
            <td>
69 61 bojilova
		<xsl:value-of select="file_size/amount"/>
70
                <xsl:value-of select="file_size/unit"/>
71 63 bojilova
                <xsl:text>&nbsp;</xsl:text></td>
72 61 bojilova
          </tr>
73
          <tr>
74 62 bojilova
            <th align="left"><xsl:text>File Format</xsl:text></th>
75
            <td><xsl:apply-templates select="format"/>
76 63 bojilova
                <xsl:text>&nbsp;</xsl:text></td>
77 61 bojilova
          </tr>
78
          <tr>
79 62 bojilova
            <th align="left"><xsl:text>Orientation</xsl:text></th>
80
            <td><xsl:apply-templates select="orientation"/>
81 63 bojilova
                <xsl:text>&nbsp;</xsl:text></td>
82 61 bojilova
          </tr>
83
          <tr>
84 62 bojilova
            <th align="left"><xsl:text>Header Lines</xsl:text></th>
85
            <td><xsl:value-of select="header_lines"/>
86 63 bojilova
                <xsl:text>&nbsp;</xsl:text></td>
87 61 bojilova
          </tr>
88
          <tr>
89 62 bojilova
            <th align="left"><xsl:text>Case Sensitive</xsl:text></th>
90
            <td><xsl:apply-templates select="case_sensitive"/>
91 63 bojilova
                <xsl:text>&nbsp;</xsl:text></td>
92 61 bojilova
          </tr>
93
          <tr>
94 62 bojilova
            <th align="left"><xsl:text>Geographic Coverage</xsl:text></th>
95
            <td>
96 61 bojilova
		<xsl:if test="geographic_coverage/paragraph/text() or geographic_coverage/coordinates/lattitude/text() or geographic_coverage/coordinates/longitude/text()"><ul>
97 57 bojilova
                <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 61 bojilova
                      <xsl:value-of select="lattitude"/>la -
103
                      <xsl:value-of select="longitude"/>lo<br/>
104 57 bojilova
                    </xsl:for-each>
105
                </li>
106
                </xsl:for-each>
107 61 bojilova
                </ul></xsl:if>
108 63 bojilova
                <xsl:text>&nbsp;</xsl:text></td>
109 61 bojilova
          </tr>
110
          <tr>
111 62 bojilova
            <th align="left"><xsl:text>Temporal Coverage</xsl:text></th>
112
            <td>
113 61 bojilova
		<xsl:if test="temporal_coverage/*/*/*/text()"><ul>
114 57 bojilova
                <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 61 bojilova
                </ul></xsl:if>
122 63 bojilova
                <xsl:text>&nbsp;</xsl:text></td>
123 61 bojilova
          </tr>
124
          <tr>
125 62 bojilova
            <th align="left"><xsl:text>Authentication</xsl:text></th>
126
            <td><xsl:for-each select="authentication">
127 63 bojilova
                  <xsl:value-of select="."/><br/>
128
                </xsl:for-each></td>
129 61 bojilova
          </tr>
130
          <tr>
131 62 bojilova
            <th align="left"><xsl:text>Data Problem</xsl:text></th>
132
            <td><xsl:for-each select="data_problem">
133 61 bojilova
                  <xsl:for-each select="paragraph">
134 57 bojilova
                    <xsl:value-of select="."/><br/>
135
                  </xsl:for-each>
136 63 bojilova
                </xsl:for-each></td>
137 61 bojilova
          </tr>
138
139 57 bojilova
        </table>
140
  </xsl:template>
141
142
  <xsl:template match="meta_file_id">
143 61 bojilova
    <table border="0" cellspacing="0" cellpadding="1">
144 57 bojilova
      <tr>
145 497 jones
        <td class="highlight">
146 57 bojilova
          <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 95 jones
</xsl:stylesheet>