This repository has been archived by the owner on Feb 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathholsingerTransformation.xsl
1251 lines (1152 loc) · 49.6 KB
/
holsingerTransformation.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
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
xpath-default-namespace="http://www.loc.gov/mods/v3" xmlns:mods="http://www.loc.gov/mods/v3"
xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:nuds="http://nomisma.org/nuds" xmlns:nmo="http://nomisma.org/ontology#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:skos="http://www.w3.org/2004/02/skos/core#" exclude-result-prefixes="mods fn xs nuds rdf skos nmo xlink">
<!-- UVA-LIB stylesheet for converting Holsinger Collection MODS to SOLR -->
<!-- created by M. Stephens (ms3uf) on Jan 14/2010 -->
<!-- modified by Andrew Curley (aec6v) on November 10, 2011 -->
<!-- modified by Jocelyn Triplett (jbo3d) June 4, 2014 -->
<!-- Required Parameters -->
<xsl:param name="pid" required="yes" />
<!-- A URL to get the IIIF presentation metadata -->
<xsl:param name="iiifManifest" required="yes"/>
<xsl:param name="iiifRoot" required="yes" />
<xsl:param name="flipped" required="no" />
<!--
In order to allow reuse of the mappings from the MODS metadata to SOLR fields
this parameter results in an incomplete SOLR document that does not make any
calls to get content from external sources. The result should NOT be used by
SOLR and will indeed contain information to that effect. Setting this to any
value is sufficient to enable this mode.
-->
<xsl:param name="excludeExternallyGenerated" required="no" />
<xsl:param name="permanentUrl" />
<!-- A base URL, for which when a page pid is appended will provide an endpoint to
download a large copy of the given image with citation and rights information embedded.-->
<xsl:param name="rightsWrapperServiceUrl" required="yes" />
<xsl:param name="exemplarPid">
<xsl:value-of select="false()"/>
</xsl:param>
<!-- Datetime that this index record was produced. Defaults to now. Format:YYYYMMDDHHMM -->
<xsl:param name="dateIngestNow" >
<xsl:value-of select="format-dateTime(current-dateTime(), '[Y0001][M01][D01][H01][m01]')"/>
</xsl:param>
<xsl:param name="policyFacet" />
<xsl:param name="useRightsString" required="yes" />
<xsl:param name="rightsstatementURI" required="no">
<xsl:value-of select="$rightsstatementMapping[1]/*[*[local-name() = 'string']/text()=$useRightsString]/*[local-name()='uri']/text()" />
</xsl:param>
<!-- Date DL Ingest for the object being indexed for the creation of date_received_facet and date_received_text -->
<xsl:param name="dateReceived" />
<!-- Facet use for blacklight to group digital objects. Default value: 'UVA Library Digital Repository'. -->
<xsl:param name="sourceFacet">
<xsl:value-of select="'UVA Library Digital Repository'"/>
</xsl:param>
<!-- While this can be passed to the stylesheet as a params, this method of determination is to be supplanted by an investiagtion of the descMetadata (as written below). This param is to be deprecated. -->
<xsl:param name="shadowedItem" />
<!-- If this item belongs to a specific collection of objects, that information should be encoded in the above mentioned XPath location. -->
<!--<xsl:param name="collectionName"
select="//relatedItem[@type='series' and @displayLabel='Part of']/titleInfo[1]/title[1]"/>-->
<!-- Global Variables -->
<xsl:variable name="lowercase" select="'abcdefghijklmnopqrstuvwxyz '"/>
<!-- whitespace in select is meaningful -->
<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ,;-:.'"/>
<xsl:variable name='newline'><xsl:text>
</xsl:text></xsl:variable>
<xsl:variable name="rightsstatementMapping">
<statement>
<uri>http://rightsstatements.org/vocab/CNE/1.0/</uri>
<string>Copyright Not Evaluated</string>
<wrapperText>
<xsl:text>The UVA Library has not evaluated the copyright status of this work.</xsl:text>
<xsl:value-of select="$newline" />
<xsl:text>This single copy was produced for purposes of private study, scholarship, or research, pursuant to the library's rights under the Copyright Act.</xsl:text>
<xsl:value-of select="$newline" />
<xsl:text>Copyright and other restrictions may apply to any further use of this image.</xsl:text>
</wrapperText>
</statement>
<statement>
<uri>http://rightsstatements.org/vocab/NKC/1.0/</uri>
<string>No Known Copyright</string>
<use>Educational Use Permitted</use>
<use>Modifications Permitted</use>
<use>Commercial Use Permitted</use>
<wrapperText>
<xsl:text>The UVA Library is not aware of any copyright interest in this work.</xsl:text>
<xsl:value-of select="$newline" />
<xsl:text>This single copy was produced for purposes of private study, scholarship, or research. You are responsible for making a rights determination for your own uses.</xsl:text>
</wrapperText>
</statement>
<statement>
<uri>http://rightsstatements.org/vocab/InC/1.0/</uri>
<string>In Copyright</string>
<wrapperText>
<xsl:text>The UVA Library has determined that this work is in-copyright.</xsl:text>
<xsl:value-of select="$newline" />
<xsl:text>This single copy was produced for purposes of private study, scholarship, or research, pursuant to the library's rights under the Copyright Act.</xsl:text>
<xsl:value-of select="$newline" />
<xsl:text>Copyright and other restrictions may apply to any further use of this image.</xsl:text>
</wrapperText>
</statement>
<statement>
<uri>http://rightsstatements.org/vocab/InC-EDU/1.0/</uri>
<string>In Copyright Educational Use Permitted</string>
<use>Educational Use Permitted</use>
<wrapperText>
<xsl:text>The UVA Library has determined that this work is in-copyright.</xsl:text>
<xsl:value-of select="$newline" />
<xsl:text>This single copy was produced for purposes of private study, scholarship, or research, pursuant to the library's rights under the Copyright Act.</xsl:text>
<xsl:value-of select="$newline" />
<xsl:text>Copyright and other restrictions may apply to any further use of this image.</xsl:text>
</wrapperText>
</statement>
<statement>
<uri>http://rightsstatements.org/vocab/InC-NC/1.0/</uri>
<string>In Copyright Non-Commercial Use Permitted</string>
<use>Educational Use Permitted</use>
<wrapperText>
<xsl:text>The UVA Library has determined that this work is in-copyright.</xsl:text>
<xsl:value-of select="$newline" />
<xsl:text>This single copy was produced for purposes of private study, scholarship, or research, pursuant to the library's rights under the Copyright Act.</xsl:text>
<xsl:value-of select="$newline" />
<xsl:text>Copyright and other restrictions may apply to any further use of this image.</xsl:text>
</wrapperText>
</statement>
<statement>
<uri>http://rightsstatements.org/vocab/InC-RUU/1.0/</uri>
<string>In Copyright Rights Holder Unlocatable</string>
<wrapperText>
<xsl:text>The UVA Library has not determined the copyright status of this work.</xsl:text>
<xsl:value-of select="$newline" />
<xsl:text>This single copy was produced for purposes of private study, scholarship, or research, pursuant to the library's rights under the Copyright Act.</xsl:text>
<xsl:value-of select="$newline" />
<xsl:text>Copyright and other restrictions may apply to any further use of this image.</xsl:text>
</wrapperText>
</statement>
<statement>
<uri>http://rightsstatements.org/vocab/NoC-OKLR/1.0/</uri>
<string>No Copyright Other Known Legal Restrictions</string>
<wrapperText>
<xsl:text>The UVA Library is not aware of any copyright interest in this work, but other legal restrictions apply.</xsl:text>
<xsl:value-of select="$newline" />
<xsl:text>This single copy was produced for purposes of private study, scholarship, or research, pursuant to the library's rights under the Copyright Act.</xsl:text>
<xsl:value-of select="$newline" />
<xsl:text>Legal restrictions may apply to further use of this image.</xsl:text>
</wrapperText>
</statement>
<statement>
<uri>http://rightsstatements.org/vocab/NoC-US/1.0/</uri>
<string>No Copyright United States</string>
<use>Educational Use Permitted</use>
<use>Modifications Permitted</use>
<use>Commercial Use Permitted</use>
<wrapperText>
<xsl:text>The UVA Library is not aware of any copyright interest in this work.</xsl:text>
<xsl:value-of select="$newline" />
<xsl:text>This single copy was produced for purposes of private study, scholarship, or research. You are responsible for making a rights determination for your own uses.</xsl:text>
</wrapperText>
</statement>
<statement>
<uri>http://rightsstatements.org/vocab/UND/1.0/</uri>
<string>Copyright Undetermined</string>
<wrapperText>
<xsl:text>The UVA Library has been unable to determine the copyright status of this work.</xsl:text>
<xsl:value-of select="$newline" />
<xsl:text>This single copy was produced for purposes of private study, scholarship, or research, pursuant to the library's rights under the Copyright Act.</xsl:text>
<xsl:value-of select="$newline" />
<xsl:text>Copyright and other restrictions may apply to any further use of this image.</xsl:text>
</wrapperText>
</statement>
</xsl:variable>
<xsl:output byte-order-mark="no" encoding="UTF-8" media-type="text/xml" xml:space="preserve" indent="yes"/>
<xsl:template match="/">
<add>
<doc>
<xsl:if test="$excludeExternallyGenerated">
<note>
This solr record is INCOMPLETE because it was requested to be generated that way using the "excludeExternallyGenerated" parameter.
</note>
</xsl:if>
<field name="id">
<xsl:value-of select="$pid"/>
</field>
<!-- At this time, no Holsinger items will have MARC in them, so this value can be set to false -->
<field name="marc_display_facet">false</field>
<xsl:for-each select="//relatedItem[@type='series' and @displayLabel='Part of']/titleInfo/title">
<field name="digital_collection_facet">
<xsl:value-of select="."/>
</field>
<field name="digital_collection_text">
<xsl:value-of select="."/>
</field>
</xsl:for-each>
<xsl:if test="$policyFacet != 'false'">
<field name="policy_facet">
<xsl:value-of select="$policyFacet"/>
</field>
</xsl:if>
<field name="source_facet">UVA Library Digital Repository</field>
<xsl:if test="$flipped">
<field name="thumbnail_url_display"><xsl:value-of select="$iiifRoot" /><xsl:value-of select="$exemplarPid" />/full/!125,125/!0/default.jpg</field>
</xsl:if>
<xsl:if test="not($flipped)">
<field name="thumbnail_url_display"><xsl:value-of select="$iiifRoot" /><xsl:value-of select="$exemplarPid" />/full/!125,125/0/default.jpg</field>
</xsl:if>
<xsl:if test="not($excludeExternallyGenerated)">
<field name="feature_facet">iiif</field>
<field name="feature_facet">dl_metadata</field>
<field name="iiif_presentation_metadata_display">
<xsl:value-of select="unparsed-text($iiifManifest)" />
</field>
</xsl:if>
<!-- The "right_wrapper" feature indicates that we should provide page-level links
that include rights information and specifically that that rights information will be
stored in the "rights_wrapper_display" field, and a service URL will be included in the
rights_wrapper_url_display field to which just the page pid should be appended.
-->
<xsl:if test="$rightsWrapperServiceUrl">
<field name="feature_facet">rights_wrapper</field>
<field name="rights_wrapper_url_display"><xsl:value-of select="$rightsWrapperServiceUrl" /></field>
<xsl:variable name="citation">
<xsl:variable name="title">
<xsl:choose>
<xsl:when test="//mods:mods/mods:titleInfo/mods:title[@type='uniform']">
<xsl:value-of select="//mods:mods/mods:titleInfo/mods:title[@type='uniform'][1]/text()" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="//mods:mods/mods:titleInfo/mods:title[1]/text()" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:value-of select="normalize-space($title)" />
<xsl:variable name="callNumber" select="normalize-space(//mods:mods/mods:classification[1]/text())" />
<xsl:if test="$callNumber != ''">
<xsl:text>, </xsl:text>
<xsl:value-of select="$callNumber" />
</xsl:if>
<xsl:variable name="location">
<xsl:choose>
<xsl:when test="//mods:mods/mods:location/mods:physicalLocation">
<xsl:value-of select="normalize-space((//mods:mods/mods:location/mods:physicalLocation)[1])" />
</xsl:when>
<xsl:when test="//mods:mods/mods:location/mods:holdingSimple/mods:copyInformation[mods:subLocation/text() = 'SPEC-COLL']">
<xsl:text>Special Collections, University of Virginia Library, Charlottesville, Va.</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:if test="$location != ''">
<xsl:text>, </xsl:text>
<xsl:value-of select="$location" />
</xsl:if>
</xsl:variable>
<field name="rs_uri_display"><xsl:value-of select="$rightsstatementURI"/></field>
<xsl:for-each select="$rightsstatementMapping[1]/*[*[local-name()='uri']/text()=$rightsstatementURI]/*[local-name()='use']">
<field name="use_facet"><xsl:value-of select="text()"/></field>
</xsl:for-each>
<xsl:comment select="concat('Use Rights: ', $useRightsString, ' (', $rightsstatementURI, ')')" />
<field name="rights_wrapper_display">
<xsl:value-of select="$citation" />
<xsl:value-of select="$newline" />
<xsl:if test="$permanentUrl">
<xsl:value-of select="$permanentUrl" />
<xsl:value-of select="$newline" />
</xsl:if>
<xsl:value-of select="$newline" />
<xsl:variable name="rightsSummary">
<xsl:value-of select="$rightsstatementMapping[1]/*[*[local-name()='uri']/text()=$rightsstatementURI]/*[local-name()='wrapperText']/text()"/>
</xsl:variable>
<xsl:value-of select="$rightsSummary"/>
<xsl:if test="$rightsSummary = ''">
<xsl:value-of select="$rightsstatementMapping[1]/*[1]/*[local-name()='wrapperText']/text()" />
</xsl:if>
<xsl:value-of select="$newline" />
<xsl:text>Find more information about permission to use the library's materials at http://search.lib.virginia.edu/terms.html</xsl:text>
</field>
</xsl:if>
<!-- date indexed -->
<field name="date_indexed_facet">
<xsl:value-of select="$dateIngestNow"/>
</field>
<!-- call number -->
<xsl:for-each select="//mods:identifier">
<xsl:if test="//mods:identifier/text() and @type='accessionNumber'">
<field name="call_number_display">
<xsl:value-of select="current()"/>
</field>
<field name="call_number_text">
<xsl:value-of select="current()"/>
</field>
</xsl:if>
</xsl:for-each>
<!-- title -->
<xsl:for-each select="//mods:title">
<xsl:if test="position() = 1 or @type='uniform'">
<field name="main_title_display">
<xsl:value-of select="current()"/>
</field>
<!-- there can be only one! title facet will BREAK solr sorting if multiple values found -->
<field name="title_facet">
<xsl:value-of select="current()"/>
</field>
<field name="title_text">
<xsl:value-of select="current()"/>
</field>
<field name="title_display">
<xsl:value-of select="current()"/>
</field>
<field name="title_sort_facet">
<xsl:value-of select="translate(current(), $uppercase, $lowercase)"/>
</field>
</xsl:if>
</xsl:for-each>
<!-- deleted 10/26/16 at request from jtb4t
<xsl:if
test="not(//mods/*[1][local-name() = 'titleInfo']/*[local-name() = 'title'])">
<field name="alternate_title_display">untitled</field>
</xsl:if>
-->
<!-- searchable legacy identifier -->
<xsl:for-each select="//mods/identifier[(@displayLabel='Negative Number' or @displayLabel='Prints Number' or @displayLabel='Originating Collection' or @displayLabel='Artifact Number' or @displayLabel='Retrieval ID' or @displayLabel='retrieval ID')]">
<xsl:variable name="boxnbr" select="//mods/location/shelfLocator"/>
<field name="media_retrieval_id_display">
<xsl:if test="$boxnbr">
<xsl:value-of select="$boxnbr"/>
<xsl:text>, </xsl:text>
</xsl:if>
<xsl:value-of select="current()"/>
</field>
<field name="media_retrieval_id_facet">
<xsl:value-of select="current()"/>
</field>
<field name="media_retrieval_id_text">
<xsl:value-of select="current()"/>
</field>
</xsl:for-each>
<!-- SOLR can take only one year_multisort_i field, so we need to choose which mods element to utilize -->
<xsl:for-each select="/mods/originInfo[1]">
<xsl:choose>
<xsl:when test="current()/dateIssued[@keyDate='yes'][1]">
<xsl:call-template name="build-dates">
<xsl:with-param name="date-node"
select="current()/dateIssued[@keyDate='yes'][1]"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="current()/dateCreated[@keyDate='yes'][1]">
<xsl:call-template name="build-dates">
<xsl:with-param name="date-node"
select="current()/dateCreated"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="current()/dateCaptured[@keyDate='yes'][1]">
<xsl:call-template name="build-dates">
<xsl:with-param name="date-node"
select="current()/dateCaptured[@keyDate='yes'][1]"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="current()/dateValid[@keyDate='yes'][1]">
<xsl:call-template name="build-dates">
<xsl:with-param name="date-node"
select="current()/dateValid[@keyDate='yes'][1]"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="current()/copyrightDate[@keyDate='yes'][1]">
<xsl:call-template name="build-dates">
<xsl:with-param name="date-node"
select="current()/copyrightDate[@keyDate='yes'][1]"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="current()/dateOther[@keyDate='yes'][1]">
<xsl:call-template name="build-dates">
<xsl:with-param name="date-node"
select="current()/dateOther[@keyDate='yes'][1]"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:for-each>
<!-- subject text -->
<xsl:for-each select="//subject">
<xsl:variable name="text-content">
<xsl:choose>
<xsl:when test="current()/child::*/local-name() = 'hierarchicalGeographic'"/>
<xsl:otherwise>
<xsl:for-each select="./descendant::text()[matches(., '[\w]+')]">
<xsl:if test="matches(current(), '[\w]+')">
<!-- add double dash to all trailing subfields -->
<xsl:if test="position() != 1">
<xsl:text> -- </xsl:text>
</xsl:if>
<xsl:copy-of select="normalize-space(current())"/>
</xsl:if>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="not($text-content = '')">
<field name="subject_text">
<xsl:value-of select="$text-content"/>
</field>
<field name="subject_facet">
<xsl:value-of select="$text-content"/>
</field>
<field name="subject_genre_facet">
<xsl:value-of select="$text-content"/>
</field>
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:for-each>
<!-- get Geographic Places facet from subject/hierarchicalGeographic -->
<xsl:for-each select="//subject">
<xsl:choose>
<!-- only use standalone geographical children -->
<xsl:when test="*[2]"/>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="current()/child::*/local-name() = 'hierarchicalGeographic'">
<xsl:variable name="placeList">
<xsl:for-each select="./descendant::text()[matches(., '[\w]+')]">
<!-- add double dash to all trailing subfields -->
<xsl:if test="position() != 1">
<xsl:text> -- </xsl:text>
</xsl:if>
<xsl:copy-of select="normalize-space(current())"/>
</xsl:for-each>
</xsl:variable>
<xsl:if test="$placeList">
<field name="region_facet">
<xsl:value-of select="$placeList"/>
</field>
</xsl:if>
</xsl:when>
<xsl:when test="current()/geographic/text()">
<field name="region_facet">
<xsl:value-of select="current()/geographic/text()"/>
</field>
</xsl:when>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<!-- library facet -->
<xsl:for-each select="/mods/location/physicalLocation[not(@authority='oclcorg')]">
<xsl:if test="current()/text() != ' '">
<field name="location_display">
<xsl:value-of select="current()/text()"/>
</field>
</xsl:if>
<xsl:variable name="normalizedLibraryName">
<xsl:choose>
<xsl:when
test="./text()='Special Collections, University of Virginia Library, Charlottesville, Va.'"
>Special Collections</xsl:when>
<xsl:when
test="./text()='Historical Collections & Services, Claude Moore Health Sciences Library, Charlottesville, Va.'"
>Health Sciences</xsl:when>
<xsl:when
test="./text()='Special Collections, Arthur J. Morris Law Library, Charlottesville, Va.'"
>Law School</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:if test="$normalizedLibraryName != ''">
<field name="library_facet">
<xsl:value-of select="$normalizedLibraryName"/>
</field>
</xsl:if>
</xsl:for-each>
<!-- creator -->
<!-- handle names without identifying type -->
<xsl:for-each select="//mods/name[not(@type)]">
<xsl:variable name="dfltName">
<xsl:value-of select="current()/namePart/text()"/>
</xsl:variable>
<xsl:if test="normalize-space($dfltName) != ''">
<field name="author_display">
<xsl:value-of select="$dfltName"/>
</field>
<field name="author_facet">
<xsl:value-of select="$dfltName"/>
</field>
<field name="author_text">
<xsl:value-of select="$dfltName"/>
</field>
</xsl:if>
</xsl:for-each>
<!-- added corporate info to accommodate Online Artifacts records -->
<xsl:for-each select="//mods/name[@type='corporate']">
<xsl:variable name="corpName">
<xsl:value-of select="current()/namePart/text()"/>
</xsl:variable>
<xsl:if test="normalize-space($corpName) != ''">
<field name="author_display">
<xsl:value-of select="$corpName"/>
</field>
<field name="author_facet">
<xsl:value-of select="$corpName"/>
</field>
<field name="author_text">
<xsl:value-of select="$corpName"/>
</field>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="//mods/name[@type='personal']">
<xsl:variable name="fname">
<xsl:choose>
<xsl:when
test="current()/namePart[@type='family'] and current()/namePart[@type='family'][substring-before(., ',')!='']">
<xsl:value-of
select="substring-before(current()/namePart[@type='family'], ',')"
/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="current()/namePart[@type='family']"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="gname">
<xsl:choose>
<xsl:when
test="current()/namePart[@type='given'] and current()/namePart[@type='given'][substring-before(., ',')!='']">
<xsl:value-of
select="substring-before(current()/namePart[@type='given'], ',')"
/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="current()/namePart[@type='given']"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="term-of-address">
<xsl:choose>
<xsl:when
test="current()/namePart[@type='termsOfAddress'] and current()/namePart[@type='termsOfAddress'][substring-before(., ',')!='']">
<xsl:value-of
select="substring-before(current()/namePart[@type='termsOfAddress'], ',')"
/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="current()/namePart[@type='termsOfAddress']"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="nameFull">
<xsl:choose>
<xsl:when
test="current()/namePart[@type='family'] and current()/namePart[@type='given']">
<xsl:value-of select="$fname"/>
<xsl:text>, </xsl:text>
<xsl:value-of select="$gname"/>
</xsl:when>
<xsl:when
test="current()/namePart[@type='family'] and current()/namePart[@type='termsOfAddress']">
<xsl:value-of select="$fname"/>
<xsl:text>, </xsl:text>
<xsl:value-of select="$term-of-address"/>
</xsl:when>
<xsl:when
test="current()/namePart[@type='given'] and current()/namePart[@type='termsOfAddress']">
<xsl:value-of select="$gname"/>
<xsl:text>, </xsl:text>
<xsl:value-of select="$term-of-address"/>
</xsl:when>
<xsl:when
test="contains(current()/namePart[not(@type = 'date')][not(@type = 'termsOfAddress')][1], ',') and count(current()/namePart) = 1">
<xsl:value-of select="current()/namePart[1]"/>
</xsl:when>
<xsl:when test="current()/namePart[not(@type = 'date')]">
<xsl:for-each select="current()/namePart[not(@type = 'date')]">
<xsl:choose>
<xsl:when
test="contains(., ',') and substring-after(., ',')=''">
<xsl:value-of select="substring-before(., ',')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="current()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:if test="normalize-space($nameFull) != ''" >
<field name="author_facet">
<xsl:value-of select="$nameFull"/>
</field>
<field name="author_text">
<xsl:value-of select="$nameFull"/>
</field>
<xsl:choose>
<xsl:when test="child::namePart[@type='date']">
<field name="author_display"><xsl:value-of select="$nameFull"/>, <xsl:value-of select="child::namePart[@type='date']/text()"/>
</field>
</xsl:when>
<xsl:otherwise>
<field name="author_display">
<xsl:value-of select="$nameFull"/>
</field>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
<!-- The following is commented because the special-role is no longer needed. 11/10/11 -->
<!--
<xsl:variable name="special-role">
<xsl:if test="current()/role/roleTerm[not(@type='code')][not(contains(., 'creator'))]"> (<xsl:value-of select="current()/role/roleTerm[not(@type='code')][not(contains(., 'creator'))]"/>)</xsl:if>
</xsl:variable>
<xsl:choose>
<xsl:when test="child::namePart[@type='date']">
<field name="author_display"><xsl:value-of select="$nameFull"/>, <xsl:value-of select="child::namePart[@type='date']/text()"/><xsl:value-of select="$special-role"/></field>
</xsl:when>
<xsl:otherwise>
<field name="author_display"><xsl:value-of select="$nameFull"/><xsl:value-of select="$special-role"/></field>
</xsl:otherwise>
</xsl:choose>
-->
<xsl:choose>
<xsl:when test="position() = 1 and child::mods:namePart[@type='date']">
<field name="author_sort_facet">
<xsl:value-of select="translate($nameFull, $uppercase, $lowercase)"/>
<xsl:text> </xsl:text>
<xsl:value-of select="translate(child::mods:namePart[@type='date']/text(), $uppercase, $lowercase)"/>
</field>
</xsl:when>
<xsl:when test="position() = 1">
<field name="author_sort_facet"><xsl:value-of select="translate($nameFull, $uppercase, $lowercase)"/></field>
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:for-each>
<!-- Publication information added for Bicentennial collection 9/2016-->
<xsl:for-each select="//mods/originInfo/publisher">
<xsl:choose>
<xsl:when test="./text()">
<field name="published_display">
<xsl:value-of select="text()"/>
</field>
</xsl:when>
</xsl:choose>
</xsl:for-each>
<!-- series facet -->
<xsl:for-each select="//mods/relatedItem[@type='series'][not(@displayLabel='Part of')]">
<xsl:variable name="dateRange" xml:space="default">
<xsl:choose>
<xsl:when test="//mods/relatedItem[1]/originInfo[1]/dateCreated[@point='start'] and
//mods/relatedItem[1]/originInfo[1]/dateCreated[@point='end']"
>, <xsl:value-of
select="//mods/relatedItem[1]/originInfo[1]/dateCreated[@point='start']"
/> - <xsl:value-of
select="//mods/relatedItem[1]/originInfo[1]/dateCreated[@point='end']"
/></xsl:when>
<xsl:when
test="//mods/relatedItem[1]/originInfo[1]/dateCreated[@point='start']"
>, <xsl:value-of
select="//mods/relatedItem[1]/originInfo[1]/dateCreated[@point='start']"
/> - ?</xsl:when>
<xsl:when
test="//mods/relatedItem[1]/originInfo[1]/dateCreated[@point='end']"
>, ? - <xsl:value-of
select="//mods/relatedItem[1]/originInfo[1]/dateCreated[@point='end']"
/>)</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:variable>
<xsl:variable name="volume" xml:space="default">
<xsl:choose>
<xsl:when test="current()/part/detail[@type='volume']">
<xsl:value-of select="current()/part/detail[@type='volume']/number"/>
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:variable>
<xsl:variable name="issue" xml:space="default">
<xsl:choose>
<xsl:when test="current()/part/detail[@type='issue']">
<xsl:value-of select="current()/part/detail[@type='issue']/number"/>
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:variable>
<field name="series_title_text">
<xsl:for-each select="current()/titleInfo/descendant::*">
<xsl:text> </xsl:text>
<xsl:value-of select="."/>
</xsl:for-each>
</field>
<field name="series_title_facet">
<xsl:for-each select="current()/titleInfo/descendant::*[local-name() != 'nonSort']">
<xsl:value-of select="."/>
<xsl:if test="position() != last()">
<xsl:text> </xsl:text>
</xsl:if>
</xsl:for-each>
</field>
<field name="series_title_display">
<xsl:for-each select="current()/titleInfo/descendant::*[local-name() != 'nonSort']">
<xsl:value-of select="."/>
<xsl:if test="$dateRange">
<xsl:value-of xml:space="default" select="$dateRange"/>
</xsl:if>
<xsl:if test="$volume != ''">
<xsl:text>, Volume </xsl:text> <xsl:value-of xml:space="default" select="$volume"/>
</xsl:if>
<xsl:if test="$issue != ''">
<xsl:text>, Issue </xsl:text> <xsl:value-of xml:space="default" select="$issue"/>
</xsl:if>
<xsl:if test="position() != last()">
<xsl:text> </xsl:text>
</xsl:if>
</xsl:for-each>
</field>
</xsl:for-each>
<!-- date (range) -->
<xsl:for-each select="/mods/relatedItem[1]/originInfo[1]">
<field name="startDate_text">
<xsl:value-of select="current()/dateCreated[@point='start']"/>
</field>
<field name="endDate_text">
<xsl:value-of select="current()/dateCreated[@point='end']"/>
</field>
</xsl:for-each>
<!-- format facet -->
<field name="format_facet">Online</field>
<field name="format_text">Online</field>
<xsl:for-each select="//mods/typeOfResource">
<xsl:choose>
<!-- typeOfResource 'three dimensional object' -> Physical Object -->
<xsl:when test="./text()='three dimensional object'">
<field name="format_text">
<xsl:value-of>Physical Object</xsl:value-of>
</field>
<field name="format_facet">
<xsl:value-of>Physical Object</xsl:value-of>
</field>
</xsl:when>
<!-- typeOfResource 'still image' -> Visual Materials -->
<xsl:when test="./text()='still image'">
<field name="format_text">
<xsl:value-of>Visual Materials</xsl:value-of>
</field>
<field name="format_facet">
<xsl:value-of>Visual Materials</xsl:value-of>
</field>
</xsl:when>
<xsl:otherwise>
<field name="format_text">
<xsl:value-of select="./text()"/>
</field>
<field name="format_facet">
<xsl:value-of select="./text()"/>
</field>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<!-- Collection-specific Facets and Fields -->
<!-- Vanity Fair -->
<xsl:if test="//mods/relatedItem[@type='series'][@displayLabel='Part of']/titleInfo/title/text()='Cecil Lang Collection of Vanity Fair Illustrations'">
<field name="has_optional_facet">category_facet</field>
<field name="has_optional_facet">group_facet</field>
<field name="has_optional_facet">signature_facet</field>
<xsl:if test="//mods/note[@displayLabel='Category']/text()">
<field name="category_facet">
<xsl:value-of select="//mods/note[@displayLabel='Category']"/>
</field>
<field name="category_display">
<xsl:value-of select="//mods/note[@displayLabel='Category']"/>
</field>
</xsl:if>
<xsl:if test="//mods/note[@displayLabel='Group']/text()">
<field name="group_facet">
<xsl:value-of select="//mods/note[@displayLabel='Group']/substring-before(.,',')"/>
</field>
<field name="group_display">
<xsl:value-of select="//mods/note[@displayLabel='Group']"/>
</field>
</xsl:if>
<xsl:if test="//mods/note[@displayLabel='Signature']/text()">
<field name="signature_facet">
<xsl:value-of select="//mods/note[@displayLabel='Signature']"/>
</field>
<field name="signature_display">
<xsl:value-of select="//mods/note[@displayLabel='Signature']"/>
</field>
</xsl:if>
</xsl:if>
<!-- End of Collection-specific Facets and Fields -->
<!-- genre -->
<xsl:for-each select="//mods/genre/text()">
<field name="subject_text">
<xsl:value-of select="current()"/>
</field>
<field name="subject_facet">
<xsl:value-of select="current()"/>
</field>
<field name="subject_genre_facet">
<xsl:value-of select="current()"/>
</field>
</xsl:for-each>
<xsl:for-each select="//mods/abstract/text()">
<field name="abstract_display">
<xsl:value-of select="current()"/>
</field>
<field name="abstract_text">
<xsl:value-of select="current()"/>
</field>
</xsl:for-each>
<!-- physical description -->
<!-- first put form subelement in Virgo Type -->
<xsl:for-each select="//mods/physicalDescription/form/text()">
<field name="genre_display">
<xsl:value-of select="current()"/>
</field>
<field name="genre_facet">
<xsl:value-of select="current()"/>
</field>
</xsl:for-each>
<!-- then extent followed by note in Virgo Description -->
<xsl:variable name="descriptionDisplay">
<xsl:for-each select="//mods/physicalDescription/extent/text()">
<xsl:value-of select="."/>
<xsl:if test="//mods/physicalDescription/note">
<xsl:text>; </xsl:text>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="//mods/physicalDescription/note">
<xsl:value-of select="./text()"/>
<xsl:if test="position() != last()">
<xsl:text>; </xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:if test="$descriptionDisplay != ''">
<field name="media_description_display">
<xsl:value-of select="normalize-space($descriptionDisplay)"/>
</field>
<field name="desc_meta_file_display">
<xsl:value-of select="normalize-space($descriptionDisplay)"/>
</field>
<field name="media_description_text">
<xsl:value-of select="normalize-space ($descriptionDisplay)"/>
</field>
</xsl:if>
<!-- staff note -->
<xsl:for-each select="//mods/note[@displayLabel='staff']">
<xsl:if test="./text() != ' '">
<field name="note_text"><xsl:value-of select="current()"
/></field>
<!-- use if you want this data to be searchable -->
<field name="note_display"><xsl:value-of select="current()"
/></field>
<!-- use if you want this data to be available for display in blacklight brief or full record -->
</xsl:if>
</xsl:for-each>
<!-- use and access (rough version) -->
<xsl:for-each select="//accessCondition[@type='restrictionOnAccess']">
<xsl:variable name="accessRestriction">
<!-- If access restriction element is empty, we will restrict object by default -->
<xsl:choose>
<xsl:when test="current()/text()">
<xsl:value-of select="normalize-space(current())"/>
</xsl:when>
<xsl:otherwise>RESTRICTED</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<field name="access_display"><xsl:value-of select="current()/@displayLabel"/>: <xsl:value-of select="$accessRestriction"/></field>
<field name="access_text">
<xsl:value-of select="$accessRestriction"/>
</field>
</xsl:for-each>
<xsl:for-each select="//accessCondition[@type='useAndReproduction']">
<xsl:variable name="accessUse">
<!-- If use restriction element is empty, we will restrict object by default -->
<xsl:choose>
<xsl:when test="current()/text()">
<xsl:value-of select="normalize-space(current())"/>
</xsl:when>
<xsl:otherwise>RESTRICTED</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<field name="access_display"><xsl:value-of select="current()/@displayLabel"/>: <xsl:value-of select="$accessUse"/></field>
<field name="access_text">
<xsl:value-of select="$accessUse"/>
</field>
</xsl:for-each>
<xsl:for-each select="//accessCondition[@type='local rights statements']">
<field name="local_rights_statement_display"><xsl:value-of select="current()"/></field>
<field name="local_rights_statement_text"><xsl:value-of select="current()"/></field>
</xsl:for-each>
<!-- this (arbitary) dateTime gets added to every record -->
<!-- default blacklight behavior is to sort by this date (newest first) -->
<!-- default behavior here is to plug in Feb 2, 2010 unless $ingestDate set -->
<xsl:choose>
<xsl:when
test="not($dateIngestNow) and //recordInfo/recordCreationDate[@encoding='marc']">
<xsl:variable name="marcdate">
<xsl:call-template name="format-marc-date">
<xsl:with-param name="date"
select="//recordInfo/recordCreationDate[@encoding='marc'][1]"/>
</xsl:call-template>
</xsl:variable>
<field name="date_received_facet">
<xsl:value-of select="$marcdate"/>
</field>
</xsl:when>
<xsl:when test="not($dateIngestNow) and not($shadowedItem)">
<field name="date_received_facet"><xsl:value-of
select="fn:dateTime(xs:date('2010-02-01'), xs:time('12:00:00'))"
/>Z</field>
</xsl:when>
<xsl:when test="not($dateIngestNow) and not($shadowedItem)">
<!-- shadowed items get older timestamps so the don't come up first in Blacklight/Solr, whihc sorts on this field -->
<field name="date_received_facet"><xsl:value-of
select="fn:dateTime(xs:date('1999-12-31'), xs:time('23:59:59'))"
/>Z</field>
</xsl:when>
<xsl:when test="//relatedItem[@type='series' and @displayLabel='Part of']/titleInfo[1]/title[1]/text() = 'Holsinger Studio Collection'">
<field name="date_received_facet">2010-02-01T00:00:00Z</field>
</xsl:when>
<xsl:otherwise>
<field name="date_received_facet">
<xsl:value-of select="fn:current-dateTime()"/>
</field>
</xsl:otherwise>
</xsl:choose>
<!-- Test for deprecated method of determing whether the record is to be shadowed. Otherwise, use newer method of relying upon descMetadata. -->
<xsl:choose>
<xsl:when test="$shadowedItem != 'false'">
<field name="shadowed_location_facet">