comparison docs/xslt/changes.xslt @ 4014:234907e676a5

XSLT regeneration for r3998.
author Ruslan Ermilov <ru@nginx.com>
date Fri, 19 Aug 2011 08:39:27 +0000
parents 551102312e19
children 023b288a22b2
comparison
equal deleted inserted replaced
4013:b427290fb6bc 4014:234907e676a5
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> 2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
3 3
4 <xsl:output encoding="koi8-r" method="text"/> 4 <xsl:output encoding="koi8-r" method="text"/>
5 5
6 <xsl:param select="'en'" name="lang"/> 6 <xsl:param select="'en'" name="lang"/>
7
7 <xsl:param select="'../xml/change_log_conf.xml'" name="configuration"/> 8 <xsl:param select="'../xml/change_log_conf.xml'" name="configuration"/>
8 9
9 <xsl:variable select="document($configuration)/configuration" name="conf"/> 10 <xsl:variable select="document($configuration)/configuration" name="conf"/>
11
10 <xsl:variable select="$conf/start" name="start"/> 12 <xsl:variable select="$conf/start" name="start"/>
13
11 <xsl:variable select="$conf/indent" name="indent"/> 14 <xsl:variable select="$conf/indent" name="indent"/>
15
12 <xsl:variable select="$conf/length" name="max"/> 16 <xsl:variable select="$conf/length" name="max"/>
17
13 <xsl:variable name="br">&lt;br&gt;</xsl:variable> 18 <xsl:variable name="br">&lt;br&gt;</xsl:variable>
14 19
15 <xsl:template match="/"> 20 <xsl:template match="/">
16 <xsl:apply-templates select="change_log"/> 21 <xsl:apply-templates select="change_log"/>
17 </xsl:template> 22 </xsl:template>
18 23
19 <xsl:template match="change_log"> 24 <xsl:template match="change_log">
20 <xsl:apply-templates select="changes"/> 25 <xsl:apply-templates select="changes"/>
21 </xsl:template> 26 </xsl:template>
22 27
23 <xsl:template match="changes"> 28 <xsl:template match="changes">
29
24 <xsl:text> 30 <xsl:text>
25 </xsl:text> 31 </xsl:text>
26 32
27 <xsl:value-of select="substring(concat($conf/changes[@lang=$lang]/title, //change_log/@title, ' ', @ver, ' '), 1, $conf/changes[@lang=$lang]/length)"/> 33 <xsl:value-of select="substring(concat($conf/changes[@lang=$lang]/title, //change_log/@title, ' ', @ver, ' '), 1, $conf/changes[@lang=$lang]/length)"/>
28 34
29 <xsl:if test="$lang='ru'"> 35 <xsl:if test="$lang='ru'">
30 <xsl:value-of select="@date"/> 36 <xsl:value-of select="@date"/>
31 </xsl:if> 37 </xsl:if>
32 38
33 <xsl:if test="$lang='en'"> 39 <xsl:if test="$lang='en'">
40
34 <xsl:value-of select="substring(@date, 1, 2)"/> 41 <xsl:value-of select="substring(@date, 1, 2)"/>
42
35 <xsl:value-of select="$conf/changes[@lang=$lang]/month[number(substring(current()/@date, 4, 2))]"/> 43 <xsl:value-of select="$conf/changes[@lang=$lang]/month[number(substring(current()/@date, 4, 2))]"/>
44
36 <xsl:value-of select="substring(@date, 7, 4)"/> 45 <xsl:value-of select="substring(@date, 7, 4)"/>
37 </xsl:if> 46 </xsl:if>
47
38 <xsl:text> 48 <xsl:text>
39 </xsl:text> 49 </xsl:text>
40 50
41 <xsl:apply-templates select="change"/> 51 <xsl:apply-templates select="change"/>
42 52
43 <xsl:text> 53 <xsl:text>
44 </xsl:text> 54 </xsl:text>
45 </xsl:template> 55 </xsl:template>
46 56
47
48 <xsl:template match="change"> 57 <xsl:template match="change">
58
49 <xsl:variable select="$conf/changes[@lang=$lang]/*[local-name(.)=current()/@type]" name="prefix"/> 59 <xsl:variable select="$conf/changes[@lang=$lang]/*[local-name(.)=current()/@type]" name="prefix"/>
50 60
51 <xsl:variable name="postfix"> 61 <xsl:variable name="postfix">
52 <xsl:if test="$prefix"> 62 <xsl:if test="$prefix">
53 <xsl:text>: </xsl:text> 63 <xsl:text>: </xsl:text>
57 <xsl:apply-templates select="para[@lang=$lang]"> 67 <xsl:apply-templates select="para[@lang=$lang]">
58 <xsl:with-param select="concat($start, $prefix, $postfix)" name="prefix"/> 68 <xsl:with-param select="concat($start, $prefix, $postfix)" name="prefix"/>
59 </xsl:apply-templates> 69 </xsl:apply-templates>
60 </xsl:template> 70 </xsl:template>
61 71
62
63 <xsl:template match="para" name="para"> 72 <xsl:template match="para" name="para">
64 <xsl:param name="prefix"/> 73 <xsl:param name="prefix"/>
74
65 <xsl:variable name="text"> 75 <xsl:variable name="text">
66 <xsl:apply-templates/> 76 <xsl:apply-templates/>
67 </xsl:variable> 77 </xsl:variable>
68 78
69 <xsl:text> 79 <xsl:text>
71 81
72 <xsl:call-template name="wrap"> 82 <xsl:call-template name="wrap">
73 <xsl:with-param select="normalize-space($text)" name="text"/> 83 <xsl:with-param select="normalize-space($text)" name="text"/>
74 <xsl:with-param name="prefix"> 84 <xsl:with-param name="prefix">
75 <xsl:choose> 85 <xsl:choose>
86
76 <xsl:when test="position() = 1"> 87 <xsl:when test="position() = 1">
77 <xsl:value-of select="$prefix"/> 88 <xsl:value-of select="$prefix"/>
78 </xsl:when> 89 </xsl:when>
79 <xsl:otherwise> 90 <xsl:otherwise>
80 <xsl:value-of select="$indent"/> 91 <xsl:value-of select="$indent"/>
82 </xsl:choose> 93 </xsl:choose>
83 </xsl:with-param> 94 </xsl:with-param>
84 </xsl:call-template> 95 </xsl:call-template>
85 </xsl:template> 96 </xsl:template>
86 97
87
88 <xsl:template name="wrap"> 98 <xsl:template name="wrap">
89 <xsl:param name="text"/> 99 <xsl:param name="text"/>
90 <xsl:param name="prefix"/> 100 <xsl:param name="prefix"/>
101
91 <xsl:if test="$text"> 102 <xsl:if test="$text">
103
92 <xsl:variable name="offset"> 104 <xsl:variable name="offset">
93 <xsl:choose> 105 <xsl:choose>
106
94 <xsl:when test="starts-with($text, concat($br, ' '))"> 107 <xsl:when test="starts-with($text, concat($br, ' '))">
108
95 <xsl:value-of select="string-length($br) + 2"/> 109 <xsl:value-of select="string-length($br) + 2"/>
96 </xsl:when> 110 </xsl:when>
111
97 <xsl:otherwise> 112 <xsl:otherwise>
98 1</xsl:otherwise> 113 1</xsl:otherwise>
99 </xsl:choose> 114 </xsl:choose>
100 </xsl:variable> 115 </xsl:variable>
101 116
102 <xsl:variable name="length"> 117 <xsl:variable name="length">
118
103 <xsl:call-template name="length"> 119 <xsl:call-template name="length">
104 <xsl:with-param select="substring($text, $offset)" name="text"/> 120 <xsl:with-param select="substring($text, $offset)" name="text"/>
105 <xsl:with-param select="string-length($prefix)" name="prefix"/> 121 <xsl:with-param select="string-length($prefix)" name="prefix"/>
106 <xsl:with-param select="$max" name="length"/> 122 <xsl:with-param select="$max" name="length"/>
107 </xsl:call-template> 123 </xsl:call-template>
108 </xsl:variable> 124 </xsl:variable>
125
109 <xsl:value-of select="$prefix"/> 126 <xsl:value-of select="$prefix"/>
110 127
111 <xsl:value-of select="translate(substring($text, $offset, $length), ' ', ' ')"/> 128 <xsl:value-of select="translate(substring($text, $offset, $length), ' ', ' ')"/>
112 129
113 <xsl:text> 130 <xsl:text>
117 <xsl:with-param select="substring($text, $length + $offset)" name="text"/> 134 <xsl:with-param select="substring($text, $length + $offset)" name="text"/>
118 <xsl:with-param select="$indent" name="prefix"/> 135 <xsl:with-param select="$indent" name="prefix"/>
119 </xsl:call-template> 136 </xsl:call-template>
120 </xsl:if> 137 </xsl:if>
121 </xsl:template> 138 </xsl:template>
122 139
123 <xsl:template name="length"> 140 <xsl:template name="length">
124 <xsl:param name="text"/> 141 <xsl:param name="text"/>
125 <xsl:param name="prefix"/> 142 <xsl:param name="prefix"/>
126 <xsl:param name="length"/> 143 <xsl:param name="length"/>
144
127 <xsl:variable select="substring-before(substring($text, 1, $length - $prefix), $br)" name="break"/> 145 <xsl:variable select="substring-before(substring($text, 1, $length - $prefix), $br)" name="break"/>
146
128 <xsl:choose> 147 <xsl:choose>
129 <xsl:when test="$break"> 148 <xsl:when test="$break">
130 <xsl:value-of select="string-length($break)"/> 149 <xsl:value-of select="string-length($break)"/>
131 </xsl:when> 150 </xsl:when>
132 <xsl:when test="$length = 0"> 151 <xsl:when test="$length = 0">
143 </xsl:call-template> 162 </xsl:call-template>
144 </xsl:otherwise> 163 </xsl:otherwise>
145 </xsl:choose> 164 </xsl:choose>
146 </xsl:template> 165 </xsl:template>
147 166
148
149 <xsl:template match="at">@</xsl:template> 167 <xsl:template match="at">@</xsl:template>
150 168
151 <xsl:template match="br"> 169 <xsl:template match="br">
152 <xsl:value-of select="$br"/> 170 <xsl:value-of select="$br"/>
153 </xsl:template> 171 </xsl:template>
154 172
155 <xsl:template match="nobr"> 173 <xsl:template match="nobr">
156 <xsl:value-of select="translate(., ' ', ' ')"/> 174 <xsl:value-of select="translate(., ' ', ' ')"/>
157 </xsl:template> 175 </xsl:template>
176
158 </xsl:stylesheet> 177 </xsl:stylesheet>