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

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

    
8
	<xsl:template match="/">
9
		<div class="row">
10
			<div class="col-xs-2">
11
				<img src="../resources/img/record.png" width="80" height="80"/>
12
			</div>
13
			<div class="col-xs-10">
14
				<xsl:if test="//*[local-name()='title']">
15
					<h1 id="overview">
16
						<xsl:value-of select="/crm:P102_has_title"/>
17
					</h1>
18
				</xsl:if>
19
			</div>
20
		</div>
21

    
22
		<div class="row">
23
			<div class="col-xs-12">
24
				<h6>
25
					<span class="glyphicon glyphicon-align-left"/>
26
					GENERAL INFORMATION
27
				</h6>
28
				<table class="table">
29
					<tbody>
30
						<tr>
31
							<td class="col-xs-3">
32
								<strong>Author</strong>
33
							</td>
34
							<td>
35
								<xsl:for-each select="//*[local-name()='creator']">
36
									<xsl:value-of select="."/>
37
									<br/>
38
								</xsl:for-each>
39
							</td>
40
						</tr>
41
						<tr>
42
							<td class="col-xs-3">
43
								<strong>Title</strong>
44
							</td>
45
							<td>
46
								<xsl:for-each select="//crm:P102_has_title">
47
									<xsl:value-of select="."/>
48
									<br/>
49
								</xsl:for-each>
50
							</td>
51
						</tr>
52
						<tr>
53
							<td class="col-xs-3">
54
								<strong>Description</strong>
55
							</td>
56
							<td>
57
								<xsl:for-each select="//crm:P3_has_note">
58
									<xsl:value-of select="."/>
59
									<br/>
60
								</xsl:for-each>
61
							</td>
62
						</tr>
63
						<tr>
64
							<td class="col-xs-3">
65
								<strong>Identifiers</strong>
66
							</td>
67
							<td>
68
								<xsl:for-each select="//crm:P1_is_identified_by/crm:E42_Identifier/@rdf:about">
69
									<xsl:value-of select="."/>
70
									<br/>
71
								</xsl:for-each>
72
							</td>
73
						</tr>
74
						<tr>
75
							<td class="col-xs-3">
76
								<strong>Type</strong>
77
							</td>
78
							<td>
79
								<xsl:for-each select="//rdf:RDF/*/rdf:type/@rdf:resource">
80
									<xsl:value-of select="substring-after(./text(),'http://www.ics.forth.gr/isl/CRMext/CRMpe.rdfs/')"/>
81
									<br/>
82
								</xsl:for-each>
83
							</td>
84
						</tr>
85
					</tbody>
86
				</table>
87
			</div>
88
		</div>
89

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

    
101
	<xsl:template name="xmlAttr">
102
		<span style='color:red'>
103
			<xsl:value-of select="concat(' ', local-name())"/>
104
		</span>
105
		<xsl:value-of select="concat('=&quot;', ., '&quot;')"/>
106
	</xsl:template>
107

    
108

    
109
	<xsl:template name="xmlItem">
110
		<xsl:param name="indent"/>
111
		<xsl:variable name="tag" select="name()"/>
112
		<xsl:variable name="newindent"><xsl:value-of select="$indent"/>&#160;&#160;&#160;&#160;
113
		</xsl:variable>
114

    
115
		<xsl:if test="string-length($tag)">
116
			<br/>
117
			<xsl:value-of select="$indent"/>
118
			<span style='color:blue'>
119
				<xsl:value-of select="concat('&lt;',$tag)"/>
120
			</span>
121
			<xsl:for-each select="@*">
122
				<xsl:call-template name="xmlAttr"/>
123
			</xsl:for-each>
124
			<xsl:choose>
125
				<xsl:when test="count(child::*) = 0 and count(child::text()) = 1">
126
					<span style='color:blue'>&gt;</span>
127
					<xsl:value-of select="normalize-space(.)"/>
128
					<span style='color:blue'>
129
						<xsl:value-of select="concat('&lt;/',$tag,'&gt;')"/>
130
					</span>
131
				</xsl:when>
132
				<xsl:when test="count(child::* | child::text()) &gt; 0">
133
					<span style='color:blue'>&gt;</span>
134
					<xsl:for-each select="child::* | child::text()">
135
						<xsl:choose>
136
							<xsl:when test="self::text() and string-length(normalize-space(.)) &gt; 0">
137
								<xsl:value-of select="normalize-space(.)"/>
138
							</xsl:when>
139
							<xsl:otherwise>
140
								<xsl:call-template name="xmlItem">
141
									<xsl:with-param name="indent" select="$newindent"/>
142
								</xsl:call-template>
143
							</xsl:otherwise>
144
						</xsl:choose>
145
					</xsl:for-each>
146
					<br/>
147
					<xsl:value-of select="$indent"/>
148
					<span style='color:blue'>
149
						<xsl:value-of select="concat('&lt;/',$tag,'&gt;')"/>
150
					</span>
151
				</xsl:when>
152
				<xsl:otherwise>
153
					<span style='color:blue'>&#160;/&gt;</span>
154
				</xsl:otherwise>
155
			</xsl:choose>
156
		</xsl:if>
157
	</xsl:template>
158

    
159

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