-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpreviewAuthorities.xsl
executable file
·114 lines (107 loc) · 5.19 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
<?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="'http://armenian.bodleian.ox.ac.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": [[10, 25, 50, -1], [10, 25, 50, "All"]],
"columns": [
{ "searchable": true },
{ "searchable": true },
{ "searchable": false }
]
}
);
}
);
</script>
</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>
<th width="15%">Sources</th>
</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]">
<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:if 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:if>
</td>
</tr>
</xsl:for-each>
</tbody>
</table>
</xsl:template>
</xsl:stylesheet>