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

    
96
		<xsl:for-each select="//*[local-name() = 'record']">
97
			<h6><span class="glyphicon glyphicon-wrench"/> INDEXED RECORD </h6>
98
			<xsl:call-template name="xmlItem">
99
				<xsl:with-param name="indent" select="string('')"/>
100
			</xsl:call-template>
101
		</xsl:for-each>
102
	</xsl:template>
103

    
104
<!--
105
	<xsl:template mode="minimalMetadata" match="rdf:Description[./rdf:type/@rdf:resource = 'http://www.cidoc-crm.org/cidoc-crm/E41_Appellation']" />
106
	<xsl:template mode="minimalMetadata" match="rdf:Description[./rdf:type/@rdf:resource = 'http://www.cidoc-crm.org/cidoc-crm/E35_Title']" />
107
	<xsl:template mode="minimalMetadata" match="rdf:Description[./rdf:type/@rdf:resource = 'http://www.cidoc-crm.org/cidoc-crm/E65_Creation']" />
108
	<xsl:template mode="minimalMetadata" match="rdf:Description[./rdf:type/@rdf:resource = 'http://www.cidoc-crm.org/cidoc-crm/E30_Right']" />
109
	<xsl:template mode="minimalMetadata" match="rdf:Description[./rdf:type/@rdf:resource = 'http://www.cidoc-crm.org/cidoc-crm/E52_Time-Span']" />
110
	<xsl:template mode="minimalMetadata" match="rdf:Description[./rdf:type/@rdf:resource = 'http://www.cidoc-crm.org/cidoc-crm/E51_Contact_Point']" />
111
	<xsl:template mode="minimalMetadata" match="rdf:Description[./rdf:type/@rdf:resource = 'http://www.cidoc-crm.org/cidoc-crm/E45_Address']" />
112
	<xsl:template mode="minimalMetadata" match="rdf:Description[./rdf:type/@rdf:resource = 'http://www.ics.forth.gr/isl/CRMext/CRMpe.rdfs/PE29_Access_Point']" />
113
	-->
114
	<xsl:template mode="minimalMetadata" match="text()" />
115

    
116
	<!--http://parthenos.d4science.org/CRMext/CRMpe.rdfs/PE22_Persistent_Dataset-->
117
	<xsl:template mode="minimalMetadata"
118
			match="rdf:Description[./rdf:type/@rdf:resource = 'http://www.ics.forth.gr/isl/CRMext/CRMpe.rdfs/PE22_Persistent_Dataset']">
119
		<br/>
120
		<tr>
121
			<td>
122
				<strong>PE22_Persistent_Dataset</strong> : <strong><xsl:value-of select="./@rdf:about"/></strong><br/>
123

    
124
				<xsl:call-template name="printProperty">
125
					<xsl:with-param name="propertyName">P1_is_identified_by</xsl:with-param>
126
					<xsl:with-param name="propertyValue">
127
						<xsl:value-of select="./crm:P1_is_identified_by/@rdf:resource"/>
128
					</xsl:with-param>
129
				</xsl:call-template>
130
				<br/>
131
				<xsl:call-template name="printProperty">
132
					<xsl:with-param name="propertyName">P102_has_title</xsl:with-param>
133
					<xsl:with-param name="propertyValue">
134
						<xsl:value-of
135
								select="//rdf:Description[@rdf:about = ./crm:P102_has_title/@rdf:resource]/rdfs:label"
136
						/>
137
					</xsl:with-param>
138
				</xsl:call-template>
139
				<br/>
140
				<xsl:call-template name="printProperty">
141
					<xsl:with-param name="propertyName">P2_has_type</xsl:with-param>
142
					<xsl:with-param name="propertyValue">
143
						<xsl:value-of
144
								select="//rdf:Description[@rdf:about = ./crm:P2_has_type/@rdf:resource]/rdfs:label"
145
						/>
146
					</xsl:with-param>
147
				</xsl:call-template>
148
				<br/>
149
				<xsl:call-template name="printProperty">
150
					<xsl:with-param name="propertyName">P3_has_note</xsl:with-param>
151
					<xsl:with-param name="propertyValue">
152
						<xsl:value-of select="./crm:P3_has_note"/>
153
					</xsl:with-param>
154
				</xsl:call-template>
155
				<br/>
156
				<xsl:call-template name="printProperty">
157
					<xsl:with-param name="propertyName">P129_is_about</xsl:with-param>
158
					<xsl:with-param name="propertyValue">
159
						<xsl:value-of select="./crm:P129_is_about/@rdf:resource"/>
160
					</xsl:with-param>
161
				</xsl:call-template>
162
				<br/>
163
				<xsl:call-template name="printProperty">
164
					<xsl:with-param name="propertyName">P67_refers_to</xsl:with-param>
165
					<xsl:with-param name="propertyValue">
166
						<xsl:value-of select="./crm:P67_refers_to/@rdf:resource"/>
167
					</xsl:with-param>
168
				</xsl:call-template>
169
				<br/>
170
				<xsl:call-template name="printProperty">
171
					<xsl:with-param name="propertyName">PP8i_is_dataset_hosted_by</xsl:with-param>
172
					<xsl:with-param name="propertyValue">
173
						<xsl:value-of select="./crm:PP8i_is_dataset_hosted_by/@rdf:resource"/>
174
					</xsl:with-param>
175
				</xsl:call-template>
176
				<br/>
177
				<xsl:call-template name="printProperty">
178
					<xsl:with-param name="propertyName"
179
					>PP6i_is_digital_object_hosted_by</xsl:with-param>
180
					<xsl:with-param name="propertyValue">
181
						<xsl:value-of select="./crm:PP6i_is_digital_object_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">PP4i_is_object_hosted_by</xsl:with-param>
187
					<xsl:with-param name="propertyValue">
188
						<xsl:value-of select="./crm:PP4i_is_object_hosted_by/@rdf:resource"/>
189
					</xsl:with-param>
190
				</xsl:call-template>
191
			</td>
192
		</tr>
193

    
194
	</xsl:template>
195

    
196
	<xsl:template name="printProperty">
197
		<xsl:param name="propertyName"/>
198
		<xsl:param name="propertyValue"/>
199
		<xsl:value-of select="concat($propertyName, ' : ', $propertyValue)"/>
200
	</xsl:template>
201

    
202
	<xsl:template name="xmlAttr">
203
		<span style="color:orange">
204
			<xsl:value-of select="concat(' ', local-name())"/>
205
		</span>
206
		<xsl:value-of select="concat('=&quot;', ., '&quot;')"/>
207
	</xsl:template>
208

    
209

    
210
	<xsl:template name="xmlItem">
211
		<xsl:param name="indent"/>
212
		<xsl:variable name="tag" select="name()"/>
213
		<xsl:variable name="newindent"><xsl:value-of select="$indent"/>&#160;&#160;&#160;&#160; </xsl:variable>
214

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

    
260
	<!--
261
        Suppress warning messages "The source document is in no namespace, but the template rules
262
        all expect elements in a namespace" (see https://github.com/daisy/pipeline-mod-braille/issues/38)
263
    -->
264
	<xsl:template match="/phony">
265
		<xsl:next-match/>
266
	</xsl:template>
267

    
268

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