Project

General

Profile

« Previous | Next » 

Revision 365

Added by Matt Jones over 24 years ago

Repository reorganization, and some file cleanup to make the XSL and CSS
files portable to various installations of metacat (by using the
build.xml file substitution in the XSL files). Removed "xsqltest" directory
because it is no longer needed. Created new "style" directory inside of
"lib" to contain all stylesheets.

View differences:

xsqltest/eml-file2.xsql
1
<?xml version="1.0"?>
2
<!--
3
  * eml-file.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-file-display.xsl"?><xsql:include-xsql href="eml-file.xsql" xmlns:xsql="urn:oracle-xsql"/>
17 0

  
xsqltest/eml-file-display.xsl
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$'   
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="/xmltodb/xsqltest/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> 
173 0

  
xsqltest/eml-dataset1-xsql.xml
1
<?xml version="1.0"?>
2
<!--
3
  * eml-dataset1.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 5
10
  *      Version: 0.01
11
  *    File Info: '$Id$'
12
  * 
13
  * This is an XSQL (http://technet.oracle.com/tech/xml) document designed
14
  * to query a relational database and return the result as a well-formed
15
  * XML document that contains the information necessary to transform the
16
  * document into the eml-dataset.dtd module of the Ecological Metadata
17
  * Language (EML)
18
-->
19
<eml-dataset connection="demo" xmlns:xsql="urn:oracle-xsql">
20

  
21
<xsql:query tag-case="lower" 
22
            rowset-element="" 
23
            row-element="" 
24
            id-attribute="">
25

  
26
  SELECT meta_file_id,dataset_id,title FROM eml_dataset
27
   WHERE meta_file_id = '{@meta_file_id}'
28

  
29
</xsql:query>
30

  
31
<xsql:query tag-case="lower" 
32
            row-element="originator" 
33
            rowset-element="" 
34
            id-attribute="">
35

  
36
  SELECT p.party_org, pi.salutation, pi.given_name, pi.surname, pi.jobtitle, 
37
         ma.address, ma.city, ma.admin_area, ma.postal_code, ma.country,
38
         ma.resource_url, ma.email, ma.work_phone, ma.home_phone, ma.fax,
39
         ma.tdd_phone 
40
    FROM party p, party_individual pi, meta_address ma
41
   WHERE p.party_individual_id = pi.party_individual_id
42
     AND p.meta_address_id = ma.meta_address_id
43
     AND p.meta_file_id = '{@meta_file_id}'
44

  
45
</xsql:query>
46

  
47
<xsql:query tag-case="lower" 
48
            rowset-element="" 
49
            row-element="" 
50
            id-attribute="">
51

  
52
  SELECT abstract FROM eml_dataset
53
   WHERE meta_file_id = '{@meta_file_id}'
54

  
55
</xsql:query>
56

  
57
<xsql:query tag-case="lower" 
58
            row-element="keyword_info" 
59
            rowset-element="" 
60
            id-attribute="">
61

  
62
  SELECT keyword, keyword_type, keyword_thesaurus
63
    FROM keyword_info
64
   WHERE meta_file_id = '{@meta_file_id}'
65

  
66
</xsql:query>
67

  
68
</eml-dataset>
69 0

  
xsqltest/eml-dataset.xsl
1
<?xml version="1.0"?>
2
<!--
3
  * eml-dataset.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 5
10
  *      Version: 0.01
11
  *    File Info: '$Id$'
12
  * 
13
  * This is an XSLT (http://www.w3.org/TR/xslt) stylesheet designed to
14
  * convert an XML file that is the result of a SQL query using Oracle's
15
  * XSQL tool to another XML file that is valid with respect to the 
16
  * eml-dataset.dtd module of Ecological Metadata Language (EML)
17
-->
18
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
19

  
20
  <xsl:template match="/">
21
    <?xml-stylesheet type="text/xsl" href="eml-dataset-display.xsl"?>
22
    <eml-dataset>
23
      <xsl:apply-templates/>      
24
    </eml-dataset>
25
  </xsl:template>
26

  
27
  <xsl:template match="originator">
28
    <originator>
29
      <xsl:choose>
30
      <xsl:when test="party_org">
31
          <party><party_org><xsl:value-of select="."/></party_org></party>
32
      </xsl:when>
33
        <xsl:otherwise>
34
          <party>
35
            <party_individual>
36
              <xsl:for-each select="salutation|given_name|surname|jobtitle">
37
                 <xsl:copy-of select="."/>
38
              </xsl:for-each>
39
            </party_individual>
40
          </party>
41
        </xsl:otherwise>
42
      </xsl:choose>
43
      <meta_address>
44
        <xsl:for-each select="address|city|admin_area|postal_code|country|resource_url|email|work_phone|home_phone|fax|tdd_phone">
45
           <xsl:copy-of select="."/>
46
        </xsl:for-each>
47
      </meta_address>
48
    </originator> 
49
  </xsl:template>
50

  
51
  <xsl:template match="meta_file_id|dataset_id|title|abstract|keyword_info">
52
    <xsl:copy-of select="."/>
53
  </xsl:template>
54

  
55
</xsl:stylesheet>
56 0

  
xsqltest/xmltest2-xsql.xml
1
<?xml version="1.0"?>
2
<!--
3
  * xmltest2.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 5
10
  *      Version: 0.01
11
  *    File Info: '$Id$'
12
  * 
13
  * This is an XSQL (http://technet.oracle.com/tech/xml) document designed
14
  * to query a relational database and return the result as a well-formed
15
  * XML document.
16
-->
17
<page connection="demo" xmlns:xsql="urn:oracle-xsql">
18
<xsql:query>
19

  
20
  SELECT * FROM xmltest ORDER BY docid
21

  
22
</xsql:query>
23
</page>
24 0

  
xsqltest/eml-dataset1.xsql
1
<?xml version="1.0"?>
2
<!--
3
  * eml-dataset1.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 5
10
  *      Version: 0.01
11
  *    File Info: '$Id$'
12
  * 
13
  * This is an XSQL (http://technet.oracle.com/tech/xml) document designed
14
  * to query a relational database and return the result as a well-formed
15
  * XML document that contains the information necessary to transform the
16
  * document into the eml-dataset.dtd module of the Ecological Metadata
17
  * Language (EML)
18
-->
19
<?xml-stylesheet type="text/xsl" href="eml-dataset.xsl"?>
20
<eml-dataset connection="demo" xmlns:xsql="urn:oracle-xsql">
21

  
22
<xsql:query tag-case="lower" 
23
            rowset-element="" 
24
            row-element="" 
25
            id-attribute="">
26

  
27
  SELECT meta_file_id,dataset_id,title FROM eml_dataset
28
   WHERE meta_file_id = '{@meta_file_id}'
29

  
30
</xsql:query>
31

  
32
<xsql:query tag-case="lower" 
33
            row-element="originator" 
34
            rowset-element="" 
35
            id-attribute="">
36

  
37
  SELECT p.party_org, pi.salutation, pi.given_name, pi.surname, pi.jobtitle, 
38
         ma.address, ma.city, ma.admin_area, ma.postal_code, ma.country,
39
         ma.resource_url, ma.email, ma.work_phone, ma.home_phone, ma.fax,
40
         ma.tdd_phone 
41
    FROM party p, party_individual pi, meta_address ma
42
   WHERE p.party_individual_id = pi.party_individual_id
43
     AND p.meta_address_id = ma.meta_address_id
44
     AND p.meta_file_id = '{@meta_file_id}'
45

  
46
</xsql:query>
47

  
48
<xsql:query tag-case="lower" 
49
            rowset-element="" 
50
            row-element="" 
51
            id-attribute="">
52

  
53
  SELECT abstract FROM eml_dataset
54
   WHERE meta_file_id = '{@meta_file_id}'
55

  
56
</xsql:query>
57

  
58
<xsql:query tag-case="lower" 
59
            row-element="keyword_info" 
60
            rowset-element="" 
61
            id-attribute="">
62

  
63
  SELECT keyword, keyword_type, keyword_thesaurus
64
    FROM keyword_info
65
   WHERE meta_file_id = '{@meta_file_id}'
66

  
67
</xsql:query>
68

  
69
</eml-dataset>
70 0

  
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"/>
18 0

  
xsqltest/eml-variable-display.xsl
1
<?xml version="1.0"?>
2
<!--
3
  * eml-variable-display2.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 5
10
  *    File Info: '$Id$'
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" encoding="iso-8859-1"/>
20

  
21
  <xsl:template match="/">
22
    <html>
23
      <head>
24
        <link rel="stylesheet" type="text/css" href="/xmltodb/xsqltest/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

  
138
</xsl:stylesheet>
139 0

  
xsqltest/eml-dataset-display.xsl
1
<?xml version="1.0"?>
2
<!--
3
  * eml-dataset-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 5
10
  *      Version: 0.01
11
  *    File Info: '$Id$'
12
  *
13
  * This is an XSLT (http://www.w3.org/TR/xslt) stylesheet designed to
14
  * convert an XML file that is valid with respect to the eml-dataset.dtd
15
  * module of the Ecological Metadata Language (EML) into an HTML format 
16
  * suitable for rendering with modern web browsers.
17
-->
18
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
19

  
20
  <xsl:output method="html" encoding="iso-8859-1"/>
21

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

  
34
        <table width="100%">
35
        <tr><td class="rowodd">
36
        <b><xsl:text>Keywords:</xsl:text></b>
37
        </td></tr>
38
        <tr><td>
39
          <ul>
40
            <xsl:for-each select="//keyword_info/keyword">
41
              <li><xsl:value-of select="."/></li>
42
            </xsl:for-each>
43
          </ul>
44
        </td></tr>
45
        </table>
46
         
47

  
48
        <table width="100%">
49
        <tr><td class="rowodd">
50
        <b><xsl:text>Related Metadata and Data Files:</xsl:text></b>
51
        </td></tr>
52
        <tr><td>
53
        <ul>
54
          <xsl:for-each select="//relations">
55
            <li>
56
             <xsl:value-of select="@object"/>
57
             <xsl:text> </xsl:text>
58
             <xsl:value-of select="@relation"/>
59
             <xsl:text> </xsl:text>
60
             <xsl:value-of select="@target"/>
61
            </li>
62
          </xsl:for-each>
63
        </ul>
64
        </td></tr>
65
        </table>
66

  
67
      </body>
68
    </html>
69
  </xsl:template>
70

  
71
  <xsl:template match="meta_file_id">
72
    <table width="100%">
73
    <tr>
74
    <td class="rowodd"><b><xsl:text>Metadata File ID:</xsl:text></b></td>
75
    <td><xsl:value-of select="."/></td>
76
    </tr>
77
      <xsl:for-each select="//dataset_id|//title">
78
        <tr>
79
        <xsl:if test="name(.)='dataset_id'">
80
          <td class="rowodd"><b><xsl:text>Data set ID:</xsl:text></b></td>
81
        </xsl:if>
82
        <xsl:if test="name(.)='title'">
83
          <td class="rowodd"><b><xsl:text>Title:</xsl:text></b></td>
84
        </xsl:if>
85
        <td><xsl:value-of select="."/></td>
86
        </tr>
87
      </xsl:for-each>
88
    </table>
89

  
90
  </xsl:template>
91

  
92
  <xsl:template match="dataset_id"/>
93
  <xsl:template match="title"/>
94

  
95
  <xsl:template match="originator[1]">
96
      <table width="100%">
97
      <tr><td class="rowodd">
98
      <b><xsl:text>Data Set Owner(s):</xsl:text></b>
99
      </td></tr>
100
      </table>
101
  </xsl:template>
102

  
103
  <xsl:template match="party_org">
104
    <br><b><xsl:value-of select="."/></b></br>
105
  </xsl:template>
106

  
107
  <xsl:template match="party_individual">
108
    <br>
109
    <b>
110
       <xsl:value-of select="./salutation"/>
111
       <xsl:text> </xsl:text>
112
       <xsl:value-of select="./given_name"/>
113
       <xsl:text> </xsl:text>
114
       <xsl:value-of select="./surname"/>
115
    </b></br>
116
    <br><xsl:value-of select="./title"/></br>
117
  </xsl:template>
118

  
119
  <xsl:template match="meta_address">
120
    <table>
121
    <xsl:for-each select="./address">
122
      <tr>
123
      <td><xsl:value-of select="."/></td>
124
      </tr>
125
    </xsl:for-each>
126
    <tr>
127
    <td><xsl:value-of select="./city"/>
128
        <xsl:text>, </xsl:text>
129
        <xsl:value-of select="./admin_area"/>
130
        <xsl:text> </xsl:text>
131
        <xsl:value-of select="./postal_code"/>
132
    </td>
133
    </tr>
134
    <xsl:if test="./work_phone">
135
      <tr><td><xsl:text>Work: </xsl:text><xsl:value-of select="./work_phone"/>
136
       </td></tr>
137
    </xsl:if>
138
    <xsl:if test="./home_phone">
139
      <tr><td><xsl:text>Home: </xsl:text><xsl:value-of select="./home_phone"/>
140
       </td></tr>
141
    </xsl:if>
142
    <xsl:if test="./fax">
143
      <tr><td><xsl:text>Fax: </xsl:text><xsl:value-of select="./fax"/></td></tr>
144
    </xsl:if>
145
    <xsl:if test="./email">
146
      <tr><td><xsl:value-of select="./email"/></td></tr>
147
    </xsl:if>
148
    <xsl:if test="./resource_url">
149
      <tr><td><xsl:value-of select="./resource_url"/></td></tr>
150
    </xsl:if>
151
    </table>
152
  </xsl:template>
153

  
154
  <xsl:template match="abstract">
155
    <table width="100%">
156
    <tr>
157
    <td class="rowodd"><b><xsl:text>Abstract:</xsl:text></b></td>
158
    </tr>
159
    <tr>
160
    <td><xsl:value-of select="."/></td>
161
    </tr></table>
162
  </xsl:template>
163

  
164
  <xsl:template match="keyword_info"/>
165
  <xsl:template match="relations"/>
166

  
167
</xsl:stylesheet>
168 0

  
xsqltest/xmltest2.xsql
1
<?xml version="1.0"?>
2
<!--
3
  * xmltest2.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 5
10
  *      Version: 0.01
11
  *    File Info: '$Id$'
12
  * 
13
  * This is an XSQL (http://technet.oracle.com/tech/xml) document designed
14
  * to query a relational database and return the result as a well-formed
15
  * XML document.
16
-->
17
<?xml-stylesheet type="text/xsl" href="rowcol.xsl"?>
18
<page connection="demo" xmlns:xsql="urn:oracle-xsql">
19
<xsql:query>
20

  
21
  SELECT * FROM xmltest ORDER BY docid
22

  
23
</xsql:query>
24
</page>
25 0

  
xsqltest/eml-dataset2.xsql
1
<?xml version="1.0"?>
2
<!--
3
  * eml-dataset2.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 5
10
  *      Version: 0.01
11
  *    File Info: '$Id$'
12
  * 
13
  * This is an XSQL (http://technet.oracle.com/tech/xml) document designed
14
  * to cause an XSLT (http://www.w3.org/TR/xslt) stylesheet transformation
15
  * of the results of another XSLT query
16
-->
17
<?xml-stylesheet type="text/xsl" href="eml-dataset-display.xsl"?>
18
<xsql:include-xsql 
19
      href="eml-dataset1.xsql?meta_file_id={@meta_file_id}" 
20
      xmlns:xsql="urn:oracle-xsql"/>
21 0

  
xsqltest/rowcol.xsl
1
<?xml version="1.0"?>
2
<!--
3
  * rowcol.xsl
4
  *
5
  * This is an XSLT (http://www.w3.org/TR/xslt) stylesheet designed to
6
  * convert an XML file that is the result of a SQL query using Oracle's
7
  * XSQL tool to HTML format using a generic tabular display. Cascading
8
  * Style Sheets (CSS) are used to create some styling effects.
9
-->
10
<!--
11
| Author: smuench
12
+-->
13
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
14

  
15

  
16
  <xsl:template match="/">
17
    <html>
18
      <head>
19
	<link rel="stylesheet" type="text/css" href="./rowcol.css" />
20
      </head>
21
      <body class="page">
22
	<center><h1>XSL Transformed View</h1></center>
23
        <xsl:apply-templates/>      
24
      </body>
25
    </html>
26
  </xsl:template>
27

  
28
    <xsl:template match="ROWSET">
29
      <center>
30
      <table border="0" cellpadding="4">
31
      <xsl:choose>
32
        <xsl:when test="ROW">
33
	  <xsl:for-each select="ROW[1]">
34
	    <tr>
35
	      <xsl:for-each select="*[not(starts-with(name(.),'H_'))]">
36
		<th align="left">
37
		  <xsl:attribute name="class">
38
		    <xsl:choose>
39
		      <xsl:when test="position() mod 2 = 1">colodd</xsl:when>
40
		      <xsl:when test="position() mod 2 = 0">coleven</xsl:when>
41
		    </xsl:choose>
42
		  </xsl:attribute>
43
		  <xsl:value-of select="name(.)"/>
44
		</th>
45
	      </xsl:for-each>
46
	    </tr>
47
	  </xsl:for-each>
48
	  <xsl:apply-templates/>
49
        </xsl:when>
50
        <xsl:otherwise>
51
          <tr><td>No Matches</td></tr> 
52
        </xsl:otherwise>
53
      </xsl:choose>
54
      </table>
55
      </center>
56
    </xsl:template>
57

  
58
    <xsl:template match="ROW">
59
        <tr>
60
          <xsl:attribute name="class">
61
            <xsl:choose>
62
              <xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
63
              <xsl:when test="position() mod 2 = 0">roweven</xsl:when>
64
            </xsl:choose>
65
          </xsl:attribute>
66
          <xsl:for-each select="*[not(starts-with(name(.),'H_'))]">
67
            <td>
68
	      <xsl:attribute name="class">
69
		<xsl:choose>
70
		  <xsl:when test="position() mod 2 = 1">colodd</xsl:when>
71
		  <xsl:when test="position() mod 2 = 0">coleven</xsl:when>
72
		</xsl:choose>
73
	      </xsl:attribute>
74
              <xsl:apply-templates select='.'/>
75
            </td>
76
          </xsl:for-each>
77
        </tr>
78
  </xsl:template>
79

  
80
</xsl:stylesheet>
81 0

  
xsqltest/index.html
1
<!--
2
  * index.html
3
  *
4
  *      Authors: Matt Jones
5
  *    Copyright: 2000 Regents of the University of California and the
6
  *               National Center for Ecological Analysis and Synthesis
7
  *  For Details: http://www.nceas.ucsb.edu/
8
  *      Created: 2000 April 5
9
  *      Version: 0.01
10
  *    File Info: '$Id$'
11
  * 
12
  * This is an HTML document for displaying examples of the use of 
13
  * Oracle XML tools
14
-->
15
  <HTML>
16
  <HEAD>
17
  <TITLE>XSL Transformation examples</TITLE>
18
  </HEAD> 
19
  <FRAMESET ROWS="*" FRAMEBORDER=0 BORDER=0>
20

  
21
    <FRAMESET COLS="250,*"  FRAMEBORDER=0 BORDER=0>
22
    
23
    <FRAME SRC="contents.html" BORDER=0 NAME="left">
24

  
25
    <FRAME SRC="xmltest2.xsql" BORDER=0 NAME="right">
26

  
27
    </FRAMESET>
28
  </FRAMESET>
29 0

  
xsqltest/dsquery-xsql.xml
1
<?xml version = '1.0'?>
2
<!--
3
  * dsquery.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 5
10
  *      Version: 0.01
11
  *    File Info: '$Id$'
12
  * 
13
  * This is an XSQL (http://technet.oracle.com/tech/xml) document designed
14
  * to query a relational database and return the result as a well-formed
15
  * XML document. The query is a general search for datasets that match
16
  * search criteria from a metadata catalog containing documents that are 
17
  * valid with respect to the eml-dataset.dtd module of the Ecological 
18
  * Metadata Language (EML)
19
-->
20
<html connection="demo" xmlns:xsql="urn:oracle-xsql">
21
<head><title>Query Demo</title></head>
22
<body>
23
<section>Query form</section>
24
<form>
25
  <method>POST</method>
26
  <action>/xmltodb/xsqltest/dsquery.xsql</action>
27
  <textfield>
28
    <name>search_string</name>
29
    <xsql:query tag-case="lower" 
30
                rowset-element="" row-element="" id-attribute="">
31
       select '{@search_string}' AS val FROM DUAL
32
    </xsql:query>
33
  </textfield>
34
  <input type="submit" name="Run query"/>
35
</form>
36
<section>Results</section>
37
<xsql:query tag-case="lower">
38

  
39
  SELECT meta_file_id,dataset_id,title, 
40
         CURSOR (SELECT salutation,given_name,surname
41
                   FROM party_individual pi
42
                  WHERE pi.party_individual_id IN
43
                        (SELECT party_individual_id FROM party p
44
                          WHERE p.meta_file_id = ds.meta_file_id)) as originators 
45
    FROM eml_dataset ds
46
   WHERE UPPER(meta_file_id) LIKE UPPER('%{@search_string}%')
47
      OR UPPER(dataset_id)  LIKE UPPER('%{@search_string}%')
48
      OR UPPER(title)  LIKE UPPER('%{@search_string}%')
49
      OR UPPER(abstract) LIKE UPPER('%{@search_string}%')
50
</xsql:query>
51
</body>
52
</html>
53 0

  
xsqltest/eml-file.xsql
1
<?xml version="1.0"?>
2
<!--
3
  * eml-file.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
<xsql:include-xml href="eml-file.xml" xmlns:xsql="urn:oracle-xsql"/>
17 0

  
xsqltest/dsquery.xsql
1
<?xml version = '1.0'?>
2
<!--
3
  * dsquery.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 5
10
  *      Version: 0.01
11
  *    File Info: '$Id$'
12
  * 
13
  * This is an XSQL (http://technet.oracle.com/tech/xml) document designed
14
  * to query a relational database and return the result as a well-formed
15
  * XML document. The query is a general search for datasets that match
16
  * search criteria from a metadata catalog containing documents that are 
17
  * valid with respect to the eml-dataset.dtd module of the Ecological 
18
  * Metadata Language (EML)
19
-->
20
<?xml-stylesheet type="text/xsl" href="dsquery.xsl"?>
21
<html connection="demo" xmlns:xsql="urn:oracle-xsql">
22
<head><title>Query Demo</title></head>
23
<body>
24
<section>Query form</section>
25
<form>
26
  <method>POST</method>
27
  <action>/xmltodb/xsqltest/dsquery.xsql</action>
28
  <textfield>
29
    <name>search_string</name>
30
    <xsql:query tag-case="lower" 
31
                rowset-element="" row-element="" id-attribute="">
32
       select '{@search_string}' AS val FROM DUAL
33
    </xsql:query>
34
  </textfield>
35
  <input type="submit" name="Run query"/>
36
</form>
37
<section>Results</section>
38
<xsql:query tag-case="lower">
39

  
40
  SELECT meta_file_id,dataset_id,title, 
41
         CURSOR (SELECT salutation,given_name,surname
42
                   FROM party_individual pi
43
                  WHERE pi.party_individual_id IN
44
                        (SELECT party_individual_id FROM party p
45
                          WHERE p.meta_file_id = ds.meta_file_id)) as originators 
46
    FROM eml_dataset ds
47
   WHERE UPPER(meta_file_id) LIKE UPPER('%{@search_string}%')
48
      OR UPPER(dataset_id)  LIKE UPPER('%{@search_string}%')
49
      OR UPPER(title)  LIKE UPPER('%{@search_string}%')
50
      OR UPPER(abstract) LIKE UPPER('%{@search_string}%')
51
</xsql:query>
52
</body>
53
</html>
54 0

  
xsqltest/eml-variable.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
<xsql:include-xml href="eml-variable.xml" xmlns:xsql="urn:oracle-xsql"/>
17 0

  
xsqltest/eml-file.xml
1
<?xml version="1.0"?>
2
<!DOCTYPE eml-file><!-- '$Id$' --><!-- eml document for the NCEAS working group entitled:         Intrinsic and Extrinsic Variability in Community Dynamics          MODULE 4b - CLASS IVb - DATA STRUCTURAL DESCRIPTORS           --> <eml-file description="Data structural descriptors">
3
<meta_file_id description="Unique identifier of this metadata record">NCEAS-1998-2244-Dist-File</meta_file_id>
4
  <file description="Data set file">
5
    <file_name description="File name">NCEAS-1998-2244-Dist.csv</file_name>
6
    <file_size description="Size of file">
7
      <amount description="Amount">3821</amount>
8
      <unit description="Unit">KB</unit>
9
    </file_size>
10
    <format description="File type and compression schemes employed">
11
      <!--(compressed|encoded|base_file_type)-->
12
      <base_file_type description="Base file type">
13
        <!--(ASCII|binary)-->
14
        <ASCII description="ASCII">
15
          <record_delimiter description="Record delimiter"/>
16
        </ASCII>
17
      </base_file_type>
18
    </format>
19
    <orientation description="Is file column major or row major?" columnorrow="columnmajor"/>
20
    <header_lines description="Number of header lines or information that prepares data">1</header_lines>
21
    <case_sensitive description="Case sensitivity of field" yesorno="n"/>
22
    <geographic_coverage description="Geographic coverage">
23
      <paragraph description="Paragraph of text"></paragraph>
24
      <coordinates description="Cartesian Coordinates">
25
        <lattitude description="Lattitude coordinates"></lattitude>
26
        <longitude description="Longitude coordinates"></longitude>
27
      </coordinates>
28
    </geographic_coverage>
29
    <temporal_coverage description="Temporal coverage">
30
      <start_date description="Date data collection commenced">
31
        <datetime description="Date and time as designated in ISO 8601">
32
          <year description="Year in YYYY format"/>
33
          <month description="Month in MM format"/>
34
          <day description="Day of month in DD format"/>
35
          <hour description="Hour in hh"/>
36
          <minute description="Minute in mm"/>
37
          <second description="Seconds in ss"/>
38
          <second_fraction description="One or more digits representing a decimal fraction of a second"/>
39
          <time_zone_designator description="Time zone designator"/>
40
        </datetime>
41
      </start_date>
42
      <stop_date description="Date data collection terminated">
43
        <datetime description="Date and time as designated in ISO 8601">
44
          <year description="Year in YYYY format"/>
45
          <month description="Month in MM format"/>
46
          <day description="Day of month in DD format"/>
47
          <hour description="Hour in hh"/>
48
          <minute description="Minute in mm"/>
49
          <second description="Seconds in ss"/>
50
          <second_fraction description="One or more digits representing a decimal fraction of a second"/>
51
          <time_zone_designator description="Time zone designator"/>
52
        </datetime>
53
      </stop_date>
54
    </temporal_coverage>
55
    <authentication description="Authentication procedures or techniques">MD5 Checksum for verification: 41edbfbce8c32ff18ae589b19ef07cb2</authentication>
56
    <data_problem description="Data anomalies; description of missing data">
57
      <paragraph description="Paragraph of text">Occasional values are missing</paragraph>
58
    </data_problem>
59
  </file>
60
</eml-file>
61 0

  
xsqltest/eml-variable-sort.xsl
1
<!--
2
  * eml-variable-sort.xsl
3
  *
4
  *      Authors: Matt Jones
5
  *    Copyright: 2000 Regents of the University of California and the
6
  *               National Center for Ecological Analysis and Synthesis
7
  *  For Details: http://www.nceas.ucsb.edu/
8
  *      Created: 2000 April 5
9
  *    File Info: '$Id$'
10
  *
11
  * This is an XSLT (http://www.w3.org/TR/xslt) stylesheet designed to
12
  * convert an XML file that is valid with respect to the eml-variable.dtd
13
  * module of the Ecological Metadata Language (EML) into an HTML format
14
  * suitable for rendering with modern web browsers. It implements the sorting
15
  * routines for this function.
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
-->
22
<xsl:template xmlns:xsl="http://www.w3.org/TR/WD-xsl">
23
  <xsl:apply-templates select="eml_variable">
24
    <xsl:template><xsl:copy><xsl:apply-templates select="@*"/><xsl:apply-templates/></xsl:copy></xsl:template>
25
    <xsl:template match="eml_variable"><xsl:copy><xsl:apply-templates select="@*"/><xsl:apply-templates select="variable" order-by="variable_name"/></xsl:copy></xsl:template>
26
  </xsl:apply-templates>
27
</xsl:template>
28 0

  
xsqltest/rowcol.css
1
 .page    {font-family: Tahoma, sans-serif; background-color:white}
2
 .emlbody    {font-family: Tahoma, sans-serif; background-color:white}
3
 .rowodd  {background-color: #CCCCCC; color: black; vertical-align: top}
4
 .roweven {background-color: #F8F8F8; color: black; vertical-align: top}
5
 .rowlight {background-color: #CCCCFF; color: black; vertical-align: top}
6
 .rowwhite {background-color: #FFFFFF; color: black; vertical-align: top}
7
 .coleven {}
8
 .colodd  {}
9
 .shaded  {background-color: #DDDDDD; color: black}
10 0

  
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff