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

    
109

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

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

    
160

    
161
</xsl:stylesheet>
    (1-1/1)