Mercurial > hg > nginx-site
comparison xsls/link.xsls @ 0:61e04fc01027
Initial import of the nginx.org website.
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Thu, 11 Aug 2011 12:19:13 +0000 |
parents | |
children | 9d3403f5204d |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:61e04fc01027 |
---|---|
1 X:stylesheet { | |
2 | |
3 | |
4 <!-- {a href="/en/docs/page.xml" /} --> | |
5 | |
6 X:template = "a[starts-with(@href, '/') | |
7 and string() = '' | |
8 and contains(@href, '.xml')]" | |
9 { | |
10 <a> | |
11 X:attribute "href" { | |
12 | |
13 <!-- | |
14 -- variables are not allowed in a template match predicate: | |
15 -- a[starts-with(@href, $DIRNAME) ... ] | |
16 -- therefore, we have to test this using "if" | |
17 --> | |
18 | |
19 X:if "starts-with(@href, $DIRNAME)" { | |
20 | |
21 <!-- convert to a link "docs/page.html" --> | |
22 | |
23 !{ substring-after(document(concat($XML, @href))/article/@link, | |
24 $DIRNAME) } | |
25 } else { | |
26 | |
27 <!-- convert to a link "../../../en/docs/page.html" --> | |
28 | |
29 !{ concat($ROOT, document(concat($XML, @href))/article/@link) } | |
30 } | |
31 } | |
32 !{ document(concat($XML, @href))/article/@title } | |
33 </a> | |
34 } | |
35 | |
36 | |
37 <!-- {a href="/en/docs/page.xml"} TEXT {/a} --> | |
38 | |
39 X:template = "a[starts-with(@href, '/') | |
40 and string() | |
41 and contains(@href, '.xml')]" | |
42 { | |
43 <a> | |
44 X:attribute "href" { | |
45 X:if "starts-with(@href, $DIRNAME)" { | |
46 !{ substring-after(document(concat($XML, @href))/article/@link, | |
47 $DIRNAME) } | |
48 } else { | |
49 !{ concat($ROOT, document(concat($XML, @href))/article/@link) } | |
50 } | |
51 } | |
52 !!; | |
53 </a> | |
54 } | |
55 | |
56 X:template = "a" { <a href="{@href}"> !!; </a> } | |
57 | |
58 X:template = "img" { <img src="{@href}"> !!; </img> } | |
59 | |
60 } |