source: trunk/gsdl3/web/interfaces/default/transform/style.xsl@ 9274

Last change on this file since 9274 was 9274, checked in by kjdon, 19 years ago

added a bit to print out any error nodes

  • Property svn:keywords set to Author Date Id Revision
File size: 10.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 <!-- global style info goes here -->
14 <xsl:template name="globalStyle">
15 <link rel="stylesheet" href="interfaces/default/style/core.css" type="text/css"/>
16 </xsl:template>
17
18 <!-- the main page layout template is here -->
19 <xsl:template match="page">
20 <html>
21 <xsl:call-template name="pageHead"/>
22 <body>
23 <table border="0" cellspacing="0" cellpadding="0" width="100%">
24 <td valign="top" width="65"><!-- a space for our side bar-->
25 <img src="interfaces/default/images/spacer.gif" width="65" height="1" alt="" border="0"/><!-- an image cos netscape ignores the cell width -->
26 </td>
27 <td>
28 <table width="100%">
29 <tr><td>
30 <xsl:apply-templates select="pageResponse"/>
31 <xsl:apply-templates select="descendant::error"/>
32 <xsl:call-template name="greenstoneFooter"/>
33 </td></tr>
34 </table>
35 </td>
36 </table>
37 </body>
38 </html>
39 </xsl:template>
40
41 <!-- put a space in the title in case the actual value is missing - mozilla will not display a page with no title-->
42 <xsl:template name="pageHead">
43 <head>
44 <title>
45 <xsl:call-template name="pageTitle"/><xsl:text> </xsl:text>
46 </title>
47 <xsl:call-template name="globalStyle"/>
48 <xsl:call-template name="pageStyle"/>
49 </head>
50 </xsl:template>
51
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="greenstoneFooter">
59 <center>
60 <p/>
61 <small><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'gs3power')"/></small>
62 </center>
63 </xsl:template>
64
65 <xsl:template match="error">
66 Error: <xsl:value-of select="."/>
67 </xsl:template>
68 <xsl:template name="standardPageBanner">
69 <xsl:param name="collName"/>
70 <xsl:param name="pageType"/>
71 <xsl:variable name="this-element" select="/page/pageResponse/collection|/page/pageResponse/serviceCluster"/>
72 <table width="100%">
73 <tr>
74 <td align="left">
75 <a href="{$library_name}?a=p&amp;sa=about&amp;c={$collName}">
76 <xsl:choose>
77 <xsl:when test="$this-element/displayItem[@name='icon']">
78 <img border="0">
79 <xsl:attribute name="src">
80 <xsl:value-of select="$this-element/metadataList/metadata[@name='httpPath']"/>/images/<xsl:value-of select="$this-element/displayItem[@name='icon']"/>
81 </xsl:attribute>
82 <xsl:attribute name="alt">
83 <xsl:value-of select="$this-element/displayItem[@name='name']"/>
84 </xsl:attribute>
85 <xsl:attribute name="title">
86 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'aboutpage')"/>
87 </xsl:attribute>
88 </img>
89 </xsl:when>
90 <xsl:otherwise>
91 <b><xsl:value-of select="$this-element/displayItem[@name='name']"/></b>
92 </xsl:otherwise>
93 </xsl:choose>
94 </a>
95 </td>
96 <td align="right">
97 <xsl:call-template name="top-buttons">
98 <xsl:with-param name="collName" select="$collName"/>
99 <xsl:with-param name="pageType" select="$pageType"/>
100 </xsl:call-template>
101 </td>
102 </tr>
103 </table>
104 <p/>
105 </xsl:template>
106
107 <xsl:template name="top-buttons">
108 <xsl:param name="collName"/>
109 <xsl:param name="pageType"/>
110 <table cellspacing='4'>
111 <tr>
112 <td class="gsbutton">
113 <a class="gsbutton" 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>
114 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home_b')"/>
115 </a>
116 </td>
117 <xsl:choose>
118 <xsl:when test="$pageType='help'">
119 <td class="gsbuttonoff">
120 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_b')"/>
121 </td>
122 </xsl:when>
123 <xsl:otherwise>
124 <td class="gsbutton">
125 <a class="gsbutton" 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>
126 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'help_b')"/>
127 </a>
128 </td>
129 </xsl:otherwise>
130 </xsl:choose>
131 <xsl:choose>
132 <xsl:when test="$pageType='pref'">
133 <td class="gsbuttonoff">
134 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_b')"/>
135 </td>
136 </xsl:when>
137 <xsl:otherwise>
138 <td class="gsbutton">
139 <a class="gsbutton" 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>
140 <xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'pref_b')"/>
141 </a>
142 </td>
143 </xsl:otherwise>
144 </xsl:choose>
145 </tr>
146 </table>
147
148 </xsl:template>
149
150 <xsl:template name="navigationBar">
151 <xsl:param name="collName"/>
152 <xsl:variable name="this-element" select="/page/pageResponse/collection|/page/pageResponse/serviceCluster"/>
153 <xsl:variable name="this-service" select="/page/pageResponse/service/@name"/>
154 <xsl:choose>
155 <xsl:when test="$this-element/serviceList/service">
156 <table border='0' cellspacing='0' width='100%'>
157 <tr>
158 <xsl:for-each select="$this-element/serviceList/service">
159 <xsl:variable name="action"><xsl:choose>
160 <xsl:when test="@name=$this-service">CURRENT</xsl:when>
161 <xsl:when test="@type='query'">q</xsl:when>
162 <xsl:when test="@type='browse'">b</xsl:when>
163 <xsl:when test="@type='process'">pr</xsl:when>
164 <xsl:when test="@type='applet'">a</xsl:when>
165 <xsl:otherwise>DO_NOT_DISPLAY</xsl:otherwise>
166 </xsl:choose></xsl:variable>
167 <xsl:choose>
168 <xsl:when test="$action='CURRENT'">
169 <td class="navbaroff"><nobr><xsl:value-of select="displayItem[@name='name']"/></nobr></td>
170 </xsl:when>
171 <xsl:when test="$action !='DO_NOT_DISPLAY'">
172 <td class="navbar"><a class="navbar" href="{$library_name}?a={$action}&amp;rt=d&amp;s={@name}&amp;c={$collName}"><xsl:if test="displayItem[@name='description']"><xsl:attribute name='title'><xsl:value-of select="displayItem[@name='description']"/></xsl:attribute></xsl:if><nobr><xsl:value-of select="displayItem[@name='name']"/></nobr></a></td>
173 </xsl:when>
174 </xsl:choose>
175 </xsl:for-each>
176 </tr>
177 </table>
178 </xsl:when>
179 <xsl:otherwise>
180 <table border='0' cellspacing='0' width='100%'><tr><td class="navbar">&#160;</td></tr></table>
181 </xsl:otherwise>
182 </xsl:choose>
183 </xsl:template>
184
185
186 <xsl:template name="dividerBar">
187 <xsl:param name='text'/>
188 <br/><table width='100%' border="0" cellpadding="0" cellspacing="0">
189 <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><br/>
190 </xsl:template>
191
192 <!-- Display the appropriate image, depending on the node type -->
193 <xsl:template match="documentNode" mode="displayNodeIcon">
194
195 <!-- Root node: book icon (open or closed) -->
196 <xsl:choose>
197 <xsl:when test="@nodeType='root'">
198 <xsl:choose>
199 <xsl:when test="documentNode">
200 <xsl:call-template name="openbookimg">
201 <xsl:with-param name="title">Close this book</xsl:with-param>
202 </xsl:call-template>
203 </xsl:when>
204 <xsl:otherwise>
205 <xsl:call-template name="closedbookimg">
206 <xsl:with-param name="title">Open this document and view contents</xsl:with-param>
207 </xsl:call-template>
208 </xsl:otherwise>
209 </xsl:choose>
210 </xsl:when>
211
212 <!-- Internal node: folder icon (open or closed) -->
213 <xsl:when test="@nodeType='internal'">
214 <xsl:choose>
215 <xsl:when test="documentNode">
216 <xsl:call-template name="openfolderimg">
217 <xsl:with-param name="title">Close this folder</xsl:with-param>
218 </xsl:call-template>
219 </xsl:when>
220 <xsl:otherwise>
221 <xsl:call-template name="closedfolderimg">
222 <xsl:with-param name="title">Open this folder and view contents</xsl:with-param>
223 </xsl:call-template>
224 </xsl:otherwise>
225 </xsl:choose>
226 </xsl:when>
227
228 <!-- Leaf node: page icon, and this is the default -->
229 <xsl:otherwise>
230 <xsl:call-template name="textpageimg">
231 <xsl:with-param name="title">View the document</xsl:with-param>
232 </xsl:call-template>
233 </xsl:otherwise>
234 </xsl:choose>
235 </xsl:template>
236
237 <xsl:template name="openbookimg">
238 <xsl:param name="alt"/>
239 <xsl:param name="title"/>
240 <img border="0" width="28" height="23"
241 src="interfaces/default/images/openbook.gif"
242 alt="{$alt}" title="{$title}"/>
243 </xsl:template>
244
245 <xsl:template name="closedbookimg">
246 <xsl:param name="alt"/>
247 <xsl:param name="title"/>
248 <img border="0" width="18" height="11"
249 src="interfaces/default/images/book.gif"
250 alt="{$alt}" title="{$title}"/>
251 </xsl:template>
252
253 <xsl:template name="openfolderimg">
254 <xsl:param name="alt"/>
255 <xsl:param name="title"/>
256 <img border="0" width="23" height="15"
257 src="interfaces/default/images/openfldr.gif"
258 alt="{$alt}" title="{$title}"/>
259 </xsl:template>
260
261 <xsl:template name="closedfolderimg">
262 <xsl:param name="alt"/>
263 <xsl:param name="title"/>
264 <img border="0" width="23" height="15"
265 src="interfaces/default/images/clsdfldr.gif"
266 alt="{$alt}" title="{$title}"/>
267 </xsl:template>
268
269 <xsl:template name="textpageimg">
270 <xsl:param name="alt"/>
271 <xsl:param name="title"/>
272 <img border="0" width="16" height="21"
273 src="interfaces/default/images/itext.gif"
274 alt="{$alt}" title="{$title}"/>
275 </xsl:template>
276
277 <xsl:template name="bookshelfimg">
278 <xsl:param name="alt"/>
279 <xsl:param name="title"/>
280 <img border="0" width="20" height="16"
281 src="interfaces/default/images/bshelf.gif"
282 alt="{$alt}" title="{$title}"/>
283 </xsl:template>
284</xsl:stylesheet>
285
286
Note: See TracBrowser for help on using the repository browser.