source: trunk/gsdl3/web/interfaces/classic/transform/style.xsl@ 13254

Last change on this file since 13254 was 13254, checked in by shaoqun, 17 years ago

now uses <div> to make changing styles easier

  • Property svn:keywords set to Author Date Id Revision
File size: 14.4 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<xsl:stylesheet version="1.0"
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns:java="http://xml.apache.org/xslt/java"
5 xmlns:util="xalan://org.greenstone.gsdl3.util.XSLTUtil"
6 extension-element-prefixes="java util"
7 exclude-result-prefixes="java util">
8
9 <!-- some global parameters - these are set by whoever is invoking the transformation -->
10 <xsl:param name="interface_name"/>
11 <xsl:param name="library_name"/>
12
13 <!-- the main page layout template is here -->
14 <xsl:template match="page">
15 <html>
16 <xsl:call-template name="pageHead"/>
17 <body class="bgimage">
18 <div id="page">
19 <xsl:apply-templates select="pageResponse"/>
20 <xsl:call-template name="greenstoneFooter"/>
21 </div>
22 </body>
23 </html>
24 </xsl:template>
25
26
27 <!-- put a space in the title in case the actual value is missing - mozilla will not display a page with no title-->
28 <xsl:template name="pageHead">
29 <head>
30 <title>
31 <xsl:call-template name="pageTitle"/><xsl:text> </xsl:text>
32 </title>
33 <xsl:call-template name="globalStyle"/>
34 <xsl:call-template name="pageStyle"/>
35 </head>
36 </xsl:template>
37
38 <!-- any global style stuff should go in here -->
39 <xsl:template name="globalStyle">
40 <link rel="stylesheet" href="interfaces/classic/style/classic.css" type="text/css"/>
41 <link rel="stylesheet" href="interfaces/classic/style/classic2.css" type="text/css"/>
42 </xsl:template>
43
44 <xsl:template name="greenstonePageBanner">
45 <div id="banner">
46 <div class="collectimage">
47 <img src="interfaces/classic/images/gsdlhead.gif"><xsl:attribute name="alt"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'gsdl')"/></xsl:attribute>
48 </img>
49 </div>
50 </div>
51 <div class="bannerextra"></div>
52 <div id="content">
53 <xsl:call-template name="dividerBar">
54 <xsl:with-param name="text" select="'select a collection'"/>
55 </xsl:call-template>
56 </div>
57 </xsl:template>
58
59 <xsl:template name="genericPageBanner">
60 <xsl:param name='text'/>
61 <xsl:variable name="lang" select="/page/@lang"/>
62 <center>
63 <table width="100%">
64 <tr><td align="left"></td>
65 <td align="right">
66 <table>
67 <tr><td class="gsbutton">
68 <a class="gsbutton" href="{$library_name}?a=p&amp;sa=home">
69 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home_b')"/>
70 </a>
71 </td></tr></table>
72 </td>
73 </tr>
74 </table>
75 </center>
76 <xsl:call-template name="dividerBar"><xsl:with-param name='text' select="$text"/></xsl:call-template>
77 </xsl:template>
78
79 <xsl:template name="standardPageBanner">
80 <xsl:param name="collName"/>
81 <xsl:param name="pageType"/>
82 <xsl:param name="clTop"/>
83 <xsl:variable name="this-element" select="/page/pageResponse/collection"/>
84 <div id="bannar">
85 <div class="pageinfo">
86 <xsl:call-template name="top-buttons">
87 <xsl:with-param name="collName" select="$collName"/>
88 <xsl:with-param name="pageType" select="$pageType"/>
89 </xsl:call-template>
90 <xsl:if test="not(/page/pageRequest/@action='d')">
91 <xsl:variable name="text">
92 <xsl:choose>
93 <xsl:when test="$pageType='browse'">
94 <xsl:value-of select="/page/pageResponse/collection/serviceList/service[@name='ClassifierBrowse']/classifierList/classifier[@name=$clTop]/displayItem[@name='name']"/>
95 </xsl:when>
96 <xsl:otherwise>
97 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, concat($pageType, '_t'))"/>
98 </xsl:otherwise>
99 </xsl:choose>
100 </xsl:variable>
101 <p class="bannertitle"><xsl:value-of select="$text"/></p>
102 </xsl:if>
103 </div>
104
105 <div class="collectimage">
106 <a href="{$library_name}?a=p&amp;sa=about&amp;c={$collName}">
107 <xsl:choose>
108 <xsl:when test="$this-element/displayItem[@name='icon']">
109 <img border="0">
110 <xsl:attribute name="src">
111 <xsl:value-of select="$this-element/metadataList/metadata[@name='httpPath']"/>/images/<xsl:value-of select="$this-element/displayItem[@name='icon']"/>
112 </xsl:attribute>
113 <xsl:attribute name="alt">
114 <xsl:value-of select="$this-element/displayItem[@name='name']"/>
115 </xsl:attribute>
116 <xsl:attribute name="title">
117 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'aboutpage')"/>
118 </xsl:attribute>
119 </img>
120 </xsl:when>
121 <xsl:otherwise>
122 <b><xsl:value-of select="$this-element/displayItem[@name='name']"/>hello</b>
123 </xsl:otherwise>
124 </xsl:choose>
125 </a>
126 </div>
127 </div>
128 <div class="bannerextra"></div>
129 </xsl:template>
130
131 <xsl:template name="top-buttons">
132 <xsl:param name="collName"/>
133 <xsl:param name="pageType"/>
134 <p class="bannerlinks">
135 <a class="navlink" href="{$library_name}?a=p&amp;sa=home"><xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home_tip')"/></xsl:attribute>
136 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home_b')"/>
137 </a>
138 <!-- <xsl:choose>
139 <xsl:when test="$pageType='help'">
140 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_b')"/>
141 </xsl:when>
142 <xsl:otherwise>
143 <a class="navlink" href="{$library_name}?a=p&amp;sa=help&amp;c={$collName}"><xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_tip')"/></xsl:attribute>
144 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_b')"/>
145 </a>
146 </xsl:otherwise>
147 </xsl:choose> -->
148 <xsl:choose>
149 <xsl:when test="$pageType='pref'">
150 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_b')"/>
151 </xsl:when>
152 <xsl:otherwise>
153 <a class="navlink" href="{$library_name}?a=p&amp;sa=pref&amp;c={$collName}"><xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_tip')"/></xsl:attribute>
154 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_b')"/>
155 </a>
156 </xsl:otherwise>
157 </xsl:choose>
158 </p>
159 </xsl:template>
160
161 <xsl:template name="navigationBar">
162 <xsl:param name="collName"/>
163 <xsl:param name="clTop"/>
164 <xsl:variable name="this-element" select="/page/pageResponse/collection"/>
165 <xsl:variable name="this-service" select="/page/pageResponse/service/@name"/>
166 <xsl:variable name="classifiers" select="$this-element/serviceList/service[@name='ClassifierBrowse']/classifierList"/>
167 <div class="navbar">
168 <p class="navbar">
169 <xsl:if test="$this-element/serviceList/service[@type='query']">
170 <xsl:call-template name="navbar-search"><xsl:with-param name="collName" select="$collName"/></xsl:call-template>
171 </xsl:if>
172
173 <xsl:for-each select="$classifiers/classifier">
174 <xsl:apply-templates select="." mode="navbar">
175 <xsl:with-param name="collName" select="$collName"/>
176 <xsl:with-param name="clTop" select="$clTop"/>
177 </xsl:apply-templates>
178 </xsl:for-each>
179
180 <xsl:if test="$this-element/serviceList/service[@name='PhindApplet']">
181 <xsl:call-template name="navbar-phind"><xsl:with-param name="collName" select="$collName"/></xsl:call-template>
182 </xsl:if>
183 </p>
184 </div>
185 </xsl:template>
186
187 <xsl:template name="navbar-search">
188 <xsl:param name="collName"/>
189 <xsl:choose>
190 <xsl:when test="/page/pageRequest/@action='q'">
191 <span class="narspace">search</span>
192 </xsl:when>
193 <xsl:otherwise>
194 <xsl:variable name="service">
195 <xsl:choose>
196 <xsl:when test="not(/page/pageRequest/paramList/param[@name='ct'])">TextQuery</xsl:when>
197 <xsl:when test="/page/pageRequest/paramList/param[@name='ct']/@value='0'">TextQuery</xsl:when>
198 <xsl:when test="/page/pageRequest/paramList/param[@name='qt']/@value='1'"><xsl:choose><xsl:when test="/page/pageRequest/paramList/param[@name='qfm']/@value='1'">AdvancedFieldQuery</xsl:when><xsl:otherwise>FieldQuery</xsl:otherwise></xsl:choose></xsl:when>
199 <xsl:otherwise>TextQuery</xsl:otherwise>
200 </xsl:choose>
201 </xsl:variable>
202 <a class="navlink" href="{$library_name}?a=q&amp;rt=d&amp;s={$service}&amp;c={$collName}"><xsl:attribute name='title'><xsl:value-of select="/page/pageResponse/collection/service[@name=$service]/displayItem[@name='description']"/></xsl:attribute>search</a>
203 </xsl:otherwise>
204 </xsl:choose>
205 </xsl:template>
206
207 <xsl:template name="navbar-phind">
208 <xsl:param name="collName"/>
209 <xsl:choose>
210 <xsl:when test="/page/pageRequest/paramList/param[@name='s']/@value='PhindApplet'">
211 <span class="narspace">phrases</span>
212 </xsl:when>
213 <xsl:otherwise>
214 <a class="navlink" href="{$library_name}?a=a&amp;rt=d&amp;s=PhindApplet&amp;c={$collName}"><xsl:if test="/page/pageResponse/collection/service[@name='PhindApplet']/displayItem[@name='description']"><xsl:attribute name='title'><xsl:value-of select="/page/pageResponse/collection/service[@name='PhindApplet']/displayItem[@name='description']"/></xsl:attribute></xsl:if>phrases</a>
215 </xsl:otherwise>
216 </xsl:choose>
217 </xsl:template>
218
219 <xsl:template match="classifier" mode="navbar">
220 <xsl:param name="collName"/>
221 <xsl:param name="clTop"/>
222 <xsl:choose>
223 <xsl:when test="/page/pageRequest/@action='b' and $clTop=@name">
224 <span class="narspace"><xsl:value-of select="displayItem[@name='name']"/></span>
225 </xsl:when>
226 <xsl:otherwise>
227 <a class="navlink" href="{$library_name}?a=b&amp;rt=r&amp;s=ClassifierBrowse&amp;c={$collName}&amp;cl={@name}"><xsl:attribute name='title'><xsl:value-of select="displayItem[@name='description']"/></xsl:attribute><xsl:value-of select="displayItem[@name='name']"/></a>
228 </xsl:otherwise>
229 </xsl:choose>
230 </xsl:template>
231
232 <xsl:template name="dividerBar">
233 <xsl:param name='text'/>
234 <xsl:choose>
235 <xsl:when test="$text">
236 <div class="divbar"><p class="navbar"><xsl:value-of select="$text"/></p></div>
237 </xsl:when>
238 <xsl:otherwise>
239 <div class="divbar"><xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text></div>
240 </xsl:otherwise>
241 </xsl:choose>
242 </xsl:template>
243
244 <xsl:template name="nzdlPageBanner">
245 <div><img src="interfaces/nzdl/images/nzdl2gr.gif" width="457" height="181" ><xsl:attribute name="alt"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'nzdl')"/></xsl:attribute></img></div>
246 <!-- end of page banner -->
247 </xsl:template>
248
249 <xsl:template name="greenstoneFooter">
250 <div class="divbar"><p class="navbar">powered by greenstone3</p>
251 </div>
252 </xsl:template>
253
254 <xsl:template name="imagegreenstone">
255 <img src="interfaces/nzdl/images/gsdl.gif" width="140" height="77" border="0" hspace='0'><xsl:attribute name='alt'><xsl:call-template name='textimagegreenstone'/></xsl:attribute></img>
256 </xsl:template>
257
258 <!-- Display the appropriate image, depending on the node type -->
259 <xsl:template match="documentNode" mode="displayNodeIcon">
260
261 <!-- Root node: book icon (open or closed) -->
262 <xsl:choose>
263 <xsl:when test="@nodeType='root'">
264 <xsl:choose>
265 <xsl:when test="documentNode">
266 <xsl:call-template name="openbookimg">
267 <xsl:with-param name="title">Close this book</xsl:with-param>
268 </xsl:call-template>
269 </xsl:when>
270 <xsl:otherwise>
271 <xsl:call-template name="closedbookimg">
272 <xsl:with-param name="title">Open this document and view contents</xsl:with-param>
273 </xsl:call-template>
274 </xsl:otherwise>
275 </xsl:choose>
276 </xsl:when>
277
278 <!-- Internal node: folder icon (open or closed) -->
279 <xsl:when test="@nodeType='internal'">
280 <xsl:choose>
281 <xsl:when test="documentNode">
282 <xsl:call-template name="openfolderimg">
283 <xsl:with-param name="title">Close this folder</xsl:with-param>
284 </xsl:call-template>
285 </xsl:when>
286 <xsl:otherwise>
287 <xsl:call-template name="closedfolderimg">
288 <xsl:with-param name="title">Open this folder and view contents</xsl:with-param>
289 </xsl:call-template>
290 </xsl:otherwise>
291 </xsl:choose>
292 </xsl:when>
293
294 <!-- Leaf node: page icon, and this is the default -->
295 <xsl:otherwise>
296 <xsl:call-template name="textpageimg">
297 <xsl:with-param name="title">View the document</xsl:with-param>
298 </xsl:call-template>
299 </xsl:otherwise>
300 </xsl:choose>
301 </xsl:template>
302
303
304 <xsl:template name="openbookimg">
305 <xsl:param name="alt"/>
306 <xsl:param name="title"/>
307 <img border="0" width="28" height="23"
308 src="interfaces/classic/images/openbook.gif"
309 alt="{$alt}" title="{$title}"/>
310 </xsl:template>
311
312 <xsl:template name="closedbookimg">
313 <xsl:param name="alt"/>
314 <xsl:param name="title"/>
315 <img border="0" width="18" height="11"
316 src="interfaces/classic/images/book.gif"
317 alt="{$alt}" title="{$title}"/>
318 </xsl:template>
319
320 <xsl:template name="openfolderimg">
321 <xsl:param name="alt"/>
322 <xsl:param name="title"/>
323 <img border="0" width="23" height="15"
324 src="interfaces/classic/images/openfldr.gif"
325 alt="{$alt}" title="{$title}"/>
326 </xsl:template>
327
328 <xsl:template name="closedfolderimg">
329 <xsl:param name="alt"/>
330 <xsl:param name="title"/>
331 <img border="0" width="23" height="15"
332 src="interfaces/classic/images/clsdfldr.gif"
333 alt="{$alt}" title="{$title}"/>
334 </xsl:template>
335
336 <xsl:template name="textpageimg">
337 <xsl:param name="alt"/>
338 <xsl:param name="title"/>
339 <img border="0" width="16" height="21"
340 src="interfaces/classic/images/itext.gif"
341 alt="{$alt}" title="{$title}"/>
342 </xsl:template>
343
344 <xsl:template name="bookshelfimg">
345 <xsl:param name="alt"/>
346 <xsl:param name="title"/>
347 <img border="0" width="20" height="16"
348 src="interfaces/classic/images/bshelf.gif"
349 alt="{$alt}" title="{$title}"/>
350 </xsl:template>
351
352 <xsl:template name="iconpdf">
353 <xsl:param name="alt">PDF</xsl:param>
354 <xsl:param name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'texticonpdf')"/></xsl:param>
355 <img border="0" width='26' height='26'
356 src='interfaces/classic/images/ipdf.gif'
357 alt='{$alt}' title='{$title}'/>
358 </xsl:template>
359
360 <xsl:template name="icondoc">
361 <xsl:param name="alt">Word</xsl:param>
362 <xsl:param name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'texticonmsword')"/></xsl:param>
363 <img border="0" width='26' height='26'
364 src='interfaces/classic/images/imsword.gif'
365 alt='{$alt}' title='{$title}'/>
366 </xsl:template>
367
368</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.