Newer
Older
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
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fn="http://www.w3.org/2005/xpath-functions" >
<xsl:template name="navigation.row">
<xsl:param name="rootNode"/>
<xsl:param name="CSSLayoutClass"/>
<!-- read xml item entries and create the link bar -->
<xsl:for-each select="$rootNode/item">
<xsl:call-template name="addLink">
<xsl:with-param name="CSSLayoutClass" select="$CSSLayoutClass"/>
</xsl:call-template>
</xsl:for-each>
</xsl:template>
<xsl:template name="addLink">
<xsl:param name="createSiteMap"/>
<xsl:param name="CSSLayoutClass"/>
<xsl:choose>
<!-- item @type is "intern" -> add the web application path before the link -->
<xsl:when test="@type = 'intern'">
<a class="{$CSSLayoutClass}">
<!--target -->
<xsl:attribute name="target">
<xsl:value-of select="@target"/>
</xsl:attribute>
<!--add lastPage=@href to URL -->
<xsl:variable name="href_intern_tmp">
<xsl:call-template name="UrlSetParam">
<xsl:with-param name="url" select="concat($WebApplicationBaseURL,substring-after(@href,'/'))"/>
<xsl:with-param name="par" select="'XSL.lastPage.SESSION'"/>
<xsl:with-param name="value" select="@href"/>
</xsl:call-template>
</xsl:variable>
<xsl:attribute name="href">
<xsl:call-template name="UrlAddSession">
<xsl:with-param name="url" select="$href_intern_tmp"/>
</xsl:call-template>
</xsl:attribute>
<xsl:choose>
<xsl:when test="@style = 'bold'">
<span style="font-weight:bold;">
<xsl:choose>
<xsl:when test="./label[lang($CurrentLang)] != ''">
<xsl:value-of select="./label[lang($CurrentLang)]"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="./label[lang($DefaultLang)]"/>
</xsl:otherwise>
</xsl:choose>
</span>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="./label[lang($CurrentLang)] != ''">
<xsl:value-of select="./label[lang($CurrentLang)]"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="./label[lang($DefaultLang)]"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</a>
</xsl:when>
<!-- item @type is extern -->
<xsl:otherwise>
<a class="{$CSSLayoutClass}">
<xsl:attribute name="target">
<xsl:value-of select="@target"/>
</xsl:attribute>
<!-- set attribute @href -->
<xsl:variable name="href_temp">
<xsl:choose>
<!-- build $webapplicationbaseurl before link in case @href doesn't start with 'http' & co. -->
<xsl:when test=" starts-with(@href,'http:') or starts-with(@href,'https:') or starts-with(@href,'mailto:') or starts-with(@href,'ftp:')">
<xsl:value-of select="@href"/>
</xsl:when>
<!-- link is relative and not starting with http ... -->
<xsl:otherwise>
<xsl:call-template name="UrlSetParam">
<xsl:with-param name="url" select="concat($WebApplicationBaseURL,substring-after(@href,'/'))"/>
<xsl:with-param name="par" select="'XSL.lastPage.SESSION'"/>
<xsl:with-param name="value" select="fn:encode-for-uri(@href)"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!--add session -->
<xsl:variable name="href_temp2">
<xsl:call-template name="UrlAddSession">
<xsl:with-param name="url" select="$href_temp"/>
</xsl:call-template>
</xsl:variable>
<xsl:attribute name="href">
<xsl:choose>
<!-- in case of $href_temp contains 'servlet' append 'lang=$currentlang' -->
<xsl:when test=" contains($href_temp,'/servlets/') ">
<xsl:call-template name="UrlSetParam">
<xsl:with-param name="url" select="$href_temp2"/>
<xsl:with-param name="par" select="'lang'"/>
<xsl:with-param name="value" select="$CurrentLang"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$href_temp2"/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<!-- end: set attribute @href -->
<xsl:choose>
<xsl:when test="@style = 'bold'">
<span style="font-weight:bold;">
<xsl:choose>
<xsl:when test="./label[lang($CurrentLang)] != ''">
<xsl:value-of select="./label[lang($CurrentLang)]"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="./label[lang($DefaultLang)]"/>
</xsl:otherwise>
</xsl:choose>
</span>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="./label[lang($CurrentLang)] != ''">
<xsl:value-of select="./label[lang($CurrentLang)]"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="./label[lang($DefaultLang)]"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</a>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="navbar">
<xsl:param name="rootNode"/>
<ul class="navbar-nav">
<xsl:for-each select="$rootNode/item">
<li class="nav-item">
<xsl:if test="@userNot = $CurrentUser">
<xsl:attribute name="hidden"/>
<xsl:attribute name="class">hidden</xsl:attribute>
</xsl:if>
<xsl:variable name="top_link">
<xsl:value-of select="@href"/>
</xsl:variable>
<a class="nav-link" href="{$top_link}">
<xsl:if test="./label[lang($CurrentLang)] != ''">
<xsl:value-of select="./label[lang($CurrentLang)]"/>
</xsl:if>
</a>
</li>
</xsl:for-each>
</ul>
</xsl:template>
<!--
<xsl:template name="langalt">
<xsl:if test="$CurrentLang != 'de'">
<link>
<xsl:call-template name="langref">
<xsl:with-param name="lang" select="'de'"/>
<xsl:with-param name="url" select="$RequestURL"/>
<xsl:with-param name="alternative" select="concat($RequestURL, '?lang=de')"/>
</xsl:call-template>
</link>
</xsl:if>
<xsl:if test="$CurrentLang != 'en'">
<link>
<xsl:call-template name="langref">
<xsl:with-param name="lang" select="'en'"/>
<xsl:with-param name="url" select="$RequestURL"/>
<xsl:with-param name="alternative" select="concat($RequestURL, '?lang=en')"/>
</xsl:call-template>
</link>
</xsl:if>
<xsl:if test="$CurrentLang != 'es'">
<link>
<xsl:call-template name="langref">
<xsl:with-param name="lang" select="'es'"/>
<xsl:with-param name="url" select="$RequestURL"/>
<xsl:with-param name="alternative" select="concat($RequestURL, '?lang=es')"/>
</xsl:call-template>
</link>
</xsl:if>
<xsl:if test="$CurrentLang != 'fr'">
<link>
<xsl:call-template name="langref">
<xsl:with-param name="lang" select="'fr'"/>
<xsl:with-param name="url" select="$RequestURL"/>
<xsl:with-param name="alternative" select="concat($RequestURL, '?lang=fr')"/>
</xsl:call-template>
</link>
</xsl:if>
<xsl:if test="$CurrentLang != 'it'">
<link>
<xsl:call-template name="langref">
<xsl:with-param name="lang" select="'it'"/>
<xsl:with-param name="url" select="$RequestURL"/>
<xsl:with-param name="alternative" select="concat($RequestURL, '?lang=it')"/>
</xsl:call-template>
</link>
</xsl:if>
<xsl:if test="$CurrentLang != 'ja'">
<link>
<xsl:call-template name="langref">
<xsl:with-param name="lang" select="'ja'"/>
<xsl:with-param name="url" select="$RequestURL"/>
<xsl:with-param name="alternative" select="concat($RequestURL, '?lang=ja')"/>
</xsl:call-template>
</link>
</xsl:if>
</xsl:template>
-->
<xsl:template name="langchooser">
<xsl:param name="lang"/>
<xsl:param name="url"/>
<xsl:param name="alternative"/>
<xsl:call-template name="langref">
<xsl:with-param name="lang" select="$lang"/>
<xsl:with-param name="url" select="$url"/>
<xsl:with-param name="alternative" select="concat($url, '?lang=', $lang)"/>
</xsl:call-template>
<xsl:attribute name="title">
<xsl:value-of select="document(concat('i18n:module.dptbase.common.navi.lang.',$lang))/i18n/text()"/>
</xsl:attribute>
<xsl:value-of select="document(concat('i18n:module.dptbase.common.navi.lang.',$lang))/i18n/text()"/>
</xsl:template>
<xsl:template name="langref">
<xsl:param name="lang"/>
<xsl:param name="url"/>
<xsl:param name="alternative"/>
<xsl:variable name="newurl">
<xsl:call-template name="UrlSetParam">
<xsl:with-param name="url" select="$url"/>
<xsl:with-param name="par" select="'lang'"/>
<xsl:with-param name="value" select="$lang"/>
</xsl:call-template>
</xsl:variable>
<xsl:attribute name="href">
<xsl:choose>
<xsl:when test="contains($newurl,'MCR:ERROR')">
<xsl:call-template name="UrlAddSession">
<xsl:with-param name="url" select="$alternative"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="UrlAddSession">
<xsl:with-param name="url" select="$newurl"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="hreflang">
<xsl:value-of select="$lang"/>
</xsl:attribute>
<xsl:attribute name="rel">
<xsl:value-of select="'alternate'"/>
</xsl:attribute>
</xsl:template>
<xsl:template name="langmenu">
<xsl:param name="rootNode"/>
<ul class="navbar-nav">
<li class="nav-item dropdown languages">
<a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown">
<span class="fas fa-globe" aria-hidden="true"/>
<span>
<xsl:value-of select="document(concat('i18n:module.dptbase.common.navi.lang.',$CurrentLang))/i18n/text()"/>
</span>
<b class="caret"/>
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item">
<xsl:call-template name="langchooser">
<xsl:with-param name="lang" select="'de'"/>
<xsl:with-param name="url" select="$RequestURL"/>
<xsl:with-param name="alternative" select="concat($RequestURL, '?lang=de')"/>
</xsl:call-template>
</a>
<a class="dropdown-item">
<xsl:call-template name="langchooser">
<xsl:with-param name="lang" select="'en'"/>
<xsl:with-param name="url" select="$RequestURL"/>
<xsl:with-param name="alternative" select="concat($RequestURL, '?lang=de')"/>
</xsl:call-template>
</a>
</div>
</li>
</ul>
</xsl:template>
<xsl:template match="TOC | toc">
<xsl:for-each select="$loaded_navigation_xml//item[@href=$browserAddress]">
<ul>
<xsl:for-each select="child::item">
<li>
<xsl:call-template name="addLink"/>
</li>
</xsl:for-each>
</ul>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>