Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
quarto-dev
GitHub Repository: quarto-dev/quarto-cli
Path: blob/main/src/resources/preview/jats/quarto-jats-html.xsl
12923 views
1
<?xml version="1.0"?>
2
<!-- ============================================================= -->
3
<!-- MODULE: HTML Preview of NISO JATS Publishing 1.0 XML -->
4
<!-- DATE: May-June 2012 -->
5
<!-- -->
6
<!-- ============================================================= -->
7
8
<!-- ============================================================= -->
9
<!-- SYSTEM: NCBI Archiving and Interchange Journal Articles -->
10
<!-- -->
11
<!-- PURPOSE: Provide an HTML preview of a journal article, -->
12
<!-- in a form suitable for reading. -->
13
<!-- -->
14
<!-- PROCESSOR DEPENDENCIES: -->
15
<!-- None: standard XSLT 1.0 -->
16
<!-- Tested using Saxon 6.5, Tranformiix (Firefox), -->
17
<!-- Saxon 9.4.0.3 -->
18
<!-- -->
19
<!-- COMPONENTS REQUIRED: -->
20
<!-- 1) This stylesheet -->
21
<!-- 2) CSS styles defined in jats-preview.css -->
22
<!-- (to be placed with the results) -->
23
<!-- -->
24
<!-- INPUT: An XML document valid to (any of) the -->
25
<!-- NISO JATS 1.0, NLM/NCBI Journal Publishing 3.0, -->
26
<!-- or NLM/NCBI Journal Publishing 2.3 DTDs. -->
27
<!-- (May also work with older variants, -->
28
<!-- and note further assumptions and limitations -->
29
<!-- below.) -->
30
<!-- -->
31
<!-- OUTPUT: HTML (XHTML if a postprocessor is used) -->
32
<!-- -->
33
<!-- CREATED FOR: -->
34
<!-- Digital Archive of Journal Articles -->
35
<!-- National Center for Biotechnology Information (NCBI) -->
36
<!-- National Library of Medicine (NLM) -->
37
<!-- -->
38
<!-- CREATED BY: -->
39
<!-- Wendell Piez (based on HTML design by -->
40
<!-- Kate Hamilton and Debbie Lapeyre, 2004), -->
41
<!-- Mulberry Technologies, Inc. -->
42
<!-- -->
43
<!-- ============================================================= -->
44
45
<!-- ============================================================= -->
46
<!--
47
This work is in the public domain and may be reproduced, published or
48
otherwise used without the permission of the National Library of Medicine (NLM).
49
50
We request only that the NLM is cited as the source of the work.
51
52
Although all reasonable efforts have been taken to ensure the accuracy and
53
reliability of the software and data, the NLM and the U.S. Government do
54
not and cannot warrant the performance or results that may be obtained by
55
using this software or data. The NLM and the U.S. Government disclaim all
56
warranties, express or implied, including warranties of performance,
57
merchantability or fitness for any particular purpose.
58
-->
59
<!-- ============================================================= -->
60
61
<!-- Change history -->
62
63
<!-- From jpub3-html.xsl v3.0 to jats-html.xsl v1.0:
64
65
Calls to 'normalize-space($node)' where $node is not a string are
66
expressed as 'normalize-space(string($node)) in order to provide
67
type safety in some XSLT 2.0 processors.
68
69
Support for certain elements in NLM Blue v2.3 is added to provide
70
backward compatibility:
71
floats-wrap (same as floats-group)
72
chem-struct-wrapper (same as chem-struct-wrap)
73
custom-meta-wrap (same as custom-meta-group)
74
floats-wrap (same as floats-group)
75
gloss-group (same as glossary)
76
citation
77
contract-num
78
contract-sponsor
79
grant-num
80
grant-sponsor
81
82
Support is added for looser structures for title-group elements
83
in 2.3 (title, trans-title, trans-subtitle etc.) Same for 2.3
84
tagging of permissions info (copyright-statement, copyright-year,
85
license) and funding/contract info (contract-num, contract-sponsor,
86
grant-num, grant-sponsor).
87
88
Elements newly permitted in JATS journal-meta
89
(contrib-group, aff, aff-alternatives) are supported.
90
91
New elements in NISO JATS v1.0 are supported:
92
aff-alternatives
93
citation-alternatives
94
collab-alternatives
95
trans-title-group (with @xml:lang)
96
contrib-id
97
count>
98
issn-l
99
nested-kwd
100
101
Added support for @pub-id-type='arXiv'
102
103
Named anchor logic extended to support "alternatives" wrappers
104
for aff, contrib, citation etc.
105
106
Footer text is emended, with name of transformation (stylesheet
107
or pipeline) parameterized.
108
109
-->
110
<xsl:stylesheet version="1.0"
111
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
112
xmlns:xlink="http://www.w3.org/1999/xlink"
113
xmlns:mml="http://www.w3.org/1998/Math/MathML"
114
exclude-result-prefixes="xlink mml">
115
116
117
<!--<xsl:output method="xml" indent="no" encoding="UTF-8"
118
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
119
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>-->
120
121
122
<xsl:output doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
123
doctype-system="http://www.w3.org/TR/html4/loose.dtd"
124
encoding="UTF-8"/>
125
126
<xsl:strip-space elements="*"/>
127
128
<!-- Space is preserved in all elements allowing #PCDATA -->
129
<xsl:preserve-space
130
elements="abbrev abbrev-journal-title access-date addr-line
131
aff alt-text alt-title article-id article-title
132
attrib award-id bold chapter-title chem-struct
133
collab comment compound-kwd-part compound-subject-part
134
conf-acronym conf-date conf-loc conf-name conf-num
135
conf-sponsor conf-theme contrib-id copyright-holder
136
copyright-statement copyright-year corresp country
137
date-in-citation day def-head degrees disp-formula
138
edition elocation-id email etal ext-link fax fpage
139
funding-source funding-statement given-names glyph-data
140
gov inline-formula inline-supplementary-material
141
institution isbn issn-l issn issue issue-id issue-part
142
issue-sponsor issue-title italic journal-id
143
journal-subtitle journal-title kwd label license-p
144
long-desc lpage meta-name meta-value mixed-citation
145
monospace month named-content object-id on-behalf-of
146
overline p page-range part-title patent person-group
147
phone prefix preformat price principal-award-recipient
148
principal-investigator product pub-id publisher-loc
149
publisher-name related-article related-object role
150
roman sans-serif sc season self-uri series series-text
151
series-title sig sig-block size source speaker std
152
strike string-name styled-content std-organization
153
sub subject subtitle suffix sup supplement surname
154
target td term term-head tex-math textual-form th
155
time-stamp title trans-source trans-subtitle trans-title
156
underline uri verse-line volume volume-id volume-series
157
xref year
158
159
mml:annotation mml:ci mml:cn mml:csymbol mml:mi mml:mn
160
mml:mo mml:ms mml:mtext"/>
161
162
163
<xsl:param name="transform" select="'quarto-jats-html.xsl'"/>
164
165
<xsl:param name="css" select="'quarto-jats-preview.css'"/>
166
167
<xsl:param name="report-warnings" select="'no'"/>
168
169
<xsl:variable name="verbose" select="$report-warnings='yes'"/>
170
171
<!-- Keys -->
172
173
<!-- To reduce dependency on a DTD for processing, we declare
174
a key to use instead of the id() function. -->
175
<xsl:key name="element-by-id" match="*[@id]" use="@id"/>
176
177
<!-- Enabling retrieval of cross-references to objects -->
178
<xsl:key name="xref-by-rid" match="xref" use="@rid"/>
179
180
<!-- ============================================================= -->
181
<!-- ROOT TEMPLATE - HANDLES HTML FRAMEWORK -->
182
<!-- ============================================================= -->
183
184
<xsl:template match="/">
185
<html>
186
<!-- HTML header -->
187
<xsl:call-template name="make-html-header"/>
188
<body>
189
<xsl:apply-templates/>
190
</body>
191
<!-- quarto-after-body -->
192
</html>
193
</xsl:template>
194
195
196
<xsl:template name="make-html-header">
197
<head>
198
<title>
199
<xsl:variable name="authors">
200
<xsl:call-template name="author-string"/>
201
</xsl:variable>
202
<xsl:value-of select="normalize-space(string($authors))"/>
203
<xsl:if test="normalize-space(string($authors))">: </xsl:if>
204
<xsl:value-of
205
select="/article/front/article-meta/title-group/article-title[1]"/>
206
</title>
207
<link rel="stylesheet" type="text/css" href="{$css}"/>
208
<!-- XXX check: any other header stuff? XXX -->
209
</head>
210
</xsl:template>
211
212
213
<!-- ============================================================= -->
214
<!-- TOP LEVEL -->
215
<!-- ============================================================= -->
216
217
<!--
218
content model for article:
219
(front,body?,back?,floats-group?,(sub-article*|response*))
220
221
content model for sub-article:
222
((front|front-stub),body?,back?,floats-group?,
223
(sub-article*|response*))
224
225
content model for response:
226
((front|front-stub),body?,back?,floats-group?) -->
227
228
<xsl:template match="article">
229
<xsl:call-template name="make-article"/>
230
</xsl:template>
231
232
<xsl:template match="sub-article | response">
233
<hr class="part-rule"/>
234
<xsl:call-template name="make-article"/>
235
</xsl:template>
236
237
238
<!-- ============================================================= -->
239
<!-- "make-article" for the document architecture -->
240
<!-- ============================================================= -->
241
242
<xsl:template name="make-article">
243
<!-- Generates a series of (flattened) divs for contents of any
244
article, sub-article or response -->
245
246
<!-- variable to be used in div id's to keep them unique -->
247
<xsl:variable name="this-article">
248
<xsl:apply-templates select="." mode="id"/>
249
</xsl:variable>
250
251
<div id="{$this-article}-front" class="front">
252
<xsl:apply-templates select="front | front-stub"/>
253
</div>
254
255
<!-- body -->
256
<xsl:for-each select="body">
257
<div id="{$this-article}-body" class="body">
258
<xsl:apply-templates/>
259
</div>
260
</xsl:for-each>
261
262
<xsl:if test="back | $loose-footnotes">
263
<!-- $loose-footnotes is defined below as any footnotes outside
264
front matter or fn-group -->
265
<div id="{$this-article}-back" class="back">
266
<xsl:call-template name="make-back"/>
267
</div>
268
</xsl:if>
269
270
<xsl:for-each select="floats-group | floats-wrap">
271
<!-- floats-wrap is from 2.3 -->
272
<div id="{$this-article}-floats" class="back">
273
<xsl:call-template name="main-title">
274
<xsl:with-param name="contents">
275
<span class="generated">Floating objects</span>
276
</xsl:with-param>
277
</xsl:call-template>
278
<xsl:apply-templates/>
279
</div>
280
</xsl:for-each>
281
282
<!-- more metadata goes in the footer -->
283
<div id="{$this-article}-footer" class="footer">
284
<xsl:call-template name="footer-metadata"/>
285
<xsl:call-template name="footer-branding"/>
286
</div>
287
288
<!-- sub-article or response (recursively calls
289
this template) -->
290
<xsl:apply-templates select="sub-article | response"/>
291
292
</xsl:template>
293
294
<xsl:template match="front | front-stub">
295
296
<!-- change context to front/article-meta (again) -->
297
<xsl:for-each select="article-meta | self::front-stub">
298
<div class="metadata centered">
299
<xsl:apply-templates mode="metadata" select="title-group"/>
300
</div>
301
<div class="metadata two-column table authors">
302
<div class="row">
303
<div class="cell">
304
<!-- contrib-group, aff, aff-alternatives, author-notes -->
305
<xsl:apply-templates mode="metadata" select="contrib-group"/>
306
<xsl:if test="aff | aff-alternatives">
307
<div class="metadata table cell metadata-group">
308
<xsl:apply-templates mode="metadata"
309
select="author-notes"/>
310
</div>
311
</xsl:if>
312
313
</div>
314
<div class="cell">
315
<!-- back in article-meta or front-stub context -->
316
<xsl:if test="aff | aff-alternatives">
317
<div class="metadata two-column table">
318
<div class="row">
319
320
<div class="cell">
321
<div class="metadata-group">
322
<xsl:apply-templates mode="metadata"
323
select="aff | aff-alternatives"/>
324
</div>
325
</div>
326
</div>
327
</div>
328
</xsl:if>
329
</div>
330
</div>
331
</div>
332
333
334
<!-- abstract(s) -->
335
<xsl:if test="abstract | trans-abstract">
336
<!-- rule separates title+authors from abstract(s) -->
337
<hr class="section-rule"/>
338
339
<xsl:for-each select="abstract | trans-abstract">
340
<!-- title in left column, content (paras, secs) in right -->
341
<div class="section-abstract">
342
<h4 class="abstract-title">
343
<xsl:apply-templates select="title/node()"/>
344
<xsl:if test="not(normalize-space(string(title)))">
345
<span class="generated">
346
<xsl:if test="self::trans-abstract">Translated </xsl:if>
347
<xsl:text>Abstract</xsl:text>
348
</span>
349
</xsl:if>
350
</h4>
351
<xsl:apply-templates select="*[not(self::title)]"/>
352
</div>
353
</xsl:for-each>
354
<!-- end of abstract or trans-abstract -->
355
</xsl:if>
356
<!-- end of dealing with abstracts -->
357
</xsl:for-each>
358
<xsl:for-each select="notes">
359
<div class="metadata">
360
<xsl:apply-templates mode="metadata" select="."/>
361
</div>
362
</xsl:for-each>
363
<hr class="part-rule"/>
364
365
<!-- end of big front-matter pull -->
366
</xsl:template>
367
368
369
<xsl:template name="footer-metadata">
370
371
<hr class="part-rule"/>
372
373
<xsl:for-each select="front | front-stub">
374
375
<!-- First Table: journal and article metadata -->
376
<div class="metadata two-column table">
377
<div class="row">
378
<!-- Cell 1: journal information -->
379
<xsl:for-each select="journal-meta">
380
<!-- (journal-id+, journal-title-group*, (contrib-group | aff | aff-alternatives)*,
381
issn+, issn-l?, isbn*, publisher?, notes*, self-uri*) -->
382
<div class="cell">
383
<h4 class="generated">
384
<xsl:text>Journal Information</xsl:text>
385
</h4>
386
<div class="metadata-group">
387
<xsl:apply-templates select="journal-id | journal-title-group" mode="metadata"/>
388
<!-- the following may appear in 2.3 -->
389
<xsl:apply-templates mode="metadata" select="journal-title | journal-subtitle | trans-title | trans-subtitle | abbrev-journal-title"/>
390
<!-- contrib-group, aff, aff-alternatives, author-notes -->
391
<xsl:apply-templates mode="metadata"
392
select="contrib-group"/>
393
<xsl:if test="aff | aff-alternatives | author-notes">
394
<div class="metadata-group">
395
<xsl:apply-templates mode="metadata"
396
select="aff | aff-alternatives | author-notes"/>
397
</div>
398
</xsl:if>
399
<xsl:apply-templates select="issn | issn-l | isbn | publisher | notes | self-uri" mode="metadata"/>
400
</div>
401
</div>
402
</xsl:for-each>
403
404
<!-- Cell 2: Article information -->
405
<xsl:for-each select="article-meta | self::front-stub">
406
<!-- content model:
407
(article-id*, article-categories?, title-group,
408
(contrib-group | aff)*,
409
author-notes?, pub-date+, volume?, volume-id*,
410
volume-series?, issue?, issue-id*, issue-title*,
411
issue-sponsor*, issue-part?, isbn*, supplement?,
412
((fpage, lpage?, page-range?) | elocation-id)?,
413
(email | ext-link | uri | product |
414
supplementary-material)*,
415
history?, permissions?, self-uri*, related-article*,
416
abstract*, trans-abstract*,
417
kwd-group*, funding-group*, conference*, counts?,
418
custom-meta-group?)
419
420
These are handled as follows:
421
422
In the "Article Information" header cell:
423
article-id
424
pub-date
425
volume
426
volume-id
427
volume-series
428
issue
429
issue-id
430
issue-title
431
issue-sponsor
432
issue-part
433
isbn
434
supplement
435
fpage
436
lpage
437
page-range
438
elocation-id
439
email
440
ext-link
441
uri
442
product
443
history
444
permissions
445
self-uri
446
related-article
447
funding-group
448
conference
449
450
In the "Article title" cell:
451
title-group
452
contrib-group
453
aff
454
author-notes
455
abstract
456
trans-abstract
457
458
In the metadata footer
459
article-categories
460
supplementary-material
461
kwd-group
462
counts
463
custom-meta-group
464
465
-->
466
467
<div class="cell">
468
<h4 class="generated">
469
<xsl:text>Article Information</xsl:text>
470
</h4>
471
<div class="metadata-group">
472
473
<xsl:apply-templates mode="metadata"
474
select="email | ext-link | uri | self-uri"/>
475
476
<xsl:apply-templates mode="metadata" select="product"/>
477
478
<!-- only in 2.3 -->
479
<xsl:apply-templates mode="metadata" select="copyright-statement |
480
copyright-year | license"/>
481
482
<xsl:apply-templates mode="metadata" select="permissions"/>
483
484
<xsl:apply-templates mode="metadata" select="history/date"/>
485
486
<xsl:apply-templates mode="metadata" select="pub-date"/>
487
488
<xsl:call-template name="volume-info">
489
<!-- handles volume?, volume-id*, volume-series? -->
490
</xsl:call-template>
491
492
<xsl:call-template name="issue-info">
493
<!-- handles issue?, issue-id*, issue-title*,
494
issue-sponsor*, issue-part? -->
495
</xsl:call-template>
496
497
<xsl:call-template name="page-info">
498
<!-- handles (fpage, lpage?, page-range?) -->
499
</xsl:call-template>
500
501
<xsl:apply-templates mode="metadata" select="elocation-id"/>
502
503
<xsl:apply-templates mode="metadata" select="isbn"/>
504
505
<xsl:apply-templates mode="metadata"
506
select="supplement | related-article | conference"/>
507
508
<xsl:apply-templates mode="metadata" select="article-id"/>
509
510
<!-- only in 2.3 -->
511
<xsl:apply-templates mode="metadata" select="contract-num | contract-sponsor |
512
grant-num | grant-sponsor"/>
513
514
<xsl:apply-templates mode="metadata" select="funding-group/*">
515
<!-- includes (award-group*, funding-statement*,
516
open-access?) -->
517
</xsl:apply-templates>
518
519
<xsl:apply-templates mode="metadata"
520
select="supplementary-material"/>
521
522
<xsl:apply-templates mode="metadata"
523
select="article-categories | kwd-group | counts"/>
524
525
<xsl:apply-templates mode="metadata"
526
select="custom-meta-group | custom-meta-wrap"/>
527
528
</div>
529
</div>
530
</xsl:for-each>
531
</div>
532
</div>
533
534
535
</xsl:for-each>
536
537
<xsl:variable name="process-warnings">
538
<xsl:call-template name="process-warnings"/>
539
</xsl:variable>
540
541
<xsl:if test="normalize-space(string($process-warnings))">
542
<hr class="part-rule"/>
543
<div class="metadata one-column table">
544
<!--<div class="row">
545
<div class="cell spanning">
546
547
</div>
548
</div>-->
549
<div class="row">
550
<div class="cell spanning">
551
<h4 class="generated">
552
<xsl:text>Process warnings</xsl:text>
553
</h4>
554
<p>Warnings reported by the processor due to problematic markup follow:</p>
555
<div class="metadata-group">
556
<xsl:copy-of select="$process-warnings"/>
557
</div>
558
</div>
559
</div>
560
</div>
561
</xsl:if>
562
</xsl:template>
563
564
565
<!-- ============================================================= -->
566
<!-- METADATA PROCESSING -->
567
<!-- ============================================================= -->
568
569
<!-- Includes mode "metadata" for front matter, along with
570
"metadata-inline" for metadata elements collapsed into
571
inline sequences, plus associated named templates -->
572
573
<!-- WAS journal-meta content:
574
journal-id+, journal-title-group*, issn+, isbn*, publisher?,
575
notes? -->
576
<!-- (journal-id+, journal-title-group*, (contrib-group | aff | aff-alternatives)*,
577
issn+, issn-l?, isbn*, publisher?, notes*, self-uri*) -->
578
<xsl:template match="journal-id" mode="metadata">
579
<xsl:call-template name="metadata-labeled-entry">
580
<xsl:with-param name="label">
581
<xsl:text>Journal ID</xsl:text>
582
<xsl:for-each select="@journal-id-type">
583
<xsl:text> (</xsl:text>
584
<span class="data">
585
<xsl:value-of select="."/>
586
</span>
587
<xsl:text>)</xsl:text>
588
</xsl:for-each>
589
</xsl:with-param>
590
</xsl:call-template>
591
</xsl:template>
592
593
594
<xsl:template match="journal-title-group" mode="metadata">
595
<xsl:apply-templates mode="metadata"/>
596
</xsl:template>
597
598
599
<xsl:template match="issn" mode="metadata">
600
<xsl:call-template name="metadata-labeled-entry">
601
<xsl:with-param name="label">
602
<xsl:text>ISSN</xsl:text>
603
<xsl:call-template name="append-pub-type"/>
604
</xsl:with-param>
605
</xsl:call-template>
606
</xsl:template>
607
608
609
<xsl:template match="issn-l" mode="metadata">
610
<xsl:call-template name="metadata-labeled-entry">
611
<xsl:with-param name="label">
612
<xsl:text>ISSN-L</xsl:text>
613
<xsl:call-template name="append-pub-type"/>
614
</xsl:with-param>
615
</xsl:call-template>
616
</xsl:template>
617
618
619
<xsl:template match="isbn" mode="metadata">
620
<xsl:call-template name="metadata-labeled-entry">
621
<xsl:with-param name="label">
622
<xsl:text>ISBN</xsl:text>
623
</xsl:with-param>
624
</xsl:call-template>
625
</xsl:template>
626
627
628
<xsl:template match="publisher" mode="metadata">
629
<xsl:call-template name="metadata-labeled-entry">
630
<xsl:with-param name="label">Publisher</xsl:with-param>
631
<xsl:with-param name="contents">
632
<xsl:apply-templates select="publisher-name" mode="metadata-inline"/>
633
<xsl:apply-templates select="publisher-loc" mode="metadata-inline"/>
634
</xsl:with-param>
635
</xsl:call-template>
636
</xsl:template>
637
638
639
<xsl:template match="publisher-name" mode="metadata-inline">
640
<xsl:apply-templates/>
641
</xsl:template>
642
643
644
<xsl:template match="publisher-loc" mode="metadata-inline">
645
<span class="generated"> (</span>
646
<xsl:apply-templates/>
647
<span class="generated">)</span>
648
</xsl:template>
649
650
651
<xsl:template match="notes" mode="metadata">
652
<xsl:call-template name="metadata-area">
653
<xsl:with-param name="label">Notes</xsl:with-param>
654
</xsl:call-template>
655
</xsl:template>
656
657
658
<!-- journal-title-group content:
659
(journal-title*, journal-subtitle*, trans-title-group*,
660
abbrev-journal-title*) -->
661
662
<xsl:template match="journal-title" mode="metadata">
663
<xsl:call-template name="metadata-labeled-entry">
664
<xsl:with-param name="label">Title</xsl:with-param>
665
</xsl:call-template>
666
</xsl:template>
667
668
669
<xsl:template match="journal-subtitle" mode="metadata">
670
<xsl:call-template name="metadata-labeled-entry">
671
<xsl:with-param name="label">Subtitle</xsl:with-param>
672
</xsl:call-template>
673
</xsl:template>
674
675
676
<xsl:template match="trans-title-group" mode="metadata">
677
<xsl:apply-templates mode="metadata"/>
678
</xsl:template>
679
680
681
<xsl:template match="abbrev-journal-title" mode="metadata">
682
<xsl:call-template name="metadata-labeled-entry">
683
<xsl:with-param name="label">Abbreviated Title</xsl:with-param>
684
</xsl:call-template>
685
</xsl:template>
686
687
688
<!-- trans-title-group content: (trans-title, trans-subtitle*) -->
689
690
<xsl:template match="trans-title" mode="metadata">
691
<xsl:call-template name="metadata-labeled-entry">
692
<xsl:with-param name="label">
693
<xsl:text>Translated Title</xsl:text>
694
<xsl:for-each select="(../@xml:lang|@xml:lang)[last()]">
695
<xsl:text> (</xsl:text>
696
<span class="data">
697
<xsl:value-of select="."/>
698
</span>
699
<xsl:text>)</xsl:text>
700
</xsl:for-each>
701
</xsl:with-param>
702
</xsl:call-template>
703
</xsl:template>
704
705
706
<xsl:template match="trans-subtitle" mode="metadata">
707
<xsl:call-template name="metadata-labeled-entry">
708
<xsl:with-param name="label">
709
<xsl:text>Translated Subtitle</xsl:text>
710
<xsl:for-each select="(../@xml:lang|@xml:lang)[last()]">
711
<xsl:text> (</xsl:text>
712
<span class="data">
713
<xsl:value-of select="."/>
714
</span>
715
<xsl:text>)</xsl:text>
716
</xsl:for-each>
717
</xsl:with-param>
718
</xsl:call-template>
719
</xsl:template>
720
721
722
<!-- article-meta content:
723
(article-id*, article-categories?, title-group,
724
(contrib-group | aff)*, author-notes?, pub-date+, volume?,
725
volume-id*, volume-series?, issue?, issue-id*,
726
issue-title*, issue-sponsor*, issue-part?, isbn*,
727
supplement?, ((fpage, lpage?, page-range?) | elocation-id)?,
728
(email | ext-link | uri | product | supplementary-material)*,
729
history?, permissions?, self-uri*, related-article*,
730
abstract*, trans-abstract*,
731
kwd-group*, funding-group*, conference*, counts?,
732
custom-meta-group?) -->
733
734
<!-- In order of appearance... -->
735
736
<xsl:template match="ext-link" mode="metadata">
737
<xsl:call-template name="metadata-labeled-entry">
738
<xsl:with-param name="label">
739
<xsl:text>External link</xsl:text>
740
<xsl:for-each select="ext-link-type">
741
<xsl:text> (</xsl:text>
742
<span class="data">
743
<xsl:value-of select="."/>
744
</span>
745
<xsl:text>)</xsl:text>
746
</xsl:for-each>
747
</xsl:with-param>
748
<xsl:with-param name="contents">
749
<xsl:apply-templates select="."/>
750
</xsl:with-param>
751
</xsl:call-template>
752
</xsl:template>
753
754
755
<xsl:template match="email" mode="metadata">
756
<xsl:call-template name="metadata-labeled-entry">
757
<xsl:with-param name="label">Email</xsl:with-param>
758
<xsl:with-param name="contents">
759
<xsl:apply-templates select="."/>
760
</xsl:with-param>
761
</xsl:call-template>
762
</xsl:template>
763
764
765
<xsl:template match="uri" mode="metadata">
766
<xsl:call-template name="metadata-labeled-entry">
767
<xsl:with-param name="label">URI</xsl:with-param>
768
<xsl:with-param name="contents">
769
<xsl:apply-templates select="."/>
770
</xsl:with-param>
771
</xsl:call-template>
772
</xsl:template>
773
774
775
<xsl:template match="self-uri" mode="metadata">
776
<xsl:call-template name="metadata-labeled-entry">
777
<xsl:with-param name="label">
778
<xsl:text>Self URI</xsl:text>
779
</xsl:with-param>
780
<xsl:with-param name="contents">
781
<a href="{@xlink:href}">
782
<xsl:choose>
783
<xsl:when test="normalize-space(string(.))">
784
<xsl:apply-templates/>
785
</xsl:when>
786
<xsl:otherwise>
787
<xsl:value-of select="@xlink:href"/>
788
</xsl:otherwise>
789
</xsl:choose>
790
</a>
791
</xsl:with-param>
792
</xsl:call-template>
793
</xsl:template>
794
795
796
<xsl:template match="product" mode="metadata">
797
<xsl:call-template name="metadata-labeled-entry">
798
<xsl:with-param name="label">
799
<xsl:text>Product Information</xsl:text>
800
</xsl:with-param>
801
<xsl:with-param name="contents">
802
<xsl:choose>
803
<xsl:when test="normalize-space(string(@xlink:href))">
804
<a>
805
<xsl:call-template name="assign-href"/>
806
<xsl:apply-templates/>
807
</a>
808
</xsl:when>
809
<xsl:otherwise>
810
<xsl:apply-templates/>
811
</xsl:otherwise>
812
</xsl:choose>
813
</xsl:with-param>
814
</xsl:call-template>
815
</xsl:template>
816
817
818
<xsl:template match="permissions" mode="metadata">
819
<xsl:apply-templates select="copyright-statement" mode="metadata"/>
820
<xsl:if test="copyright-year | copyright-holder">
821
<xsl:call-template name="metadata-labeled-entry">
822
<xsl:with-param name="label">Copyright</xsl:with-param>
823
<xsl:with-param name="contents">
824
<xsl:for-each select="copyright-year | copyright-holder">
825
<xsl:apply-templates/>
826
<xsl:if test="not(position()=last())">, </xsl:if>
827
</xsl:for-each>
828
</xsl:with-param>
829
</xsl:call-template>
830
</xsl:if>
831
<xsl:apply-templates select="license" mode="metadata"/>
832
</xsl:template>
833
834
835
<xsl:template match="copyright-statement" mode="metadata">
836
<xsl:call-template name="metadata-labeled-entry">
837
<xsl:with-param name="label">Copyright statement</xsl:with-param>
838
</xsl:call-template>
839
</xsl:template>
840
841
842
<xsl:template match="copyright-year" mode="metadata">
843
<xsl:call-template name="metadata-labeled-entry">
844
<xsl:with-param name="label">Copyright</xsl:with-param>
845
</xsl:call-template>
846
</xsl:template>
847
848
849
<xsl:template match="license" mode="metadata">
850
<xsl:call-template name="metadata-area">
851
<xsl:with-param name="label">
852
<xsl:text>License</xsl:text>
853
<xsl:if test="@license-type | @xlink:href">
854
<xsl:text> (</xsl:text>
855
<span class="data">
856
<xsl:value-of select="@license-type"/>
857
<xsl:if test="@xlink:href">
858
<xsl:if test="@license-type">, </xsl:if>
859
<a>
860
<xsl:call-template name="assign-href"/>
861
<xsl:value-of select="@xlink:href"/>
862
</a>
863
</xsl:if>
864
</span>
865
<xsl:text>)</xsl:text>
866
</xsl:if>
867
</xsl:with-param>
868
</xsl:call-template>
869
</xsl:template>
870
871
872
<xsl:template match="history/date" mode="metadata">
873
<xsl:call-template name="metadata-labeled-entry">
874
<xsl:with-param name="label">
875
<xsl:text>Date</xsl:text>
876
<xsl:for-each select="@date-type">
877
<xsl:choose>
878
<xsl:when test=".='accepted'"> accepted</xsl:when>
879
<xsl:when test=".='received'"> received</xsl:when>
880
<xsl:when test=".='rev-request'"> revision requested</xsl:when>
881
<xsl:when test=".='rev-recd'"> revision received</xsl:when>
882
</xsl:choose>
883
</xsl:for-each>
884
</xsl:with-param>
885
<xsl:with-param name="contents">
886
<xsl:call-template name="format-date"/>
887
</xsl:with-param>
888
</xsl:call-template>
889
</xsl:template>
890
891
892
<xsl:template match="pub-date" mode="metadata">
893
<xsl:call-template name="metadata-labeled-entry">
894
<xsl:with-param name="label">
895
<xsl:text>Publication date</xsl:text>
896
<xsl:call-template name="append-pub-type"/>
897
</xsl:with-param>
898
<xsl:with-param name="contents">
899
<xsl:call-template name="format-date"/>
900
</xsl:with-param>
901
</xsl:call-template>
902
</xsl:template>
903
904
905
<xsl:template name="volume-info">
906
<!-- handles volume?, volume-id*, volume-series? -->
907
<xsl:if test="volume | volume-id | volume-series">
908
<xsl:choose>
909
<xsl:when test="not(volume-id[2]) or not(volume)">
910
<!-- if there are no multiple volume-id, or no volume, we make one line only -->
911
<xsl:call-template name="metadata-labeled-entry">
912
<xsl:with-param name="label">Volume</xsl:with-param>
913
<xsl:with-param name="contents">
914
<xsl:apply-templates select="volume | volume-series"
915
mode="metadata-inline"/>
916
<xsl:apply-templates select="volume-id" mode="metadata-inline"/>
917
</xsl:with-param>
918
</xsl:call-template>
919
</xsl:when>
920
<xsl:otherwise>
921
<xsl:apply-templates select="volume | volume-id | volume-series"
922
mode="metadata"/>
923
</xsl:otherwise>
924
</xsl:choose>
925
</xsl:if>
926
</xsl:template>
927
928
929
<xsl:template match="volume | issue" mode="metadata-inline">
930
<xsl:apply-templates/>
931
</xsl:template>
932
933
934
<xsl:template match="volume-id | issue-id" mode="metadata-inline">
935
<span class="generated">
936
<xsl:text> (</xsl:text>
937
<xsl:for-each select="@pub-id-type">
938
<span class="data">
939
<xsl:value-of select="."/>
940
</span>
941
<xsl:text> </xsl:text>
942
</xsl:for-each>
943
<xsl:text>ID: </xsl:text>
944
</span>
945
<xsl:apply-templates/>
946
<span class="generated">)</span>
947
</xsl:template>
948
949
950
<xsl:template match="volume-series" mode="metadata-inline">
951
<xsl:if test="preceding-sibling::volume">
952
<span class="generated">,</span>
953
</xsl:if>
954
<xsl:text> </xsl:text>
955
<xsl:apply-templates/>
956
</xsl:template>
957
958
959
<xsl:template match="volume" mode="metadata">
960
<xsl:call-template name="metadata-labeled-entry">
961
<xsl:with-param name="label">Volume</xsl:with-param>
962
</xsl:call-template>
963
</xsl:template>
964
965
966
<xsl:template match="volume-id" mode="metadata">
967
<xsl:call-template name="metadata-labeled-entry">
968
<xsl:with-param name="label">
969
<xsl:text>Volume ID</xsl:text>
970
<xsl:for-each select="@pub-id-type">
971
<xsl:text> (</xsl:text>
972
<span class="data">
973
<xsl:value-of select="."/>
974
</span>
975
<xsl:text>)</xsl:text>
976
</xsl:for-each>
977
</xsl:with-param>
978
</xsl:call-template>
979
</xsl:template>
980
981
982
<xsl:template match="volume-series" mode="metadata">
983
<xsl:call-template name="metadata-labeled-entry">
984
<xsl:with-param name="label">Series</xsl:with-param>
985
</xsl:call-template>
986
</xsl:template>
987
988
989
<xsl:template name="issue-info">
990
<!-- handles issue?, issue-id*, issue-title*, issue-sponsor*, issue-part?, supplement? -->
991
<xsl:variable name="issue-info"
992
select="issue | issue-id | issue-title |
993
issue-sponsor | issue-part"/>
994
<xsl:choose>
995
<xsl:when
996
test="$issue-info and not(issue-id[2] | issue-title[2] | issue-sponsor | issue-part)">
997
<!-- if there are only one issue, issue-id and issue-title and nothing else, we make one line only -->
998
<xsl:call-template name="metadata-labeled-entry">
999
<xsl:with-param name="label">Issue</xsl:with-param>
1000
<xsl:with-param name="contents">
1001
<xsl:apply-templates select="issue | issue-title"
1002
mode="metadata-inline"/>
1003
<xsl:apply-templates select="issue-id" mode="metadata-inline"/>
1004
</xsl:with-param>
1005
</xsl:call-template>
1006
</xsl:when>
1007
<xsl:otherwise>
1008
<xsl:apply-templates select="$issue-info" mode="metadata"/>
1009
</xsl:otherwise>
1010
</xsl:choose>
1011
</xsl:template>
1012
1013
1014
<xsl:template match="issue-title" mode="metadata-inline">
1015
<span class="generated">
1016
<xsl:if test="preceding-sibling::issue">,</xsl:if>
1017
</span>
1018
<xsl:text> </xsl:text>
1019
<xsl:apply-templates/>
1020
</xsl:template>
1021
1022
1023
<xsl:template match="issue" mode="metadata">
1024
<xsl:call-template name="metadata-labeled-entry">
1025
<xsl:with-param name="label">Issue</xsl:with-param>
1026
</xsl:call-template>
1027
</xsl:template>
1028
1029
1030
<xsl:template match="issue-id" mode="metadata">
1031
<xsl:call-template name="metadata-labeled-entry">
1032
<xsl:with-param name="label">
1033
<xsl:text>Issue ID</xsl:text>
1034
<xsl:for-each select="@pub-id-type">
1035
<xsl:text> (</xsl:text>
1036
<span class="data">
1037
<xsl:value-of select="."/>
1038
</span>
1039
<xsl:text>)</xsl:text>
1040
</xsl:for-each>
1041
</xsl:with-param>
1042
</xsl:call-template>
1043
</xsl:template>
1044
1045
1046
<xsl:template match="issue-title" mode="metadata">
1047
<xsl:call-template name="metadata-labeled-entry">
1048
<xsl:with-param name="label">Issue title</xsl:with-param>
1049
</xsl:call-template>
1050
</xsl:template>
1051
1052
1053
<xsl:template match="issue-sponsor" mode="metadata">
1054
<xsl:call-template name="metadata-labeled-entry">
1055
<xsl:with-param name="label">Issue sponsor</xsl:with-param>
1056
</xsl:call-template>
1057
</xsl:template>
1058
1059
1060
<xsl:template match="issue-part" mode="metadata">
1061
<xsl:call-template name="metadata-labeled-entry">
1062
<xsl:with-param name="label">Issue part</xsl:with-param>
1063
</xsl:call-template>
1064
</xsl:template>
1065
1066
1067
<xsl:template name="page-info">
1068
<!-- handles (fpage, lpage?, page-range?) -->
1069
<xsl:if test="fpage | lpage | page-range">
1070
<xsl:call-template name="metadata-labeled-entry">
1071
<xsl:with-param name="label">
1072
<xsl:text>Page</xsl:text>
1073
<xsl:if
1074
test="normalize-space(string(lpage[not(.=../fpage)]))
1075
or normalize-space(string(page-range))">
1076
<!-- we have multiple pages if lpage exists and is not equal fpage,
1077
or if we have a page-range -->
1078
<xsl:text>s</xsl:text>
1079
</xsl:if>
1080
</xsl:with-param>
1081
<xsl:with-param name="contents">
1082
<xsl:value-of select="fpage"/>
1083
<xsl:if test="normalize-space(string(lpage[not(.=../fpage)]))">
1084
<xsl:text>-</xsl:text>
1085
<xsl:value-of select="lpage"/>
1086
</xsl:if>
1087
<xsl:for-each select="page-range">
1088
<xsl:text> (pp. </xsl:text>
1089
<xsl:value-of select="."/>
1090
<xsl:text>)</xsl:text>
1091
</xsl:for-each>
1092
</xsl:with-param>
1093
</xsl:call-template>
1094
</xsl:if>
1095
</xsl:template>
1096
1097
1098
<xsl:template match="elocation-id" mode="metadata">
1099
<xsl:call-template name="metadata-labeled-entry">
1100
<xsl:with-param name="label">Electronic Location
1101
Identifier</xsl:with-param>
1102
</xsl:call-template>
1103
</xsl:template>
1104
1105
1106
<!-- isbn is already matched in mode 'metadata' above -->
1107
1108
<xsl:template match="supplement" mode="metadata">
1109
<xsl:call-template name="metadata-labeled-entry">
1110
<xsl:with-param name="label">Supplement Info</xsl:with-param>
1111
</xsl:call-template>
1112
</xsl:template>
1113
1114
1115
<xsl:template match="related-article | related-object" mode="metadata">
1116
<xsl:call-template name="metadata-labeled-entry">
1117
<xsl:with-param name="label">
1118
<xsl:text>Related </xsl:text>
1119
<xsl:choose>
1120
<xsl:when test="self::related-object">object</xsl:when>
1121
<xsl:otherwise>article</xsl:otherwise>
1122
</xsl:choose>
1123
<xsl:for-each select="@related-article-type | @object-type">
1124
<xsl:text> (</xsl:text>
1125
<span class="data">
1126
<xsl:value-of select="translate(.,'-',' ')"/>
1127
</span>
1128
<xsl:text>)</xsl:text>
1129
</xsl:for-each>
1130
</xsl:with-param>
1131
<xsl:with-param name="contents">
1132
<xsl:choose>
1133
<xsl:when test="normalize-space(string(@xlink:href))">
1134
<a>
1135
<xsl:call-template name="assign-href"/>
1136
<xsl:apply-templates/>
1137
</a>
1138
</xsl:when>
1139
<xsl:otherwise>
1140
<xsl:apply-templates/>
1141
</xsl:otherwise>
1142
</xsl:choose>
1143
</xsl:with-param>
1144
</xsl:call-template>
1145
</xsl:template>
1146
1147
1148
<xsl:template match="conference" mode="metadata">
1149
<!-- content model:
1150
(conf-date,
1151
(conf-name | conf-acronym)+,
1152
conf-num?, conf-loc?, conf-sponsor*, conf-theme?) -->
1153
<xsl:choose>
1154
<xsl:when
1155
test="not(conf-name[2] | conf-acronym[2] | conf-sponsor |
1156
conf-theme)">
1157
<!-- if there is no second name or acronym, and no sponsor
1158
or theme, we make one line only -->
1159
<xsl:call-template name="metadata-labeled-entry">
1160
<xsl:with-param name="label">Conference</xsl:with-param>
1161
<xsl:with-param name="contents">
1162
<xsl:apply-templates select="conf-acronym | conf-name"
1163
mode="metadata-inline"/>
1164
<xsl:apply-templates select="conf-num" mode="metadata-inline"/>
1165
<xsl:if test="conf-date | conf-loc">
1166
<span class="generated"> (</span>
1167
<xsl:for-each select="conf-date | conf-loc">
1168
<xsl:if test="position() = 2">, </xsl:if>
1169
<xsl:apply-templates select="." mode="metadata-inline"/>
1170
</xsl:for-each>
1171
<span class="generated">)</span>
1172
</xsl:if>
1173
</xsl:with-param>
1174
</xsl:call-template>
1175
</xsl:when>
1176
<xsl:otherwise>
1177
<xsl:apply-templates mode="metadata"/>
1178
</xsl:otherwise>
1179
</xsl:choose>
1180
</xsl:template>
1181
1182
1183
<xsl:template match="conf-date" mode="metadata">
1184
<xsl:call-template name="metadata-labeled-entry">
1185
<xsl:with-param name="label">Conference date</xsl:with-param>
1186
</xsl:call-template>
1187
</xsl:template>
1188
1189
1190
<xsl:template match="conf-name" mode="metadata">
1191
<xsl:call-template name="metadata-labeled-entry">
1192
<xsl:with-param name="label">Conference</xsl:with-param>
1193
</xsl:call-template>
1194
</xsl:template>
1195
1196
1197
<xsl:template match="conf-acronym" mode="metadata">
1198
<xsl:call-template name="metadata-labeled-entry">
1199
<xsl:with-param name="label">Conference</xsl:with-param>
1200
</xsl:call-template>
1201
</xsl:template>
1202
1203
1204
<xsl:template match="conf-num" mode="metadata">
1205
<xsl:call-template name="metadata-labeled-entry">
1206
<xsl:with-param name="label">Conference number</xsl:with-param>
1207
</xsl:call-template>
1208
</xsl:template>
1209
1210
1211
<xsl:template match="conf-loc" mode="metadata">
1212
<xsl:call-template name="metadata-labeled-entry">
1213
<xsl:with-param name="label">Conference location</xsl:with-param>
1214
</xsl:call-template>
1215
</xsl:template>
1216
1217
1218
<xsl:template match="conf-sponsor" mode="metadata">
1219
<xsl:call-template name="metadata-labeled-entry">
1220
<xsl:with-param name="label">Conference sponsor</xsl:with-param>
1221
</xsl:call-template>
1222
</xsl:template>
1223
1224
1225
<xsl:template match="conf-theme" mode="metadata">
1226
<xsl:call-template name="metadata-labeled-entry">
1227
<xsl:with-param name="label">Conference theme</xsl:with-param>
1228
</xsl:call-template>
1229
</xsl:template>
1230
1231
1232
<xsl:template match="conf-name | conf-acronym" mode="metadata-inline">
1233
<!-- we only hit this template if there is at most one of each -->
1234
<xsl:variable name="following"
1235
select="preceding-sibling::conf-name | preceding-sibling::conf-acronym"/>
1236
<!-- if we come after the other, we go in parentheses -->
1237
<xsl:if test="$following">
1238
<span class="generated"> (</span>
1239
</xsl:if>
1240
<xsl:apply-templates/>
1241
<xsl:if test="$following">
1242
<span class="generated">)</span>
1243
</xsl:if>
1244
</xsl:template>
1245
1246
1247
<xsl:template match="conf-num" mode="metadata-inline">
1248
<xsl:text> </xsl:text>
1249
<xsl:apply-templates/>
1250
</xsl:template>
1251
1252
1253
<xsl:template match="conf-date | conf-loc" mode="metadata-inline">
1254
<xsl:apply-templates/>
1255
</xsl:template>
1256
1257
1258
<xsl:template match="article-id" mode="metadata">
1259
<xsl:call-template name="metadata-labeled-entry">
1260
<xsl:with-param name="label">
1261
<xsl:choose>
1262
<xsl:when test="@pub-id-type='art-access-id'">Accession ID</xsl:when>
1263
<xsl:when test="@pub-id-type='coden'">Coden</xsl:when>
1264
<xsl:when test="@pub-id-type='doi'">DOI</xsl:when>
1265
<xsl:when test="@pub-id-type='manuscript'">Manuscript ID</xsl:when>
1266
<xsl:when test="@pub-id-type='medline'">Medline ID</xsl:when>
1267
<xsl:when test="@pub-id-type='pii'">Publisher Item ID</xsl:when>
1268
<xsl:when test="@pub-id-type='pmid'">PubMed ID</xsl:when>
1269
<xsl:when test="@pub-id-type='publisher-id'">Publisher ID</xsl:when>
1270
<xsl:when test="@pub-id-type='sici'">Serial Item and Contribution ID</xsl:when>
1271
<xsl:when test="@pub-id-type='doaj'">DOAJ ID</xsl:when>
1272
<xsl:when test="@pub-id-type='arXiv'">arXiv.org ID</xsl:when>
1273
<xsl:otherwise>
1274
<xsl:text>Article Id</xsl:text>
1275
<xsl:for-each select="@pub-id-type">
1276
<xsl:text> (</xsl:text>
1277
<span class="data">
1278
<xsl:value-of select="."/>
1279
</span>
1280
<xsl:text>)</xsl:text>
1281
</xsl:for-each>
1282
</xsl:otherwise>
1283
</xsl:choose>
1284
</xsl:with-param>
1285
</xsl:call-template>
1286
</xsl:template>
1287
1288
1289
<xsl:template match="contract-num" mode="metadata">
1290
<!-- only in 2.3 -->
1291
<xsl:call-template name="metadata-labeled-entry">
1292
<xsl:with-param name="label">Contract</xsl:with-param>
1293
</xsl:call-template>
1294
</xsl:template>
1295
1296
<xsl:template match="contract-sponsor" mode="metadata">
1297
<!-- only in 2.3 -->
1298
<xsl:call-template name="metadata-labeled-entry">
1299
<xsl:with-param name="label">Contract Sponsor</xsl:with-param>
1300
</xsl:call-template>
1301
</xsl:template>
1302
1303
<xsl:template match="grant-num" mode="metadata">
1304
<!-- only in 2.3 -->
1305
<xsl:call-template name="metadata-labeled-entry">
1306
<xsl:with-param name="label">Grant Number</xsl:with-param>
1307
</xsl:call-template>
1308
</xsl:template>
1309
1310
<xsl:template match="grant-sponsor" mode="metadata">
1311
<!-- only in 2.3 -->
1312
<xsl:call-template name="metadata-labeled-entry">
1313
<xsl:with-param name="label">Grant Sponsor</xsl:with-param>
1314
</xsl:call-template>
1315
</xsl:template>
1316
1317
1318
<xsl:template match="award-group" mode="metadata">
1319
<!-- includes (funding-source*, award-id*, principal-award-recipient*, principal-investigator*) -->
1320
<xsl:apply-templates mode="metadata"/>
1321
</xsl:template>
1322
1323
1324
<xsl:template match="funding-source" mode="metadata">
1325
<xsl:call-template name="metadata-labeled-entry">
1326
<xsl:with-param name="label">Funded by</xsl:with-param>
1327
</xsl:call-template>
1328
</xsl:template>
1329
1330
1331
<xsl:template match="award-id" mode="metadata">
1332
<xsl:call-template name="metadata-labeled-entry">
1333
<xsl:with-param name="label">Award ID</xsl:with-param>
1334
</xsl:call-template>
1335
</xsl:template>
1336
1337
1338
<xsl:template match="principal-award-recipient" mode="metadata">
1339
<xsl:call-template name="metadata-labeled-entry">
1340
<xsl:with-param name="label">Award Recipient</xsl:with-param>
1341
</xsl:call-template>
1342
</xsl:template>
1343
1344
1345
<xsl:template match="principal-investigator" mode="metadata">
1346
<xsl:call-template name="metadata-labeled-entry">
1347
<xsl:with-param name="label">Principal Investigator</xsl:with-param>
1348
</xsl:call-template>
1349
</xsl:template>
1350
1351
1352
<xsl:template match="funding-statement" mode="metadata">
1353
<xsl:call-template name="metadata-labeled-entry">
1354
<xsl:with-param name="label">Funding</xsl:with-param>
1355
</xsl:call-template>
1356
</xsl:template>
1357
1358
1359
<xsl:template match="open-access" mode="metadata">
1360
<xsl:call-template name="metadata-area">
1361
<xsl:with-param name="label">Open Access</xsl:with-param>
1362
</xsl:call-template>
1363
</xsl:template>
1364
1365
1366
<xsl:template match="title-group" mode="metadata">
1367
<!-- content model:
1368
article-title, subtitle*, trans-title-group*, alt-title*, fn-group? -->
1369
<!-- trans-title and trans-subtitle included for 2.3 -->
1370
<xsl:apply-templates select="article-title | subtitle | trans-title-group |
1371
trans-title | trans-subtitle"
1372
mode="metadata"/>
1373
<xsl:if test="alt-title | fn-group">
1374
<div class="document-title-notes metadata-group">
1375
<xsl:apply-templates select="alt-title | fn-group" mode="metadata"/>
1376
</div>
1377
</xsl:if>
1378
</xsl:template>
1379
1380
1381
<xsl:template match="title-group/article-title" mode="metadata">
1382
<h1 class="document-title">
1383
<xsl:apply-templates/>
1384
<xsl:if test="../subtitle">:</xsl:if>
1385
</h1>
1386
</xsl:template>
1387
1388
1389
<xsl:template match="title-group/subtitle | trans-title-group/subtitle"
1390
mode="metadata">
1391
<h2 class="document-title">
1392
<xsl:apply-templates/>
1393
</h2>
1394
</xsl:template>
1395
1396
1397
<xsl:template match="title-group/trans-title-group" mode="metadata">
1398
<!-- content model: (trans-title, trans-subtitle*) -->
1399
<xsl:apply-templates mode="metadata"/>
1400
</xsl:template>
1401
1402
1403
1404
<xsl:template match="title-group/alt-title" mode="metadata">
1405
<xsl:call-template name="metadata-labeled-entry">
1406
<xsl:with-param name="label">
1407
<xsl:text>Alternative title</xsl:text>
1408
<xsl:for-each select="@alt-title-type">
1409
<xsl:text> (</xsl:text>
1410
<span class="data">
1411
<xsl:value-of select="."/>
1412
</span>
1413
<xsl:text>)</xsl:text>
1414
</xsl:for-each>
1415
</xsl:with-param>
1416
</xsl:call-template>
1417
</xsl:template>
1418
1419
1420
<xsl:template match="title-group/fn-group" mode="metadata">
1421
<xsl:apply-templates/>
1422
</xsl:template>
1423
1424
1425
<xsl:template mode="metadata" match="journal-meta/contrib-group">
1426
<xsl:for-each select="contrib">
1427
<xsl:variable name="contrib-identification">
1428
<xsl:call-template name="contrib-identify"/>
1429
</xsl:variable>
1430
<!-- placing the div only if it has content -->
1431
<!-- the extra call to string() makes it type-safe in a type-aware
1432
XSLT 2.0 engine -->
1433
<xsl:if test="normalize-space(string($contrib-identification))">
1434
<xsl:copy-of select="$contrib-identification"/>
1435
</xsl:if>
1436
<xsl:variable name="contrib-info">
1437
<xsl:call-template name="contrib-info"/>
1438
</xsl:variable>
1439
<!-- placing the div only if it has content -->
1440
<xsl:if test="normalize-space(string($contrib-info))">
1441
<xsl:copy-of select="$contrib-info"/>
1442
</xsl:if>
1443
</xsl:for-each>
1444
1445
<xsl:if test="*[not(self::contrib | self::xref)]">
1446
1447
<xsl:apply-templates mode="metadata"
1448
select="*[not(self::contrib | self::xref)]"/>
1449
1450
</xsl:if>
1451
</xsl:template>
1452
1453
<xsl:template mode="metadata" match="article-meta/contrib-group">
1454
<!-- content model of contrib-group:
1455
(contrib+,
1456
(address | aff | author-comment | bio | email |
1457
ext-link | on-behalf-of | role | uri | xref)*) -->
1458
<!-- each contrib makes a row: name at left, details at right -->
1459
<div class="metadata">
1460
<xsl:for-each select="contrib">
1461
<!-- content model of contrib:
1462
((contrib-id)*,
1463
(anonymous | collab | collab-alternatives | name | name-alternatives)*,
1464
(degrees)*,
1465
(address | aff | aff-alternatives | author-comment | bio | email |
1466
ext-link | on-behalf-of | role | uri | xref)*) -->
1467
1468
<div class="row">
1469
<div class="cell" style="text-align: left">
1470
<xsl:call-template name="contrib-identify">
1471
<!-- handles (contrib-id)*,
1472
(anonymous | collab | collab-alternatives |
1473
name | name-alternatives | degrees | xref) -->
1474
</xsl:call-template>
1475
<xsl:call-template name="contrib-info">
1476
<!-- handles
1477
(address | aff | author-comment | bio | email |
1478
ext-link | on-behalf-of | role | uri) -->
1479
</xsl:call-template>
1480
1481
</div>
1482
</div>
1483
1484
</xsl:for-each>
1485
</div>
1486
<!-- end of contrib -->
1487
<xsl:variable name="misc-contrib-data"
1488
select="*[not(self::contrib | self::xref)]"/>
1489
<xsl:if test="$misc-contrib-data">
1490
<div class="metadata two-column table">
1491
<div class="row">
1492
<div class="cell">&#160;</div>
1493
<div class="cell">
1494
<div class="metadata-group">
1495
<xsl:apply-templates mode="metadata"
1496
select="$misc-contrib-data"/>
1497
</div>
1498
</div>
1499
</div>
1500
</div>
1501
</xsl:if>
1502
</xsl:template>
1503
1504
1505
<xsl:template name="contrib-identify">
1506
<!-- Placed in a left-hand pane -->
1507
<!--handles
1508
(anonymous | collab | collab-alternatives |
1509
name | name-alternatives | degrees | xref)
1510
and @equal-contrib -->
1511
<div class="metadata-group">
1512
<xsl:for-each select="anonymous |
1513
collab | collab-alternatives/* | name | name-alternatives/*">
1514
<xsl:call-template name="metadata-entry">
1515
<xsl:with-param name="contents">
1516
<xsl:if test="position() = 1">
1517
<!-- a named anchor for the contrib goes with its
1518
first member -->
1519
<xsl:call-template name="named-anchor"/>
1520
<!-- so do any contrib-ids -->
1521
</xsl:if>
1522
<xsl:apply-templates select="." mode="metadata-inline"/>
1523
<xsl:if test="position() = last()">
1524
<xsl:apply-templates mode="metadata-inline"
1525
select="degrees | xref"/>
1526
<!-- xrefs in the parent contrib-group go with the last member
1527
of *each* contrib in the group -->
1528
<xsl:apply-templates mode="metadata-inline"
1529
select="following-sibling::xref"/>
1530
</xsl:if>
1531
<br/>
1532
<xsl:apply-templates mode="metadata-inline"
1533
select="../contrib-id"/>
1534
1535
1536
</xsl:with-param>
1537
</xsl:call-template>
1538
</xsl:for-each>
1539
</div>
1540
</xsl:template>
1541
1542
1543
<xsl:template match="anonymous" mode="metadata-inline">
1544
<xsl:text>Anonymous</xsl:text>
1545
</xsl:template>
1546
1547
1548
<xsl:template match="collab |
1549
collab-alternatives/*" mode="metadata-inline">
1550
<xsl:apply-templates/>
1551
</xsl:template>
1552
1553
1554
<xsl:template match="contrib/name |
1555
contrib/name-alternatives/*" mode="metadata-inline">
1556
<xsl:apply-templates select="."/>
1557
</xsl:template>
1558
1559
1560
<xsl:template match="degrees" mode="metadata-inline">
1561
<xsl:text>, </xsl:text>
1562
<xsl:apply-templates/>
1563
</xsl:template>
1564
1565
1566
<xsl:template match="xref" mode="metadata-inline">
1567
<!-- These are not expected to appear in mixed content, so
1568
brackets are provided -->
1569
<span class="generated">[</span>
1570
<xsl:apply-templates select="."/>
1571
<span class="generated">]</span>
1572
</xsl:template>
1573
1574
<xsl:template match="contrib-id" mode="metadata-inline">
1575
<span class="generated">[</span>
1576
<xsl:apply-templates select="."/>
1577
<span class="generated">] </span>
1578
</xsl:template>
1579
1580
1581
<xsl:template name="contrib-info">
1582
<!-- Placed in a right-hand pane -->
1583
<div class="metadata-group">
1584
<xsl:apply-templates mode="metadata"
1585
select="address | aff | author-comment | bio | email |
1586
ext-link | on-behalf-of | role | uri"/>
1587
</div>
1588
</xsl:template>
1589
1590
1591
<xsl:template mode="metadata"
1592
match="address[not(addr-line) or not(*[2])]">
1593
<!-- when we have no addr-line or a single child, we generate
1594
a single unlabelled line -->
1595
<xsl:call-template name="metadata-entry">
1596
<xsl:with-param name="contents">
1597
<xsl:call-template name="address-line"/>
1598
</xsl:with-param>
1599
</xsl:call-template>
1600
</xsl:template>
1601
1602
1603
<xsl:template match="address" mode="metadata">
1604
<!-- when we have an addr-line we generate an unlabelled block -->
1605
<xsl:call-template name="metadata-area">
1606
<xsl:with-param name="contents">
1607
<xsl:apply-templates mode="metadata"/>
1608
</xsl:with-param>
1609
</xsl:call-template>
1610
</xsl:template>
1611
1612
1613
<xsl:template mode="metadata" priority="2" match="address/*">
1614
<!-- being sure to override other templates for these
1615
element types -->
1616
<xsl:call-template name="metadata-entry"/>
1617
</xsl:template>
1618
1619
1620
<xsl:template match="aff" mode="metadata">
1621
<xsl:call-template name="metadata-entry">
1622
<xsl:with-param name="contents">
1623
<xsl:call-template name="named-anchor"/>
1624
<xsl:apply-templates/>
1625
</xsl:with-param>
1626
</xsl:call-template>
1627
</xsl:template>
1628
1629
1630
<xsl:template match="author-comment" mode="metadata">
1631
<xsl:call-template name="metadata-area">
1632
<xsl:with-param name="label">Comment</xsl:with-param>
1633
</xsl:call-template>
1634
</xsl:template>
1635
1636
1637
<xsl:template match="bio" mode="metadata">
1638
<xsl:call-template name="metadata-area">
1639
<xsl:with-param name="label">Bio</xsl:with-param>
1640
</xsl:call-template>
1641
</xsl:template>
1642
1643
1644
<xsl:template match="on-behalf-of" mode="metadata">
1645
<xsl:call-template name="metadata-labeled-entry">
1646
<xsl:with-param name="label">On behalf of</xsl:with-param>
1647
</xsl:call-template>
1648
</xsl:template>
1649
1650
1651
<xsl:template match="role" mode="metadata">
1652
<xsl:call-template name="metadata-entry"/>
1653
</xsl:template>
1654
1655
1656
<xsl:template match="author-notes" mode="metadata">
1657
<xsl:call-template name="metadata-area">
1658
<xsl:with-param name="label">Author notes</xsl:with-param>
1659
<xsl:with-param name="contents">
1660
<xsl:call-template name="named-anchor"/>
1661
<xsl:apply-templates mode="metadata"/>
1662
</xsl:with-param>
1663
</xsl:call-template>
1664
</xsl:template>
1665
1666
1667
<xsl:template match="author-notes/corresp" mode="metadata">
1668
<xsl:call-template name="metadata-labeled-entry">
1669
<xsl:with-param name="label">
1670
<xsl:call-template name="named-anchor"/>
1671
<xsl:text>Correspondence to</xsl:text>
1672
</xsl:with-param>
1673
</xsl:call-template>
1674
</xsl:template>
1675
1676
1677
<xsl:template match="author-notes/fn | author-notes/p" mode="metadata">
1678
<xsl:call-template name="metadata-labeled-entry">
1679
<xsl:with-param name="label">
1680
<xsl:apply-templates select="@fn-type"/>
1681
</xsl:with-param>
1682
<xsl:with-param name="contents">
1683
<xsl:call-template name="named-anchor"/>
1684
<xsl:apply-templates/>
1685
</xsl:with-param>
1686
</xsl:call-template>
1687
</xsl:template>
1688
1689
1690
<xsl:template match="supplementary-material" mode="metadata">
1691
<xsl:call-template name="metadata-area">
1692
<xsl:with-param name="label">Supplementary material</xsl:with-param>
1693
</xsl:call-template>
1694
</xsl:template>
1695
1696
1697
<xsl:template match="article-categories" mode="metadata">
1698
<xsl:apply-templates mode="metadata"/>
1699
</xsl:template>
1700
1701
1702
<xsl:template match="article-categories/subj-group" mode="metadata">
1703
<xsl:call-template name="metadata-area">
1704
<xsl:with-param name="label">Categories</xsl:with-param>
1705
<xsl:with-param name="contents">
1706
<xsl:apply-templates mode="metadata"/>
1707
</xsl:with-param>
1708
</xsl:call-template>
1709
</xsl:template>
1710
1711
1712
<xsl:template match="subj-group" mode="metadata">
1713
<xsl:apply-templates mode="metadata"/>
1714
</xsl:template>
1715
1716
1717
<xsl:template match="subj-group/subj-group" mode="metadata">
1718
<div class="metadata-area">
1719
<xsl:apply-templates mode="metadata"/>
1720
</div>
1721
</xsl:template>
1722
1723
1724
<xsl:template match="subj-group/subject" mode="metadata">
1725
<xsl:call-template name="metadata-labeled-entry">
1726
<xsl:with-param name="label">Subject</xsl:with-param>
1727
</xsl:call-template>
1728
</xsl:template>
1729
1730
1731
<xsl:template match="series-title" mode="metadata">
1732
<xsl:call-template name="metadata-labeled-entry">
1733
<xsl:with-param name="label">Series title</xsl:with-param>
1734
</xsl:call-template>
1735
</xsl:template>
1736
1737
1738
<xsl:template match="series-text" mode="metadata">
1739
<xsl:call-template name="metadata-labeled-entry">
1740
<xsl:with-param name="label">Series description</xsl:with-param>
1741
</xsl:call-template>
1742
</xsl:template>
1743
1744
1745
<xsl:template match="kwd-group" mode="metadata">
1746
<xsl:call-template name="metadata-area">
1747
<xsl:with-param name="label">
1748
<xsl:apply-templates select="title|label" mode="metadata-inline"/>
1749
<xsl:if test="not(title|label)">Keywords</xsl:if>
1750
</xsl:with-param>
1751
<xsl:with-param name="contents">
1752
<xsl:apply-templates mode="metadata"/>
1753
</xsl:with-param>
1754
</xsl:call-template>
1755
</xsl:template>
1756
1757
1758
<xsl:template match="title" mode="metadata">
1759
<xsl:apply-templates select="."/>
1760
</xsl:template>
1761
1762
1763
<xsl:template match="kwd" mode="metadata">
1764
<xsl:call-template name="metadata-labeled-entry">
1765
<xsl:with-param name="label">Keyword</xsl:with-param>
1766
</xsl:call-template>
1767
</xsl:template>
1768
1769
<xsl:template match="nested-kwd" mode="metadata">
1770
<ul class="nested-kwd">
1771
<xsl:apply-templates mode="metadata"/>
1772
</ul>
1773
</xsl:template>
1774
1775
<xsl:template match="nested-kwd/kwd" mode="metadata">
1776
<li class="kwd">
1777
<xsl:apply-templates/>
1778
</li>
1779
</xsl:template>
1780
1781
1782
<xsl:template match="compound-kwd" mode="metadata">
1783
<xsl:call-template name="metadata-area">
1784
<xsl:with-param name="label">Compound keyword</xsl:with-param>
1785
<xsl:with-param name="contents">
1786
<xsl:apply-templates mode="metadata"/>
1787
</xsl:with-param>
1788
</xsl:call-template>
1789
</xsl:template>
1790
1791
1792
<xsl:template match="compound-kwd-part" mode="metadata">
1793
<xsl:call-template name="metadata-labeled-entry">
1794
<xsl:with-param name="label">
1795
<xsl:text>Keyword part</xsl:text>
1796
<xsl:for-each select="@content-type">
1797
<xsl:text> (</xsl:text>
1798
<span class="data">
1799
<xsl:value-of select="."/>
1800
</span>
1801
<xsl:text>)</xsl:text>
1802
</xsl:for-each>
1803
</xsl:with-param>
1804
</xsl:call-template>
1805
</xsl:template>
1806
1807
1808
<xsl:template match="counts" mode="metadata">
1809
<!-- fig-count?, table-count?, equation-count?, ref-count?,
1810
page-count?, word-count? -->
1811
<xsl:call-template name="metadata-area">
1812
<xsl:with-param name="label">Counts</xsl:with-param>
1813
<xsl:with-param name="contents">
1814
<xsl:apply-templates mode="metadata"/>
1815
</xsl:with-param>
1816
</xsl:call-template>
1817
</xsl:template>
1818
1819
1820
<xsl:template mode="metadata"
1821
match="count | fig-count | table-count | equation-count |
1822
ref-count | page-count | word-count">
1823
<xsl:call-template name="metadata-labeled-entry">
1824
<xsl:with-param name="label">
1825
<xsl:apply-templates select="." mode="metadata-label"/>
1826
</xsl:with-param>
1827
<xsl:with-param name="contents">
1828
<xsl:value-of select="@count"/>
1829
</xsl:with-param>
1830
</xsl:call-template>
1831
</xsl:template>
1832
1833
1834
<xsl:template match="count"
1835
mode="metadata-label">
1836
<xsl:text>Count</xsl:text>
1837
<xsl:for-each select="@count-type">
1838
<xsl:text> (</xsl:text>
1839
<span class="data">
1840
<xsl:value-of select="."/>
1841
</span>
1842
<xsl:text>)</xsl:text>
1843
</xsl:for-each>
1844
</xsl:template>
1845
1846
1847
<xsl:template match="fig-count"
1848
mode="metadata-label">Figures</xsl:template>
1849
1850
1851
<xsl:template match="table-count"
1852
mode="metadata-label">Tables</xsl:template>
1853
1854
1855
<xsl:template match="equation-count"
1856
mode="metadata-label">Equations</xsl:template>
1857
1858
1859
<xsl:template match="ref-count"
1860
mode="metadata-label">References</xsl:template>
1861
1862
1863
<xsl:template match="page-count"
1864
mode="metadata-label">Pages</xsl:template>
1865
1866
1867
<xsl:template match="word-count"
1868
mode="metadata-label">Words</xsl:template>
1869
1870
1871
<xsl:template mode="metadata"
1872
match="custom-meta-group | custom-meta-wrap">
1873
<xsl:call-template name="metadata-area">
1874
<xsl:with-param name="label">Custom metadata</xsl:with-param>
1875
<xsl:with-param name="contents">
1876
<xsl:apply-templates mode="metadata"/>
1877
</xsl:with-param>
1878
</xsl:call-template>
1879
</xsl:template>
1880
1881
1882
<xsl:template match="custom-meta" mode="metadata">
1883
<xsl:call-template name="metadata-labeled-entry">
1884
<xsl:with-param name="label">
1885
<span class="data">
1886
<xsl:apply-templates select="meta-name" mode="metadata-inline"/>
1887
</span>
1888
</xsl:with-param>
1889
<xsl:with-param name="contents">
1890
<xsl:apply-templates select="meta-value" mode="metadata-inline"/>
1891
</xsl:with-param>
1892
</xsl:call-template>
1893
</xsl:template>
1894
1895
1896
<xsl:template match="meta-name | meta-value" mode="metadata-inline">
1897
<xsl:apply-templates/>
1898
</xsl:template>
1899
1900
1901
<!-- ============================================================= -->
1902
<!-- REGULAR (DEFAULT) MODE -->
1903
<!-- ============================================================= -->
1904
1905
1906
<xsl:template match="sec">
1907
<div class="section">
1908
<xsl:call-template name="named-anchor"/>
1909
<xsl:apply-templates select="title"/>
1910
<xsl:apply-templates select="sec-meta"/>
1911
<xsl:apply-templates mode="drop-title"/>
1912
</div>
1913
</xsl:template>
1914
1915
1916
<xsl:template match="*" mode="drop-title">
1917
<xsl:apply-templates select="."/>
1918
</xsl:template>
1919
1920
1921
<xsl:template match="title | sec-meta" mode="drop-title"/>
1922
1923
1924
<xsl:template match="app">
1925
<div class="section app">
1926
<xsl:call-template name="named-anchor"/>
1927
<xsl:apply-templates select="." mode="label"/>
1928
<xsl:apply-templates/>
1929
</div>
1930
</xsl:template>
1931
1932
1933
<xsl:template match="ref-list" name="ref-list">
1934
<div class="section ref-list">
1935
<xsl:call-template name="named-anchor"/>
1936
<xsl:apply-templates select="." mode="label"/>
1937
<xsl:apply-templates select="*[not(self::ref | self::ref-list)]"/>
1938
<xsl:if test="ref">
1939
<div class="ref-list table">
1940
<xsl:apply-templates select="ref"/>
1941
</div>
1942
</xsl:if>
1943
<xsl:apply-templates select="ref-list"/>
1944
</div>
1945
</xsl:template>
1946
1947
1948
<xsl:template match="sec-meta">
1949
<div class="section-metadata">
1950
<!-- includes contrib-group | permissions | kwd-group -->
1951
<xsl:apply-templates/>
1952
</div>
1953
</xsl:template>
1954
1955
1956
<xsl:template match="sec-meta/contrib-group">
1957
<xsl:apply-templates mode="metadata"/>
1958
</xsl:template>
1959
1960
1961
<xsl:template match="sec-meta/kwd-group">
1962
<!-- matches only if contrib-group has only contrib children -->
1963
<xsl:apply-templates select="." mode="metadata"/>
1964
</xsl:template>
1965
1966
1967
1968
<!-- ============================================================= -->
1969
<!-- Titles -->
1970
<!-- ============================================================= -->
1971
1972
<xsl:template name="main-title"
1973
match="abstract/title | body/*/title |
1974
back/title | back[not(title)]/*/title">
1975
<xsl:param name="contents">
1976
<xsl:apply-templates/>
1977
</xsl:param>
1978
<xsl:if test="normalize-space(string($contents))">
1979
<!-- coding defensively since empty titles make glitchy HTML -->
1980
<h2 class="main-title">
1981
<xsl:copy-of select="$contents"/>
1982
</h2>
1983
</xsl:if>
1984
</xsl:template>
1985
1986
1987
<xsl:template name="section-title"
1988
match="abstract/*/title | body/*/*/title |
1989
back[title]/*/title | back[not(title)]/*/*/title">
1990
<xsl:param name="contents">
1991
<xsl:apply-templates/>
1992
</xsl:param>
1993
<xsl:if test="normalize-space(string($contents))">
1994
<!-- coding defensively since empty titles make glitchy HTML -->
1995
<h3 class="section-title">
1996
<xsl:copy-of select="$contents"/>
1997
</h3>
1998
</xsl:if>
1999
</xsl:template>
2000
2001
2002
<xsl:template name="subsection-title"
2003
match="abstract/*/*/title | body/*/*/*/title |
2004
back[title]/*/*/title | back[not(title)]/*/*/*/title">
2005
<xsl:param name="contents">
2006
<xsl:apply-templates/>
2007
</xsl:param>
2008
<xsl:if test="normalize-space(string($contents))">
2009
<!-- coding defensively since empty titles make glitchy HTML -->
2010
<h4 class="subsection-title">
2011
<xsl:copy-of select="$contents"/>
2012
</h4>
2013
</xsl:if>
2014
</xsl:template>
2015
2016
2017
<xsl:template name="block-title" priority="2"
2018
match="list/title | def-list/title | boxed-text/title |
2019
verse-group/title | glossary/title | gloss-group/title | kwd-group/title">
2020
<xsl:param name="contents">
2021
<xsl:apply-templates/>
2022
</xsl:param>
2023
<xsl:if test="normalize-space(string($contents))">
2024
<!-- coding defensively since empty titles make glitchy HTML -->
2025
<h4 class="block-title">
2026
<xsl:copy-of select="$contents"/>
2027
</h4>
2028
</xsl:if>
2029
</xsl:template>
2030
2031
2032
<!-- default: any other titles found -->
2033
<xsl:template match="title">
2034
<xsl:if test="normalize-space(string(.))">
2035
<h3 class="title">
2036
<xsl:apply-templates/>
2037
</h3>
2038
</xsl:if>
2039
</xsl:template>
2040
2041
2042
<xsl:template match="subtitle">
2043
<xsl:if test="normalize-space(string(.))">
2044
<h5 class="subtitle">
2045
<xsl:apply-templates/>
2046
</h5>
2047
</xsl:if>
2048
</xsl:template>
2049
2050
2051
<!-- ============================================================= -->
2052
<!-- Figures, lists and block-level objectS -->
2053
<!-- ============================================================= -->
2054
2055
2056
<xsl:template match="address">
2057
<xsl:choose>
2058
<!-- address appears as a sequence of inline elements if
2059
it has no addr-line and the parent may contain text -->
2060
<xsl:when test="not(addr-line) and
2061
(parent::collab | parent::p | parent::license-p |
2062
parent::named-content | parent::styled-content)">
2063
<xsl:call-template name="address-line"/>
2064
</xsl:when>
2065
<xsl:otherwise>
2066
<div class="address">
2067
<xsl:apply-templates/>
2068
</div>
2069
</xsl:otherwise>
2070
</xsl:choose>
2071
</xsl:template>
2072
2073
2074
<xsl:template name="address-line">
2075
<!-- emits element children in a simple comma-delimited sequence -->
2076
<xsl:for-each select="*">
2077
<xsl:if test="position() &gt; 1">, </xsl:if>
2078
<xsl:apply-templates/>
2079
</xsl:for-each>
2080
</xsl:template>
2081
2082
2083
<xsl:template match="address/*">
2084
<p class="address-line">
2085
<xsl:apply-templates/>
2086
</p>
2087
</xsl:template>
2088
2089
<xsl:template match="array | disp-formula-group | fig-group |
2090
fn-group | license | long-desc | open-access | sig-block |
2091
table-wrap-foot | table-wrap-group">
2092
<div class="{local-name()}">
2093
<xsl:apply-templates/>
2094
</div>
2095
</xsl:template>
2096
2097
<xsl:template match="attrib">
2098
<p class="attrib">
2099
<xsl:apply-templates/>
2100
</p>
2101
</xsl:template>
2102
2103
2104
<xsl:template match="boxed-text | chem-struct-wrap | fig |
2105
table-wrap | chem-struct-wrapper">
2106
<!-- chem-struct-wrapper is from NLM 2.3 -->
2107
<xsl:variable name="gi">
2108
<xsl:choose>
2109
<xsl:when test="self::chem-struct-wrapper">chem-struct-wrap</xsl:when>
2110
<xsl:otherwise>
2111
<xsl:value-of select="local-name(.)"/>
2112
</xsl:otherwise>
2113
</xsl:choose>
2114
</xsl:variable>
2115
<div class="{$gi} panel">
2116
<xsl:if test="not(@position != 'float')">
2117
<!-- the test respects @position='float' as the default -->
2118
<xsl:attribute name="style">display: float; clear: both</xsl:attribute>
2119
</xsl:if>
2120
<xsl:call-template name="named-anchor"/>
2121
<xsl:apply-templates select="." mode="label"/>
2122
<xsl:apply-templates/>
2123
<xsl:apply-templates mode="footnote"
2124
select="self::table-wrap//fn[not(ancestor::table-wrap-foot)]"/>
2125
</div>
2126
</xsl:template>
2127
2128
2129
<xsl:template match="caption">
2130
<div class="caption">
2131
<xsl:apply-templates/>
2132
</div>
2133
</xsl:template>
2134
2135
2136
<xsl:template match="disp-formula | statement">
2137
<div class="{local-name()} panel">
2138
<xsl:call-template name="named-anchor"/>
2139
<xsl:apply-templates select="." mode="label"/>
2140
<xsl:apply-templates/>
2141
</div>
2142
</xsl:template>
2143
2144
2145
<xsl:template match="glossary | gloss-group">
2146
<!-- gloss-group is from 2.3 -->
2147
<div class="glossary">
2148
<xsl:call-template name="named-anchor"/>
2149
<xsl:apply-templates select="label | title"/>
2150
<xsl:if test="not(normalize-space(string(title)))">
2151
<xsl:call-template name="block-title">
2152
<xsl:with-param name="contents">
2153
<span class="generated">Glossary</span>
2154
</xsl:with-param>
2155
</xsl:call-template>
2156
</xsl:if>
2157
<xsl:apply-templates select="*[not(self::label|self::title)]"/>
2158
</div>
2159
</xsl:template>
2160
2161
2162
<xsl:template match="textual-form">
2163
<p class="textual-form">
2164
<span class="generated">[Textual form] </span>
2165
<xsl:apply-templates/>
2166
</p>
2167
</xsl:template>
2168
2169
2170
2171
<xsl:template match="glossary/glossary | gloss-group/gloss-group">
2172
<!-- the same document shouldn't have both types -->
2173
<div class="glossary">
2174
<xsl:call-template name="named-anchor"/>
2175
<xsl:apply-templates/>
2176
</div>
2177
</xsl:template>
2178
2179
2180
2181
<xsl:template match="graphic | inline-graphic">
2182
<xsl:apply-templates/>
2183
<img alt="{@xlink:href}">
2184
<xsl:for-each select="alt-text">
2185
<xsl:attribute name="alt">
2186
<xsl:value-of select="normalize-space(string(.))"/>
2187
</xsl:attribute>
2188
</xsl:for-each>
2189
<xsl:call-template name="assign-src"/>
2190
</img>
2191
</xsl:template>
2192
2193
2194
<xsl:template match="alt-text">
2195
<!-- handled with graphic or inline-graphic -->
2196
</xsl:template>
2197
2198
2199
<xsl:template match="list">
2200
<div class="list">
2201
<xsl:call-template name="named-anchor"/>
2202
<xsl:apply-templates select="label | title"/>
2203
<xsl:apply-templates select="." mode="list"/>
2204
</div>
2205
</xsl:template>
2206
2207
2208
<xsl:template priority="2" mode="list"
2209
match="list[@list-type='simple' or list-item/label]">
2210
<ul style="list-style-type: none">
2211
<xsl:apply-templates select="list-item"/>
2212
</ul>
2213
</xsl:template>
2214
2215
2216
<xsl:template match="list[@list-type='bullet' or not(@list-type)]" mode="list">
2217
<ul>
2218
<xsl:apply-templates select="list-item"/>
2219
</ul>
2220
</xsl:template>
2221
2222
2223
<xsl:template match="list" mode="list">
2224
<xsl:variable name="style">
2225
<xsl:choose>
2226
<xsl:when test="@list-type='alpha-lower'">lower-alpha</xsl:when>
2227
<xsl:when test="@list-type='alpha-upper'">upper-alpha</xsl:when>
2228
<xsl:when test="@list-type='roman-lower'">lower-roman</xsl:when>
2229
<xsl:when test="@list-type='roman-upper'">upper-roman</xsl:when>
2230
<xsl:otherwise>decimal</xsl:otherwise>
2231
</xsl:choose>
2232
</xsl:variable>
2233
<ol style="list-style-type: {$style}">
2234
<xsl:apply-templates select="list-item"/>
2235
</ol>
2236
</xsl:template>
2237
2238
2239
<xsl:template match="list-item">
2240
<li>
2241
<xsl:apply-templates/>
2242
</li>
2243
</xsl:template>
2244
2245
2246
<xsl:template match="list-item/label">
2247
<!-- if the next sibling is a p, the label will be called as
2248
a run-in -->
2249
<xsl:if test="following-sibling::*[1][not(self::p)]">
2250
<xsl:call-template name="label"/>
2251
</xsl:if>
2252
</xsl:template>
2253
2254
2255
<xsl:template match="media">
2256
<a>
2257
<xsl:call-template name="assign-id"/>
2258
<xsl:call-template name="assign-href"/>
2259
<xsl:apply-templates/>
2260
</a>
2261
</xsl:template>
2262
2263
2264
<xsl:template match="p | license-p">
2265
<p>
2266
<xsl:if test="not(preceding-sibling::*)">
2267
<xsl:attribute name="class">first</xsl:attribute>
2268
</xsl:if>
2269
<xsl:call-template name="assign-id"/>
2270
<xsl:apply-templates select="@content-type"/>
2271
<xsl:apply-templates/>
2272
</p>
2273
</xsl:template>
2274
2275
2276
<xsl:template match="@content-type">
2277
<!-- <span class="generated">[</span>
2278
<xsl:value-of select="."/>
2279
<span class="generated">] </span> -->
2280
</xsl:template>
2281
2282
2283
<xsl:template match="list-item/p[not(preceding-sibling::*[not(self::label)])]">
2284
<p>
2285
<xsl:call-template name="assign-id"/>
2286
<xsl:for-each select="preceding-sibling::label">
2287
<span class="label">
2288
<xsl:apply-templates/>
2289
</span>
2290
<xsl:text> </xsl:text>
2291
</xsl:for-each>
2292
<xsl:apply-templates select="@content-type"/>
2293
<xsl:apply-templates/>
2294
</p>
2295
</xsl:template>
2296
2297
2298
<xsl:template match="product">
2299
<p class="product">
2300
<xsl:call-template name="assign-id"/>
2301
<xsl:apply-templates/>
2302
</p>
2303
</xsl:template>
2304
2305
2306
<xsl:template match="permissions">
2307
<div class="permissions">
2308
<xsl:apply-templates select="copyright-statement"/>
2309
<xsl:if test="copyright-year | copyright-holder">
2310
<p class="copyright">
2311
<span class="generated">Copyright</span>
2312
<xsl:for-each select="copyright-year | copyright-holder">
2313
<xsl:apply-templates/>
2314
<xsl:if test="not(position()=last())">
2315
<span class="generated">, </span>
2316
</xsl:if>
2317
</xsl:for-each>
2318
</p>
2319
</xsl:if>
2320
<xsl:apply-templates select="license"/>
2321
</div>
2322
</xsl:template>
2323
2324
2325
<xsl:template match="copyright-statement">
2326
<p class="copyright">
2327
<xsl:apply-templates></xsl:apply-templates>
2328
</p>
2329
</xsl:template>
2330
2331
2332
<xsl:template match="def-list">
2333
<div class="def-list">
2334
<xsl:call-template name="named-anchor"/>
2335
<xsl:apply-templates select="label | title"/>
2336
<div class="def-list table">
2337
<xsl:if test="term-head|def-head">
2338
<div class="row">
2339
<div class="cell def-list-head">
2340
<xsl:apply-templates select="term-head"/>
2341
</div>
2342
<div class="cell def-list-head">
2343
<xsl:apply-templates select="def-head"/>
2344
</div>
2345
</div>
2346
</xsl:if>
2347
<xsl:apply-templates select="def-item"/>
2348
</div>
2349
<xsl:apply-templates select="def-list"/>
2350
</div>
2351
</xsl:template>
2352
2353
2354
<xsl:template match="def-item">
2355
<div class="def-item row">
2356
<xsl:call-template name="assign-id"/>
2357
<xsl:apply-templates/>
2358
</div>
2359
</xsl:template>
2360
2361
2362
<xsl:template match="term">
2363
<div class="def-term cell">
2364
<xsl:call-template name="assign-id"/>
2365
<p>
2366
<xsl:apply-templates/>
2367
</p>
2368
</div>
2369
</xsl:template>
2370
2371
2372
<xsl:template match="def">
2373
<div class="def-def cell">
2374
<xsl:call-template name="assign-id"/>
2375
<xsl:apply-templates/>
2376
</div>
2377
</xsl:template>
2378
2379
2380
<xsl:template match="disp-quote">
2381
<div class="blockquote">
2382
<xsl:call-template name="named-anchor"/>
2383
<xsl:apply-templates/>
2384
</div>
2385
</xsl:template>
2386
2387
2388
<xsl:template match="preformat">
2389
<pre class="preformat">
2390
<xsl:apply-templates/>
2391
</pre>
2392
</xsl:template>
2393
2394
<xsl:template match="code">
2395
<pre class="sourceCode">
2396
<code class="sourceCode">
2397
<xsl:apply-templates/>
2398
</code>
2399
</pre>
2400
</xsl:template>
2401
2402
2403
<xsl:template match="alternatives | name-alternatives | collab-alternatives | aff-alternatives">
2404
<xsl:apply-templates/>
2405
</xsl:template>
2406
2407
2408
<xsl:template match="citation-alternatives" priority="2">
2409
<!-- priority bumped to supersede match on ref/* -->
2410
<!-- may appear in license-p, p, ref, td, th, title -->
2411
<xsl:apply-templates/>
2412
</xsl:template>
2413
2414
2415
<xsl:template match="ref">
2416
<div class="row">
2417
<div class="ref-label cell">
2418
<p class="ref-label">
2419
<xsl:apply-templates select="." mode="label"/>
2420
<xsl:text>&#xA0;</xsl:text>
2421
<!-- space forces vertical alignment of the paragraph -->
2422
<xsl:call-template name="named-anchor"/>
2423
</p>
2424
</div>
2425
<div class="ref-content cell">
2426
<xsl:apply-templates/>
2427
</div>
2428
</div>
2429
</xsl:template>
2430
2431
2432
<xsl:template match="ref/* | ref/citation-alternatives/*" priority="0">
2433
<!-- should match mixed-citation, element-citation, nlm-citation,
2434
or citation (in 2.3); note and label should be matched below;
2435
citation-alternatives is handled elsewhere -->
2436
<p class="citation">
2437
<xsl:call-template name="named-anchor"/>
2438
<xsl:apply-templates/>
2439
</p>
2440
</xsl:template>
2441
2442
2443
<xsl:template match="ref/note" priority="2">
2444
<xsl:param name="label" select="''"/>
2445
<xsl:if test="normalize-space(string($label))
2446
and not(preceding-sibling::*[not(self::label)])">
2447
<p class="label">
2448
<xsl:copy-of select="$label"/>
2449
</p>
2450
</xsl:if>
2451
<div class="note">
2452
<xsl:call-template name="named-anchor"/>
2453
<xsl:apply-templates/>
2454
</div>
2455
</xsl:template>
2456
2457
2458
<xsl:template match="app/related-article |
2459
app-group/related-article | bio/related-article |
2460
body/related-article | boxed-text/related-article |
2461
disp-quote/related-article | glossary/related-article |
2462
gloss-group/related-article |
2463
ref-list/related-article | sec/related-article">
2464
<xsl:apply-templates select="." mode="metadata"/>
2465
</xsl:template>
2466
2467
2468
<xsl:template match="app/related-object |
2469
app-group/related-object | bio/related-object |
2470
body/related-object | boxed-text/related-object |
2471
disp-quote/related-object | glossary/related-object |
2472
gloss-group/related-article |
2473
ref-list/related-object | sec/related-object">
2474
<xsl:apply-templates select="." mode="metadata"/>
2475
</xsl:template>
2476
2477
2478
<xsl:template match="speech">
2479
<div class="speech">
2480
<xsl:call-template name="named-anchor"/>
2481
<xsl:apply-templates mode="speech"/>
2482
</div>
2483
</xsl:template>
2484
2485
2486
<xsl:template match="speech/speaker" mode="speech"/>
2487
2488
2489
<xsl:template match="speech/p" mode="speech">
2490
<p>
2491
<xsl:apply-templates select="self::p[not(preceding-sibling::p)]/../speaker"/>
2492
<xsl:apply-templates/>
2493
</p>
2494
</xsl:template>
2495
2496
2497
<xsl:template match="speech/speaker">
2498
<b>
2499
<xsl:apply-templates/>
2500
</b>
2501
<span class="generated">: </span>
2502
</xsl:template>
2503
2504
2505
<xsl:template match="supplementary-material">
2506
<div class="panel">
2507
<xsl:call-template name="named-anchor"/>
2508
<xsl:apply-templates select="." mode="label"/>
2509
<xsl:apply-templates/>
2510
</div>
2511
</xsl:template>
2512
2513
2514
<xsl:template match="tex-math">
2515
<span class="tex-math">
2516
<span class="generated">[TeX:] </span>
2517
<xsl:apply-templates/>
2518
</span>
2519
</xsl:template>
2520
2521
2522
<xsl:template match="mml:*">
2523
<!-- this stylesheet simply copies MathML through. If your browser
2524
supports it, you will get it -->
2525
<xsl:copy>
2526
<xsl:copy-of select="@*"/>
2527
<xsl:apply-templates/>
2528
</xsl:copy>
2529
</xsl:template>
2530
2531
2532
<xsl:template match="verse-group">
2533
<div class="verse">
2534
<xsl:call-template name="named-anchor"/>
2535
<xsl:apply-templates/>
2536
</div>
2537
</xsl:template>
2538
2539
2540
<xsl:template match="verse-line">
2541
<p class="verse-line">
2542
<xsl:apply-templates/>
2543
</p>
2544
</xsl:template>
2545
2546
2547
<xsl:template match="aff/label | corresp/label | chem-struct/label |
2548
element-citation/label | mixed-citation/label | citation/label">
2549
<!-- these labels appear in line -->
2550
<span class="generated">[</span>
2551
<xsl:apply-templates/>
2552
<span class="generated">] </span>
2553
</xsl:template>
2554
2555
2556
<xsl:template match="app/label | boxed-text/label |
2557
chem-struct-wrap/label | chem-struct-wrapper/label |
2558
disp-formula/label | fig/label | fn/label | ref/label |
2559
statement/label | supplementary-material/label | table-wrap/label"
2560
priority="2">
2561
<!-- suppressed, since acquired by their parents in mode="label" -->
2562
</xsl:template>
2563
2564
2565
<xsl:template match="p/label">
2566
<span class="label">
2567
<xsl:apply-templates/>
2568
</span>
2569
</xsl:template>
2570
2571
<xsl:template match="label" name="label">
2572
<!-- other labels are displayed as blocks -->
2573
<h5 class="label">
2574
<xsl:apply-templates/>
2575
</h5>
2576
</xsl:template>
2577
2578
2579
<!-- ============================================================= -->
2580
<!-- TABLES -->
2581
<!-- ============================================================= -->
2582
<!-- Tables are already in XHTML, and can simply be copied
2583
through -->
2584
2585
2586
<xsl:template match="table | thead | tbody | tfoot |
2587
col | colgroup | tr | th | td">
2588
<xsl:copy>
2589
<xsl:apply-templates select="@*" mode="table-copy"/>
2590
<xsl:call-template name="named-anchor"/>
2591
<xsl:apply-templates/>
2592
</xsl:copy>
2593
</xsl:template>
2594
2595
2596
<xsl:template match="array/tbody">
2597
<table>
2598
<xsl:copy>
2599
<xsl:apply-templates select="@*" mode="table-copy"/>
2600
<xsl:call-template name="named-anchor"/>
2601
<xsl:apply-templates/>
2602
</xsl:copy>
2603
</table>
2604
</xsl:template>
2605
2606
2607
<xsl:template match="@*" mode="table-copy">
2608
<xsl:copy-of select="."/>
2609
</xsl:template>
2610
2611
2612
<xsl:template match="@content-type" mode="table-copy"/>
2613
2614
2615
<!-- ============================================================= -->
2616
<!-- INLINE MISCELLANEOUS -->
2617
<!-- ============================================================= -->
2618
<!-- Templates strictly for formatting follow; these are templates
2619
to handle various inline structures -->
2620
2621
2622
<xsl:template match="abbrev">
2623
<xsl:apply-templates/>
2624
</xsl:template>
2625
2626
<xsl:template match="abbrev[normalize-space(string(@xlink:href))]">
2627
<a>
2628
<xsl:call-template name="assign-href"/>
2629
<xsl:apply-templates/>
2630
</a>
2631
</xsl:template>
2632
2633
<xsl:template match="abbrev/def">
2634
<xsl:text>[</xsl:text>
2635
<xsl:apply-templates/>
2636
<xsl:text>]</xsl:text>
2637
</xsl:template>
2638
2639
<xsl:template match="p/address | license-p/address |
2640
named-content/p | styled-content/p">
2641
<xsl:apply-templates mode="inline"/>
2642
</xsl:template>
2643
2644
2645
<xsl:template match="address/*" mode="inline">
2646
<xsl:if test="preceding-sibling::*">
2647
<span class="generated">, </span>
2648
</xsl:if>
2649
<xsl:apply-templates/>
2650
</xsl:template>
2651
2652
2653
<xsl:template match="award-id">
2654
<xsl:apply-templates/>
2655
</xsl:template>
2656
2657
2658
<xsl:template match="award-id[normalize-space(string(@rid))]">
2659
<a href="#{@rid}">
2660
<xsl:apply-templates/>
2661
</a>
2662
</xsl:template>
2663
2664
2665
<xsl:template match="break">
2666
<br class="br"/>
2667
</xsl:template>
2668
2669
2670
<xsl:template match="email">
2671
<a href="mailto:{.}">
2672
<xsl:apply-templates/>
2673
</a>
2674
</xsl:template>
2675
2676
2677
<xsl:template match="ext-link | uri | inline-supplementary-material">
2678
<a target="xrefwindow">
2679
<xsl:attribute name="href">
2680
<xsl:value-of select="."/>
2681
</xsl:attribute>
2682
<!-- if an @href is present, it overrides the href
2683
just attached -->
2684
<xsl:call-template name="assign-href"/>
2685
<xsl:call-template name="assign-id"/>
2686
<xsl:apply-templates/>
2687
<xsl:if test="not(normalize-space(string(.)))">
2688
<xsl:value-of select="@xlink:href"/>
2689
</xsl:if>
2690
</a>
2691
</xsl:template>
2692
2693
2694
<xsl:template match="funding-source">
2695
<span class="funding-source">
2696
<xsl:apply-templates/>
2697
</span>
2698
</xsl:template>
2699
2700
2701
<xsl:template match="hr">
2702
<hr class="hr"/>
2703
</xsl:template>
2704
2705
2706
<!-- inline-graphic is handled above, with graphic -->
2707
2708
2709
<xsl:template match="inline-formula | chem-struct">
2710
<span class="{local-name()}">
2711
<xsl:apply-templates/>
2712
</span>
2713
</xsl:template>
2714
2715
2716
<xsl:template match="chem-struct-wrap/chem-struct | chem-struct-wrapper/chem-struct">
2717
<div class="{local-name()}">
2718
<xsl:apply-templates/>
2719
</div>
2720
</xsl:template>
2721
2722
2723
<xsl:template match="milestone-start | milestone-end">
2724
<span class="{substring-after(local-name(),'milestone-')}">
2725
<xsl:comment>
2726
<xsl:value-of select="@rationale"/>
2727
</xsl:comment>
2728
</span>
2729
</xsl:template>
2730
2731
2732
<xsl:template match="object-id">
2733
<span class="{local-name()}">
2734
<xsl:apply-templates/>
2735
</span>
2736
</xsl:template>
2737
2738
2739
<!-- preformat is handled above -->
2740
2741
<xsl:template match="sig">
2742
<xsl:apply-templates/>
2743
</xsl:template>
2744
2745
2746
<xsl:template match="target">
2747
<xsl:call-template name="named-anchor"/>
2748
</xsl:template>
2749
2750
2751
<xsl:template match="styled-content">
2752
<span>
2753
<xsl:copy-of select="@style"/>
2754
<xsl:for-each select="@style-type">
2755
<xsl:attribute name="class">
2756
<xsl:value-of select="."/>
2757
</xsl:attribute>
2758
</xsl:for-each>
2759
<xsl:apply-templates/>
2760
</span>
2761
</xsl:template>
2762
2763
2764
<xsl:template match="named-content">
2765
<span>
2766
<xsl:for-each select="@content-type">
2767
<xsl:attribute name="class">
2768
<xsl:value-of select="translate(.,' ','-')"/>
2769
</xsl:attribute>
2770
</xsl:for-each>
2771
<xsl:apply-templates/>
2772
</span>
2773
</xsl:template>
2774
2775
2776
<xsl:template match="private-char">
2777
<span>
2778
<xsl:for-each select="@description">
2779
<xsl:attribute name="title">
2780
<xsl:value-of select="."/>
2781
</xsl:attribute>
2782
</xsl:for-each>
2783
<span class="generated">[Private character </span>
2784
<xsl:for-each select="@name">
2785
<xsl:text> </xsl:text>
2786
<xsl:value-of select="."/>
2787
</xsl:for-each>
2788
<span class="generated">]</span>
2789
</span>
2790
</xsl:template>
2791
2792
2793
<xsl:template match="glyph-data | glyph-ref">
2794
<span class="generated">(Glyph not rendered)</span>
2795
</xsl:template>
2796
2797
2798
<xsl:template match="related-article">
2799
<span class="generated">[Related article:] </span>
2800
<xsl:apply-templates/>
2801
</xsl:template>
2802
2803
2804
<xsl:template match="related-object">
2805
<span class="generated">[Related object:] </span>
2806
<xsl:apply-templates/>
2807
</xsl:template>
2808
2809
2810
<xsl:template match="xref[not(normalize-space(string(.)))]">
2811
<a href="#{@rid}">
2812
<xsl:apply-templates select="key('element-by-id',@rid)"
2813
mode="label-text">
2814
<xsl:with-param name="warning" select="true()"/>
2815
</xsl:apply-templates>
2816
</a>
2817
</xsl:template>
2818
2819
2820
<xsl:template match="xref">
2821
<a href="#{@rid}">
2822
<xsl:apply-templates/>
2823
</a>
2824
</xsl:template>
2825
2826
2827
2828
<!-- ============================================================= -->
2829
<!-- Formatting elements -->
2830
<!-- ============================================================= -->
2831
2832
2833
<xsl:template match="bold">
2834
<b>
2835
<xsl:apply-templates/>
2836
</b>
2837
</xsl:template>
2838
2839
2840
<xsl:template match="italic">
2841
<i>
2842
<xsl:apply-templates/>
2843
</i>
2844
</xsl:template>
2845
2846
2847
<xsl:template match="monospace">
2848
<tt>
2849
<xsl:apply-templates/>
2850
</tt>
2851
</xsl:template>
2852
2853
2854
<xsl:template match="overline">
2855
<span style="text-decoration: overline">
2856
<xsl:apply-templates/>
2857
</span>
2858
</xsl:template>
2859
2860
2861
<xsl:template match="price">
2862
<span class="price">
2863
<xsl:apply-templates/>
2864
</span>
2865
</xsl:template>
2866
2867
2868
<xsl:template match="roman">
2869
<span style="font-style: normal">
2870
<xsl:apply-templates/>
2871
</span>
2872
</xsl:template>
2873
2874
2875
<xsl:template match="sans-serif">
2876
<span style="font-family: sans-serif; font-size: 80%">
2877
<xsl:apply-templates/>
2878
</span>
2879
</xsl:template>
2880
2881
2882
<xsl:template match="sc">
2883
<span style="font-variant: small-caps">
2884
<xsl:apply-templates/>
2885
</span>
2886
</xsl:template>
2887
2888
2889
<xsl:template match="strike">
2890
<span style="text-decoration: line-through">
2891
<xsl:apply-templates/>
2892
</span>
2893
</xsl:template>
2894
2895
2896
<xsl:template match="sub">
2897
<sub>
2898
<xsl:apply-templates/>
2899
</sub>
2900
</xsl:template>
2901
2902
2903
<xsl:template match="sup">
2904
<sup>
2905
<xsl:apply-templates/>
2906
</sup>
2907
</xsl:template>
2908
2909
2910
<xsl:template match="underline">
2911
<span style="text-decoration: underline">
2912
<xsl:apply-templates/>
2913
</span>
2914
</xsl:template>
2915
2916
2917
<!-- ============================================================= -->
2918
<!-- BACK MATTER -->
2919
<!-- ============================================================= -->
2920
2921
2922
<xsl:variable name="loose-footnotes"
2923
select="//fn[not(ancestor::front|parent::fn-group|ancestor::table-wrap)]"/>
2924
2925
2926
<xsl:template name="make-back">
2927
<xsl:apply-templates select="back"/>
2928
<xsl:if test="$loose-footnotes and not(back)">
2929
<!-- autogenerating a section for footnotes only if there is no
2930
back element, and if footnotes exist for it -->
2931
<xsl:call-template name="footnotes"/>
2932
</xsl:if>
2933
</xsl:template>
2934
2935
<xsl:template match="back">
2936
<!-- content model for back:
2937
(label?, title*,
2938
(ack | app-group | bio | fn-group | glossary | ref-list |
2939
notes | sec)*) -->
2940
<xsl:if test="not(fn-group) and $loose-footnotes">
2941
<xsl:call-template name="footnotes"/>
2942
</xsl:if>
2943
<xsl:apply-templates/>
2944
</xsl:template>
2945
2946
2947
<xsl:template name="footnotes">
2948
<xsl:call-template name="backmatter-section">
2949
<xsl:with-param name="generated-title">Notes</xsl:with-param>
2950
<xsl:with-param name="contents">
2951
<xsl:apply-templates select="$loose-footnotes" mode="footnote"/>
2952
</xsl:with-param>
2953
</xsl:call-template>
2954
</xsl:template>
2955
2956
2957
<xsl:template match="ack">
2958
<xsl:call-template name="backmatter-section">
2959
<xsl:with-param name="generated-title">Acknowledgements</xsl:with-param>
2960
</xsl:call-template>
2961
</xsl:template>
2962
2963
2964
<xsl:template match="app-group">
2965
<xsl:call-template name="backmatter-section">
2966
<xsl:with-param name="generated-title">Appendices</xsl:with-param>
2967
</xsl:call-template>
2968
</xsl:template>
2969
2970
2971
<xsl:template match="back/bio">
2972
<xsl:call-template name="backmatter-section">
2973
<xsl:with-param name="generated-title">Biography</xsl:with-param>
2974
</xsl:call-template>
2975
</xsl:template>
2976
2977
2978
<xsl:template match="back/fn-group">
2979
<xsl:call-template name="backmatter-section">
2980
<xsl:with-param name="generated-title">Notes</xsl:with-param>
2981
</xsl:call-template>
2982
</xsl:template>
2983
2984
2985
<xsl:template match="back/glossary | back/gloss-group">
2986
<xsl:call-template name="backmatter-section">
2987
<xsl:with-param name="generated-title">Glossary</xsl:with-param>
2988
</xsl:call-template>
2989
</xsl:template>
2990
2991
2992
<xsl:template match="back/ref-list">
2993
<xsl:call-template name="backmatter-section">
2994
<xsl:with-param name="generated-title">References</xsl:with-param>
2995
<xsl:with-param name="contents">
2996
<xsl:call-template name="ref-list"/>
2997
</xsl:with-param>
2998
</xsl:call-template>
2999
</xsl:template>
3000
3001
3002
<xsl:template match="back/notes">
3003
<xsl:call-template name="backmatter-section">
3004
<xsl:with-param name="generated-title">Notes</xsl:with-param>
3005
</xsl:call-template>
3006
</xsl:template>
3007
3008
3009
<xsl:template name="backmatter-section">
3010
<xsl:param name="generated-title"/>
3011
<xsl:param name="contents">
3012
<xsl:apply-templates/>
3013
</xsl:param>
3014
<div class="back-section">
3015
<xsl:call-template name="named-anchor"/>
3016
<xsl:if test="not(title) and $generated-title">
3017
<xsl:choose>
3018
<!-- The level of title depends on whether the back matter itself
3019
has a title -->
3020
<xsl:when test="ancestor::back/title">
3021
<xsl:call-template name="section-title">
3022
<xsl:with-param name="contents" select="$generated-title"/>
3023
</xsl:call-template>
3024
</xsl:when>
3025
<xsl:otherwise>
3026
<xsl:call-template name="main-title">
3027
<xsl:with-param name="contents" select="$generated-title"/>
3028
</xsl:call-template>
3029
</xsl:otherwise>
3030
</xsl:choose>
3031
</xsl:if>
3032
<xsl:copy-of select="$contents"/>
3033
</div>
3034
</xsl:template>
3035
3036
3037
<!-- ============================================================= -->
3038
<!-- FOOTNOTES -->
3039
<!-- ============================================================= -->
3040
3041
<xsl:template match="fn">
3042
<!-- Footnotes appearing outside fn-group
3043
generate cross-references to the footnote,
3044
which is displayed elsewhere -->
3045
<!-- Note the rules for displayed content: if any fn elements
3046
not inside an fn-group (the matched fn or any other) includes
3047
a label child, all footnotes are expected to have a label
3048
child. -->
3049
<xsl:variable name="id">
3050
<xsl:apply-templates select="." mode="id"/>
3051
</xsl:variable>
3052
<a href="#{$id}">
3053
<xsl:apply-templates select="." mode="label-text">
3054
<xsl:with-param name="warning" select="true()"/>
3055
</xsl:apply-templates>
3056
</a>
3057
</xsl:template>
3058
3059
<xsl:template match="fn-group/fn | table-wrap-foot/fn |
3060
table-wrap-foot/fn-group/fn">
3061
<xsl:apply-templates select="." mode="footnote"/>
3062
</xsl:template>
3063
3064
3065
<xsl:template match="fn" mode="footnote">
3066
<div class="footnote">
3067
<xsl:call-template name="named-anchor"/>
3068
<xsl:apply-templates/>
3069
</div>
3070
</xsl:template>
3071
3072
3073
<xsl:template match="fn/p">
3074
<p>
3075
<xsl:call-template name="assign-id"/>
3076
<xsl:if test="not(preceding-sibling::p)">
3077
<!-- drop an inline label text into the first p -->
3078
<xsl:apply-templates select="parent::fn" mode="label-text"/>
3079
<xsl:text> </xsl:text>
3080
</xsl:if>
3081
<xsl:apply-templates/>
3082
</p>
3083
</xsl:template>
3084
3085
3086
<!-- ============================================================= -->
3087
<!-- MODE 'label-text'
3088
Generates label text for elements and their cross-references -->
3089
<!-- ============================================================= -->
3090
<!-- This mode is to support auto-numbering and generating of
3091
labels for certain elements by the stylesheet.
3092
3093
The logic is as follows: for any such element type, if a
3094
'label' element is ever present, it is expected always to be
3095
present; automatic numbering is not performed on any elements
3096
of that type. For example, the presence of a 'label' element
3097
in any 'fig' is taken to indicate that all figs should likewise
3098
be labeled, and any 'fig' without a label is supposed to be
3099
unlabelled (and unnumbered). But if no 'fig' elements have
3100
'label' children, labels with numbers are generated for all
3101
figs in display.
3102
3103
This logic applies to:
3104
app, boxed-text, chem-struct-wrap, disp-formula, fig, fn,
3105
note, ref, statement, table-wrap.
3106
3107
There is one exception in the case of fn elements, where
3108
the checking for labels (or for @symbol attributes in the
3109
case of this element) is performed only within its parent
3110
fn-group, or in the scope of all fn elements not in an
3111
fn-group, for fn elements appearing outside fn-group.
3112
3113
In all cases, this logic can be altered simply by overwriting
3114
templates in "label" mode for any of these elements.
3115
3116
For other elements, a label is simply displayed if present,
3117
and auto-numbering is never performed.
3118
These elements include:
3119
(label appearing in line) aff, corresp, chem-struct,
3120
element-citation, mixed-citation
3121
3122
(label appearing as a block) abstract, ack, app-group,
3123
author-notes, back, bio, def-list, disp-formula-group,
3124
disp-quote, fn-group, glossary, graphic, kwd-group,
3125
list, list-item, media, notes, ref-list, sec,
3126
supplementary-material, table-wrap-group,
3127
trans-abstract, verse-group -->
3128
3129
3130
<xsl:variable name="auto-label-app" select="false()"/>
3131
<xsl:variable name="auto-label-boxed-text" select="false()"/>
3132
<xsl:variable name="auto-label-chem-struct-wrap" select="false()"/>
3133
<xsl:variable name="auto-label-disp-formula" select="false()"/>
3134
<xsl:variable name="auto-label-fig" select="false()"/>
3135
<xsl:variable name="auto-label-ref" select="not(//ref[label])"/>
3136
<!-- ref elements are labeled unless any ref already has a label -->
3137
3138
<xsl:variable name="auto-label-statement" select="false()"/>
3139
<xsl:variable name="auto-label-supplementary"
3140
select="false()"/>
3141
<xsl:variable name="auto-label-table-wrap" select="false()"/>
3142
3143
<!--
3144
These variables assignments show how autolabeling can be
3145
configured conditionally.
3146
For example: "label figures if no figures have labels" translates to
3147
"not(//fig[label])", which will resolve to Boolean true() when the set of
3148
all fig elements with labels is empty.
3149
3150
<xsl:variable name="auto-label-app" select="not(//app[label])"/>
3151
<xsl:variable name="auto-label-boxed-text" select="not(//boxed-text[label])"/>
3152
<xsl:variable name="auto-label-chem-struct-wrap" select="not(//chem-struct-wrap[label])"/>
3153
<xsl:variable name="auto-label-disp-formula" select="not(//disp-formula[label])"/>
3154
<xsl:variable name="auto-label-fig" select="not(//fig[label])"/>
3155
<xsl:variable name="auto-label-ref" select="not(//ref[label])"/>
3156
<xsl:variable name="auto-label-statement" select="not(//statement[label])"/>
3157
<xsl:variable name="auto-label-supplementary"
3158
select="not(//supplementary-material[not(ancestor::front)][label])"/>
3159
<xsl:variable name="auto-label-table-wrap" select="not(//table-wrap[label])"/>
3160
-->
3161
3162
<xsl:template mode="label" match="*" name="block-label">
3163
<xsl:param name="contents">
3164
<xsl:apply-templates select="." mode="label-text">
3165
<!-- we place a warning for missing labels if this element is ever
3166
cross-referenced with an empty xref -->
3167
<xsl:with-param name="warning"
3168
select="boolean(key('xref-by-rid',@id)[not(normalize-space(string(.)))])"/>
3169
</xsl:apply-templates>
3170
</xsl:param>
3171
<xsl:if test="normalize-space(string($contents))">
3172
<!-- not to create an h5 for nothing -->
3173
<h5 class="label">
3174
<xsl:copy-of select="$contents"/>
3175
</h5>
3176
</xsl:if>
3177
</xsl:template>
3178
3179
3180
<xsl:template mode="label" match="ref">
3181
<xsl:param name="contents">
3182
<xsl:apply-templates select="." mode="label-text"/>
3183
</xsl:param>
3184
<xsl:if test="normalize-space(string($contents))">
3185
<!-- we're already in a p -->
3186
<span class="label">
3187
<xsl:copy-of select="$contents"/>
3188
</span>
3189
</xsl:if>
3190
</xsl:template>
3191
3192
3193
<xsl:template match="app" mode="label-text">
3194
<xsl:param name="warning" select="true()"/>
3195
<!-- pass $warning in as false() if a warning string is not wanted
3196
(for example, if generating autonumbered labels) -->
3197
<xsl:call-template name="make-label-text">
3198
<xsl:with-param name="auto" select="$auto-label-app"/>
3199
<xsl:with-param name="warning" select="$warning"/>
3200
<!--
3201
Pass in the desired label if a label is to be autogenerated
3202
<xsl:with-param name="auto-text">
3203
<xsl:text>Appendix </xsl:text>
3204
<xsl:number format="A"/>
3205
</xsl:with-param>-->
3206
</xsl:call-template>
3207
</xsl:template>
3208
3209
3210
<xsl:template match="boxed-text" mode="label-text">
3211
<xsl:param name="warning" select="true()"/>
3212
<!-- pass $warning in as false() if a warning string is not wanted
3213
(for example, if generating autonumbered labels) -->
3214
<xsl:call-template name="make-label-text">
3215
<xsl:with-param name="auto" select="$auto-label-boxed-text"/>
3216
<xsl:with-param name="warning" select="$warning"/>
3217
<xsl:with-param name="auto-text">
3218
<xsl:text>Box </xsl:text>
3219
<xsl:number level="any"/>
3220
</xsl:with-param>
3221
</xsl:call-template>
3222
</xsl:template>
3223
3224
3225
<xsl:template match="disp-formula" mode="label-text">
3226
<xsl:param name="warning" select="true()"/>
3227
<!-- pass $warning in as false() if a warning string is not wanted
3228
(for example, if generating autonumbered labels) -->
3229
<xsl:call-template name="make-label-text">
3230
<xsl:with-param name="auto" select="$auto-label-disp-formula"/>
3231
<xsl:with-param name="warning" select="$warning"/>
3232
<xsl:with-param name="auto-text">
3233
<xsl:text>Formula </xsl:text>
3234
<xsl:number level="any"/>
3235
</xsl:with-param>
3236
</xsl:call-template>
3237
</xsl:template>
3238
3239
3240
<xsl:template match="chem-struct-wrap | chem-struct-wrapper" mode="label-text">
3241
<xsl:param name="warning" select="true()"/>
3242
<!-- pass $warning in as false() if a warning string is not wanted
3243
(for example, if generating autonumbered labels) -->
3244
<xsl:call-template name="make-label-text">
3245
<xsl:with-param name="auto" select="$auto-label-chem-struct-wrap"/>
3246
<xsl:with-param name="warning" select="$warning"/>
3247
<xsl:with-param name="auto-text">
3248
<xsl:text>Formula (chemical) </xsl:text>
3249
<xsl:number level="any"/>
3250
</xsl:with-param>
3251
</xsl:call-template>
3252
</xsl:template>
3253
3254
3255
<xsl:template match="fig" mode="label-text">
3256
<xsl:param name="warning" select="true()"/>
3257
<!-- pass $warning in as false() if a warning string is not wanted
3258
(for example, if generating autonumbered labels) -->
3259
<xsl:call-template name="make-label-text">
3260
<xsl:with-param name="auto" select="$auto-label-fig"/>
3261
<xsl:with-param name="warning" select="$warning"/>
3262
<xsl:with-param name="auto-text">
3263
<xsl:text>Figure </xsl:text>
3264
<xsl:number level="any"/>
3265
</xsl:with-param>
3266
</xsl:call-template>
3267
</xsl:template>
3268
3269
3270
<xsl:template match="front//fn" mode="label-text">
3271
<xsl:param name="warning" select="boolean(key('xref-by-rid',@id))"/>
3272
<!-- pass $warning in as false() if a warning string is not wanted
3273
(for example, if generating autonumbered labels);
3274
by default, we get a warning only if we need a label for
3275
a cross-reference -->
3276
<!-- auto-number-fn is true only if (1) this fn is cross-referenced, and
3277
(2) there exists inside the front matter any fn elements with
3278
cross-references, but not labels or @symbols. -->
3279
<xsl:param name="auto-number-fn"
3280
select="boolean(key('xref-by-rid',parent::fn/@id)) and
3281
boolean(ancestor::front//fn[key('xref-by-rid',@id)][not(label|@symbol)])"/>
3282
<xsl:call-template name="make-label-text">
3283
<xsl:with-param name="auto" select="$auto-number-fn"/>
3284
<xsl:with-param name="warning" select="$warning"/>
3285
<xsl:with-param name="auto-text">
3286
<xsl:number level="any" count="fn" from="front" format="a"/>
3287
</xsl:with-param>
3288
</xsl:call-template>
3289
</xsl:template>
3290
3291
3292
<xsl:template match="table-wrap//fn" mode="label-text">
3293
<xsl:param name="warning" select="boolean(key('xref-by-rid',@id))"/>
3294
<!-- pass $warning in as false() if a warning string is not wanted
3295
(for example, if generating autonumbered labels);
3296
by default, we get a warning only if we need a label for
3297
a cross-reference -->
3298
<xsl:param name="auto-number-fn"
3299
select="not(ancestor::table-wrap//fn/label | ancestor::table-wrap//fn/@symbol)"/>
3300
<xsl:call-template name="make-label-text">
3301
<xsl:with-param name="auto" select="$auto-number-fn"/>
3302
<xsl:with-param name="warning" select="$warning"/>
3303
<xsl:with-param name="auto-text">
3304
<xsl:text>[</xsl:text>
3305
<xsl:number level="any" count="fn" from="table-wrap" format="i"/>
3306
<xsl:text>]</xsl:text>
3307
</xsl:with-param>
3308
</xsl:call-template>
3309
</xsl:template>
3310
3311
3312
<xsl:template match="fn" mode="label-text">
3313
<xsl:param name="warning" select="boolean(key('xref-by-rid',@id))"/>
3314
<!-- pass $warning in as false() if a warning string is not wanted
3315
(for example, if generating autonumbered labels);
3316
by default, we get a warning only if we need a label for
3317
a cross-reference -->
3318
<!-- autonumber all fn elements outside fn-group,
3319
front matter and table-wrap only if none of them
3320
have labels or @symbols (to keep numbering
3321
orderly) -->
3322
<xsl:variable name="in-scope-notes"
3323
select="ancestor::article//fn[not(parent::fn-group
3324
| ancestor::front
3325
| ancestor::table-wrap)]"/>
3326
<xsl:variable name="auto-number-fn"
3327
select="not($in-scope-notes/label |
3328
$in-scope-notes/@symbol)"/>
3329
<xsl:call-template name="make-label-text">
3330
<xsl:with-param name="auto" select="$auto-number-fn"/>
3331
<xsl:with-param name="warning" select="$warning"/>
3332
<xsl:with-param name="auto-text">
3333
<xsl:text>[</xsl:text>
3334
<xsl:number level="any" count="fn[not(ancestor::front)]"
3335
from="article | sub-article | response"/>
3336
<xsl:text>]</xsl:text>
3337
<xsl:apply-templates select="@fn-type"/>
3338
</xsl:with-param>
3339
</xsl:call-template>
3340
</xsl:template>
3341
3342
<xsl:template match="fn/@fn-type[.='abbr']" priority="2">
3343
<span class="generated"> Abbreviation</span>
3344
</xsl:template>
3345
3346
<xsl:template match="fn/@fn-type[.='com']" priority="2">
3347
<span class="generated"> Communicated by</span>
3348
</xsl:template>
3349
3350
<xsl:template match="fn/@fn-type[.='con']" priority="2">
3351
<span class="generated"> Contributed by</span>
3352
</xsl:template>
3353
3354
<xsl:template match="fn/@fn-type[.='conflict']" priority="2">
3355
<span class="generated"> Conflicts of interest</span>
3356
</xsl:template>
3357
3358
<xsl:template match="fn/@fn-type[.='corresp']" priority="2">
3359
<span class="generated"> Corresponding author</span>
3360
</xsl:template>
3361
3362
<xsl:template match="fn/@fn-type[.='current-aff']" priority="2">
3363
<span class="generated"> Current affiliation</span>
3364
</xsl:template>
3365
3366
<xsl:template match="fn/@fn-type[.='deceased']" priority="2">
3367
<span class="generated"> Deceased</span>
3368
</xsl:template>
3369
3370
<xsl:template match="fn/@fn-type[.='edited-by']" priority="2">
3371
<span class="generated"> Edited by</span>
3372
</xsl:template>
3373
3374
<xsl:template match="fn/@fn-type[.='equal']" priority="2">
3375
<span class="generated"> Equal contributor</span>
3376
</xsl:template>
3377
3378
<xsl:template match="fn/@fn-type[.='financial-disclosure']" priority="2">
3379
<span class="generated"> Financial disclosure</span>
3380
</xsl:template>
3381
3382
<xsl:template match="fn/@fn-type[.='on-leave']" priority="2">
3383
<span class="generated"> On leave</span>
3384
</xsl:template>
3385
3386
<xsl:template match="fn/@fn-type[.='other']" priority="2"/>
3387
3388
<xsl:template match="fn/@fn-type[.='participating-researchers']" priority="2">
3389
<span class="generated"> Participating researcher</span>
3390
</xsl:template>
3391
3392
<xsl:template match="fn/@fn-type[.='present-address']" priority="2">
3393
<span class="generated"> Current address</span>
3394
</xsl:template>
3395
3396
<xsl:template match="fn/@fn-type[.='presented-at']" priority="2">
3397
<span class="generated"> Presented at</span>
3398
</xsl:template>
3399
3400
<xsl:template match="fn/@fn-type[.='presented-by']" priority="2">
3401
<span class="generated"> Presented by</span>
3402
</xsl:template>
3403
3404
<xsl:template match="fn/@fn-type[.='previously-at']" priority="2">
3405
<span class="generated"> Previously at</span>
3406
</xsl:template>
3407
3408
<xsl:template match="fn/@fn-type[.='study-group-members']" priority="2">
3409
<span class="generated"> Study group member</span>
3410
</xsl:template>
3411
3412
<xsl:template match="fn/@fn-type[.='supplementary-material']" priority="2">
3413
<span class="generated"> Supplementary material</span>
3414
</xsl:template>
3415
3416
<xsl:template match="fn/@fn-type[.='supported-by']" priority="2">
3417
<span class="generated"> Supported by</span>
3418
</xsl:template>
3419
3420
<xsl:template match="fn/@fn-type"/>
3421
3422
3423
<xsl:template match="ref" mode="label-text">
3424
<xsl:param name="warning" select="true()"/>
3425
<!-- pass $warning in as false() if a warning string is not wanted
3426
(for example, if generating autonumbered labels) -->
3427
<xsl:call-template name="make-label-text">
3428
<xsl:with-param name="auto" select="$auto-label-ref"/>
3429
<xsl:with-param name="warning" select="$warning"/>
3430
<xsl:with-param name="auto-text">
3431
<xsl:number level="any"/>
3432
</xsl:with-param>
3433
</xsl:call-template>
3434
</xsl:template>
3435
3436
3437
<xsl:template match="statement" mode="label-text">
3438
<xsl:param name="warning" select="true()"/>
3439
<!-- pass $warning in as false() if a warning string is not wanted
3440
(for example, if generating autonumbered labels) -->
3441
<xsl:call-template name="make-label-text">
3442
<xsl:with-param name="auto" select="$auto-label-statement"/>
3443
<xsl:with-param name="warning" select="$warning"/>
3444
<xsl:with-param name="auto-text">
3445
<xsl:text>Statement </xsl:text>
3446
<xsl:number level="any"/>
3447
</xsl:with-param>
3448
</xsl:call-template>
3449
</xsl:template>
3450
3451
3452
<xsl:template match="supplementary-material" mode="label-text">
3453
<xsl:param name="warning" select="true()"/>
3454
<!-- pass $warning in as false() if a warning string is not wanted
3455
(for example, if generating autonumbered labels) -->
3456
<xsl:call-template name="make-label-text">
3457
<xsl:with-param name="auto" select="$auto-label-supplementary"/>
3458
<xsl:with-param name="warning" select="$warning"/>
3459
<xsl:with-param name="auto-text">
3460
<xsl:text>Supplementary Material </xsl:text>
3461
<xsl:number level="any" format="A"
3462
count="supplementary-material[not(ancestor::front)]"/>
3463
</xsl:with-param>
3464
</xsl:call-template>
3465
</xsl:template>
3466
3467
3468
<xsl:template match="table-wrap" mode="label-text">
3469
<xsl:param name="warning" select="true()"/>
3470
<!-- pass $warning in as false() if a warning string is not wanted
3471
(for example, if generating autonumbered labels) -->
3472
<xsl:call-template name="make-label-text">
3473
<xsl:with-param name="auto" select="$auto-label-table-wrap"/>
3474
<xsl:with-param name="warning" select="$warning"/>
3475
<xsl:with-param name="auto-text">
3476
<xsl:text>Table </xsl:text>
3477
<xsl:number level="any" format="I"/>
3478
</xsl:with-param>
3479
</xsl:call-template>
3480
</xsl:template>
3481
3482
3483
<xsl:template match="*" mode="label-text">
3484
<xsl:param name="warning" select="true()"/>
3485
<!-- pass $warning in as false() if a warning string is not wanted
3486
(for example, if generating autonumbered labels) -->
3487
<xsl:call-template name="make-label-text">
3488
<xsl:with-param name="warning" select="$warning"/>
3489
</xsl:call-template>
3490
</xsl:template>
3491
3492
3493
<xsl:template match="label" mode="label-text">
3494
<xsl:apply-templates mode="inline-label-text"/>
3495
</xsl:template>
3496
3497
3498
<xsl:template match="text()" mode="inline-label-text">
3499
<!-- when displaying labels, space characters become non-breaking spaces -->
3500
<xsl:value-of select="translate(normalize-space(string(.)),' &#xA;&#x9;','&#xA0;&#xA0;&#xA0;')"/>
3501
</xsl:template>
3502
3503
3504
<!-- ============================================================= -->
3505
<!-- Writing a name -->
3506
<!-- ============================================================= -->
3507
3508
<!-- Called when displaying structured names in metadata -->
3509
3510
<xsl:template match="name">
3511
<xsl:apply-templates select="prefix" mode="inline-name"/>
3512
<xsl:apply-templates select="surname[../@name-style='eastern']"
3513
mode="inline-name"/>
3514
<xsl:apply-templates select="given-names" mode="inline-name"/>
3515
<xsl:apply-templates select="surname[not(../@name-style='eastern')]"
3516
mode="inline-name"/>
3517
<xsl:apply-templates select="suffix" mode="inline-name"/>
3518
</xsl:template>
3519
3520
3521
<xsl:template match="prefix" mode="inline-name">
3522
<xsl:apply-templates/>
3523
<xsl:if test="../surname | ../given-names | ../suffix">
3524
<xsl:text> </xsl:text>
3525
</xsl:if>
3526
</xsl:template>
3527
3528
3529
<xsl:template match="given-names" mode="inline-name">
3530
<xsl:apply-templates/>
3531
<xsl:if test="../surname[not(../@name-style='eastern')] | ../suffix">
3532
<xsl:text> </xsl:text>
3533
</xsl:if>
3534
</xsl:template>
3535
3536
3537
<xsl:template match="contrib/name/surname" mode="inline-name">
3538
<xsl:apply-templates/>
3539
<xsl:if test="../given-names[../@name-style='eastern'] | ../suffix">
3540
<xsl:text> </xsl:text>
3541
</xsl:if>
3542
</xsl:template>
3543
3544
3545
<xsl:template match="surname" mode="inline-name">
3546
<xsl:apply-templates/>
3547
<xsl:if test="../given-names[../@name-style='eastern'] | ../suffix">
3548
<xsl:text> </xsl:text>
3549
</xsl:if>
3550
</xsl:template>
3551
3552
3553
<xsl:template match="suffix" mode="inline-name">
3554
<xsl:apply-templates/>
3555
</xsl:template>
3556
3557
3558
<!-- string-name elements are written as is -->
3559
3560
<xsl:template match="string-name">
3561
<xsl:apply-templates/>
3562
</xsl:template>
3563
3564
3565
<xsl:template match="string-name/*">
3566
<xsl:apply-templates/>
3567
</xsl:template>
3568
3569
3570
<!-- ============================================================= -->
3571
<!-- UTILITY TEMPLATES -->
3572
<!-- ============================================================= -->
3573
3574
3575
<xsl:template name="append-pub-type">
3576
<!-- adds a value mapped for @pub-type, enclosed in parenthesis,
3577
to a string -->
3578
<xsl:for-each select="@pub-type">
3579
<xsl:text> (</xsl:text>
3580
<span class="data">
3581
<xsl:choose>
3582
<xsl:when test=".='epub'">electronic</xsl:when>
3583
<xsl:when test=".='ppub'">print</xsl:when>
3584
<xsl:when test=".='epub-ppub'">print and electronic</xsl:when>
3585
<xsl:when test=".='epreprint'">electronic preprint</xsl:when>
3586
<xsl:when test=".='ppreprint'">print preprint</xsl:when>
3587
<xsl:when test=".='ecorrected'">corrected, electronic</xsl:when>
3588
<xsl:when test=".='pcorrected'">corrected, print</xsl:when>
3589
<xsl:when test=".='eretracted'">retracted, electronic</xsl:when>
3590
<xsl:when test=".='pretracted'">retracted, print</xsl:when>
3591
<xsl:otherwise>
3592
<xsl:value-of select="."/>
3593
</xsl:otherwise>
3594
</xsl:choose>
3595
</span>
3596
<xsl:text>)</xsl:text>
3597
</xsl:for-each>
3598
</xsl:template>
3599
3600
3601
<xsl:template name="metadata-labeled-entry">
3602
<xsl:param name="label"/>
3603
<xsl:param name="contents">
3604
<xsl:apply-templates/>
3605
</xsl:param>
3606
<xsl:call-template name="metadata-entry">
3607
<xsl:with-param name="contents">
3608
<xsl:if test="normalize-space(string($label))">
3609
<span class="generated">
3610
<xsl:copy-of select="$label"/>
3611
<xsl:text>: </xsl:text>
3612
</span>
3613
</xsl:if>
3614
<xsl:copy-of select="$contents"/>
3615
</xsl:with-param>
3616
</xsl:call-template>
3617
</xsl:template>
3618
3619
3620
<xsl:template name="metadata-entry">
3621
<xsl:param name="contents">
3622
<xsl:apply-templates/>
3623
</xsl:param>
3624
<p class="metadata-entry">
3625
<xsl:copy-of select="$contents"/>
3626
</p>
3627
</xsl:template>
3628
3629
3630
<xsl:template name="metadata-area">
3631
<xsl:param name="label"/>
3632
<xsl:param name="contents">
3633
<xsl:apply-templates/>
3634
</xsl:param>
3635
<div class="metadata-area">
3636
<xsl:if test="normalize-space(string($label))">
3637
<xsl:call-template name="metadata-labeled-entry">
3638
<xsl:with-param name="label">
3639
<xsl:copy-of select="$label"/>
3640
</xsl:with-param>
3641
<xsl:with-param name="contents"/>
3642
</xsl:call-template>
3643
</xsl:if>
3644
<div class="metadata-chunk">
3645
<xsl:copy-of select="$contents"/>
3646
</div>
3647
</div>
3648
</xsl:template>
3649
3650
3651
<xsl:template name="make-label-text">
3652
<xsl:param name="auto" select="false()"/>
3653
<xsl:param name="warning" select="false()"/>
3654
<xsl:param name="auto-text"/>
3655
<xsl:choose>
3656
<xsl:when test="$auto">
3657
<span class="generated">
3658
<xsl:copy-of select="$auto-text"/>
3659
</span>
3660
</xsl:when>
3661
<xsl:otherwise>
3662
<xsl:apply-templates mode="label-text"
3663
select="label | @symbol"/>
3664
<xsl:if test="$warning and not(label|@symbol)">
3665
<span class="warning">
3666
<xsl:text>{ label</xsl:text>
3667
<xsl:if test="self::fn"> (or @symbol)</xsl:if>
3668
<xsl:text> needed for </xsl:text>
3669
<xsl:value-of select="local-name()"/>
3670
<xsl:for-each select="@id">
3671
<xsl:text>[@id='</xsl:text>
3672
<xsl:value-of select="."/>
3673
<xsl:text>']</xsl:text>
3674
</xsl:for-each>
3675
<xsl:text> }</xsl:text>
3676
</span>
3677
</xsl:if>
3678
</xsl:otherwise>
3679
</xsl:choose>
3680
</xsl:template>
3681
3682
3683
<xsl:template name="assign-id">
3684
<xsl:variable name="id">
3685
<xsl:apply-templates select="." mode="id"/>
3686
</xsl:variable>
3687
<xsl:attribute name="id">
3688
<xsl:value-of select="$id"/>
3689
</xsl:attribute>
3690
</xsl:template>
3691
3692
3693
<xsl:template name="assign-src">
3694
<xsl:for-each select="@xlink:href">
3695
<xsl:attribute name="src">
3696
<xsl:value-of select="."/>
3697
</xsl:attribute>
3698
</xsl:for-each>
3699
</xsl:template>
3700
3701
3702
<xsl:template name="assign-href">
3703
<xsl:for-each select="@xlink:href">
3704
<xsl:attribute name="href">
3705
<xsl:value-of select="."/>
3706
</xsl:attribute>
3707
</xsl:for-each>
3708
</xsl:template>
3709
3710
3711
<xsl:template name="named-anchor">
3712
<!-- generates an HTML named anchor -->
3713
<xsl:variable name="id">
3714
<xsl:choose>
3715
<xsl:when test="@id">
3716
<!-- if we have an @id, we use it -->
3717
<xsl:value-of select="@id"/>
3718
</xsl:when>
3719
<xsl:when test="not(preceding-sibling::*) and
3720
(parent::alternatives | parent::name-alternatives |
3721
parent::citation-alternatives | parent::collab-alternatives |
3722
parent::aff-alternatives)/@id">
3723
<!-- if not, and we are first among our siblings inside one of
3724
several 'alternatives' wrappers, we use its @id if available -->
3725
<xsl:value-of select="(parent::alternatives | parent::name-alternatives |
3726
parent::citation-alternatives | parent::collab-alternatives |
3727
parent::aff-alternatives)/@id"/>
3728
</xsl:when>
3729
<xsl:otherwise>
3730
<!-- otherwise we simply generate an ID -->
3731
<xsl:value-of select="generate-id(.)"/>
3732
</xsl:otherwise>
3733
</xsl:choose>
3734
</xsl:variable>
3735
<a id="{$id}">
3736
<xsl:comment> named anchor </xsl:comment>
3737
</a>
3738
</xsl:template>
3739
3740
3741
<!-- ============================================================= -->
3742
<!-- Process warnings -->
3743
<!-- ============================================================= -->
3744
<!-- Generates a list of warnings to be reported due to processing
3745
anomalies. -->
3746
3747
<xsl:template name="process-warnings">
3748
<!-- Only generate the warnings if set to $verbose -->
3749
<xsl:if test="$verbose">
3750
<!-- returns an RTF containing all the warnings -->
3751
<xsl:variable name="xref-warnings">
3752
<xsl:for-each select="//xref[not(normalize-space(string(.)))]">
3753
<xsl:variable name="target-label">
3754
<xsl:apply-templates select="key('element-by-id',@rid)"
3755
mode="label-text">
3756
<xsl:with-param name="warning" select="false()"/>
3757
</xsl:apply-templates>
3758
</xsl:variable>
3759
<xsl:if test="not(normalize-space(string($target-label))) and
3760
generate-id(.) = generate-id(key('xref-by-rid',@rid)[1])">
3761
<!-- if we failed to get a label with no warning, and
3762
this is the first cross-reference to this target
3763
we ask again to get the warning -->
3764
<li>
3765
<xsl:apply-templates select="key('element-by-id',@rid)"
3766
mode="label-text">
3767
<xsl:with-param name="warning" select="true()"/>
3768
</xsl:apply-templates>
3769
</li>
3770
</xsl:if>
3771
</xsl:for-each>
3772
</xsl:variable>
3773
3774
<xsl:if test="normalize-space(string($xref-warnings))">
3775
<h4>Elements are cross-referenced without labels.</h4>
3776
<p>Either the element should be provided a label, or their cross-reference(s) should
3777
have literal text content.</p>
3778
<ul>
3779
<xsl:copy-of select="$xref-warnings"/>
3780
</ul>
3781
</xsl:if>
3782
3783
3784
<xsl:variable name="alternatives-warnings">
3785
<!-- for reporting any element with a @specific-use different
3786
from a sibling -->
3787
<xsl:for-each select="//*[@specific-use != ../*/@specific-use]/..">
3788
<li>
3789
<xsl:text>In </xsl:text>
3790
<xsl:apply-templates select="." mode="xpath"/>
3791
<ul>
3792
<xsl:for-each select="*[@specific-use != ../*/@specific-use]">
3793
<li>
3794
<xsl:apply-templates select="." mode="pattern"/>
3795
</li>
3796
</xsl:for-each>
3797
</ul>
3798
<!--<xsl:text>: </xsl:text>
3799
<xsl:call-template name="list-elements">
3800
<xsl:with-param name="elements" select="*[@specific-use]"/>
3801
</xsl:call-template>-->
3802
</li>
3803
</xsl:for-each>
3804
</xsl:variable>
3805
3806
<xsl:if test="normalize-space(string($alternatives-warnings))">
3807
<h4>Elements with different 'specific-use' assignments appearing together</h4>
3808
<ul>
3809
<xsl:copy-of select="$alternatives-warnings"/>
3810
</ul>
3811
</xsl:if>
3812
</xsl:if>
3813
3814
</xsl:template>
3815
3816
<!-- ============================================================= -->
3817
<!-- id mode -->
3818
<!-- ============================================================= -->
3819
<!-- An id can be derived for any element. If an @id is given,
3820
it is presumed unique and copied. If not, one is generated. -->
3821
3822
<xsl:template match="*" mode="id">
3823
<xsl:value-of select="@id"/>
3824
<xsl:if test="not(@id)">
3825
<xsl:value-of select="generate-id(.)"/>
3826
</xsl:if>
3827
</xsl:template>
3828
3829
3830
<xsl:template match="article | sub-article | response" mode="id">
3831
<xsl:value-of select="@id"/>
3832
<xsl:if test="not(@id)">
3833
<xsl:value-of select="local-name()"/>
3834
<xsl:number from="article" level="multiple"
3835
count="article | sub-article | response" format="1-1"/>
3836
</xsl:if>
3837
</xsl:template>
3838
3839
3840
<!-- ============================================================= -->
3841
<!-- "format-date" -->
3842
<!-- ============================================================= -->
3843
<!-- Maps a structured date element to a string -->
3844
3845
<xsl:template name="format-date">
3846
<!-- formats date in DD Month YYYY format -->
3847
<!-- context must be 'date', with content model:
3848
(((day?, month?) | season)?, year) -->
3849
<xsl:for-each select="day|month|season">
3850
<xsl:apply-templates select="." mode="map"/>
3851
<xsl:text> </xsl:text>
3852
</xsl:for-each>
3853
<xsl:apply-templates select="year" mode="map"/>
3854
</xsl:template>
3855
3856
3857
<xsl:template match="day | season | year" mode="map">
3858
<xsl:apply-templates/>
3859
</xsl:template>
3860
3861
3862
<xsl:template match="month" mode="map">
3863
<!-- maps numeric values to English months -->
3864
<xsl:choose>
3865
<xsl:when test="number() = 1">January</xsl:when>
3866
<xsl:when test="number() = 2">February</xsl:when>
3867
<xsl:when test="number() = 3">March</xsl:when>
3868
<xsl:when test="number() = 4">April</xsl:when>
3869
<xsl:when test="number() = 5">May</xsl:when>
3870
<xsl:when test="number() = 6">June</xsl:when>
3871
<xsl:when test="number() = 7">July</xsl:when>
3872
<xsl:when test="number() = 8">August</xsl:when>
3873
<xsl:when test="number() = 9">September</xsl:when>
3874
<xsl:when test="number() = 10">October</xsl:when>
3875
<xsl:when test="number() = 11">November</xsl:when>
3876
<xsl:when test="number() = 12">December</xsl:when>
3877
<xsl:otherwise>
3878
<xsl:apply-templates/>
3879
</xsl:otherwise>
3880
</xsl:choose>
3881
</xsl:template>
3882
3883
3884
<!-- ============================================================= -->
3885
<!-- "author-string" writes authors' names in sequence -->
3886
<!-- ============================================================= -->
3887
3888
<xsl:template name="author-string">
3889
<xsl:variable name="all-contribs"
3890
select="/article/front/article-meta/contrib-group/contrib/name/surname |
3891
/article/front/article-meta/contrib-group/contrib/collab"/>
3892
<xsl:for-each select="$all-contribs">
3893
<xsl:if test="count($all-contribs) &gt; 1">
3894
<xsl:if test="position() &gt; 1">
3895
<xsl:if test="count($all-contribs) &gt; 2">,</xsl:if>
3896
<xsl:text> </xsl:text>
3897
</xsl:if>
3898
<xsl:if test="position() = count($all-contribs)">and </xsl:if>
3899
</xsl:if>
3900
<xsl:value-of select="."/>
3901
</xsl:for-each>
3902
</xsl:template>
3903
3904
3905
<!-- ============================================================= -->
3906
<!-- Footer branding -->
3907
<!-- ============================================================= -->
3908
3909
<xsl:template name="footer-branding">
3910
<div class="branding">
3911
<p>
3912
<xsl:text>(Preview based upon NISO JATS XSLT)</xsl:text>
3913
</p>
3914
</div>
3915
</xsl:template>
3916
3917
3918
<!-- ============================================================= -->
3919
<!-- Utility templates for generating warnings and reports -->
3920
<!-- ============================================================= -->
3921
3922
<!-- <xsl:template name="report-warning">
3923
<xsl:param name="when" select="false()"/>
3924
<xsl:param name="msg"/>
3925
<xsl:if test="$verbose and $when">
3926
<xsl:message>
3927
<xsl:copy-of select="$msg"/>
3928
</xsl:message>
3929
</xsl:if>
3930
</xsl:template>-->
3931
3932
3933
<!--<xsl:template name="list-elements">
3934
<xsl:param name="elements" select="/.."/>
3935
<xsl:if test="$elements">
3936
<ol>
3937
<xsl:for-each select="*">
3938
<li>
3939
<xsl:apply-templates select="." mode="element-pattern"/>
3940
</li>
3941
</xsl:for-each>
3942
</ol>
3943
</xsl:if>
3944
</xsl:template>-->
3945
3946
3947
<xsl:template match="*" mode="pattern">
3948
<xsl:value-of select="name(.)"/>
3949
<xsl:for-each select="@*">
3950
<xsl:text>[@</xsl:text>
3951
<xsl:value-of select="name()"/>
3952
<xsl:text>='</xsl:text>
3953
<xsl:value-of select="."/>
3954
<xsl:text>']</xsl:text>
3955
</xsl:for-each>
3956
</xsl:template>
3957
3958
3959
<xsl:template match="node()" mode="xpath">
3960
<xsl:apply-templates mode="xpath" select=".."/>
3961
<xsl:apply-templates mode="xpath-step" select="."/>
3962
</xsl:template>
3963
3964
3965
<xsl:template match="/" mode="xpath"/>
3966
3967
3968
<xsl:template match="*" mode="xpath-step">
3969
<xsl:variable name="name" select="name(.)"/>
3970
<xsl:text>/</xsl:text>
3971
<xsl:value-of select="$name"/>
3972
<xsl:if test="count(../*[name(.) = $name]) > 1">
3973
<xsl:text>[</xsl:text>
3974
<xsl:value-of select="count(.|preceding-sibling::*[name(.) = $name])"/>
3975
<xsl:text>]</xsl:text>
3976
</xsl:if>
3977
</xsl:template>
3978
3979
3980
<xsl:template match="@*" mode="xpath-step">
3981
<xsl:text>/@</xsl:text>
3982
<xsl:value-of select="name(.)"/>
3983
</xsl:template>
3984
3985
3986
<xsl:template match="comment()" mode="xpath-step">
3987
<xsl:text>/comment()</xsl:text>
3988
<xsl:if test="count(../comment()) > 1">
3989
<xsl:text>[</xsl:text>
3990
<xsl:value-of select="count(.|preceding-sibling::comment())"/>
3991
<xsl:text>]</xsl:text>
3992
</xsl:if>
3993
</xsl:template>
3994
3995
3996
<xsl:template match="processing-instruction()" mode="xpath-step">
3997
<xsl:text>/processing-instruction()</xsl:text>
3998
<xsl:if test="count(../processing-instruction()) > 1">
3999
<xsl:text>[</xsl:text>
4000
<xsl:value-of select="count(.|preceding-sibling::processing-instruction())"/>
4001
<xsl:text>]</xsl:text>
4002
</xsl:if>
4003
</xsl:template>
4004
4005
4006
<xsl:template match="text()" mode="xpath-step">
4007
<xsl:text>/text()</xsl:text>
4008
<xsl:if test="count(../text()) > 1">
4009
<xsl:text>[</xsl:text>
4010
<xsl:value-of select="count(.|preceding-sibling::text())"/>
4011
<xsl:text>]</xsl:text>
4012
</xsl:if>
4013
</xsl:template>
4014
4015
4016
<!-- ============================================================= -->
4017
<!-- End stylesheet -->
4018
<!-- ============================================================= -->
4019
4020
</xsl:stylesheet>
4021