Repository navigation
Expand file tree
/
Copy pathtei2html.xsl
More file actions
2342 lines (2282 loc) · 135 KB
/
Copy pathtei2html.xsl
File metadata and controls
2342 lines (2282 loc) · 135 KB
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
<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:t="http://www.tei-c.org/ns/1.0" xmlns:x="http://www.w3.org/1999/xhtml" xmlns:srophe="https://srophe.app" xmlns:saxon="http://saxon.sf.net/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:local="http://syriaca.org/ns" exclude-result-prefixes="xs t x saxon local" version="2.0">
<!-- ==================================================================
Copyright 2013 New York University
This file is part of the Syriac Reference Portal Places Application.
The Syriac Reference Portal Places Application is free software:
you can redistribute it and/or modify it under the terms of the GNU
General Public License as published by the Free Software Foundation,
either version 3 of the License, or (at your option) any later
version.
The Syriac Reference Portal Places Application is distributed in
the hope that it will be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more
details.
You should have received a copy of the GNU General Public License
along with the Syriac Reference Portal Places Application. If not,
see (http://www.gnu.org/licenses/).
================================================================== -->
<!-- ==================================================================
tei2html.xsl
This XSLT transforms tei.xml to html.
This file needs to be updated separately from version in code repo for proper transformation.
parameters:
code based on code by:
+ Winona Salesky (wsalesky@gmail.com)
https://github.com/srophe/Gaddel/blob/main/siteGenerator/xsl/tei2html.xsl
+ Tom Elliott (http://www.paregorios.org)
for the Institute for the Study of the Ancient World, New York
University, under contract to Vanderbilt University for the
NEH-funded Syriac Reference Portal project.
funding provided by:
+ National Endowment for the Humanities (http://www.neh.gov). Any
views, findings, conclusions, or recommendations expressed in
this code do not necessarily reflect those of the National
Endowment for the Humanities.
================================================================== -->
<!-- =================================================================== -->
<!-- import component stylesheets for HTML page portions -->
<!-- =================================================================== -->
<xsl:import href="citation.xsl"/>
<xsl:import href="bibliography.xsl"/>
<!-- Calls Srophe specific display XSLT, you can add your own or edit this one. -->
<xsl:import href="core.xsl"/>
<!-- Helper functions and templates -->
<xsl:import href="helper-functions.xsl"/>
<xsl:import href="collations.xsl"/>
<!-- Syriaca.org stylesheets -->
<!-- <xsl:import href="link-icons.xsl"/>-->
<!-- SPEAR -->
<xsl:import href="spear.xsl"/>
<!-- =================================================================== -->
<!-- set output so we get (mostly) indented HTML -->
<!-- =================================================================== -->
<xsl:output name="html" encoding="UTF-8" method="xhtml" indent="no" omit-xml-declaration="yes"/>
<!-- =================================================================== -->
<!-- initialize top-level variables and transform parameters -->
<!-- =================================================================== -->
<!-- Parameters passed from global.xqm (set in config.xml) default values if params are empty -->
<xsl:param name="data-root" select="'/data'"/>
<!-- eXist app root for app deployment-->
<xsl:param name="app-root" select="'/syriaca'"/>
<!-- Root of app for building dynamic links. Default is eXist app root -->
<xsl:param name="nav-base" select="''"/>
<!-- Base URI for identifiers in app data -->
<xsl:param name="base-uri" select="'http://syriaca.org'"/>
<!-- Add a collection parameter to make it possible to switch XSLT stylesheets, or views via collections -->
<xsl:param name="collection"/>
<!-- Hard coded values-->
<xsl:param name="normalization">NFKC</xsl:param>
<!-- Repo-config -->
<xsl:variable name="config">
<xsl:choose>
<xsl:when test="doc-available('/repo-config.xml')">
<xsl:message>repo-config found</xsl:message>
<xsl:sequence select="document('/repo-config.xml')"/>
</xsl:when>
<xsl:otherwise>
<xsl:message>Warning: repo-config not found</xsl:message>
<xsl:sequence select="()" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:param name="idno"/>
<!-- Repository Title -->
<xsl:variable name="repository-title">
<xsl:choose>
<xsl:when test="not(empty($config))">
<xsl:value-of select="$config//*:title[1]"/>
</xsl:when>
<xsl:otherwise>The Gaddel Application</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="collection-title">
<xsl:choose>
<xsl:when test="not(empty($config))">
<xsl:choose>
<xsl:when test="$config//*:collection[@name=$collection]">
<xsl:value-of select="$config//*:collection[@name=$collection]/@title"/>
</xsl:when>
<xsl:when test="$config//*:collection[@title=$collection]">
<xsl:value-of select="$config//*:collection[@title=$collection]/@title"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$repository-title"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$repository-title"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Resource id -->
<xsl:variable name="resource-id">
<xsl:choose>
<xsl:when test="$idno != ''">
<xsl:value-of select="$idno"/>
</xsl:when>
<xsl:when test="string(/*/@id)">
<xsl:value-of select="string(/*/@id)"/>
</xsl:when>
<xsl:when test="/descendant::t:publicationStmt/t:idno[@type='URI'][starts-with(.,$base-uri)]">
<xsl:value-of select="replace(replace(/descendant::t:publicationStmt[1]/t:idno[@type='URI'][starts-with(.,$base-uri)][1],'/tei',''),'/source','')"/>
</xsl:when>
<xsl:when test="/descendant::t:publicationStmt/t:idno[@type='URI']">
<xsl:value-of select="replace(replace(/descendant::t:publicationStmt[1]/t:idno[@type='URI'][1],'/tei',''),'/source','')"/>
</xsl:when>
<xsl:when test="/descendant::t:idno[@type='URI'][starts-with(.,$base-uri)]">
<xsl:value-of select="replace(replace(/descendant::t:idno[@type='URI'][starts-with(.,$base-uri)][1],'/tei',''),'/source','')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat($base-uri,'/0000')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Resource title -->
<xsl:variable name="resource-title">
<xsl:apply-templates select="/descendant-or-self::t:titleStmt/t:title[1]"/>
</xsl:variable>
<!-- =================================================================== -->
<!-- Templates -->
<!-- =================================================================== -->
<!-- Root -->
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<!-- =================================================================== -->
<!-- Custom Syriaca.org templates, remove overwrite or edit to change the display -->
<!-- =================================================================== -->
<!-- A -->
<xsl:template name="aboutEntry">
<div id="about">
<xsl:choose>
<xsl:when test="contains($resource-id,'/bibl/')">
<h3>About this Online Entry</h3>
<xsl:apply-templates select="descendant-or-self::t:teiHeader/t:fileDesc/t:titleStmt" mode="about-bibl"/>
</xsl:when>
<xsl:otherwise>
<h3>About this Entry</h3>
<xsl:apply-templates select="descendant-or-self::t:teiHeader/t:fileDesc/t:titleStmt" mode="about"/>
</xsl:otherwise>
</xsl:choose>
</div>
</xsl:template>
<!-- Named template for bibl about -->
<xsl:template match="t:srophe-about">
<div id="citation-note" class="content-block">
<xsl:call-template name="aboutEntry"/>
</div>
</xsl:template>
<!-- B -->
<!-- suppress bibl in title mode -->
<xsl:template match="t:bibl" mode="title"/>
<xsl:template match="t:bibl">
<xsl:choose>
<xsl:when test="@type !=('lawd:ConceptualWork','lawd:Citation')">
<li>
<xsl:if test="descendant::t:lang/text()">
<span class="tei-label">
<xsl:value-of select="local:expand-lang(descendant::t:lang[1]/text(),'lawd:Edition')"/>:
</span>
</xsl:if>
<span>
<xsl:sequence select="local:attributes(.)"/>
<xsl:if test="t:idno">
<span class="footnote idno">
<xsl:value-of select="t:idno"/>
</span>
</xsl:if>
<xsl:call-template name="footnote"/>
<xsl:if test="t:listRelation/t:relation">
<xsl:variable name="parent" select="/"/>
<xsl:variable name="bibl-type" select="local:translate-label(string(@type),0)"/>
<xsl:for-each select="t:listRelation/t:relation[not(@ref='lawd:embodies')]">
<!-- List all bibs grouped by type to get correct position for constructed relationship sentance. -->
<xsl:variable name="all-bibs">
<bibs xmlns="http://www.tei-c.org/ns/1.0">
<xsl:for-each-group select="ancestor::t:bibl[@type='lawd:ConceptualWork']/t:bibl" group-by="@type">
<bibList>
<xsl:for-each select="current-group()">
<bibl bibid="{@xml:id}" position="{position()}" type="{local:translate-label(string(current-grouping-key()),count(current-group()))}" ref="{string-join(child::t:ptr[1]/@target,' ')}"/>
</xsl:for-each>
</bibList>
</xsl:for-each-group>
</bibs>
</xsl:variable>
<!-- Get related bibs based on @passive -->
<xsl:variable name="bibl-rel">
<xsl:choose>
<xsl:when test="@ref='lawd:hasCitation'">
<bib-relations xmlns="http://www.tei-c.org/ns/1.0">
<xsl:for-each select="tokenize(@active,' ')">
<xsl:choose>
<xsl:when test="contains(.,'#')">
<xsl:variable name="bibl-id" select="replace(.,'#','')"/>
<xsl:for-each select="$all-bibs/descendant::t:bibl[@bibid = $bibl-id]">
<xsl:copy-of select="."/>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="bibl-id" select="."/>
<xsl:for-each select="$all-bibs/descendant::t:bibl[@ref = $bibl-id]">
<xsl:copy-of select="."/>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</bib-relations>
</xsl:when>
<xsl:otherwise>
<bib-relations xmlns="http://www.tei-c.org/ns/1.0">
<xsl:for-each select="tokenize(@passive,' ')">
<xsl:choose>
<xsl:when test="contains(.,'#')">
<xsl:variable name="bibl-id" select="replace(.,'#','')"/>
<xsl:for-each select="$all-bibs/descendant::t:bibl[@bibid = $bibl-id]">
<xsl:copy-of select="."/>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="bibl-id" select="."/>
<xsl:for-each select="$all-bibs/descendant::t:bibl[@ref = $bibl-id]">
<xsl:copy-of select="."/>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</bib-relations>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Compile sentance -->
<xsl:text> (</xsl:text>
<xsl:value-of select="$bibl-type"/>
<xsl:choose>
<xsl:when test="@ref='lawd:hasCitation'">
<xsl:text> cites </xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text> based on </xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:for-each-group select="$bibl-rel/descendant-or-self::t:bibl" group-by="@type">
<xsl:copy-of select="current-group()"/>
<xsl:if test="current-grouping-key() != 'ref'">
<xsl:value-of select="current-grouping-key()"/>
</xsl:if>
<xsl:for-each select="current-group()">
<xsl:text> </xsl:text>
<xsl:value-of select="string(@position)"/>
<xsl:if test="not(position()=last())">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:for-each-group>
<xsl:text>.)</xsl:text>
<xsl:if test="t:desc">
<xsl:text> [</xsl:text>
<xsl:value-of select="t:desc"/>
<xsl:text>]</xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:if>
</span>
</li>
</xsl:when>
<xsl:when test="parent::t:note">
<xsl:choose>
<xsl:when test="t:ptr[contains(@target,'/work/')]">
<a href="{t:ptr/@target}">
<xsl:apply-templates mode="inline"/>
</a>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="footnote"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="child::*">
<xsl:apply-templates mode="footnote"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- suppress biblScope in title mode -->
<xsl:template match="t:biblScope"/>
<xsl:template match="preferredCitation">
<xsl:apply-templates select="." mode="bibliography"/>.
</xsl:template>
<xsl:template match="t:biblStruct">
<xsl:choose>
<xsl:when test="parent::t:body">
<div class="content-block preferred-citation">
<h2>Preferred Citation</h2>
<div class="indent citation">
<xsl:apply-templates select="parent::t:body/t:bibl[@subtype='citation']" mode="preferredCitation"/>
</div>
</div>
<h3>Full Citation Information</h3>
<div class="section indent">
<h4>Permanent Identifiers</h4>
<div class="indent">
<xsl:apply-templates select="descendant::t:idno" mode="full"/>
</div>
<bdi>
<xsl:apply-templates mode="full"/>
</bdi>
</div>
<div class="info-btns">
<xsl:variable name="status" select="string(/descendant-or-self::t:revisionDesc/@status)"/>
<xsl:if test="$status != ''">
<span class="rec-status {$status} btn btn-info">Status: <xsl:value-of select="$status"/></span>
</xsl:if>
<!-- Button trigger corrections email modal -->
<button class="btn btn-info" data-toggle="modal" data-target="#feedback">Corrections/Additions?</button>
<a href="#" class="btn btn-info" data-toggle="modal" data-target="#selection" data-ref="../documentation/faq.html" id="showSection">
Is this record complete?
</a>
</div>
</xsl:when>
<xsl:otherwise>
<span class="section indent">
<xsl:apply-templates mode="footnote"/>
</span>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- C -->
<xsl:template name="citationInfo">
<xsl:param name="idno"/>
<div class="citationinfo">
<h3>How to Cite This Entry</h3>
<div id="citation-note" class="content-block indent">
<xsl:apply-templates select="descendant-or-self::t:teiHeader/t:fileDesc/t:titleStmt" mode="cite-foot"/>
<div class="collapse" id="showcit">
<div id="citation-bibliography">
<h4>Bibliography:</h4>
<xsl:apply-templates select="descendant-or-self::t:teiHeader/t:fileDesc/t:titleStmt" mode="cite-biblist"/>
</div>
<xsl:call-template name="aboutEntry"/>
<div id="license">
<h3>Copyright and License for Reuse</h3>
<div>
<xsl:text>Except otherwise noted, this page is © </xsl:text>
<xsl:choose>
<xsl:when test="descendant-or-self::t:teiHeader/t:fileDesc/t:publicationStmt/t:date[1]/text() castable as xs:date">
<xsl:value-of select="format-date(xs:date(//t:teiHeader/t:fileDesc/t:publicationStmt/t:date[1]), '[Y]')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="descendant-or-self::t:teiHeader/t:fileDesc/t:publicationStmt/t:date[1]"/>
</xsl:otherwise>
</xsl:choose>.
</div>
<xsl:apply-templates select="descendant-or-self::t:teiHeader/t:fileDesc/t:publicationStmt/t:availability/t:licence"/>
</div>
</div>
<a class="togglelink pull-right btn-link" data-toggle="collapse" data-target="#showcit" data-text-swap="Hide citation">Show full citation information...</a>
</div>
</div>
</xsl:template>
<!-- L -->
<xsl:template match="t:location">
<xsl:choose>
<xsl:when test=".[@type='geopolitical' or @type='relative']">
<li>
<xsl:choose>
<xsl:when test="@subtype='quote'">"<xsl:apply-templates/>"</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
<xsl:sequence select="local:add-footnotes(@source,.)"/>
</li>
</xsl:when>
<xsl:when test="@type='nested'">
<li>Within
<xsl:for-each select="t:*">
<xsl:apply-templates select="."/>
<xsl:if test="following-sibling::t:*">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:for-each>
<xsl:text>.</xsl:text>
<xsl:sequence select="local:add-footnotes(@source,.)"/>
</li>
</xsl:when>
<xsl:when test=".[@type='gps' and t:geo]">
<li>Coordinates
<xsl:if test="@subtype != ''">
<xsl:value-of select="concat(' (',@subtype,')')"/>
</xsl:if>:
<ul class="unstyled offset1">
<li>
<xsl:value-of select="concat('Lat. ',tokenize(t:geo,' ')[1],'°')"/>
<xsl:text> </xsl:text>
<xsl:value-of select="concat('Long. ',tokenize(t:geo,' ')[2],'°')"/>
<xsl:sequence select="local:add-footnotes(@source,.)"/>
</li>
</ul>
</li>
</xsl:when>
</xsl:choose>
</xsl:template>
<xsl:template name="link-icons-list">
<xsl:param name="title"/>
<xsl:if test="descendant::t:idno[@type='URI'][not(starts-with(.,$base-uri))]">
<div id="see-also" class="see-also content-block">
<h3>See Also</h3>
<ul>
<xsl:for-each select="//t:idno[contains(.,'csc.org.il')]">
<li>
<a href="{normalize-space(.)}"> "
<xsl:value-of select="substring-before(substring-after(normalize-space(.),'sK='),'&sT=')"/>" in the Comprehensive Bibliography on Syriac Christianity</a>
</li>
</xsl:for-each>
<!-- WorldCat Identities -->
<xsl:for-each select="//t:idno[contains(.,'http://worldcat.org/identities')]">
<li>
<a href="{normalize-space(.)}"> "<xsl:value-of select="substring-after(.,'http://worldcat.org/identities/')"/>" in WorldCat Identities</a>
</li>
</xsl:for-each>
<!-- VIAF -->
<xsl:for-each select="//t:idno[contains(.,'http://viaf.org/')]">
<li>
<a href="{normalize-space(.)}">VIAF</a>
</li>
</xsl:for-each>
<!-- Pleiades links -->
<xsl:for-each select="//t:idno[contains(.,'pleiades')]">
<li>
<a href="{normalize-space(.)}">
<img src="../../resources/images/circle-pi-25.png" alt="Image of the Greek letter pi in blue; small icon of the Pleiades project" title="click to view {$title} in Pleiades"/> View in Pleiades</a>
</li>
</xsl:for-each>
<!-- Google map links -->
<xsl:for-each select="//descendant::t:location[@type='gps']/t:geo">
<li>
<xsl:variable name="geoRef">
<xsl:variable name="coords" select="tokenize(normalize-space(.), '\s+')"/>
<xsl:value-of select="$coords[1]"/>
<xsl:text>, </xsl:text>
<xsl:value-of select="$coords[2]"/>
</xsl:variable>
<a href="https://maps.google.com/maps?q={$geoRef}+(name)&z=10&ll={$geoRef}">
<img src="../../resources/images/gmaps-25.png" alt="The Google Maps icon" title="click to view {$title} on Google Maps"/> View in Google Maps
</a>
</li>
</xsl:for-each>
<!-- Wikipedia links -->
<xsl:for-each select="//t:idno[contains(.,'wikipedia')]">
<xsl:variable name="get-title">
<xsl:value-of select="replace(tokenize(.,'/')[last()],'_',' ')"/>
</xsl:variable>
<li>
<a href="{.}">
<img src="../resources/images/Wikipedia-25.png" alt="The Wikipedia icon" title="click to view {$get-title} in Wikipedia"/> "<xsl:value-of select="$get-title"/>" in Wikipedia</a>
</li>
</xsl:for-each>
</ul>
</div>
</xsl:if>
</xsl:template>
<!-- N -->
<xsl:template match="t:note">
<xsl:variable name="xmlid" select="@xml:id"/>
<xsl:choose>
<xsl:when test="ancestor::t:choice">
<xsl:text> (</xsl:text>
<span>
<xsl:sequence select="local:attributes(.)"/>
<xsl:apply-templates/>
</span>
<xsl:text>) </xsl:text>
<xsl:sequence select="local:add-footnotes(@source,.)"/>
</xsl:when>
<!-- Adds definition list for depreciated names -->
<xsl:when test="@type='deprecation'">
<div class="tei-note">
<span>
<xsl:if test="../t:link[contains(@target,$xmlid)]">
<xsl:apply-templates select="../t:link[contains(@target,$xmlid)]"/>:
</xsl:if>
<xsl:apply-templates/>
<!-- Check for ending punctuation, if none, add . -->
<!-- NOTE not working -->
</span>
<xsl:sequence select="local:add-footnotes(@source,.)"/>
</div>
</xsl:when>
<xsl:when test="@type='ancientVersion'">
<div class="tei-note">
<xsl:if test="descendant::t:lang/text()">
<span class="srp-label">
<xsl:value-of select="local:expand-lang(descendant::t:lang[1]/text(),'ancientVersion')"/>:
</span>
</xsl:if>
<span>
<xsl:sequence select="local:attributes(.)"/>
<xsl:apply-templates/>
</span>
<xsl:sequence select="local:add-footnotes(@source,.)"/>
</div>
</xsl:when>
<xsl:when test="@type='modernTranslation'">
<li>
<xsl:if test="descendant::t:lang/text()">
<span class="srp-label">
<xsl:value-of select="local:expand-lang(descendant::t:lang[1]/text(),'modernTranslation')"/>:
</span>
</xsl:if>
<span>
<xsl:sequence select="local:attributes(.)"/>
<xsl:apply-templates/>
</span>
<xsl:sequence select="local:add-footnotes(@source,.)"/>
</li>
</xsl:when>
<xsl:when test="@type='editions'">
<div class="tei-note">
<span>
<xsl:sequence select="local:attributes(.)"/>
<xsl:apply-templates/>
<xsl:if test="t:bibl/@corresp">
<xsl:variable name="mss" select="../t:note[@type='MSS']"/>
<xsl:text> (</xsl:text>
<xsl:choose>
<xsl:when test="@ana='partialTranslation'">Partial edition</xsl:when>
<xsl:otherwise>Edition</xsl:otherwise>
</xsl:choose>
<xsl:text> from manuscript </xsl:text>
<xsl:choose>
<xsl:when test="contains(t:bibl/@corresp,' ')">
<xsl:text>witnesses </xsl:text>
<xsl:for-each select="tokenize(t:bibl/@corresp,' ')">
<xsl:variable name="corresp" select="."/>
<xsl:for-each select="$mss/t:bibl">
<xsl:if test="@xml:id = $corresp">
<xsl:value-of select="position()"/>
</xsl:if>
</xsl:for-each>
<xsl:if test="position() != last()">, </xsl:if>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="corresp" select="substring-after(t:bibl/@corresp,'#')"/>
<xsl:text>witness </xsl:text>
<xsl:for-each select="$mss/t:bibl">
<xsl:if test="@xml:id = $corresp">
<xsl:value-of select="position()"/>
</xsl:if>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
<xsl:text>. See below.)</xsl:text>
</xsl:if>
</span>
<xsl:sequence select="local:add-footnotes(@source,.)"/>
</div>
</xsl:when>
<xsl:otherwise>
<div class="tei-note">
<xsl:choose>
<xsl:when test="t:quote">
<xsl:apply-templates/>
</xsl:when>
<xsl:otherwise>
<span>
<xsl:sequence select="local:attributes(.)"/>
<xsl:apply-templates/>
<!-- Check for ending punctuation, if none, add . -->
<!-- Do not have this working -->
</span>
</xsl:otherwise>
</xsl:choose>
<xsl:sequence select="local:add-footnotes(@source,.)"/>
</div>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- P -->
<!-- Main page modules for syriaca.org display -->
<xsl:template match="t:person | t:personGrp">
<xsl:if test="t:desc[@type='abstract'] | t:desc[starts-with(@xml:id, 'abstract-en')] | t:note[@type='abstract']">
<xsl:choose>
<xsl:when test="$collection = 'johnofephesusPersons'">
<xsl:if test="t:note[@type='abstract'][contains(@corresp,'http://syriaca.org/johnofephesus/persons')]">
<div class="tei-desc text abstract">
<xsl:apply-templates select="t:note[@type='abstract'][contains(@corresp,'http://syriaca.org/johnofephesus/persons')]"/>
</div>
</xsl:if>
</xsl:when>
<xsl:when test="t:note[@type='abstract'][contains(@corresp,'http://syriaca.org/persons')]">
<div class="tei-desc text abstract">
<xsl:apply-templates select="t:note[@type='abstract'][contains(@corresp,'http://syriaca.org/persons')]"/>
</div>
</xsl:when>
<xsl:otherwise>
<div class="tei-desc text abstract">
<xsl:apply-templates select="t:desc[@type='abstract' or starts-with(@xml:id, 'abstract-en')][1] | t:note[@type='abstract'][1]"/>
</div>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
<xsl:if test="t:persName[not(empty(descendant-or-self::text()))]">
<h3>Names</h3>
<ul class="persNames">
<xsl:apply-templates select="t:persName[@srophe:tags='#syriaca-headword' and starts-with(@xml:lang,'syr')]" mode="list">
<xsl:sort lang="syr" select="."/>
</xsl:apply-templates>
<xsl:apply-templates select="t:persName[@srophe:tags='#syriaca-headword' and starts-with(@xml:lang,'en')]" mode="list">
<xsl:sort collation="{$mixed}" select="."/>
</xsl:apply-templates>
<xsl:apply-templates select="t:persName[(not(@srophe:tags) or @srophe:tags!='#syriaca-headword') and starts-with(@xml:lang, 'syr')]" mode="list">
<xsl:sort lang="syr" select="."/>
</xsl:apply-templates>
<xsl:apply-templates select="t:persName[starts-with(@xml:lang, 'ar')]" mode="list">
<xsl:sort lang="ar" select="."/>
</xsl:apply-templates>
<xsl:apply-templates select="t:persName[(not(@srophe:tags) or @srophe:tags!='#syriaca-headword') and not(starts-with(@xml:lang, 'syr') or starts-with(@xml:lang, 'ar')) and not(@srophe:tags='#syriaca-simplified-script')]" mode="list">
<xsl:sort collation="{$mixed}" select="."/>
</xsl:apply-templates>
</ul>
</xsl:if>
<xsl:apply-templates select="t:sex | t:gender| t:death | t:birth | t:floruit"/>
<!-- Work in progress
<xsl:if test="t:state">
<xsl:for-each-group select="//t:state[not(@when) and not(@notBefore) and not(@notAfter) and not(@to) and not(@from)]" group-by="@type">
<h4>
<xsl:value-of select="concat(upper-case(substring(current-grouping-key(),1,1)),substring(current-grouping-key(),2))"/>
</h4>
<ul>
<xsl:for-each select="current-group()[not(t:desc/@xml:lang = 'en-x-gedsh')]">
<li>
<xsl:apply-templates mode="plain"/>
<xsl:sequence select="local:add-footnotes(self::*/@source,.)"/>
</li>
</xsl:for-each>
</ul>
</xsl:for-each-group>
</xsl:if>
-->
<xsl:if test="not(empty(t:desc[not(starts-with(@xml:id,'abstract'))][1])) or not(empty(t:note[@type='description'][1]))">
<h3>Descriptions</h3>
<xsl:for-each-group select="t:desc[not(starts-with(@xml:id,'abstract'))] | t:note[@type='description']" group-by="if (contains(@xml:lang, '-')=true()) then substring-before(@xml:lang, '-') else @xml:lang">
<xsl:sort collation="{$languages}" select="if (contains(@xml:lang, '-')=true()) then substring-before(@xml:lang, '-') else @xml:lang"/>
<xsl:for-each select="current-group()">
<xsl:sort lang="{current-grouping-key()}" select="normalize-space(.)"/>
<div class="tei-desc text">
<xsl:apply-templates select="."/>
</div>
</xsl:for-each>
</xsl:for-each-group>
</xsl:if>
<!-- Events -->
<xsl:if test="t:event[not(@type='attestation')]">
<div id="event">
<h3>Event<xsl:if test="count(t:event[not(@type='attestation')]) > 1">s</xsl:if>
</h3>
<div class="text-block">
<xsl:for-each select="t:event[not(@type='attestation')]">
<xsl:sort select="if(exists(@notBefore)) then @notBefore else @when"/>
<span class="text-block">
<xsl:apply-templates select="."/>
</span>
</xsl:for-each>
</div>
</div>
</xsl:if>
<!-- Events/attestation -->
<xsl:if test="t:event[@type='attestation']">
<div id="attestation">
<h3>Attestation<xsl:if test="count(t:event[@type='attestation']) > 1">s</xsl:if></h3>
<div class="text-block">
<!-- Sorts events on dates, checks first for @notBefore and if not present, uses @when -->
<xsl:for-each select="t:event[@type='attestation']">
<xsl:sort select="if(exists(@notBefore)) then @notBefore else @when"/>
<span class="text-block">
<xsl:apply-templates select="."/>
</span>
</xsl:for-each>
</div>
</div>
</xsl:if>
<xsl:if test="not(empty(t:note[not(@type='description')][1]))">
<xsl:choose>
<xsl:when test="$collection = 'johnofephesusPersons'">
<xsl:if test="t:note[not(@type='abstract')][not(@type='description')][contains(@corresp,'http://syriaca.org/johnofephesus/persons')]">
<h3>Notes</h3>
<xsl:apply-templates select="t:note[not(@type='abstract')][not(@type='description')][not(contains(@corresp,'http://syriaca.org/johnofephesus/persons'))]"/>
</xsl:if>
</xsl:when>
<xsl:when test="t:note[not(@type='abstract')][contains(@corresp,'http://syriaca.org/persons')]">
<h3>Notes</h3>
<xsl:apply-templates select="t:note[not(@type='abstract')][not(@type='description')][not(contains(@corresp,'http://syriaca.org/persons'))]"/>
</xsl:when>
<xsl:otherwise>
<h3>Notes</h3>
<xsl:apply-templates select="t:note[not(@type='abstract')][not(@type='description')]"/>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
<div class="info-btns">
<xsl:variable name="status" select="string(/descendant-or-self::t:revisionDesc/@status)"/>
<xsl:if test="$status != ''">
<span class="rec-status {$status} btn btn-info">Status: <xsl:value-of select="$status"/></span>
</xsl:if>
<!-- Button trigger corrections email modal -->
<button class="btn btn-info" data-toggle="modal" data-target="#feedback">Corrections/Additions?</button>
<a href="#" class="btn btn-info" data-toggle="modal" data-target="#selection" data-ref="../documentation/faq.html" id="showSection">
Is this record complete?
</a>
</div>
<!-- Build see also -->
<xsl:call-template name="link-icons-list">
<xsl:with-param name="title">
<xsl:value-of select="//t:teiHeader/descendant::t:titleStmt/t:title[1]"/>
</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="sources"/>
</xsl:template>
<xsl:template match="t:place">
<xsl:if test="t:desc[@type='abstract'] | t:desc[starts-with(@xml:id, 'abstract-en')] | t:note[@type='abstract']">
<xsl:choose>
<xsl:when test="$collection = 'johnofephesusPlace'">
<xsl:if test="t:note[@type='abstract'][contains(@corresp,'http://syriaca.org/johnofephesus/places')]">
<div class="tei-desc text abstract">
<xsl:apply-templates select="t:note[@type='abstract'][contains(@corresp,'http://syriaca.org/johnofephesus/places')]"/>
</div>
</xsl:if>
</xsl:when>
<xsl:when test="t:note[@type='abstract'][contains(@corresp,'http://syriaca.org/places')]">
<div class="tei-desc text abstract">
<xsl:apply-templates select="t:note[@type='abstract'][contains(@corresp,'http://syriaca.org/places')]"/>
</div>
</xsl:when>
<xsl:otherwise>
<div class="tei-desc text abstract">
<xsl:apply-templates select="t:desc[@type='abstract' or starts-with(@xml:id, 'abstract-en')][1] | t:note[@type='abstract'][1]"/>
</div>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
<xsl:if test="t:placeName">
<div id="placenames" class="content-block">
<h3>Names</h3>
<ul>
<xsl:apply-templates select="t:placeName[@srophe:tags='#syriaca-headword' and @xml:lang='syr']" mode="list">
<xsl:sort lang="syr" select="."/>
</xsl:apply-templates>
<xsl:apply-templates select="t:placeName[@srophe:tags='#syriaca-headword' and @xml:lang='en']" mode="list">
<xsl:sort collation="{$mixed}" select="."/>
</xsl:apply-templates>
<xsl:apply-templates select="t:placeName[(not(@srophe:tags) or @srophe:tags!='#syriaca-headword') and starts-with(@xml:lang, 'syr')]" mode="list">
<xsl:sort lang="syr" select="."/>
</xsl:apply-templates>
<xsl:apply-templates select="t:placeName[starts-with(@xml:lang, 'ar')]" mode="list">
<xsl:sort lang="ar" select="."/>
</xsl:apply-templates>
<xsl:apply-templates select="t:placeName[(not(@srophe:tags) or @srophe:tags!='#syriaca-headword') and not(starts-with(@xml:lang, 'syr') or starts-with(@xml:lang, 'ar')) and not(@syriaca-tags='#syriaca-simplified-script')]" mode="list">
<xsl:sort collation="{$mixed}" select="."/>
</xsl:apply-templates>
</ul>
</div>
</xsl:if>
<div class="content-block">
<h3>Place Type</h3>
<p class="text-block">
<xsl:value-of select="@type"/>
</p>
</div>
<xsl:if test="t:location">
<div id="placenames" class="content-block">
<h3>Location</h3>
<ul>
<xsl:apply-templates select="t:location"/>
</ul>
</div>
</xsl:if>
<xsl:if test="not(empty(t:desc[not(starts-with(@xml:id,'abstract'))][1])) or not(empty(t:note[@type='description'][1]))">
<h3>Descriptions</h3>
<xsl:for-each-group select="t:desc[not(starts-with(@xml:id,'abstract'))] | t:note[@type='description']" group-by="if (contains(@xml:lang, '-')=true()) then substring-before(@xml:lang, '-') else @xml:lang">
<xsl:sort collation="{$languages}" select="if (contains(@xml:lang, '-')=true()) then substring-before(@xml:lang, '-') else @xml:lang"/>
<xsl:for-each select="current-group()">
<xsl:sort lang="{current-grouping-key()}" select="normalize-space(.)"/>
<div class="tei-desc text">
<xsl:apply-templates select="."/>
</div>
</xsl:for-each>
</xsl:for-each-group>
</xsl:if>
<xsl:if test="t:state[. != '']">
<xsl:for-each-group select="//t:state[not(@when) and not(@notBefore) and not(@notAfter) and not(@to) and not(@from)]" group-by="@type">
<h3><xsl:value-of select="concat(upper-case(substring(current-grouping-key(),1,1)),substring(current-grouping-key(),2))"/></h3>
<ul>
<xsl:for-each select="current-group()[not(t:desc/@xml:lang = 'en-x-gedsh')]">
<li>
<xsl:apply-templates mode="plain"/>
<xsl:sequence select="local:add-footnotes(self::*/@source,.)"/>
</li>
</xsl:for-each>
</ul>
</xsl:for-each-group>
</xsl:if>
<!-- Events -->
<xsl:if test="t:event[not(@type='attestation')]">
<div id="event">
<h3>Event<xsl:if test="count(t:event[not(@type='attestation')]) > 1">s</xsl:if></h3>
<div class="text-block">
<xsl:for-each select="t:event[not(@type='attestation')]">
<xsl:sort select="if(exists(@notBefore)) then @notBefore else @when"/>
<span class="text-block">
<xsl:apply-templates select="."/>
</span>
</xsl:for-each>
</div>
</div>
</xsl:if>
<!-- Events/attestation -->
<xsl:if test="t:event[@type='attestation']">
<div id="attestation">
<h3>Attestation<xsl:if test="count(t:event[@type='attestation']) > 1">s</xsl:if></h3>
<div class="text-block">
<!-- Sorts events on dates, checks first for @notBefore and if not present, uses @when -->
<xsl:for-each select="t:event[@type='attestation']">
<xsl:sort select="if(exists(@notBefore)) then @notBefore else @when"/>
<span class="text-block">
<xsl:apply-templates select="."/>
</span>
</xsl:for-each>
</div>
</div>
</xsl:if>
<xsl:if test="not(empty(t:note[not(@type='description')][1]))">
<xsl:choose>
<xsl:when test="$collection = 'johnofephesusPlace'">
<xsl:if test="t:note[not(@type='abstract')][not(@type='description')][contains(@corresp,'http://syriaca.org/johnofephesus/places')]">
<h3>Notes</h3>
<xsl:apply-templates select="t:note[not(@type='abstract')][not(@type='description')][not(contains(@corresp,'http://syriaca.org/johnofephesus/places'))]"/>
</xsl:if>
</xsl:when>
<xsl:when test="t:note[not(@type='abstract')][not(@type='description')][contains(@corresp,'http://syriaca.org/places')]">
<h3>Notes</h3>
<xsl:apply-templates select="t:note[not(@type='abstract')][not(@type='description')][not(contains(@corresp,'http://syriaca.org/places'))]"/>
</xsl:when>
<xsl:otherwise>
<h3>Notes</h3>
<xsl:apply-templates select="t:note[not(@type='abstract')][not(@type='description')]"/>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
<!-- Confessions/Religious Communities -->
<xsl:if test="t:state[@type='confession'][parent::t:place]">
<div>
<h3>Known Religious Communities</h3>
<p class="caveat">
<em>This list is not necessarily exhaustive, and the order does not represent importance or proportion of the population. Dates do not represent starting or ending dates of a group's presence, but rather when they are attested. Instead, the list only represents groups for which Syriaca.org has source(s) and dates.</em>
</p>
<xsl:choose>
<xsl:when test="doc-available(concat($app-root,'/documentation/confessions.xml'))">
<xsl:call-template name="confessions">
<xsl:with-param name="confessionsDoc" select="doc(concat($app-root,'/documentation/confessions.xml'))"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<ul>
<xsl:for-each select="t:state[@type='confession']">
<li>
<xsl:apply-templates mode="plain"/>
</li>
</xsl:for-each>
</ul>
</xsl:otherwise>
</xsl:choose>
</div>
</xsl:if>
<div class="info-btns">
<xsl:variable name="status" select="string(/descendant-or-self::t:revisionDesc/@status)"/>
<xsl:if test="$status != ''">
<span class="rec-status {$status} btn btn-info">Status: <xsl:value-of select="$status"/></span>
</xsl:if>
<!-- Button trigger corrections email modal -->
<button class="btn btn-info" data-toggle="modal" data-target="#feedback">Corrections/Additions?</button>
<a href="#" class="btn btn-info" data-toggle="modal" data-target="#selection" data-ref="../documentation/faq.html" id="showSection">
Is this record complete?
</a>
</div>
<!-- Build see also -->
<xsl:call-template name="link-icons-list">
<xsl:with-param name="title">
<xsl:value-of select="//t:teiHeader/descendant::t:titleStmt/t:title[1]"/>
</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="sources"/>
<!-- WS: Note, this was constructed by XQuery, will need to pull it in another way -->
<!--
<xsl:if test="t:nested-place">
<div id="contents">
<h3>Contains</h3>
<ul>
<xsl:for-each select="/child::*/t:nested-place">
<xsl:sort collation="{$mixed}" select="t:placeName[@xml:lang='en'][1]/@reg"/>
<li>
<a href="{concat('/place/',@id,'.html')}">
<xsl:value-of select="."/>
<xsl:value-of select="concat(' (',@type,')')"/>
</a>
</li>
</xsl:for-each>
</ul>
</div>
</xsl:if>
-->
</xsl:template>
<xsl:template match="t:bibl[starts-with(@xml:id,'work-')]">
<div class="content-block">
<h3>Titles</h3>
<ul>
<xsl:for-each select="t:title[(not(@type) or not(@type=('initial-rubric','final-rubric','abbreviation'))) and not(@syriaca-tags='#syriaca-simplified-script')]">
<xsl:apply-templates select=".[contains(@srophe:tags,'#syriaca-headword') and starts-with(@xml:lang,'en')]" mode="list">
<xsl:sort collation="{$mixed}" select="."/>
</xsl:apply-templates>
<xsl:apply-templates select=".[contains(@srophe:tags,'#syriaca-headword') and starts-with(@xml:lang,'syr')]" mode="list">
<xsl:sort lang="syr" select="."/>
</xsl:apply-templates>
<xsl:apply-templates select=".[(not(@srophe:tags) or not(contains(@srophe:tags,'#syriaca-headword'))) and starts-with(@xml:lang, 'syr')]" mode="list">
<xsl:sort lang="syr" select="."/>
</xsl:apply-templates>
<xsl:apply-templates select=".[starts-with(@xml:lang, 'ar')]" mode="list">
<xsl:sort lang="ar" select="."/>
</xsl:apply-templates>
<xsl:apply-templates select=".[(not(@srophe:tags) or not(contains(@srophe:tags,'#syriaca-headword'))) and not(starts-with(@xml:lang, 'syr') or starts-with(@xml:lang, 'ar'))]" mode="list">
<xsl:sort collation="{$mixed}" select="."/>
</xsl:apply-templates>
</xsl:for-each>
</ul>
<xsl:if test="t:title[@type='abbreviation']">
<h3>Abbreviations</h3>
<ul>
<xsl:for-each select="t:title[@type='abbreviation']">
<xsl:apply-templates select="." mode="list"/>
</xsl:for-each>
</ul>
</xsl:if>
<xsl:if test="t:author | t:editor">
<h3>Authors</h3>