Project

General

Profile

1
<?xml version="1.0"?>
2
<!--
3
  *  '$RCSfile$'
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
  *
9
  *   '$Author: tao $'
10
  *     '$Date: 2003-06-24 17:19:15 -0700 (Tue, 24 Jun 2003) $'
11
  * '$Revision: 1686 $'
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
  * 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-dataset.dtd
29
  * module of the Ecological Metadata Language (EML) into an HTML format
30
  * suitable for rendering with modern web browsers.
31
-->
32
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
33

    
34
    
35
  <xsl:output method="html" encoding="iso-8859-1"/>
36
  
37
  <xsl:template match="dataset" mode="dataset">
38
    <table class="tabledefault" width="100%">
39
      <xsl:choose>
40
         <xsl:when test="references!=''">
41
          <xsl:variable name="ref_id" select="references"/>
42
          <xsl:variable name="references" select="$ids[@id=$ref_id]" />
43
          <xsl:for-each select="$references">
44
             <xsl:call-template name="datasetresource"/>
45
             <xsl:call-template name="datasetaccess"/>
46
             <xsl:call-template name="datasetpurpose"/>
47
             <xsl:call-template name="datasetmaintenance"/>
48
             <xsl:call-template name="datasetcontact"/>
49
             <xsl:call-template name="datasetpublisher"/>
50
             <xsl:call-template name="datasetpubplace"/>
51
             <xsl:call-template name="datasetproject"/>
52
             <xsl:call-template name="datasetentity"/>
53
          </xsl:for-each>
54
       </xsl:when>
55
       <xsl:otherwise>
56
             <xsl:call-template name="datasetresource"/>
57
             <xsl:call-template name="datasetaccess"/>
58
             <xsl:call-template name="datasetpurpose"/>
59
             <xsl:call-template name="datasetmaintenance"/>
60
             <xsl:call-template name="datasetcontact"/>
61
             <xsl:call-template name="datasetpublisher"/>
62
             <xsl:call-template name="datasetpubplace"/>
63
             <xsl:call-template name="datasetproject"/>
64
             <xsl:call-template name="datasetentity"/>
65
       </xsl:otherwise>
66
      </xsl:choose>  
67
    </table>
68
    
69
  </xsl:template>
70
  
71
  <xsl:template name="datasetresource">
72
     <tr>
73
        <td colspan="2" width="100%">
74
          <xsl:call-template name="resource">
75
            <xsl:with-param name="resfirstColStyle" select="$firstColStyle"/>
76
            <xsl:with-param name="ressubHeaderStyle" select="$subHeaderStyle"/>
77
          </xsl:call-template>
78
       </td>
79
     </tr>
80
  </xsl:template>
81
  
82
 
83
  
84
  <xsl:template name="datasetpurpose">
85
    <xsl:for-each select="purpose">
86
      <tr><td class="{$subHeaderStyle}" colspan="2">
87
           <xsl:text>Purpose:</xsl:text>
88
        </td>
89
       </tr>
90
       <tr>
91
            <td width="{$firstColWidth}"  class="{$firstColStyle}">
92
            &#160;
93
            </td>
94
            <td width="{$secondColWidth}" class="{$secondColStyle}" >
95
              <xsl:call-template name="text">
96
                <xsl:with-param name="textfirstColStyle" select="$firstColStyle"/>
97
              </xsl:call-template>
98
            </td>
99
       </tr>
100
     </xsl:for-each>
101
  </xsl:template>
102
  
103
  <xsl:template name="datasetmaintenance">
104
    <xsl:for-each select="maintenance">
105
      <tr><td class="{$subHeaderStyle}" colspan="2">
106
        <xsl:text>Maintenance:</xsl:text>
107
     </td></tr>
108
     <xsl:call-template name="mantenancedescription"/>
109
      <tr>
110
          <td width="{$firstColWidth}"  class="{$firstColStyle}">
111
          Frequency:
112
          </td>
113
          <td width="{$secondColWidth}" class="{$secondColStyle}" >
114
           <xsl:value-of select="maintenanceUpdateFrequency"/>
115
          </td>
116
     </tr>
117
     <xsl:call-template name="datasetchangehistory"/>
118
   </xsl:for-each>
119
  </xsl:template>
120
  
121
  <xsl:template name="mantenancedescription">
122
   <xsl:for-each select="description">
123
     <tr>
124
          <td width="{$firstColWidth}"  class="{$firstColStyle}">
125
          Description:
126
          </td>
127
          <td width="{$secondColWidth}" class="{$secondColStyle}" >
128
            <xsl:call-template name="text">
129
               <xsl:with-param name="textfirstColStyle" select="$firstColStyle"/>
130
             </xsl:call-template>
131
          </td>
132
     </tr>
133
    </xsl:for-each>
134
  </xsl:template>
135
  
136
   <xsl:template name="datasetchangehistory">
137
   <xsl:if test="changeHistory">
138
     <tr>
139
          <td width="{$firstColWidth}" class="{$firstColStyle}">
140
          History:
141
          </td>
142
          <td width="{$secondColWidth}" class="{$secondColStyle}" >
143
            <table width="100%">
144
              <xsl:for-each select="changeHistory">
145
                <xsl:call-template name="historydetails"/>
146
              </xsl:for-each>
147
            </table>
148
          </td>
149
     </tr>
150
     </xsl:if>
151
   </xsl:template>
152
   
153
   <xsl:template name="historydetails">
154
        <tr><td width="{$firstColWidth}" class="{$firstColStyle}">
155
            scope:</td>
156
            <td width="{$secondColWidth}" class="{$secondColStyle}">
157
            <xsl:value-of select="changeScope"/>
158
        </td></tr>
159
        <tr><td width="{$firstColWidth}" class="{$firstColStyle}">
160
            old value:</td>
161
            <td width="{$secondColWidth}" class="{$secondColStyle}">
162
            <xsl:value-of select="oldValue"/>
163
        </td></tr>
164
        <tr><td width="{$firstColWidth}" class="{$firstColStyle}">
165
            change date:</td>
166
            <td width="{$secondColWidth}" class="{$secondColStyle}">
167
            <xsl:value-of select="changeDate"/>
168
        </td></tr>
169
        <xsl:if test="comment and normalize-space(comment)!=''">
170
          <tr><td width="{$firstColWidth}" class="{$firstColStyle}">
171
            comment:</td><td width="{$secondColWidth}" class="{$secondColStyle}">
172
            <xsl:value-of select="comment"/>
173
          </td></tr>
174
        </xsl:if>
175
  </xsl:template>
176
  
177
  <xsl:template name="datasetcontact">
178
    <tr><td class="{$subHeaderStyle}" colspan="2">
179
        <xsl:text>Contact:</xsl:text>
180
     </td></tr>
181
    <xsl:for-each select="contact">
182
     <tr><td colspan="2">
183
       <xsl:call-template name="party">
184
              <xsl:with-param name="partyfirstColStyle" select="$firstColStyle"/>
185
       </xsl:call-template>
186
     </td></tr>
187
     <tr><td width="{$firstColWidth}" class="{$firstColStyle}">&#160;</td>
188
      <td width="{$secondColWidth}" class="{$secondColStyle}">&#160;</td></tr>
189
    </xsl:for-each>
190
  </xsl:template>
191
  
192
  <xsl:template name="datasetpublisher">
193
   <xsl:for-each select="publisher">
194
     <tr><td class="{$subHeaderStyle}" colspan="2">
195
        <xsl:text>Publisher:</xsl:text>
196
     </td></tr>
197
     <tr><td colspan="2">
198
       <xsl:call-template name="party">
199
              <xsl:with-param name="partyfirstColStyle" select="$firstColStyle"/>
200
       </xsl:call-template>
201
     </td></tr>
202
     <tr><td width="{$firstColWidth}" class="{$firstColStyle}">&#160;</td>
203
      <td width="{$secondColWidth}" class="{$secondColStyle}">&#160;</td></tr>
204
   </xsl:for-each>
205
  </xsl:template>
206
  
207
  <xsl:template name="datasetpubplace">
208
    <xsl:for-each select="pubPlace">
209
      <tr><td width="{$firstColWidth}" class="{$firstColStyle}">
210
           Publish Place:</td>
211
          <td width="{$secondColWidth}" class="{$secondColStyle}">
212
          <xsl:value-of select="."/>
213
          </td>
214
      </tr>
215
   </xsl:for-each>
216
  </xsl:template>
217
   
218
   <xsl:template name="datasetproject">
219
    <xsl:for-each select="project">
220
     <tr><td class="{$subHeaderStyle}" colspan="2">
221
        <xsl:text>Project Info:</xsl:text>
222
     </td></tr>
223
      <tr>
224
        <td colspan="2" width="100%">
225
        <xsl:call-template name="project">
226
          <xsl:with-param name="projectfirstColStyle" select="$firstColStyle"/>
227
        </xsl:call-template>
228
        </td>
229
      </tr>
230
    </xsl:for-each>
231
  </xsl:template>
232
  
233
   <xsl:template name="datasetaccess">
234
    <xsl:for-each select="access">
235
      <tr>
236
        <td colspan="2" width="100%">
237
        <xsl:call-template name="access">
238
          <xsl:with-param name="accessfirstColStyle" select="$firstColStyle"/>
239
          <xsl:with-param name="accesssubHeaderStyle" select="$subHeaderStyle"/>
240
        </xsl:call-template>
241
        </td>
242
      </tr>
243
    </xsl:for-each>
244
  </xsl:template>
245
  
246
  
247
  
248
  <xsl:template name="datasetentity" > 
249
   <xsl:if test="dataTable or spatialRaster or spatialVector or storedProcedures or view or otherEntity">
250
      <tr><td class="{$subHeaderStyle}" colspan="2">
251
        <xsl:text>Data Tables, Images, and Other Entities:</xsl:text>
252
     </td></tr>
253
   </xsl:if>
254
    <xsl:for-each select="dataTable">
255
      <xsl:call-template name="entityurl">
256
        <xsl:with-param name="type">dataTable</xsl:with-param>
257
        <xsl:with-param name="showtype">Data Table</xsl:with-param>
258
        <xsl:with-param name="index" select="position()"/>
259
      </xsl:call-template>
260
   </xsl:for-each>
261
   <xsl:for-each select="spatialRaster">
262
     <xsl:call-template name="entityurl">
263
        <xsl:with-param name="type">spatialRaster</xsl:with-param>
264
        <xsl:with-param name="showtype">Spatial Raster</xsl:with-param>
265
        <xsl:with-param name="index" select="position()"/>
266
      </xsl:call-template>
267
   </xsl:for-each>
268
   <xsl:for-each select="spatialVector">
269
      <xsl:call-template name="entityurl">
270
        <xsl:with-param name="type">spatialVector</xsl:with-param>
271
        <xsl:with-param name="showtype">Spatial Vector</xsl:with-param>
272
        <xsl:with-param name="index" select="position()"/>
273
      </xsl:call-template>
274
   </xsl:for-each>
275
   <xsl:for-each select="storedProcedure">
276
     <xsl:call-template name="entityurl">
277
        <xsl:with-param name="type">storedProcedure</xsl:with-param>
278
        <xsl:with-param name="showtype">Stored Procedure</xsl:with-param>
279
        <xsl:with-param name="index" select="position()"/>
280
      </xsl:call-template>
281
   </xsl:for-each>
282
   <xsl:for-each select="view">
283
      <xsl:call-template name="entityurl">
284
        <xsl:with-param name="type">view</xsl:with-param>
285
        <xsl:with-param name="showtype">View</xsl:with-param>
286
        <xsl:with-param name="index" select="position()"/>
287
      </xsl:call-template>
288
   </xsl:for-each>
289
   <xsl:for-each select="otherEntity">
290
      <xsl:call-template name="entityurl">
291
        <xsl:with-param name="type">otherEntity</xsl:with-param>
292
        <xsl:with-param name="showtype">Other Entity</xsl:with-param>
293
        <xsl:with-param name="index" select="position()"/>
294
      </xsl:call-template>
295
   </xsl:for-each>
296
  </xsl:template>
297
  
298
  <xsl:template name="entityurl">
299
     <xsl:param name="showtype"/>
300
     <xsl:param name="type"/>
301
     <xsl:param name="index"/>
302
      <xsl:choose>
303
         <xsl:when test="references!=''">
304
          <xsl:variable name="ref_id" select="references"/>
305
          <xsl:variable name="references" select="$ids[@id=$ref_id]" />
306
          <xsl:for-each select="$references">
307
            <tr><td width="{$firstColWidth}" class="{$firstColStyle}">
308
             &#160;</td>
309
            <td width="{$secondColWidth}" class="{$firstColStyle}">
310
             <a><xsl:attribute name="href">
311
              <xsl:value-of select="$tripleURI"/><xsl:value-of select="$docid"/>&amp;displaymodule=entity&amp;entitytype=<xsl:value-of select="$type"/>&amp;entityindex=<xsl:value-of select="$index"/></xsl:attribute>
312
             <br><xsl:value-of select="./entityName"/> (<xsl:value-of select="$showtype"/>)</br></a>
313
            </td>
314
         </tr> 
315
          </xsl:for-each>
316
        </xsl:when>
317
        <xsl:otherwise>
318
         <tr><td width="{$firstColWidth}" class="{$firstColStyle}">
319
             &#160;</td>
320
            <td width="{$secondColWidth}" class="{$firstColStyle}">
321
             <a><xsl:attribute name="href">
322
              <xsl:value-of select="$tripleURI"/><xsl:value-of select="$docid"/>&amp;displaymodule=entity&amp;entitytype=<xsl:value-of select="$type"/>&amp;entityindex=<xsl:value-of select="$index"/></xsl:attribute>
323
             <br><xsl:value-of select="./entityName"/> (<xsl:value-of select="$showtype"/>)</br></a>
324
            </td>
325
         </tr>
326
       </xsl:otherwise>
327
     </xsl:choose>
328
  </xsl:template>
329
  
330
  <xsl:template match="text()" mode="dataset" />
331
  <xsl:template match="text()" mode="resource" />
332

    
333
</xsl:stylesheet>
(10-10/33)