]> git.itanic.dy.fi Git - maemo-mapper/blob - data/help/tohtml.xsl
Removed context elements from output.
[maemo-mapper] / data / help / tohtml.xsl
1 <?xml version="1.0" encoding="UTF-8"?>
2 <xsl:stylesheet version="1.0"
3                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
4
5 <!--
6  -
7  - Copyright (C) 2006, 2007 John Costigan.
8  -
9  - This file is part of Maemo Mapper.
10  -
11  - Maemo Mapper is free software: you can redistribute it and/or modify
12  - it under the terms of the GNU General Public License as published by
13  - the Free Software Foundation, either version 3 of the License, or
14  - (at your option) any later version.
15  -
16  - Maemo Mapper is distributed in the hope that it will be useful,
17  - but WITHOUT ANY WARRANTY; without even the implied warranty of
18  - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  - GNU General Public License for more details.
20  -
21  - You should have received a copy of the GNU General Public License
22  - along with Maemo Mapper.  If not, see <http://www.gnu.org/licenses/>.
23  -
24 -->
25
26 <xsl:output method="html"/>
27
28
29 <!-- Root element. -->
30
31 <xsl:template match="ossohelpsource">
32   <html>
33   <head><title><xsl:value-of select="folder/title"/></title></head>
34
35   <!-- Everything else -->
36   <body>
37   <xsl:apply-templates />
38   </body>
39
40   </html>
41 </xsl:template>
42
43
44 <!-- Sections (folder, topic) -->
45
46 <xsl:template match="folder">
47   <!-- Introduction -->
48   <xsl:apply-templates select="title"/>
49   <p>
50     This page is an HTML version of the built-in documentation that is
51     available within Maemo Mapper via the "Help" main menu item.
52   </p>
53
54   <p>
55     If you use Maemo Mapper and would like to show your appreciation for
56     it, or if you have a feature that you would like added to Maemo
57     Mapper, please consider donating money via PayPal.
58   </p>
59
60   <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
61     <p>
62       <input type="hidden" name="cmd" value="_s-xclick"/>
63       <input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but21.gif" name="submit" alt="Make payments with PayPal - it's fast, free and secure!"/>
64       <img alt="" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="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ZlX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbQIBADAJBgUrDgMCGgUAoF0wGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMDYwNTEwMjAwMzI0WjAjBgkqhkiG9w0BCQQxFgQUS8mmmoO/csf0wOXxgMeHd/y6/HowDQYJKoZIhvcNAQEBBQAEgYB3UYQqHvJPPZ62FQlxW33p/7q4RAMffzUmXZlAMKIuX5ycakbq4FEJUGxX1HW03tl3Pj3En1EiUg5T+MGbsEDV49pV32QX3yvSjUKke26BIq0vrKYxxfTbwryPeqPHGLizIaCBfZOlffeKq0UDVDvS6iZ/fi7h1+r1qRC4UNvQ4A==-----END PKCS7-----"/>
66     </p>
67   </form>
68
69   <!-- Table of Contents -->
70   <h2 id="help_maemomapper_">Table of Contents</h2>
71   <ul>
72     <xsl:for-each select="topic">
73       <li>
74         <xsl:element name="a">
75           <xsl:attribute name="href">
76             <xsl:choose>
77               <xsl:when test="context/@contextUID">
78                 #<xsl:value-of select="context/@contextUID"/>
79               </xsl:when>
80               <xsl:otherwise>
81                 #<xsl:value-of select="translate(topictitle, ' ', '_')"/>
82                 <xsl:text>_topictitle</xsl:text>
83               </xsl:otherwise>
84             </xsl:choose>
85           </xsl:attribute>
86           <xsl:value-of select="topictitle"/>
87         </xsl:element>
88         <ul>
89           <xsl:for-each select="heading">
90             <li>
91             <xsl:element name="a">
92               <xsl:attribute name="href">
93                 #<xsl:value-of select="translate(../context/@contextUID, ' ', '_')"/>
94                 <xsl:text>_</xsl:text>
95                 <xsl:value-of select="translate(., ' ', '_')"/>
96                 <xsl:text>_heading</xsl:text>
97               </xsl:attribute>
98               <xsl:value-of select="."/>
99             </xsl:element>
100             </li>
101           </xsl:for-each>
102         </ul>
103       </li>
104     </xsl:for-each>
105   </ul>
106   <xsl:apply-templates select="topic"/>
107 </xsl:template>
108
109 <xsl:template match="topic">
110   <xsl:element name="div">
111     <xsl:attribute name="id">
112       <xsl:value-of select="context/@contextUID"/>
113     </xsl:attribute>
114     <xsl:apply-templates />
115   </xsl:element>
116 </xsl:template>
117
118 <xsl:template match="context"></xsl:template>
119
120 <!-- Headings (title = h1, topictitle = h2, heading = h3) -->
121
122 <xsl:template match="title">
123   <h1><xsl:apply-templates /></h1>
124 </xsl:template>
125
126 <xsl:template match="topictitle">
127   <xsl:element name="h2">
128     <xsl:attribute name="id">
129       <xsl:value-of select="translate(., ' ', '_')"/>
130       <xsl:text>_topictitle</xsl:text>
131     </xsl:attribute>
132     <xsl:apply-templates />
133   </xsl:element>
134 </xsl:template>
135
136 <xsl:template match="heading">
137   <xsl:element name="h3">
138     <xsl:attribute name="id">
139       <xsl:value-of select="translate(../context/@contextUID, ' ', '_')"/>_<xsl:value-of select="translate(., ' ', '_')"/>
140       <xsl:text>_heading</xsl:text>
141     </xsl:attribute>
142     <xsl:apply-templates />
143   </xsl:element>
144 </xsl:template>
145
146
147 <!-- Simple HTML elements. -->
148
149 <xsl:template match="para">
150   <p><xsl:apply-templates /></p>
151 </xsl:template>
152
153 <xsl:template match="list">
154   <ul><xsl:apply-templates /></ul>
155 </xsl:template>
156
157 <xsl:template match="listitem">
158   <li><xsl:apply-templates /></li>
159 </xsl:template>
160
161 <xsl:template match="task_seq">
162   <ul><xsl:apply-templates /></ul>
163 </xsl:template>
164
165 <xsl:template match="step">
166   <li><xsl:apply-templates /></li>
167 </xsl:template>
168
169 <xsl:template match="display_text">
170   <code><xsl:apply-templates /></code>
171 </xsl:template>
172
173 <xsl:template match="tip">
174   <p><strong>Tip: <xsl:apply-templates /></strong></p>
175 </xsl:template>
176
177 <xsl:template match="note">
178   <p><strong>Note: <xsl:apply-templates /></strong></p>
179 </xsl:template>
180
181 <xsl:template match="important">
182   <p><strong>Important: <xsl:apply-templates /></strong></p>
183 </xsl:template>
184
185 <xsl:template match="example">
186   <p>Example: <xsl:apply-templates /></p>
187 </xsl:template>
188
189 <xsl:template match="Warning">
190   <p><strong>Warning: <xsl:apply-templates /></strong></p>
191 </xsl:template>
192
193 <xsl:template match="emphasis">
194   <em><xsl:apply-templates /></em>
195 </xsl:template>
196
197 <xsl:template match="@*|node()">
198   <xsl:copy>
199     <xsl:apply-templates select="@*|node()"/>
200   </xsl:copy>
201 </xsl:template>
202
203
204 <!-- Images -->
205
206 <xsl:template match="graphic">
207   <xsl:element name="img">
208     <xsl:attribute name="src">
209       <xsl:text>http://maemo.org/forrest-images/4-x/maemo_4-0_tutorial/images/</xsl:text>
210       <xsl:choose>
211         <xsl:when test="@filename = '2686KEY_full_screen'">
212           <xsl:text>hkey_fullscreen.png</xsl:text>
213         </xsl:when>
214         <xsl:when test="@filename = '2686KEY_zoom_in'">
215           <xsl:text>hkey_zoomIn.png</xsl:text>
216         </xsl:when>
217         <xsl:when test="@filename = '2686KEY_zoom_out'">
218           <xsl:text>hkey_zoomOut.png</xsl:text>
219         </xsl:when>
220         <xsl:when test="@filename = '2686KEY_scroll_up'">
221           <xsl:text>hkey_up.png</xsl:text>
222         </xsl:when>
223         <xsl:when test="@filename = '2686KEY_scroll_down'">
224           <xsl:text>hkey_down.png</xsl:text>
225         </xsl:when>
226         <xsl:when test="@filename = '2686KEY_scroll_left'">
227           <xsl:text>hkey_left.png</xsl:text>
228         </xsl:when>
229         <xsl:when test="@filename = '2686KEY_scroll_right'">
230           <xsl:text>hkey_right.png</xsl:text>
231         </xsl:when>
232         <xsl:when test="@filename = '2686KEY_scroll_center'">
233           <xsl:text>hkey_enter.png</xsl:text>
234         </xsl:when>
235         <xsl:when test="@filename = '2686KEY_esc'">
236           <xsl:text>hkey_cancel.png</xsl:text>
237         </xsl:when>
238         <xsl:otherwise>
239           <xsl:text>???.png</xsl:text>
240         </xsl:otherwise>
241       </xsl:choose>
242     </xsl:attribute>
243     <xsl:attribute name="alt">
244       <xsl:value-of select="substring-after(@filename, '2686KEY_')"/>
245     </xsl:attribute>
246     <xsl:attribute name="style">
247       <xsl:text>height: 1.5em;</xsl:text>
248     </xsl:attribute>
249   </xsl:element>
250 </xsl:template>
251
252
253 <!-- Links and references. -->
254
255 <xsl:template match="ref">
256   <xsl:element name="a">
257     <xsl:attribute name="href">
258       #<xsl:value-of select="@refid"/>
259     </xsl:attribute>
260     <xsl:value-of select="@refdoc"/>
261   </xsl:element>
262 </xsl:template>
263
264 </xsl:stylesheet>
265