/
page-structure.xsl
784 lines (703 loc) · 40 KB
/
page-structure.xsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
<!--
The contents of this file are subject to the license and copyright
detailed in the LICENSE and NOTICE files at the root of the source
tree and available online at
http://www.dspace.org/license/
-->
<!--
Main structure of the page, determines where
header, footer, body, navigation are structurally rendered.
Rendering of the header, footer, trail and alerts
Author: art.lowel at atmire.com
Author: lieven.droogmans at atmire.com
Author: ben at atmire.com
Author: Alexey Maslov
-->
<xsl:stylesheet xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
xmlns:dri="http://di.tamu.edu/DRI/1.0/"
xmlns:mets="http://www.loc.gov/METS/"
xmlns:xlink="http://www.w3.org/TR/xlink/"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:dim="http://www.dspace.org/xmlns/dspace/dim"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:mods="http://www.loc.gov/mods/v3"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:confman="org.dspace.core.ConfigurationManager"
xmlns="http://www.w3.org/1999/xhtml"
exclude-result-prefixes="i18n dri mets xlink xsl dim xhtml mods dc confman">
<xsl:output indent="yes"/>
<!--
Requested Page URI. Some functions may alter behavior of processing depending if URI matches a pattern.
Specifically, adding a static page will need to override the DRI, to directly add content.
-->
<xsl:variable name="request-uri" select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='request'][@qualifier='URI']"/>
<!--
The starting point of any XSL processing is matching the root element. In DRI the root element is document,
which contains a version attribute and three top level elements: body, options, meta (in that order).
This template creates the html document, giving it a head and body. A title and the CSS style reference
are placed in the html head, while the body is further split into several divs. The top-level div
directly under html body is called "ds-main". It is further subdivided into:
"ds-header" - the header div containing title, subtitle, trail and other front matter
"ds-body" - the div containing all the content of the page; built from the contents of dri:body
"ds-options" - the div with all the navigation and actions; built from the contents of dri:options
"ds-footer" - optional footer div, containing misc information
The order in which the top level divisions appear may have some impact on the design of CSS and the
final appearance of the DSpace page. While the layout of the DRI schema does favor the above div
arrangement, nothing is preventing the designer from changing them around or adding new ones by
overriding the dri:document template.
-->
<xsl:template match="dri:document">
<html class="no-js">
<!-- First of all, build the HTML head element -->
<xsl:call-template name="buildHead"/>
<!-- Then proceed to the body -->
<!--paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/-->
<xsl:text disable-output-escaping="yes"><!--[if lt IE 7 ]> <body class="ie6"> <![endif]-->
<!--[if IE 7 ]> <body class="ie7"> <![endif]-->
<!--[if IE 8 ]> <body class="ie8"> <![endif]-->
<!--[if IE 9 ]> <body class="ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--><body><!--<![endif]--></xsl:text>
<xsl:choose>
<xsl:when test="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='framing'][@qualifier='popup']">
<xsl:apply-templates select="dri:body/*"/>
</xsl:when>
<xsl:otherwise>
<div id="ds-main">
<!--The header div, complete with title, subtitle and other junk-->
<xsl:call-template name="buildHeader"/>
<!--The trail is built by applying a template over pageMeta's trail children. -->
<xsl:call-template name="buildTrail"/>
<!--javascript-disabled warning, will be invisible if javascript is enabled-->
<div id="no-js-warning-wrapper" class="hidden">
<div id="no-js-warning">
<div class="notice failure">
<xsl:text>JavaScript is disabled for your browser. Some features of this site may not work without it.</xsl:text>
</div>
</div>
</div>
<!--ds-content is a groups ds-body and the navigation together and used to put the clearfix on, center, etc.
ds-content-wrapper is necessary for IE6 to allow it to center the page content-->
<div id="ds-content-wrapper">
<div id="ds-content" class="clearfix">
<!--
Goes over the document tag's children elements: body, options, meta. The body template
generates the ds-body div that contains all the content. The options template generates
the ds-options div that contains the navigation and action options available to the
user. The meta element is ignored since its contents are not processed directly, but
instead referenced from the different points in the document. -->
<xsl:apply-templates/>
</div>
</div>
<!--
The footer div, dropping whatever extra information is needed on the page. It will
most likely be something similar in structure to the currently given example. -->
<xsl:call-template name="buildFooter"/>
</div>
</xsl:otherwise>
</xsl:choose>
<!-- Javascript at the bottom for fast page loading -->
<xsl:call-template name="addJavascript"/>
<xsl:text disable-output-escaping="yes"></body></xsl:text>
</html>
</xsl:template>
<!-- The HTML head element contains references to CSS as well as embedded JavaScript code. Most of this
information is either user-provided bits of post-processing (as in the case of the JavaScript), or
references to stylesheets pulled directly from the pageMeta element. -->
<xsl:template name="buildHead">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<!-- Mobile Viewport Fix
j.mp/mobileviewport & davidbcalhoun.com/2010/viewport-metatag
device-width : Occupy full width of the screen in its current orientation
initial-scale = 1.0 retains dimensions instead of zooming out if page height > device height
maximum-scale = 1.0 retains dimensions instead of zooming in if page width < device width
-->
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0;"/>
<link rel="shortcut icon">
<xsl:attribute name="href">
<xsl:value-of select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='contextPath'][not(@qualifier)]"/>
<xsl:text>/themes/</xsl:text>
<xsl:value-of select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='theme'][@qualifier='path']"/>
<xsl:text>/images/favicon.ico</xsl:text>
</xsl:attribute>
</link>
<link rel="apple-touch-icon">
<xsl:attribute name="href">
<xsl:value-of select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='contextPath'][not(@qualifier)]"/>
<xsl:text>/themes/</xsl:text>
<xsl:value-of select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='theme'][@qualifier='path']"/>
<xsl:text>/images/apple-touch-icon.png</xsl:text>
</xsl:attribute>
</link>
<meta name="Generator">
<xsl:attribute name="content">
<xsl:text>DSpace</xsl:text>
<xsl:if test="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='dspace'][@qualifier='version']">
<xsl:text> </xsl:text>
<xsl:value-of select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='dspace'][@qualifier='version']"/>
</xsl:if>
</xsl:attribute>
</meta>
<!-- Add stylesheets -->
<xsl:for-each select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='stylesheet']">
<link rel="stylesheet" type="text/css">
<xsl:attribute name="media">
<xsl:value-of select="@qualifier"/>
</xsl:attribute>
<xsl:attribute name="href">
<xsl:value-of select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='contextPath'][not(@qualifier)]"/>
<xsl:text>/themes/</xsl:text>
<xsl:value-of select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='theme'][@qualifier='path']"/>
<xsl:text>/</xsl:text>
<xsl:value-of select="."/>
</xsl:attribute>
</link>
</xsl:for-each>
<!-- Add syndication feeds -->
<xsl:for-each select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='feed']">
<link rel="alternate" type="application">
<xsl:attribute name="type">
<xsl:text>application/</xsl:text>
<xsl:value-of select="@qualifier"/>
</xsl:attribute>
<xsl:attribute name="href">
<xsl:value-of select="."/>
</xsl:attribute>
</link>
</xsl:for-each>
<!-- Add OpenSearch auto-discovery link -->
<xsl:if test="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='opensearch'][@qualifier='shortName']">
<link rel="search" type="application/opensearchdescription+xml">
<xsl:attribute name="href">
<xsl:value-of select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='request'][@qualifier='scheme']"/>
<xsl:text>://</xsl:text>
<xsl:value-of select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='request'][@qualifier='serverName']"/>
<xsl:text>:</xsl:text>
<xsl:value-of select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='request'][@qualifier='serverPort']"/>
<xsl:value-of select="$context-path"/>
<xsl:text>/</xsl:text>
<xsl:value-of select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='opensearch'][@qualifier='autolink']"/>
</xsl:attribute>
<xsl:attribute name="title" >
<xsl:value-of select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='opensearch'][@qualifier='shortName']"/>
</xsl:attribute>
</link>
</xsl:if>
<!-- The following javascript removes the default text of empty text areas when they are focused on or submitted -->
<!-- There is also javascript to disable submitting a form when the 'enter' key is pressed. -->
<script type="text/javascript">
//Clear default text of empty text areas on focus
function tFocus(element)
{
if (element.value == '<i18n:text>xmlui.dri2xhtml.default.textarea.value</i18n:text>'){element.value='';}
}
//Clear default text of empty text areas on submit
function tSubmit(form)
{
var defaultedElements = document.getElementsByTagName("textarea");
for (var i=0; i != defaultedElements.length; i++){
if (defaultedElements[i].value == '<i18n:text>xmlui.dri2xhtml.default.textarea.value</i18n:text>'){
defaultedElements[i].value='';}}
}
//Disable pressing 'enter' key to submit a form (otherwise pressing 'enter' causes a submission to start over)
function disableEnterKey(e)
{
var key;
if(window.event)
key = window.event.keyCode; //Internet Explorer
else
key = e.which; //Firefox and Netscape
if(key == 13) //if "Enter" pressed, then disable!
return false;
else
return true;
}
function FnArray()
{
this.funcs = new Array;
}
FnArray.prototype.add = function(f)
{
if( typeof f!= "function" )
{
f = new Function(f);
}
this.funcs[this.funcs.length] = f;
};
FnArray.prototype.execute = function()
{
for( var i=0; i <xsl:text disable-output-escaping="yes"><</xsl:text> this.funcs.length; i++ )
{
this.funcs[i]();
}
};
var runAfterJSImports = new FnArray();
</script>
<!-- Modernizr enables HTML5 elements & feature detects -->
<script type="text/javascript">
<xsl:attribute name="src">
<xsl:value-of select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='contextPath'][not(@qualifier)]"/>
<xsl:text>/themes/</xsl:text>
<xsl:value-of select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='theme'][@qualifier='path']"/>
<xsl:text>/lib/js/modernizr-1.7.min.js</xsl:text>
</xsl:attribute> </script>
<!-- Add the title in -->
<xsl:variable name="page_title" select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='title']" />
<title>
<xsl:choose>
<xsl:when test="starts-with($request-uri, 'page/about')">
<xsl:text>About This Repository</xsl:text>
</xsl:when>
<xsl:when test="not($page_title)">
<i18n:text>xmlui.dri2xhtml.METS-1.0.no-title</i18n:text>
</xsl:when>
<xsl:when test="$page_title = ''">
<i18n:text>xmlui.dri2xhtml.METS-1.0.no-title</i18n:text>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="$page_title/node()" />
</xsl:otherwise>
</xsl:choose>
</title>
<!-- Head metadata in item pages -->
<xsl:if test="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='xhtml_head_item']">
<xsl:value-of select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='xhtml_head_item']"
disable-output-escaping="yes"/>
</xsl:if>
<!-- Add all Google Scholar Metadata values -->
<xsl:for-each select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[substring(@element, 1, 9) = 'citation_']">
<meta name="{@element}" content="{.}"></meta>
</xsl:for-each>
</head>
</xsl:template>
<!-- The header (distinct from the HTML head element) contains the title, subtitle, login box and various
placeholders for header images -->
<xsl:template name="buildHeader">
<div id="ds-header-wrapper">
<div id="ds-header" class="clearfix">
<a id="ds-header-logo-link">
<xsl:attribute name="href">
<xsl:value-of
select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='contextPath'][not(@qualifier)]"/>
<xsl:text>/</xsl:text>
</xsl:attribute>
<span id="ds-header-logo"> </span>
<span id="ds-header-logo-text">
<i18n:text>xmlui.dri2xhtml.structural.head-subtitle</i18n:text>
</span>
</a>
<h1 class="pagetitle visuallyhidden">
<xsl:choose>
<!-- protection against an empty page title -->
<xsl:when test="not(/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='title'])">
<xsl:text> </xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of
select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='title']/node()"/>
</xsl:otherwise>
</xsl:choose>
</h1>
<xsl:choose>
<xsl:when test="/dri:document/dri:meta/dri:userMeta/@authenticated = 'yes'">
<div id="ds-user-box">
<p>
<a>
<xsl:attribute name="href">
<xsl:value-of select="/dri:document/dri:meta/dri:userMeta/
dri:metadata[@element='identifier' and @qualifier='url']"/>
</xsl:attribute>
<i18n:text>xmlui.dri2xhtml.structural.profile</i18n:text>
<xsl:value-of select="/dri:document/dri:meta/dri:userMeta/
dri:metadata[@element='identifier' and @qualifier='firstName']"/>
<xsl:text> </xsl:text>
<xsl:value-of select="/dri:document/dri:meta/dri:userMeta/
dri:metadata[@element='identifier' and @qualifier='lastName']"/>
</a>
<xsl:text> | </xsl:text>
<a>
<xsl:attribute name="href">
<xsl:value-of select="/dri:document/dri:meta/dri:userMeta/
dri:metadata[@element='identifier' and @qualifier='logoutURL']"/>
</xsl:attribute>
<i18n:text>xmlui.dri2xhtml.structural.logout</i18n:text>
</a>
</p>
</div>
</xsl:when>
<xsl:otherwise>
<div id="ds-user-box">
<p>
<a>
<xsl:attribute name="href">
<xsl:value-of select="/dri:document/dri:meta/dri:userMeta/
dri:metadata[@element='identifier' and @qualifier='loginURL']"/>
</xsl:attribute>
<i18n:text>xmlui.dri2xhtml.structural.login</i18n:text>
</a>
</p>
</div>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="languageSelection" />
</div>
</div>
</xsl:template>
<!-- The header (distinct from the HTML head element) contains the title, subtitle, login box and various
placeholders for header images -->
<xsl:template name="buildTrail">
<div id="ds-trail-wrapper">
<ul id="ds-trail">
<xsl:choose>
<xsl:when test="starts-with($request-uri, 'page/about')">
<xsl:text>About This Repository</xsl:text>
</xsl:when>
<xsl:when test="count(/dri:document/dri:meta/dri:pageMeta/dri:trail) = 0">
<li class="ds-trail-link first-link">-</li>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="/dri:document/dri:meta/dri:pageMeta/dri:trail"/>
</xsl:otherwise>
</xsl:choose>
</ul>
</div>
</xsl:template>
<xsl:template match="dri:trail">
<!--put an arrow between the parts of the trail-->
<xsl:if test="position()>1">
<li class="ds-trail-arrow">
<xsl:text>→</xsl:text>
</li>
</xsl:if>
<li>
<xsl:attribute name="class">
<xsl:text>ds-trail-link </xsl:text>
<xsl:if test="position()=1">
<xsl:text>first-link </xsl:text>
</xsl:if>
<xsl:if test="position()=last()">
<xsl:text>last-link</xsl:text>
</xsl:if>
</xsl:attribute>
<!-- Determine whether we are dealing with a link or plain text trail link -->
<xsl:choose>
<xsl:when test="./@target">
<a>
<xsl:attribute name="href">
<xsl:value-of select="./@target"/>
</xsl:attribute>
<xsl:apply-templates />
</a>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates />
</xsl:otherwise>
</xsl:choose>
</li>
</xsl:template>
<xsl:template name="cc-license">
<xsl:param name="metadataURL"/>
<xsl:variable name="externalMetadataURL">
<xsl:text>cocoon:/</xsl:text>
<xsl:value-of select="$metadataURL"/>
<xsl:text>?sections=dmdSec,fileSec&fileGrpTypes=THUMBNAIL</xsl:text>
</xsl:variable>
<xsl:variable name="ccLicenseName"
select="document($externalMetadataURL)//dim:field[@element='rights']"
/>
<xsl:variable name="ccLicenseUri"
select="document($externalMetadataURL)//dim:field[@element='rights'][@qualifier='uri']"
/>
<xsl:variable name="handleUri">
<xsl:for-each select="document($externalMetadataURL)//dim:field[@element='identifier' and @qualifier='uri']">
<a>
<xsl:attribute name="href">
<xsl:copy-of select="./node()"/>
</xsl:attribute>
<xsl:copy-of select="./node()"/>
</a>
<xsl:if test="count(following-sibling::dim:field[@element='identifier' and @qualifier='uri']) != 0">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:if test="$ccLicenseName and $ccLicenseUri and contains($ccLicenseUri, 'creativecommons')">
<div about="{$handleUri}" class="clearfix">
<xsl:attribute name="style">
<xsl:text>margin:0em 2em 0em 2em; padding-bottom:0em;</xsl:text>
</xsl:attribute>
<a rel="license"
href="{$ccLicenseUri}"
alt="{$ccLicenseName}"
title="{$ccLicenseName}"
>
<xsl:call-template name="cc-logo">
<xsl:with-param name="ccLicenseName" select="$ccLicenseName"/>
<xsl:with-param name="ccLicenseUri" select="$ccLicenseUri"/>
</xsl:call-template>
</a>
<span>
<xsl:attribute name="style">
<xsl:text>vertical-align:middle; text-indent:0 !important;</xsl:text>
</xsl:attribute>
<i18n:text>xmlui.dri2xhtml.METS-1.0.cc-license-text</i18n:text>
<xsl:value-of select="$ccLicenseName"/>
</span>
</div>
</xsl:if>
</xsl:template>
<xsl:template name="cc-logo">
<xsl:param name="ccLicenseName"/>
<xsl:param name="ccLicenseUri"/>
<xsl:variable name="ccLogo">
<xsl:choose>
<xsl:when test="starts-with($ccLicenseUri,
'http://creativecommons.org/licenses/by/')">
<xsl:value-of select="'cc-by.png'" />
</xsl:when>
<xsl:when test="starts-with($ccLicenseUri,
'http://creativecommons.org/licenses/by-sa/')">
<xsl:value-of select="'cc-by-sa.png'" />
</xsl:when>
<xsl:when test="starts-with($ccLicenseUri,
'http://creativecommons.org/licenses/by-nd/')">
<xsl:value-of select="'cc-by-nd.png'" />
</xsl:when>
<xsl:when test="starts-with($ccLicenseUri,
'http://creativecommons.org/licenses/by-nc/')">
<xsl:value-of select="'cc-by-nc.png'" />
</xsl:when>
<xsl:when test="starts-with($ccLicenseUri,
'http://creativecommons.org/licenses/by-nc-sa/')">
<xsl:value-of select="'cc-by-nc-sa.png'" />
</xsl:when>
<xsl:when test="starts-with($ccLicenseUri,
'http://creativecommons.org/licenses/by-nc-nd/')">
<xsl:value-of select="'cc-by-nc-nd.png'" />
</xsl:when>
<xsl:when test="starts-with($ccLicenseUri,
'http://creativecommons.org/publicdomain/zero/')">
<xsl:value-of select="'cc-zero.png'" />
</xsl:when>
<xsl:when test="starts-with($ccLicenseUri,
'http://creativecommons.org/publicdomain/mark/')">
<xsl:value-of select="'cc-mark.png'" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="'cc-generic.png'" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="ccLogoImgSrc">
<xsl:value-of select="$theme-path"/>
<xsl:text>/images/creativecommons/</xsl:text>
<xsl:value-of select="$ccLogo"/>
</xsl:variable>
<img>
<xsl:attribute name="src">
<xsl:value-of select="$ccLogoImgSrc"/>
</xsl:attribute>
<xsl:attribute name="alt">
<xsl:value-of select="$ccLicenseName"/>
</xsl:attribute>
<xsl:attribute name="style">
<xsl:text>float:left; margin:0em 1em 0em 0em; border:none;</xsl:text>
</xsl:attribute>
</img>
</xsl:template>
<!-- Like the header, the footer contains various miscellaneous text, links, and image placeholders -->
<xsl:template name="buildFooter">
<div id="ds-footer-wrapper">
<div id="ds-footer">
<div id="ds-footer-left">
<a href="http://www.dspace.org/" target="_blank">DSpace software</a> copyright © 2002-2012  <a href="http://www.duraspace.org/" target="_blank">Duraspace</a>
</div>
<div id="ds-footer-right">
<span class="theme-by">Theme by </span>
<a title="@mire NV" target="_blank" href="http://atmire.com" id="ds-footer-logo-link">
<span id="ds-footer-logo"> </span>
</a>
</div>
<div id="ds-footer-links">
<a>
<xsl:attribute name="href">
<xsl:value-of
select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='contextPath'][not(@qualifier)]"/>
<xsl:text>/contact</xsl:text>
</xsl:attribute>
<i18n:text>xmlui.dri2xhtml.structural.contact-link</i18n:text>
</a>
<xsl:text> | </xsl:text>
<a>
<xsl:attribute name="href">
<xsl:value-of
select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='contextPath'][not(@qualifier)]"/>
<xsl:text>/feedback</xsl:text>
</xsl:attribute>
<i18n:text>xmlui.dri2xhtml.structural.feedback-link</i18n:text>
</a>
</div>
<!--Invisible link to HTML sitemap (for search engines) -->
<a class="hidden">
<xsl:attribute name="href">
<xsl:value-of
select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='contextPath'][not(@qualifier)]"/>
<xsl:text>/htmlmap</xsl:text>
</xsl:attribute>
<xsl:text> </xsl:text>
</a>
</div>
</div>
</xsl:template>
<!--
The meta, body, options elements; the three top-level elements in the schema
-->
<!--
The template to handle the dri:body element. It simply creates the ds-body div and applies
templates of the body's child elements (which consists entirely of dri:div tags).
-->
<xsl:template match="dri:body">
<div id="ds-body">
<xsl:if test="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='alert'][@qualifier='message']">
<div id="ds-system-wide-alert">
<p>
<xsl:copy-of select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='alert'][@qualifier='message']/node()"/>
</p>
</div>
</xsl:if>
<!-- Check for the custom pages -->
<xsl:choose>
<xsl:when test="starts-with($request-uri, 'page/about')">
<div>
<h1>About This Repository</h1>
<p>To add your own content to this page, edit webapps/xmlui/themes/Mirage/lib/xsl/core/page-structure.xsl and
add your own content to the title, trail, and body. If you wish to add additional pages, you
will need to create an additional xsl:when block and match the request-uri to whatever page
you are adding. Currently, static pages created through altering XSL are only available
under the URI prefix of page/.</p>
</div>
</xsl:when>
<!-- Otherwise use default handling of body -->
<xsl:otherwise>
<xsl:apply-templates />
</xsl:otherwise>
</xsl:choose>
</div>
</xsl:template>
<!-- Currently the dri:meta element is not parsed directly. Instead, parts of it are referenced from inside
other elements (like reference). The blank template below ends the execution of the meta branch -->
<xsl:template match="dri:meta">
</xsl:template>
<!-- Meta's children: userMeta, pageMeta, objectMeta and repositoryMeta may or may not have templates of
their own. This depends on the meta template implementation, which currently does not go this deep.
<xsl:template match="dri:userMeta" />
<xsl:template match="dri:pageMeta" />
<xsl:template match="dri:objectMeta" />
<xsl:template match="dri:repositoryMeta" />
-->
<xsl:template name="addJavascript">
<xsl:variable name="jqueryVersion">
<xsl:text>1.6.2</xsl:text>
</xsl:variable>
<xsl:variable name="protocol">
<xsl:choose>
<xsl:when test="starts-with(confman:getProperty('dspace.baseUrl'), 'https://')">
<xsl:text>https://</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>http://</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<script type="text/javascript" src="{concat($protocol, 'ajax.googleapis.com/ajax/libs/jquery/', $jqueryVersion ,'/jquery.min.js')}"> </script>
<xsl:variable name="localJQuerySrc">
<xsl:value-of select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='contextPath'][not(@qualifier)]"/>
<xsl:text>/static/js/jquery-</xsl:text>
<xsl:value-of select="$jqueryVersion"/>
<xsl:text>.min.js</xsl:text>
</xsl:variable>
<script type="text/javascript">
<xsl:text disable-output-escaping="yes">!window.jQuery && document.write('<script type="text/javascript" src="</xsl:text><xsl:value-of
select="$localJQuerySrc"/><xsl:text disable-output-escaping="yes">"> <\/script>')</xsl:text>
</script>
<!-- Add theme javascipt -->
<xsl:for-each select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='javascript'][@qualifier='url']">
<script type="text/javascript">
<xsl:attribute name="src">
<xsl:value-of select="."/>
</xsl:attribute> </script>
</xsl:for-each>
<xsl:for-each select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='javascript'][not(@qualifier)]">
<script type="text/javascript">
<xsl:attribute name="src">
<xsl:value-of select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='contextPath'][not(@qualifier)]"/>
<xsl:text>/themes/</xsl:text>
<xsl:value-of select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='theme'][@qualifier='path']"/>
<xsl:text>/</xsl:text>
<xsl:value-of select="."/>
</xsl:attribute> </script>
</xsl:for-each>
<!-- add "shared" javascript from static, path is relative to webapp root -->
<xsl:for-each select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='javascript'][@qualifier='static']">
<!--This is a dirty way of keeping the scriptaculous stuff from choice-support
out of our theme without modifying the administrative and submission sitemaps.
This is obviously not ideal, but adding those scripts in those sitemaps is far
from ideal as well-->
<xsl:choose>
<xsl:when test="text() = 'static/js/choice-support.js'">
<script type="text/javascript">
<xsl:attribute name="src">
<xsl:value-of select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='contextPath'][not(@qualifier)]"/>
<xsl:text>/themes/</xsl:text>
<xsl:value-of select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='theme'][@qualifier='path']"/>
<xsl:text>/lib/js/choice-support.js</xsl:text>
</xsl:attribute> </script>
</xsl:when>
<xsl:when test="not(starts-with(text(), 'static/js/scriptaculous'))">
<script type="text/javascript">
<xsl:attribute name="src">
<xsl:value-of
select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='contextPath'][not(@qualifier)]"/>
<xsl:text>/</xsl:text>
<xsl:value-of select="."/>
</xsl:attribute> </script>
</xsl:when>
</xsl:choose>
</xsl:for-each>
<!-- add setup JS code if this is a choices lookup page -->
<xsl:if test="dri:body/dri:div[@n='lookup']">
<xsl:call-template name="choiceLookupPopUpSetup"/>
</xsl:if>
<!--PNG Fix for IE6-->
<xsl:text disable-output-escaping="yes"><!--[if lt IE 7 ]></xsl:text>
<script type="text/javascript">
<xsl:attribute name="src">
<xsl:value-of select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='contextPath'][not(@qualifier)]"/>
<xsl:text>/themes/</xsl:text>
<xsl:value-of select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='theme'][@qualifier='path']"/>
<xsl:text>/lib/js/DD_belatedPNG_0.0.8a.js?v=1</xsl:text>
</xsl:attribute> </script>
<script type="text/javascript">
<xsl:text>DD_belatedPNG.fix('#ds-header-logo');DD_belatedPNG.fix('#ds-footer-logo');$.each($('img[src$=png]'), function() {DD_belatedPNG.fixPng(this);});</xsl:text>
</script>
<xsl:text disable-output-escaping="yes" ><![endif]--></xsl:text>
<script type="text/javascript">
runAfterJSImports.execute();
</script>
<!-- Add a google analytics script if the key is present -->
<xsl:if test="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='google'][@qualifier='analytics']">
<script type="text/javascript"><xsl:text>
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '</xsl:text><xsl:value-of select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='google'][@qualifier='analytics']"/><xsl:text>']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</xsl:text></script>
</xsl:if>
</xsl:template>
</xsl:stylesheet>