Project

General

Profile

1
<?xml version="1.0"?> 
2
<!--   
3
* eml-file-display.xsl   
4
*   
5
*      Authors: Matt Jones   
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 57 2000-04-18 18:44:11Z bojilova $'   
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-variable.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"/>
20
  <xsl:template match="/">
21
    <html>       
22
      <head> 	
23
        <link rel="stylesheet" type="text/css" href="./rowcol.css" />
24
      </head>   
25
      <body class="emlbody"> 	
26
        <center>           
27
          <h1>File structure description</h1>           
28
          <h3>Ecological Metadata Language</h3>         
29
        </center>
30
        <xsl:apply-templates select="eml-file/meta_file_id"/>          
31
        <h3>Files in the Data Set:</h3>         
32
        <table width="100%">         
33
          <tr class="rowodd">         
34
            <th><xsl:text>File Name</xsl:text></th>         
35
            <th><xsl:text>File Size</xsl:text></th>         
36
            <th><xsl:text>File Format</xsl:text></th>         
37
            <th><xsl:text>Orientation</xsl:text></th>         
38
            <th><xsl:text>Header Lines</xsl:text></th>         
39
            <th><xsl:text>Case Sensitive</xsl:text></th>         
40
            <th><xsl:text>Geographic Coverage</xsl:text></th>         
41
            <th><xsl:text>Temporal Coverage</xsl:text></th>         
42
            <th><xsl:text>Authentication</xsl:text></th>         
43
            <th><xsl:text>Data Problem</xsl:text></th>         
44
          </tr>          
45

    
46
          <xsl:for-each select="eml-file/file">           
47
          <tr valign="top">             
48
            <xsl:attribute name="class">               
49
              <xsl:choose>                 
50
                <xsl:when test="position() mod 2 = 1">rowwhite</xsl:when>                
51
                <xsl:when test="position() mod 2 = 0">rowlight</xsl:when>               
52
              </xsl:choose>             
53
            </xsl:attribute>            
54
            <td><b><xsl:value-of select="file_name"/></b>               
55
                <xsl:text><![CDATA[&nbsp;]]></xsl:text></td>           
56
            <td><xsl:value-of select="file_size/amount"/>
57
                <xsl:value-of select="file_size/unit"/>               
58
                <xsl:text><![CDATA[&nbsp;]]></xsl:text></td>           
59
            <td><xsl:apply-templates select="format"/>               
60
                <xsl:text><![CDATA[&nbsp;]]></xsl:text></td>           
61
            <td><xsl:apply-templates select="orientation"/>               
62
                <xsl:text><![CDATA[&nbsp;]]></xsl:text></td>           
63
            <td><xsl:value-of select="header_lines"/>               
64
                <xsl:text><![CDATA[&nbsp;]]></xsl:text></td>           
65
            <td><xsl:apply_templates select="case_sensitive"/>               
66
                <xsl:text><![CDATA[&nbsp;]]></xsl:text></td>           
67
            <td><ul>               
68
                <xsl:for-each select="geographic_coverage">
69
                <li><xsl:for-each select="paragraph">
70
                      <xsl:value-of select="."/><br/>
71
                    </xsl:for-each>                     
72
                    <xsl:for-each select="coordinates">                        
73
                      <xsl:value-of select="lattitude"/>                        
74
                      <xsl:value-of select="longitude"/><br/>
75
                    </xsl:for-each>                 
76
                </li>               
77
                </xsl:for-each>               
78
                </ul>               
79
                <xsl:text><![CDATA[&nbsp;]]></xsl:text></td>           
80
            <td><ul>               
81
                <xsl:for-each select="temporal_coverage">                 
82
                <li><xsl:text>Start Date </xsl:text>
83
                    <xsl:apply-templates select="start_date/datetime"/> 
84
                    <xsl:text> - Stop Date </xsl:text>
85
                    <xsl:apply-templates select="stop_date/datetime"/>
86
                </li>
87
                </xsl:for-each>
88
                </ul>
89
                <xsl:text><![CDATA[&nbsp;]]></xsl:text></td>
90
            <td><xsl:for-each select="authentication">
91
                <xsl:value-of select="."/><br />
92
                </xsl:for-each>
93
                <xsl:text><![CDATA[&nbsp;]]></xsl:text></td>
94
            <td><xsl:for-each select="data_problem">
95
                  <xsl:for-each select="paragraph"/>
96
                    <xsl:value-of select="."/><br/>
97
                  </xsl:for-each>
98
                </xsl:for-each>
99
                <xsl:text><![CDATA[&nbsp;]]></xsl:text></td>
100
          </tr>
101
          </xsl:for-each>
102
        </table>
103
      </body>
104
    </html>
105
  </xsl:template>
106

    
107
  <xsl:template match="meta_file_id">
108
    <table>
109
      <tr>
110
        <td class="shaded">
111
          <b><xsl:text>Metadata File ID:</xsl:text></b>
112
        </td>
113
        <td>
114
          <xsl:value-of select="."/>
115
        </td>
116
      </tr>
117
    </table>
118
  </xsl:template>
119

    
120
  <xsl:template match="format">
121
    <xsl:choose>
122
       <xsl:when test="compressed">Compressed - <xsl:value-of select="compressed"/></xsl:when>
123
       <xsl:when test="encoded">Encoded - <xsl:value-of select="encoded"/></xsl:when>
124
       <xsl:when test="base_file_type/ASCII">ASCII file <xsl:value-of select="record_delimiter"/></xsl:when>
125
       <xsl:when test="base_file_type/binary">Binary file</xsl:when>
126
     </xsl:choose>
127
  </xsl:template>
128

    
129
  <xsl:template match="orientation">
130
    <xsl:choose>
131
      <xsl:when test="@columnorrow='columnmajor'">File column is major</xsl:when>
132
      <xsl:when test="@columnorrow='rowmajor'">File row is major</xsl:when>
133
     </xsl:choose>
134
  </xsl:template>
135

    
136
  <xsl:template match="case_sensitive">
137
    <xsl:choose>
138
      <xsl:when test="@yesorno='n'">No case sensitive fields</xsl:when>
139
      <xsl:when test="@yesorno='y'">Fields are case sensitive</xsl:when>
140
    </xsl:choose>
141
  </xsl:template>
142

    
143
  <xsl:template match="datetime">
144
    <xsl:value-of select="year"/><xsl:text>/</xsl:text>
145
    <xsl:value-of select="month"/><xsl:text>/</xsl:text>
146
    <xsl:value-of select="day"/><xsl:text> </xsl:text>
147
    <xsl:value-of select="hour"/><xsl:text>:</xsl:text>
148
    <xsl:value-of select="minute"/><xsl:text>:</xsl:text>
149
    <xsl:value-of select="second"/><xsl:text>:</xsl:text>
150
    <xsl:value-of select="second_fraction"/>
151
  </xsl:template>
152

    
153
</xsl:stylesheet> 
(10-10/24)