Project

General

Profile

« Previous | Next » 

Revision 42659

added light-ui

View differences:

dc_2_document.xslt
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" ><xsl:value-of select="//*[local-name()='title']" /></h1>
17
				</xsl:if>
18
			</div>
19
		</div>
20
		
21
		<div class="row">
22
			<div class="col-xs-12">
23
				<h6><span class="glyphicon glyphicon-align-left" /> GENERAL INFORMATION</h6>
24
				<table class="table">
25
					<tbody>
26
						<tr>
27
							<td class="col-xs-3"><strong>Author</strong></td>
28
							<td>
29
								<xsl:for-each select="//*[local-name()='creator']">
30
									<xsl:value-of select="." /><br />
31
								</xsl:for-each>
32
							</td>
33
						</tr>
34
						<tr>
35
							<td class="col-xs-3"><strong>Title</strong></td>
36
							<td>
37
								<xsl:for-each select="//*[local-name()='title']">
38
									<xsl:value-of select="." /><br />
39
								</xsl:for-each>
40
							</td>
41
						</tr>
42
						<tr>
43
							<td class="col-xs-3"><strong>Description</strong></td>
44
							<td>
45
								<xsl:for-each select="//*[local-name()='description']">
46
									<xsl:value-of select="." /><br />
47
								</xsl:for-each>
48
							</td>
49
						</tr>
50
						<tr>
51
							<td class="col-xs-3"><strong>Identifier</strong></td>
52
							<td>
53
								<xsl:for-each select="//*[local-name()='identifier']">
54
									<xsl:value-of select="." /><br />
55
								</xsl:for-each>
56
							</td>
57
						</tr>
58
						<tr>
59
							<td class="col-xs-3"><strong>Type</strong></td>
60
							<td>
61
								<xsl:for-each select="//*[local-name()='type']">
62
									<xsl:value-of select="." /><br />
63
								</xsl:for-each>
64
							</td>
65
						</tr>
66
					</tbody>
67
				</table>
68
			</div>
69
		</div>
70
		
71
		<xsl:for-each select="//*[local-name()='record']">
72
			<h6><span class="glyphicon glyphicon-wrench" /> RECORD XML</h6>
73
			<xsl:call-template name="xmlItem">
74
				<xsl:with-param name="indent" select="string('')" />
75
			</xsl:call-template>
76
		</xsl:for-each>
77
	</xsl:template>
78
	
79
	<xsl:template name="xmlItem">
80
		<xsl:param name="indent" />
81

  
82
		<xsl:variable name="tag" select="local-name()" />
83

  
84
		<xsl:variable name="newindent">
85
			<xsl:value-of select="$indent" />
86
			&#160;&#160;&#160;&#160;
87
		</xsl:variable>
88

  
89
		<xsl:variable name="attribs">
90
			<xsl:for-each select="@*">
91
				<xsl:value-of select="concat(' ', local-name(), '=&quot;', ., '&quot;')" />
92
			</xsl:for-each>
93
		</xsl:variable>
94
		<xsl:value-of select="$indent" />
95

  
96
		<b>
97
			<xsl:value-of select="concat('&lt;',$tag)" />
98
		</b>
99
		<i>
100
			<xsl:value-of select="$attribs" />
101
		</i>
102
		<b>&gt;</b>
103

  
104
		<xsl:value-of select="text()" />
105

  
106
		<xsl:choose>
107
			<xsl:when test="count(child::*) &gt; 0">
108
				<br />
109
				<xsl:for-each select="child::*">
110
					<xsl:call-template name="xmlItem">
111
						<xsl:with-param name="indent" select="$newindent" />
112
					</xsl:call-template>
113
					<br />
114
				</xsl:for-each>
115
				<xsl:value-of select="$indent" />
116
			</xsl:when>
117
			<xsl:otherwise>
118

  
119
			</xsl:otherwise>
120
		</xsl:choose>
121

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

  
126
	</xsl:template>
127
	
128
    <xsl:template name="threedimensions">
129
        <xsl:param name="w"/>
130
        <xsl:param name="h"/>
131
        <xsl:param name="d"/>
132
        <xsl:param name="unit"/>
133
        
134
        <xsl:variable name="actualW">
135
            <xsl:choose>
136
                <xsl:when test="normalize-space($w) != ''">
137
                    <xsl:value-of select="normalize-space($w)"/>
138
                </xsl:when>
139
                <xsl:otherwise>??</xsl:otherwise>
140
            </xsl:choose>
141
        </xsl:variable>
142
        <xsl:variable name="actualH">
143
            <xsl:choose>
144
                <xsl:when test="normalize-space($h) != ''">
145
                    <xsl:value-of select="normalize-space($h)"/>
146
                </xsl:when>
147
                <xsl:otherwise>??</xsl:otherwise>
148
            </xsl:choose>
149
        </xsl:variable>
150
        <xsl:variable name="actualD">
151
            <xsl:choose>
152
                <xsl:when test="normalize-space($d) != ''">
153
                    <xsl:value-of select="normalize-space($d)"/>
154
                </xsl:when>
155
                <xsl:otherwise>??</xsl:otherwise>
156
            </xsl:choose>
157
        </xsl:variable>
158

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

  
185
        <xsl:value-of select="concat($actualW,' x ', $actualH, ' (', $unit, ')')"/>
186
    </xsl:template>
187
	
188
</xsl:stylesheet>

Also available in: Unified diff