Project

General

Profile

1 3094 cjones
<?xml version="1.0"?>
2
<!--
3
  *  '$RCSfile$'
4
  *      Authors: Matthew Brooke
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$'
10
  *     '$Date$'
11
  * '$Revision$'
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-variable.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
  <!--<xsl:import href="eml-party.xsl"/>
34
  <xsl:import href="eml-distribution.xsl"/>
35
  <xsl:import href="eml-coverage.xsl"/>-->
36
  <xsl:output method="html" encoding="iso-8859-1"
37
    doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
38
    doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
39
    indent="yes" />
40
41
  <!-- This module is for resouce and it is self-contained (it is table)-->
42
  <xsl:template name="resource">
43
    <xsl:param name="resfirstColStyle"/>
44
    <xsl:param name="ressubHeaderStyle"/>
45
    <xsl:param name="creator">Data Set Owner(s):</xsl:param>
46
47
      <!--
48
      <xsl:for-each select="alternateIdentifier">
49
        <xsl:call-template name="resourcealternateIdentifier">
50
          <xsl:with-param name="resfirstColStyle" select="$resfirstColStyle"/>
51
        </xsl:call-template>
52
      </xsl:for-each>
53
54
      <xsl:for-each select="shortName">
55
        <xsl:call-template name="resourceshortName">
56
          <xsl:with-param name="resfirstColStyle" select="$resfirstColStyle"/>
57
         </xsl:call-template>
58
      </xsl:for-each>
59
60
      <xsl:for-each select="title">
61
        <xsl:call-template name="resourcetitle">
62
          <xsl:with-param name="resfirstColStyle" select="$resfirstColStyle"/>
63
          <xsl:with-param name="ressubHeaderStyle" select="$ressubHeaderStyle"/>
64
        </xsl:call-template>
65
      </xsl:for-each>
66
67
       <xsl:for-each select="pubDate">
68
        <xsl:call-template name="resourcepubDate" >
69
          <xsl:with-param name="resfirstColStyle" select="$resfirstColStyle"/>
70
         </xsl:call-template>
71
      </xsl:for-each>
72
73
      <xsl:for-each select="language">
74
        <xsl:call-template name="resourcelanguage" >
75
          <xsl:with-param name="resfirstColStyle" select="$resfirstColStyle"/>
76
         </xsl:call-template>
77
      </xsl:for-each>
78
79
      <xsl:for-each select="series">
80
        <xsl:call-template name="resourceseries" >
81
          <xsl:with-param name="resfirstColStyle" select="$resfirstColStyle"/>
82
        </xsl:call-template>
83
      </xsl:for-each>
84
85
      <xsl:if test="creator">
86
        <tr>
87
          <td class="{$ressubHeaderStyle}" colspan="2">
88
            <h3><xsl:value-of select="$creator"/></h3>
89
          </td>
90
        </tr>
91
      </xsl:if>
92
      <xsl:for-each select="creator">
93
        <xsl:call-template name="resourcecreator">
94
          <xsl:with-param name="resfirstColStyle" select="$resfirstColStyle"/>
95
        </xsl:call-template>
96
      </xsl:for-each>
97
98
      <xsl:if test="metadataProvider">
99
        <tr><td class="{$ressubHeaderStyle}" colspan="2">
100
        <xsl:text>Metadata Provider(s):</xsl:text>
101
      </td></tr>
102
      </xsl:if>
103
       <xsl:for-each select="metadataProvider">
104
        <xsl:call-template name="resourcemetadataProvider">
105
          <xsl:with-param name="resfirstColStyle" select="$resfirstColStyle"/>
106
        </xsl:call-template>
107
      </xsl:for-each>
108
109
      <xsl:if test="associatedParty">
110
        <tr>
111
          <td class="{$ressubHeaderStyle}" colspan="2">
112
            <h3><xsl:text>Associated Parties:</xsl:text></h3>
113
          </td>
114
        </tr>
115
      </xsl:if>
116
      <xsl:for-each select="associatedParty">
117
        <xsl:call-template name="resourceassociatedParty">
118
          <xsl:with-param name="resfirstColStyle" select="$resfirstColStyle"/>
119
        </xsl:call-template>
120
      </xsl:for-each>
121
122
      <xsl:for-each select="abstract">
123
        <xsl:call-template name="resourceabstract" >
124
          <xsl:with-param name="resfirstColStyle" select="$resfirstColStyle"/>
125
          <xsl:with-param name="ressubHeaderStyle" select="$ressubHeaderStyle"/>
126
        </xsl:call-template>
127
      </xsl:for-each>
128
129
      <xsl:if test="keywordSet">
130
        <tr><td class="{$ressubHeaderStyle}" colspan="2">
131
             <xsl:text>Keywords:</xsl:text></td></tr>
132
      </xsl:if>
133
      <xsl:for-each select="keywordSet">
134
        <xsl:call-template name="resourcekeywordSet" >
135
          <xsl:with-param name="resfirstColStyle" select="$resfirstColStyle"/>
136
        </xsl:call-template>
137
      </xsl:for-each>
138
139
      <xsl:for-each select="additionalInfo">
140
        <xsl:call-template name="resourceadditionalInfo" >
141
          <xsl:with-param name="resfirstColStyle" select="$resfirstColStyle"/>
142
          <xsl:with-param name="ressubHeaderStyle" select="$ressubHeaderStyle"/>
143
        </xsl:call-template>
144
      </xsl:for-each>
145
146
      <xsl:for-each select="intellectualRights">
147
        <xsl:call-template name="resourceintellectualRights" >
148
          <xsl:with-param name="resfirstColStyle" select="$resfirstColStyle"/>
149
          <xsl:with-param name="ressubHeaderStyle" select="$ressubHeaderStyle"/>
150
        </xsl:call-template>
151
      </xsl:for-each>
152
153
      <xsl:for-each select="distribution">
154
        <xsl:call-template name="resourcedistribution">
155
          <xsl:with-param name="resfirstColStyle" select="$resfirstColStyle"/>
156
          <xsl:with-param name="ressubHeaderStyle" select="$ressubHeaderStyle"/>
157
          <xsl:with-param name="index" select="position()"/>
158
          <xsl:with-param name="docid" select="$docid"/>
159
        </xsl:call-template>
160
      </xsl:for-each>
161
162
    <xsl:for-each select="coverage">
163
      <xsl:call-template name="resourcecoverage">
164
          <xsl:with-param name="resfirstColStyle" select="$resfirstColStyle"/>
165
          <xsl:with-param name="ressubHeaderStyle" select="$ressubHeaderStyle"/>
166
      </xsl:call-template>
167
    </xsl:for-each>
168
    -->
169
170
  </xsl:template>
171
172
  <!-- style the alternate identifier elements -->
173
  <xsl:template name="resourcealternateIdentifier" >
174
      <xsl:param name="resfirstColStyle"/>
175
      <xsl:param name="ressecondColStyle"/>
176
      <xsl:if test="normalize-space(.)!=''">
177
      <tr>
178
        <td class="{$resfirstColStyle}">Alternate Identifier:</td>
179
        <td class="{$ressecondColStyle}"><xsl:value-of select="."/></td>
180
      </tr>
181
      </xsl:if>
182
  </xsl:template>
183
184
185
  <!-- style the short name elements -->
186
  <xsl:template name="resourceshortName">
187
      <xsl:param name="resfirstColStyle"/>
188
      <xsl:param name="ressecondColStyle"/>
189
      <xsl:if test="normalize-space(.)!=''">
190
      <tr>
191
        <td class="{$resfirstColStyle}">Short Name:</td>
192
        <td class="{$ressecondColStyle}"><xsl:value-of select="."/></td>
193
      </tr>
194
      </xsl:if>
195
  </xsl:template>
196
197
198
  <!-- style the title element -->
199
  <xsl:template name="resourcetitle" >
200
      <xsl:param name="resfirstColStyle"/>
201
      <xsl:param name="ressecondColStyle"/>
202
      <xsl:if test="normalize-space(.)!=''">
203
      <tr>
204
        <td class="{$resfirstColStyle}">Title:</td>
205
        <td class="{$ressecondColStyle}">
206
          <em class="bold"><xsl:value-of select="."/></em>
207
        </td>
208
      </tr>
209
      </xsl:if>
210
  </xsl:template>
211
212
  <xsl:template name="resourcecreator" >
213
      <xsl:param name="resfirstColStyle"/>
214
      <tr><td colspan="2">
215
       <xsl:call-template name="party">
216
              <xsl:with-param name="partyfirstColStyle" select="$resfirstColStyle"/>
217
       </xsl:call-template>
218
      </td></tr>
219
   </xsl:template>
220
221
  <xsl:template name="resourcemetadataProvider" >
222
      <xsl:param name="resfirstColStyle"/>
223
      <tr><td colspan="2">
224
      <xsl:call-template name="party">
225
            <xsl:with-param name="partyfirstColStyle" select="$resfirstColStyle"/>
226
      </xsl:call-template>
227
      </td></tr>
228
  </xsl:template>
229
230
  <xsl:template name="resourceassociatedParty">
231
      <xsl:param name="resfirstColStyle"/>
232
      <tr><td colspan="2">
233
      <xsl:call-template name="party">
234
          <xsl:with-param name="partyfirstColStyle" select="$resfirstColStyle"/>
235
      </xsl:call-template>
236
      </td></tr>
237
  </xsl:template>
238
239
240
  <xsl:template name="resourcepubDate">
241
      <xsl:param name="resfirstColStyle"/>
242
      <xsl:if test="normalize-space(../pubDate)!=''">
243
      <tr><td class="{$resfirstColStyle}">
244
        Publication Date:</td><td class="{$secondColStyle}">
245
        <xsl:value-of select="../pubDate"/></td></tr>
246
      </xsl:if>
247
  </xsl:template>
248
249
250
  <xsl:template name="resourcelanguage">
251
      <xsl:param name="resfirstColStyle"/>
252
      <xsl:if test="normalize-space(.)!=''">
253
      <tr><td class="{$resfirstColStyle}">
254
        Language:</td><td class="{$secondColStyle}">
255
        <xsl:value-of select="."/></td></tr>
256
      </xsl:if>
257
  </xsl:template>
258
259
260
  <xsl:template name="resourceseries">
261
      <xsl:param name="resfirstColStyle"/>
262
      <xsl:if test="normalize-space(../series)!=''">
263
      <tr><td class="{$resfirstColStyle}">
264
        Series:</td><td class="{$secondColStyle}">
265
        <xsl:value-of select="../series"/></td></tr>
266
      </xsl:if>
267
  </xsl:template>
268
269
270
  <xsl:template name="resourceabstract">
271
     <xsl:param name="resfirstColStyle"/>
272
     <xsl:param name="ressecondColStyle"/>
273
     <tr>
274
       <td class="{$resfirstColStyle}"><xsl:text>Abstract:</xsl:text></td>
275
       <td>
276
         <xsl:call-template name="text">
277
           <xsl:with-param name="textfirstColStyle" select="$resfirstColStyle"/>
278
           <xsl:with-param name="textsecondColStyle" select="$ressecondColStyle"/>
279
         </xsl:call-template>
280
       </td>
281
     </tr>
282
  </xsl:template>
283
284
285
  <!--<xsl:template match="keywordSet[1]" mode="resource">
286
        <xsl:param name="ressubHeaderStyle"/>
287
        <xsl:param name="resfirstColStyle"/>
288
        <tr><td class="{$ressubHeaderStyle}" colspan="2">
289
        <xsl:text>Keywords:</xsl:text></td></tr>
290
        <xsl:call-template name="renderKeywordSet">
291
          <xsl:with-param name="resfirstColStyle" select="$resfirstColStyle"/>
292
        </xsl:call-template>
293
  </xsl:template>-->
294
295
  <xsl:template name="resourcekeywordSet">
296
      <xsl:for-each select="keywordThesaurus">
297
        <xsl:if test="normalize-space(.)!=''">
298
          <xsl:value-of select="."/>
299
          <xsl:text>: </xsl:text>
300
        </xsl:if>
301
        <xsl:if test="normalize-space(keyword)!=''">
302
        <ul>
303
          <xsl:for-each select="keyword">
304
            <li><xsl:value-of select="."/>
305
            <xsl:if test="./@keywordType and normalize-space(./@keywordType)!=''">
306
              (<xsl:value-of select="./@keywordType"/>)
307
            </xsl:if>
308
            </li>
309
          </xsl:for-each>
310
        </ul>
311
        </xsl:if>
312
      </xsl:for-each>
313
        <xsl:if test="normalize-space(keyword)!=''">
314
        <ul>
315
          <xsl:for-each select="keyword">
316
            <li><xsl:value-of select="."/>
317
            <xsl:if test="./@keywordType and normalize-space(./@keywordType)!=''">
318
              (<xsl:value-of select="./@keywordType"/>)
319
            </xsl:if>
320
            </li>
321
          </xsl:for-each>
322
        </ul>
323
        </xsl:if>
324
  </xsl:template>
325
326
   <xsl:template name="resourceadditionalInfo">
327
     <xsl:param name="ressubHeaderStyle"/>
328
     <xsl:param name="resfirstColStyle"/>
329
     <tr><td class="{$ressubHeaderStyle}" colspan="2">
330
        <xsl:text>Additional Information:</xsl:text>
331
     </td></tr>
332
     <tr><td class="{$resfirstColStyle}">&#160;</td>
333
         <td>
334
           <xsl:call-template name="text">
335
             <xsl:with-param name="textfirstColStyle" select="$resfirstColStyle"/>
336
           </xsl:call-template>
337
         </td>
338
     </tr>
339
  </xsl:template>
340
341
342
   <xsl:template name="resourceintellectualRights">
343
     <xsl:param name="resfirstColStyle"/>
344
     <xsl:param name="ressecondColStyle"/>
345
       <xsl:call-template name="text">
346
         <xsl:with-param name="textsecondColStyle" select="$ressecondColStyle"/>
347
       </xsl:call-template>
348
  </xsl:template>
349
350
   <xsl:template name="resourcedistribution">
351
     <xsl:param name="ressubHeaderStyle"/>
352
     <xsl:param name="resfirstColStyle"/>
353
     <xsl:param name="index"/>
354
     <xsl:param name="docid"/>
355
     <tr><td colspan="2">
356
        <xsl:call-template name="distribution">
357
          <xsl:with-param name="disfirstColStyle" select="$resfirstColStyle"/>
358
          <xsl:with-param name="dissubHeaderStyle" select="$ressubHeaderStyle"/>
359
          <xsl:with-param name="level">toplevel</xsl:with-param>
360
          <xsl:with-param name="distributionindex" select="$index"/>
361
          <xsl:with-param name="docid" select="$docid"/>
362
        </xsl:call-template>
363
     </td></tr>
364
  </xsl:template>
365
366
  <xsl:template name="resourcecoverage">
367
     <xsl:param name="ressubHeaderStyle"/>
368
     <xsl:param name="resfirstColStyle"/>
369
     <tr><td colspan="2">
370
        <xsl:call-template name="coverage">
371
        </xsl:call-template>
372
     </td></tr>
373
  </xsl:template>
374
375
376
</xsl:stylesheet>