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

Last change on this file since 6688 was 6688, checked in by nzdl, 20 years ago

some small display changes to make it more like nzdl.org

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