Project

General

Profile

1 57 bojilova
<?xml version="1.0"?>
2
<!--
3
* eml-file-display.xsl
4
*
5 61 bojilova
*      Authors: Jivka Bojilova
6 57 bojilova
*    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$'
11
*
12
* This is an XSLT (http://www.w3.org/TR/xslt) stylesheet designed to
13 61 bojilova
* convert an XML file that is valid with respect to the eml-file.dtd
14 57 bojilova
* module of the Ecological Metadata Language (EML) into an HTML format
15
* suitable for rendering with modern web browsers.
16
-->
17 63 bojilova
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
18 57 bojilova
19 63 bojilova
  <xsl:output method="html" encoding="iso-8859-1"/>
20 57 bojilova
  <xsl:template match="/">
21
    <html>
22
      <head>
23 506 jones
        <link rel="stylesheet" type="text/css"
24
              href="@web-base-url@/default.css" />
25 57 bojilova
      </head>
26 506 jones
      <body>
27 57 bojilova
        <center>
28 61 bojilova
          <h2>File structure description</h2>
29
          <h4>Ecological Metadata Language</h4>
30 57 bojilova
        </center>
31
        <xsl:apply-templates select="eml-file/meta_file_id"/>
32 506 jones
        <table width="750" border="0" cellspacing="0" cellpadding="1" class="tablehead">
33 61 bojilova
	  <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 497 jones
	<table width="750" border="1" cellspacing="0" cellpadding="1">
46 61 bojilova
          <tr>
47 62 bojilova
            <th width="25%" align="left"><xsl:text>File Name</xsl:text></th>
48
            <td><xsl:value-of select="file_name"/>
49 63 bojilova
                <xsl:text>&nbsp;</xsl:text></td>
50 57 bojilova
          </tr>
51 61 bojilova
          <tr>
52 62 bojilova
            <th align="left"><xsl:text>File Size</xsl:text></th>
53
            <td>
54 61 bojilova
		<xsl:value-of select="file_size/amount"/>
55
                <xsl:value-of select="file_size/unit"/>
56 63 bojilova
                <xsl:text>&nbsp;</xsl:text></td>
57 61 bojilova
          </tr>
58
          <tr>
59 62 bojilova
            <th align="left"><xsl:text>File Format</xsl:text></th>
60
            <td><xsl:apply-templates select="format"/>
61 63 bojilova
                <xsl:text>&nbsp;</xsl:text></td>
62 61 bojilova
          </tr>
63
          <tr>
64 62 bojilova
            <th align="left"><xsl:text>Orientation</xsl:text></th>
65
            <td><xsl:apply-templates select="orientation"/>
66 63 bojilova
                <xsl:text>&nbsp;</xsl:text></td>
67 61 bojilova
          </tr>
68
          <tr>
69 62 bojilova
            <th align="left"><xsl:text>Header Lines</xsl:text></th>
70
            <td><xsl:value-of select="header_lines"/>
71 63 bojilova
                <xsl:text>&nbsp;</xsl:text></td>
72 61 bojilova
          </tr>
73
          <tr>
74 62 bojilova
            <th align="left"><xsl:text>Case Sensitive</xsl:text></th>
75
            <td><xsl:apply-templates select="case_sensitive"/>
76 63 bojilova
                <xsl:text>&nbsp;</xsl:text></td>
77 61 bojilova
          </tr>
78
          <tr>
79 62 bojilova
            <th align="left"><xsl:text>Geographic Coverage</xsl:text></th>
80
            <td>
81 61 bojilova
		<xsl:if test="geographic_coverage/paragraph/text() or geographic_coverage/coordinates/lattitude/text() or geographic_coverage/coordinates/longitude/text()"><ul>
82 57 bojilova
                <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 61 bojilova
                      <xsl:value-of select="lattitude"/>la -
88
                      <xsl:value-of select="longitude"/>lo<br/>
89 57 bojilova
                    </xsl:for-each>
90
                </li>
91
                </xsl:for-each>
92 61 bojilova
                </ul></xsl:if>
93 63 bojilova
                <xsl:text>&nbsp;</xsl:text></td>
94 61 bojilova
          </tr>
95
          <tr>
96 62 bojilova
            <th align="left"><xsl:text>Temporal Coverage</xsl:text></th>
97
            <td>
98 61 bojilova
		<xsl:if test="temporal_coverage/*/*/*/text()"><ul>
99 57 bojilova
                <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 61 bojilova
                </ul></xsl:if>
107 63 bojilova
                <xsl:text>&nbsp;</xsl:text></td>
108 61 bojilova
          </tr>
109
          <tr>
110 62 bojilova
            <th align="left"><xsl:text>Authentication</xsl:text></th>
111
            <td><xsl:for-each select="authentication">
112 63 bojilova
                  <xsl:value-of select="."/><br/>
113
                </xsl:for-each></td>
114 61 bojilova
          </tr>
115
          <tr>
116 62 bojilova
            <th align="left"><xsl:text>Data Problem</xsl:text></th>
117
            <td><xsl:for-each select="data_problem">
118 61 bojilova
                  <xsl:for-each select="paragraph">
119 57 bojilova
                    <xsl:value-of select="."/><br/>
120
                  </xsl:for-each>
121 63 bojilova
                </xsl:for-each></td>
122 61 bojilova
          </tr>
123
124 57 bojilova
        </table>
125
  </xsl:template>
126
127
  <xsl:template match="meta_file_id">
128 61 bojilova
    <table border="0" cellspacing="0" cellpadding="1">
129 57 bojilova
      <tr>
130 497 jones
        <td class="highlight">
131 57 bojilova
          <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 95 jones
</xsl:stylesheet>