source: greenstone3/trunk/web/interfaces/gs2/transform/style.xsl@ 18318

Last change on this file since 18318 was 18318, checked in by kjdon, 15 years ago

made the indentation nice

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