-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnwda.mod.generics.xsl
554 lines (526 loc) · 18 KB
/
nwda.mod.generics.xsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
<?xml version="1.0" encoding="UTF-8"?>
<!--
Original coding by [email protected] 2003-04-25
Revisions and modifications by Mark Carlson 2004
Major or significant revision history:
2004-07-14 fix daoloc display
2004-07-14 treat <chronitem> separately
2004-07-14 code to treat chronlist differently
2004-09-27 adding test to remove excess space if <p> is in <dsc>
2004-11-30 add code to process <eventgrp>. See OSU SC "Pauling" in <bioghist> or OSU Archives "Board of Regents" in <odd>
2004-12-07 put chronlist into a table format instead of a def list
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:ead="urn:isbn:1-931666-22-9" exclude-result-prefixes="ead xs xlink fo" version="1.0">
<!--links-->
<xsl:template match="*[local-name()='ref']">
<a class="xref">
<xsl:attribute name="href">#<xsl:value-of select="@target"/>
</xsl:attribute>
<xsl:value-of select="parent::*[local-name()='p']/text()"/>
<xsl:value-of select="."/>
</a>
<xsl:if test="following-sibling::*[local-name()='ref']">
<br/>
</xsl:if>
</xsl:template>
<xsl:template match="*[local-name()='extref'][string(@*[local-name()='href'])]">
<a>
<xsl:attribute name="href">
<xsl:value-of select="@*[local-name()='href']"/>
</xsl:attribute>
<xsl:apply-templates/>
</a>
</xsl:template>
<xsl:template match="*[local-name()='daogrp']">
<!-- <div class="daogrp"> -->
<xsl:apply-templates select="*[local-name()='daoloc']"/>
<!-- </div> -->
</xsl:template>
<xsl:template match="*[local-name()='dao']">
<a target="new">
<xsl:attribute name="href">
<xsl:value-of select="@*[local-name()='href']"/>. <xsl:value-of select="@content-role"/>
</xsl:attribute>
<xsl:value-of select="*[local-name()='daodesc']"/>
<span class="glyphicon glyphicon-camera"/>
</a>
</xsl:template>
<!-- 2004-07-14 carlson mod to fix daoloc display -->
<xsl:template match="*[local-name()='daoloc']">
<a target="new">
<xsl:attribute name="href">
<!--<xsl:value-of disable-output-escaping="yes" select="@*[local-name()='href']"/> removed 7/23/07 by Ethan Gruber-->
<xsl:value-of select="@*[local-name()='href']"/>
</xsl:attribute>   <span class="glyphicon glyphicon-camera"/>
</a>
</xsl:template>
<!--expan/abbr-->
<xsl:template match="*[local-name()='abbr']">
<xsl:choose>
<xsl:when test="$expandAbbr='true'">
<xsl:value-of select="./@expan"/> ( <xsl:value-of select="."/>) </xsl:when>
<xsl:otherwise>
<xsl:value-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="*[local-name()='expan']">
<xsl:choose>
<xsl:when test="$expandAbbr='true'">
<xsl:value-of select="."/> ( <xsl:value-of select="./@abbr"/>) </xsl:when>
<xsl:otherwise>
<xsl:value-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="*[local-name()='item'] | *[local-name()='indexentry']">
<li>
<xsl:apply-templates/>
</li>
</xsl:template>
<xsl:template match="*[local-name()='bibref']">
<span>
<xsl:apply-templates/>
</span>
</xsl:template>
<xsl:template match="*[local-name()='eventgrp']" mode="chronlist">
<xsl:for-each select="*[local-name()='event']">
<xsl:apply-templates/>
<br/>
</xsl:for-each>
</xsl:template>
<xsl:template match="*[local-name()='defitem']">
<li>
<xsl:if test="./*[local-name()='label']">
<b>
<xsl:value-of select="*[local-name()='label']"/>
</b>: </xsl:if>
<xsl:value-of select="*[local-name()='item']"/>
</li>
</xsl:template>
<!-- 2004-07-14 carlsonm mod to treat chronlist differently -->
<!-- 2004-12-07 carlsonm: put chronlist into a table format instead of a def list -->
<!-- 2015-06-15 Ethan Gruber: put chronlist back into a bootstrap 3 horizontal def list -->
<xsl:template match="*[local-name()='chronlist']">
<xsl:if test="*[local-name()='head']">
<h5>
<xsl:apply-templates select="*[local-name()='head']"/>
</h5>
</xsl:if>
<dl class="dl-horizontal">
<xsl:apply-templates select="./*[not(self::*[local-name()='head'])]"/>
</dl>
</xsl:template>
<xsl:template match="*[local-name()='chronitem']">
<dt>
<xsl:apply-templates select="*[local-name()='date']"/>
</dt>
<!-- 2004-11-30 Carlson mod add code to process <eventgrp>. See OSU SC "Pauling" in <bioghist> or OSU Archives "Board of Regents" in <odd> -->
<dd>
<xsl:choose>
<xsl:when test="*[local-name()='event']">
<xsl:apply-templates select="*[local-name()='event']"/>
</xsl:when>
<xsl:when test="*[local-name()='eventgrp']">
<xsl:apply-templates select="*[local-name()='eventgrp']" mode="chronlist"/>
</xsl:when>
</xsl:choose>
</dd>
</xsl:template>
<xsl:template match="*[local-name()='list'] | *[local-name()='index']">
<xsl:if test="*[local-name()='head']">
<h5>
<xsl:apply-templates select="*[local-name()='head']"/>
</h5>
</xsl:if>
<xsl:if test="*[local-name()='item'] or *[local-name()='defitem'] or *[local-name()='indexentry']">
<ul>
<xsl:apply-templates select="*[local-name()='item']|*[local-name()='defitem']|*[local-name()='indexentry']"/>
</ul>
</xsl:if>
</xsl:template>
<xsl:template match="*[local-name()='fileplan'] | *[local-name()='bibliography']">
<xsl:if test="*[local-name()='head']">
<h5>
<xsl:apply-templates select="*[local-name()='head']"/>
</h5>
</xsl:if>
<xsl:apply-templates select="./*[not(self::*[local-name()='head'])]"/>
</xsl:template>
<!-- where would an archivist be without... "misc"-->
<xsl:template match="*[local-name()='change']">
<xsl:apply-templates select="./*[local-name()='item']"/> ( <xsl:apply-templates select="./*[local-name()='date']"/>) </xsl:template>
<xsl:template match="*[@altrender='nodisplay']"/>
<!--
<xsl:template match="*[@role][not(parent::origination)][not(self::daogrp)]">
<xsl:value-of select="."/> (
<xsl:value-of select="./@role"/>) 
</xsl:template>
-->
<!--<xsl:template match="*[@type='bulk']">
<xsl:value-of select="."/>(<xsl:value-of select="./@type"/>)</xsl:template>
<xsl:template match="*[@type='inclusive']">
<xsl:value-of select="."/>(<xsl:value-of select="./@type"/>)</xsl:template>-->
<xsl:template match="ixiahit">
<xsl:apply-templates/>
</xsl:template>
<!--ultra generics-->
<xsl:template match="*[local-name()='emph'][not(@render)]">
<u>
<xsl:apply-templates/>
</u>
</xsl:template>
<xsl:template match="*[local-name()='lb']">
<br/>
</xsl:template>
<xsl:template match="*[local-name()='unitdate']">
<xsl:apply-templates/>
<xsl:text> </xsl:text>
<!-- original SY code
<xsl:if test="@type"> <xsl:text></xsl:text>(<xsl:value-of select="@type"/>)</xsl:if>
-->
<!-- 2004-07-16 carlsonm mod Do not display @type if c02+ -->
<xsl:if test="@type and not(ancestor::*[local-name()='c01'])">  <xsl:text/>( <xsl:value-of select="@type"/>) </xsl:if>
</xsl:template>
<xsl:template match="*[local-name()='unitid']" mode="archdesc">
<span property="dcterms:identifier" content="{.}">
<xsl:value-of select="."/>
<xsl:if test="@type">
<xsl:text> (</xsl:text>
<xsl:value-of select="@type"/>
<xsl:text>)</xsl:text>
</xsl:if>
<xsl:if test="not(position() = last())">
<xsl:text>, </xsl:text>
</xsl:if>
</span>
</xsl:template>
<xsl:template match="*[local-name()='unitdate']" mode="archdesc">
<xsl:value-of select="."/>
<xsl:if test="@type">
<xsl:text> (</xsl:text>
<xsl:value-of select="@type"/>
<xsl:text>)</xsl:text>
</xsl:if>
<xsl:if test="@normal">
<div class="hidden">
<xsl:choose>
<xsl:when test="contains(@normal, '/')">
<xsl:variable name="start" select="substring-before(@normal, '/')"/>
<xsl:variable name="end" select="substring-after(@normal, '/')"/>
<xsl:choose>
<xsl:when test="@type='bulk'">
<span content="{$start}" property="arch:bulkStart">
<xsl:attribute name="datatype">
<xsl:call-template name="unitdate-datatype">
<xsl:with-param name="date" select="$start"/>
</xsl:call-template>
</xsl:attribute>
<xsl:value-of select="$start"/>
</span>
<span content="{$end}" property="arch:bulkEnd">
<xsl:attribute name="datatype">
<xsl:call-template name="unitdate-datatype">
<xsl:with-param name="date" select="$end"/>
</xsl:call-template>
</xsl:attribute>
<xsl:value-of select="$end"/>
</span>
</xsl:when>
<xsl:otherwise>
<span content="{$start}" property="arch:inclusiveStart">
<xsl:attribute name="datatype">
<xsl:call-template name="unitdate-datatype">
<xsl:with-param name="date" select="$start"/>
</xsl:call-template>
</xsl:attribute>
<xsl:value-of select="$start"/>
</span>
<span content="{$end}" property="arch:inclusiveEnd">
<xsl:attribute name="datatype">
<xsl:call-template name="unitdate-datatype">
<xsl:with-param name="date" select="$end"/>
</xsl:call-template>
</xsl:attribute>
<xsl:value-of select="$end"/>
</span>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="@type='bulk'">
<span content="{@normal}" property="arch:bulkStart">
<xsl:attribute name="datatype">
<xsl:call-template name="unitdate-datatype">
<xsl:with-param name="date" select="@normal"/>
</xsl:call-template>
</xsl:attribute>
<xsl:value-of select="@normal"/>
</span>
<span content="{@normal}" property="arch:bulkEnd">
<xsl:attribute name="datatype">
<xsl:call-template name="unitdate-datatype">
<xsl:with-param name="date" select="@normal"/>
</xsl:call-template>
</xsl:attribute>
<xsl:value-of select="@normal"/>
</span>
</xsl:when>
<xsl:otherwise>
<span content="{@normal}" property="arch:inclusiveStart">
<xsl:attribute name="datatype">
<xsl:call-template name="unitdate-datatype">
<xsl:with-param name="date" select="@normal"/>
</xsl:call-template>
</xsl:attribute>
<xsl:value-of select="@normal"/>
</span>
<span content="{@normal}" property="arch:inclusiveEnd">
<xsl:attribute name="datatype">
<xsl:call-template name="unitdate-datatype">
<xsl:with-param name="date" select="@normal"/>
</xsl:call-template>
</xsl:attribute>
<xsl:value-of select="@normal"/>
</span>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</div>
</xsl:if>
<xsl:if test="not(position() = last())">
<br/>
</xsl:if>
</xsl:template>
<xsl:template name="unitdate-datatype">
<xsl:param name="date"/>
<xsl:attribute name="datatype">xsd:gYear</xsl:attribute>
<!--<xsl:choose>
<xsl:when test="$date castable as xs:date">
<xsl:attribute name="datatype">xsd:date</xsl:attribute>
</xsl:when>
<xsl:when test="$date castable as xs:gYearMonth">
<xsl:attribute name="datatype">xsd:gYearMonth</xsl:attribute>
</xsl:when>
<xsl:when test="$date castable as xs:gYear">
<xsl:attribute name="datatype">xsd:gYear</xsl:attribute>
</xsl:when>
</xsl:choose>-->
</xsl:template>
<!-- March 2015: For displaying the container within c01/did. Revision specification 7.1.2 -->
<xsl:template match="*[local-name()='container']" mode="c01">
<xsl:if test="@type">
<xsl:value-of select="concat(translate(substring(@type, 1, 1), 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'), substring(@type, 2))"/>
<xsl:text> </xsl:text>
</xsl:if>
<xsl:value-of select="."/>
<xsl:if test="not(position()=last())">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="*[local-name()='extent']">
<xsl:choose>
<xsl:when test="position() = 1">
<span property="dcterms:extent">
<xsl:value-of select="."/>
</span>
</xsl:when>
<xsl:otherwise>
<xsl:text>, </xsl:text>
<span property="dcterms:extent" content="{.}">
<xsl:text>(</xsl:text>
<xsl:value-of select="."/>
<xsl:text>)</xsl:text>
</span>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="*[local-name()='p']">
<!-- 2004-09-27 carlsonm: adding test to remove excess space if <p> is in <dsc>
Tracking # 4.20
-->
<xsl:choose>
<xsl:when test="not(ancestor::*[local-name()='dsc']) or parent::*[local-name()='dsc']">
<p>
<xsl:apply-templates/>
</p>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
<xsl:if test="not(position()=last()) and *[local-name()='c01']">
<br/>
<br/>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="*[local-name()='controlaccess'][@type='lower']">
<xsl:value-of select="name()"/>
<xsl:apply-templates>
<xsl:sort order="ascending" data-type="text"/>
</xsl:apply-templates>
<br/>
<!--
<xsl:apply-templates>
ddd<xsl:sort order="ascending" data-type="text"/>ddd
</xsl:apply-templates><br /> -->
</xsl:template>
<xsl:template match="*[local-name()='address']">
<p class="address">
<!-- the following code distinguishes between a text-only address line and a url or email address -->
<xsl:for-each select="*[local-name()='addressline']">
<xsl:choose>
<!-- if the addressline contains http://, a href is created -->
<xsl:when test="contains(normalize-space(.), 'http://')">
<xsl:choose>
<xsl:when test="substring-before(normalize-space(.), 'http://')">
<xsl:value-of select="substring-before(normalize-space(.), 'http://')"/>
<a href="http://{substring-after(normalize-space(.), 'http://')}" target="_blank">
<xsl:text>http://</xsl:text>
<xsl:value-of select="substring-after(normalize-space(.), 'http://')"/>
</a>
</xsl:when>
<xsl:otherwise>
<a href="{normalize-space(.)}" target="_blank">
<xsl:value-of select="normalize-space(.)"/>
</a>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="not(position() = last())">
<br/>
</xsl:if>
</xsl:when>
<!-- if the @ symbol is contained, it is assumed to be an email address -->
<xsl:when test="contains(normalize-space(.), '@')">
<xsl:choose>
<!-- if email address is preceded by a space, i. e. "Email: [email protected]", only the [email protected] is made a mailto link -->
<xsl:when test="contains(normalize-space(.), ' ')">
<xsl:value-of select="substring-before(normalize-space(.), ' ')"/>
<xsl:text> </xsl:text>
<a href="mailto:{substring-after(normalize-space(.), ' ')}">
<xsl:value-of select="substring-after(normalize-space(.), ' ')"/>
</a>
<!-- insert break only if it's not the last line. this will cut back on unnecessary whitespace -->
<xsl:if test="not(position() = last())">
<br/>
</xsl:if>
</xsl:when>
<!-- otherwise, the whole line is. this is assuming these are the only two options seen. standards in email and http
address lines should be further developed -->
<xsl:otherwise>
<a href="mailto:{normalize-space(.)}">
<xsl:value-of select="normalize-space(.)"/>
</a>
<xsl:if test="not(position() = last())">
<br/>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="normalize-space(.)"/>
<xsl:if test="not(position() = last())">
<br/>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</p>
</xsl:template>
<xsl:template match="*[local-name()='div']">
<p class="div">
<xsl:apply-templates/>
</p>
</xsl:template>
<!-- suppress all heads
<xsl:template match="head">
<b>
<xsl:apply-templates/>
</b>
</xsl:template>
-->
<xsl:template match="*[local-name()='title']">
<i>
<xsl:apply-templates/>
</i>
</xsl:template>
<xsl:template match="*[@type='restricted']">
<span class="restricted">
<xsl:value-of select="."/>
</span>
</xsl:template>
<!-- ********************* <* @render> *********************** -->
<xsl:template match="*[@render]">
<xsl:choose>
<xsl:when test="@render='bold'">
<b>
<xsl:apply-templates/>
</b>
</xsl:when>
<xsl:when test="@render='italic'">
<i>
<xsl:apply-templates/>
</i>
</xsl:when>
<xsl:when test="@render='bolditalic'">
<b>
<i>
<xsl:apply-templates/>
</i>
</b>
</xsl:when>
<xsl:when test="@render='underline'">
<u>
<xsl:apply-templates/>
</u>
</xsl:when>
<xsl:when test="@render='boldunderline'">
<b>
<u>
<xsl:apply-templates/>
</u>
</b>
</xsl:when>
<xsl:when test="@render='quoted'">" <xsl:apply-templates/>" </xsl:when>
<xsl:when test="@render='doublequote'">" <xsl:apply-templates/>" </xsl:when>
<xsl:when test="@render='bolddoublequote'">
<b>" <xsl:apply-templates/>" </b>
</xsl:when>
<xsl:when test="@render='nonproport'">
<font style="font-family: 'Courier New', Cumberland ">
<xsl:apply-templates/>
</font>
</xsl:when>
<xsl:when test="@render='singlequote'">' <xsl:apply-templates/>' </xsl:when>
<xsl:when test="@render='boldsinglequote'">
<b>" <xsl:apply-templates/>' </b>
</xsl:when>
<xsl:when test="@render='sub'">
<sub>
<xsl:apply-templates/>
</sub>
</xsl:when>
<xsl:when test="@render='super'">
<sup>
<xsl:apply-templates/>
</sup>
</xsl:when>
<xsl:when test="@render='smcaps'">
<font style="font-variant: small-caps">
<xsl:apply-templates/>
</font>
</xsl:when>
<xsl:when test="@render='boldsmcaps'">
<b>
<font style="font-variant: small-caps">
<xsl:apply-templates/>
</font>
</b>
</xsl:when>
</xsl:choose>
</xsl:template>
<!-- ********************* </* @render> *********************** -->
</xsl:stylesheet>