forked from fihristorg/fihrist-mss
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpreviewAuthorities.xsl
executable file
·143 lines (136 loc) · 6.86 KB
/
previewAuthorities.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
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:tei="http://www.tei-c.org/ns/1.0"
xmlns:xi="http://www.w3.org/2001/XInclude"
version="1.0">
<!-- Using XSLT 1.0 to allow viewing in web browsers that support client-side transformation: Firefox and Safari only
when the file is on local filesystem, Chrome on a web server that responds with XML MIME type (which is not the case
on raw.githubusercontent.com that serves everything as text/plain), possibly IE/Edge with some more work. -->
<xsl:variable name="website" select="'https://www.fihrist.org.uk'"/>
<xsl:template match="/">
<html>
<head>
<title>Authority file browser</title>
<style type="text/css">
body {
font-family: Helvetica, Arial, sans-serif;
background-color: #CCCCCC;
padding-top: 5px;
padding-left: 10px;
padding-right: 10px;
}
td {
vertical-align: top ! important;
}
th {
text-align: left ! important;
}
td.ids {
word-break: keep-all;
}</style>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css"/>
<script type="text/javascript" language="javascript" src="http://code.jquery.com/jquery-1.12.4.js"/>
<script type="text/javascript" language="javascript" src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"/>
<script type="text/javascript" class="init">
$(document).ready(
function() {
$('#onetable').DataTable(
{
scrollY: '80vh',
"lengthMenu": [[100, -1], [100, "All"]],
"columns": [
{ "searchable": true },
{ "searchable": true },
{ "searchable": false }
]
}
);
}
);
</script>
<base target="_blank"/>
</head>
<body>
<xsl:apply-templates select="/tei:TEI/tei:text/tei:body"/>
</body>
</html>
</xsl:template>
<xsl:template match="tei:body">
<table id="onetable" class="display">
<thead>
<tr>
<th width="15%">ID</th>
<th width="70%">Names</th>
<xsl:choose>
<xsl:when test="tei:listBibl or xi:include[contains(@href, 'work')]">
<th width="15%">Authors</th>
</xsl:when>
<xsl:otherwise>
<th width="15%">Sources</th>
</xsl:otherwise>
</xsl:choose>
</tr>
</thead>
<tbody>
<!-- Next line works with or without XInclude support enabled in the XSLT processor -->
<xsl:for-each select=".//*[@xml:id] | document(xi:include/@href)//*[@xml:id]">
<xsl:sort select="@xml:id"/>
<tr>
<td class="ids">
<a href="{ $website }/catalog/{ @xml:id }">
<xsl:value-of select="@xml:id"/>
</a>
</td>
<td>
<!-- Preferred form of the entry (e.g. person's name, work title, etc) -->
<xsl:value-of select="normalize-space(*[@type = 'display' or @type = 'uniform'])"/>
<!-- List of alternative forms/spellings, if any, which will be indexed but not displayed in the search results on the web site -->
<xsl:if test="*[@type = 'variant']">
<ul>
<xsl:for-each select="*[@type = 'variant']">
<li>
<xsl:value-of select="normalize-space(.)"/>
</li>
</xsl:for-each>
</ul>
</xsl:if>
</td>
<td>
<xsl:choose>
<xsl:when test="self::tei:bibl">
<ul>
<xsl:for-each select="tei:author">
<li>
<xsl:choose>
<xsl:when test="@key">
<a href="{ $website }/catalog/{ @key }">
<xsl:value-of select="string(.)"/>
</a>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="string(.)"/>
</xsl:otherwise>
</xsl:choose>
</li>
</xsl:for-each>
</ul>
</xsl:when>
<xsl:when test=".//tei:list[@type = 'links']">
<ul>
<xsl:for-each select=".//tei:list[@type = 'links']//tei:ref">
<li>
<a href="{@target}">
<xsl:value-of select="tei:title"/>
</a>
</li>
</xsl:for-each>
</ul>
</xsl:when>
</xsl:choose>
</td>
</tr>
</xsl:for-each>
</tbody>
</table>
</xsl:template>
</xsl:stylesheet>