-rw-r--r-- | shared-code/kinhelp.xsl | 250 |
1 files changed, 250 insertions, 0 deletions
diff --git a/shared-code/kinhelp.xsl b/shared-code/kinhelp.xsl new file mode 100644 index 0000000..0bb384a --- a/dev/null +++ b/shared-code/kinhelp.xsl | |||
@@ -0,0 +1,250 @@ | |||
1 | <?xml version="1.0"?> | ||
2 | <xsl:stylesheet version="1.0" | ||
3 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | ||
4 | > | ||
5 | <xsl:output | ||
6 | method="text" | ||
7 | encoding="us-ascii"/> | ||
8 | <xsl:strip-space elements="*"/> | ||
9 | |||
10 | <xsl:template match="winhelp"> | ||
11 | <xsl:text>{\rtf1\ansi</xsl:text> | ||
12 | <xsl:text>
@{\footnote</xsl:text> | ||
13 | <xsl:text>
THIS FILE WAS AUTOMATICALLY GENERATED FROM XML DOCUMENT.</xsl:text> | ||
14 | <xsl:text>
DO NOT MODIFY THIS FILE DIRECTLY. EDIT XML DOCUMENT INSTEAD</xsl:text> | ||
15 | <xsl:text>
}
</xsl:text> | ||
16 | <xsl:call-template name="fonttbl"/> | ||
17 | <xsl:call-template name="colortbl"/> | ||
18 | <xsl:apply-templates/> | ||
19 | <xsl:text>}</xsl:text> | ||
20 | </xsl:template> | ||
21 | |||
22 | <xsl:template match="topic"> | ||
23 | <xsl:text>
\pard\plain</xsl:text> | ||
24 | <xsl:if test="descendant::*[ (@scroll='no') and | ||
25 | count(preceding-sibling::*[not(@scroll='no') and (name()!='a' and @name)])=0] "> | ||
26 | <xsl:text>\keepn</xsl:text> | ||
27 | </xsl:if> | ||
28 | <xsl:if test="@id"> | ||
29 | <xsl:text>
#{\footnote </xsl:text> | ||
30 | <xsl:value-of select="@id"/> | ||
31 | <xsl:text>}</xsl:text> | ||
32 | </xsl:if> | ||
33 | <xsl:if test="@title"> | ||
34 | <xsl:text>
${\footnote </xsl:text> | ||
35 | <xsl:value-of select="@title"/> | ||
36 | <xsl:text>}</xsl:text> | ||
37 | </xsl:if> | ||
38 | <xsl:if test="@keywords"> | ||
39 | <xsl:text>
K{\footnote </xsl:text> | ||
40 | <xsl:value-of select="@keywords"/> | ||
41 | <xsl:text>}</xsl:text> | ||
42 | </xsl:if> | ||
43 | <xsl:apply-templates/> | ||
44 | <xsl:text>
\page
</xsl:text> | ||
45 | </xsl:template> | ||
46 | |||
47 | <xsl:template match="a[@name]"> | ||
48 | <xsl:text>{#{\footnote </xsl:text> | ||
49 | <xsl:value-of select="@name"/> | ||
50 | <xsl:text>}}</xsl:text> | ||
51 | </xsl:template> | ||
52 | <xsl:template match="a[@href]"> | ||
53 | <xsl:call-template name="hyperref"> | ||
54 | <xsl:with-param name="href" select="@href"/> | ||
55 | <xsl:with-param name="inset"><xsl:apply-templates/></xsl:with-param> | ||
56 | </xsl:call-template> | ||
57 | </xsl:template> | ||
58 | <xsl:template name="hyperref"> | ||
59 | <xsl:param name="href"/> | ||
60 | <xsl:param name="inset"/> | ||
61 | <xsl:choose> | ||
62 | <xsl:when test="starts-with($href,'http:') or starts-with($href,'mailto:') or | ||
63 | starts-with($href,'ftp:')"> | ||
64 | <xsl:text>{\uldb </xsl:text> | ||
65 | <xsl:value-of select="$inset"/> | ||
66 | <xsl:text>}{\v %!ExecFile("</xsl:text> | ||
67 | <xsl:value-of select="$href"/> | ||
68 | <xsl:text>")}</xsl:text> | ||
69 | </xsl:when> | ||
70 | <xsl:when test="starts-with($href,'#')"> | ||
71 | <xsl:text>{\uldb </xsl:text> | ||
72 | <xsl:value-of select="$inset"/> | ||
73 | <xsl:text>}{\v </xsl:text> | ||
74 | <xsl:value-of select="substring($href,2)"/> | ||
75 | <xsl:text>}</xsl:text> | ||
76 | </xsl:when> | ||
77 | <xsl:otherwise> | ||
78 | <xsl:message>Warining: Unqualified hyper-reference. Using as help-internal</xsl:message> | ||
79 | <xsl:text>{\uldb </xsl:text> | ||
80 | <xsl:value-of select="$inset"/> | ||
81 | <xsl:text>}{\v </xsl:text> | ||
82 | <xsl:value-of select="$href"/> | ||
83 | <xsl:text>}</xsl:text> | ||
84 | </xsl:otherwise> | ||
85 | </xsl:choose> | ||
86 | </xsl:template> | ||
87 | |||
88 | <xsl:template match="heading"> | ||
89 | <xsl:text>
</xsl:text> | ||
90 | <xsl:if test="@scroll!='no'"> | ||
91 | <xsl:text>\pard </xsl:text> | ||
92 | </xsl:if> | ||
93 | <xsl:text>{ \f1\fs18\b\sb120 </xsl:text> | ||
94 | <xsl:apply-templates/> | ||
95 | <xsl:text>}</xsl:text> | ||
96 | </xsl:template> | ||
97 | |||
98 | <xsl:template match="p"> | ||
99 | <xsl:text>
\par\sa120\sb120\qj</xsl:text> | ||
100 | <xsl:if test="@scroll!='no'"> | ||
101 | <xsl:text>\pard</xsl:text> | ||
102 | </xsl:if> | ||
103 | <xsl:text> \f1\fs18\sb120 </xsl:text> | ||
104 | <xsl:apply-templates/> | ||
105 | </xsl:template> | ||
106 | |||
107 | <xsl:template match="note"> | ||
108 | <xsl:text>
\par\sa120\sb120\qj\f1\fs16 </xsl:text> | ||
109 | <xsl:apply-templates/> | ||
110 | </xsl:template> | ||
111 | |||
112 | <xsl:template match="dedication"> | ||
113 | <xsl:text>
\par\sa120\sb120\qr\f1\fs16 </xsl:text> | ||
114 | <xsl:apply-templates/> | ||
115 | </xsl:template> | ||
116 | |||
117 | <xsl:template match="image"> | ||
118 | <xsl:text>\{bmct </xsl:text> | ||
119 | <xsl:value-of select="@source"/> | ||
120 | <xsl:text>\}</xsl:text> | ||
121 | </xsl:template> | ||
122 | |||
123 | <xsl:template match="newsfor"> | ||
124 | <xsl:text>
\par\pard\plain\f1\fs24\qc\cf2\b </xsl:text> | ||
125 | <xsl:value-of select="@version"/> | ||
126 | <xsl:text> - </xsl:text> | ||
127 | <xsl:value-of select="@date"/> | ||
128 | <xsl:apply-templates/> | ||
129 | </xsl:template> | ||
130 | <xsl:template match="ni"> | ||
131 | <xsl:text>
\par\pard\plain\fi0\li0\f1\fs18 \bullet </xsl:text> | ||
132 | <xsl:apply-templates/> | ||
133 | </xsl:template> | ||
134 | |||
135 | <xsl:template match="b"> | ||
136 | <xsl:text>{\b </xsl:text> | ||
137 | <xsl:apply-templates/> | ||
138 | <xsl:text>}</xsl:text> | ||
139 | </xsl:template> | ||
140 | <xsl:template match="i"> | ||
141 | <xsl:text>{\i </xsl:text> | ||
142 | <xsl:apply-templates/> | ||
143 | <xsl:text>}</xsl:text> | ||
144 | </xsl:template> | ||
145 | <xsl:template match="u"> | ||
146 | <xsl:text>{\ul </xsl:text> | ||
147 | <xsl:apply-templates/> | ||
148 | <xsl:text>}</xsl:text> | ||
149 | </xsl:template> | ||
150 | <xsl:template match="strike"> | ||
151 | <xsl:text>{\strike </xsl:text> | ||
152 | <xsl:apply-templates/> | ||
153 | <xsl:text>}</xsl:text> | ||
154 | </xsl:template> | ||
155 | |||
156 | <xsl:template match="kin"> | ||
157 | <xsl:choose> | ||
158 | <xsl:when test="@href"> | ||
159 | <xsl:call-template name="hyperref"> | ||
160 | <xsl:with-param name="href" select="@href"/> | ||
161 | <xsl:with-param name="inset"><xsl:text>{\b </xsl:text><xsl:apply-templates/><xsl:text>}</xsl:text></xsl:with-param> | ||
162 | </xsl:call-template> | ||
163 | </xsl:when> | ||
164 | <xsl:otherwise> | ||
165 | <xsl:text>{\b </xsl:text> | ||
166 | <xsl:apply-templates/> | ||
167 | <xsl:text>}</xsl:text> | ||
168 | </xsl:otherwise> | ||
169 | </xsl:choose> | ||
170 | </xsl:template> | ||
171 | <xsl:template match="product"> | ||
172 | <xsl:choose> | ||
173 | <xsl:when test="@href"> | ||
174 | <xsl:call-template name="hyperref"> | ||
175 | <xsl:with-param name="href" select="@href"/> | ||
176 | <xsl:with-param name="inset"><xsl:text>{\b\cf6 </xsl:text><xsl:apply-templates/><xsl:text>}</xsl:text></xsl:with-param> | ||
177 | </xsl:call-template> | ||
178 | </xsl:when> | ||
179 | <xsl:otherwise> | ||
180 | <xsl:text>{\b\cf6 </xsl:text> | ||
181 | <xsl:apply-templates/> | ||
182 | <xsl:text>}</xsl:text> | ||
183 | </xsl:otherwise> | ||
184 | </xsl:choose> | ||
185 | </xsl:template> | ||
186 | <xsl:template match="term"> | ||
187 | <xsl:text>{\i </xsl:text> | ||
188 | <xsl:apply-templates/> | ||
189 | <xsl:text>}</xsl:text> | ||
190 | </xsl:template> | ||
191 | |||
192 | <xsl:template match="rfc"> | ||
193 | <xsl:call-template name="hyperref"> | ||
194 | <xsl:with-param name="href" select="concat('http://www.rfc-editor.org/rfc/rfc',@num,'.txt')"/> | ||
195 | <xsl:with-param name="inset" select="concat('{\b RFC',@num,'}')"/> | ||
196 | </xsl:call-template> | ||
197 | </xsl:template> | ||
198 | |||
199 | <xsl:template match="license"> | ||
200 | <xsl:text>
{</xsl:text> | ||
201 | <xsl:text>
\par\pard\plain\sb360\sa120 \f1\fs16 Copyright (c) </xsl:text> | ||
202 | <xsl:value-of select="@years"/> | ||
203 | <xsl:text> {\uldb\cf0 Klever Group (http://www.klever.net/)}{\v %!ExecFile("http://www.klever.net/")}</xsl:text> | ||
204 | <xsl:text>
\par\qj\sb120\sa120</xsl:text> | ||
205 | <xsl:text>Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:</xsl:text> | ||
206 | <xsl:text>
\par The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.</xsl:text> | ||
207 | <xsl:text>
\par \sa360 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</xsl:text> | ||
208 | <xsl:text>
}</xsl:text> | ||
209 | </xsl:template> | ||
210 | <xsl:template match="credits"> | ||
211 | <xsl:text>
\par \sa0\sb120\ql \f1\fs16 Author: {\b\uldb\cf11 Michael Krelin ({\i hacker@klever.net})}{\v %!ExecFile("mailto:hacker@klever.net")}</xsl:text> | ||
212 | <xsl:text>
\par \sa0\sb0 Fan mail send to {\i\uldb gefilte@klever.net}{\v %!ExecFile("mailto:gefilte@klever.net")}</xsl:text> | ||
213 | </xsl:template> | ||
214 | |||
215 | <xsl:template match="ul"> | ||
216 | <xsl:text>\pard</xsl:text> | ||
217 | <xsl:apply-templates/> | ||
218 | <xsl:text>\pard</xsl:text> | ||
219 | </xsl:template> | ||
220 | <xsl:template match="li"> | ||
221 | <!-- TODO: could be done better, but you never know with winhelp.. --> | ||
222 | <xsl:variable name="li" select=" count(ancestor::ul) "/> | ||
223 | <xsl:text>
\par \fi0\li</xsl:text><xsl:value-of | ||
224 | select="0"/><xsl:text> \bullet </xsl:text> | ||
225 | <xsl:apply-templates/> | ||
226 | </xsl:template> | ||
227 | |||
228 | <xsl:template match="topic/text()"> | ||
229 | <!-- maybe only omit spaces? --> | ||
230 | </xsl:template> | ||
231 | <xsl:template match="ul/text()"> | ||
232 | </xsl:template> | ||
233 | |||
234 | <xsl:template name="colortbl"> | ||
235 | <xsl:text>{\colortbl; | ||
236 | \red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0; | ||
237 | \red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255; | ||
238 | \red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128; | ||
239 | \red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;} | ||
240 | </xsl:text> | ||
241 | </xsl:template> | ||
242 | <xsl:template name="fonttbl"> | ||
243 | <xsl:text>{\fonttbl</xsl:text> | ||
244 | <xsl:text>{\f0\froman Times New Roman;}</xsl:text> | ||
245 | <xsl:text>{\f1\fswiss Arial;}</xsl:text> | ||
246 | <xsl:text>{\f3\froman Symbol;}</xsl:text> | ||
247 | <xsl:text>}</xsl:text> | ||
248 | </xsl:template> | ||
249 | |||
250 | </xsl:stylesheet> | ||