Project

General

Profile

1
<?xml version="1.0"?>
2
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
3
    <xsl:param name="sessid"/>
4
    <xsl:param name="enableediting">false</xsl:param>
5
    <!-- This parameter gets overidden by the chosen default qformat -->
6
    <xsl:param name="qformat">default</xsl:param>
7
    <!-- this module for displaying a list of sbc citations, which is NOT an EML DOC -->
8
    <!-- parameters for searching, to be passed into stylesheet. defaults to all if no select 
9
    need 2 sets of quotes in select= " 'string' "
10
        <xsl:param name="author" select=" 'Reed' "/>   -->
11
    <!-- only using author at present -->
12
    <xsl:param name="author"/>
13
    <xsl:param name="keyword"/>
14
    <xsl:param name="year"/>
15
    
16
    <!-- another output attribute: media-type="text/xml" -->
17
    <xsl:preserve-space elements="text"/>
18
    <!--
19
    a parameter to use for counting authors or editors (using this? think not) -->
20
    <xsl:param name="nameCount"/>
21
    <!--
22
    parameters to use for storing contact author for reprint request  -->
23
    <xsl:param name="contactEmail"/>
24
    <xsl:param name="creatorEmail"/>
25
    <!-- 
26
    
27
   Variables for the DOI:
28
    url which can resolve DOIs (keep the trailing slash, so template can add the doi only)-->
29
    <xsl:variable name="doi_resolver_url">http://dx.doi.org/</xsl:variable>
30
    <!-- 
31
    text for the tooltip keep all on one line!-->
32
    <xsl:variable name="tooltip_text_DOI">Digital Object Identifer (DOI): an identifier for a resource on a digital network. Click on the DOI to go directly to the paper at the publisher\'s website. DOIs simplify maintenance of our database because a \'Resolver\' managed by the DOI Foundation handles the connection between the browser and the publisher\'s website</xsl:variable>
33
    <!--
34
    
35
    keys for grouping by year.    -->
36
    <!--  a key for grouping articles by pubdate -->
37
    <xsl:key name="articles-by-pubDate" match="citation[(article or chapter) and
38
        normalize-space(pubDate) ]" use="pubDate"/>
39
    <!--  
40
    a key for grouping presentations by pubdate -->
41
    <xsl:key name="presentations-by-pubDate" match="citation[(presentation) and
42
        normalize-space(pubDate)]" use="pubDate"/>
43
    <!--  
44
    a key for grouping articles by pubdate and author
45
    an attempt at more complicated grouping, to get the label and the citations to show together
46
    doesnt work yet. -->
47
    <xsl:key name="articles-by-pubDate_author" match="citation[(article or chapter) and
48
        normalize-space(pubDate)]" use="concat(pubDate,':',creator/individualName/surName)"/>
49
    <!--
50
    
51
      create a path to the tooltip.js (get tokens in for this)      /style/skins/{$qformat}  -->
52
    <xsl:variable name="javascript_path">/catalog/style/skins/sbclter</xsl:variable>
53
    <!--
54
    
55
    create a metacat url with variables (switch to tokens, please) -->
56
    <xsl:variable name="catalog">http://sbc.lternet.edu/catalog/</xsl:variable>
57
    <xsl:variable name="style">sbclter</xsl:variable>
58
    <xsl:variable name="metacat_url">
59
        <xsl:value-of select="$catalog"/>
60
        <xsl:text>metacat?action=read&amp;qformat=sbclter</xsl:text>
61
        <xsl:text>&amp;docid=</xsl:text>
62
        <!-- docid attached later -->
63
    </xsl:variable>
64
    <!--
65
    variable for sending reprint request via email -->
66
    <!--   <xsl:variable name="send_email">
67
           <a href="mailto:{$contactEmail}?subject=Reprint Request, via SBC-LTER pubsDB">request from author</a> 
68
    </xsl:variable>  -->
69
    <!-- 
70
    Change this match expression if reading single-citation docs
71
    
72
    
73
    -->
74
    <xsl:template match="/citationList">
75
   
76
        <html>
77
            <head>
78
                <script type="text/javascript"/>
79
                <!--
80
                        <script language="JavaScript" type="text/javascript" src="./wz_tooltip.js"></script>
81
             -->
82
                <!--
83
                <script language="JavaScript">
84
                    <![CDATA[
85
                    function resolve_doi {
86
                        document.getSelection();
87
                         if(!Qr){void(Qr=prompt('Enter DOI to resolve, e.g. 10.1000/202:',''))}
88
                         if(Qr)location.href='http://dx.doi.org/'+escape(Qr)+' '
89
                   ]]>
90
                    </script>
91
        -->
92
                <!-- begin the header area
93
        <xsl:call-template name="pageheader" />
94
        end the header area -->
95
            </head>
96
            <body>
97
                <table>
98
                    <tr>
99
                        <td>
100
                            <a name="INPRESS"/>
101
                            <h4>In Press</h4>
102
                        </td>
103
                    </tr>
104
                    <!-- matches only publish-able citations (no theses or presentations), 
105
			which also have an empty (or whitespace) pubDate -->
106
                    <xsl:for-each select="citation[(article or
107
                        chapter or
108
                        book or                 
109
                        editedBook or                
110
                        report or
111
                        audioVisual) and                     
112
                        not(normalize-space(pubDate)) and
113
                        creator/individualName/surName[contains(.,$author)] 
114
                        ]">
115
                        <xsl:sort select="creator/individualName/surName" order="ascending"/>
116
                        <tr>
117
                            <td class="eighty_percent">
118
                                <div class="hanging-paragraph smaller-font bottom-padding">
119
                                    <xsl:call-template name="citation">
120
                                        <xsl:with-param name="author"/>
121
                                    </xsl:call-template>
122
                                </div>
123
                            </td>
124
                            <td class="twenty_percent">
125
                                <div class="bottom-padding left-padding smaller-font">
126
                                    <xsl:call-template name="paper_link_doi"/>
127
                                </div>
128
                            </td>
129
                        </tr>
130
                    </xsl:for-each>
131
                    <tr>
132
                        <td>
133
                            <h4>Published</h4>
134
                        </td>
135
                    </tr>
136
                    <tr>
137
                        <td>
138
                            <a id="ART_CHAP"/>
139
                            <h5>Articles and Chapters</h5>
140
                        </td>
141
                    </tr>
142
                    <!-- citation[(article or chapter) and normalize-space(pubDate) and -->
143
                    <xsl:for-each select="
144
                        citation[generate-id(.)=generate-id(key('articles-by-pubDate',
145
                        pubDate))]/pubDate">
146
                        <xsl:sort select="." order="descending"/>
147
                        <tr>
148
                            <td>
149
                                <h5>
150
                                    <xsl:value-of select="."/>
151
                                </h5>
152
                            </td>
153
                        </tr>
154
                        <!--    <tr><td><xsl:value-of select="count(key('articles-by-pubDate',.))"/></td></tr> -->
155
                        <xsl:for-each select="key('articles-by-pubDate',.)">
156
                            <xsl:sort select="creator/individualName/surName" order="ascending"/>
157
                            <xsl:if test="creator/individualName/surName[contains(.,$author)] ">
158
                                <tr>
159
                                    <td class="eighty_percent">
160
                                        <div class="hanging-paragraph smaller-font bottom-padding">
161
                                            <xsl:call-template name="citation">
162
                                                <xsl:with-param name="author" select="$author"/>
163
                                            </xsl:call-template>
164
                                        </div>
165
                                    </td>
166
                                    <td class="twenty_percent">
167
                                        <div class="bottom-padding left-padding smaller-font">
168
                                            <xsl:call-template name="paper_link_doi"/>
169
                                        </div>
170
                                    </td>
171
                                </tr>
172
                            </xsl:if>
173
                        </xsl:for-each>
174
                    </xsl:for-each>
175
                    <tr>
176
                        <td>
177
                            <a id="BOOKS"/>
178
                            <h5>Books</h5>
179
                        </td>
180
                    </tr>
181
                    <xsl:for-each select="citation[(book or editedBook) and
182
                        normalize-space(pubDate) and
183
                        creator/individualName/surName[contains(.,$author)] ]">
184
                        <xsl:sort select="creator/individualName/surName" order="ascending"/>
185
                        <tr>
186
                            <td class="eighty_percent">
187
                                <div class="hanging-paragraph smaller-font bottom-padding">
188
                                    <xsl:call-template name="citation">
189
                                        <xsl:with-param name="author"/>
190
                                    </xsl:call-template>
191
                                </div>
192
                            </td>
193
                            <td class="twenty_percent">
194
                                <div class="bottom-padding left-padding smaller-font">
195
                                    <xsl:call-template name="paper_link_doi"/>
196
                                </div>
197
                            </td>
198
                        </tr>
199
                    </xsl:for-each>
200
                    <tr>
201
                        <td>
202
                            <a id="THESES"/>
203
                            <h5>Theses</h5>
204
                        </td>
205
                    </tr>
206
                    <xsl:for-each select="citation[thesis and
207
                        normalize-space(pubDate) and
208
                        creator/individualName/surName[contains(.,$author)] ] ">
209
                        <xsl:sort select="creator/individualName/surName" order="ascending"/>
210
                        <tr>
211
                            <td class="eighty_percent">
212
                                <div class="hanging-paragraph smaller-font bottom-padding">
213
                                    <xsl:call-template name="citation">
214
                                        <xsl:with-param name="author"/>
215
                                    </xsl:call-template>
216
                                </div>
217
                            </td>
218
                            <td class="twenty_percent">
219
                                <div class="bottom-padding left-padding smaller-font">
220
                                    <xsl:call-template name="paper_link_doi"/>
221
                                </div>
222
                            </td>
223
                        </tr>
224
                    </xsl:for-each>
225
                    <tr>
226
                        <td>
227
                            <a id="REP_CP"/>
228
                            <h5>Reports and Contributions to Conference Proceedings</h5>
229
                        </td>
230
                    </tr>
231
                    <xsl:for-each select="citation[(report or conferenceProceedings) and
232
                        normalize-space(pubDate) and
233
                        creator/individualName/surName[contains(.,$author)]  ]">
234
                        <xsl:sort select="creator/individualName/surName" order="ascending"/>
235
                        <tr>
236
                            <td class="eighty_percent">
237
                                <div class="hanging-paragraph smaller-font bottom-padding">
238
                                    <xsl:call-template name="citation">
239
                                        <xsl:with-param name="author"/>
240
                                    </xsl:call-template>
241
                                </div>
242
                            </td>
243
                            <td class="twenty_percent">
244
                                <div class="bottom-padding left-padding smaller-font">
245
                                    <xsl:call-template name="paper_link_doi"/>
246
                                </div>
247
                            </td>
248
                        </tr>
249
                    </xsl:for-each>
250
                    <tr>
251
                        <td>
252
                            <a id="AV"/>
253
                            <h5>Audio-Visual Resources</h5>
254
                        </td>
255
                    </tr>
256
                    <xsl:for-each select="citation[audioVisual and
257
                        normalize-space(pubDate) and
258
                        creator/individualName/surName[contains(.,$author)]  ] ">
259
                        <xsl:sort select="creator/individualName/surName" order="ascending"/>
260
                        <tr>
261
                            <td class="eighty_percent">
262
                                <div class="hanging-paragraph smaller-font bottom-padding">
263
                                    <xsl:call-template name="citation">
264
                                        <xsl:with-param name="author"/>
265
                                    </xsl:call-template>
266
                                </div>
267
                            </td>
268
                            <td class="twenty_percent">
269
                                <div class="bottom-padding left-padding smaller-font">
270
                                    <xsl:call-template name="paper_link_doi"/>
271
                                </div>
272
                            </td>
273
                        </tr>
274
                    </xsl:for-each>
275
                    <tr>
276
                        <td>
277
                            <a id="PRESENTATIONS"/>
278
                            <h4>Presentations</h4>
279
                        </td>
280
                    </tr>
281
                    <xsl:for-each select="citation[presentation and
282
                        normalize-space(pubDate) and
283
                        generate-id(.)=generate-id(key('presentations-by-pubDate',pubDate))]/pubDate
284
                        ">
285
                        <xsl:sort select="." order="descending"/>
286
                        <tr>
287
                            <td>
288
                                <h5>
289
                                    <xsl:value-of select="."/>
290
                                </h5>
291
                            </td>
292
                        </tr>
293
                        <xsl:for-each select="key('presentations-by-pubDate',.)">
294
                            <xsl:sort select="creator/individualName/surName" order="ascending"/>
295
                            <xsl:if test="creator/individualName/surName[contains(.,$author)] ">
296
                                <tr>
297
                                    <td class="eighty_percent">
298
                                        <div class="hanging-paragraph smaller-font bottom-padding">
299
                                            <xsl:call-template name="citation">
300
                                                <xsl:with-param name="author" select="$author"/>
301
                                            </xsl:call-template>
302
                                        </div>
303
                                    </td>
304
                                    <td class="twenty_percent">
305
                                        <div class="bottom-padding left-padding smaller-font">
306
                                            <xsl:call-template name="paper_link_doi"/>
307
                                        </div>
308
                                    </td>
309
                                </tr>
310
                            </xsl:if>
311
                        </xsl:for-each>
312
                    </xsl:for-each>
313
                </table>
314
                <script type="text/javascript" language="JavaScript">
315
                    <xsl:attribute name="src">
316
                        <xsl:value-of select="$javascript_path"/>
317
                        <xsl:text>/wz_tooltip.js</xsl:text>
318
                    </xsl:attribute>
319
                </script>
320
                <!-- <script language="JavaScript" type="text/javascript" src="./wz_tooltip.js"></script>  -->
321
            </body>
322
        </html>
323
        <!-- begin the footer area
324
        <xsl:call-template name="pagefooter" />
325
         end the footer area -->
326
        <!-- 
327

    
328
	used to be closing body and html tags here
329

    
330

    
331

    
332

    
333

    
334

    
335

    
336

    
337

    
338
-->
339
    </xsl:template>
340
    <!--
341
    -->
342
    <!--
343
    -->
344
    <xsl:template match="citation" name="citation">
345
        <xsl:param name="nameCount" select="count(creator)"/>
346
        <!-- 
347
        <tr>
348
            <td class="eighty_percent">  
349
                <div class="hanging-paragraph smaller-font bottom-padding"> -->
350
        <!--
351
                        ? put these (authors, date, title) in a tempate called citation_common? -->
352
        <!--
353
                        display authors with template, add punct.-->
354
        <xsl:call-template name="display_names">
355
            <xsl:with-param name="nameCount" select="$nameCount"/>
356
            <!-- doesnt seem to like this parameter. why? -->
357
        </xsl:call-template>
358
        <xsl:apply-templates select="creator/individualName"/>
359
        <!--
360
                        punctuate creators, add text if this is an edited book 
361
			note: jsp did not like the &#160; that was in the empty text string. alternative? 
362
			oxygen cleaned this to remove whitespace if I didnt put in. -->
363
        <xsl:choose>
364
            <xsl:when test="$nameCount=1">
365
                <xsl:choose>
366
                    <xsl:when test="editedBook">
367
                        <xsl:text>, ed. </xsl:text>
368
                    </xsl:when>
369
                    <xsl:otherwise>
370
                        <xsl:text> </xsl:text>
371
                    </xsl:otherwise>
372
                </xsl:choose>
373
            </xsl:when>
374
            <xsl:otherwise>
375
                <!-- more than one creator -->
376
                <xsl:choose>
377
                    <xsl:when test="editedBook">
378
                        <xsl:text>, eds. </xsl:text>
379
                    </xsl:when>
380
                    <xsl:otherwise>
381
                        <xsl:text>. </xsl:text>
382
                    </xsl:otherwise>
383
                </xsl:choose>
384
            </xsl:otherwise>
385
        </xsl:choose>
386
        <!--
387
                        the date goes in only if published -->
388
        <xsl:if test="normalize-space(pubDate)">
389
            <xsl:value-of select="pubDate"/>
390
            <xsl:text>. </xsl:text>
391
        </xsl:if>
392
        <!-- 
393
                        the title goes in all. books are underlined. 
394
	            titles are mixed content: apply-templates invokes built-in rule 
395
	            for title text, italics template below. -->
396
        <xsl:choose>
397
            <xsl:when test="editedBook">
398
                <xsl:call-template name="display-book-title"/>
399
            </xsl:when>
400
            <xsl:when test="book">
401
                <xsl:call-template name="display-book-title"/>
402
            </xsl:when>
403
            <xsl:otherwise>
404
                <xsl:apply-templates select="title"/>
405
                <xsl:text>. </xsl:text>
406
            </xsl:otherwise>
407
        </xsl:choose>
408
        <!-- 
409

    
410

    
411
                        end of common area. 
412
                        add the rest of the citation using a template for each type
413
                    Note: the ifs are now takin care of in the type templates, and inpress pubs should
414
                    show whatever info is available. -->
415
        <!--         <xsl:if test="normalize-space(pubDate)"> -->
416
        <xsl:choose>
417
            <xsl:when test="article">
418
                <xsl:call-template name="article"/>
419
            </xsl:when>
420
            <xsl:when test="chapter">
421
                <xsl:call-template name="chapter"/>
422
            </xsl:when>
423
            <xsl:when test="book">
424
                <xsl:call-template name="book"/>
425
            </xsl:when>
426
            <xsl:when test="editedBook">
427
                <xsl:call-template name="editedBook"/>
428
            </xsl:when>
429
            <xsl:when test="thesis">
430
                <xsl:call-template name="thesis"/>
431
            </xsl:when>
432
            <xsl:when test="presentation">
433
                <xsl:call-template name="presentation"/>
434
            </xsl:when>
435
            <xsl:when test="report">
436
                <xsl:call-template name="report"/>
437
            </xsl:when>
438
            <xsl:when test="audioVisual">
439
                <xsl:call-template name="audioVisual"/>
440
            </xsl:when>
441
            <xsl:when test="conferenceProceedings">
442
                <xsl:call-template name="proceedings"/>
443
            </xsl:when>
444
        </xsl:choose>
445
        
446
        <!-- this bit  shows the sbc id. for now, it makes entries easier to find and edit, but it can also be used to pull up a single-page view  -->
447
        <xsl:text> (sbc-id: </xsl:text>
448
        <xsl:value-of select="alternateIdentifier[@system='sbclter-bibliography']"/>
449
        <xsl:text>)</xsl:text>
450
        
451
        
452
        <!--           </xsl:if>  -->
453
        <!-- 
454
                </div>
455
            </td> 
456
            <td class="twenty_percent">
457
                <div class="bottom-padding left-padding smaller-font">
458
         -->
459
        <!-- 
460
                    
461
                    put the link to paper or resource here
462
                    <xsl:call-template name="paper_link_doi"/>
463
                </div>
464
            </td>
465
         -->
466
        <!-- 
467
        
468
        save till later 
469
            <td class="fifteen_percent">
470
	    <div class="smaller-font bottom-padding">
471
                 <xsl:call-template name="dataset_link"/>
472
		</div>
473
            </td>
474
        </tr> -->
475
    </xsl:template>
476
    <!--
477
    template to display author's names (creator tree). also needed when citation is a chapter, for book's editors (editor tree) -->
478
    <xsl:template name="display_names" match="creator/individualName |
479
        chapter/editor/individualName">
480
        <!-- <xsl:param name="nameCount" select="$nameCount"/> -->
481
        <xsl:variable name="nameCount" select="count(../../creator | ../../editor)"/>
482
        <xsl:if test="$nameCount = 1">
483
            <xsl:call-template name="surName_inits"/>
484
        </xsl:if>
485
        <!--- 
486
                         2 authors: last, f. and f. last -->
487
        <xsl:if test="$nameCount = 2">
488
            <xsl:if test="position() = 1">
489
                <xsl:call-template name="surName_inits"/>
490
                <xsl:text> and </xsl:text>
491
                <xsl:text/>
492
            </xsl:if>
493
            <xsl:if test="position() = 2">
494
                <xsl:call-template name="inits_surName"/>
495
            </xsl:if>
496
        </xsl:if>
497
        <!-- 3+ authors: last, f., f. last, f. last and f. last -->
498
        <xsl:if test="$nameCount &gt;2 ">
499
            <xsl:choose>
500
                <xsl:when test="position() = 1">
501
                    <xsl:call-template name="surName_inits"/>
502
                    <xsl:text>, </xsl:text>
503
                </xsl:when>
504
                <xsl:when test="position() = last()-1">
505
                    <xsl:call-template name="inits_surName"/>
506
                    <xsl:text> and </xsl:text>
507
                </xsl:when>
508
                <xsl:when test="position() = last()">
509
                    <xsl:call-template name="inits_surName"/>
510
                </xsl:when>
511
                <xsl:otherwise>
512
                    <xsl:call-template name="inits_surName"/>
513
                    <xsl:text>, </xsl:text>
514
                </xsl:otherwise>
515
            </xsl:choose>
516
        </xsl:if>
517
    </xsl:template>
518
    <!--
519
    template for formatting author names -->
520
    <!-- surName, initials -->
521
    <xsl:template name="surName_inits">
522
        <xsl:value-of select="surName"/>
523
        <xsl:text>, </xsl:text>
524
        <xsl:for-each select="givenName">
525
            <xsl:value-of select="substring(.,1,1)"/>
526
            <xsl:choose>
527
                <xsl:when test="position() = last()">
528
                    <xsl:text>.</xsl:text>
529
                </xsl:when>
530
                <xsl:otherwise>
531
                    <xsl:text>. </xsl:text>
532
                </xsl:otherwise>
533
            </xsl:choose>
534
        </xsl:for-each>
535
    </xsl:template>
536
    <!--
537
    template for formatting author names -->
538
    <!--initials surName -->
539
    <xsl:template name="inits_surName">
540
        <xsl:for-each select="givenName">
541
            <xsl:value-of select="substring(.,1,1)"/>
542
            <xsl:text>. </xsl:text>
543
        </xsl:for-each>
544
        <xsl:value-of select="surName"/>
545
    </xsl:template>
546
    <!--
547
    TEMPLATE FOR BOOK TITLES (used conditionally)-->
548
    <xsl:template name="display-book-title">
549
        <u>
550
            <xsl:apply-templates select="title"/>
551
        </u>
552
        <xsl:text>.&#160; </xsl:text>
553
    </xsl:template>
554
    <!--
555
    TEMPLATE FOR chapter/bookTitle (always underlined) -->
556
    <xsl:template name="display-bookTitle">
557
        <xsl:if test="chapter">
558
            <u>
559
                <xsl:apply-templates select="chapter/bookTitle"/>
560
            </u>
561
        </xsl:if>
562
        <xsl:if test="conferenceProceedings">
563
            <u>
564
                <xsl:apply-templates select="conferenceProceedings/bookTitle"/>
565
            </u>
566
        </xsl:if>
567
        <xsl:text>.&#160;</xsl:text>
568
    </xsl:template>
569
    <!--
570
    TEMPLATE FOR ITALICs -->
571
    <xsl:template match="emphasis">
572
        <i>
573
            <xsl:apply-templates/>
574
        </i>
575
    </xsl:template>
576
    <!-- to be replaced with this, eventually?
577
    <xsl:template match="italic">
578
         <i><xsl:apply-templates/></i>
579
     </xsl:template>
580
    <xsl:template match="bold">
581
         <b><xsl:apply-templates/></b>
582
     </xsl:template>
583
    <xsl:template match="underline">
584
         <u><xsl:apply-templates/></u>
585
     </xsl:template>
586
-->
587
    <!-- 
588
    TEMPLATE for a conferenceLocation ADDRESS -->
589
    <xsl:template name="address">
590
        <!--  this template is called, so context node is citation, and match need to be in test statements -->
591
        <xsl:if test="descendant::deliveryPoint">
592
            <xsl:for-each select="descendant::deliveryPoint">
593
                <xsl:value-of select="."/>
594
                <!-- its not last delivery point, so a comma between -->
595
                <xsl:if test="position() != last()">, </xsl:if>
596
                <!--  if its the last deliveryPoint, and more address tags follow, put a comma. -->
597
                <xsl:if test="position() = last()">
598
                    <xsl:if test="following-sibling::*">
599
                        <xsl:text>, </xsl:text>
600
                    </xsl:if>
601
                </xsl:if>
602
            </xsl:for-each>
603
            <!-- finished with deliveryPoints -->
604
        </xsl:if>
605
        <xsl:if test="descendant::city">
606
            <xsl:value-of select="descendant::city"/>
607
            <xsl:if test="descendant::administrativeArea">
608
                <xsl:text>, </xsl:text>
609
            </xsl:if>
610
            <xsl:if test="descendant::country">
611
                <xsl:text>, </xsl:text>
612
            </xsl:if>
613
        </xsl:if>
614
        <xsl:if test="descendant::administrativeArea">
615
            <xsl:value-of select="descendant::administrativeArea"/>
616
            <xsl:if test="descendant::country">
617
                <xsl:text>, </xsl:text>
618
            </xsl:if>
619
        </xsl:if>
620
        <xsl:if test="descendant::country">
621
            <xsl:value-of select="descendant::country"/>
622
        </xsl:if>
623
        <!-- end with .  -->
624
        <xsl:text>.</xsl:text>
625
    </xsl:template>
626
    <!-- 
627
    TEMPLATE FOR ARTICLE REF -->
628
    <xsl:template name="article">
629
        <xsl:if test="descendant::journal[text()]">
630
            <xsl:value-of select="article/journal"/>
631
            <xsl:if test="descendant::volume[text()]">
632
                <xsl:text>, </xsl:text>
633
                <xsl:value-of select="article/volume"/>
634
                <xsl:if test="descendant::pageRange[text()]">
635
                    <xsl:text>: </xsl:text>
636
                    <xsl:value-of select="article/pageRange"/>
637
                </xsl:if>
638
            </xsl:if>
639
        </xsl:if>
640
        <xsl:text>. </xsl:text>
641
    </xsl:template>
642
    <!-- 
643
    TEMPLATE FOR CHAPTER REF -->
644
    <xsl:template name="chapter">
645
        <xsl:text>in: </xsl:text>
646
        <xsl:call-template name="display-bookTitle"/>
647
        <xsl:call-template name="display_names"/>
648
        <xsl:apply-templates select="chapter/editor/individualName"/>
649
        <!-- add punctuation for the editors-->
650
        <xsl:choose>
651
            <xsl:when test="$nameCount=1">
652
                <xsl:text>,&#160;ed.&#160;</xsl:text>
653
            </xsl:when>
654
            <xsl:otherwise>
655
                <!-- more than one creator -->
656
                <xsl:text>,&#160;eds.&#160;</xsl:text>
657
            </xsl:otherwise>
658
        </xsl:choose>
659
        <xsl:value-of select="chapter/publisher/organizationName"/>
660
        <xsl:text>.&#160;</xsl:text>
661
    </xsl:template>
662
    <!-- 
663
    TEMPLATE FOR BOOK REF -->
664
    <xsl:template name="book">
665
        <xsl:value-of select="book/publisher/organizationName"/>
666
        <xsl:text>. </xsl:text>
667
        <xsl:if test="descendant::totalPages[text()]">
668
            <xsl:value-of select="book/totalPages"/>
669
            <xsl:text>pp. </xsl:text>
670
        </xsl:if>
671
    </xsl:template>
672
    <!-- 
673
    TEMPLATE FOR editedBOOK REF -->
674
    <xsl:template name="editedBook">
675
        <xsl:value-of select="editedBook/publisher/organizationName"/>
676
        <xsl:text>. </xsl:text>
677
        <xsl:if test="editedBook/totalPages">
678
            <xsl:value-of select="."/>
679
            <xsl:text>pp. </xsl:text>
680
        </xsl:if>
681
    </xsl:template>
682
    <!-- 
683
    TEMPLATE FOR conferenceProceedings REF -->
684
    <xsl:template name="proceedings">
685
        <xsl:text> In: </xsl:text>
686
        <xsl:call-template name="display-bookTitle"/>
687
        <xsl:if test="descendant::pageRange[text()]">
688
            <xsl:text>pp</xsl:text>
689
            <xsl:value-of select="*/pageRange"/>
690
            <xsl:text>. </xsl:text>
691
        </xsl:if>
692
        <xsl:if test="descendant::conferenceDate[text()]">
693
            <xsl:value-of select="*/conferenceDate"/>
694
            <xsl:text>. </xsl:text>
695
        </xsl:if>
696
        <xsl:call-template name="address"/>
697
        <xsl:text>(</xsl:text>
698
        <xsl:value-of select="conferenceProceedings/publisher/organizationName"/>
699
        <xsl:text>).</xsl:text>
700
    </xsl:template>
701
    <!-- 
702
    TEMPLATE FOR report REF -->
703
    <xsl:template name="report">
704
        <xsl:if test="report/reportNumber">
705
            <xsl:text>Rpt. No. </xsl:text>
706
            <xsl:value-of select="report/reportNumber"/>
707
            <xsl:text>, </xsl:text>
708
        </xsl:if>
709
        <xsl:if test="report/publisher/organizationName">
710
            <xsl:value-of select="report/publisher/organizationName"/>
711
            <xsl:text>. </xsl:text>
712
        </xsl:if>
713
        <xsl:if test="report/totalPages">
714
            <xsl:value-of select="report/totalPages"/>
715
            <xsl:text>pp. </xsl:text>
716
        </xsl:if>
717
    </xsl:template>
718
    <!-- 
719
    TEMPLATE FOR THESIS REF -->
720
    <xsl:template name="thesis">
721
        <xsl:value-of select="thesis/degree"/>
722
        <xsl:text>, </xsl:text>
723
        <xsl:value-of select="thesis/institution/organizationName"/>
724
        <!--  look for text in descendants of sibs following institution  -->
725
        <xsl:choose>
726
            <xsl:when test="thesis/institution/following-sibling::descendant[text()]">
727
                <xsl:text>, </xsl:text>
728
                <xsl:if test="descendant::address[child::*[text()]]">
729
                    <xsl:call-template name="address"/>
730
                </xsl:if>
731
                <xsl:if test="descendant::totalPages[text()]">
732
                    <xsl:text>&#160;</xsl:text>
733
                    <xsl:value-of select="thesis/totalPages"/>
734
                    <xsl:text>pp.</xsl:text>
735
                </xsl:if>
736
            </xsl:when>
737
            <xsl:otherwise>
738
                <!-- nothing follows institution -->
739
                <xsl:text>.</xsl:text>
740
            </xsl:otherwise>
741
        </xsl:choose>
742
    </xsl:template>
743
    <!-- 
744
    TEMPLATE FOR AUDIO-VISUAL REF -->
745
    <xsl:template name="audioVisual">
746
        <xsl:value-of select="audioVisual/publisher/organizationName"/>
747
        <xsl:text>. </xsl:text>
748
        <xsl:if test="audioVisual/publicationPlace">
749
            <xsl:value-of select="audioVisual/publicationPlace"/>
750
            <xsl:text>. </xsl:text>
751
        </xsl:if>
752
    </xsl:template>
753
    <!-- 
754
    TEMPLATE FOR PRESENTATION REF -->
755
    <xsl:template name="presentation">
756
        <xsl:text> at: </xsl:text>
757
        <xsl:value-of select="presentation/conferenceName"/>
758
        <!-- if a citation has a address descendant with a child containing text, 
759
            add a comma and call address, otherwise end with a . -->
760
        <xsl:choose>
761
            <xsl:when test="descendant::address[child::*[text()]]">
762
                <xsl:text>, </xsl:text>
763
                <xsl:call-template name="address"/>
764
            </xsl:when>
765
            <xsl:otherwise>
766
                <xsl:text>.</xsl:text>
767
            </xsl:otherwise>
768
        </xsl:choose>
769
    </xsl:template>
770
    <!-- 
771

    
772
    Include a link to the paper. FIrst look for a DOI. 
773
    then a pdf or doc (for inpress only?) or a ppt for presentation.
774
    default to author's email, defaults or text if no usable info. -->
775
    <!-- 
776
    
777
    
778
    *** you could reorganize the whole damn thing and create templates for accessing each type of resource. 
779
    which can hold the entire row. currently, parts of each , and now the second col is type-dependent. 
780
    then you can sort the big chunk of articles by date within it's own template! -->
781
    <xsl:template name="paper_link_doi">
782
        <xsl:variable name="paperUrl" select="distribution/online/url"/>
783
        <xsl:variable name="paperDoi" select="alternateIdentifier[@system='DOI']"/>
784
        <xsl:variable name="contactEmail" select="normalize-space(contact/electronicMailAddress)"/>
785
        <xsl:variable name="creatorEmail"
786
            select="normalize-space(creator[position()=1]/electronicMailAddress)"/>
787
        <xsl:choose>
788
            <xsl:when test="not(normalize-space(pubDate))">
789
            <!-- the paper is not yet published, ok to distribute a pdf or word doc (wont have a doi yet.) -->
790
                <xsl:choose>
791
                    <xsl:when test="contains($paperUrl,'.pdf')">
792
                        <a href="{$paperUrl}">view PDF document</a>
793
                    </xsl:when>
794
                    <xsl:when test="contains($paperUrl,'.doc')">
795
                        <a href="{$paperUrl}">MS-Word preprint</a>
796
                    </xsl:when>
797
                    <xsl:when test="contains($paperUrl,'.gov')">
798
                        <a href="{$paperUrl}">available</a>
799
                    </xsl:when>
800
                    <xsl:otherwise>
801
                        <!-- no distribution/url, so default to an email address -->
802
                        <xsl:call-template name="create_email_link">
803
                            <xsl:with-param name="contactEmail" select="$contactEmail"/>
804
                            <xsl:with-param name="creatorEmail" select="$creatorEmail"/>
805
                        </xsl:call-template>
806
                    </xsl:otherwise>
807
                </xsl:choose>
808
            </xsl:when>
809
            <xsl:otherwise>
810
                <!--  
811
                it's got a pub date, copyrights may apply -->
812
                <xsl:choose>
813
                    <!-- but if its a presentation, OK to distribute a powerpoint  -->
814
                <xsl:when test="presentation">
815
                    <xsl:choose>
816
                        <xsl:when test="contains($paperUrl,'.ppt')">
817
                            <a href="{$paperUrl}">PowerPoint document</a>
818
                        </xsl:when>
819
                        <xsl:otherwise>
820
                            <xsl:call-template name="create_email_link">
821
                                <xsl:with-param name="contactEmail" select="$contactEmail"/>
822
                                <xsl:with-param name="creatorEmail" select="$creatorEmail"/>
823
                            </xsl:call-template>
824
                        </xsl:otherwise>
825
                    </xsl:choose>
826
                </xsl:when>
827
            <xsl:otherwise>
828
                <!--  its got a pub date, and its not a presentation, so copyrights probably apply.
829
                look for a DOI first-->
830
                <!-- 
831
                (maybe will need a url to another catalog, eg, for a film, report or proceedings? -->
832
                <xsl:choose>
833
                    <xsl:when test="$paperDoi">
834
                        <!-- resolve the DOI, with a url  -->
835
                        <a>
836
                            <xsl:attribute name="href">
837
                                <xsl:value-of select="$doi_resolver_url"/>
838
                                <xsl:value-of select="$paperDoi "/>
839
                            </xsl:attribute>
840
			<!--        
841
		    <xsl:value-of select="$paperDoi"/>
842
			-->
843
			access with DOI
844
                            <!-- available via paper's DOI -->
845
                        </a>
846
                        <br/>
847
                        <a href="http://doi.org">
848
                            <xsl:attribute name="onmouseover">
849
                                <xsl:text>return escape('</xsl:text>
850
                                <xsl:value-of select="$tooltip_text_DOI"/>
851
                                <xsl:text>')</xsl:text>
852
                            </xsl:attribute> (what's this?) </a>
853
                    </xsl:when>
854
                    <xsl:when test="contains($paperUrl,'.com')">
855
                        <a href="{$paperUrl}">see publisher website</a>
856
                    </xsl:when>
857
                    <xsl:when test="contains($paperUrl,'.gov')">
858
                        <a href="{$paperUrl}">available</a>
859
                    </xsl:when>
860
                    <xsl:when test="contains($paperUrl,'.html')">
861
                        <a href="{$paperUrl}">available through another catalog</a>
862
                    </xsl:when>
863
                    <xsl:otherwise>
864
                        <!-- email the contact author -->
865
                        <xsl:call-template name="create_email_link">
866
                            <xsl:with-param name="contactEmail" select="$contactEmail"/>
867
                            <xsl:with-param name="creatorEmail" select="$creatorEmail"/>
868
                        </xsl:call-template>
869
                    </xsl:otherwise>
870
                </xsl:choose>
871
            </xsl:otherwise>
872
                </xsl:choose>
873
            </xsl:otherwise>
874
            </xsl:choose>
875
    </xsl:template>
876
    <!-- 
877
    
878
    template for sending an email to a contact author -->
879
    <xsl:template name="create_email_link">
880
        <xsl:param name="contactEmail" select="$contactEmail"/>
881
        <xsl:param name="creatorEmail" select="$creatorEmail"/>
882
        <xsl:choose>
883
            <xsl:when test="$contactEmail">
884
                <xsl:variable name="email4requests" select="$contactEmail"/>
885
                <a href="mailto:{$email4requests}?subject=Reprint Request, via SBC-LTER
886
                    pubsDB">email author</a>
887
            </xsl:when>
888
            <xsl:otherwise>
889
                <xsl:choose>
890
                    <xsl:when test="$creatorEmail">
891
                        <xsl:variable name="email4requests" select="$creatorEmail"/>
892
                        <a href="mailto:{$email4requests}?subject=Reprint Request, via
893
                            SBC-LTER pubs DB">email author</a>
894
                    </xsl:when>
895
                    <xsl:otherwise>
896
                        <xsl:text>contact author</xsl:text>
897
                    </xsl:otherwise>
898
                </xsl:choose>
899
            </xsl:otherwise>
900
        </xsl:choose>
901
    </xsl:template>
902
    <!--
903
    
904
    template for including a link to a dataset-->
905
    <xsl:template name="dataset_link">
906
        <xsl:if test="normalize-space(datasetID)">
907
            <!--create the url to datasets -->
908
            <!-- might have more than one. -->
909
            <xsl:for-each select="datasetID">
910
                <xsl:variable name="docid" select="."/>
911
                <a href="{$metacat_url}{$docid}">View Dataset</a>
912
                <br/>
913
            </xsl:for-each>
914
        </xsl:if>
915
    </xsl:template>
916
</xsl:stylesheet>
(13-13/14)