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

Last change on this file since 4278 was 4278, checked in by kjdon, 21 years ago

removed width att from coll image in coll page banner

  • Property svn:keywords set to Author Date Id Revision
File size: 15.9 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 extension-element-prefixes="java">
6
7 <!-- the main page layout template is here -->
8 <xsl:template match="page">
9 <html>
10 <xsl:call-template name="pageHead"/>
11 <body xsl:use-attribute-sets="body-style">
12 <table border="0" cellspacing="0" cellpadding="0" width="100%">
13 <td valign="top" width="65">
14 <img src="interfaces/default/images/spacer.gif" width="65" height="1" alt="" border="0"/>
15 </td>
16 <td>
17 <center>
18 <table width="537">
19 <tr><td>
20 <xsl:apply-templates select="pageResponse"/>
21 <xsl:call-template name="greenstoneFooter"/>
22 </td></tr>
23 </table>
24 </center>
25 </td>
26 </table>
27 </body>
28 </html>
29 </xsl:template>
30
31 <xsl:template name="headScript">
32 <script>
33 <xsl:text disable-output-escaping="yes">
34 &lt;!--
35 var loaded = new Array();
36 function gbutton (image, onimage) {
37 if (image &amp;&amp; image.src &amp;&amp; (image.out == null || typeof(image.out) == typeof(void(0)))) {
38 s = image.src;
39 image.out = new Image();
40 image.out.src = s;
41 image.over = new Image();
42 image.over.src = onimage;
43 loaded[image.name] = image;
44 }
45 }
46
47 function roll (imagename, over) {
48 if (document.images) {
49 if (over) i = "over";
50 else i = "out";
51 image = loaded[imagename];
52 if (image) image.src = eval("image."+i+".src");
53 }
54 }
55 //--&gt;
56 </xsl:text>
57
58 </script>
59 </xsl:template>
60
61 <xsl:template name="genericPageBanner">
62 <xsl:variable name="library" select="ancestor::page/pageExtra/config/library_name"/>
63 <xsl:variable name="lang" select="ancestor::page/@lang"/>
64 <center>
65 <table width="537">
66 <tr><td align="left"></td>
67 <td align="right">
68 <a href="{$library}?a=p&amp;sa=home" onMouseover="roll('homer',1);" onMouseOut="roll('homer',0);"><img name="homer" src="interfaces/nzdl/images/{$lang}/chomeof.gif" onLoad="gbutton(this, 'interfaces/nzdl/images/{$lang}/chomeon.gif');" border="0" alt="Home page"/></a>
69 </td>
70 </tr>
71 </table>
72 </center>
73 <xsl:call-template name="greenBar"/>
74 </xsl:template>
75
76
77 <!-- just pass in collname cos use it everywhere - saves working it out lots of times -->
78 <xsl:template name="collectionPageBanner">
79 <xsl:param name="collName"/>
80 <xsl:param name="pageType"/>
81 <xsl:variable name="httpPath" select="ancestor::page/pageResponse/collection/metadataList/metadata[@name='httpPath']"/>
82 <xsl:variable name="colIcon" select="ancestor::page/pageResponse/collection/metadataList/metadata[@name='colIcon']"/>
83 <xsl:variable name="library" select="ancestor::page/pageExtra/config/library_name"/>
84 <xsl:variable name="lang" select="ancestor::page/@lang"/>
85 <table width="537">
86 <tr>
87 <td align="left" rowspan="2">
88 <a href="{$library}?a=p&amp;sa=about&amp;c={$collName}">
89 <img border="1" src="{$httpPath}/images/{$colIcon}">
90 <xsl:attribute name="alt">
91 <xsl:call-template name="text">
92 <xsl:with-param name="key">aboutpage</xsl:with-param>
93 </xsl:call-template>
94 </xsl:attribute>
95 </img>
96 </a>
97 </td>
98 <td align="right">
99 <a href="{$library}?a=p&amp;sa=home" onMouseover="roll('homer',1);" onMouseOut="roll('homer',0);"><img name="homer" src="interfaces/nzdl/images/{$lang}/chomeof.gif" onLoad="gbutton(this, 'interfaces/nzdl/images/{$lang}/chomeon.gif');" border="0" alt="Home page"/></a>
100 <a href="{$library}?a=p&amp;sa=help&amp;c={$collName}" onMouseover="roll('help',1);" onMouseOut="roll('help',0);"><img name="help" src="interfaces/nzdl/images/{$lang}/chelpof.gif" onLoad="gbutton(this, 'interfaces/nzdl/images/{$lang}/chelpon.gif');" border="0" alt="Help page"/></a>
101 <a href="{$library}?a=p&amp;sa=pref&amp;c={$collName}" onMouseover="roll('pref',1);" onMouseOut="roll('pref',0);"><img name="pref" src="interfaces/nzdl/images/{$lang}/cprefof.gif" onLoad="gbutton(this, 'interfaces/nzdl/images/{$lang}/cprefon.gif');" border="0" alt="Preferences page"/></a>
102 </td>
103 </tr>
104 <tr>
105 <td align='right'><xsl:if test="$pageType"><img src="interfaces/nzdl/images/{$lang}/h_{$pageType}.gif" width="200" height="57"/></xsl:if></td>
106 </tr>
107
108 <tr>
109 <td colspan='2'></td>
110 </tr>
111 </table>
112
113 <xsl:call-template name="navigationBar">
114 <xsl:with-param name="collName" select="$collName"/>
115 </xsl:call-template>
116 </xsl:template>
117
118 <xsl:template name="navigationBar">
119 <xsl:param name="collName"/>
120 <xsl:variable name="classifiers" select="ancestor::page/pageResponse/collection/serviceList/service[@name='ClassifierBrowse']/classifierList"/>
121 <xsl:variable name="action" select="ancestor::page/pageRequest/@action"/>
122 <xsl:variable name="classifier" select="ancestor::page/pageRequest/paramList/param[@name='cl']/@value"/>
123 <xsl:variable name="lang" select="ancestor::page/@lang"/>
124 <!--action=<xsl:value-of select="$action"/>, classifier=<xsl:value-of select="$classifier"/>-->
125 <xsl:text disable-output-escaping='yes'>
126 &lt;!-- Navigation Bar --&gt;
127 </xsl:text>
128 <nobr>
129 <xsl:call-template name="nbSearch">
130 <xsl:with-param name="collName" select="$collName"/>
131 <xsl:with-param name="action" select="$action"/>
132 </xsl:call-template>
133
134 <xsl:for-each select="$classifiers/classifier">
135 <xsl:apply-templates select="." mode="nav-bar-button">
136 <xsl:with-param name="collName" select="$collName"/>
137 <xsl:with-param name="classifier" select="$classifier"/>
138 </xsl:apply-templates>
139 </xsl:for-each>
140 <xsl:call-template name="nbPhrase"> <!-- this may be nothing if there is no phrase browsing for a collection -->
141 <xsl:with-param name="collName" select="$collName"/>
142 <xsl:with-param name="action" select="$action"/>
143 </xsl:call-template>
144 </nobr>
145 <xsl:text disable-output-escaping='yes'>
146 &lt;!-- End of Navigation Bar --&gt;
147 </xsl:text>
148 </xsl:template>
149
150
151 <xsl:template name="navBarImage">
152 <xsl:param name="url"/>
153 <xsl:param name="name"/>
154 <xsl:param name="alt"/>
155 <xsl:variable name="lang" select="ancestor::page/@lang"/>
156 <a href="{$url}" onMouseOver="roll('{$name}', 1);" onMouseOut="roll('{$name}', 0);"><img name="{$name}" src="interfaces/nzdl/images/{$lang}/t{$name}of.gif" onLoad="gbutton(this,'interfaces/nzdl/images/{$lang}/t{$name}on.gif');" border='0' alt="{$alt}" title="{alt}"/></a>
157 </xsl:template>
158
159 <xsl:template name="nbSearch">
160 <xsl:param name="collName"/>
161 <xsl:param name="action"/>
162 <xsl:variable name="lang" select="ancestor::page/@lang"/>
163 <xsl:choose>
164 <xsl:when test="$action='q'">
165 <img src="interfaces/nzdl/images/{$lang}/tSearchgr.gif" border='0' alt="Search" title="Search"/>
166 </xsl:when>
167 <xsl:otherwise>
168 <xsl:call-template name="navBarImage">
169 <xsl:with-param name="url">nzdl?a=q&amp;rt=d&amp;s=TextQuery&amp;c=<xsl:value-of select="$collName"/></xsl:with-param>
170 <xsl:with-param name="name">Search</xsl:with-param>
171 <xsl:with-param name="alt">Search</xsl:with-param>
172 </xsl:call-template>
173 </xsl:otherwise>
174 </xsl:choose>
175 </xsl:template>
176
177 <xsl:template name="nbPhrase">
178 <xsl:param name="collName"/>
179 <xsl:param name="action"/>
180 <xsl:variable name="lang" select="ancestor::page/@lang"/>
181 <xsl:if test="ancestor::page/pageResponse/collection/serviceList/service[@name='PhindApplet']">
182 <xsl:choose>
183 <xsl:when test="$action='a'"><!-- note, this assumes that the phind applet is the only applet -->
184 <img src="interfaces/nzdl/images/{$lang}/tPhrasegr.gif" border='0' alt="Phrase Browse" title="Phrase Browse"/>
185 </xsl:when>
186 <xsl:otherwise>
187 <xsl:call-template name="navBarImage">
188 <xsl:with-param name="url">nzdl?a=a&amp;rt=d&amp;s=PhindApplet&amp;c=<xsl:value-of select="$collName"/></xsl:with-param>
189 <xsl:with-param name="name">Phrase</xsl:with-param>
190 <xsl:with-param name="alt">Phrase Browse</xsl:with-param>
191 </xsl:call-template>
192 </xsl:otherwise>
193 </xsl:choose>
194 </xsl:if>
195 </xsl:template>
196
197 <xsl:template match="classifier" mode="nav-bar-button">
198 <xsl:param name="collName"/>
199 <xsl:param name="classifier"/>
200 <xsl:variable name="buttonname"><xsl:choose><xsl:when test="@buttonname"><xsl:value-of select="@buttonname"/></xsl:when><xsl:otherwise><xsl:value-of select="@content"/></xsl:otherwise></xsl:choose></xsl:variable>
201 <xsl:variable name="lang" select="ancestor::page/@lang"/>
202 <xsl:choose>
203 <xsl:when test="$classifier=@name">
204 <img src="interfaces/nzdl/images/{$lang}/t{$buttonname}gr.gif" border='0' alt="{$buttonname}" title="{$buttonname}"/>
205 </xsl:when>
206 <xsl:otherwise>
207 <xsl:call-template name="navBarImage">
208 <xsl:with-param name="url">nzdl?a=b&amp;rt=r&amp;s=ClassifierBrowse&amp;c=<xsl:value-of select="$collName"/>&amp;cl=<xsl:value-of select="@name"/></xsl:with-param>
209 <xsl:with-param name="name" select="$buttonname"/>
210 <xsl:with-param name="alt" select="$buttonname"/>
211 </xsl:call-template>
212 </xsl:otherwise>
213 </xsl:choose>
214 </xsl:template>
215
216
217<!-- Navigation Bar
218<nobr>
219<img
220src="/gsdl/images/tsrchgr.gif" width=87 border=0><img
221src="/gsdl/images/tspace.gif" width="19" height="17"><a href="/cgi-bin/library?e=&a=d&cl=CL1" onMouseover="roll('titles',1);" onMouseOut="roll('titles',0);"><img
222name="titles" src="/gsdl/images/ttitlof.gif" onLoad="gbutton(this,'/gsdl/images/ttitlon.gif');" border=0 alt="Browse alphabetical list of titles"></a><img
223src="/gsdl/images/tspace.gif" width="19" height="17"><a href="/cgi-bin/library?e=&a=d&cl=CL2" onMouseover="roll('authors',1);" onMouseOut="roll('authors',0);"><img
224name="authors" src="/gsdl/images/tauthof.gif" onLoad="gbutton(this,'/gsdl/images/tauthon.gif');" border=0 alt="Browse alphabetical list of authors"></a><img
225src="/gsdl/images/tspace.gif" width="19" height="17"><a href="/cgi-bin/library?e=&a=d&cl=CL3" onMouseover="roll('dates',1);" onMouseOut="roll('dates',0);"><img
226name="dates" src="/gsdl/images/tdateof.gif" onLoad="gbutton(this,'/gsdl/images/tdateon.gif');" border=0 alt="Browse by date"></a><img
227src="/gsdl/images/tspace.gif" width="19" height="17"><a href="/cgi-bin/library?e=&a=d&cl=CL4" onMouseover="roll('phrase',1);" onMouseOut="roll('phrase',0);"><img
228name="phrase" src="/gsdl/images/tphrseof.gif" onLoad="gbutton(this,'/gsdl/images/tphrseon.gif');" border=0 alt="Browse phrases"></a>
229</nobr>
230 End of Navigation Bar -->
231
232 <!-- do we want different stuff for cluster or same as collection -->
233 <xsl:template name="clusterPageBanner">
234 <xsl:param name="clusterName"/>
235 <xsl:variable name="library" select="ancestor::page/pageExtra/config/library_name"/>
236 <table width="537">
237 <tr><td align="left"><a href="{$library}?a=p&amp;sa=about&amp;c={$clusterName}"><xsl:value-of select="$clusterName"/></a></td><td align="right"><a href="{$library}?a=p&amp;sa=home"><xsl:call-template name="text"><xsl:with-param name="key">home</xsl:with-param></xsl:call-template></a></td></tr></table>
238
239 <xsl:call-template name="greenBar"/>
240 </xsl:template>
241
242
243 <xsl:attribute-set name="body-style">
244 <xsl:attribute name="bgcolor">#ffffff</xsl:attribute>
245 <xsl:attribute name="text">#000000</xsl:attribute>
246 <xsl:attribute name="link">#006666</xsl:attribute>
247 <xsl:attribute name="alink">#cc9900</xsl:attribute>
248 <xsl:attribute name="vlink">#666633</xsl:attribute>
249 <xsl:attribute name="background">interfaces/default/images/chalk.gif</xsl:attribute>
250 </xsl:attribute-set>
251
252 <!-- this should probably use a greenstone image rather than nzdl image -->
253 <xsl:template name="nzdlPageBanner">
254 <center>
255 <table width="537" cellspacing="0" cellpadding="0">
256 <tr valign="top">
257 <td rowspan="2" align="left"><center><img src="interfaces/nzdl/images/nzdl2gr.gif" width="457" height="181" ><xsl:attribute name="alt"><xsl:call-template name="text"><xsl:with-param name="key">nzdl</xsl:with-param></xsl:call-template></xsl:attribute></img></center></td>
258 <td align="right"></td>
259 </tr>
260
261 <tr>
262 <td align="right"></td>
263 </tr>
264
265 <tr>
266 <td colspan="2"></td>
267 </tr>
268 </table>
269 </center>
270
271 <!-- end of page banner -->
272
273 </xsl:template>
274
275 <xsl:template name="greenstoneFooter">
276 <center>
277 <p/>
278 <small>powered by greenstone3</small>
279 </center>
280 </xsl:template>
281
282
283 <xsl:template name="greenBar">
284 <p/><img src="interfaces/default/images/divb.gif" width="537" height="17"/>
285 </xsl:template>
286
287 <xsl:template name="iconblankbar">
288 <p/><img src="interfaces/default/images/divb.gif" width="537" height="17"/>
289 </xsl:template>
290
291 <xsl:template name="imagegreenstone">
292 <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>
293 </xsl:template>
294
295
296 <!-- Display the appropriate image, depending on the node type -->
297 <xsl:template match="documentNode" mode="displayNodeIcon">
298
299 <!-- Root node: book icon (open or closed) -->
300 <xsl:if test="@nodeType='root'">
301 <xsl:choose>
302 <xsl:when test="documentNode">
303 <img border="0" width="28" height="23"
304 src="interfaces/default/images/openbook.gif"
305 alt="Close this book"/>
306 </xsl:when>
307 <xsl:otherwise>
308 <img border="0" width="18" height="11"
309 src="interfaces/default/images/book.gif"
310 alt="Open this document and view contents"/>
311 </xsl:otherwise>
312 </xsl:choose>
313 </xsl:if>
314
315 <!-- Interior node: folder icon (open or closed) -->
316 <xsl:if test="@nodeType='interior'">
317 <xsl:choose>
318 <xsl:when test="documentNode">
319 <img border="0" width="23" height="15"
320 src="interfaces/default/images/openfldr.gif"
321 alt="Close this folder"/>
322 </xsl:when>
323 <xsl:otherwise>
324 <img border="0" width="23" height="15"
325 src="interfaces/default/images/clsdfldr.gif"
326 alt="Open this folder and view contents"/>
327 </xsl:otherwise>
328 </xsl:choose>
329 </xsl:if>
330
331 <!-- Leaf node: page icon -->
332 <xsl:if test="@nodeType='leaf'">
333 <img border="0" width="16" height="21"
334 src="interfaces/default/images/itext.gif"
335 alt="View the document"/>
336 </xsl:if>
337</xsl:template>
338
339
340
341
342<!-- text stuff. can be called via xsl:call-template:
343
344<xsl:call-template name="text"><xsl:with-param name="key">your text name here</xsl:with-param></xsl:call-template>
345
346otherwise can be selected by :
347
348<xsl:apply-templates select="text"/>
349
350the text elem to be processed must be in the form
351<text name="query/about"/>
352
353-->
354
355<xsl:template name="text" match="text">
356<xsl:param name="key"><xsl:value-of select="@name"/></xsl:param>
357<xsl:variable name="path">ancestor::page/pageExtra/display/<xsl:value-of select='$key'/></xsl:variable>
358<xsl:variable name="string1"><xsl:value-of select="java:org.apache.xalan.lib.Extensions.evaluate($path)"/></xsl:variable>
359<xsl:choose><xsl:when test="boolean(string($string1))"><xsl:value-of select="$string1"/></xsl:when>
360<xsl:otherwise>
361
362<!-- no match found, output the name of the text string -->
363_<xsl:value-of select="$key"/>_</xsl:otherwise>
364</xsl:choose>
365</xsl:template>
366
367
368<!-- may not have to use this anymore-->
369<xsl:template name="text-old" match="text-old">
370
371<xsl:param name="key"><xsl:value-of select="@name"/></xsl:param>
372
373<!-- try the current language -->
374
375<xsl:variable name="path1">ancestor::page/translate/current/text/<xsl:value-of select="$key"/></xsl:variable>
376<xsl:variable name="string1"><xsl:value-of select="java:org.apache.xalan.lib.Extensions.evaluate($path1)"/></xsl:variable>
377<xsl:choose><xsl:when test="boolean(string($string1))"><xsl:value-of select="$string1"/></xsl:when>
378<xsl:otherwise>
379
380<!-- try the default language -->
381<xsl:variable name="path2">ancestor::page/translate/default/text/<xsl:value-of select="$key"/></xsl:variable>
382<xsl:variable name="string2"><xsl:value-of select="java:org.apache.xalan.lib.Extensions.evaluate($path2)"/></xsl:variable>
383<xsl:choose><xsl:when test="boolean(string($string1))"><xsl:value-of select="$string1"/></xsl:when>
384<xsl:otherwise>
385
386<!-- no match found, output the name of the text string -->
387_<xsl:value-of select="$key"/>_</xsl:otherwise>
388</xsl:choose>
389</xsl:otherwise>
390</xsl:choose>
391</xsl:template>
392
393</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.