-
Notifications
You must be signed in to change notification settings - Fork 7
/
workflow.xsl
1411 lines (1384 loc) · 57.1 KB
/
workflow.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:atom="http://www.w3.org/2005/Atom"
xmlns="http://www.tei-c.org/ns/1.0" xmlns:cei="http://www.monasterium.net/NS/cei" xmlns:bf="http://betterform.sourceforge.net/xforms"
xmlns:xalan="http://xml.apache.org/xslt" exclude-result-prefixes="xs" version="3.0">
<xsl:output method="xml" indent="yes" xalan:indent-amount="4"/>
<xsl:strip-space elements="*"/>
<!--****************************
Dieses Stylesheet regelt das Preprocessing und die Konversion von CEI docs zu TEI docs
1. Step-1: Unnötige leere Elemente aus dem CEI werden entfernt
2. Step-2: Konversion von CEI zu TEI
3. Step-3: TEI-Validität erzeugen (body befüllen)
****************************
-->
<xsl:variable name="oldid">
<xsl:value-of select="substring-after(//atom:id, 'tag:www.monasterium.net,2011:/charter/')"
/>
</xsl:variable>
<!-- xpath-default-namespace entfernt auch aus body-filler
var fond-imgs integrates urls from monasterium fonds -->
<xsl:variable name="fond-imgs"
select="document('Listeversionofimages.xml')//eintrag[id = $oldid]"/>
<!-- Entries in subcollections of illurk extracted from List -->
<xsl:variable name="step-1">
<xsl:apply-templates mode="step-1"/>
</xsl:variable>
<xsl:template match="*[descendant::text() or descendant-or-self::*/@*[string()]]" mode="step-1">
<xsl:copy>
<xsl:apply-templates select="node() | @*" mode="step-1"/>
</xsl:copy>
</xsl:template>
<xsl:template match="@*[string()]" mode="step-1">
<xsl:copy/>
</xsl:template>
<xsl:variable name="step-2">
<xsl:apply-templates select="$step-1" mode="step-2"/>
</xsl:variable>
<xsl:template match="$step-1" mode="step-2">
<!--<xsl:processing-instruction name="xml-model">href="file:/Z:/Documents/CEI_TEIP5/tei_cei/out/tei_cei.rnc" type="application/relax-ng-compact-syntax"</xsl:processing-instruction>-->
<!-- Various Variables -->
<xsl:variable name="atom_published" select="/atom:entry/atom:published"/>
<xsl:variable name="atom_updated" select="/atom:entry/atom:updated"/>
<xsl:variable name="pid"
select="concat('o:cord.', lower-case(replace(substring-after(atom:entry/atom:id, 'charter/'), '/', '.')))"/>
<xsl:variable name="atom-rest">
<xsl:value-of select="substring-after(atom:entry/atom:id, 'charter/')"/>
</xsl:variable>
<xsl:variable name="atom-last">
<xsl:value-of select="concat('/', tokenize($atom-rest, '/')[last()])"/>
</xsl:variable>
<xsl:variable name="collection" select="substring-before($atom-rest, $atom-last)"></xsl:variable>
<xsl:variable name="contextname">
<xsl:value-of
select="concat('context:cord.', lower-case(replace(substring-before($atom-rest, $atom-last), '/', '.')))"
/>
</xsl:variable>
<TEI>
<teiHeader>
<fileDesc>
<titleStmt>
<title/>
<editor>
<xsl:value-of select="//atom:email"/>
</editor>
<principal>
<persName ref="https://orcid.org/0000-0002-1726-1712" xml:id="gv">
<forename>Georg</forename>
<surname>Vogeler</surname>
</persName>
</principal>
<respStmt>
<resp>Project Lead; Art historical description</resp>
<persName ref="https://orcid.org/0000-0002-9503-7097" xml:id="mr">
<forename>Martin</forename>
<surname>Roland</surname>
</persName>
</respStmt>
<respStmt>
<resp>Art historical description</resp>
<persName ref="https://orcid.org/0000-0002-8406-0785" xml:id="gb">
<forename>Gabriele</forename>
<surname>Bartz</surname>
</persName>
</respStmt>
<respStmt>
<resp>Diplomatic description</resp>
<persName ref="https://orcid.org/0000-0003-3269-453X" xml:id="mg">
<forename>Markus</forename>
<surname>Gneiß</surname>
</persName>
</respStmt>
<respStmt>
<resp>Project Lead; Diplomatic description</resp>
<persName ref="https://orcid.org/0000-0002-1967-6022" xml:id="az">
<forename>Andreas</forename>
<surname>Zajic</surname>
</persName>
</respStmt>
<respStmt>
<resp>Digital transformation; modelling</resp>
<persName ref="https://orcid.org/0000-0002-5114-0594" xml:id="sw">
<forename>Sean</forename>
<surname>Winslow</surname>
</persName>
</respStmt>
<respStmt>
<resp>Digital transformation</resp>
<persName ref="https://orcid.org/0000-0003-0594-1902" xml:id="mb">
<forename>Martina</forename>
<surname>Bürgermeister</surname>
</persName>
</respStmt>
<funder>
<orgName ref="https://www.fwf.ac.at/">
<choice>
<expan>Fonds zur Förderung der wissenschaftlichen
Forschung</expan>
<abbr>FWF</abbr>
</choice>
</orgName> Projekt P 26706-G21 "Illuminierten Urkunden als
Gesamtkunstwerk" and Projekt FWF-ORD84 "Erhalt fachspezifischer
Funktionalitäten bei Langzeitarchivierung in einem allgemeinen
Datenarchiv für die Geisteswissenschaften."</funder>
</titleStmt>
<publicationStmt>
<publisher>
<orgName ref="http://d-nb.info/gnd/1137284463"
corresp="https://informationsmodellierung.uni-graz.at"
>Zentrum für
Informationsmodellierung - Austrian Centre for Digital Humanities,
Karl-Franzens-Universität Graz</orgName>
<!-- old id is included in the new id and is hashed in fedora-->
<idno type="PID" resp="https://illuminierte-urkunden.uni-graz.at/">
<xsl:value-of select="$pid"/>
</idno>
<ref target="{$contextname}" type="context">
<xsl:value-of select="$contextname"/>
</ref>
</publisher>
<distributor>
<orgName ref="https://gams.uni-graz.at"
>GAMS - Geisteswissenschaftliches
Asset Management System</orgName>
</distributor>
<availability>
<p>All texts and pictures are protected according to national copyrights
and exploitation rights. Furthermore, all rights of publication and
duplication of the pictorial reproductions of the documents are held
by the respective archive’s proprietor. Any means of publication is
therefore bound to above mentioned authorization and infringement is
punishable.</p>
<p>We would like to make all users aware that addresses, time and
duration of access will be stored on our server. The place of
jurisdiction for all disputes arising from this agreement is the
court nearest to the respective archive.</p>
<p>Conditions of use of printed editions and depictions apply in the
same way to scientific utilization. Citation according to good
scientific practice is therefore expected. (URL, author,
archive)</p>
<p>When publishing or duplicating research results (including
unpublished theses and dissertations) obtained from data provided by
Monasterium.Net, we would like to ask every user to pass a free
sample copy to the respective holder of the originals (archive).</p>
</availability>
<pubPlace>
<placeName>Graz</placeName>
</pubPlace>
<date>
<xsl:value-of select="current-dateTime()"/>
<!-- hOW TO MAKE THIS STABLE ACROSS Multiple Imports? -->
</date>
</publicationStmt>
<sourceDesc>
<bibl>Originally converted to TEI based upon a CEI file from <ref
target="http://monasterium.net/">Monasterium</ref>, <idno
type="Monasterium">
<xsl:value-of
select="$oldid"
/>
</idno>, created on <date when="{$atom_published}"><xsl:value-of
select="format-dateTime($atom_published, '[Y]-[M]-[D]')"
/></date> and last updated on <date when="{$atom_updated}"
><xsl:value-of
select="format-dateTime($atom_updated, '[Y]-[M]-[D]')"
/></date>. </bibl>
<xsl:for-each
select="//cei:sourceDesc | //cei:sourceDescRegest | //cei:sourceDescVolltext | //cei:sourceDescErw">
<!-- Nested bbibl elements in SourceDescRegest -->
<xsl:apply-templates select="cei:bibl[. != '']"/>
</xsl:for-each>
<!-- Hier wird der atom:link erhalten mit bibl type version: Gut Idee? -->
<xsl:if test="//atom:link">
<bibl type="version">
<ref>
<xsl:attribute name="target">
<xsl:text>http://monasterium.net/mom/</xsl:text>
<xsl:value-of
select="substring-after(//atom:link/@ref, 'charter/')"/>
<xsl:text>/charter</xsl:text>
</xsl:attribute>
</ref>
</bibl>
</xsl:if>
<listWit>
<xsl:call-template name="original_witness"/>
<xsl:if test="//cei:chDesc/cei:witListPar//*[. != '']">
<xsl:apply-templates select="//cei:chDesc/cei:witListPar"/>
</xsl:if>
</listWit>
</sourceDesc>
</fileDesc>
<encodingDesc>
<projectDesc>
<p>The <ref target="https://illuminierte-urkunden.uni-graz.at"
>Illuminierte
Urkunden</ref> project is a cross-disciplinary historical,
art-historical, and digital humanities project which collects
illuminated medieval charters from all over Europe, publishes them, and
explores them in detailed studies.</p>
</projectDesc>
<listPrefixDef>
<prefixDef ident="zotero" matchPattern="([a-z]+[a-z0-9]*)"
replacementPattern="http://zotero.org/groups/257864/items/$1">
<p part="N"
> Private URIs using the bibl prefix can be expanded to form
URIs which retrieve the relevant bibliographical reference from
Zotero. </p>
</prefixDef>
</listPrefixDef>
</encodingDesc>
<profileDesc>
<abstract>
<xsl:apply-templates select="//cei:abstract"/>
</abstract>
<xsl:apply-templates select="//cei:lang_MOM"/>
<textClass>
<xsl:for-each-group select="//cei:index[@indexName]" group-by="@indexName">
<xsl:call-template name="keywords"/>
</xsl:for-each-group>
<xsl:for-each-group select="//cei:index[not(@indexName)][@lemma]" group-by="@lemma">
<xsl:call-template name="keywords"/>
</xsl:for-each-group>
<xsl:for-each-group select="//cei:index[@type]" group-by="@type">
<xsl:call-template name="keywords"/>
</xsl:for-each-group>
<xsl:for-each-group select="//cei:index[not(@*)]" group-by=".">
<keywords>
<term><xsl:value-of select="."/></term>
</keywords>
</xsl:for-each-group>
</textClass>
<xsl:if
test="//cei:back//cei:persName[. != ''] | //cei:back//cei:orgName[. != '']">
<particDesc>
<xsl:if test="//cei:back//cei:persName[. != '']">
<listPerson>
<xsl:for-each select="//cei:back//cei:persName">
<xsl:sort order="ascending" select="."/>
<xsl:choose>
<xsl:when test="@key">
<xsl:for-each-group select="." group-by="@key">
<xsl:call-template name="list_people"/>
</xsl:for-each-group>
</xsl:when>
<xsl:when test="@reg">
<xsl:for-each-group select="." group-by="@reg">
<xsl:call-template name="list_people"/>
</xsl:for-each-group>
</xsl:when>
<xsl:otherwise>
<xsl:for-each-group select="." group-by=".">
<xsl:call-template name="list_people"/>
</xsl:for-each-group>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</listPerson>
</xsl:if>
<xsl:if test="//cei:back//cei:orgName[. != '']">
<listOrg>
<xsl:for-each select="//cei:back//cei:orgName[. != '']">
<xsl:sort order="ascending" select="."/>
<xsl:choose>
<xsl:when test="@key">
<xsl:for-each-group select="." group-by="@key">
<xsl:call-template name="list_orgs"/>
</xsl:for-each-group>
</xsl:when>
<xsl:when test="@reg">
<xsl:for-each-group select="." group-by="@reg">
<xsl:call-template name="list_orgs"/>
</xsl:for-each-group>
</xsl:when>
<xsl:otherwise>
<xsl:for-each-group select="." group-by=".">
<xsl:call-template name="list_orgs"/>
</xsl:for-each-group>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</listOrg>
</xsl:if>
</particDesc>
</xsl:if>
<xsl:if test="//cei:back//cei:placeName[. != '']">
<settingDesc>
<listPlace>
<xsl:for-each select="//cei:back//cei:placeName[. != '']">
<xsl:sort order="ascending" select="."/>
<!-- <xsl:choose>
<xsl:when test="@key">
<xsl:for-each-group select="." group-by="@key">
<xsl:value-of select="."/>
</xsl:for-each-group>
</xsl:when>
<xsl:when test="@reg">
<xsl:for-each-group select="." group-by="@reg">
<xsl:call-template name="list_places"/>
</xsl:for-each-group>
</xsl:when>
<xsl:otherwise> -->
<xsl:for-each-group select="." group-by=".">
<xsl:call-template name="list_places"/>
</xsl:for-each-group>
<!-- </xsl:otherwise>
</xsl:choose>-->
</xsl:for-each>
</listPlace>
</settingDesc>
</xsl:if>
</profileDesc>
<!-- <revisionDesc>
Use revisionDesc only for changes to TEI file. atom:updated is referenced in sourceDesc. Need a way to track changes across imports to this space.
</revisionDesc>-->
</teiHeader>
<xsl:if test="//cei:graphic[@url != ''] or $fond-imgs/eintrag != ''">
<facsimile>
<xsl:apply-templates select="//cei:graphic[@url != '']" mode="image"/>
<xsl:if test="$fond-imgs/eintrag != ''">
<xsl:for-each select="$fond-imgs/image-url">
<graphic url="{.}"/>
</xsl:for-each>
</xsl:if>
</facsimile>
</xsl:if>
<text>
<body>
<xsl:apply-templates select="//cei:tenor"/>
</body>
</text>
</TEI>
</xsl:template>
<xsl:template name="original_witness">
<witness>
<msDesc>
<xsl:choose>
<xsl:when test="//cei:witnessOrig/not(cei:archIdentifier)">
<msIdentifier><p/></msIdentifier>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="//cei:witnessOrig/cei:archIdentifier"/>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates select="//cei:witnessOrig/cei:physicalDesc"/>
<diploDesc>
<xsl:apply-templates select="//cei:witnessOrig/cei:traditioForm"/>
<xsl:apply-templates select="//cei:diplomaticAnalysis"/>
<issued>
<xsl:apply-templates select="//cei:issued"/>
</issued>
</diploDesc>
<xsl:apply-templates select="//cei:witnessOrig/cei:auth[. != '']"/>
<!-- There are cei:figure tags in witnessOrig that need to be moved to facsimile (no anchors neeeded?) -->
</msDesc>
</witness>
</xsl:template>
<xsl:template match="cei:index">
<!-- ref="http://gams.uni-graz.at/skos/scheme/o:cord.2484#Historiated" -->
<ref>
<xsl:choose>
<xsl:when test="@lemma and @indexName">
<xsl:variable name="indexName">
<xsl:choose>
<xsl:when test="@indexName = 'IllUrkGlossar'">2483</xsl:when>
<xsl:when test="@indexName = 'illurk-vocabulary'">2484</xsl:when>
<xsl:otherwise> </xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:attribute name="target">
<xsl:value-of
select="concat('http://gams.uni-graz.at/skos/scheme/o:cord.', $indexName, '#', @lemma)"
/>
</xsl:attribute>
</xsl:when>
<!-- eigentlich brauch es hier noch ein otherwise, es könnte cei:index geben, der andere @ hat -->
</xsl:choose>
<!--<xsl:copy-of select="@*"></xsl:copy-of>-->
<xsl:value-of select="."/>
</ref>
</xsl:template>
<xsl:template match="cei:abstract">
<p>
<xsl:apply-templates/>
</p>
</xsl:template>
<xsl:template match="cei:add">
<add>
<xsl:apply-templates/>
</add>
</xsl:template>
<xsl:template match="cei:altIdentifier">
<altIdentifier>
<xsl:if test="@ana != ''">
<xsl:attribute name="ana">
<xsl:value-of select="@ana"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="@type != ''">
<xsl:attribute name="type">
<xsl:value-of select="@type"/>
</xsl:attribute>
</xsl:if>
<xsl:apply-templates/>
</altIdentifier>
</xsl:template>
<xsl:template match="cei:app">
<app>
<xsl:apply-templates/>
</app>
</xsl:template>
<xsl:template match="cei:arch">
<repository>
<xsl:apply-templates/>
</repository>
</xsl:template>
<xsl:template match="cei:archFond">
<collection>
<xsl:apply-templates/>
</collection>
</xsl:template>
<xsl:template match="cei:arenga">
<diploPart type="arenga">
<xsl:apply-templates/>
</diploPart>
</xsl:template>
<xsl:template match="cei:witness/cei:auth[. != '']">
<authDesc>
<xsl:apply-templates/>
<xsl:apply-templates select="../cei:sealDesc[. != '']"/>
</authDesc>
</xsl:template>
<xsl:template match="cei:witnessOrig/cei:auth[. != '']">
<authDesc>
<xsl:apply-templates/>
<xsl:apply-templates select="../cei:sealDesc[. != '']"/>
</authDesc>
</xsl:template>
<xsl:template match="cei:author">
<author>
<xsl:apply-templates/>
</author>
</xsl:template>
<xsl:template match="cei:availability">
<availability>
<xsl:apply-templates/>
</availability>
</xsl:template>
<!-- <xsl:template match="cei:back/cei:persName">
<person>
<xsl:apply-templates/>
</person>
</xsl:template>
<xsl:template match="cei:back/cei:placeName">
<place>
<xsl:apply-templates/>
</place>
</xsl:template>
<xsl:template match="cei:back/cei:orgName">
<org>
<xsl:apply-templates/>
</org>
</xsl:template>-->
<xsl:template match="cei:bibl">
<bibl>
<xsl:if test="@key != ''">
<xsl:variable name="key" select="@key"/>
<ref target="{$key}"/>
</xsl:if>
<xsl:apply-templates/>
</bibl>
</xsl:template>
<!-- <xsl:template match="cei:body[. != '']">
<xsl:apply-templates/>
</xsl:template>-->
<xsl:template match="cei:c">
<g>
<xsl:apply-templates/>
</g>
</xsl:template>
<xsl:template match="cei:chDesc">
<!-- <xsl:apply-templates/> -->
</xsl:template>
<xsl:template match="cei:cit">
<cit>
<xsl:apply-templates/>
</cit>
</xsl:template>
<xsl:template match="cei:condition">
<condition>
<xsl:apply-templates/>
</condition>
</xsl:template>
<xsl:template match="cei:corr">
<corr>
<xsl:apply-templates/>
</corr>
</xsl:template>
<xsl:template match="cei:corrobatio">
<diploPart type="corrobation">
<xsl:apply-templates/>
</diploPart>
</xsl:template>
<xsl:template match="cei:datatio">
<diploPart type="datatio">
<xsl:apply-templates/>
</diploPart>
</xsl:template>
<xsl:template match="cei:dispositio">
<diploPart type="dispositio">
<xsl:apply-templates/>
</diploPart>
</xsl:template>
<xsl:template match="cei:inscriptio">
<diploPart type="inscriptio">
<xsl:apply-templates/>
</diploPart>
</xsl:template>
<xsl:template match="cei:intitulatio">
<diploPart type="intitulatio">
<xsl:apply-templates/>
</diploPart>
</xsl:template>
<xsl:template match="cei:invocatio">
<diploPart type="invocatio">
<xsl:apply-templates/>
</diploPart>
</xsl:template>
<xsl:template match="cei:narratio">
<diploPart type="narratio">
<xsl:apply-templates/>
</diploPart>
</xsl:template>
<xsl:template match="cei:publicatio">
<diploPart type="publicatio">
<xsl:apply-templates/>
</diploPart>
</xsl:template>
<xsl:template match="cei:sanctio">
<diploPart type="sanctio">
<xsl:apply-templates/>
</diploPart>
</xsl:template>
<xsl:template match="cei:country">
<country>
<xsl:apply-templates/>
</country>
</xsl:template>
<xsl:template match="cei:damage">
<damage>
<xsl:apply-templates/>
</damage>
</xsl:template>
<xsl:template match="cei:date">
<date>
<xsl:apply-templates/>
</date>
</xsl:template>
<xsl:template match="cei:dateRange">
<xsl:variable name="from" select="@from"/>
<xsl:variable name="to" select="@to"/>
<xsl:choose>
<xsl:when test="$from = $to">
<date when="{$from}">
<xsl:apply-templates/>
</date>
</xsl:when>
<xsl:otherwise>
<date from="{$from}" to="{$to}">
<xsl:apply-templates/>
</date>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="cei:decoDesc[. != '']">
<decoDesc>
<xsl:apply-templates/>
</decoDesc>
</xsl:template>
<xsl:template match="cei:del">
<del>
<xsl:apply-templates/>
</del>
</xsl:template>
<xsl:template match="cei:desc">
<desc>
<xsl:apply-templates/>
</desc>
</xsl:template>
<xsl:template match="cei:dimensions">
<!-- no text allowed within dimensions -->
<dimensions>
<xsl:apply-templates select="node()[text()]"/>
</dimensions>
</xsl:template>
<xsl:template match="cei:diplomaticAnalysis">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="cei:div">
<!--| cei:divNotes -->
<div>
<xsl:apply-templates select="cei:p"/>
<xsl:call-template name="p_in_div"/>
</div>
</xsl:template>
<xsl:template match="cei:divNotes">
<div>
<p>
<xsl:apply-templates/>
</p>
</div>
</xsl:template>
<xsl:template match="cei:expan">
<expan>
<xsl:apply-templates/>
</expan>
</xsl:template>
<xsl:template match="cei:figDesc">
<figDesc>
<xsl:apply-templates/>
</figDesc>
</xsl:template>
<!-- <xsl:template match="cei:figure">
<figure><xsl:apply-templates/></figure>
</xsl:template> -->
<xsl:template match="cei:foreign">
<foreign>
<xsl:apply-templates/>
</foreign>
</xsl:template>
<xsl:template match="cei:forename">
<forename>
<xsl:apply-templates/>
</forename>
</xsl:template>
<xsl:template match="cei:geogName">
<geogName>
<xsl:apply-templates/>
</geogName>
</xsl:template>
<xsl:template match="cei:graphic" mode="image">
<graphic url="{@url}"/>
</xsl:template>
<xsl:template match="cei:group">
<group>
<xsl:apply-templates/>
</group>
</xsl:template>
<xsl:template match="cei:handShift">
<handShift>
<xsl:apply-templates/>
</handShift>
</xsl:template>
<xsl:template match="cei:height">
<xsl:variable name="unit">
<xsl:choose>
<xsl:when test="contains(parent::cei:dimensions, 'mm')">
<xsl:text>mm</xsl:text>
</xsl:when>
<xsl:when test="contains(parent::cei:dimensions, 'cm')">
<xsl:text>cm</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:variable>
<height>
<xsl:if test="$unit[. != '']">
<xsl:attribute name="unit" select="$unit"/>
</xsl:if>
<xsl:apply-templates/>
</height>
</xsl:template>
<xsl:template match="cei:hi">
<hi>
<xsl:apply-templates/>
</hi>
</xsl:template>
<xsl:template match="cei:plica">
<xsl:variable name="unit">
<xsl:choose>
<xsl:when test="contains(parent::cei:dimensions, 'mm')">
<xsl:text>mm</xsl:text>
</xsl:when>
<xsl:when test="contains(parent::cei:dimensions, 'cm')">
<xsl:text>cm</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:variable>
<plica>
<xsl:if test="$unit[. != '']">
<xsl:attribute name="unit" select="$unit"/>
</xsl:if>
<xsl:apply-templates/>
</plica>
</xsl:template>
<xsl:template match="cei:hi">
<hi>
<xsl:apply-templates/>
</hi>
</xsl:template>
<xsl:template match="cei:witnessOrig/cei:archIdentifier">
<msIdentifier>
<xsl:apply-templates select="cei:country"/>
<xsl:apply-templates select="cei:region"/>
<xsl:apply-templates select="cei:settlement"/>
<xsl:apply-templates select="cei:institution"/>
<xsl:apply-templates select="cei:arch | cei:repository"/>
<xsl:apply-templates select="cei:archFond"/>
<xsl:apply-templates select="cei:idno"/>
<xsl:apply-templates select="cei:altIdentifier"/>
<xsl:apply-templates select="cei:note"/>
</msIdentifier>
</xsl:template>
<xsl:template match="cei:witness/cei:archIdentifier">
<msIdentifier>
<xsl:apply-templates select="cei:country"/>
<xsl:apply-templates select="cei:region"/>
<xsl:apply-templates select="cei:settlement"/>
<xsl:apply-templates select="cei:institution"/>
<xsl:apply-templates select="cei:arch | cei:repository"/>
<xsl:apply-templates select="cei:archFond"/>
<xsl:apply-templates select="cei:idno"/>
<xsl:apply-templates select="cei:altIdentifier"/>
<xsl:apply-templates select="cei:note"/>
</msIdentifier>
</xsl:template>
<!-- NOT IN USE
<xsl:template match="cei:body/cei:idno">
</xsl:template>-->
<xsl:template match="cei:idno[not(parent::cei:body)]">
<idno>
<xsl:apply-templates/>
</idno>
</xsl:template>
<!-- <xsl:template match="cei:image_server_address">
<image_server_address><xsl:apply-templates/></image_server_address>
</xsl:template>
<xsl:template match="cei:image_server_folder">
<image_server_folder><xsl:apply-templates/></image_server_folder>
</xsl:template>-->
<xsl:template match="cei:imprint">
<imprint>
<xsl:apply-templates/>
</imprint>
</xsl:template>
<!-- <xsl:template match="cei:body//cei:index[. != '']">
<!-\- <term>-\->
<xsl:call-template name="vocab_uri"/>
<!-\-</term>-\->
</xsl:template>-->
<xsl:template match="cei:institution">
<institution>
<xsl:apply-templates/>
</institution>
</xsl:template>
<xsl:template match="//cei:issued">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="cei:issuer">
<legalActor type="issuer">
<xsl:apply-templates/>
</legalActor>
</xsl:template>
<xsl:template match="cei:lang_MOM">
<xsl:variable name="langmom" select="."/>
<xsl:for-each select="document('lang_MOM.xml')//lang_MOM_entry">
<xsl:if test="lang_mom[text() = $langmom]">
<langUsage>
<xsl:for-each select="tokenize(lang_iso, ',')">
<xsl:variable name="token" select="normalize-space(.)"/>
<language ident="{$token}">
<xsl:value-of select="$langmom"/>
</language>
</xsl:for-each>
</langUsage>
</xsl:if>
</xsl:for-each>
</xsl:template>
<xsl:template match="cei:lb">
<lb>
<xsl:apply-templates/>
</lb>
</xsl:template>
<xsl:template match="cei:legend">
<legend>
<xsl:apply-templates/>
</legend>
</xsl:template>
<!--<xsl:template match="cei:lem">
<lem><xsl:apply-templates/></lem>
</xsl:template>-->
<xsl:template match="cei:listBibl">
<listBibl type="other">
<xsl:apply-templates/>
</listBibl>
</xsl:template>
<xsl:template match="cei:listBiblEdition">
<listBibl type="edition">
<xsl:apply-templates/>
</listBibl>
</xsl:template>
<xsl:template match="cei:listBiblErw">
<listBibl type="unknown">
<xsl:apply-templates/>
</listBibl>
</xsl:template>
<xsl:template match="cei:listBiblFacsimile">
<listBibl type="facsimile">
<xsl:apply-templates/>
</listBibl>
</xsl:template>
<xsl:template match="cei:listBiblRegest">
<listBibl type="regest">
<xsl:apply-templates/>
</listBibl>
</xsl:template>
<xsl:template match="cei:material">
<material>
<xsl:apply-templates/>
</material>
</xsl:template>
<xsl:template match="cei:measure">
<measure>
<xsl:apply-templates/>
</measure>
</xsl:template>
<xsl:template match="cei:nota">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="cei:note[. != '']">
<note>
<xsl:apply-templates/>
</note>
</xsl:template>
<!-- <xsl:template match="cei:notariusDesc">
<authen><xsl:apply-templates/></authen>
</xsl:template> SIX APPEARANCES IN DATA ; NEEDS TO BE FIXED
<xsl:template match="cei:notariusSign"> DOES NOT APPEAR IN DATA
<authen><xsl:apply-templates/></authen>
</xsl:template>-->
<xsl:template match="cei:notariusDesc[. != '']">
<authen type="signed">
<legalActor type="notary">
<xsl:apply-templates/>
</legalActor>
</authen>
</xsl:template>
<xsl:template match="cei:num">
<num>
<xsl:apply-templates/>
</num>
</xsl:template>
<xsl:template match="cei:orgName">
<orgName>
<xsl:apply-templates/>
</orgName>
</xsl:template>
<xsl:template match="cei:p[. != ''] | cei:pTenor[. != '']">
<p>
<xsl:if test="@n != ''">
<xsl:attribute name="n">
<xsl:value-of select="@n"/>
</xsl:attribute>
</xsl:if>
<xsl:apply-templates/>
</p>
</xsl:template>
<!-- <xsl:template match="cei:password">
<password><xsl:apply-templates/></password>
</xsl:template>-->
<xsl:template match="cei:pb">
<pb>
<xsl:apply-templates/>
</pb>
</xsl:template>
<xsl:template match="cei:persName">
<persName>
<xsl:apply-templates/>
</persName>
</xsl:template>
<xsl:template match="cei:witness/cei:physicalDesc">
<physDesc>
<objectDesc>
<supportDesc>
<support>
<xsl:apply-templates select="cei:material"/>
<xsl:apply-templates select="cei:dimensions"/>
</support>
<xsl:apply-templates select="cei:condition"/>
</supportDesc>
</objectDesc>
<xsl:apply-templates select="cei:decoDesc"/>
<xsl:if test="./../cei:nota[. != '']">
<additions>
<xsl:apply-templates select="parent::*//cei:nota"/>
</additions>
</xsl:if>
</physDesc>
</xsl:template>
<xsl:template match="cei:witnessOrig/cei:physicalDesc">
<physDesc>
<objectDesc>
<supportDesc>
<support>
<xsl:apply-templates select="cei:material"/>
<xsl:apply-templates select="cei:dimensions"/>
</support>
<xsl:apply-templates select="cei:condition"/>
</supportDesc>
</objectDesc>
<xsl:apply-templates select="cei:decoDesc"/>
<xsl:if test="parent::*//cei:nota[. != '']">
<additions>
<xsl:apply-templates select="parent::*//cei:nota"/>
</additions>
</xsl:if>
</physDesc>
</xsl:template>
<!-- <xsl:template match="cei:pict">
<pict><xsl:apply-templates/></pict>
</xsl:template>-->
<xsl:template match="cei:placeName">
<placeName>
<xsl:for-each select="@*">
<xsl:attribute name="{name()}">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:for-each>
<xsl:apply-templates/>
</placeName>
</xsl:template>
<xsl:template match="cei:provenance">
<provenance>
<xsl:apply-templates/>
</provenance>
</xsl:template>
<xsl:template match="cei:pubPlace">
<pubPlace>
<xsl:apply-templates/>
</pubPlace>
</xsl:template>
<xsl:template match="cei:quote">
<quote>
<xsl:if test="@type[. = 'italic']">
<xsl:attribute name="rend">italic</xsl:attribute>
</xsl:if>
<xsl:apply-templates/>
</quote>
</xsl:template>
<xsl:template match="cei:quoteOriginaldatierung[. != '']">
<p>
<quote>
<date>
<xsl:apply-templates/>
</date>
</quote>
</p>
</xsl:template>
<xsl:template match="cei:rdg">
<rdg>
<xsl:apply-templates/>
</rdg>
</xsl:template>
<xsl:template match="cei:recipient">
<legalActor type="recipient">
<xsl:apply-templates/>
</legalActor>