source: trunk/gsdl3/web/interfaces/nzdl/transform/style.xsl@ 8534

Last change on this file since 8534 was 8534, checked in by kjdon, 20 years ago

tidied up the style stuff - now uses css. pageHead is now defined by style, with pageTitle and pageStyle in each page. got rid of the attribute sets and colors in style - uses css instead.

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