-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcd_catalog.xsl
More file actions
173 lines (150 loc) · 4.24 KB
/
Copy pathcd_catalog.xsl
File metadata and controls
173 lines (150 loc) · 4.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="UTF-8" indent="yes"></xsl:output>
<xsl:template match="/">
<html>
<!-- Import de la police "Lobster" -->
<link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css"/>
<head>
<title>CD catalog</title>
<!-- CSS -->
<style>
h1, h2, h3, h4 {
font-family : Lobster, Helvetica;
}
p {
font-family: Arial;
font-style: italic;
font-size: 12px;
margin: 0cm 0cm 0cm 1cm;
transition: font-size 0.05s;
}
table {
border: 1px solid black;
border-radius: 10px;
border-color: #99e699;
border-width: 3px;
margin-left: 1cm;
width: 6cm;
}
tr {
text-align: left;
transition: background-color 1s;
font-family: Helvetica;
}
td:first-child {
text-align: right;
}
td:second-child {
text-align: left;
}
td {
width: 3cm;
}
tr:hover {
background-color: #99e699;
}
p:hover {
font-size:14px;
}
footer {
font-style: italic;
font-size: 12px;
}
.bloc {
display: inline-block;
width: 8cm;
}
img {
width: 6cm;
height: 6cm;
margin-bottom: 1cm;
margin-left: 1cm;
border-radius: 50%;
transition: border-radius 0.5s;
}
img:hover {
border-radius: 5px;
}
a {
color: #99e699;
}
.container {
position: fixed;
}
nav {
position: absolute;
left: 0px;
width: 200px;
}
section {
/* position is static by default */
margin-left: 300px;
}
</style>
</head>
<body>
<div id="Top"><h1 style="text-align: center; font-size: 30pt">CD catalog</h1></div>
<!-- 1ere boucle pour le sommaire. Les balises nav et container permettent de le placer sur la gauche de la page -->
<div class="container">
<nav>
<h2 style="margin-left: 0.5cm;">Summary</h2>
<xsl:for-each select="CATALOG/CD">
<xsl:sort select="ARTIST"/>
<div class="bloc">
<p>
<!-- generate-id permet de faire des ancres facilement -->
<a href="#{generate-id(TITLE)}">
<xsl:value-of select="ARTIST"/> - <xsl:value-of select="TITLE"/>
</a>
</p>
</div>
</xsl:for-each>
</nav>
</div>
<section>
<h2 style="margin-left: 0.5cm; margin-top: 1.2cm;">Catalog</h2>
<!-- 2eme boucle pour le catalogue -->
<xsl:for-each select="CATALOG/CD">
<xsl:sort select="ARTIST"/>
<div class="bloc">
<!-- la div de classe bloc permet de mettre cote à cote les éléments -->
<h4 id="{generate-id(TITLE)}" style="margin-left: 0.5cm;"><xsl:value-of select="ARTIST"/> - <xsl:value-of select="TITLE"/></h4>
<!-- Image avec lien Deezer (balises ajoutées manuellement dans le fichier XML-->
<a alt="Click to listen on Deezer !">
<xsl:attribute name="href">http://www.deezer.com/us/album/<xsl:value-of select='LISTEN'/></xsl:attribute>
<img>
<xsl:attribute name="src">../pictures/<xsl:value-of select='PICTURE'/>.jpg</xsl:attribute>
</img>
</a>
<!-- Tableau -->
<table cellspacing="0">
<tr>
<td>Country : </td>
<td><xsl:value-of select="COUNTRY"/></td>
</tr>
<tr>
<td>Company : </td>
<td><xsl:value-of select="COMPANY"/></td>
</tr>
<tr>
<td>Price : </td>
<td><xsl:value-of select="PRICE"/> $</td>
</tr>
<tr>
<td>Year : </td>
<td><xsl:value-of select="YEAR"/></td>
</tr>
</table>
<p style="margin-top: 10px; margin-bottom: 10px;"><a href="#Top">Back to Top</a></p>
</div>
</xsl:for-each>
</section>
</body>
<footer>
Victor Mataigne - Mini projet ESR - Mise en page de documents XML
Contact : <a href="mailto:victor.mataigne@wanadoo.fr">victor.mataigne@wanadoo.fr</a>.
</footer>
</html>
</xsl:template>
</xsl:stylesheet>