Project

General

Profile

1
<?xml version="1.0" encoding="UTF-8"?>
2

    
3
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
4
                xmlns:crm="http://www.cidoc-crm.org/cidoc-crm/"
5
                xmlns:dr="http://www.driver-repository.eu/namespace/dr"
6
                xmlns:dri="http://www.driver-repository.eu/namespace/dri"
7
                xmlns:dc="http://purl.org/dc/elements/1.1/"
8
                xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
9
                xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:foaf="http://xmlns.com/foaf/0.1/">
10

    
11
	<xsl:output method="html" encoding="UTF-8" indent="yes" omit-xml-declaration="yes"/>
12

    
13
	<xsl:template match="/">
14
		<div class="row">
15
			<div class="col-xs-2">
16
				<img src="../resources/img/record.png" width="80" height="80"/>
17
			</div>
18
			<div class="col-xs-10">
19
				<xsl:if test="//*[local-name() = 'title']">
20
					<h1 id="overview">
21
						<!-- this is visualized big next to the picture. Since we cannot identify 1 main title, for Parthenos it wil be empty -->
22
						<!--<xsl:value-of select="/crm:P102_has_title"/>-->
23
					</h1>
24
				</xsl:if>
25
			</div>
26
		</div>
27

    
28
		<div class="row">
29
			<div class="col-xs-12">
30
				<h6><span class="glyphicon glyphicon-align-left"/> GENERAL INFORMATION </h6>
31
				<table class="table">
32
					<tbody>
33
						<tr>
34
							<td class="col-xs-3">
35
								<strong>Original identifier</strong>
36
							</td>
37
							<td>
38
								<xsl:choose>
39
									<xsl:when test="starts-with(//dri:objIdentifier, 'http')">
40
										<a href="{//dri:recordIdentifier}" target="_blank"><xsl:value-of select="//dri:recordIdentifier"/></a>
41
									</xsl:when>
42
									<xsl:otherwise><xsl:value-of select="//dri:recordIdentifier"/></xsl:otherwise>
43
								</xsl:choose>
44

    
45
							</td>
46
						</tr>
47
						<tr>
48
							<td class="col-xs-3">
49
								<strong>Provenance</strong>
50
							</td>
51
							<td>
52
								<i>Data source: </i>
53
								<xsl:value-of select="//dri:datasourcename"/>
54
								<br/>
55
								<i>D-Net API: </i>
56
								<xsl:value-of select="//dri:datasourceapi"/>
57
							</td>
58
						</tr>
59
						<tr>
60
							<td class="col-xs-3">
61
								<strong>Collected</strong>
62
							</td>
63
							<td>
64
								<xsl:value-of select="//dri:dateOfCollection"/>
65
							</td>
66
						</tr>
67
						<tr>
68
							<td class="col-xs-3">
69
								<strong>Transformed</strong>
70
							</td>
71
							<td>
72
								<xsl:value-of select="//dri:dateOfTransformation"/>
73
							</td>
74
						</tr>
75
						<tr>
76
							<td class="col-xs-3">
77
								<strong>Resource types</strong>
78
							</td>
79
							<td>
80
								<xsl:for-each-group select="//rdf:Description"
81
								                    group-by="./rdf:type/@rdf:resource">
82
									<i><xsl:value-of
83
											select="tokenize(current-grouping-key(), '/')[last()]"
84
									/></i> (<xsl:value-of select="count(current-group())"/>) --
85
								</xsl:for-each-group>
86
							</td>
87
						</tr>
88
					</tbody>
89
				</table>
90
				<h6><span class="glyphicon glyphicon-align-left"/> MINIMAL METADATA </h6>
91
					<table class="table">
92
						<tbody>
93
							<xsl:for-each-group select="//rdf:Description"
94
							                    group-by="./rdf:type/@rdf:resource">
95
								<xsl:for-each select="current-group()">
96
									<xsl:apply-templates select="." mode="minimalMetadata"/>
97
								</xsl:for-each>
98
							</xsl:for-each-group>
99
						</tbody>
100
					</table>
101
			</div>
102
		</div>
103

    
104
		<xsl:for-each select="//*[local-name() = 'record']">
105
			<h6><span class="glyphicon glyphicon-wrench"/> INDEXED RECORD </h6>
106
			<xsl:call-template name="xmlItem">
107
				<xsl:with-param name="indent" select="string('')"/>
108
			</xsl:call-template>
109
		</xsl:for-each>
110
	</xsl:template>
111

    
112
<!--
113
	<xsl:template mode="minimalMetadata" match="rdf:Description[./rdf:type/@rdf:resource = 'http://www.cidoc-crm.org/cidoc-crm/E41_Appellation']" />
114
	<xsl:template mode="minimalMetadata" match="rdf:Description[./rdf:type/@rdf:resource = 'http://www.cidoc-crm.org/cidoc-crm/E35_Title']" />
115
	<xsl:template mode="minimalMetadata" match="rdf:Description[./rdf:type/@rdf:resource = 'http://www.cidoc-crm.org/cidoc-crm/E65_Creation']" />
116
	<xsl:template mode="minimalMetadata" match="rdf:Description[./rdf:type/@rdf:resource = 'http://www.cidoc-crm.org/cidoc-crm/E30_Right']" />
117
	<xsl:template mode="minimalMetadata" match="rdf:Description[./rdf:type/@rdf:resource = 'http://www.cidoc-crm.org/cidoc-crm/E52_Time-Span']" />
118
	<xsl:template mode="minimalMetadata" match="rdf:Description[./rdf:type/@rdf:resource = 'http://www.cidoc-crm.org/cidoc-crm/E51_Contact_Point']" />
119
	<xsl:template mode="minimalMetadata" match="rdf:Description[./rdf:type/@rdf:resource = 'http://www.cidoc-crm.org/cidoc-crm/E45_Address']" />
120
	<xsl:template mode="minimalMetadata" match="rdf:Description[./rdf:type/@rdf:resource = 'http://www.ics.forth.gr/isl/CRMext/CRMpe.rdfs/PE29_Access_Point']" />
121
	-->
122
	<xsl:template mode="minimalMetadata" match="text()" />
123

    
124
	<!--http://parthenos.d4science.org/CRMext/CRMpe.rdfs/PE22_Persistent_Dataset-->
125
	<xsl:template mode="minimalMetadata"
126
			match="rdf:Description[./rdf:type/@rdf:resource = 'http://www.ics.forth.gr/isl/CRMext/CRMpe.rdfs/PE22_Persistent_Dataset']">
127
		<br/>
128
		<tr>
129
			<td>
130
				<strong>PE22_Persistent_Dataset</strong> : <strong><xsl:value-of select="./@rdf:about"/></strong><br/>
131

    
132
				<xsl:call-template name="printProperty">
133
					<xsl:with-param name="propertyName">P1_is_identified_by</xsl:with-param>
134
					<xsl:with-param name="propertyValue">
135
						<xsl:value-of select="./crm:P1_is_identified_by/@rdf:resource"/>
136
					</xsl:with-param>
137
				</xsl:call-template>
138
				<br/>
139
				<xsl:call-template name="printProperty">
140
					<xsl:with-param name="propertyName">P102_has_title</xsl:with-param>
141
					<xsl:with-param name="propertyValue">
142
						<xsl:value-of
143
								select="//rdf:Description[@rdf:about = ./crm:P102_has_title/@rdf:resource]/rdfs:label"
144
						/>
145
					</xsl:with-param>
146
				</xsl:call-template>
147
				<br/>
148
				<xsl:call-template name="printProperty">
149
					<xsl:with-param name="propertyName">P2_has_type</xsl:with-param>
150
					<xsl:with-param name="propertyValue">
151
						<xsl:value-of
152
								select="//rdf:Description[@rdf:about = ./crm:P2_has_type/@rdf:resource]/rdfs:label"
153
						/>
154
					</xsl:with-param>
155
				</xsl:call-template>
156
				<br/>
157
				<xsl:call-template name="printProperty">
158
					<xsl:with-param name="propertyName">P3_has_note</xsl:with-param>
159
					<xsl:with-param name="propertyValue">
160
						<xsl:value-of select="./crm:P3_has_note"/>
161
					</xsl:with-param>
162
				</xsl:call-template>
163
				<br/>
164
				<xsl:call-template name="printProperty">
165
					<xsl:with-param name="propertyName">P129_is_about</xsl:with-param>
166
					<xsl:with-param name="propertyValue">
167
						<xsl:value-of select="./crm:P129_is_about/@rdf:resource"/>
168
					</xsl:with-param>
169
				</xsl:call-template>
170
				<br/>
171
				<xsl:call-template name="printProperty">
172
					<xsl:with-param name="propertyName">P67_refers_to</xsl:with-param>
173
					<xsl:with-param name="propertyValue">
174
						<xsl:value-of select="./crm:P67_refers_to/@rdf:resource"/>
175
					</xsl:with-param>
176
				</xsl:call-template>
177
				<br/>
178
				<xsl:call-template name="printProperty">
179
					<xsl:with-param name="propertyName">PP8i_is_dataset_hosted_by</xsl:with-param>
180
					<xsl:with-param name="propertyValue">
181
						<xsl:value-of select="./crm:PP8i_is_dataset_hosted_by/@rdf:resource"/>
182
					</xsl:with-param>
183
				</xsl:call-template>
184
				<br/>
185
				<xsl:call-template name="printProperty">
186
					<xsl:with-param name="propertyName"
187
					>PP6i_is_digital_object_hosted_by</xsl:with-param>
188
					<xsl:with-param name="propertyValue">
189
						<xsl:value-of select="./crm:PP6i_is_digital_object_hosted_by/@rdf:resource"/>
190
					</xsl:with-param>
191
				</xsl:call-template>
192
				<br/>
193
				<xsl:call-template name="printProperty">
194
					<xsl:with-param name="propertyName">PP4i_is_object_hosted_by</xsl:with-param>
195
					<xsl:with-param name="propertyValue">
196
						<xsl:value-of select="./crm:PP4i_is_object_hosted_by/@rdf:resource"/>
197
					</xsl:with-param>
198
				</xsl:call-template>
199
			</td>
200
		</tr>
201

    
202
	</xsl:template>
203

    
204
	<xsl:template name="printProperty">
205
		<xsl:param name="propertyName"/>
206
		<xsl:param name="propertyValue"/>
207
		<xsl:value-of select="concat($propertyName, ' : ', $propertyValue)"/>
208
	</xsl:template>
209

    
210
	<xsl:template name="xmlAttr">
211
		<span style="color:orange">
212
			<xsl:value-of select="concat(' ', local-name())"/>
213
		</span>
214
		<xsl:value-of select="concat('=&quot;', ., '&quot;')"/>
215
	</xsl:template>
216

    
217

    
218
	<xsl:template name="xmlItem">
219
		<xsl:param name="indent"/>
220
		<xsl:variable name="tag" select="name()"/>
221
		<xsl:variable name="newindent"><xsl:value-of select="$indent"/>&#160;&#160;&#160;&#160; </xsl:variable>
222

    
223
		<xsl:if test="string-length($tag)">
224
			<br/>
225
			<xsl:value-of select="$indent"/>
226
			<span style="color:blue">
227
				<xsl:value-of select="concat('&lt;', $tag)"/>
228
			</span>
229
			<xsl:for-each select="@*">
230
				<xsl:call-template name="xmlAttr"/>
231
			</xsl:for-each>
232
			<xsl:choose>
233
				<xsl:when test="count(child::*) = 0 and count(child::text()) = 1">
234
					<span style="color:blue">&gt;</span>
235
					<xsl:value-of select="normalize-space(.)"/>
236
					<span style="color:blue">
237
						<xsl:value-of select="concat('&lt;/', $tag, '&gt;')"/>
238
					</span>
239
				</xsl:when>
240
				<xsl:when test="count(child::* | child::text()) &gt; 0">
241
					<span style="color:blue">&gt;</span>
242
					<xsl:for-each select="child::* | child::text()">
243
						<xsl:choose>
244
							<xsl:when
245
									test="self::text() and string-length(normalize-space(.)) &gt; 0">
246
								<xsl:value-of select="normalize-space(.)"/>
247
							</xsl:when>
248
							<xsl:otherwise>
249
								<xsl:call-template name="xmlItem">
250
									<xsl:with-param name="indent" select="$newindent"/>
251
								</xsl:call-template>
252
							</xsl:otherwise>
253
						</xsl:choose>
254
					</xsl:for-each>
255
					<br/>
256
					<xsl:value-of select="$indent"/>
257
					<span style="color:blue">
258
						<xsl:value-of select="concat('&lt;/', $tag, '&gt;')"/>
259
					</span>
260
				</xsl:when>
261
				<xsl:otherwise>
262
					<span style="color:blue">&#160;/&gt;</span>
263
				</xsl:otherwise>
264
			</xsl:choose>
265
		</xsl:if>
266
	</xsl:template>
267

    
268
	<!--
269
        Suppress warning messages "The source document is in no namespace, but the template rules
270
        all expect elements in a namespace" (see https://github.com/daisy/pipeline-mod-braille/issues/38)
271
    -->
272
	<xsl:template match="/phony">
273
		<xsl:next-match/>
274
	</xsl:template>
275

    
276

    
277
</xsl:stylesheet>
(1-1/2)