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 pathdefaultModsTransformation.xsl
1404 lines (1329 loc) · 65.9 KB
/
defaultModsTransformation.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"
xmlns:mods="http://www.loc.gov/mods/v3" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:uva="http://fedora.lib.virginia.edu/relationships#">
<xsl:param name="debug" required="no" select="false()" />
<!-- Required Parameters -->
<!-- Unique identifier for object -->
<xsl:param name="pid">
<xsl:value-of select="false()"/>
</xsl:param>
<!-- level of Solr publication for this object. -->
<xsl:param name="destination">
<xsl:value-of select="false()"/>
</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">
<xsl:value-of select="false()"/>
</xsl:param>
<!-- Datetime that this index record was produced. Format:YYYYMMDDHHMM -->
<xsl:param name="dateIngestNow">
<xsl:value-of select="false()"/>
</xsl:param>
<xsl:param name="policyFacet">
<xsl:value-of select="false()"/>
</xsl:param>
<xsl:param name="useRightsString" required="yes" />
<!-- 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>
<!-- A URL to get the IIIF presentation metadata -->
<xsl:param name="iiifManifest">
<xsl:value-of select="false()"/>
</xsl:param>
<xsl:param name="iiifRoot">
<xsl:value-of select="false()"/>
</xsl:param>
<xsl:param name="pdfServiceUrl" />
<xsl:param name="pageCount" />
<xsl:param name="permanentUrl">
<xsl:value-of select="false()" />
</xsl:param>
<!-- 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" />
<xsl:param name="exemplarPid">
<xsl:value-of select="false()"/>
</xsl:param>
<!-- Will contain the transcription text of one object (in the case of an image object), or a concatenated string of all transcription text belonging to children objects (in the case of a bibliographic or colelction object). -->
<xsl:param name="totalTranscriptions">
<xsl:value-of select="false()"/>
</xsl:param>
<!-- like "totalTranscriptions" but a URL at which the transcriptions can be fetched in plain text. -->
<xsl:param name="transcriptionUrl" />
<!-- Will contain the title text of one object (in the case of an image object), or a concatenated string of all title text belonging to children objects (in the case of a bibliographic or colelction object). -->
<xsl:param name="totalTitles">
<xsl:value-of select="false()"/>
</xsl:param>
<!-- Will contain the description text of one object (in the case of an image object), or a concatenated string of all description text belonging to children objects (in the case of a bibliographic or colelction object). -->
<xsl:param name="totalDescriptions">
<xsl:value-of select="false()"/>
</xsl:param>
<!-- like "totalDescriptions" but a URL at which the descriptions can be fetched in plain text. -->
<xsl:param name="descriptionUrl" />
<!-- 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">
<xsl:value-of select="false()"/>
</xsl:param>
<!-- Import object's solr record for the analog equivalent to build format_facet fields. -->
<xsl:param name="analogSolrRecord">
<xsl:value-of select="false()"/>
</xsl:param>
<!-- Optional Parameters -->
<!-- If this is a child object, we will need many of the fields of the parent included in the child (if it is going to be made uniquely discoverable). -->
<xsl:param name="parentModsRecord">
<xsl:value-of select="false()"/>
</xsl:param>
<!-- If this item belongs to a specific collection of objects, that information should be encoded in the above mentioned XPath location. -->
<xsl:param name="digitalCollectionFacet"
select="//relatedItem[@type='series']/titleInfo[1]/title[1]"/>
<!-- Global Variables -->
<xsl:variable name="lowercase" select="'abcdefghijklmnopqrstuvwxyz '"/>
<!-- whitespace in select is meaningful -->
<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ,;-:'"/>
<!-- AC added this to remove trailing periods from $special-role -->
<xsl:variable name="periods" select="'.'"/>
<xsl:variable name="noperiods" select="' '"/>
<xsl:variable name='newline'><xsl:text>
</xsl:text></xsl:variable>
<xsl:param name="publishedDateFacet">
<xsl:value-of select="'More than 50 years ago'"/>
</xsl:param>
<xsl:output encoding="UTF-8" media-type="text/xml" xml:space="preserve" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="text()"/>
<xsl:template match="/">
<xsl:variable name="mode" select="'primary'"/>
<add>
<doc>
<field name="id" source="{$mode}">
<xsl:value-of select="$pid"/>
</field>
<field name="date_indexed_facet" source="{$mode}">
<xsl:value-of select="$dateIngestNow"/>
</field>
<field name="date_received_facet" source="{$mode}">
<xsl:value-of select="$dateReceived"/>
</field>
<field name="date_received_text" source="{$mode}">
<xsl:value-of select="$dateReceived"/>
</field>
<field name="released_facet" source="{$mode}">
<xsl:value-of select="$destination"/>
</field>
<xsl:if test="$policyFacet != 'false'">
<field name="policy_facet" source="{$mode}">
<xsl:value-of select="$policyFacet"/>
</field>
</xsl:if>
<field name="source_facet" source="{$mode}">
<xsl:value-of select="$sourceFacet"/>
</field>
<field name="published_date_facet" source="{$mode}">
<xsl:value-of select="$publishedDateFacet"/>
</field>
<xsl:if test="$digitalCollectionFacet != ''">
<field name="digital_collection_facet" source="{$mode}">
<xsl:value-of select="$digitalCollectionFacet"/>
</field>
</xsl:if>
<xsl:if test="$pdfServiceUrl">
<xsl:if test="not($pageCount = '1')">
<field name="feature_facet">pdf_service</field>
<field name="pdf_url_display"><xsl:value-of select="$pdfServiceUrl"/></field>
</xsl:if>
</xsl:if>
<field name="thumbnail_url_display"><xsl:value-of select="$iiifRoot" /><xsl:value-of select="$exemplarPid" />/full/!125,125/0/default.jpg</field>
<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 test="$totalTranscriptions != 'false'">
<field name="transcription_fulltext" source="{$mode}">
<xsl:value-of select="$totalTranscriptions"/>
</field>
</xsl:if>
<xsl:if test="$transcriptionUrl">
<field name="transcription_fulltext" source="{$mode}">
<xsl:value-of select="unparsed-text($transcriptionUrl)"/>
</field>
</xsl:if>
<xsl:if test="$totalDescriptions != 'false'">
<field name="descriptions_fulltext" source="{$mode}">
<xsl:value-of select="$totalDescriptions"/>
</field>
</xsl:if>
<xsl:if test="$descriptionUrl">
<field name="descriptions_fulltext" source="{$mode}">
<xsl:value-of select="unparsed-text($descriptionUrl)"/>
</field>
</xsl:if>
<xsl:if test="$totalTitles != 'false'">
<field name="titles_fulltext" source="{$mode}">
<xsl:value-of select="$totalTitles"/>
</field>
</xsl:if>
<xsl:call-template name="getTitle">
<xsl:with-param name="mode" select="'primary'"/>
</xsl:call-template>
<xsl:call-template name="getDescription">
<xsl:with-param name="mode" select="'primary'"/>
</xsl:call-template>
<xsl:call-template name="getLanguageNote">
<xsl:with-param name="mode" select="primary"/>
</xsl:call-template>
<xsl:call-template name="getLocalNote">
<xsl:with-param name="mode" select="primary"/>
</xsl:call-template>
<xsl:call-template name="getPublishedDate">
<xsl:with-param name="mode" select="primary"/>
</xsl:call-template>
<xsl:call-template name="getSubjects">
<xsl:with-param name="mode" select="'primary'"/>
</xsl:call-template>
<xsl:call-template name="getAuthor">
<xsl:with-param name="mode" select="'primary'"/>
</xsl:call-template>
<xsl:call-template name="getLanguage">
<xsl:with-param name="mode" select="'primary'"/>
</xsl:call-template>
<xsl:call-template name="getSeries">
<xsl:with-param name="mode" select="'primary'"/>
</xsl:call-template>
<xsl:call-template name="getCopyInformation">
<xsl:with-param name="mode" select="'primary'"/>
</xsl:call-template>
<!-- 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" source="{$mode}">
<xsl:value-of select="$shadowedItem"/>
</field>
</xsl:when>
<xsl:when
test="//mods:identifier[@displayLabel='Accessible index record displayed in VIRGO'][@invalid='yes']">
<field name="shadowed_location_facet" source="{$mode}">HIDDEN</field>
</xsl:when>
<xsl:otherwise>
<field name="shadowed_location_facet" source="{$mode}">VISIBLE</field>
</xsl:otherwise>
</xsl:choose>
<!-- PARENT RECORD TRANSFORMATION -->
<xsl:if test="$parentModsRecord != 'false'">
<xsl:apply-templates select="document($parentModsRecord)/*[local-name()='mods']"
mode="secondary"/>
</xsl:if>
<!-- ANALOG SOLR RECORD TRANSFORMATION -->
<xsl:variable name="solrRecord" select="document($analogSolrRecord)" />
<xsl:apply-templates select="$solrRecord" mode="quaternary"/>
<!-- 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="marcCitation">
<xsl:call-template name="extractMarcSubfield">
<xsl:with-param name="marcCDATA" select="$solrRecord//doc/str[@name='marc_display']" />
<xsl:with-param name="datafield" select="524" />
<xsl:with-param name="subfield" select="a" />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="citation">
<xsl:choose>
<xsl:when test="$marcCitation != ''">
<xsl:value-of select="$marcCitation" />
</xsl:when>
<xsl:otherwise>
<xsl:variable name="titleFields">
<xsl:call-template name="getTitle">
<xsl:with-param name="mode" select="'primary'"/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="$titleFields/field[@name='main_title_display']/text()" />
<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:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:comment select="concat('Use Rights: ', $useRightsString)" />
<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:choose>
<xsl:when test="$useRightsString = 'In Copyright'">
<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>
<xsl:value-of select="$newline" />
<xsl:text>See the full Virgo Terms of Use at http://search.lib.virginia.edu/terms.html for more information.</xsl:text>
</xsl:when>
<xsl:when test="$useRightsString = 'No Known Copyright'">
<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>
<xsl:value-of select="$newline" />
<xsl:text>See the full Virgo Terms of Use at http://search.lib.virginia.edu/terms.html for more information.</xsl:text>
</xsl:when>
<xsl:otherwise>
<!-- Default to Copyright Not Evaluated -->
<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>
<xsl:value-of select="$newline" />
<xsl:text>See the full Virgo Terms of Use at http://search.lib.virginia.edu/terms.html for more information.</xsl:text>
</xsl:otherwise>
</xsl:choose>
</field>
</xsl:if>
</doc>
</add>
</xsl:template>
<xsl:template name="extractMarcSubfield">
<xsl:param name="marcCDATA" required="yes" />
<xsl:param name="datafield" required="yes" />
<xsl:param name="subfield" required="yes" />
<xsl:variable name="open" select="concat('datafield tag="', $datafield)" />
<xsl:variable name="firstAfter" select="substring-after($marcCDATA, $open)" />
<xsl:variable name="datafieldText" select="substring-before(substring-after(substring-before(substring-after($firstAfter, '>'), '</datafield>'), '>'), '<')"/>
<xsl:if test="$debug">
<xsl:message select="concat('marc: ', $marcCDATA)" />
<xsl:message select="concat('open: ', $open)" />
<xsl:message select="concat('firstAfter: ', $firstAfter)" />
<xsl:message select="concat('Datafield Text: ', $datafieldText)" />
</xsl:if>
<xsl:value-of select="$datafieldText" />
</xsl:template>
<xsl:template match="mods:mods" mode="secondary">
<xsl:variable name="mode" select="secondary"/>
<xsl:call-template name="getTitle">
<xsl:with-param name="mode" select="'secondary'"/>
</xsl:call-template>
<xsl:call-template name="getAuthor">
<xsl:with-param name="mode" select="'secondary'"/>
</xsl:call-template>
<xsl:call-template name="getSubjects">
<xsl:with-param name="mode" select="'secondary'"/>
</xsl:call-template>
<xsl:call-template name="getLanguage">
<xsl:with-param name="mode" select="'secondary'"/>
</xsl:call-template>
<xsl:call-template name="getCopyInformation">
<xsl:with-param name="mode" select="'secondary'"/>
</xsl:call-template>
<xsl:call-template name="getSeries">
<xsl:with-param name="mode" select="'secondary'"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="doc" mode="quaternary">
<xsl:variable name="mode" select="quaternary"/>
<xsl:call-template name="getFormatFacet">
<xsl:with-param name="mode" select="'quaternary'"/>
</xsl:call-template>
<xsl:call-template name="getMarcDisplay">
<xsl:with-param name="mode" select="'quaternary'"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="getTitle">
<xsl:param name="mode"/>
<!-- Get and process the main title, not the uniform or alternate. The title from the primary document is used to create the main_title_display and the title_facet -->
<xsl:choose>
<xsl:when test="$mode != 'secondary'">
<field name="main_title_display" source="{$mode}">
<xsl:for-each select="//mods:mods/mods:titleInfo[not(@type)]/descendant::*">
<xsl:if test="name()='mods:subTitle'">
<xsl:text> : </xsl:text>
</xsl:if>
<xsl:value-of select="current()[normalize-space()]"/>
</xsl:for-each>
</field>
<!-- there can be only one! title facet will BREAK solr sorting if multiple values found -->
<field name="title_facet" source="{$mode}">
<xsl:for-each select="//mods:mods/mods:titleInfo[not(@type)]/descendant::*">
<xsl:value-of select="translate(current(), $uppercase, $lowercase)"/>
<xsl:text> </xsl:text>
</xsl:for-each>
</field>
<field name="title_sort_facet" source="{$mode}">
<xsl:for-each select="//mods:mods/mods:titleInfo[not(@type)]/descendant::*">
<xsl:value-of select="translate(current(), $uppercase, $lowercase)"/>
<xsl:text> </xsl:text>
</xsl:for-each>
</field>
</xsl:when>
</xsl:choose>
<!-- All titles get title_text and title_display -->
<field name="title_text" source="{$mode}">
<xsl:for-each select="//mods:mods/mods:titleInfo[not(@type)]/descendant::*">
<xsl:if test="name()='mods:subTitle'">
<xsl:text> : </xsl:text>
</xsl:if>
<xsl:value-of select="current()[normalize-space()]"/>
</xsl:for-each>
</field>
<field name="title_display" source="{$mode}">
<xsl:for-each select="//mods:mods/mods:titleInfo[not(@type)]/descendant::*">
<xsl:if test="name()='mods:subTitle'">
<xsl:text> : </xsl:text>
</xsl:if>
<xsl:value-of select="current()[normalize-space()]"/>
</xsl:for-each>
</field>
</xsl:template>
<xsl:template name="getAuthor">
<xsl:param name="mode"/>
<!-- creator -->
<xsl:for-each select="//mods:mods/mods:name[@type='personal']">
<xsl:variable name="fname">
<xsl:choose>
<xsl:when
test="current()/mods:namePart[@type='family'] and current()/mods:namePart[@type='family'][substring-before(., ',')!='']">
<xsl:value-of
select="substring-before(current()/mods:namePart[@type='family'], ',')"
/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="current()/mods:namePart[@type='family']"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="gname">
<xsl:choose>
<xsl:when
test="current()/mods:namePart[@type='given'] and current()/mods: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()/mods:namePart[@type='termsOfAddress'] and current()/mods:namePart[@type='termsOfAddress'][substring-before(., ',')!='']">
<xsl:value-of
select="substring-before(current()/mods:namePart[@type='termsOfAddress'], ',')"
/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="current()/mods:namePart[@type='termsOfAddress']"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="nameFull">
<xsl:choose>
<xsl:when
test="current()/mods:namePart[@type='family'] and current()/mods: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()/mods: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()/mods:namePart[@type='given'] and current()/mods:namePart[@type='termsOfAddress']">
<xsl:value-of select="$gname"/>
<xsl:text>, </xsl:text>
<xsl:value-of select="$term-of-address"/>
</xsl:when>
<xsl:when test="current()/mods:namePart[not(@type)]">
<xsl:value-of select="current()/mods:namePart[not(@type)]" />
<xsl:if test="current()/mods:namePart[@type='termsOfAddress']">
<xsl:text>, </xsl:text>
<xsl:value-of select="$term-of-address"/>
</xsl:if>
</xsl:when>
<xsl:when
test="contains(current()/mods:namePart[not(@type = 'date')][not(@type = 'termsOfAddress')][1], ',') and count(current()/mods:namePart) = 1">
<xsl:value-of select="current()/mods:namePart[1]"/>
</xsl:when>
<xsl:when test="current()/mods:namePart[not(@type = 'date')]">
<xsl:for-each select="current()/mods: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>
<field name="author_text" source="{$mode}">
<xsl:value-of select="$nameFull"/>
</field>
<xsl:variable name="special-role">
<xsl:if test="current()/mods:role/mods:roleTerm[not(@type='code')][not(contains(., 'creator'))]">
<xsl:value-of select="translate((current()/mods:role/mods:roleTerm[not(@type='code')][not(contains(., 'creator'))])[1], $periods, $noperiods)"/>
<!-- If there are multiple roles, we're only using the first here. Need to review if that's OK or should they be appended? -->
</xsl:if>
</xsl:variable>
<xsl:variable name="authorDisplayFacet">
<xsl:choose>
<xsl:when test="child::mods:namePart[@type='date']">
<xsl:if test="$special-role != ''">
<xsl:value-of select="$nameFull"/>, <xsl:value-of select="child::mods:namePart[@type='date']/text()"/>, <xsl:value-of select="$special-role"/>
</xsl:if>
<xsl:if test="$special-role = ''">
<xsl:value-of select="$nameFull"/>, <xsl:value-of select="child::mods:namePart[@type='date']/text()"/>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:if test="$special-role != ''">
<xsl:value-of select="$nameFull"/>, <xsl:value-of select="$special-role"/>
</xsl:if>
<xsl:if test="$special-role = ''">
<xsl:value-of select="$nameFull"/>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<field name="author_facet" source="{$mode}"><xsl:value-of select="normalize-space($authorDisplayFacet)"/></field>
<xsl:if test="current()[@usage='primary']">
<field name="author_display" source="{$mode}"><xsl:value-of select="normalize-space($authorDisplayFacet)"/></field>
<xsl:choose>
<xsl:when test="position() = 1 and child::mods:namePart[@type='date']">
<field name="author_sort_facet" source="{$mode}">
<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)"/>
<xsl:text> </xsl:text>
<xsl:value-of select="$special-role"
/>
</field>
</xsl:when>
<xsl:when test="position() = 1">
<field name="author_sort_facet" source="{$mode}">
<xsl:value-of select="translate($nameFull, $uppercase, $lowercase)"/>
<xsl:text> </xsl:text>
<xsl:value-of select="$special-role"
/>
</field>
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:if>
</xsl:for-each>
<!-- corporate author -->
<xsl:for-each select="//mods:mods/mods:name[@type='corporate']">
<xsl:variable name="corporateName">
<xsl:value-of select="current()/mods:namePart/text()"/>
</xsl:variable>
<xsl:variable name="corporateRoleTerm">
<xsl:value-of select="current()/mods:role/mods:roleTerm/text()"/>
</xsl:variable>
<field name="author_facet"><xsl:value-of select="$corporateName"/><xsl:text>, </xsl:text><xsl:value-of select="translate($corporateRoleTerm, $periods, $noperiods)"/></field>
<field name="author_text"><xsl:value-of select="$corporateName"/><xsl:text>, </xsl:text><xsl:value-of select="translate($corporateRoleTerm, $periods, $noperiods)"/></field>
</xsl:for-each>
</xsl:template>
<xsl:template name="getDescription">
<xsl:param name="mode"/>
<xsl:for-each select="//mods:note[@type='description']">
<field name="note_text" source="{$mode}">
<xsl:value-of select="current()"/>
</field>
<field name="note_display" source="{$mode}">
<xsl:value-of select="current()"/>
</field>
<xsl:choose>
<xsl:when test="$mode = 'secondary'"> </xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:template>
<xsl:template name="getLanguageNote">
<xsl:param name="mode"/>
<xsl:for-each select="//mods:note[@type='language']">
<field name="language_note_text" source="{$mode}">
<xsl:value-of select="current()"/>
</field>
<field name="language_note_display" source="{$mode}">
<xsl:value-of select="current()"/>
</field>
<xsl:choose>
<xsl:when test="$mode = 'secondary'"> </xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:template>
<xsl:template name="getLocalNote">
<xsl:param name="mode"/>
<xsl:for-each select="//mods:note[@type='local']">
<field name="local_note_text" source="{$mode}">
<xsl:value-of select="current()"/>
</field>
<field name="local_note_display" source="{$mode}">
<xsl:value-of select="current()"/>
</field>
<xsl:choose>
<xsl:when test="$mode = 'secondary'"> </xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:template>
<xsl:template name="getPublishedDate">
<xsl:param name="mode"/>
<!-- SOLR can take only one year_multisort_i field, so we need to choose which mods element to utilize -->
<xsl:for-each select="//mods:mods/mods:originInfo[1]">
<xsl:choose>
<xsl:when test="current()/mods:dateIssued[@encoding='marc'][1]">
<xsl:call-template name="build-dates">
<xsl:with-param name="mode" select="primary"/>
<xsl:with-param name="date-node"
select="current()/mods:dateIssued[@encoding='marc'][1]"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="current()/mods:dateIssued[1]">
<xsl:call-template name="build-dates">
<xsl:with-param name="date-node"
select="current()/mods:dateIssued[1]"/>
<xsl:with-param name="mode" select="primary"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="current()/mods:dateCreated[1]">
<xsl:call-template name="build-dates">
<xsl:with-param name="date-node"
select="current()/mods:dateCreated[1]"/>
<xsl:with-param name="mode" select="primary"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="current()/mods:dateCaptured[1]">
<xsl:call-template name="build-dates">
<xsl:with-param name="date-node"
select="current()/mods:dateCaptured[1]"/>
<xsl:with-param name="mode" select="primary"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="current()/mods:dateValid[1]">
<xsl:call-template name="build-dates">
<xsl:with-param name="date-node"
select="current()/mods:dateValid[1]"/>
<xsl:with-param name="mode" select="primary"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="current()/mods:copyrightDate[1]">
<xsl:call-template name="build-dates">
<xsl:with-param name="date-node"
select="current()/mods:copyrightDate[1]"/>
<xsl:with-param name="mode" select="primary"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="current()/mods:dateOther[1]">
<xsl:call-template name="build-dates">
<xsl:with-param name="date-node"
select="current()/mods:dateOther[1]"/>
<xsl:with-param name="mode" select="primary"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:for-each>
</xsl:template>
<xsl:template name="getSubjects">
<xsl:param name="mode"/>
<xsl:for-each select="//mods:subject">
<xsl:variable name="text-content">
<xsl:for-each select="./descendant::node()/text()[normalize-space()]">
<!-- 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>
<field name="subject_text" source="{$mode}">
<xsl:value-of select="$text-content"/>
</field>
<field name="subject_facet" source="{$mode}">
<xsl:value-of select="$text-content"/>
</field>
<field name="subject_genre_facet" source="{$mode}">
<xsl:value-of select="$text-content"/>
</field>
</xsl:for-each>
</xsl:template>
<xsl:template name="getCopyInformation">
<xsl:param name="mode"/>
<xsl:for-each select="//mods:mods/mods:location/mods:holdingSimple/mods:copyInformation">
<xsl:variable name="normalizedLibraryName">
<xsl:choose>
<xsl:when test="mods:subLocation = 'ALDERMAN'">Alderman</xsl:when>
<xsl:when test="mods:subLocation = 'ASTRONOMY'">Astronomy</xsl:when>
<xsl:when test="mods:subLocation = 'ATSEA'">Semester at Sea</xsl:when>
<xsl:when test="mods:subLocation = 'BIO-PSYCH'">Biology &
Psychology</xsl:when>
<xsl:when test="mods:subLocation = 'BLANDY'">Blandy Experimental Farm</xsl:when>
<xsl:when test="mods:subLocation = 'CHEMISTRY'">Chemistry</xsl:when>
<xsl:when test="mods:subLocation = 'CLEMONS'">Clemons</xsl:when>
<xsl:when test="mods:subLocation = 'EDUCATION'">Education</xsl:when>
<xsl:when test="mods:subLocation = 'DARDEN'">Darden Business School</xsl:when>
<xsl:when test="mods:subLocation = 'HEALTHSCI'">Health Sciences</xsl:when>
<xsl:when test="mods:subLocation = 'FINE-ARTS'">Fine Arts</xsl:when>
<xsl:when test="mods:subLocation = 'IVY'">Ivy Stacks</xsl:when>
<xsl:when test="mods:subLocation = 'LAW'">Law School</xsl:when>
<xsl:when test="mods:subLocation = 'MATH'">Mathematics</xsl:when>
<xsl:when test="mods:subLocation = 'MEDIA-CTR'">Robertson Media
Center</xsl:when>
<xsl:when test="mods:subLocation = 'MT-LAKE'">Mountain Lake</xsl:when>
<xsl:when test="mods:subLocation = 'MUSIC'">Music </xsl:when>
<xsl:when test="mods:subLocation = 'PHYSICS'">Physics</xsl:when>
<xsl:when test="mods:subLocation = 'SCI-ENG'">Brown SEL</xsl:when>
<xsl:when test="mods:subLocation = 'SPEC-COLL'">Special Collections</xsl:when>
</xsl:choose>
</xsl:variable>
<field name="library_facet" source="{$mode}">
<xsl:value-of select="$normalizedLibraryName"/>
</field>
<!-- This is intentionally omitted because it was requested that
we not show locations like "MCGR-VAULT" -->
<!--
<field name="location_facet" source="{$mode}">
<xsl:value-of select="$normalizedLibraryName"/>
<xsl:text> </xsl:text>
<xsl:value-of select="mods:shelfLocator"/>
</field>
-->
<field name="barcode_facet" source="{$mode}">
<xsl:value-of select="mods:note[@type='barcode']"/>
</field>
<field name="call_number_display" source="{$mode}">
<xsl:value-of select="mods:note[@type='call_number']"/>
</field>
<field name="call_number_text" source="{$mode}">
<xsl:value-of select="mods:note[@type='call_number']"/>
</field>
<field name="call_number_sort_facet" source="{$mode}">
<xsl:value-of select="mods:note[@type='call_number_sort']"/>
<xsl:text>:</xsl:text>
<xsl:value-of select="mods:note[@type='call_number']"/>
</field>
</xsl:for-each>
</xsl:template>
<xsl:template name="getSeries">
<xsl:param name="mode"/>
<xsl:for-each select="/mods:mods/mods:relatedItem[@type='series']/mods:titleInfo/mods:title">
<field name="series_title_facet" source="{$mode}">
<xsl:value-of select="current()[normalize-space()]"/>
</field>
<field name="series_title_text" source="{$mode}">
<xsl:value-of select="current()[normalize-space()]"/>
</field>
<field name="series_title_display" source="{$mode}">
<xsl:value-of select="current()[normalize-space()]"/>
</field>
</xsl:for-each>
</xsl:template>
<xsl:template name="getLanguage">
<xsl:param name="mode"/>
<xsl:for-each select="//mods:language/mods:languageTerm">
<xsl:variable name="langCode" select="text()"/>
<xsl:if test="not($langCode='zxx')">
<field name="language_facet" source="{$mode}">
<xsl:choose>
<xsl:when test="$langCode='???'">null</xsl:when>
<xsl:when test="$langCode='adrar'">Afar</xsl:when>
<xsl:when test="$langCode='abk'">Abkhaz</xsl:when>
<xsl:when test="$langCode='ace'">Achinese</xsl:when>
<xsl:when test="$langCode='ach'">Acoli</xsl:when>
<xsl:when test="$langCode='ada'">Adangme</xsl:when>
<xsl:when test="$langCode='ady'">Adygei</xsl:when>
<xsl:when test="$langCode='afa'">Afroasiatic (Other)</xsl:when>
<xsl:when test="$langCode='afh'">Afrihili (Artificial language)</xsl:when>
<xsl:when test="$langCode='afr'">Afrikaans</xsl:when>
<xsl:when test="$langCode='ajm'">Aljamia</xsl:when>
<xsl:when test="$langCode='aka'">Akan</xsl:when>
<xsl:when test="$langCode='akk'">Akkadian</xsl:when>
<xsl:when test="$langCode='alb'">Albanian</xsl:when>
<xsl:when test="$langCode='ale'">Aleut</xsl:when>
<xsl:when test="$langCode='alg'">Algonquian (Other)</xsl:when>
<xsl:when test="$langCode='amh'">Amharic</xsl:when>
<xsl:when test="$langCode='ang'">English, Old (ca. 450-1100)</xsl:when>
<xsl:when test="$langCode='apa'">Apache languages</xsl:when>
<xsl:when test="$langCode='ara'">Arabic</xsl:when>
<xsl:when test="$langCode='arc'">Aramaic</xsl:when>
<xsl:when test="$langCode='arg'">Aragonese Spanish</xsl:when>
<xsl:when test="$langCode='arm'">Armenian</xsl:when>
<xsl:when test="$langCode='arn'">Mapuche</xsl:when>
<xsl:when test="$langCode='arp'">Arapaho</xsl:when>
<xsl:when test="$langCode='art'">Artificial (Other)</xsl:when>
<xsl:when test="$langCode='arw'">Arawak</xsl:when>
<xsl:when test="$langCode='asm'">Assamese</xsl:when>
<xsl:when test="$langCode='ast'">Bable</xsl:when>
<xsl:when test="$langCode='ath'">Athapascan (Other)</xsl:when>
<xsl:when test="$langCode='aus'">Australian languages</xsl:when>
<xsl:when test="$langCode='ava'">Avaric</xsl:when>
<xsl:when test="$langCode='ave'">Avestan</xsl:when>
<xsl:when test="$langCode='awa'">Awadhi</xsl:when>
<xsl:when test="$langCode='aym'">Aymara</xsl:when>
<xsl:when test="$langCode='aze'">Azerbaijani</xsl:when>
<xsl:when test="$langCode='bad'">Banda</xsl:when>
<xsl:when test="$langCode='bai'">Bamileke languages</xsl:when>
<xsl:when test="$langCode='bak'">Bashkir</xsl:when>
<xsl:when test="$langCode='bal'">Baluchi</xsl:when>
<xsl:when test="$langCode='bam'">Bambara</xsl:when>
<xsl:when test="$langCode='ban'">Balinese</xsl:when>
<xsl:when test="$langCode='baq'">Basque</xsl:when>
<xsl:when test="$langCode='bas'">Basa</xsl:when>
<xsl:when test="$langCode='bat'">Baltic (Other)</xsl:when>
<xsl:when test="$langCode='bej'">Beja</xsl:when>
<xsl:when test="$langCode='bel'">Belarusian</xsl:when>
<xsl:when test="$langCode='bem'">Bemba</xsl:when>
<xsl:when test="$langCode='ben'">Bengali</xsl:when>
<xsl:when test="$langCode='ber'">Berber (Other)</xsl:when>
<xsl:when test="$langCode='bho'">Bhojpuri</xsl:when>
<xsl:when test="$langCode='bih'">Bihari</xsl:when>
<xsl:when test="$langCode='bik'">Bikol</xsl:when>
<xsl:when test="$langCode='bin'">Edo</xsl:when>
<xsl:when test="$langCode='bis'">Bislama</xsl:when>
<xsl:when test="$langCode='bla'">Siksika</xsl:when>
<xsl:when test="$langCode='bnt'">Bantu (Other)</xsl:when>
<xsl:when test="$langCode='bos'">Bosnian</xsl:when>
<xsl:when test="$langCode='bra'">Braj</xsl:when>
<xsl:when test="$langCode='bre'">Breton</xsl:when>
<xsl:when test="$langCode='btk'">Batak</xsl:when>
<xsl:when test="$langCode='bua'">Buriat</xsl:when>
<xsl:when test="$langCode='bug'">Bugis</xsl:when>
<xsl:when test="$langCode='bul'">Bulgarian</xsl:when>
<xsl:when test="$langCode='bur'">Burmese</xsl:when>
<xsl:when test="$langCode='cad'">Caddo</xsl:when>
<xsl:when test="$langCode='cai'">Central American Indian (Other)</xsl:when>
<xsl:when test="$langCode='cam'">Khmer</xsl:when>
<xsl:when test="$langCode='car'">Carib</xsl:when>
<xsl:when test="$langCode='cat'">Catalan</xsl:when>
<xsl:when test="$langCode='cau'">Caucasian (Other)</xsl:when>
<xsl:when test="$langCode='ceb'">Cebuano</xsl:when>
<xsl:when test="$langCode='cel'">Celtic (Other)</xsl:when>
<xsl:when test="$langCode='cha'">Chamorro</xsl:when>
<xsl:when test="$langCode='chb'">Chibcha</xsl:when>
<xsl:when test="$langCode='che'">Chechen</xsl:when>
<xsl:when test="$langCode='chg'">Chagatai</xsl:when>
<xsl:when test="$langCode='chi'">Chinese</xsl:when>
<xsl:when test="$langCode='chk'">Truk</xsl:when>
<xsl:when test="$langCode='chm'">Mari</xsl:when>
<xsl:when test="$langCode='chn'">Chinook jargon</xsl:when>
<xsl:when test="$langCode='cho'">Choctaw</xsl:when>
<xsl:when test="$langCode='chp'">Chipewyan</xsl:when>
<xsl:when test="$langCode='chr'">Cherokee</xsl:when>
<xsl:when test="$langCode='chu'">Church Slavic</xsl:when>
<xsl:when test="$langCode='chv'">Chuvash</xsl:when>
<xsl:when test="$langCode='chy'">Cheyenne</xsl:when>
<xsl:when test="$langCode='cmc'">Chamic languages</xsl:when>
<xsl:when test="$langCode='cop'">Coptic</xsl:when>
<xsl:when test="$langCode='cor'">Cornish</xsl:when>
<xsl:when test="$langCode='cos'">Corsican</xsl:when>
<xsl:when test="$langCode='cpe'">Creoles and Pidgins, English-based
(Other)</xsl:when>
<xsl:when test="$langCode='cpf'">Creoles and Pidgins, French-based
(Other)</xsl:when>
<xsl:when test="$langCode='cpp'">Creoles and Pidgins, Portuguese-based
(Other)</xsl:when>
<xsl:when test="$langCode='cre'">Cree</xsl:when>
<xsl:when test="$langCode='crh'">Crimean Tatar</xsl:when>
<xsl:when test="$langCode='crp'">Creoles and Pidgins (Other)</xsl:when>
<xsl:when test="$langCode='cus'">Cushitic (Other)</xsl:when>
<xsl:when test="$langCode='cze'">Czech</xsl:when>
<xsl:when test="$langCode='dak'">Dakota</xsl:when>
<xsl:when test="$langCode='dan'">Danish</xsl:when>
<xsl:when test="$langCode='dar'">Dargwa</xsl:when>
<xsl:when test="$langCode='day'">Dayak</xsl:when>
<xsl:when test="$langCode='del'">Delaware</xsl:when>
<xsl:when test="$langCode='den'">Slave</xsl:when>
<xsl:when test="$langCode='dgr'">Dogrib</xsl:when>
<xsl:when test="$langCode='din'">Dinka</xsl:when>
<xsl:when test="$langCode='div'">Divehi</xsl:when>
<xsl:when test="$langCode='doi'">Dogri</xsl:when>
<xsl:when test="$langCode='dra'">Dravidian (Other)</xsl:when>
<xsl:when test="$langCode='dua'">Duala</xsl:when>
<xsl:when test="$langCode='dum'">Dutch, Middle (ca. 1050-1350)</xsl:when>
<xsl:when test="$langCode='dut'">Dutch</xsl:when>
<xsl:when test="$langCode='dyu'">Dyula</xsl:when>
<xsl:when test="$langCode='dzo'">Dzongkha</xsl:when>
<xsl:when test="$langCode='efi'">Efik</xsl:when>
<xsl:when test="$langCode='egy'">Egyptian</xsl:when>
<xsl:when test="$langCode='eka'">Ekajuk</xsl:when>
<xsl:when test="$langCode='elx'">Elamite</xsl:when>
<xsl:when test="$langCode='eng'">English</xsl:when>
<xsl:when test="$langCode='enm'">English, Middle (1100-1500)</xsl:when>
<xsl:when test="$langCode='epo'">Esperanto</xsl:when>
<xsl:when test="$langCode='esk'">Eskimo languages</xsl:when>
<xsl:when test="$langCode='esp'">Esperanto</xsl:when>
<xsl:when test="$langCode='est'">Estonian</xsl:when>
<xsl:when test="$langCode='eth'">Ethiopic</xsl:when>
<xsl:when test="$langCode='ewe'">Ewe</xsl:when>
<xsl:when test="$langCode='ewo'">Ewondo</xsl:when>
<xsl:when test="$langCode='fan'">Fang</xsl:when>
<xsl:when test="$langCode='fao'">Faroese</xsl:when>
<xsl:when test="$langCode='far'">Faroese</xsl:when>
<xsl:when test="$langCode='fat'">Fanti</xsl:when>
<xsl:when test="$langCode='fij'">Fijian</xsl:when>
<xsl:when test="$langCode='fin'">Finnish</xsl:when>
<xsl:when test="$langCode='fiu'">Finno-Ugrian (Other)</xsl:when>
<xsl:when test="$langCode='fon'">Fon</xsl:when>
<xsl:when test="$langCode='fre'">French</xsl:when>
<xsl:when test="$langCode='fri'">Frisian</xsl:when>
<xsl:when test="$langCode='frm'">French, Middle (ca. 1400-1600)</xsl:when>
<xsl:when test="$langCode='fro'">French, Old (ca. 842-1400)</xsl:when>
<xsl:when test="$langCode='fry'">Frisian</xsl:when>
<xsl:when test="$langCode='ful'">Fula</xsl:when>
<xsl:when test="$langCode='fur'">Friulian</xsl:when>
<xsl:when test="$langCode='gaa'">Ga</xsl:when>
<xsl:when test="$langCode='gae'">Scottish Gaelic</xsl:when>
<xsl:when test="$langCode='gag'">Galician</xsl:when>
<xsl:when test="$langCode='gal'">Oromo</xsl:when>
<xsl:when test="$langCode='gay'">Gayo</xsl:when>
<xsl:when test="$langCode='gba'">Gbaya</xsl:when>
<xsl:when test="$langCode='gem'">Germanic (Other)</xsl:when>
<xsl:when test="$langCode='geo'">Georgian</xsl:when>
<xsl:when test="$langCode='ger'">German</xsl:when>
<xsl:when test="$langCode='gez'">Ethiopic</xsl:when>
<xsl:when test="$langCode='gil'">Gilbertese</xsl:when>
<xsl:when test="$langCode='gla'">Scottish Gaelic</xsl:when>
<xsl:when test="$langCode='gle'">Irish</xsl:when>
<xsl:when test="$langCode='glg'">Galician</xsl:when>
<xsl:when test="$langCode='glv'">Manx</xsl:when>
<xsl:when test="$langCode='gmh'">German, Middle High (ca.
1050-1500)</xsl:when>
<xsl:when test="$langCode='goh'">German, Old High (ca. 750-1050)</xsl:when>
<xsl:when test="$langCode='gon'">Gondi</xsl:when>
<xsl:when test="$langCode='gor'">Gorontalo</xsl:when>
<xsl:when test="$langCode='got'">Gothic</xsl:when>
<xsl:when test="$langCode='grb'">Grebo</xsl:when>
<xsl:when test="$langCode='grc'">Greek, Ancient (to 1453)</xsl:when>
<xsl:when test="$langCode='gre'">Greek, Modern (1453- )</xsl:when>