- new screenshot
[buliscores] / www / classic / template.xsl
1 <?xml version="1.0" encoding="UTF-8" ?>
2 <!DOCTYPE stylesheet [
3 <!ENTITY raquo "&#187;">
4 ]>
5
6 <xsl:transform version="1.0"
7         xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
8         xmlns:exsl="http://exslt.org/common"
9         extension-element-prefixes="exsl">
10
11 <xsl:template name="linkTagsImagePage">
12         <link rel="first" href="{../image[position()=1]/full/@fileName}.html"></link>
13         <link rel="last" href="{../image[position()=last()]/full/@fileName}.html"></link>
14         <xsl:if test="position() &gt; 1">
15                 <link rel="prev" href="{preceding-sibling::image[position()=1]/full/@fileName}.html"></link>
16         </xsl:if>
17         <xsl:if test="position() &lt; last()">
18                 <link rel="next" href="{following-sibling::image[position()=1]/full/@fileName}.html"></link>
19         </xsl:if>
20         <xsl:choose>
21                 <xsl:when test="count(/collections/collection) &gt; 1">
22                         <link rel="up" href="../{../fileName}.html"></link>
23                         <link rel="top" href="../index.html"></link>
24                 </xsl:when>
25                 <xsl:otherwise>
26                         <link rel="up" href="../index.html"></link>
27                 </xsl:otherwise>
28         </xsl:choose>
29 </xsl:template>
30
31 <xsl:template name="linkTagsCollectionPage">
32         <xsl:if test="count(/collections/collection) &gt; 1">
33                 <link rel="up" href="index.html"></link>
34         </xsl:if>
35 </xsl:template>
36
37 <xsl:template name="style">
38         <style type='text/css'>
39         body {
40                 color: <xsl:value-of select="$fgColor"/>;
41                 background: <xsl:value-of select="$bgColor"/>;
42                 font-family: /*param*/Helvetica, sans-serif;
43                 font-size: <xsl:value-of select="$fontSize"/>pt;
44                 margin: 4%;
45         }
46
47         h1 {
48                 color: <xsl:value-of select="$fgColor"/>;
49         }
50
51         table {
52                 text-align: center;
53                 margin-left: auto;
54                 margin-right: auto;
55         }
56
57         td {
58                 color: <xsl:value-of select="$fgColor"/>;
59                 padding: 1em;
60         }
61
62         img.photo {
63                 border: <xsl:value-of select="$imgBorderSize"/>px solid <xsl:value-of select="$imgBorderColor"/>;
64         }
65
66         a:link {
67                 color: <xsl:value-of select="$linkColor"/>;
68         }
69
70         a:visited {
71                 color: <xsl:value-of select="$visitedLinkColor"/>;
72         }
73         </style>
74 </xsl:template>
75
76 <xsl:template name="imagePage">
77         <xsl:param name="index" select="1"/>
78         <html>
79         <head>
80                 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
81                 <title><xsl:value-of select="title"/></title>
82                 <xsl:call-template name="style"/>
83                 <xsl:call-template name="linkTagsImagePage"/>
84         </head>
85         <body>
86                 <div align="center">
87                         <xsl:if test="$index &gt; 1">
88                                 <xsl:for-each select="../image[$index - 1]">
89                                         <a href="{full/@fileName}.html">
90                                                 <img class="photo" src="{thumbnail/@fileName}" alt="{$i18nPrevious}" title="{$i18nPrevious}" height="{thumbnail/@width}" width="{thumbnail/@height}"/>
91                                         </a>
92                                 </xsl:for-each>
93                                 |
94                         </xsl:if>
95
96                         <xsl:choose>
97                                 <xsl:when test="count(/collections/collection) > 1">
98                                         <a href="../{../fileName}.html"><img src="../classic/up.png" border="0" title="{../description}" alt="{../description}"/></a>
99                                         | <a href="../index.html"><img src="../classic/gohome.png" border="0" alt="{$i18nCollectionList}" title="{$i18nCollectionList}"/></a>
100                                 </xsl:when>
101                                 <xsl:otherwise>
102                                         <a href="../index.html"><img src="../classic/up.png" border="0" title="{$i18nCollectionList}" alt="{$i18nCollectionList}"/></a>
103                                 </xsl:otherwise>
104                         </xsl:choose>
105
106                         <xsl:if test="$index &lt; count(../image)">
107                                 |
108                                 <xsl:for-each select="../image[$index + 1]">
109                                         <a href="{full/@fileName}.html">
110                                                 <img class="photo" src="{thumbnail/@fileName}" alt="{$i18nNext}" title="{$i18nNext}" height="{thumbnail/@width}" width="{thumbnail/@height}"/>
111                                         </a>
112                                 </xsl:for-each>
113                         </xsl:if>
114                         <br/>
115                         <hr/>
116                         <br/>
117                         <br/>
118                         <img class="photo" src="{full/@fileName}" width="{full/@width}" height="{full/@height}" alt="{description}" title="{description}"/>
119                         <xsl:if test="original/@fileName != ''">
120                                 <p>
121                                 <a href="{original/@fileName}"><xsl:value-of select="$i18nOriginalImage"/></a>
122                                 (<xsl:value-of select="original/@width"/>x<xsl:value-of select="original/@height"/>)
123                                 </p>
124                         </xsl:if>
125                         <!-- FIXME title="description, imageSize, fileSize" -->
126                         <br/>
127                         <br/>
128                 </div>
129                 <hr/>
130                 <!-- FIXME footer -->
131         </body>
132         </html>
133 </xsl:template>
134
135
136 <xsl:template name="collectionPage">
137         <html>
138         <head>
139                 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
140                 <title><xsl:value-of select="name"/></title>
141                 <xsl:call-template name="style"/>
142                 <xsl:call-template name="linkTagsCollectionPage"/>
143         </head>
144         <body>
145         <xsl:if test="count(/collections/collection) > 1">
146                 <a href="index.html"><img src="classic/gohome.png" border="0" alt="{$i18nCollectionList}" title="{$i18nCollectionList}"/></a>
147         </xsl:if>
148         <h1>&quot;<xsl:value-of select="name"/>&quot;</h1>
149         <!-- FIXME: Album info -->
150
151         <table>
152                 <xsl:call-template name="thumbnailTable"/>
153         </table>
154         <hr/>
155
156         <!-- FIXME: Footer -->
157         </body>
158         </html>
159 </xsl:template>
160
161
162 <!-- Called only once per table, use recursion to generate every row -->
163 <xsl:template name="thumbnailTable">
164         <xsl:param name="index" select="1"/>
165
166         <xsl:if test="$index &lt; count(image)+1">
167                 <tr>
168                         <xsl:call-template name="thumbnailTableCell">
169                                 <xsl:with-param name="index" select="$index"/>
170                                 <xsl:with-param name="counter" select="$index + $thumbnailPerRow - 1"/>
171                         </xsl:call-template>
172                 </tr>
173
174                 <xsl:call-template name="thumbnailTable">
175                         <xsl:with-param name="index" select="$index + $thumbnailPerRow"/>
176                 </xsl:call-template>
177         </xsl:if>
178 </xsl:template>
179
180
181 <!-- Called for every cell, use recursion to generate every cell -->
182 <xsl:template name="thumbnailTableCell">
183         <xsl:param name="index" select="1"/>
184         <xsl:param name="counter" select="1"/>
185
186         <xsl:if test="$index &lt; count(image) + 1">
187                 <td align="center">
188                         <xsl:variable name="folder" select='fileName'/>
189                         <xsl:for-each select="image[$index]">
190                                 <a href='{$folder}/{full/@fileName}.html'>
191                                         <img class="photo" src="{$folder}/{thumbnail/@fileName}" width="{thumbnail/@width}" height="{thumbnail/@height}" />
192                                         <div><xsl:value-of select="title"/></div>
193                                         <!--FIXME image size and file size -->
194                                 </a>
195
196                                 <exsl:document href='{$folder}/{full/@fileName}.html'>
197                                         <xsl:call-template name="imagePage">
198                                                 <xsl:with-param name="index" select="$index"/>
199                                         </xsl:call-template>
200                                 </exsl:document>
201                         </xsl:for-each>
202                 </td>
203
204                 <xsl:if test="$counter > $index">
205                         <xsl:call-template name="thumbnailTableCell">
206                                 <xsl:with-param name="index" select="$index + 1"/>
207                                 <xsl:with-param name="counter" select="$counter"/>
208                         </xsl:call-template>
209                 </xsl:if>
210         </xsl:if>
211 </xsl:template>
212
213
214 <xsl:template name="collectionListPage">
215         <html>
216         <head>
217                 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
218                 <title><xsl:value-of select="$i18nCollectionList"/></title>
219                 <xsl:call-template name="style"/>
220         </head>
221         <body>
222         <h1><xsl:value-of select="$i18nCollectionList"/></h1>
223         <hr/>
224         <p>
225         
226                 <xsl:for-each select="collections/collection">
227                         <xsl:variable name="title" select='concat(name, " [", count(image), "]")'/>
228                                 <a href="{fileName}.html">
229                                         <!-- Use first image as collection image -->
230                                         <img class="photo"
231                                                 src="{fileName}/{image[1]/thumbnail/@fileName}"
232                                                 width="{image[1]/thumbnail/@width}"
233                                                 height="{image[1]/thumbnail/@height}"
234                                                 alt="{$title}"
235                                                 title="{$title}"/>
236                                 </a>
237                                 <a href="{fileName}.html"><xsl:value-of select="$title"/></a>
238                                 <br />
239                                 <exsl:document href="{fileName}.html">
240                                         <xsl:call-template name="collectionPage"/>
241                                 </exsl:document>
242                 </xsl:for-each>
243         
244         </p>
245         <hr/>
246         <!-- FIXME: Footer -->
247         </body>
248         </html>
249 </xsl:template>
250
251
252 <xsl:template match="/">
253         <xsl:choose>
254                 <xsl:when test="count(collections/collection) &gt; 1">
255                         <xsl:call-template name="collectionListPage"/>
256                 </xsl:when>
257                 <xsl:otherwise>
258                         <xsl:for-each select="collections/collection">
259                                 <xsl:call-template name="collectionPage"/>
260                         </xsl:for-each>
261                 </xsl:otherwise>
262         </xsl:choose>
263 </xsl:template>
264
265
266 </xsl:transform>