comparison xsls/menu.xsls @ 693:095d1972dad9

Added ability to switch languages without context change.
author Vladimir Homutov <vl@nginx.com>
date Fri, 28 Sep 2012 11:14:47 +0000
parents 6c0532e6982f
children cd0d1f0130db
comparison
equal deleted inserted replaced
692:31ba6a104186 693:095d1972dad9
19 } else { 19 } else {
20 !{ normalize-space(text()) }<br/> 20 !{ normalize-space(text()) }<br/>
21 } 21 }
22 22
23 } else { 23 } else {
24 <a>
25 X:attribute "href" {
26 24
27 X:if "starts-with(@href, $DIRNAME)" { 25 <!--
28 X:if "substring-after(@href, $DIRNAME) = ''" { 26 -- If a menu item has the switchlang attribute, then it will point
29 ./ 27 -- to the same document in the specified language.
28 -- The document will be taken from $NOLANGORIGIN variable.
29 -->
30 X:if "@switchlang != ''" {
30 31
31 } else { 32 <!--
32 !{ substring-after(@href, $DIRNAME) } 33 -- Check if list of available translations ($TRANS) contains
33 } 34 -- the language we are going to generate link to.
35 -- If yes - generate link, otherwise just name the language.
36 -->
37 X:if "contains($TRANS, @switchlang)" {
38 <a>
39 X:attribute "href" {
40 X:if "$ROOT != '' " {
41 !{ concat($ROOT, '/', @switchlang, '/', $NOLANGORIGIN) }
42 } else {
43 !{ concat(@switchlang, '/', $NOLANGORIGIN) }
44 }
45 }
46 !{ normalize-space(text()) }
47 </a>
34 48
35 } else { 49 } else {
36 !{ concat($ROOT, @href) } 50 <a class="notrans"> !{ normalize-space(text()) } </a>
37 } 51 }
52 } else {
53
54 <a>
55 X:attribute "href" {
56
57 X:if "starts-with(@href, $DIRNAME)" {
58 X:if "substring-after(@href, $DIRNAME) = ''" {
59 ./
60 } else {
61 !{ substring-after(@href, $DIRNAME) }
62 }
63
64 } else {
65
66 !{ concat($ROOT, @href) }
67 }
68 }
69 !{ normalize-space(text()) }
70 </a>
71
72 X:if "@lang" { X:text { [} !{@lang} X:text {]}}
38 } 73 }
39 !{ normalize-space(text()) }
40 </a>
41
42 X:if "@lang" { X:text { [} !{@lang} X:text {]}}
43 74
44 <br/> 75 <br/>
45 } 76 }
46 } 77 }
47 78