-
Notifications
You must be signed in to change notification settings - Fork 3
/
DSC-to-Excel.xsl
3428 lines (3355 loc) · 142 KB
/
DSC-to-Excel.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"
xmlns:math="http://www.w3.org/2005/xpath-functions/math"
xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl" xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:mdc="http://mdc" xmlns="urn:isbn:1-931666-22-9" xmlns:ead="urn:isbn:1-931666-22-9"
exclude-result-prefixes="xs math xd xlink mdc ead html" version="2.0">
<xd:doc scope="stylesheet">
<xd:desc>
<xd:p><xd:b>Created on:</xd:b> Aug 16, 2014</xd:p>
<xd:p><xd:b>Significantly revised on:</xd:b> August 2, 2015</xd:p>
<xd:p><xd:b>Updated on:</xd:b> August 18, 2020</xd:p>
<xd:p><xd:b>Author:</xd:b> Mark Custer</xd:p>
<xd:p>tested with Saxon-HE 9.6.0.5</xd:p>
</xd:desc>
</xd:doc>
<xsl:output method="xml" encoding="UTF-8"/>
<xsl:strip-space elements="*"/>
<!--
to do:
should I add ss:Hidden="1" to level-0 rows? If so, they won't show up immediately in view
but they will be grouped with their parents when sorted.
-->
<xsl:variable name="ead-copy-filename"
select="
if (ead:ead/ead:eadheader/ead:eadid[1]/normalize-space())
then
concat(ead:ead/ead:eadheader/ead:eadid[1], '.xml')
else
''"/>
<xsl:param name="remove-AT-database-unitIDs" select="true()" as="xs:boolean"/>
<xsl:param name="convert-odd-to-scopecontent" select="true()" as="xs:boolean"/>
<xsl:template match="/">
<!-- storing a copy of the entire XML file so that it can be used later to re-create the collection-level information for roundtripping.
also could use it to merge any unsupported features like bibliographies, links, etc., as long as @id attributes are present, but haven't dived that deep yet.-->
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="ead:ead">
<!-- the "Excel-template" template does most of the work (and since it's so large, it's been pushed down to the end of this file);
it also calls the archdesc/dsc section in order to create the primary worksheet for the container list-->
<xsl:call-template name="Excel-Template"/>
</xsl:template>
<xsl:template match=" ead:c | ead:c01 | ead:c02 | ead:c03 | ead:c04 | ead:c05 | ead:c06 | ead:c07 | ead:c08 | ead:c09
| ead:c10 | ead:c11 | ead:c12" name="level-0">
<xsl:param name="level-0" select="false()"/>
<xsl:param name="current-position" select="1" as="xs:integer"/>
<xsl:param name="scope-count" select="0" as="xs:integer"/>
<!-- only used if convert-odd-to-scopecontent is true, but doesn't hurt to calculate -->
<xsl:variable name="get-scope-count" select="count(ead:scopecontent)"/>
<!--
the following could be used if you want to limit the repeating fields to just
unidates (not bulk)
container groups
dao elements
structured physdesc elements
if so, you'll need to replace a number of
[position() eq $current-position] filters
with for-each loops
<xsl:variable name="depth-to-recurse" as="xs:integer">
<xsl:sequence
select="
if ($level-0 eq false())
then
max(
(count(ead:did/ead:unitdate[not(@type = 'bulk')])
,
count(ead:did/ead:container[@id][not(@parent)])
,
count(ead:did/ead:dao)
,
count(ead:did/ead:physdesc/ead:extent[1]/matches(., '^\d'))
)
)
else 1"/>
</xsl:variable>
-->
<xsl:variable name="did-items" as="item()*">
<xsl:choose>
<xsl:when test="$remove-AT-database-unitIDs eq true()">
<xsl:sequence select="ead:did/*[normalize-space()][not(self::ead:container)][not(self::ead:unitdate[@type='bulk'])][not(self::ead:physdesc[ead:extent[1]/matches(., '^\d')])][local-name() = following-sibling::*[normalize-space()][not(contains(@type, 'Database::'))]/local-name()]/local-name()"/>
</xsl:when>
<xsl:otherwise>
<xsl:sequence select="ead:did/*[normalize-space()][not(self::ead:container)][not(self::ead:unitdate[@type='bulk'])][not(self::ead:physdesc[ead:extent[1]/matches(., '^\d')])][local-name() = following-sibling::*[normalize-space()]/local-name()]/local-name()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="non-did-items" as="item()*">
<xsl:choose>
<!-- need to treat 'odd' as 'scopecontent' when 'convert-odd-to-scopecontent' param is set. hmmm.
e.g. scopecontent + odd = 2, not 1, 1.
-->
<xsl:when test="$convert-odd-to-scopecontent">
<xsl:sequence select="ead:*[normalize-space()][not(local-name() = ('c', 'c01', 'c02', 'c03', 'c04', 'c05', 'c06', 'c07', 'c08', 'c09', 'c10', 'c11', 'c12'))][replace(local-name(), 'odd', 'scopecontent') = following-sibling::*[normalize-space()]/replace(local-name(), 'odd', 'scopecontent')]/replace(local-name(), 'odd', 'scopecontent')"/>
</xsl:when>
<xsl:otherwise>
<xsl:sequence select="ead:*[normalize-space()][not(local-name() = ('c', 'c01', 'c02', 'c03', 'c04', 'c05', 'c06', 'c07', 'c08', 'c09', 'c10', 'c11', 'c12'))][local-name() = following-sibling::*[normalize-space()]/local-name()]/local-name()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="depths" as="item()*">
<xsl:sequence select="
(
for $x
in distinct-values($did-items)
return count(index-of($did-items, $x))
, for $y
in distinct-values($non-did-items)
return count(index-of($non-did-items, $y))
, count(ead:did/ead:container[@id][position() gt 1][not(@parent)])
, count(ead:did/ead:physdesc[position() gt 1]/ead:extent[1]/matches(., '^\d'))
)
"/>
</xsl:variable>
<xsl:variable name="depth-to-recurse" select="max($depths)" as="xs:integer"/>
<Row ss:Height="30" xmlns="urn:schemas-microsoft-com:office:spreadsheet">
<xsl:if test="$level-0 eq true()">
<xsl:attribute name="StyleID"
namespace="urn:schemas-microsoft-com:office:spreadsheet">
<xsl:text>s1</xsl:text>
</xsl:attribute>
</xsl:if>
<!--this assumes that the YYYY-MM format will be used,
not YYYYMM.
also, if dateTimes are used, I could use those functions.-->
<xsl:variable name="beginDates"
select="
if (ead:did/ead:unitdate[not(@type = 'bulk')][position() eq $current-position]/contains(@normal, '/'))
then
tokenize(ead:did/ead:unitdate[not(@type = 'bulk')][position() eq $current-position]/substring-before(@normal, '/'), '-')
else
tokenize(ead:did/ead:unitdate[not(@type = 'bulk')][position() eq $current-position]/@normal, '-')"/>
<xsl:variable name="endDates"
select="tokenize(ead:did/ead:unitdate[not(@type = 'bulk')][position() eq $current-position]/substring-after(@normal, '/'), '-')"/>
<xsl:variable name="bulkBeginDates"
select="
if (ead:did/ead:unitdate[@type = 'bulk'][position() eq $current-position]/contains(@normal, '/'))
then
tokenize(ead:did/ead:unitdate[@type = 'bulk'][position() eq $current-position]/substring-before(@normal, '/'), '-')
else
tokenize(ead:did/ead:unitdate[@type = 'bulk'][position() eq $current-position]/@normal, '-')"/>
<xsl:variable name="bulkEndDates"
select="tokenize(ead:did/ead:unitdate[@type = 'bulk'][position() eq $current-position]/substring-after(@normal, '/'), '-')"/>
<xsl:variable name="begin-year" select="$beginDates[1]"/>
<xsl:variable name="begin-month" select="$beginDates[2]"/>
<xsl:variable name="begin-day" select="$beginDates[3]"/>
<xsl:variable name="end-year" select="$endDates[1]"/>
<xsl:variable name="end-month" select="$endDates[2]"/>
<xsl:variable name="end-day" select="$endDates[3]"/>
<xsl:variable name="bulk-begin-year" select="$bulkBeginDates[1]"/>
<xsl:variable name="bulk-begin-month" select="$bulkBeginDates[2]"/>
<xsl:variable name="bulk-begin-day" select="$bulkBeginDates[3]"/>
<xsl:variable name="bulk-end-year" select="$bulkEndDates[1]"/>
<xsl:variable name="bulk-end-month" select="$bulkEndDates[2]"/>
<xsl:variable name="bulk-end-day" select="$bulkEndDates[3]"/>
<xsl:variable name="extent-number"
select="
if (ead:did/ead:physdesc[position() eq $current-position]/ead:extent[1]/matches(., '^\d'))
then
number(substring-before(normalize-space(ead:did/ead:physdesc[position() eq $current-position]/ead:extent[1]), ' '))
else
''"/>
<xsl:variable name="extent-type"
select="
if (ead:did/ead:physdesc[position() eq $current-position]/ead:extent[1]/matches(., '^\d'))
then
substring-after(normalize-space(ead:did/ead:physdesc[position() eq $current-position]/ead:extent[1]), ' ')
else
''"/>
<!-- column 1 -->
<Cell ss:StyleID="s3">
<Data ss:Type="Number">
<xsl:value-of
select="
if ($level-0 eq true()) then
0
else
count(ancestor::*) - 2"
/>
</Data>
</Cell>
<!-- column 2 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:value-of
select="
if ($level-0 eq true()) then ''
else if (@level='otherlevel') then 'accession'
else if (@level) then @level
else 'file'"
/>
</Data>
</Cell>
<!-- column 3 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:choose>
<xsl:when test="$remove-AT-database-unitIDs eq true()">
<xsl:apply-templates select="ead:did/ead:unitid[not(contains(@type, 'Database::'))][position() eq $current-position]"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="ead:did/ead:unitid[position() eq $current-position]"/>
</xsl:otherwise>
</xsl:choose>
</Data>
</Cell>
<!-- column 4 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:apply-templates select="ead:did/ead:unittitle[position() eq $current-position]"/>
</Data>
</Cell>
<!-- column 5 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:apply-templates
select="ead:did/ead:unitdate[not(@type = 'bulk')][position() eq $current-position]"/>
<!--any repeating unidate values will be copied into the immediate following rows-->
</Data>
<NamedCell ss:Name="date_expression"/>
</Cell>
<!-- column 6 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:value-of select="$begin-year"/>
</Data>
<NamedCell ss:Name="year_begin"/>
</Cell>
<!-- column 7 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:value-of select="$begin-month"/>
</Data>
<NamedCell ss:Name="month_begin"/>
</Cell>
<!-- column 8 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:value-of select="$begin-day"/>
</Data>
<NamedCell ss:Name="day_begin"/>
</Cell>
<!-- column 9 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:value-of select="$end-year"/>
</Data>
<NamedCell ss:Name="year_end"/>
</Cell>
<!-- column 10 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:value-of select="$end-month"/>
</Data>
<NamedCell ss:Name="month_end"/>
</Cell>
<!-- column 11 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:value-of select="$end-day"/>
</Data>
<NamedCell ss:Name="day_end"/>
</Cell>
<!-- column 12 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:value-of select="$bulk-begin-year"/>
</Data>
<NamedCell ss:Name="bulk_year_begin"/>
</Cell>
<!-- column 13 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:value-of select="$bulk-begin-month"/>
<NamedCell ss:Name="bulk_month_begin"/>
</Data>
</Cell>
<!-- column 14 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:value-of select="$bulk-begin-day"/>
</Data>
<NamedCell ss:Name="bulk_day_begin"/>
</Cell>
<!-- column 15 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:value-of select="$bulk-end-year"/>
</Data>
<NamedCell ss:Name="bulk_year_end"/>
</Cell>
<!-- column 16 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:value-of select="$bulk-end-month"/>
</Data>
<NamedCell ss:Name="bulk_month_end"/>
</Cell>
<!-- column 17 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:value-of select="$bulk-end-day"/>
</Data>
<NamedCell ss:Name="bulk_day_end"/>
</Cell>
<!-- column 18 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:value-of
select="
if (ead:did/ead:container[@label][@id][not(@parent)][position() eq $current-position]/contains(@label, '['))
then
ead:did/ead:container[@label][@id][not(@parent)][position() eq $current-position]/substring-before(@label, ' [')
else
ead:did/ead:container[@label][@id][not(@parent)][position() eq $current-position]/@label"
/>
</Data>
<NamedCell ss:Name="instance_type"/>
</Cell>
<!-- column 19 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:apply-templates
select="ead:did/ead:container[@id][not(@parent)][position() eq $current-position]/@type"
/>
</Data>
<NamedCell ss:Name="container_1_type"/>
</Cell>
<!-- column 20 -->
<!-- update: we're now putting container/location info in altrender, and container profile info in encodinganalog.
so, just change that here. no changes to the import, process, though, as we haven't overridden anything in the default EAD importers in ASpace
-->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:apply-templates
select="ead:did/ead:container[@id][not(@parent)][position() eq $current-position]/@encodinganalog"
/>
</Data>
<NamedCell ss:Name="container_profile"/>
</Cell>
<!-- column 21 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:value-of
select="ead:did/ead:container[@id][not(@parent)][position() eq $current-position]/substring-after(substring-before(@label, ']'), '[')"
/>
</Data>
<NamedCell ss:Name="barcode"/>
</Cell>
<!-- column 22 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:apply-templates
select="ead:did/ead:container[@id][not(@parent)][position() eq $current-position]"
/>
</Data>
</Cell>
<!-- column 23 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:apply-templates
select="ead:did/ead:container[@id][not(@parent)][position() eq $current-position]/following-sibling::ead:container[1][@parent]/@type"
/>
</Data>
<NamedCell ss:Name="container_2_type"/>
</Cell>
<!-- column 24 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:apply-templates
select="ead:did/ead:container[@id][not(@parent)][position() eq $current-position]/following-sibling::ead:container[1][@parent]"
/>
</Data>
</Cell>
<!-- column 25 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:apply-templates
select="ead:did/ead:container[@id][not(@parent)][position() eq $current-position]/following-sibling::ead:container[2][@parent]/@type"
/>
</Data>
<NamedCell ss:Name="container_3_type"/>
</Cell>
<!-- column 26 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:apply-templates
select="ead:did/ead:container[@id][not(@parent)][position() eq $current-position]/following-sibling::ead:container[2][@parent]"
/>
</Data>
</Cell>
<!-- column 27 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:value-of select="$extent-number"/>
</Data>
<NamedCell ss:Name="extent_number"/>
</Cell>
<!-- column 28 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:value-of select="$extent-type"/>
</Data>
<NamedCell ss:Name="extent_value"/>
</Cell>
<!-- column 29 -->
<!-- just change position of physdesc, not extent, if level 0 works-->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:apply-templates select="ead:did/ead:physdesc[position() eq $current-position]/ead:extent[2]"
/>
</Data>
<NamedCell ss:Name="generic_extent"/>
</Cell>
<!-- column 30 -->
<Cell ss:StyleID="s3">
<!-- test! -->
<Data ss:Type="String">
<xsl:apply-templates
select="ead:did/ead:physdesc[position() eq $current-position][not(ead:extent) or matches(ead:extent[1], '^\D')]"
/>
</Data>
</Cell>
<!-- column 31 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:apply-templates select="ead:did/ead:origination[position() eq $current-position]"/>
</Data>
</Cell>
<!-- column 32 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:apply-templates select="ead:bioghist[position() eq $current-position]"/>
</Data>
</Cell>
<!-- column 33 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:apply-templates select="ead:scopecontent[position() eq $current-position]"/>
<xsl:if test="$convert-odd-to-scopecontent eq true()">
<!-- okay... but now we need to know how many scopecontent siblings. for every one, add to the odd position
-->
<xsl:apply-templates select="ead:odd[(position() + $scope-count) eq $current-position]"/>
</xsl:if>
</Data>
</Cell>
<!-- column 34 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:apply-templates select="ead:arrangement[position() eq $current-position]"/>
</Data>
</Cell>
<!-- column 35 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:apply-templates select="ead:accessrestrict[position() eq $current-position]"/>
</Data>
</Cell>
<!-- column 36 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:apply-templates select="ead:phystech[position() eq $current-position]"/>
</Data>
</Cell>
<!-- column 37 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:apply-templates select="ead:did/ead:physloc[position() eq $current-position]"/>
</Data>
</Cell>
<!-- column 38 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:apply-templates select="ead:userestrict[position() eq $current-position]"/>
</Data>
</Cell>
<!-- column 39 -->
<!-- just one, since that's all that the AT and ASpace will allow.... but perhaps better not to include at all?-->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:value-of
select="
if ($level-0 eq false())
then
ead:did/ead:langmaterial/ead:language[1]/@langcode
else
''"
/>
</Data>
</Cell>
<!-- column 40 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:apply-templates select="ead:did/ead:langmaterial[position() eq $current-position]"/>
</Data>
</Cell>
<!-- column 41 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:apply-templates select="ead:otherfindaid[position() eq $current-position]"/>
</Data>
</Cell>
<!-- column 42 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:apply-templates select="ead:custodhist[position() eq $current-position]"/>
</Data>
</Cell>
<!-- column 43 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:apply-templates select="ead:acqinfo[position() eq $current-position]"/>
</Data>
</Cell>
<!-- column 44 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:apply-templates select="ead:appraisal[position() eq $current-position]"/>
</Data>
</Cell>
<!-- column 45 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:apply-templates select="ead:accruals[position() eq $current-position]"/>
</Data>
</Cell>
<!-- column 46 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:apply-templates select="ead:originalsloc[position() eq $current-position]"/>
</Data>
</Cell>
<!-- column 47 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:apply-templates select="ead:altformavail[position() eq $current-position]"/>
</Data>
</Cell>
<!-- column 48 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:apply-templates select="ead:relatedmaterial[position() eq $current-position]"/>
</Data>
</Cell>
<!-- column 49 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:apply-templates select="ead:separatedmaterial[position() eq $current-position]"/>
</Data>
</Cell>
<!-- column 50 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:apply-templates select="ead:prefercite[position() eq $current-position]"/>
</Data>
</Cell>
<!-- column 51 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:apply-templates select="ead:processinfo[position() eq $current-position]"/>
</Data>
</Cell>
<!-- column 52 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:apply-templates select="ead:controlaccess[position() eq $current-position]"/>
</Data>
</Cell>
<!-- column 53 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:value-of
select="
if ($level-0 eq false())
then
@id
else
''"
/>
</Data>
<NamedCell ss:Name="component_id"/>
</Cell>
<!-- column 54 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:value-of
select="ead:did/ead:dao[position() eq $current-position]/@xlink:href"/>
</Data>
</Cell>
<!-- column 55 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:value-of
select="ead:did/ead:dao[position() eq $current-position]/@xlink:title"/>
</Data>
</Cell>
<!-- column 56 -->
<Cell ss:StyleID="s3">
<Data ss:Type="String">
<xsl:value-of
select="
if ($level-0 eq false())
then
@altrender
else
''"
/>
</Data>
<NamedCell ss:Name="system_id"/>
</Cell>
</Row>
<!--
recurisve template to handle repeating fields
-->
<xsl:if test="$current-position <= $depth-to-recurse">
<xsl:call-template name="level-0">
<xsl:with-param name="current-position" select="$current-position + 1" as="xs:integer"/>
<xsl:with-param name="level-0" select="true()"/>
<xsl:with-param name="scope-count" select="$get-scope-count"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="$level-0 eq false()">
<xsl:apply-templates select="
ead:c | ead:c02 | ead:c03 | ead:c04 | ead:c05 | ead:c06 | ead:c07 | ead:c08 | ead:c09
| ead:c10 | ead:c11 | ead:c12"/>
</xsl:if>
</xsl:template>
<!-- formatting templates -->
<xsl:template match="ead:emph[@render = 'bold']">
<html:B>
<xsl:apply-templates/>
</html:B>
</xsl:template>
<xsl:template match="ead:emph[@render = 'boldunderline']">
<html:B>
<html:U>
<xsl:apply-templates/>
</html:U>
</html:B>
</xsl:template>
<xsl:template match="ead:emph[@render = 'bolditalic']">
<html:B>
<html:I>
<xsl:apply-templates/>
</html:I>
</html:B>
</xsl:template>
<xsl:template match="ead:emph[@render = 'boldsmcaps']">
<html:B>
<html:Font html:Size="8">
<xsl:apply-templates/>
</html:Font>
</html:B>
</xsl:template>
<xsl:template match="ead:emph[@render = 'italic']">
<html:I>
<xsl:apply-templates/>
</html:I>
</xsl:template>
<xsl:template match="ead:emph[@render = 'underline']">
<html:U>
<xsl:apply-templates/>
</html:U>
</xsl:template>
<xsl:template match="ead:emph[@render = 'super']">
<html:Sup>
<xsl:apply-templates/>
</html:Sup>
</xsl:template>
<xsl:template match="ead:emph[@render = 'sub']">
<html:Sub>
<xsl:apply-templates/>
</html:Sub>
</xsl:template>
<xsl:template match="ead:emph[@render = 'nonproport']">
<html:Font html:Face='Courier New'>
<xsl:apply-templates/>
</html:Font>
</xsl:template>
<xsl:template match="ead:emph[@render = 'smcaps']">
<html:Font html:Size="8">
<xsl:apply-templates/>
</html:Font>
</xsl:template>
<xsl:template match="ead:controlaccess">
<xsl:for-each select="*">
<xsl:apply-templates select="."/>
<xsl:if test="position() ne last()">
<xsl:text disable-output-escaping="yes">&#10;</xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:template>
<!-- in rainbows -->
<xsl:template match="ead:corpname">
<html:Font html:Color='#0070C0'>
<xsl:apply-templates/>
</html:Font>
</xsl:template>
<xsl:template match="ead:persname">
<html:Font html:Color='#7030A0'>
<xsl:apply-templates/>
</html:Font>
</xsl:template>
<xsl:template match="ead:famname">
<html:Font html:Color='#ED7D31'>
<xsl:apply-templates/>
</html:Font>
</xsl:template>
<xsl:template match="ead:geogname">
<html:Font html:Color='#44546A'>
<xsl:apply-templates/>
</html:Font>
</xsl:template>
<xsl:template match="ead:genreform">
<html:Font html:Color='#00B050'>
<xsl:apply-templates/>
</html:Font>
</xsl:template>
<xsl:template match="ead:subject">
<html:Font html:Color='#00B0F0'>
<xsl:apply-templates/>
</html:Font>
</xsl:template>
<xsl:template match="ead:occupation">
<html:Font html:Color='#FFC000'>
<xsl:apply-templates/>
</html:Font>
</xsl:template>
<xsl:template match="ead:function">
<html:Font html:Color='#FF00FF'>
<xsl:apply-templates/>
</html:Font>
</xsl:template>
<xsl:template match="ead:controlaccess/ead:name">
<html:Font html:Color='#000000'>
<xsl:apply-templates/>
</html:Font>
</xsl:template>
<xsl:template match="ead:title[not(@render)]">
<html:Font html:Color='#FF0000'>
<xsl:apply-templates/>
</html:Font>
</xsl:template>
<xsl:template match="ead:title[@render='bolditalic']">
<html:B>
<html:I>
<html:Font html:Color='#FF0000'>
<xsl:apply-templates/>
</html:Font>
</html:I>
</html:B>
</xsl:template>
<xsl:template match="ead:title[@render='boldunderline']">
<html:B>
<html:U>
<html:Font html:Color='#FF0000'>
<xsl:apply-templates/>
</html:Font>
</html:U>
</html:B>
</xsl:template>
<xsl:template match="ead:title[@render='bold']">
<html:B>
<html:Font html:Color='#FF0000'>
<xsl:apply-templates/>
</html:Font>
</html:B>
</xsl:template>
<xsl:template match="ead:title[@render='italic']">
<html:I>
<html:Font html:Color='#FF0000'>
<xsl:apply-templates/>
</html:Font>
</html:I>
</xsl:template>
<xsl:template match="ead:title[@render='underline']">
<html:U>
<html:Font html:Color='#FF0000'>
<xsl:apply-templates/>
</html:Font>
</html:U>
</xsl:template>
<xsl:template match="ead:p">
<xsl:apply-templates/>
<xsl:if test="position() ne last()">
<xsl:text disable-output-escaping="yes">&#10;&#10;</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="ead:lb">
<xsl:text disable-output-escaping="yes">&#10;</xsl:text>
</xsl:template>
<!--pre process to remove any unnnecessary headers added by ASpace (e.g. Scope and Contents note)-->
<xsl:template match="ead:head">
<html:Font html:Size="14">
<xsl:apply-templates/>
</html:Font>
<xsl:text disable-output-escaping="yes">&#10;</xsl:text>
</xsl:template>
<xsl:template match="text()">
<xsl:value-of select="normalize-unicode(replace(., '\n|\s+', ' '))"/>
</xsl:template>
<!-- this template provides the framework for the main worksheet, including all of the column headers-->
<xsl:template match="ead:dsc">
<Worksheet ss:Name="ContainerList" xmlns="urn:schemas-microsoft-com:office:spreadsheet">
<Names>
<NamedRange ss:Name="_FilterDatabase" ss:RefersTo="=ContainerList!R1C1:R16C38"
ss:Hidden="1"/>
</Names>
<Table ss:ExpandedColumnCount="56" x:FullColumns="1"
x:FullRows="1" ss:DefaultRowHeight="15">
<Column ss:AutoFitWidth="0" ss:Width="76"/>
<Column ss:Width="52" ss:Span="1"/>
<Column ss:Index="4" ss:AutoFitWidth="0" ss:Width="190"/>
<Column ss:AutoFitWidth="0" ss:Width="100"/>
<Column ss:AutoFitWidth="0" ss:Width="62"/>
<Column ss:AutoFitWidth="0" ss:Width="70"/>
<Column ss:AutoFitWidth="0" ss:Width="58"/>
<Column ss:AutoFitWidth="0" ss:Width="70"/>
<Column ss:AutoFitWidth="0" ss:Width="80"/>
<Column ss:AutoFitWidth="0" ss:Width="58"/>
<Column ss:AutoFitWidth="0" ss:Width="90"/>
<Column ss:AutoFitWidth="0" ss:Width="90"/>
<Column ss:AutoFitWidth="0" ss:Width="90"/>
<Column ss:AutoFitWidth="0" ss:Width="70"/>
<Column ss:AutoFitWidth="0" ss:Width="80"/>
<Column ss:AutoFitWidth="0" ss:Width="60"/>
<Column ss:AutoFitWidth="0" ss:Width="70"/>
<Column ss:AutoFitWidth="0" ss:Width="85" ss:Span="1"/>
<Column ss:Index="21" ss:AutoFitWidth="0" ss:Width="130"/>
<Column ss:AutoFitWidth="0" ss:Width="120"/>
<Column ss:AutoFitWidth="0" ss:Width="88"/>
<Column ss:AutoFitWidth="0" ss:Width="125"/>
<Column ss:AutoFitWidth="0" ss:Width="85"/>
<Column ss:AutoFitWidth="0" ss:Width="100"/>
<Column ss:AutoFitWidth="0" ss:Width="100"/>
<Column ss:AutoFitWidth="0" ss:Width="100" ss:Span="4"/>
<Column ss:Index="33" ss:AutoFitWidth="0" ss:Width="170" ss:Span="1"/>
<Column ss:Index="35" ss:AutoFitWidth="0" ss:Width="150"/>
<Column ss:AutoFitWidth="0" ss:Width="110"/>
<Column ss:AutoFitWidth="0" ss:Width="120"/>
<Column ss:AutoFitWidth="0" ss:Width="75"/>
<Column ss:AutoFitWidth="0" ss:Width="105"/>
<Column ss:AutoFitWidth="0" ss:Width="105"/>
<Column ss:AutoFitWidth="0" ss:Width="85"/>
<Column ss:AutoFitWidth="0" ss:Width="115"/>
<Column ss:AutoFitWidth="0" ss:Width="65"/>
<Column ss:Index="46" ss:AutoFitWidth="0" ss:Width="60"/>
<Column ss:AutoFitWidth="0" ss:Width="120"/>
<Column ss:AutoFitWidth="0" ss:Width="80"/>
<Column ss:AutoFitWidth="0" ss:Width="95"/>
<Column ss:AutoFitWidth="0" ss:Width="110"/>
<Column ss:AutoFitWidth="0" ss:Width="110"/>
<Column ss:AutoFitWidth="0" ss:Width="165"/>
<Column ss:AutoFitWidth="0" ss:Width="280"/>
<Column ss:AutoFitWidth="0" ss:Width="180"/>
<!--column headers-->
<Row ss:AutoFitHeight="0" ss:StyleID="s2">
<Cell>
<Data ss:Type="String">level number</Data>
<NamedCell ss:Name="_FilterDatabase"/>
</Cell>
<Cell>
<Data ss:Type="String">level type</Data>
<NamedCell ss:Name="_FilterDatabase"/>
</Cell>
<Cell>
<Data ss:Type="String">unitid</Data>
<NamedCell ss:Name="_FilterDatabase"/>
</Cell>
<Cell>
<Data ss:Type="String">title</Data>
<NamedCell ss:Name="_FilterDatabase"/>
</Cell>
<Cell>
<Data ss:Type="String">date expression</Data>
<NamedCell ss:Name="_FilterDatabase"/>
</Cell>
<Cell>
<Data ss:Type="String">year begin</Data>
<NamedCell ss:Name="_FilterDatabase"/>
<NamedCell ss:Name="year_begin"/>
</Cell>
<Cell>
<Data ss:Type="String">month begin</Data>
<NamedCell ss:Name="_FilterDatabase"/>
<NamedCell ss:Name="month_begin"/>
</Cell>
<Cell>
<Data ss:Type="String">day begin</Data>
<NamedCell ss:Name="_FilterDatabase"/>
<NamedCell ss:Name="day_begin"/>
</Cell>
<Cell>
<Data ss:Type="String">year end</Data>
<NamedCell ss:Name="_FilterDatabase"/>
<NamedCell ss:Name="year_end"/>
</Cell>
<Cell>
<Data ss:Type="String">month end</Data>
<NamedCell ss:Name="_FilterDatabase"/>
<NamedCell ss:Name="month_end"/>
</Cell>
<Cell>
<Data ss:Type="String">day end</Data>
<NamedCell ss:Name="_FilterDatabase"/>
<NamedCell ss:Name="day_end"/>
</Cell>
<Cell>
<Data ss:Type="String">bulk year begin</Data>
<NamedCell ss:Name="_FilterDatabase"/>
<NamedCell ss:Name="bulk_year_begin"/>
</Cell>
<Cell>
<Data ss:Type="String">bulk month begin</Data>
<NamedCell ss:Name="_FilterDatabase"/>
<NamedCell ss:Name="bulk_month_begin"/>
</Cell>
<Cell>
<Data ss:Type="String">bulk day begin</Data>
<NamedCell ss:Name="_FilterDatabase"/>
<NamedCell ss:Name="bulk_day_begin"/>
</Cell>
<Cell>
<Data ss:Type="String">bulk year end</Data>
<NamedCell ss:Name="_FilterDatabase"/>
<NamedCell ss:Name="bulk_year_end"/>
</Cell>
<Cell>
<Data ss:Type="String">bulk month end</Data>
<NamedCell ss:Name="_FilterDatabase"/>
<NamedCell ss:Name="bulk_month_end"/>
</Cell>
<Cell>
<Data ss:Type="String">bulk day end</Data>
<NamedCell ss:Name="_FilterDatabase"/>
<NamedCell ss:Name="bulk_day_end"/>
</Cell>
<Cell>