Mercurial > hg > nginx-quic
comparison docs/xslt/changes.xslt @ 450:551102312e19 release-0.1.0
nginx-0.1.0-RELEASE import
*) The first public version.
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 04 Oct 2004 15:04:06 +0000 |
parents | |
children | 234907e676a5 3e706fcccbf3 |
comparison
equal
deleted
inserted
replaced
449:3b1e8c9df9ad | 450:551102312e19 |
---|---|
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"/> | |
7 <xsl:param select="'../xml/change_log_conf.xml'" name="configuration"/> | |
8 | |
9 <xsl:variable select="document($configuration)/configuration" name="conf"/> | |
10 <xsl:variable select="$conf/start" name="start"/> | |
11 <xsl:variable select="$conf/indent" name="indent"/> | |
12 <xsl:variable select="$conf/length" name="max"/> | |
13 <xsl:variable name="br"><br></xsl:variable> | |
14 | |
15 <xsl:template match="/"> | |
16 <xsl:apply-templates select="change_log"/> | |
17 </xsl:template> | |
18 | |
19 <xsl:template match="change_log"> | |
20 <xsl:apply-templates select="changes"/> | |
21 </xsl:template> | |
22 | |
23 <xsl:template match="changes"> | |
24 <xsl:text> | |
25 </xsl:text> | |
26 | |
27 <xsl:value-of select="substring(concat($conf/changes[@lang=$lang]/title, //change_log/@title, ' ', @ver, ' '), 1, $conf/changes[@lang=$lang]/length)"/> | |
28 | |
29 <xsl:if test="$lang='ru'"> | |
30 <xsl:value-of select="@date"/> | |
31 </xsl:if> | |
32 | |
33 <xsl:if test="$lang='en'"> | |
34 <xsl:value-of select="substring(@date, 1, 2)"/> | |
35 <xsl:value-of select="$conf/changes[@lang=$lang]/month[number(substring(current()/@date, 4, 2))]"/> | |
36 <xsl:value-of select="substring(@date, 7, 4)"/> | |
37 </xsl:if> | |
38 <xsl:text> | |
39 </xsl:text> | |
40 | |
41 <xsl:apply-templates select="change"/> | |
42 | |
43 <xsl:text> | |
44 </xsl:text> | |
45 </xsl:template> | |
46 | |
47 | |
48 <xsl:template match="change"> | |
49 <xsl:variable select="$conf/changes[@lang=$lang]/*[local-name(.)=current()/@type]" name="prefix"/> | |
50 | |
51 <xsl:variable name="postfix"> | |
52 <xsl:if test="$prefix"> | |
53 <xsl:text>: </xsl:text> | |
54 </xsl:if> | |
55 </xsl:variable> | |
56 | |
57 <xsl:apply-templates select="para[@lang=$lang]"> | |
58 <xsl:with-param select="concat($start, $prefix, $postfix)" name="prefix"/> | |
59 </xsl:apply-templates> | |
60 </xsl:template> | |
61 | |
62 | |
63 <xsl:template match="para" name="para"> | |
64 <xsl:param name="prefix"/> | |
65 <xsl:variable name="text"> | |
66 <xsl:apply-templates/> | |
67 </xsl:variable> | |
68 | |
69 <xsl:text> | |
70 </xsl:text> | |
71 | |
72 <xsl:call-template name="wrap"> | |
73 <xsl:with-param select="normalize-space($text)" name="text"/> | |
74 <xsl:with-param name="prefix"> | |
75 <xsl:choose> | |
76 <xsl:when test="position() = 1"> | |
77 <xsl:value-of select="$prefix"/> | |
78 </xsl:when> | |
79 <xsl:otherwise> | |
80 <xsl:value-of select="$indent"/> | |
81 </xsl:otherwise> | |
82 </xsl:choose> | |
83 </xsl:with-param> | |
84 </xsl:call-template> | |
85 </xsl:template> | |
86 | |
87 | |
88 <xsl:template name="wrap"> | |
89 <xsl:param name="text"/> | |
90 <xsl:param name="prefix"/> | |
91 <xsl:if test="$text"> | |
92 <xsl:variable name="offset"> | |
93 <xsl:choose> | |
94 <xsl:when test="starts-with($text, concat($br, ' '))"> | |
95 <xsl:value-of select="string-length($br) + 2"/> | |
96 </xsl:when> | |
97 <xsl:otherwise> | |
98 1</xsl:otherwise> | |
99 </xsl:choose> | |
100 </xsl:variable> | |
101 | |
102 <xsl:variable name="length"> | |
103 <xsl:call-template name="length"> | |
104 <xsl:with-param select="substring($text, $offset)" name="text"/> | |
105 <xsl:with-param select="string-length($prefix)" name="prefix"/> | |
106 <xsl:with-param select="$max" name="length"/> | |
107 </xsl:call-template> | |
108 </xsl:variable> | |
109 <xsl:value-of select="$prefix"/> | |
110 | |
111 <xsl:value-of select="translate(substring($text, $offset, $length), ' ', ' ')"/> | |
112 | |
113 <xsl:text> | |
114 </xsl:text> | |
115 | |
116 <xsl:call-template name="wrap"> | |
117 <xsl:with-param select="substring($text, $length + $offset)" name="text"/> | |
118 <xsl:with-param select="$indent" name="prefix"/> | |
119 </xsl:call-template> | |
120 </xsl:if> | |
121 </xsl:template> | |
122 | |
123 <xsl:template name="length"> | |
124 <xsl:param name="text"/> | |
125 <xsl:param name="prefix"/> | |
126 <xsl:param name="length"/> | |
127 <xsl:variable select="substring-before(substring($text, 1, $length - $prefix), $br)" name="break"/> | |
128 <xsl:choose> | |
129 <xsl:when test="$break"> | |
130 <xsl:value-of select="string-length($break)"/> | |
131 </xsl:when> | |
132 <xsl:when test="$length = 0"> | |
133 <xsl:value-of select="$max"/> | |
134 </xsl:when> | |
135 <xsl:when test="string-length($text) + $prefix <= $length or substring($text, $length - $prefix, 1) = ' '"> | |
136 <xsl:value-of select="$length - $prefix"/> | |
137 </xsl:when> | |
138 <xsl:otherwise> | |
139 <xsl:call-template name="length"> | |
140 <xsl:with-param select="$text" name="text"/> | |
141 <xsl:with-param select="$prefix" name="prefix"/> | |
142 <xsl:with-param select="$length - 1" name="length"/> | |
143 </xsl:call-template> | |
144 </xsl:otherwise> | |
145 </xsl:choose> | |
146 </xsl:template> | |
147 | |
148 | |
149 <xsl:template match="at">@</xsl:template> | |
150 | |
151 <xsl:template match="br"> | |
152 <xsl:value-of select="$br"/> | |
153 </xsl:template> | |
154 | |
155 <xsl:template match="nobr"> | |
156 <xsl:value-of select="translate(., ' ', ' ')"/> | |
157 </xsl:template> | |
158 </xsl:stylesheet> |