Project

General

Profile

« Previous | Next » 

Revision 40

Added by Matt Jones over 24 years ago

eliminated IE5 specific issues in eml-variable-display.xsl, modified format of display of eml-variable

View differences:

xsqltest/eml-variable-display.xsl
1 1
<?xml version="1.0"?>
2 2
<!--
3
  * eml-variable-display.xsl
3
  * eml-variable-display2.xsl
4 4
  *
5 5
  *      Authors: Matt Jones
6
  *    Copyright: 2000 Regents of the University of California and the
6
  *    Copyright: 2000 Regents of the University of California and the 
7 7
  *               National Center for Ecological Analysis and Synthesis
8 8
  *  For Details: http://www.nceas.ucsb.edu/
9 9
  *      Created: 2000 April 5
10 10
  *    File Info: '$Id$'
11
  * 
11
  *
12 12
  * This is an XSLT (http://www.w3.org/TR/xslt) stylesheet designed to
13 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
14
  * module of the Ecological Metadata Language (EML) into an HTML format 
15 15
  * suitable for rendering with modern web browsers.
16
  *
17
  ***                                                                       ***
18
  *** WARNING: THIS stylesheet was written for an early version if Internet ***
19
  *** Explorer 5, and DOES NOT COMPLY with the W3C XSLT standard.           ***
20
  ***                                                                       ***
21 16
-->
22 17
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
23
<HTML>
24
  <HEAD>
25
    <STYLE>
26
      BODY {margin:0}
27
      .bg {font:8pt Verdana; background-color:purple; color:white}
28
      H1 {font:bold 14pt Verdana; width:100%; margin-top:1em}
29
      .row {font:8pt Verdana; border-bottom:1px solid #CC88CC}
30
      .header {font:bold 9pt Verdana; cursor:hand; padding:2px; border:2px outset gray}
31
    </STYLE>
32
    <XML id="eml_variable">
33
      <xsl:apply-templates select="eml_variable">
34
        <xsl:template>
35
          <xsl:copy>
36
            <xsl:apply-templates select="@*"/>
37
            <xsl:apply-templates/>
38
          </xsl:copy>
39
        </xsl:template>
40
      </xsl:apply-templates>
41
    </XML>
42
    <XML id="sorted"><xsl:eval/></XML>
43
    <XML id="sortVars" src="eml-variable-sort.xsl"><xsl:eval/></XML>
44
  </HEAD>
45
  
46
  <SCRIPT><xsl:comment><![CDATA[
47
    function sort(field)
48
    {
49
      sortField.value=field;
50
	sorted.XMLDocument.loadXML(eml_variable.transformNode(sortVars.XMLDocument));
51
    }
52
  ]]></xsl:comment></SCRIPT>
53 18

  
54
  <SCRIPT for="window" event="onload"><xsl:comment><![CDATA[
55
    sortField = sortVars.selectSingleNode("//@order-by");
56
    sort("variable_name");
57
  ]]></xsl:comment></SCRIPT>
58
  
59
  <BODY>
60
    <TABLE width="100%" cellspacing="0">
61
      <TR><TD class="bg"/><TD class="bg"><H1>Variable listing for <U><xsl:value-of select="eml_variable/meta_file_id"/></U></H1></TD></TR>
62
      <TR>
63
        <TD class="bg" width="120" valign="top">
64
          <P>Click on the column headings to sort by that field.</P>
65
          <P>Note that sorting is by string value only and not numeric</P>
66
        </TD>
67
        <TD valign="top">
68
          <TABLE class="listing" datasrc="#sorted">
69
            <THEAD>
70
              <TD width="200"><DIV class="header" onClick="sort('variable_name')">Variable</DIV></TD>
71
              <TD width="80"><DIV class="header" onClick="sort('variable_definition')">Description</DIV></TD>
72
              <TD width="80"><DIV class="header" onClick="sort('storage_type')">Type</DIV></TD>
73
            </THEAD>
74
            <TR>
75
              <TD><DIV class="row" datafld="variable_name"><xsl:eval/></DIV></TD>
76
              <TD><DIV class="row" datafld="variable_definition"><xsl:eval/></DIV></TD>
77
              <TD><DIV class="row" datafld="storage_type" STYLE="text-align:right"><xsl:eval/></DIV></TD>
78
            </TR>
79
          </TABLE>
80
        </TD>
81
      </TR>
82
    </TABLE>    
83
  </BODY>
84
</HTML>
19
  <xsl:output method="html"/>
20

  
21
  <xsl:template match="/">
22
    <html>
23
      <head>
24
	<link rel="stylesheet" type="text/css" href="./rowcol.css" />
25
      </head>
26
      <body class="emlbody">
27
	<center>
28
          <h1>Attribute structure description</h1>
29
          <h3>Ecological Metadata Language</h3>
30
        </center>
31
        
32
        <xsl:apply-templates select="eml-variable/meta_file_id"/>
33

  
34
        <h3>Attributes in the Data Set:</h3>
35
        <table width="100%">
36
        <tr class="rowodd">
37
        <th><xsl:text>Attribute Name</xsl:text></th>
38
        <th><xsl:text>Attribute Definition</xsl:text></th>
39
        <th><xsl:text>Unit</xsl:text></th>
40
        <th><xsl:text>Type</xsl:text></th>
41
        <th><xsl:text>Codes</xsl:text></th>
42
        <th><xsl:text>Range</xsl:text></th>
43
        <th><xsl:text>Missing</xsl:text></th>
44
        <th><xsl:text>Precision</xsl:text></th>
45
        <th><xsl:text>Format</xsl:text></th>
46
        </tr>
47

  
48
        <xsl:for-each select="eml-variable/variable">
49
          <tr valign="top">
50
            <xsl:attribute name="class">
51
              <xsl:choose>
52
                <xsl:when test="position() mod 2 = 1">rowwhite</xsl:when>
53
                <xsl:when test="position() mod 2 = 0">rowlight</xsl:when>
54
              </xsl:choose>
55
            </xsl:attribute>
56

  
57
          <td><b><xsl:value-of select="variable_name"/></b>
58
              <xsl:text>&nbsp;</xsl:text></td>
59
          <td><xsl:value-of select="variable_definition"/>
60
              <xsl:text>&nbsp;</xsl:text></td>
61
          <td><xsl:value-of select="unit"/>
62
              <xsl:text>&nbsp;</xsl:text></td>
63
          <td><xsl:value-of select="storage_type"/>
64
              <xsl:text>&nbsp;</xsl:text></td>
65
          <td><ul>
66
              <xsl:for-each select="code_definition">
67
                <li><xsl:value-of select="code"/>
68
                    <xsl:text> - </xsl:text>
69
                    <xsl:value-of select="definition"/>
70
                </li>
71
              </xsl:for-each>
72
              </ul>
73
              <xsl:text>&nbsp;</xsl:text></td>
74
          <td><ul>
75
              <xsl:for-each select="numeric_range">
76
                <li><xsl:value-of select="minimum"/>
77
                    <xsl:text> - </xsl:text>
78
                    <xsl:value-of select="maximum"/>
79
                </li>
80
              </xsl:for-each>
81
              </ul>
82
              <xsl:text>&nbsp;</xsl:text></td>
83
          <td><xsl:for-each select="missing_value_code">
84
                <xsl:value-of select="."/><br />
85
              </xsl:for-each>
86
              <xsl:text>&nbsp;</xsl:text></td>
87
          <td><xsl:value-of select="precision"/>
88
              <xsl:text>&nbsp;</xsl:text></td>
89
          <td><xsl:apply-templates select="field_format"/>
90
              <xsl:text>&nbsp;</xsl:text></td>
91
          </tr>
92
        </xsl:for-each>
93
        </table>
94

  
95
      </body>
96
    </html>
97
  </xsl:template>
98

  
99
  <xsl:template match="meta_file_id">
100
    <table>
101
      <tr>
102
        <td class="shaded">
103
           <b><xsl:text>Metadata File ID:</xsl:text></b>
104
        </td>
105
        <td>
106
            <xsl:value-of select="."/>
107
        </td>
108
      </tr>
109
    </table>
110
  </xsl:template>
111

  
112
  <xsl:template match="field_format">
113
    <xsl:apply-templates/>
114
  </xsl:template>
115

  
116
  <xsl:template match="variable_format">
117
    <xsl:text>Variable: </xsl:text>
118
  </xsl:template>
119

  
120
  <xsl:template match="delimiter">
121
    <xsl:text>Variable </xsl:text>
122
    <xsl:text>(</xsl:text>
123
    <xsl:value-of select="."/>
124
    <xsl:text>)</xsl:text>
125
  </xsl:template>
126

  
127
  <xsl:template match="fixed_format">
128
    <xsl:text>Fixed</xsl:text>
129
  </xsl:template>
130

  
131
  <xsl:template match="field_width">
132
    <xsl:text>Fixed </xsl:text>
133
    <xsl:text>(</xsl:text>
134
    <xsl:value-of select="."/>
135
    <xsl:text>)</xsl:text>
136
  </xsl:template>
137

  
85 138
</xsl:stylesheet>
xsqltest/eml-variable2.xsql
1
<?xml version="1.0"?>
2
<!--
3
  * eml-variable.xsql
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 13
10
  *    File Info: '$Id$'
11
  * 
12
  * This is an XSQL (http://technet.oracle.com/tech/xml) document designed
13
  * to cause an XSLT (http://www.w3.org/TR/xslt) stylesheet transformation
14
  * for an XML document
15
-->
16
<?xml-stylesheet type="text/xsl" href="eml-variable-display.xsl"?>
17
<xsql:include-xsql href="eml-variable.xsql" xmlns:xsql="urn:oracle-xsql"/>
0 18

  
lib/style/eml-variable-display.xsl
1 1
<?xml version="1.0"?>
2 2
<!--
3
  * eml-variable-display.xsl
3
  * eml-variable-display2.xsl
4 4
  *
5 5
  *      Authors: Matt Jones
6
  *    Copyright: 2000 Regents of the University of California and the
6
  *    Copyright: 2000 Regents of the University of California and the 
7 7
  *               National Center for Ecological Analysis and Synthesis
8 8
  *  For Details: http://www.nceas.ucsb.edu/
9 9
  *      Created: 2000 April 5
10 10
  *    File Info: '$Id$'
11
  * 
11
  *
12 12
  * This is an XSLT (http://www.w3.org/TR/xslt) stylesheet designed to
13 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
14
  * module of the Ecological Metadata Language (EML) into an HTML format 
15 15
  * suitable for rendering with modern web browsers.
16
  *
17
  ***                                                                       ***
18
  *** WARNING: THIS stylesheet was written for an early version if Internet ***
19
  *** Explorer 5, and DOES NOT COMPLY with the W3C XSLT standard.           ***
20
  ***                                                                       ***
21 16
-->
22 17
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
23
<HTML>
24
  <HEAD>
25
    <STYLE>
26
      BODY {margin:0}
27
      .bg {font:8pt Verdana; background-color:purple; color:white}
28
      H1 {font:bold 14pt Verdana; width:100%; margin-top:1em}
29
      .row {font:8pt Verdana; border-bottom:1px solid #CC88CC}
30
      .header {font:bold 9pt Verdana; cursor:hand; padding:2px; border:2px outset gray}
31
    </STYLE>
32
    <XML id="eml_variable">
33
      <xsl:apply-templates select="eml_variable">
34
        <xsl:template>
35
          <xsl:copy>
36
            <xsl:apply-templates select="@*"/>
37
            <xsl:apply-templates/>
38
          </xsl:copy>
39
        </xsl:template>
40
      </xsl:apply-templates>
41
    </XML>
42
    <XML id="sorted"><xsl:eval/></XML>
43
    <XML id="sortVars" src="eml-variable-sort.xsl"><xsl:eval/></XML>
44
  </HEAD>
45
  
46
  <SCRIPT><xsl:comment><![CDATA[
47
    function sort(field)
48
    {
49
      sortField.value=field;
50
	sorted.XMLDocument.loadXML(eml_variable.transformNode(sortVars.XMLDocument));
51
    }
52
  ]]></xsl:comment></SCRIPT>
53 18

  
54
  <SCRIPT for="window" event="onload"><xsl:comment><![CDATA[
55
    sortField = sortVars.selectSingleNode("//@order-by");
56
    sort("variable_name");
57
  ]]></xsl:comment></SCRIPT>
58
  
59
  <BODY>
60
    <TABLE width="100%" cellspacing="0">
61
      <TR><TD class="bg"/><TD class="bg"><H1>Variable listing for <U><xsl:value-of select="eml_variable/meta_file_id"/></U></H1></TD></TR>
62
      <TR>
63
        <TD class="bg" width="120" valign="top">
64
          <P>Click on the column headings to sort by that field.</P>
65
          <P>Note that sorting is by string value only and not numeric</P>
66
        </TD>
67
        <TD valign="top">
68
          <TABLE class="listing" datasrc="#sorted">
69
            <THEAD>
70
              <TD width="200"><DIV class="header" onClick="sort('variable_name')">Variable</DIV></TD>
71
              <TD width="80"><DIV class="header" onClick="sort('variable_definition')">Description</DIV></TD>
72
              <TD width="80"><DIV class="header" onClick="sort('storage_type')">Type</DIV></TD>
73
            </THEAD>
74
            <TR>
75
              <TD><DIV class="row" datafld="variable_name"><xsl:eval/></DIV></TD>
76
              <TD><DIV class="row" datafld="variable_definition"><xsl:eval/></DIV></TD>
77
              <TD><DIV class="row" datafld="storage_type" STYLE="text-align:right"><xsl:eval/></DIV></TD>
78
            </TR>
79
          </TABLE>
80
        </TD>
81
      </TR>
82
    </TABLE>    
83
  </BODY>
84
</HTML>
19
  <xsl:output method="html"/>
20

  
21
  <xsl:template match="/">
22
    <html>
23
      <head>
24
	<link rel="stylesheet" type="text/css" href="./rowcol.css" />
25
      </head>
26
      <body class="emlbody">
27
	<center>
28
          <h1>Attribute structure description</h1>
29
          <h3>Ecological Metadata Language</h3>
30
        </center>
31
        
32
        <xsl:apply-templates select="eml-variable/meta_file_id"/>
33

  
34
        <h3>Attributes in the Data Set:</h3>
35
        <table width="100%">
36
        <tr class="rowodd">
37
        <th><xsl:text>Attribute Name</xsl:text></th>
38
        <th><xsl:text>Attribute Definition</xsl:text></th>
39
        <th><xsl:text>Unit</xsl:text></th>
40
        <th><xsl:text>Type</xsl:text></th>
41
        <th><xsl:text>Codes</xsl:text></th>
42
        <th><xsl:text>Range</xsl:text></th>
43
        <th><xsl:text>Missing</xsl:text></th>
44
        <th><xsl:text>Precision</xsl:text></th>
45
        <th><xsl:text>Format</xsl:text></th>
46
        </tr>
47

  
48
        <xsl:for-each select="eml-variable/variable">
49
          <tr valign="top">
50
            <xsl:attribute name="class">
51
              <xsl:choose>
52
                <xsl:when test="position() mod 2 = 1">rowwhite</xsl:when>
53
                <xsl:when test="position() mod 2 = 0">rowlight</xsl:when>
54
              </xsl:choose>
55
            </xsl:attribute>
56

  
57
          <td><b><xsl:value-of select="variable_name"/></b>
58
              <xsl:text>&nbsp;</xsl:text></td>
59
          <td><xsl:value-of select="variable_definition"/>
60
              <xsl:text>&nbsp;</xsl:text></td>
61
          <td><xsl:value-of select="unit"/>
62
              <xsl:text>&nbsp;</xsl:text></td>
63
          <td><xsl:value-of select="storage_type"/>
64
              <xsl:text>&nbsp;</xsl:text></td>
65
          <td><ul>
66
              <xsl:for-each select="code_definition">
67
                <li><xsl:value-of select="code"/>
68
                    <xsl:text> - </xsl:text>
69
                    <xsl:value-of select="definition"/>
70
                </li>
71
              </xsl:for-each>
72
              </ul>
73
              <xsl:text>&nbsp;</xsl:text></td>
74
          <td><ul>
75
              <xsl:for-each select="numeric_range">
76
                <li><xsl:value-of select="minimum"/>
77
                    <xsl:text> - </xsl:text>
78
                    <xsl:value-of select="maximum"/>
79
                </li>
80
              </xsl:for-each>
81
              </ul>
82
              <xsl:text>&nbsp;</xsl:text></td>
83
          <td><xsl:for-each select="missing_value_code">
84
                <xsl:value-of select="."/><br />
85
              </xsl:for-each>
86
              <xsl:text>&nbsp;</xsl:text></td>
87
          <td><xsl:value-of select="precision"/>
88
              <xsl:text>&nbsp;</xsl:text></td>
89
          <td><xsl:apply-templates select="field_format"/>
90
              <xsl:text>&nbsp;</xsl:text></td>
91
          </tr>
92
        </xsl:for-each>
93
        </table>
94

  
95
      </body>
96
    </html>
97
  </xsl:template>
98

  
99
  <xsl:template match="meta_file_id">
100
    <table>
101
      <tr>
102
        <td class="shaded">
103
           <b><xsl:text>Metadata File ID:</xsl:text></b>
104
        </td>
105
        <td>
106
            <xsl:value-of select="."/>
107
        </td>
108
      </tr>
109
    </table>
110
  </xsl:template>
111

  
112
  <xsl:template match="field_format">
113
    <xsl:apply-templates/>
114
  </xsl:template>
115

  
116
  <xsl:template match="variable_format">
117
    <xsl:text>Variable: </xsl:text>
118
  </xsl:template>
119

  
120
  <xsl:template match="delimiter">
121
    <xsl:text>Variable </xsl:text>
122
    <xsl:text>(</xsl:text>
123
    <xsl:value-of select="."/>
124
    <xsl:text>)</xsl:text>
125
  </xsl:template>
126

  
127
  <xsl:template match="fixed_format">
128
    <xsl:text>Fixed</xsl:text>
129
  </xsl:template>
130

  
131
  <xsl:template match="field_width">
132
    <xsl:text>Fixed </xsl:text>
133
    <xsl:text>(</xsl:text>
134
    <xsl:value-of select="."/>
135
    <xsl:text>)</xsl:text>
136
  </xsl:template>
137

  
85 138
</xsl:stylesheet>

Also available in: Unified diff