Project

General

Profile

1 38 jones
<?xml version="1.0"?>
2 39 jones
<!--
3 666 jones
  *  '$RCSfile$'
4 39 jones
  *      Authors: Matt Jones
5 666 jones
  *    Copyright: 2000 Regents of the University of California and the
6 39 jones
  *               National Center for Ecological Analysis and Synthesis
7
  *  For Details: http://www.nceas.ucsb.edu/
8 40 jones
  *
9 666 jones
  *   '$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 39 jones
  * 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-variable.dtd
29 40 jones
  * module of the Ecological Metadata Language (EML) into an HTML format
30 39 jones
  * suitable for rendering with modern web browsers.
31
-->
32 38 jones
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
33
34 64 bojilova
  <xsl:output method="html" encoding="iso-8859-1"/>
35 40 jones
36
  <xsl:template match="/">
37
    <html>
38
      <head>
39 506 jones
        <link rel="stylesheet" type="text/css"
40
              href="@web-base-url@/default.css" />
41 40 jones
      </head>
42 506 jones
      <body>
43 64 bojilova
        <center>
44 40 jones
          <h1>Attribute structure description</h1>
45
          <h3>Ecological Metadata Language</h3>
46
        </center>
47
48
        <xsl:apply-templates select="eml-variable/meta_file_id"/>
49
50
        <h3>Attributes in the Data Set:</h3>
51
        <table width="100%">
52 497 jones
        <tr>
53 506 jones
        <th class="tablehead"><xsl:text>Attribute Name</xsl:text></th>
54
        <th class="tablehead"><xsl:text>Attribute Definition</xsl:text></th>
55
        <th class="tablehead"><xsl:text>Unit</xsl:text></th>
56
        <th class="tablehead"><xsl:text>Type</xsl:text></th>
57
        <th class="tablehead"><xsl:text>Codes</xsl:text></th>
58
        <th class="tablehead"><xsl:text>Range</xsl:text></th>
59
        <th class="tablehead"><xsl:text>Missing</xsl:text></th>
60
        <th class="tablehead"><xsl:text>Precision</xsl:text></th>
61
        <th class="tablehead"><xsl:text>Format</xsl:text></th>
62 40 jones
        </tr>
63
64
        <xsl:for-each select="eml-variable/variable">
65
          <tr valign="top">
66
            <xsl:attribute name="class">
67
              <xsl:choose>
68 497 jones
                <xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
69
                <xsl:when test="position() mod 2 = 0">roweven</xsl:when>
70 40 jones
              </xsl:choose>
71
            </xsl:attribute>
72
73
          <td><b><xsl:value-of select="variable_name"/></b>
74 73 jones
              <xsl:text>&nbsp;</xsl:text></td>
75 40 jones
          <td><xsl:value-of select="variable_definition"/>
76 73 jones
              <xsl:text>&nbsp;</xsl:text></td>
77 40 jones
          <td><xsl:value-of select="unit"/>
78 73 jones
              <xsl:text>&nbsp;</xsl:text></td>
79 40 jones
          <td><xsl:value-of select="storage_type"/>
80 73 jones
              <xsl:text>&nbsp;</xsl:text></td>
81 40 jones
          <td><ul>
82
              <xsl:for-each select="code_definition">
83
                <li><xsl:value-of select="code"/>
84
                    <xsl:text> - </xsl:text>
85
                    <xsl:value-of select="definition"/>
86
                </li>
87
              </xsl:for-each>
88
              </ul>
89 73 jones
              <xsl:text>&nbsp;</xsl:text></td>
90 40 jones
          <td><ul>
91
              <xsl:for-each select="numeric_range">
92
                <li><xsl:value-of select="minimum"/>
93
                    <xsl:text> - </xsl:text>
94
                    <xsl:value-of select="maximum"/>
95
                </li>
96
              </xsl:for-each>
97
              </ul>
98 73 jones
              <xsl:text>&nbsp;</xsl:text></td>
99 40 jones
          <td><xsl:for-each select="missing_value_code">
100
                <xsl:value-of select="."/><br />
101
              </xsl:for-each>
102 73 jones
              <xsl:text>&nbsp;</xsl:text></td>
103 40 jones
          <td><xsl:value-of select="precision"/>
104 73 jones
              <xsl:text>&nbsp;</xsl:text></td>
105 40 jones
          <td><xsl:apply-templates select="field_format"/>
106 73 jones
              <xsl:text>&nbsp;</xsl:text></td>
107 40 jones
          </tr>
108
        </xsl:for-each>
109
        </table>
110
111
      </body>
112
    </html>
113
  </xsl:template>
114
115
  <xsl:template match="meta_file_id">
116
    <table>
117
      <tr>
118 497 jones
        <td class="highlight">
119 40 jones
           <b><xsl:text>Metadata File ID:</xsl:text></b>
120
        </td>
121
        <td>
122
            <xsl:value-of select="."/>
123
        </td>
124
      </tr>
125
    </table>
126
  </xsl:template>
127
128
  <xsl:template match="field_format">
129
    <xsl:apply-templates/>
130
  </xsl:template>
131
132
  <xsl:template match="variable_format">
133
    <xsl:text>Variable: </xsl:text>
134
  </xsl:template>
135
136
  <xsl:template match="delimiter">
137
    <xsl:text>Variable </xsl:text>
138
    <xsl:text>(</xsl:text>
139
    <xsl:value-of select="."/>
140
    <xsl:text>)</xsl:text>
141
  </xsl:template>
142
143
  <xsl:template match="fixed_format">
144
    <xsl:text>Fixed</xsl:text>
145
  </xsl:template>
146
147
  <xsl:template match="field_width">
148
    <xsl:text>Fixed </xsl:text>
149
    <xsl:text>(</xsl:text>
150
    <xsl:value-of select="."/>
151
    <xsl:text>)</xsl:text>
152
  </xsl:template>
153
154 73 jones
</xsl:stylesheet>