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 365 2000-08-15 21:52:10Z 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" href="@html-path@/style/rowcol.css" />
24
      </head>   
25
      <body class="emlbody"> 	
26
        <center>           
27
          <h2>File structure description</h2>           
28
          <h4>Ecological Metadata Language</h4>         
29
        </center>
30
        <xsl:apply-templates select="eml-file/meta_file_id"/>          
31
        <table width="750" border="0" cellspacing="0" cellpadding="1" bgcolor="#C0D3E7">
32
	  <tr>
33
	    <td><b>Data Set File</b></td>
34
	  </tr>
35
	</table>         
36
        <xsl:apply-templates select="eml-file/file"/>          
37

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

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

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

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

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

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

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

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

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

    
172
</xsl:stylesheet> 
(2-2/5)