]> git.itanic.dy.fi Git - maemo-mapper/blob - data/help/tohtml.xsl
Fixed placement of file header.
[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   <!-- Table of Contents -->
55   <h2 id="help_maemomapper_">Table of Contents</h2>
56   <ul>
57     <xsl:for-each select="topic">
58       <li>
59         <xsl:element name="a">
60           <xsl:attribute name="href">
61             <xsl:choose>
62               <xsl:when test="context/@contextUID">
63                 #<xsl:value-of select="context/@contextUID"/>
64               </xsl:when>
65               <xsl:otherwise>
66                 #<xsl:value-of select="translate(topictitle, ' ', '_')"/>
67                 <xsl:text>_topictitle</xsl:text>
68               </xsl:otherwise>
69             </xsl:choose>
70           </xsl:attribute>
71           <xsl:value-of select="topictitle"/>
72         </xsl:element>
73         <ul>
74           <xsl:for-each select="heading">
75             <li>
76             <xsl:element name="a">
77               <xsl:attribute name="href">
78                 #<xsl:value-of select="translate(../context/@contextUID, ' ', '_')"/>
79                 <xsl:text>_</xsl:text>
80                 <xsl:value-of select="translate(., ' ', '_')"/>
81                 <xsl:text>_heading</xsl:text>
82               </xsl:attribute>
83               <xsl:value-of select="."/>
84             </xsl:element>
85             </li>
86           </xsl:for-each>
87         </ul>
88       </li>
89     </xsl:for-each>
90   </ul>
91   <xsl:apply-templates select="topic"/>
92 </xsl:template>
93
94 <xsl:template match="topic">
95   <xsl:element name="div">
96     <xsl:attribute name="id">
97       <xsl:value-of select="context/@contextUID"/>
98     </xsl:attribute>
99     <xsl:apply-templates />
100   </xsl:element>
101 </xsl:template>
102
103
104 <!-- Headings (title = h1, topictitle = h2, heading = h3) -->
105
106 <xsl:template match="title">
107   <h1><xsl:apply-templates /></h1>
108 </xsl:template>
109
110 <xsl:template match="topictitle">
111   <xsl:element name="h2">
112     <xsl:attribute name="id">
113       <xsl:value-of select="translate(., ' ', '_')"/>
114       <xsl:text>_topictitle</xsl:text>
115     </xsl:attribute>
116     <xsl:apply-templates />
117   </xsl:element>
118 </xsl:template>
119
120 <xsl:template match="heading">
121   <xsl:element name="h3">
122     <xsl:attribute name="id">
123       <xsl:value-of select="translate(../context/@contextUID, ' ', '_')"/>_<xsl:value-of select="translate(., ' ', '_')"/>
124       <xsl:text>_heading</xsl:text>
125     </xsl:attribute>
126     <xsl:apply-templates />
127   </xsl:element>
128 </xsl:template>
129
130
131 <!-- Simple HTML elements. -->
132
133 <xsl:template match="para">
134   <p><xsl:apply-templates /></p>
135 </xsl:template>
136
137 <xsl:template match="list">
138   <ul><xsl:apply-templates /></ul>
139 </xsl:template>
140
141 <xsl:template match="listitem">
142   <li><xsl:apply-templates /></li>
143 </xsl:template>
144
145 <xsl:template match="task_seq">
146   <ul><xsl:apply-templates /></ul>
147 </xsl:template>
148
149 <xsl:template match="step">
150   <li><xsl:apply-templates /></li>
151 </xsl:template>
152
153 <xsl:template match="display_text">
154   <code><xsl:apply-templates /></code>
155 </xsl:template>
156
157 <xsl:template match="tip">
158   <p><strong>Tip: <xsl:apply-templates /></strong></p>
159 </xsl:template>
160
161 <xsl:template match="note">
162   <p><strong>Note: <xsl:apply-templates /></strong></p>
163 </xsl:template>
164
165 <xsl:template match="important">
166   <p><strong>Important: <xsl:apply-templates /></strong></p>
167 </xsl:template>
168
169 <xsl:template match="example">
170   <p>Example: <xsl:apply-templates /></p>
171 </xsl:template>
172
173 <xsl:template match="Warning">
174   <p><strong>Warning: <xsl:apply-templates /></strong></p>
175 </xsl:template>
176
177 <xsl:template match="emphasis">
178   <em><xsl:apply-templates /></em>
179 </xsl:template>
180
181 <xsl:template match="@*|node()">
182   <xsl:copy>
183     <xsl:apply-templates select="@*|node()"/>
184   </xsl:copy>
185 </xsl:template>
186
187
188 <!-- Images -->
189
190 <xsl:template match="graphic">
191   <xsl:element name="img">
192     <xsl:attribute name="src">
193       <xsl:text>http://maemo.org/forrest-images/4-x/maemo_4-0_tutorial/images/</xsl:text>
194       <xsl:choose>
195         <xsl:when test="@filename = '2686KEY_full_screen'">
196           <xsl:text>hkey_fullscreen.png</xsl:text>
197         </xsl:when>
198         <xsl:when test="@filename = '2686KEY_zoom_in'">
199           <xsl:text>hkey_zoomIn.png</xsl:text>
200         </xsl:when>
201         <xsl:when test="@filename = '2686KEY_zoom_out'">
202           <xsl:text>hkey_zoomOut.png</xsl:text>
203         </xsl:when>
204         <xsl:when test="@filename = '2686KEY_scroll_up'">
205           <xsl:text>hkey_up.png</xsl:text>
206         </xsl:when>
207         <xsl:when test="@filename = '2686KEY_scroll_down'">
208           <xsl:text>hkey_down.png</xsl:text>
209         </xsl:when>
210         <xsl:when test="@filename = '2686KEY_scroll_left'">
211           <xsl:text>hkey_left.png</xsl:text>
212         </xsl:when>
213         <xsl:when test="@filename = '2686KEY_scroll_right'">
214           <xsl:text>hkey_right.png</xsl:text>
215         </xsl:when>
216         <xsl:when test="@filename = '2686KEY_scroll_center'">
217           <xsl:text>hkey_enter.png</xsl:text>
218         </xsl:when>
219         <xsl:when test="@filename = '2686KEY_esc'">
220           <xsl:text>hkey_cancel.png</xsl:text>
221         </xsl:when>
222         <xsl:otherwise>
223           <xsl:text>???.png</xsl:text>
224         </xsl:otherwise>
225       </xsl:choose>
226     </xsl:attribute>
227     <xsl:attribute name="alt">
228       <xsl:value-of select="substring-after(@filename, '2686KEY_')"/>
229     </xsl:attribute>
230     <xsl:attribute name="style">
231       <xsl:text>height: 1.5em;</xsl:text>
232     </xsl:attribute>
233   </xsl:element>
234 </xsl:template>
235
236
237 <!-- Links and references. -->
238
239 <xsl:template match="ref">
240   <xsl:element name="a">
241     <xsl:attribute name="href">
242       #<xsl:value-of select="@refid"/>
243     </xsl:attribute>
244     <xsl:value-of select="@refdoc"/>
245   </xsl:element>
246 </xsl:template>
247
248 </xsl:stylesheet>
249