Mercurial > hg > nginx-site
comparison xslt/menu.xslt @ 170:cd2698ea00ab
Added generated XSLTs.
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Wed, 02 Nov 2011 19:31:11 +0000 |
parents | |
children | 6fa99c92e40a |
comparison
equal
deleted
inserted
replaced
169:b7b160e4e046 | 170:cd2698ea00ab |
---|---|
1 <?xml version="1.0" encoding="utf-8"?> | |
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> | |
3 | |
4 <xsl:template match="menu/item"> | |
5 <xsl:choose> | |
6 | |
7 <xsl:when test="@href = $LINK"> | |
8 <xsl:choose> | |
9 | |
10 <xsl:when test="$YEAR and @href='/'"> | |
11 | |
12 <a href="./"> news </a> | |
13 <br/> | |
14 </xsl:when> | |
15 | |
16 <xsl:otherwise> | |
17 | |
18 <xsl:value-of select=" normalize-space(text())"/> | |
19 <br/> | |
20 </xsl:otherwise> | |
21 </xsl:choose> | |
22 </xsl:when> | |
23 | |
24 <xsl:otherwise> | |
25 | |
26 <a> | |
27 | |
28 <xsl:attribute name="href"> | |
29 <xsl:choose> | |
30 | |
31 <xsl:when test="starts-with(@href, $DIRNAME)"> | |
32 <xsl:choose> | |
33 | |
34 <xsl:when test="substring-after(@href, $DIRNAME) = ''"> | |
35 ./</xsl:when> | |
36 | |
37 <xsl:otherwise> | |
38 | |
39 <xsl:value-of select=" substring-after(@href, $DIRNAME)"/> | |
40 </xsl:otherwise> | |
41 </xsl:choose> | |
42 </xsl:when> | |
43 | |
44 <xsl:otherwise> | |
45 | |
46 <xsl:value-of select=" concat($ROOT, @href)"/> | |
47 </xsl:otherwise> | |
48 </xsl:choose> | |
49 </xsl:attribute> | |
50 | |
51 <xsl:value-of select=" normalize-space(text())"/> | |
52 | |
53 </a> | |
54 | |
55 <xsl:if test="@lang"> | |
56 <xsl:text> [</xsl:text> | |
57 <xsl:value-of select="@lang"/> | |
58 <xsl:text>]</xsl:text> | |
59 </xsl:if> | |
60 | |
61 <br/> | |
62 </xsl:otherwise> | |
63 </xsl:choose> | |
64 </xsl:template> | |
65 | |
66 <xsl:template match="menu/item[@year]"> | |
67 | |
68 <xsl:if test="$YEAR or $LINK='/'"> | |
69 <xsl:choose> | |
70 | |
71 <xsl:when test="$YEAR=@year"> | |
72 | |
73 <xsl:value-of select="@year"/> | |
74 <br/> | |
75 </xsl:when> | |
76 | |
77 <xsl:otherwise> | |
78 | |
79 <a href="{@href}"> | |
80 <xsl:value-of select="@year"/> | |
81 </a> | |
82 | |
83 <br/> | |
84 </xsl:otherwise> | |
85 </xsl:choose> | |
86 </xsl:if> | |
87 </xsl:template> | |
88 | |
89 <xsl:template match="menu/item[starts-with(@href, 'http://')]"> | |
90 | |
91 <a href="{@href}"> | |
92 <xsl:value-of select=" normalize-space(text())"/> | |
93 </a> | |
94 | |
95 <xsl:if test="@lang"> | |
96 <xsl:text> [</xsl:text> | |
97 <xsl:value-of select="@lang"/> | |
98 <xsl:text>]</xsl:text> | |
99 </xsl:if> | |
100 | |
101 <br/> | |
102 </xsl:template> | |
103 | |
104 <xsl:template match="menu/item[not(@href)]"> | |
105 | |
106 <xsl:value-of select=" normalize-space(text())"/> | |
107 <br/> | |
108 </xsl:template> | |
109 | |
110 </xsl:stylesheet> |