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