Project

General

Profile

1
<?xml version="1.0"?>
2
<!--
3
  *  '$RCSfile: eml-datatable-2.0.0.xsl,v $'
4
  *      Authors: Jivka Bojilova
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: cjones $'
10
  *     '$Date: 2004/10/05 23:50:34 $'
11
  * '$Revision: 1.1 $'
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-file.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
              doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
37
              doctype-system="http://www.w3.org/TR/html4/loose.dtd"
38
              indent="yes" />  
39
  <!-- This module is for datatable module-->
40
  <!-- change the "Entity Description" and  "Identifier" to a complete citation for dataset. in eml.xsl -->
41

    
42
  <xsl:template name="dataTable">
43
      <xsl:param name="datatablefirstColStyle"/>
44
      <xsl:param name="datatablesubHeaderStyle"/>
45
      <xsl:param name="docid"/> 
46
      <xsl:param name="entityindex"/>
47
      <!-- mob added this -->
48
      <xsl:param name="numberOfColumns">
49
      <xsl:if test="$withAttributes='1'"> 
50
        <xsl:value-of select="count(attributeList/attribute/attributeName)"/>
51
        </xsl:if>
52
      </xsl:param>  
53
 
54

    
55
      <h3>Data Table Description</h3>
56

    
57

    
58
      <table class="subGroup onehundred_percent">
59
        <tr>
60
          <td>
61

    
62
      <table class="{$tabledefaultStyle}">
63
        <xsl:choose>
64
         <xsl:when test="references!=''">
65
          <xsl:variable name="ref_id" select="references"/>
66
          <xsl:variable name="references" select="$ids[@id=$ref_id]" />
67
          <xsl:for-each select="$references">
68
            <xsl:call-template name="datatablecommon">
69
             <xsl:with-param name="datatablefirstColStyle" select="$datatablefirstColStyle"/>
70
             <xsl:with-param name="datatablesubHeaderStyle" select="$datatablesubHeaderStyle"/>
71
             <xsl:with-param name="docid" select="$docid"/>
72
             <xsl:with-param name="entityindex" select="$entityindex"/>
73
             <xsl:with-param name="numberOfColumns" select="$numberOfColumns"/>
74
            </xsl:call-template>
75
          </xsl:for-each>
76
        </xsl:when>
77
        <xsl:otherwise>
78
          <xsl:call-template name="datatablecommon">
79
             <xsl:with-param name="datatablefirstColStyle" select="$datatablefirstColStyle"/>
80
             <xsl:with-param name="datatablesubHeaderStyle" select="$datatablesubHeaderStyle"/>
81
             <xsl:with-param name="docid" select="$docid"/>
82
             <xsl:with-param name="entityindex" select="$entityindex"/>
83
             <xsl:with-param name="numberOfColumns" select="$numberOfColumns"/>
84
          </xsl:call-template>
85
         </xsl:otherwise>
86
      </xsl:choose>
87
      </table>
88

    
89
</td>
90
<td>
91
      <table class="{$tabledefaultStyle}">
92

    
93
   <!-- moved this out of datatablecommon, to break up linear arrangment  -->
94
       <xsl:if test="physical">
95
       <tr><th colspan="2">
96
        Description of Table Structure:
97
      </th></tr>
98
      <!-- distrubution is still under datatablecommon 
99
        <xsl:for-each select="physical">
100
       <xsl:call-template name="showdistribution">
101
          <xsl:with-param name="docid" select="$docid"/>
102
          <xsl:with-param name="entityindex" select="$entityindex"/>
103
          <xsl:with-param name="physicalindex" select="position()"/>
104
          <xsl:with-param name="datatablefirstColStyle" select="$datatablefirstColStyle"/>
105
          <xsl:with-param name="datatablesubHeaderStyle" select="$datatablesubHeaderStyle"/>
106
       </xsl:call-template>
107
    </xsl:for-each>-->
108
    </xsl:if>
109
    <xsl:for-each select="physical">
110
       <tr><td colspan="2">
111
        <xsl:call-template name="physical">
112
         <xsl:with-param name="physicalfirstColStyle" select="$datatablefirstColStyle"/>
113
         <xsl:with-param name="notshowdistribution">yes</xsl:with-param>
114
        </xsl:call-template>
115
       </td></tr>
116
    </xsl:for-each>
117
    </table>
118
</td>
119

    
120
</tr>
121
</table>
122

    
123

    
124

    
125
<!-- a second table for the attributeList -->
126
<table class="{$tabledefaultStyle}">
127
  <tr>
128
    <th colspan="2">Table Column Descriptions</th>
129
  </tr>
130
  <tr>
131
    <td>
132
      <xsl:if test="$withAttributes='1'">
133
        <xsl:for-each select="attributeList">
134
          <xsl:call-template name="datatableattributeList">
135
            <xsl:with-param name="datatablefirstColStyle" select="$datatablefirstColStyle"/>
136
            <xsl:with-param name="datatablesubHeaderStyle" select="$datatablesubHeaderStyle"/>
137
            <xsl:with-param name="docid" select="$docid"/>
138
            <xsl:with-param name="entityindex" select="$entityindex"/>
139
          </xsl:call-template>
140
        </xsl:for-each>
141
      </xsl:if>
142
    </td>
143
  </tr>  
144
</table>
145

    
146

    
147
</xsl:template>
148

    
149

    
150

    
151

    
152

    
153
  <xsl:template name="datatablecommon">
154
    <xsl:param name="datatablefirstColStyle"/>
155
    <xsl:param name="datatablesubHeaderStyle"/>
156
    <xsl:param name="docid"/>
157
    <xsl:param name="entityindex"/>
158
    <xsl:param name="numberOfColumns"/>
159
    
160

    
161
    <xsl:for-each select="entityName">
162
       <xsl:call-template name="entityName">
163
          <xsl:with-param name="entityfirstColStyle" select="$datatablefirstColStyle"/>
164
       </xsl:call-template>
165
    </xsl:for-each>
166

    
167
    <xsl:for-each select="alternateIdentifier">
168
       <xsl:call-template name="entityalternateIdentifier">
169
          <xsl:with-param name="entityfirstColStyle" select="$datatablefirstColStyle"/>
170
       </xsl:call-template>
171
    </xsl:for-each>
172
    <xsl:for-each select="entityDescription">
173
       <xsl:call-template name="entityDescription">
174
          <xsl:with-param name="entityfirstColStyle" select="$datatablefirstColStyle"/>
175
       </xsl:call-template>
176
    </xsl:for-each>
177
    <xsl:for-each select="additionalInfo">
178
       <xsl:call-template name="entityadditionalInfo">
179
          <xsl:with-param name="entityfirstColStyle" select="$datatablefirstColStyle"/>
180
       </xsl:call-template>
181
    </xsl:for-each> 
182
    <xsl:for-each select="numberOfRecords">
183
       <xsl:call-template name="datatablenumberOfRecords">
184
          <xsl:with-param name="datatablefirstColStyle" select="$datatablefirstColStyle"/>
185
       </xsl:call-template>
186
    </xsl:for-each>
187
    <!-- show the number of columns, too -->
188
    <xsl:call-template name="datatablenumberOfColumns">
189
      <xsl:with-param name="datatablefirstColStyle" select="$datatablefirstColStyle"/>
190
      <xsl:with-param name="numberOfColumns" select="$numberOfColumns"/>
191
    </xsl:call-template>
192

    
193

    
194
    <!-- move the rest of physical module to second col -->
195
    
196
           <xsl:for-each select="physical">
197
       <xsl:call-template name="showdistribution">
198
          <xsl:with-param name="docid" select="$docid"/>
199
          <xsl:with-param name="entityindex" select="$entityindex"/>
200
          <xsl:with-param name="physicalindex" select="position()"/>
201
          <xsl:with-param name="datatablefirstColStyle" select="$datatablefirstColStyle"/>
202
          <xsl:with-param name="datatablesubHeaderStyle" select="$datatablesubHeaderStyle"/>
203
       </xsl:call-template>
204
    </xsl:for-each>
205

    
206

    
207
   
208

    
209
    
210
    <!-- could move this element down? it's boring -->
211
    <!--
212
    <xsl:for-each select="caseSensitive">
213
       <xsl:call-template name="datatablecaseSensitive">
214
          <xsl:with-param name="datatablefirstColStyle" select="$datatablefirstColStyle"/>
215
       </xsl:call-template>
216
    </xsl:for-each>
217
    -->
218
    <!-- Moved this to above distribution -->
219
    <!--
220
    <xsl:for-each select="numberOfRecords">
221
       <xsl:call-template name="datatablenumberOfRecords">
222
          <xsl:with-param name="datatablefirstColStyle" select="$datatablefirstColStyle"/>
223
       </xsl:call-template>
224
    </xsl:for-each>
225
    -->
226

    
227
    <xsl:if test="coverage">
228
       <tr><td class="{$datatablesubHeaderStyle}" colspan="2">
229
        Coverage Description:
230
      </td></tr>
231
    </xsl:if>
232

    
233
    <xsl:for-each select="coverage">
234
      <tr><td colspan="2">
235
        <xsl:call-template name="coverage">
236
        </xsl:call-template>
237
      </td></tr>
238
    </xsl:for-each>
239

    
240
    <xsl:if test="method">
241
       <tr><td class="{$datatablesubHeaderStyle}" colspan="2">
242
        Method Description:
243
      </td></tr>
244
    </xsl:if>
245
    <xsl:for-each select="method">
246
      <tr><td colspan="2">
247
        <xsl:call-template name="method">
248
          <xsl:with-param name="methodfirstColStyle" select="$datatablefirstColStyle"/>
249
          <xsl:with-param name="methodsubHeaderStyle" select="$datatablesubHeaderStyle"/>
250
        </xsl:call-template>
251
      </td></tr>
252
    </xsl:for-each>
253

    
254
    <xsl:if test="constraint">
255
       <tr><td class="{$datatablesubHeaderStyle}" colspan="2">
256
        Constraint:
257
       </td></tr>
258
    </xsl:if>
259
    <xsl:for-each select="constraint">
260
      <tr><td colspan="2">
261
        <xsl:call-template name="constraint">
262
          <xsl:with-param name="constraintfirstColStyle" select="$datatablefirstColStyle"/>
263
        </xsl:call-template>
264
      </td></tr>
265
    </xsl:for-each>
266

    
267

    
268
    <!-- copied this snippet to the second table in template=dataTable -->
269
    <!-- 
270

    
271
     <xsl:if test="$withAttributes='1'">
272
      <xsl:for-each select="attributeList">
273
       <xsl:call-template name="datatableattributeList">
274
         <xsl:with-param name="datatablefirstColStyle" select="$datatablefirstColStyle"/>
275
         <xsl:with-param name="datatablesubHeaderStyle" select="$datatablesubHeaderStyle"/>
276
         <xsl:with-param name="docid" select="$docid"/>
277
         <xsl:with-param name="entityindex" select="$entityindex"/>
278
       </xsl:call-template>
279
      </xsl:for-each>
280
     </xsl:if>
281

    
282
     -->
283

    
284

    
285

    
286

    
287
     <!-- copied this snippet up to display url sooner. move phys later? -->
288
     <!-- Here to display distribution info-->
289
     <!--
290
    <xsl:for-each select="physical">
291
       <xsl:call-template name="showdistribution">
292
          <xsl:with-param name="docid" select="$docid"/>
293
          <xsl:with-param name="entityindex" select="$entityindex"/>
294
          <xsl:with-param name="physicalindex" select="position()"/>
295
          <xsl:with-param name="datatablefirstColStyle" select="$datatablefirstColStyle"/>
296
          <xsl:with-param name="datatablesubHeaderStyle" select="$datatablesubHeaderStyle"/>
297
       </xsl:call-template>
298
    </xsl:for-each>
299
-->
300
  </xsl:template>
301

    
302

    
303

    
304

    
305
  <xsl:template name="datatablecaseSensitive">
306
       <xsl:param name="datatablefirstColStyle"/>
307
       <tr><td class="{$datatablefirstColStyle}">
308
       Case Sensitive?</td><td class="{$secondColStyle}">
309
       <xsl:value-of select="."/></td></tr>
310

    
311
  </xsl:template>
312

    
313
  <xsl:template name="datatablenumberOfRecords">
314
       <xsl:param name="datatablefirstColStyle"/>
315
       <tr><td class="{$datatablefirstColStyle}">
316
            Number of Records:</td><td class="{$secondColStyle}">
317
       <xsl:value-of select="."/></td></tr>
318
  </xsl:template>
319

    
320
  <xsl:template name="datatablenumberOfColumns">
321
       <xsl:param name="numberOfColumns"/>      
322
       <xsl:param name="datatablefirstColStyle"/>
323
       <tr><td class="{$datatablefirstColStyle}">
324
            Number of Columns:</td><td class="{$secondColStyle}">
325
       <xsl:value-of select="$numberOfColumns"/>
326
     </td></tr>
327
  </xsl:template>
328
  
329
  
330
  
331
  <xsl:template name="showdistribution">
332
     <xsl:param name="datatablefirstColStyle"/>
333
     <xsl:param name="datatablesubHeaderStyle"/>
334
     <xsl:param name="docid"/>
335
     <xsl:param name="level">entitylevel</xsl:param>
336
     <xsl:param name="entitytype">dataTable</xsl:param>
337
     <xsl:param name="entityindex"/>
338
     <xsl:param name="physicalindex"/>
339

    
340
     
341
     <xsl:if test="distribution">
342
       <tr>
343
        <th colspan="2"> Access to these data:</th>
344
       </tr>
345
     </xsl:if>
346
        
347
    <xsl:for-each select="distribution">
348
      <tr><td colspan="2">
349
        <xsl:call-template name="distribution">
350
          <xsl:with-param name="docid" select="$docid"/>
351
          <xsl:with-param name="level" select="$level"/>
352
          <xsl:with-param name="entitytype" select="$entitytype"/>
353
          <xsl:with-param name="entityindex" select="$entityindex"/>
354
          <xsl:with-param name="physicalindex" select="$physicalindex"/>
355
          <xsl:with-param name="distributionindex" select="position()"/>
356
          <xsl:with-param name="disfirstColStyle" select="$datatablefirstColStyle"/>
357
          <xsl:with-param name="dissubHeaderStyle" select="$datatablesubHeaderStyle"/>
358
        </xsl:call-template>
359
      </td></tr>
360
    </xsl:for-each>
361
  </xsl:template>
362

    
363

    
364
  <xsl:template name="datatableattributeList">
365
    <xsl:param name="datatablefirstColStyle"/>
366
    <xsl:param name="datatablesubHeaderStyle"/>
367
    <xsl:param name="docid"/>
368
    <xsl:param name="entitytype">dataTable</xsl:param>
369
    <xsl:param name="entityindex"/>
370
    <tr><td class="{$datatablesubHeaderStyle}" colspan="2">
371
        <!-- <xsl:text>Attribute(s) Info:</xsl:text> -->
372
    </td></tr>
373
    <tr><td colspan="2">
374
         <xsl:call-template name="attributelist">
375
           <xsl:with-param name="docid" select="$docid"/>
376
           <xsl:with-param name="entitytype" select="$entitytype"/>
377
           <xsl:with-param name="entityindex" select="$entityindex"/>
378
         </xsl:call-template>
379
       </td>
380
    </tr>
381
  </xsl:template>
382

    
383

    
384

    
385
</xsl:stylesheet>
(9-9/31)