source: deprecated/ui/xslt/temp/style.xsl@ 26820

Last change on this file since 26820 was 16315, checked in by davidb, 16 years ago

Merging of skin work with the main trunk

File size: 17.3 KB
Line 
1<xsl:stylesheet version="1.0" xmlns:gslib="http://www.greenstone.org/skinning" xmlns:xalan="http://xml.apache.org/xalan" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
2
3<xsl:output method="html" />
4
5<xsl:template match="/">
6 <html>
7 <head>
8 <title>
9 <xsl:call-template name="metadataItem"><xsl:with-param name="name">siteName</xsl:with-param></xsl:call-template>
10 /
11 <xsl:call-template name="metadataItem"><xsl:with-param name="name">collectionName</xsl:with-param></xsl:call-template>
12 </title>
13
14 <xsl:copy-of select="$css" />
15 <xsl:copy-of select="$js" />
16
17 </head>
18 <body>
19 <div id="container">
20
21 <div id="header">
22 <div class="title_minor">
23
24 <a href="{$site_homeUrl}">
25 <xsl:call-template name="metadataItem"><xsl:with-param name="name">siteName</xsl:with-param></xsl:call-template>
26
27 </a>
28 </div>
29
30 <div class="title_major">
31 <xsl:call-template name="metadataItem"><xsl:with-param name="name">collectionName</xsl:with-param></xsl:call-template>
32 </div>
33
34 <div class="linklist" id="tablist">
35 <ul>
36 <xsl:for-each select="$serviceNames">
37
38 <li>
39 <a href="">
40 <xsl:attribute name="href"> <xsl:call-template name="service_url"><xsl:with-param name="serviceName"><xsl:value-of disable-output-escaping="yes" select="." /></xsl:with-param></xsl:call-template> </xsl:attribute>
41 <xsl:attribute name="title"> <xsl:call-template name="service_description"><xsl:with-param name="serviceName"><xsl:value-of disable-output-escaping="yes" select="." /></xsl:with-param></xsl:call-template> </xsl:attribute>
42 <xsl:call-template name="service_title"><xsl:with-param name="serviceName"><xsl:value-of disable-output-escaping="yes" select="." /></xsl:with-param></xsl:call-template>
43 </a>
44 </li>
45
46 </xsl:for-each>
47 </ul>
48 </div>
49 </div>
50
51 <div class="noSidebar" id="content">
52 <div class="linklist" id="subServiceList">
53 <ul>
54 <xsl:for-each select="$classifierNames">
55 <li>
56
57 <xsl:choose>
58 <xsl:when test=". = $currentClassifierName">
59 <xsl:call-template name="classifier_title"><xsl:with-param name="clsName"><xsl:value-of disable-output-escaping="yes" select="." /></xsl:with-param></xsl:call-template>
60 </xsl:when>
61 <xsl:otherwise>
62 <a>
63 <xsl:attribute name="title"><xsl:call-template name="classifier_description"><xsl:with-param name="clsName"><xsl:value-of disable-output-escaping="yes" select="." /></xsl:with-param></xsl:call-template></xsl:attribute>
64 <xsl:attribute name="href"><xsl:call-template name="classifier_url"><xsl:with-param name="clsName"><xsl:value-of disable-output-escaping="yes" select="." /></xsl:with-param></xsl:call-template></xsl:attribute>
65
66 <xsl:call-template name="classifier_title"><xsl:with-param name="clsName"><xsl:value-of disable-output-escaping="yes" select="." /></xsl:with-param></xsl:call-template>
67 </a>
68
69 </xsl:otherwise>
70 </xsl:choose>
71 </li>
72 </xsl:for-each>
73 </ul>
74 </div>
75
76 <div id="classifierData">
77 <ul>
78 <xsl:for-each select="$topLevelClassifierNodes">
79
80 <li>
81 <a>
82 blah
83 </a>
84 </li>
85 </xsl:for-each>
86 </ul>
87 </div>
88 </div>
89
90
91 <div id="footer">
92 <xsl:call-template name="uiItem"><xsl:with-param name="name">collectionFooter</xsl:with-param></xsl:call-template>
93 </div>
94 </div>
95 </body>
96 </html>
97</xsl:template>
98
99<xsl:template name="displayClassifierNode">
100 <li>
101
102 <a>
103 <xsl:attribute name="href"><xsl:call-template name="classifierNode_url"><xsl:with-param name="id"><xsl:value-of disable-output-escaping="yes" select="." /></xsl:with-param></xsl:call-template></xsl:attribute>
104 <xsl:call-template name="classifierNode_title"><xsl:with-param name="id"><xsl:value-of disable-output-escaping="yes" select="." /></xsl:with-param></xsl:call-template>
105 </a>
106
107 <xsl:variable name="childIds"><xsl:call-template name="classifierNode_childNodeIds"><xsl:with-param name="id"><xsl:value-of disable-output-escaping="yes" select="." /></xsl:with-param></xsl:call-template></xsl:variable>
108
109 <xsl:for-each select="$childIds">
110 <xsl:call-template name="displayClassifierNode" />
111 </xsl:for-each>
112 </li>
113
114</xsl:template>
115
116
117
118
119
120
121
122
123
124<xsl:variable name="librarian">dev</xsl:variable>
125
126<xsl:variable name="action" select="/page/pageRequest/@action" />
127
128<xsl:variable name="subaction" select="/page/pageRequest/@subaction" />
129
130<xsl:variable name="lang" select="/page/pageRequest/@lang" />
131
132<xsl:variable name="css">
133 <xsl:for-each select="/page/pageResponse/cssFileList/cssFile">
134 <link href="{@path}" rel="stylesheet" type="text/css" />
135 </xsl:for-each>
136</xsl:variable>
137
138<xsl:variable name="js">
139 <xsl:for-each select="/page/pageResponse/jsFileList/jsFile">
140 <script src="{@path}" type="text/javascript" />
141
142 </xsl:for-each>
143</xsl:variable>
144
145<xsl:template name="metadataItem">
146 <xsl:param name="name" />
147
148 <xsl:variable name="x" select="/page/pageResponse/metadataList/metadataItem[@name=$name]" />
149
150 <xsl:choose>
151 <xsl:when test="$x = ''">
152 metadataItem &apos;<xsl:value-of select="$name" />&apos; not defined.
153 </xsl:when>
154
155 <xsl:otherwise>
156 <xsl:for-each select="$x">
157 <xsl:call-template name="expandMetadataAndUiItems" />
158 </xsl:for-each>
159 </xsl:otherwise>
160 </xsl:choose>
161
162</xsl:template>
163
164
165<xsl:template name="uiItem">
166
167 <xsl:param name="name" />
168
169 <xsl:variable name="x" select="/page/pageResponse/uiItemList/uiItem[@name=$name]" />
170
171 <xsl:choose>
172 <xsl:when test="$x = ''">
173 uiItem &apos;<xsl:value-of select="$name" />&apos; not defined.
174 </xsl:when>
175 <xsl:otherwise>
176 <xsl:for-each select="$x">
177
178 <xsl:call-template name="expandMetadataAndUiItems" />
179 </xsl:for-each>
180 </xsl:otherwise>
181 </xsl:choose>
182
183</xsl:template>
184
185
186
187<xsl:variable name="collectionNames" select="/page/pageResponse/collectionList/collection/@name" />
188
189<xsl:template name="collection_title">
190 <xsl:param name="name" />
191
192 <xsl:value-of select="/page/pageResponse/collectionList/collection[@name=$name]/displayItem[@name='name']" />
193</xsl:template>
194
195<xsl:template name="collection_description">
196 <xsl:param name="name" />
197 <xsl:value-of select="/page/pageResponse/collectionList/collection[@name=$name]/displayItem[@name='description']" />
198</xsl:template>
199
200<xsl:template name="collection_url">
201 <xsl:param name="name" />
202 <xsl:value-of select="$librarian" />
203 ?a=p&amp;sa=about&amp;c=
204 <xsl:value-of select="$name" />
205
206</xsl:template>
207
208<xsl:variable name="site_homeUrl">
209 <xsl:value-of select="$librarian" />
210 ?a=p&amp;sa=home
211</xsl:variable>
212
213
214
215<xsl:variable name="collection" select="/page/pageResponse/collection/@name" />
216
217<xsl:variable name="serviceNames" select="/page/pageResponse/collection/serviceList/service[@type='query' or @type='browse']/@name" />
218
219<xsl:template name="service_title">
220
221 <xsl:param name="serviceName" />
222 <xsl:value-of select="/page/pageResponse/collection/serviceList/service[@name=$serviceName]/displayItem[@name='name']" />
223</xsl:template>
224
225<xsl:template name="service_description">
226 <xsl:param name="serviceName" />
227 <xsl:value-of select="/page/pageResponse/collection/serviceList/service[@name=$serviceName]/displayItem[@name='description']" />
228</xsl:template>
229
230<xsl:template name="service_url">
231 <xsl:param name="serviceName" />
232
233
234 <xsl:variable name="service" select="/page/pageResponse/collection/serviceList/service[@name=$serviceName]" />
235
236 <xsl:variable name="serviceAction">
237 <xsl:choose>
238
239 <xsl:when test="$service/@type='query'">q</xsl:when>
240 <xsl:when test="$service/@type='browse'">b</xsl:when>
241 <xsl:when test="$service/@type='process'">pr</xsl:when>
242 <xsl:when test="$service/@type='applet'">a</xsl:when>
243 <xsl:otherwise>DO_NOT_DISPLAY</xsl:otherwise>
244
245 </xsl:choose>
246 </xsl:variable>
247
248 <xsl:value-of select="$librarian" />?a=
249 <xsl:value-of select="$serviceAction" />&amp;rt=d&amp;s=
250 <xsl:value-of select="$serviceName" />&amp;c=
251 <xsl:value-of select="$collection" />
252</xsl:template>
253
254<xsl:variable name="classifierNames" select="/page/pageResponse/collection/serviceList//classifier/@name" />
255
256<xsl:template name="classifier_title">
257 <xsl:param name="clsName" />
258
259 <xsl:value-of select="/page/pageResponse/collection/serviceList//classifier[@name=$clsName]/displayItem[@name='name']" />
260</xsl:template>
261
262<xsl:template name="classifier_description">
263 <xsl:param name="clsName" />
264 <xsl:value-of select="/page/pageResponse/collection/serviceList//classifier[@name=$clsName]/displayItem[@name='description']" />
265</xsl:template>
266
267<xsl:template name="classifier_url">
268 <xsl:param name="clsName" />
269 <xsl:value-of select="$librarian" />
270 ?a=b&amp;rt=r&amp;s=
271 <xsl:value-of select="/page/pageResponse/collection/serviceList//classifier[@name=$clsName]/../../@name" />
272
273 &amp;c=
274 <xsl:value-of select="$collection" />
275 &amp;cl=
276 <xsl:value-of select="$clsName" />
277</xsl:template>
278
279
280
281
282<xsl:template name="hidden_search_params">
283 <input name="c" type="hidden" value="{$collection}" />
284 <input name="a" type="hidden" value="q" />
285 <input name="s" type="hidden" value="TextQuery" />
286</xsl:template>
287
288<xsl:template name="search_param_li">
289 <xsl:param name="search_param" />
290 <li>
291 <xsl:for-each select="$search_param/displayItem[@name='name']">
292 <xsl:value-of select="." />
293 </xsl:for-each>
294
295 <xsl:choose>
296
297 <xsl:when test="$search_param/@type='boolean' or $search_param/@type='enum_single'">
298 <select name="s1.{$search_param/@name}">
299
300 <xsl:for-each select="$search_param/option">
301 <option name="{@name}">
302 <xsl:for-each select="./displayItem[@name='name']">
303 <xsl:value-of select="." />
304 </xsl:for-each>
305 </option>
306 </xsl:for-each>
307 </select>
308 </xsl:when>
309
310
311
312 <xsl:when test="$search_param/@type='integer'">
313 <input name="s1.{$search_param/@name}" value="{$search_param/@default}" />
314 </xsl:when>
315
316 <xsl:when test="$search_param/@type='invisible'">
317 <input name="s1.{$search_param/@name}" type="hidden" value="{$search_param/@default}" />
318 </xsl:when>
319
320 </xsl:choose>
321 </li>
322
323</xsl:template>
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341<xsl:variable name="currentClassifierName" select="/page/pageResponse/classifier/@name" />
342
343<xsl:variable name="topLevelClassifierNodes" select="/page/pageResponse/classifier/classifierNode" />
344
345<xsl:variable name="topLevelClassifierNodeIds" select="/page/pageResponse/classifier/classifierNode/@nodeID" />
346
347<xsl:template name="classifierNode_title">
348 <xsl:value-of select="./metadataList/metadata[@name='Title']" />
349</xsl:template>
350
351<xsl:template name="classifierNode_url">
352 <xsl:param name="id" />
353
354 <xsl:value-of select="$librarian" />
355
356 ?a=b&amp;rt=r&amp;s=
357 <xsl:value-of select="/page/pageResponse/service/@name" />
358 &amp;c=
359 <xsl:value-of select="$collection" />
360 &amp;cl=
361 <xsl:value-of select="$id" />
362</xsl:template>
363
364<xsl:template name="classifierNode_childNodeIds">
365 <xsl:param name="id" />
366 <xsl:value-of select="/page/pageResponse/classifier//classifierNode[@nodeID=$id]/classifierNode/@nodeID" />
367
368</xsl:template>
369
370<xsl:template name="list_classifer_data">
371 <ul>
372 <xsl:for-each select="/page/pageResponse/classifier/classifierNode">
373 <xsl:call-template name="expand_classifier_node" />
374 </xsl:for-each>
375 <xsl:for-each select="/page/pageResponse/classifier/documentNode">
376 <li class="leafNode">
377
378 <xsl:call-template name="documentNode" />
379
380 </li>
381 </xsl:for-each>
382 </ul>
383</xsl:template>
384
385<xsl:template name="expand_classifier_node">
386 <xsl:choose>
387
388 <xsl:when test="classifierNode or documentNode">
389
390 <li class="expandedNode">
391
392 <xsl:call-template name="classifierNode" />
393
394
395 <xsl:if test="classifierNode">
396 <ul>
397 <xsl:for-each select="classifierNode">
398 <xsl:call-template name="expand_classifier_node" />
399 </xsl:for-each>
400 </ul>
401 </xsl:if>
402 <xsl:if test="documentNode">
403 <ul>
404
405 <xsl:for-each select="documentNode">
406 <li class="leafNode">
407
408 <xsl:call-template name="documentNode" />
409 </li>
410 </xsl:for-each>
411 </ul>
412 </xsl:if>
413 </li>
414 </xsl:when>
415
416 <xsl:otherwise>
417 <li class="collapsedNode">
418
419 <xsl:call-template name="classifierNode" />
420 </li>
421 </xsl:otherwise>
422 </xsl:choose>
423</xsl:template>
424
425
426
427<xsl:variable name="document_coverImage_exists" select="/page/pageResponse/document/@hasCoverImage" />
428
429<xsl:variable name="document_coverImage_url">
430 <xsl:if test="$document_coverImage_exists">
431 <xsl:value-of select="/page/pageResponse/collection/metadataList/metadata[@name='httpPath']" />/index/assoc/<xsl:value-of select="normalize-space(/page/pageResponse/document/metadataList/metadata[@name='archivedir'])" />/cover.jpg
432 </xsl:if>
433</xsl:variable>
434
435<xsl:variable name="document_type" select="/page/pageResponse/document/@docType" />
436
437<xsl:variable name="document_hash" select="/page/pageResponse/document/documentNode/@nodeID" />
438
439<xsl:variable name="document_is_expanded" select="/page/pageRequest/paramList/param[@name='ed']/@value=1" />
440
441<xsl:variable name="document_expanded_url">
442
443 <xsl:value-of select="$librarian" />?a=d&amp;
444 c=<xsl:value-of select="$collection" />&amp;
445 d=<xsl:value-of select="$document_hash" />&amp;
446 ed=1
447</xsl:variable>
448
449<xsl:variable name="document_collapsed_url">
450 <xsl:value-of select="$librarian" />?a=d&amp;
451
452 c=<xsl:value-of select="$collection" />&amp;
453 d=<xsl:value-of select="$document_hash" />
454</xsl:variable>
455
456<xsl:variable name="document_title">
457 <xsl:choose>
458 <xsl:when test="$document_type='simple'">
459 <xsl:value-of disable-output-escaping="yes" select="/page/pageResponse/document/metadataList/metadata[@name='Title']" />
460 </xsl:when>
461
462 <xsl:otherwise>
463 <xsl:value-of disable-output-escaping="yes" select="/page/pageResponse/document/documentNode/metadataList/metadata[@name='Title']" />
464 </xsl:otherwise>
465 </xsl:choose>
466</xsl:variable>
467
468<xsl:variable name="document_content">
469 <xsl:choose>
470 <xsl:when test="$document_type='simple'">
471 <xsl:value-of select="$document_currentSection_content" />
472
473 </xsl:when>
474 </xsl:choose>
475</xsl:variable>
476
477<xsl:variable name="document_allSectionIds" select="/page/pageResponse/document//documentNode[@nodeType!='root']" />
478
479<xsl:variable name="document_topLevelSectionIds" select="/page/pageResponse/document/documentNode/documentNode" />
480
481<xsl:template name="document_section_title">
482 <xsl:param name="sectionId" />
483 <xsl:value-of disable-output-escaping="yes" select="//page/pageResponse/document//documentNode[@nodeID=$sectionId]/metadataList/metadata[@name='Title']" />
484</xsl:template>
485
486
487<xsl:variable name="document_currentSection" select="/page/pageResponse/document//nodeContent/.." />
488
489<xsl:variable name="document_currentSection_title" select="$document_currentSection/metadataList/metadata[@name='Title']" />
490
491<xsl:variable name="document_currentSection_content" select="$document_currentSection/nodeContent" />
492
493<xsl:variable name="document_previousSection" select="$document_currentSection/preceding::documentNode[@nodeType='leaf'][1]" />
494
495<xsl:variable name="document_previousSection_title" select="$document_previousSection/metadataList/metadata[@name='Title']" />
496
497<xsl:variable name="document_previousSection_url">
498 <xsl:value-of select="$librarian" />?a=d&amp;
499 c=<xsl:value-of select="$collection" />&amp;
500
501 d=<xsl:value-of select="$document_previousSection/@nodeID" />&amp;
502 sib=1&amp;ec=1
503</xsl:variable>
504
505<xsl:variable name="document_nextSection" select="$document_currentSection/following::documentNode[@nodeType='leaf'][1]" />
506
507<xsl:variable name="document_nextSection_title" select="$document_nextSection/metadataList/metadata[@name='Title']" />
508
509<xsl:variable name="document_nextSection_url">
510 <xsl:value-of select="$librarian" />?a=d&amp;
511 c=<xsl:value-of select="$collection" />&amp;
512
513 d=<xsl:value-of select="$document_nextSection/@nodeID" />&amp;
514 sib=1&amp;ec=1
515</xsl:variable>
516
517<xsl:variable name="document_ancestorSections" select="$document_currentSection/ancestor::documentNode[@nodeType='internal']" />
518
519<xsl:variable name="document_ancestorSections_titles" select="$document_ancestorSections/metadataList/metadata[@name='Title']" />
520
521
522
523
524<xsl:template name="expandMetadataAndUiItems">
525 <xsl:for-each select="*|text()">
526
527 <xsl:choose>
528
529
530 <xsl:when test="self::node()[self::metadataItem]">
531 <xsl:call-template name="metadataItem">
532 <xsl:with-param name="name"><xsl:value-of select="@name" /></xsl:with-param>
533 </xsl:call-template>
534 </xsl:when>
535
536
537 <xsl:when test="self::node()[self::uiItem]">
538 <xsl:call-template name="uiItem">
539
540 <xsl:with-param name="name"><xsl:value-of select="@name" /></xsl:with-param>
541 </xsl:call-template>
542 </xsl:when>
543
544 <xsl:when test="self::text()">
545 <xsl:value-of select="." />
546 </xsl:when>
547
548
549 <xsl:otherwise>
550 <xsl:variable name="element-name" select="name()" />
551
552 <xsl:element name="{$element-name}">
553 <xsl:for-each select="@*">
554 <xsl:variable name="attribute-name" select="name()" />
555 <xsl:attribute name="{$attribute-name}">
556 <xsl:call-template name="attribute-filter" />
557 </xsl:attribute>
558 </xsl:for-each>
559 <xsl:call-template name="expandMetadataAndUiItems" />
560 </xsl:element>
561
562 </xsl:otherwise>
563 </xsl:choose>
564 </xsl:for-each>
565
566</xsl:template>
567
568<xsl:template name="attribute-filter"><xsl:value-of select="." /></xsl:template>
569
570<xsl:template match="gslib:blah">
571 <p> Blah </p>
572</xsl:template>
573
574
575
576</xsl:stylesheet>
577
Note: See TracBrowser for help on using the repository browser.