-
Notifications
You must be signed in to change notification settings - Fork 4
/
EAD2002ToEAD3schema.xsl
2320 lines (2140 loc) · 107 KB
/
EAD2002ToEAD3schema.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"
xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs xsi xd xlink"
xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl" xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://ead3.archivists.org/schema/"
version="2.0">
<xd:doc scope="stylesheet">
<xd:desc>
<xd:p><xd:b>Created on:</xd:b> Feb 27, 2012</xd:p>
<xd:p>
<xd:b>Last Updated: 2016-06</xd:b>
</xd:p>
<xd:p><xd:b>Authors:</xd:b> Terry Catapano and Mike Rush</xd:p>
<xd:p>Convert EAD2002 instance to EAD3</xd:p>
<xd:p>Forked by Mark Custer for local Excel-to-EAD3 PDF Preview process (2021-03-30). Although I could just switch some parameters, most likely, I'm forking in case I need to make any other small tweaks during this process rather than add another transformation in the mix.</xd:p>
<xd:p>...and still holding off on adding EAD3 as an export option for the Excel process until ASpace or AtoM have an EAD3 import process.</xd:p>
<xd:pre>
<!--
Creative Commons Legal Code
CC0 1.0 Universal
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER.
Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer exclusive Copyright and Related Rights (defined below) upon the creator and subsequent owner(s) (each and all, an "owner") of an original work of authorship and/or a database (each, a "Work").
Certain owners wish to permanently relinquish those rights to a Work for the purpose of contributing to a commons of creative, cultural and scientific works ("Commons") that the public can reliably and without fear of later claims of infringement build upon, modify, incorporate in other works, reuse and redistribute as freely as possible in any form whatsoever and for any purposes, including without limitation commercial purposes. These owners may contribute to the Commons to promote the ideal of a free culture and the further production of creative, cultural and scientific works, or to gain reputation or greater distribution for their Work in part through the use and efforts of others.
For these and/or other purposes and motivations, and without any expectation of additional consideration or compensation, the person associating CC0 with a Work (the "Affirmer"), to the extent that he or she is an owner of Copyright and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and publicly distribute the Work under its terms, with knowledge of his or her Copyright and Related Rights in the Work and the meaning and intended legal effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be protected by copyright and related or neighboring rights ("Copyright and Related Rights"). Copyright and Related Rights include, but are not limited to, the following:
the right to reproduce, adapt, distribute, perform, display, communicate, and translate a Work;
moral rights retained by the original author(s) and/or performer(s);
publicity and privacy rights pertaining to a person's image or likeness depicted in a Work;
rights protecting against unfair competition in regards to a Work, subject to the limitations in paragraph 4(a), below;
rights protecting the extraction, dissemination, use and reuse of data in a Work;
database rights (such as those arising under Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, and under any national implementation thereof, including any amended or successor version of such directive); and
other similar, equivalent or corresponding rights throughout the world based on applicable law or treaty, and any national implementations thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention of, applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and unconditionally waives, abandons, and surrenders all of Affirmer's Copyright and Related Rights and associated claims and causes of action, whether now known or unknown (including existing as well as future claims and causes of action), in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each member of the public at large and to the detriment of Affirmer's heirs and successors, fully intending that such Waiver shall not be subject to revocation, rescission, cancellation, termination, or any other legal or equitable action to disrupt the quiet enjoyment of the Work by the public as contemplated by Affirmer's express Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason be judged legally invalid or ineffective under applicable law, then the Waiver shall be preserved to the maximum extent permitted taking into account Affirmer's express Statement of Purpose. In addition, to the extent the Waiver is so judged Affirmer hereby grants to each affected person a royalty-free, non transferable, non sublicensable, non exclusive, irrevocable and unconditional license to exercise Affirmer's Copyright and Related Rights in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "License"). The License shall be deemed effective as of the date CC0 was applied by Affirmer to the Work. Should any part of the License for any reason be judged legally invalid or ineffective under applicable law, such partial invalidity or ineffectiveness shall not invalidate the remainder of the License, and in such case Affirmer hereby affirms that he or she will not (i) exercise any of his or her remaining Copyright and Related Rights in the Work or (ii) assert any associated claims and causes of action with respect to the Work, in either case contrary to Affirmer's express Statement of Purpose.
4. Limitations and Disclaimers.
No trademark or patent rights held by Affirmer are waived, abandoned, surrendered, licensed or otherwise affected by this document.
Affirmer offers the Work as-is and makes no representations or warranties of any kind concerning the Work, express, implied, statutory or otherwise, including without limitation warranties of title, merchantability, fitness for a particular purpose, non infringement, or the absence of latent or other defects, accuracy, or the present or absence of errors, whether or not discoverable, all to the greatest extent permissible under applicable law.
Affirmer disclaims responsibility for clearing rights of other persons that may apply to the Work or any use thereof, including without limitation any person's Copyright and Related Rights in the Work. Further, Affirmer disclaims responsibility for obtaining any necessary consents, permissions or other rights required for any use of the Work.
Affirmer understands and acknowledges that Creative Commons is not a party to this document and has no duty or obligation with respect to this CC0 or use of the Work.
-->
</xd:pre>
</xd:desc>
</xd:doc>
<xsl:output encoding="UTF-8" indent="yes" method="xml"/>
<!-- ############################################### -->
<!-- TOP LEVEL PARAMETERS -->
<!-- ############################################### -->
<!-- user parameter to control validation schema of output -->
<xsl:param name="outputValidation">
<xsl:value-of select="'rng'"/>
<!--<xsl:value-of select="'xsd'"/>-->
</xsl:param>
<!-- user parameter to control deprecation -->
<xsl:param name="outputUndeprecatedEAD3" select="false()"/>
<!-- user parameter to control migration comments -->
<xsl:param name="addMigrationComments" select="false()"/>
<!-- user parameter to control migration messages -->
<xsl:param name="addMigrationMessages" select="false()"/>
<!-- user parameter to specify path to schema -->
<xsl:param name="schemaPath">
<xsl:value-of select="'../../'"/>
</xsl:param>
<!-- user parameter to specify the schema filename -->
<xsl:param name="schemaName">
<xsl:choose>
<xsl:when test="$outputValidation='rng'">
<xsl:choose>
<xsl:when test="$outputUndeprecatedEAD3 = false()">
<xsl:value-of select="'ead3.rng'"/>
</xsl:when>
<xsl:when test="$outputUndeprecatedEAD3 = true()">
<xsl:value-of select="'ead3_undeprecated.rng'"/>
</xsl:when>
</xsl:choose>
</xsl:when>
<xsl:when test="$outputValidation='xsd'">
<xsl:choose>
<xsl:when test="$outputUndeprecatedEAD3 = false()">
<xsl:value-of select="'ead3.xsd'"/>
</xsl:when>
<xsl:when test="$outputUndeprecatedEAD3 = true()">
<xsl:value-of select="'ead3_undeprecated.xsd'"/>
</xsl:when>
</xsl:choose>
</xsl:when>
<xsl:when test="$outputValidation='dtd'">
<xsl:choose>
<xsl:when test="$outputUndeprecatedEAD3 = false()">
<xsl:value-of select="'ead3.dtd'"/>
</xsl:when>
<xsl:when test="$outputUndeprecatedEAD3 = true()">
<xsl:value-of select="'ead3_undeprecated.dtd'"/>
</xsl:when>
</xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:param>
<!-- user parameter for control/maintenancestatus -->
<!-- maintenancestatus enumeration '[revised, deleted, new,
deletedsplit, deletedmerged, deletedreplaced, cancelled, derived]' -->
<xsl:param name="maintenancestatusValue" select="'revised'"/>
<!-- user parameter for control/publicationstatus -->
<!-- publicationstatus enumeration '[inprocess, approved, published]' -->
<xsl:param name="publicationstatusValue"/>
<!-- user parameter for control/maintenanceagency/agencyname -->
<xsl:param name="agencynameValue"/>
<!-- user parameter for control/maintenancehistory/maintenanceevent/eventtype -->
<!-- eventtype enumeration '[created, revised, deleted, cancelled, derived, updated, unknown]' -->
<xsl:param name="eventtypeValue" select="'updated'"/>
<!-- user parameter for control/maintenancehistory/maintenanceevent/agenttype -->
<!-- agenttype enumeration '[human, machine, unknown]' -->
<xsl:param name="agenttypeValue" select="'machine'"/>
<!-- user parameter for control/maintenancehistory/maintenanceevent/agent -->
<xsl:param name="agent">
<xsl:text>EAD 2002 to EAD3 Migration Style Sheet(EAD2002ToEAD3.xsl)</xsl:text>
</xsl:param>
<!-- user parameter for control/maintenancehistory/maintenanceevent/eventdescription -->
<xsl:param name="eventdescriptionValue">
<xsl:text>EAD 2002 instanace migrated to EAD3 </xsl:text>
<xsl:if test="$outputUndeprecatedEAD3=true()">
<xsl:text>Undeprecated </xsl:text>
</xsl:if>
<xsl:text>(</xsl:text>
<xsl:value-of select="$eadxmlns"/>
<xsl:text>).</xsl:text>
</xsl:param>
<!-- param for EAD3 namespace -->
<xsl:param name="eadxmlns">
<xsl:choose>
<xsl:when test="$outputUndeprecatedEAD3=false()">
<xsl:value-of select="'http://ead3.archivists.org/schema/'"/>
</xsl:when>
<xsl:when test="$outputUndeprecatedEAD3=true()">
<xsl:value-of select="'http://ead3.archivists.org/schema/undeprecated/'"/>
</xsl:when>
</xsl:choose>
</xsl:param>
<!-- create namespace stripped version of input document -->
<xsl:variable name="instance-ns-stripped">
<xsl:apply-templates select="/" mode="strip-ns"/>
</xsl:variable>
<!-- MAIN TEMPLATE: operates on namespace-stripped document -->
<xsl:template match="/">
<xsl:choose>
<xsl:when test="$outputValidation='rng'">
<xsl:processing-instruction name="xml-model">
<xsl:value-of select="concat('href="',$schemaPath,$schemaName,'" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"')"/>
</xsl:processing-instruction>
<xsl:processing-instruction name="oxygen">
<xsl:value-of select="concat('RNGSchema="',$schemaPath,$schemaName,'" type="xml"')"/>
</xsl:processing-instruction>
</xsl:when>
<xsl:when test="$outputValidation='xsd'"/>
<!--<xsl:when test="$outputValidation='dtd'">
<xsl:value-of select=""/>
<xsl:processing-instruction name="DOCTYPE">
<xsl:value-of select="concat('ead PUBLIC "+//ISBN 1-931666-00-8//DTD ',$schemaName, ' (Encoded Archival Description (EAD) Version 3)//EN" "', $schemaPath,$schemaName,'"')"/>
</xsl:processing-instruction>
</xsl:when>-->
</xsl:choose>
<!--<xsl:copy-of select="$instance-ns-stripped"/>
-->
<!--<xsl:apply-templates select="/" mode="strip-ns"/>
-->
<xsl:for-each select="$instance-ns-stripped">
<xsl:apply-templates/>
</xsl:for-each>
</xsl:template>
<!-- ############################################### -->
<!-- IDENTITY TEMPLATE -->
<!-- ############################################### -->
<xsl:template name="copyElement">
<xsl:element name="{local-name()}">
<xsl:apply-templates select="@*"/>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<xsl:template match="element()">
<xsl:call-template name="copyElement"/>
</xsl:template>
<!-- copy attributes, text, comments, and processing instructions -->
<xsl:template match="attribute()|text()|comment()|processing-instruction()">
<xsl:copy/>
</xsl:template>
<!-- Root EAD element -->
<xsl:template match="ead">
<xsl:choose>
<xsl:when test="$outputValidation='dtd'">
<xsl:element name="{local-name()}">
<xsl:apply-templates select="@id, @altrender, @audience, @relatedencoding"/>
<xsl:apply-templates/>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:element name="{local-name()}" namespace="{$eadxmlns}">
<xsl:apply-templates select="@id, @altrender, @audience, @relatedencoding"/>
<xsl:if test="$outputValidation='xsd'">
<xsl:attribute name="schemaLocation" namespace="http://www.w3.org/2001/XMLSchema-instance">
<xsl:value-of select="concat($eadxmlns, ' ', $schemaPath, $schemaName)"/>
</xsl:attribute>
</xsl:if>
<xsl:apply-templates/>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- ############################################### -->
<!-- DEPRECATED ELEMENTS -->
<!-- ############################################### -->
<!-- REMOVE ELEMENT COMPLETELY IF NOT UNDEPRECATED -->
<xsl:template
match="frontmatter | runner | descgrp/blockquote |
descgrp/chronlist | descgp/descgrp | descgrp/head | descgrp/list |
descgrp/p | descgrp/table | descgrp/blockquote |
descgp/descgrp | descgrp/head | descgrp/list | descgrp/p">
<xsl:choose>
<xsl:when test="$outputUndeprecatedEAD3=false()">
<xsl:if test="node()=element()">
<xsl:call-template name="commentAndMessage">
<xsl:with-param name="comment">
<xsl:call-template name="removedElement"/>
</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:when>
<xsl:when test="$outputUndeprecatedEAD3=true()">
<xsl:call-template name="copyElement"/>
</xsl:when>
</xsl:choose>
</xsl:template>
<!-- REMOVE ATTRIBUTE COMPLETELY IF NOT UNDEPRECATED -->
<xsl:template match="@tpattern">
<xsl:choose>
<xsl:when test="$outputUndeprecatedEAD3=false()"/>
<xsl:when test="$outputUndeprecatedEAD3=true()">
<xsl:copy-of select="."/>
</xsl:when>
</xsl:choose>
</xsl:template>
<!-- REMOVE COMPLETELY -->
<xsl:template
match="arc | resource | ead/@xsi:schemaLocation |
custodhist//acqinfo/head | scopecontent//arrangement/head | event/chronlist | event/list |
event/blockquote/chronlist | extref/blockquote/chronlist | extrefloc/blockquote/chronlist |
daodesc/list | extref/list | extrefloc/list | ref/list | refloc/list |
daodesc/chronlist | extref/chronlist | extrefloc/chronlist |
item/chronlist | p/chronlist | ref/chronlist | refloc/chronlist |
item/blockquote/chronlist | p/blockquote/chronlist | ref/blockquote/chronlist | refloc/blockquote/chronlist |
event/blockquote/list | extref/blockquote/list | extrefloc/blockquote/list | item/blockquote/list |
p/blockquote/list | ref/blockquote/list | refloc/blockquote/list |
event/blockquote/table | extref/blockquote/table | extrefloc/blockquote/table |
item/blockquote/table | p/blockquote/table | ref/blockquote/table | refloc/blockquote/table |
daodesc/table | event/table | extref/table | extrefloc/table |
item/table | p/table | ref/table | refloc/table |
notestmt/note/@actuate | notestmt/note/@show | notestmt/note/@label |
did/note/@actuate | did/note/@show |
did/note[(p[2] | p[title | persname | corpname | famname | name | geogname | genreform | subject | function | occupation | date | unitdate | blockqoute | chronlist | list | num | table] | child::*[local-name()!=p])]/@label | namegrp/note |
chronitem/date/@calendar | chronitem/date/@era |
chronitem/date/@certainty | chronitem/date/@encodinganalog |
physdesc/@source | physdesc/@rules |
archref/dao[not(ancestor::scopecontent)][not(ancestor::bioghist)][not(ancestor::odd)] |
archref/daogrp[not(ancestor::scopecontent)][not(ancestor::bioghist)][not(ancestor::odd)]">
<xsl:if test="node()=element()">
<xsl:call-template name="commentAndMessage">
<xsl:with-param name="comment">
<xsl:call-template name="removedElement"/>
</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:template>
<!-- REMOVE dsc//dsc -->
<xsl:template match="dsc[ancestor::dsc]">
<xsl:call-template name="commentAndMessage">
<xsl:with-param name="comment">
<xsl:call-template name="removedElement"/>
<xsl:text> Forward migration of dsc elements within other dsc elements is too complex for this style sheet. Revise the source to remove dsc elements with an ancestor dsc element before migrating to EAD3.</xsl:text>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<!-- SKIP ELEMENT OR ATTRIBUTE IF NOT UNDEPRECATED-->
<xsl:template match="descgrp | dimensions | physfacet | extent | bibseries | imprint">
<xsl:choose>
<xsl:when test="$outputUndeprecatedEAD3=false()">
<xsl:call-template name="commentAndMessage">
<xsl:with-param name="comment">
<xsl:call-template name="removedElement"/>
</xsl:with-param>
</xsl:call-template>
<xsl:apply-templates/>
</xsl:when>
<xsl:when test="$outputUndeprecatedEAD3=true()">
<xsl:call-template name="copyElement"/>
</xsl:when>
</xsl:choose>
</xsl:template>
<!-- SKIP ELEMENT OR ATTRIBUTE -->
<xsl:template
match="titleproper/date | titleproper/num |
archref/abstract | archref/container |
archref/langmaterial | archref/materialspec |
archref/origination | archref/physdesc |
archref/physloc | archref/repository |
archref/unitid |
bibref/archref | bibref/edition |
subtitle/date | subtitle/num |
corpname/subarea |
item/repository |
custodhist//acqinfo | scopecontent//arrangement |
materialspec/num | materialspec/materialspec |
entry/origination | entry/repository |
event/origination | event/repository |
extref/origination | extref/repository |
extrefloc/origination | extrefloc/repository |
item/origination | item/repository |
label/corpname | label/date |
label/famname | label/function |
label/genreform | label/geogname |
label/name | label/num |
label/occupation | label/origination |
label/persname | label/repository |
label/subject |
label/unitdate |
archref/unitdate/title |
entry/unitdate/title |
event/unitdate/title |
extref/unitdate/title |
extrefloc/unitdate/title |
item/unitdate/title |
p/unitdate/title |
ref/unitdate/title |
refloc/unitdate/title |
p/origination | p/repository |
ref/origination | ref/origination |
refloc/origination | refloc/origination |
unittitle[parent::* except (//did)] |
langusage | language[parent::langusage] |
language[parent::langmaterial] |
physdesc/date | physdesc/corpname |
physdesc/famname | physdesc/function |
physdesc/genreform | physdesc/geogname |
physdesc/name | physdesc/occupation |
physdesc/persname | physdesc/subject |
title/date | title/num |
descrules |
unittitle/edition | did/note[not(p[2])][not(*[local-name()!='p'])][not(p[title | persname | corpname | famname | name | geogname | genreform | subject | function | occupation | date | unitdate | blockqoute | chronlist | list | num | table])]/p |
event/blockquote/p | extref/blockquote/p | extrefloc/blockquote/p |
item/blockquote/p | p/blockquote/p | ref/blockquote/p | refloc/blockquote/p">
<xsl:if test="node()=element()">
<xsl:call-template name="commentAndMessage">
<xsl:with-param name="comment">
<xsl:call-template name="removedElement"/>
</xsl:with-param>
</xsl:call-template>
</xsl:if>
<xsl:apply-templates/>
</xsl:template>
<!-- archref and bibref -->
<xsl:template
match="archref[not(parent::separatedmaterial)][not(parent::relatedmaterial)][not(parent::otherfindaid)][not(parent::bibliography)][not(parent::bibref)]">
<xsl:call-template name="commentAndMessage">
<xsl:with-param name="comment">
<xsl:text>ELEMENT archref CONVERTED TO ref</xsl:text>
</xsl:with-param>
</xsl:call-template>
<ref>
<xsl:apply-templates select="@*"/>
<xsl:apply-templates/>
</ref>
</xsl:template>
<xsl:template
match="bibref[not(parent::separatedmaterial)][not(parent::relatedmaterial)][not(parent::otherfindaid)][not(parent::bibliography)]">
<ref>
<xsl:apply-templates select="@*"/>
<xsl:call-template name="commentAndMessage">
<xsl:with-param name="comment">
<xsl:text>ELEMENT bibref CONVERTED TO ref</xsl:text>
</xsl:with-param>
</xsl:call-template>
<xsl:apply-templates/>
</ref>
</xsl:template>
<xsl:template match="archref[not(parent::bibref)][parent::bibliography or parent::otherfindaid or parent::relatedmaterial or parent::separatedmaterial] |
bibref[parent::bibliography or parent::otherfindaid or parent::relatedmaterial or parent::separatedmaterial]">
<xsl:element name="{local-name()}">
<xsl:apply-templates
select="@* except(@actuate, @arcrole, @href, @role, @show, @title, @xpointer)"/>
<xsl:choose>
<xsl:when test="@actuate | @arcrole | @href | @role | @show | @title | @xpointer">
<xsl:call-template name="commentAndMessage">
<xsl:with-param name="comment">
<xsl:text>LINKING ATTRIBUTES REMOVED FROM ELEMENT </xsl:text>
<xsl:value-of select="local-name()"/>
<xsl:text> AND SHIFTED TO CHILD ref ELEMENT</xsl:text>
</xsl:with-param>
</xsl:call-template>
<ref>
<xsl:apply-templates
select="@actuate, @arcrole, @href, @role, @show, @title, @xpointer"/>
<xsl:apply-templates/>
</ref>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</xsl:element>
</xsl:template>
<!-- ############################################### -->
<!-- type attributes -->
<!-- ############################################### -->
<xsl:template match="dsc/@type">
<xsl:attribute name="{parent::*/local-name()}type">
<xsl:choose>
<xsl:when test="string(.)='othertype'">
<xsl:value-of select="'otherdsctype'"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="string(.)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:template>
<xsl:template match="unitdate/@type">
<xsl:attribute name="{parent::*/local-name()}type" select="string(.)"/>
</xsl:template>
<xsl:template match="dsc/@othertype">
<xsl:attribute name="otherdsctype" select="string(.)"/>
</xsl:template>
<!-- ############################################### -->
<!-- EADHEADER to CONTROL -->
<!-- ############################################### -->
<xsl:template match="eadheader">
<xsl:call-template name="commentAndMessage">
<xsl:with-param name="comment">
<xsl:text>ELEMENT eadheader REPLACED WITH control</xsl:text>
</xsl:with-param>
</xsl:call-template>
<control>
<xsl:apply-templates select="@*[not(local-name()='findaidstatus')]"/>
<xsl:apply-templates select="eadid"/>
<xsl:apply-templates select="filedesc"/>
<xsl:call-template name="commentAndMessage">
<xsl:with-param name="comment">
<xsl:text>ELEMENT maintenancestatus ADDED</xsl:text>
</xsl:with-param>
</xsl:call-template>
<maintenancestatus value="{$maintenancestatusValue}"/>
<xsl:if test="normalize-space($publicationstatusValue)">
<xsl:call-template name="commentAndMessage">
<xsl:with-param name="comment">
<xsl:text>ELEMENT publicationstatus ADDED</xsl:text>
</xsl:with-param>
</xsl:call-template>
<publicationstatus value="{$publicationstatusValue}"/>
</xsl:if>
<xsl:call-template name="commentAndMessage">
<xsl:with-param name="comment">
<xsl:text>ELEMENT maintenanceagency ADDED</xsl:text>
</xsl:with-param>
</xsl:call-template>
<maintenanceagency>
<xsl:if test="eadid/@countrycode">
<xsl:apply-templates select="eadid/@countrycode"/>
<xsl:call-template name="commentAndMessage">
<xsl:with-param name="comment">
<xsl:text>ATTRIBUTE eadid/@countrycode REPLACED WITH maintenanceagency/@countrycode</xsl:text>
</xsl:with-param>
</xsl:call-template>
</xsl:if>
<xsl:if test="eadid/@mainagencycode">
<xsl:call-template name="commentAndMessage">
<xsl:with-param name="comment">
<xsl:text>ATTRIBUTE eadid/@mainagencycode REPLACED WITH ELEMENT maintenanceagency/agencycode</xsl:text>
</xsl:with-param>
</xsl:call-template>
<agencycode>
<xsl:value-of select="eadid/@mainagencycode"/>
</agencycode>
</xsl:if>
<xsl:call-template name="commentAndMessage">
<xsl:with-param name="comment">
<xsl:text>ELEMENT agencyname ADDED</xsl:text>
</xsl:with-param>
</xsl:call-template>
<agencyname>
<xsl:choose>
<xsl:when test="normalize-space($agencynameValue)">
<xsl:value-of select="$agencynameValue"/>
</xsl:when>
<xsl:when test="filedesc/publicationstmt/publisher">
<xsl:for-each select="filedesc/publicationstmt/publisher">
<xsl:value-of select="normalize-space(.)"/>
<xsl:if test="position()!=last()">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:text>[Agency Name]</xsl:text>
</xsl:otherwise>
</xsl:choose>
</agencyname>
</maintenanceagency>
<xsl:call-template name="languagedeclaration"/>
<xsl:call-template name="descrules"/>
<xsl:if test="@findaidstatus">
<xsl:call-template name="commentAndMessage">
<xsl:with-param name="comment">
<xsl:text>ATTRIBUTE eadheader/@findaidstatus REPLACED WITH ELEMENT localcontrol/term</xsl:text>
</xsl:with-param>
</xsl:call-template>
<localcontrol localtype="findaidstatus">
<term>
<xsl:value-of select="@findaidstatus"/>
</term>
</localcontrol>
</xsl:if>
<xsl:call-template name="commentAndMessage">
<xsl:with-param name="comment">
<xsl:text>ELEMENT maintenancehistory ADDED</xsl:text>
</xsl:with-param>
</xsl:call-template>
<maintenancehistory>
<xsl:copy-of select="revisiondesc/@*"/>
<xsl:call-template name="commentAndMessage">
<xsl:with-param name="comment">
<xsl:text>ELEMENT maintenanceevent ADDED FOR THE EVENT OF MIGRATION TO EAD3</xsl:text>
</xsl:with-param>
</xsl:call-template>
<maintenanceevent>
<eventtype value="{$eventtypeValue}"/>
<eventdatetime standarddatetime="{current-dateTime()}">
<xsl:value-of select="current-dateTime()"/>
</eventdatetime>
<agenttype value="{$agenttypeValue}"/>
<agent>
<xsl:value-of select="$agent"/>
</agent>
<eventdescription>
<xsl:value-of select="$eventdescriptionValue"/>
</eventdescription>
</maintenanceevent>
<xsl:if test="profiledesc/creation">
<xsl:call-template name="commentAndMessage">
<xsl:with-param name="comment">
<xsl:text>ELEMENT creation REPLACED WITH maintenanceevent</xsl:text>
</xsl:with-param>
</xsl:call-template>
<maintenanceevent>
<xsl:copy-of select="profiledesc/creation/@*"/>
<eventtype value="created"/>
<eventdatetime>
<xsl:choose>
<xsl:when
test="profiledesc/creation/date and not(profiledesc/creation/date[2])">
<xsl:copy-of
select="profiledesc/creation/date/@*[not(local-name()='calendar') and not(local-name()='era') and not(local-name()='certainty') and not(local-name()='type') and not(local-name()='normal')]"/>
<xsl:if
test="normalize-space(profiledesc/creation/date/@normal)">
<xsl:attribute name="standarddatetime">
<xsl:choose>
<xsl:when test="contains(profiledesc/creation/date/@normal,'/')">
<xsl:call-template name="fixNormalDate">
<xsl:with-param name="normalValue">
<xsl:value-of select="substring-after(profiledesc/creation/date/@normal,'/')"/>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="fixNormalDate">
<xsl:with-param name="normalValue">
<xsl:value-of select="profiledesc/creation/date/@normal"/>
</xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:if>
<xsl:value-of select="profiledesc/creation/date"/>
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</eventdatetime>
<agenttype value="unknown"/>
<agent/>
<eventdescription>
<xsl:value-of select="profiledesc/creation"/>
</eventdescription>
</maintenanceevent>
</xsl:if>
<xsl:for-each select="revisiondesc/change">
<xsl:call-template name="commentAndMessage">
<xsl:with-param name="comment">
<xsl:text>ELEMENT change REPLACED WITH maintenanceevent</xsl:text>
</xsl:with-param>
</xsl:call-template>
<maintenanceevent>
<xsl:copy-of select="@*"/>
<eventtype value="unknown"/>
<eventdatetime>
<xsl:copy-of
select="date/@*[not(local-name()='calendar') and not(local-name()='era') and not(local-name()='certainty') and not(local-name()='type') and not(local-name()='normal')]"/>
<xsl:if
test="normalize-space(date/@normal)">
<xsl:attribute name="standarddatetime">
<xsl:choose>
<xsl:when test="contains(date/@normal,'/')">
<xsl:call-template name="fixNormalDate">
<xsl:with-param name="normalValue">
<xsl:value-of select="substring-after(date/@normal,'/')"/>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="fixNormalDate">
<xsl:with-param name="normalValue">
<xsl:value-of select="date/@normal"/>
</xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:if>
<xsl:value-of select="date"/>
</eventdatetime>
<agenttype value="unknown"/>
<agent/>
<eventdescription>
<xsl:copy-of select="item/@*"/>
<xsl:value-of select="item"/>
</eventdescription>
</maintenanceevent>
</xsl:for-each>
<xsl:for-each select="revisiondesc/list/item">
<xsl:call-template name="commentAndMessage">
<xsl:with-param name="comment">
<xsl:text>ELEMENT revisiondesc/list/item REPLACED WITH maintenanceevent</xsl:text>
</xsl:with-param>
</xsl:call-template>
<maintenanceevent>
<xsl:copy-of select="@*"/>
<eventtype value="unknown"/>
<eventdatetime/>
<agenttype value="unknown"/>
<agent/>
<eventdescription>
<xsl:value-of select="."/>
</eventdescription>
</maintenanceevent>
</xsl:for-each>
<xsl:for-each select="revisiondesc/list/defitem">
<xsl:call-template name="commentAndMessage">
<xsl:with-param name="comment">
<xsl:text>ELEMENT revisiondesc/list/defitem REPLACED WITH maintenanceevent</xsl:text>
</xsl:with-param>
</xsl:call-template>
<maintenanceevent>
<xsl:copy-of select="@*"/>
<eventtype value="unknown"/>
<eventdatetime/>
<agenttype value="unknown"/>
<agent/>
<eventdescription>
<xsl:copy-of select="item/@*"/>
<xsl:value-of select="label"/>
<xsl:text>: </xsl:text>
<xsl:value-of select="item"/>
</eventdescription>
</maintenanceevent>
</xsl:for-each>
</maintenancehistory>
</control>
</xsl:template>
<xsl:template match="@countrycode">
<xsl:attribute name="{local-name()}" select="upper-case(.)"/>
</xsl:template>
<xsl:template name="fixNormalDate">
<xsl:param name="normalValue"/>
<xsl:choose>
<xsl:when test="string-length($normalValue)>4 and not(contains($normalValue,'-'))">
<xsl:choose>
<xsl:when test="string-length($normalValue)=6">
<xsl:value-of select="concat(substring($normalValue,1,4),'-',substring($normalValue,5,2))"/>
</xsl:when>
<xsl:when test="string-length($normalValue)=8">
<xsl:value-of select="concat(substring($normalValue,1,4),'-',substring($normalValue,5,2),'-',substring($normalValue,7,2))"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$normalValue"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$normalValue"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="fixNormalDateRange">
<xsl:param name="normalRangeValue"/>
<xsl:variable name="normalRangeValueBegin">
<xsl:call-template name="fixNormalDate">
<xsl:with-param name="normalValue">
<xsl:value-of select="substring-before($normalRangeValue,'/')"/>
</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="normalRangeValueEnd">
<xsl:call-template name="fixNormalDate">
<xsl:with-param name="normalValue">
<xsl:value-of select="substring-after($normalRangeValue,'/')"/>
</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="concat($normalRangeValueBegin,'/',$normalRangeValueEnd)"/>
</xsl:template>
<xsl:template match="@countryencoding | @dateencoding | @langencoding | @repositoryencoding | @scriptencoding">
<xsl:attribute name="{local-name()}" select="lower-case(.)"/>
</xsl:template>
<xsl:template match="eadid">
<xsl:call-template name="commentAndMessage">
<xsl:with-param name="comment">
<xsl:text>ELEMENT eadid REPLACED WITH recordid</xsl:text>
</xsl:with-param>
</xsl:call-template>
<recordid>
<xsl:if test="@encodinganalog">
<xsl:copy-of select="@encodinganalog"/>
</xsl:if>
<xsl:value-of select="."/>
</recordid>
<xsl:if test="@publicid">
<xsl:call-template name="commentAndMessage">
<xsl:with-param name="comment">
<xsl:text>ATTRIBUTE eadid/@publicid REPLACED WITH otherrecordid</xsl:text>
</xsl:with-param>
</xsl:call-template>
<otherrecordid localtype="publicid">
<xsl:value-of select="@publicid"/>
</otherrecordid>
</xsl:if>
<xsl:if test="@identifier">
<xsl:call-template name="commentAndMessage">
<xsl:with-param name="comment">
<xsl:text>ATTRIBUTE eadid/@identifier REPLACED WITH otherrecordid</xsl:text>
</xsl:with-param>
</xsl:call-template>
<otherrecordid localtype="identifier">
<xsl:value-of select="@identifier"/>
</otherrecordid>
</xsl:if>
<xsl:if test="@url">
<xsl:call-template name="commentAndMessage">
<xsl:with-param name="comment">
<xsl:text>ATTRIBUTE eadid/@url REPLACED WITH otherrecordid</xsl:text>
</xsl:with-param>
</xsl:call-template>
<otherrecordid localtype="url">
<xsl:value-of select="@url"/>
</otherrecordid>
</xsl:if>
<xsl:if test="@urn">
<xsl:call-template name="commentAndMessage">
<xsl:with-param name="comment">
<xsl:text>ATTRIBUTE eadid/@urn REPLACED WITH otherrecordid</xsl:text>
</xsl:with-param>
</xsl:call-template>
<otherrecordid localtype="urn">
<xsl:value-of select="@urn"/>
</otherrecordid>
</xsl:if>
</xsl:template>
<!-- langusage -->
<xsl:template name="languagedeclaration">
<xsl:variable name="langusage">
<xsl:apply-templates select="profiledesc/langusage"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="profiledesc/langusage/language">
<xsl:for-each select="profiledesc/langusage/language">
<xsl:variable name="scriptcodeValueUpdated">
<xsl:call-template name="scriptcodeValueUpdate">
<xsl:with-param name="scriptcodeValue" select="@scriptcode"/>
</xsl:call-template>
</xsl:variable>
<xsl:call-template name="commentAndMessage">
<xsl:with-param name="comment">
<xsl:text>ELEMENT langusage REPLACED WITH languagedeclaration</xsl:text>
</xsl:with-param>
</xsl:call-template>
<languagedeclaration>
<xsl:choose>
<xsl:when test="../language[2]">
<xsl:apply-templates
select="/ead//langusage/@*[not(local-name()='id')]"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="/ead//langusage/@*"/>
</xsl:otherwise>
</xsl:choose>
<language>
<xsl:apply-templates select="@* except @scriptcode"/>
<xsl:value-of select="."/>
</language>
<script>
<xsl:if test="normalize-space($scriptcodeValueUpdated)">
<xsl:attribute name="scriptcode">
<xsl:value-of select="$scriptcodeValueUpdated"/>
</xsl:attribute>
</xsl:if>
<xsl:call-template name="commentAndMessage">
<xsl:with-param name="comment">
<xsl:text>SCRIPT NAME NEEDED</xsl:text>
</xsl:with-param>
</xsl:call-template>
</script>
<descriptivenote>
<p>
<xsl:copy-of select="$langusage"/>
</p>
</descriptivenote>
</languagedeclaration>
</xsl:for-each>
</xsl:when>
<xsl:when test="profiledesc/langusage[not(language)]">
<xsl:call-template name="commentAndMessage">
<xsl:with-param name="comment">
<xsl:text>ELEMENT langusage REPLACED WITH languagedeclaration</xsl:text>
</xsl:with-param>
</xsl:call-template>
<languagedeclaration>
<xsl:apply-templates select="/ead//langusage/@*"/>
<language/>
<script/>
<descriptivenote>
<p>
<xsl:apply-templates select="profiledesc/langusage"/>
</p>
</descriptivenote>
</languagedeclaration>
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:template>
<!-- descrules -->
<xsl:template name="descrules">
<xsl:variable name="descrules">
<xsl:apply-templates select="profiledesc/descrules"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="profiledesc/descrules/title">
<xsl:for-each select="profiledesc/descrules/title">
<xsl:call-template name="commentAndMessage">
<xsl:with-param name="comment">
<xsl:text>ELEMENT descrules REPLACED WITH conventiondeclaration</xsl:text>
</xsl:with-param>
</xsl:call-template>
<conventiondeclaration>
<xsl:choose>
<xsl:when test="../title[2]">
<xsl:apply-templates
select="/ead//descrules/@*[not(local-name()='id')]"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="/ead//descrules/@*"/>
</xsl:otherwise>
</xsl:choose>
<citation>
<xsl:value-of select="."/>
</citation>
<descriptivenote>
<p>
<xsl:copy-of select="$descrules"/>
</p>
</descriptivenote>
</conventiondeclaration>
</xsl:for-each>
</xsl:when>
<xsl:when test="profiledesc/descrules[not(title)]">
<xsl:call-template name="commentAndMessage">
<xsl:with-param name="comment">
<xsl:text>ELEMENT descrules REPLACED WITH conventiondeclaration</xsl:text>
</xsl:with-param>
</xsl:call-template>
<conventiondeclaration>
<xsl:apply-templates select="/ead//descrules/@*"/>
<citation/>
<descriptivenote>
<p>
<xsl:copy-of select="$descrules"/>
</p>
</descriptivenote>
</conventiondeclaration>
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:template>
<!-- blockquote -->
<xsl:template match="blockquote">
<xsl:choose>
<xsl:when
test="parent::event | parent::extref | parent::extrefloc |
parent::item | parent::p | parent::ref | parent::refloc">
<xsl:call-template name="commentAndMessage">
<xsl:with-param name="comment">
<xsl:text>ELEMENT blockquote CONVERTED TO quote</xsl:text>
</xsl:with-param>
</xsl:call-template>
<xsl:element name="quote">
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="copyElement"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- ############################################### -->
<!-- CHRONLIST -->