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

    
346
</xsl:stylesheet>
(10-10/30)