Project

General

Profile

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

    
3
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4
                version="2.0"
5
>
6

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

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

    
23
		<div class="row">
24
			<div class="col-xs-12">
25
				<h6>
26
					<span class="glyphicon glyphicon-align-left"/>
27
					GENERAL INFORMATION
28
				</h6>
29
				<table class="table">
30
					<tbody>
31
						<tr>
32
							<td class="col-xs-3">
33
								<strong>Author</strong>
34
							</td>
35
							<td>
36
								<xsl:for-each select="//*[local-name()='creator']">
37
									<xsl:value-of select="."/>
38
									<br/>
39
								</xsl:for-each>
40
							</td>
41
						</tr>
42
						<tr>
43
							<td class="col-xs-3">
44
								<strong>Title</strong>
45
							</td>
46
							<td>
47
								<xsl:for-each select="//*[local-name()='title']">
48
									<xsl:value-of select="."/>
49
									<br/>
50
								</xsl:for-each>
51
							</td>
52
						</tr>
53
						<tr>
54
							<td class="col-xs-3">
55
								<strong>Description</strong>
56
							</td>
57
							<td>
58
								<xsl:for-each select="//*[local-name()='description']">
59
									<xsl:value-of select="."/>
60
									<br/>
61
								</xsl:for-each>
62
							</td>
63
						</tr>
64
						<tr>
65
							<td class="col-xs-3">
66
								<strong>Identifier</strong>
67
							</td>
68
							<td>
69
								<xsl:for-each select="//*[local-name()='identifier']">
70
									<xsl:value-of select="."/>
71
									<br/>
72
								</xsl:for-each>
73
							</td>
74
						</tr>
75
						<tr>
76
							<td class="col-xs-3">
77
								<strong>Type</strong>
78
							</td>
79
							<td>
80
								<xsl:for-each select="//*[local-name()='type']">
81
									<xsl:value-of select="."/>
82
									<br/>
83
								</xsl:for-each>
84
							</td>
85
						</tr>
86
					</tbody>
87
				</table>
88
			</div>
89
		</div>
90

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

    
102
	<xsl:template name="xmlItem">
103
		<xsl:param name="indent"/>
104

    
105
		<xsl:variable name="tag" select="local-name()"/>
106

    
107
		<xsl:variable name="newindent">
108
			<xsl:value-of select="$indent"/>
109
			&#160;&#160;&#160;&#160;
110
		</xsl:variable>
111

    
112
		<xsl:variable name="attribs">
113
			<xsl:for-each select="@*">
114
				<xsl:value-of select="concat(' ', local-name(), '=&quot;', ., '&quot;')"/>
115
			</xsl:for-each>
116
		</xsl:variable>
117
		<xsl:value-of select="$indent"/>
118

    
119
		<b>
120
			<xsl:value-of select="concat('&lt;',$tag)"/>
121
		</b>
122
		<i>
123
			<xsl:value-of select="$attribs"/>
124
		</i>
125
		<b>&gt;</b>
126

    
127
		<xsl:value-of select="text()"/>
128

    
129
		<xsl:choose>
130
			<xsl:when test="count(child::*) &gt; 0">
131
				<br/>
132
				<xsl:for-each select="child::*">
133
					<xsl:call-template name="xmlItem">
134
						<xsl:with-param name="indent" select="$newindent"/>
135
					</xsl:call-template>
136
					<br/>
137
				</xsl:for-each>
138
				<xsl:value-of select="$indent"/>
139
			</xsl:when>
140
			<xsl:otherwise>
141

    
142
			</xsl:otherwise>
143
		</xsl:choose>
144

    
145
		<b>
146
			<xsl:value-of select="concat('&lt;/',$tag,'&gt;')"/>
147
		</b>
148

    
149
	</xsl:template>
150

    
151
	<xsl:template name="threedimensions">
152
		<xsl:param name="w"/>
153
		<xsl:param name="h"/>
154
		<xsl:param name="d"/>
155
		<xsl:param name="unit"/>
156

    
157
		<xsl:variable name="actualW">
158
			<xsl:choose>
159
				<xsl:when test="normalize-space($w) != ''">
160
					<xsl:value-of select="normalize-space($w)"/>
161
				</xsl:when>
162
				<xsl:otherwise>??</xsl:otherwise>
163
			</xsl:choose>
164
		</xsl:variable>
165
		<xsl:variable name="actualH">
166
			<xsl:choose>
167
				<xsl:when test="normalize-space($h) != ''">
168
					<xsl:value-of select="normalize-space($h)"/>
169
				</xsl:when>
170
				<xsl:otherwise>??</xsl:otherwise>
171
			</xsl:choose>
172
		</xsl:variable>
173
		<xsl:variable name="actualD">
174
			<xsl:choose>
175
				<xsl:when test="normalize-space($d) != ''">
176
					<xsl:value-of select="normalize-space($d)"/>
177
				</xsl:when>
178
				<xsl:otherwise>??</xsl:otherwise>
179
			</xsl:choose>
180
		</xsl:variable>
181

    
182
		<xsl:value-of select="concat($actualW,' x ', $actualH,' x ', $actualD, ' (', $unit, ')')"/>
183
	</xsl:template>
184

    
185
	<xsl:template name="twodimensions">
186
		<xsl:param name="w"/>
187
		<xsl:param name="h"/>
188
		<xsl:param name="d"/>
189
		<xsl:param name="unit"/>
190

    
191
		<xsl:variable name="actualW">
192
			<xsl:choose>
193
				<xsl:when test="normalize-space($w) != ''">
194
					<xsl:value-of select="normalize-space($w)"/>
195
				</xsl:when>
196
				<xsl:otherwise>??</xsl:otherwise>
197
			</xsl:choose>
198
		</xsl:variable>
199
		<xsl:variable name="actualH">
200
			<xsl:choose>
201
				<xsl:when test="normalize-space($h) != ''">
202
					<xsl:value-of select="normalize-space($h)"/>
203
				</xsl:when>
204
				<xsl:otherwise>??</xsl:otherwise>
205
			</xsl:choose>
206
		</xsl:variable>
207

    
208
		<xsl:value-of select="concat($actualW,' x ', $actualH, ' (', $unit, ')')"/>
209
	</xsl:template>
210

    
211
</xsl:stylesheet>
(2-2/5)