source: trunk/SRC/Documentation/xmldoc/saxo_tracwiki.xsl @ 354

Last change on this file since 354 was 354, checked in by pinsard, 16 years ago

some improvements in wiki production

  • Property snv:keywords set to Id
File size: 11.2 KB
Line 
1<?xml version='1.0' encoding='ISO-8859-1'?> 
2<xsl:stylesheet 
3xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4xmlns:xl="http://www.w3.org/1999/xlink"
5xmlns:d="http://docbook.org/ns/docbook"
6exclude-result-prefixes="d"
7version="1.0">
8<!--
9module :
10transformation docbook en un tracwiki
11
12original location :
13/Users/fplod/SAXO_DIR_ws/SRC/Documentation/xmldoc/saxo_trackwiki.xsl sur aedon.locean-ipsl.upmc.fr
14
15must be followed by awk -f saxo_trackwiki.awk
16because I did not yet correctly handle "* text" (with no linefeed)
17update :
18$Id$
19++
20++ voir http://trac-hacks.org/wiki/XsltMacro
21fplod 2008-04-18T13:01:50Z aedon.locean-ipsl.upmc.fr (Darwin)
22pompage de href="http://docbook.sourceforge.net/release/xsl/current/html/xref.xsl
23fplod 2008-01-08T16:05:29Z aedon.locean-ipsl.upmc.fr (Darwin)
24ça commence à prndre tournure
25fplod 2007-10-19T08:39:15Z aedon.locean-ipsl.upmc.fr (Darwin)
26creation
27cf http://forge.ipsl.jussieu.fr/superbib/wiki/WikiFormatting
28et http://www.sagehill.net/docbookxsl/CustomDb5Xsl.html
29car 1re xsl pour db5
30-->
31
32
33<!--
34xml output with no xml declaration : this is the only way to make xsl:copy-of copy
35nodes instead of contents of nodes
36-->
37<xsl:output method="xml" 
38indent="no" 
39omit-xml-declaration="yes"/>
40
41<xsl:strip-space elements="d:article d:sect1 d:sect2 d:sect3 d:sect4 d:variablellist d:itemizedlist d:listitem d:varlistentry d:term d:para d:simpara"/>
42
43<xsl:template match="/">
44 <xsl:apply-templates/>
45</xsl:template>
46
47<xsl:template match="d:article/d:title">
48<!-- pour ajouter une table des matières
49d'après
50http://groups.google.com/group/trac-users/browse_thread/thread/2c2cf9830c190a7d#e0a71ce3da67fb53
51-->
52 <xsl:text>= </xsl:text><xsl:value-of select="normalize-space(.)"/><xsl:text> =</xsl:text>
53 <xsl:text>&#xA;</xsl:text>
54 <xsl:text>[[PageOutline]]</xsl:text>
55 <xsl:text>&#xA;</xsl:text>
56</xsl:template>
57
58<xsl:template match="d:sect1/d:title">
59 <xsl:text>&#xA;</xsl:text>
60 <xsl:text>== </xsl:text><xsl:value-of select="normalize-space(.)"/><xsl:text> ==</xsl:text>
61 <xsl:text>&#xA;</xsl:text>
62</xsl:template>
63
64<xsl:template match="d:sect2/d:title">
65 <xsl:text>&#xA;</xsl:text>
66 <xsl:text>=== </xsl:text><xsl:value-of select="normalize-space(.)"/><xsl:text> ===</xsl:text>
67 <xsl:text>&#xA;</xsl:text>
68</xsl:template>
69
70<xsl:template match="d:sect3/d:title">
71 <xsl:text>&#xA;</xsl:text>
72 <xsl:text>==== </xsl:text><xsl:value-of select="normalize-space(.)"/><xsl:text> ====</xsl:text>
73 <xsl:text>&#xA;</xsl:text>
74</xsl:template>
75
76<xsl:template match="d:sect4/d:title">
77 <xsl:text>&#xA;</xsl:text>
78 <xsl:text>===== </xsl:text><xsl:value-of select="normalize-space(.)"/><xsl:text> =====</xsl:text>
79 <xsl:text>&#xA;</xsl:text>
80</xsl:template>
81
82<xsl:template match="d:sect5/title">
83 <xsl:text>&#xA;</xsl:text>
84 <xsl:text>====== </xsl:text><xsl:value-of select="normalize-space(.)"/><xsl:text> ======</xsl:text>
85 <xsl:text>&#xA;</xsl:text>
86</xsl:template>
87
88<xsl:template match="d:sect2/d:simplesect/d:title">
89 <xsl:text>&#xA;</xsl:text>
90 <xsl:text>==== </xsl:text><xsl:value-of select="normalize-space(.)"/><xsl:text> ====</xsl:text>
91 <xsl:text>&#xA;</xsl:text>
92</xsl:template>
93
94<xsl:template match="d:systemitem">
95 <xsl:text>{{{</xsl:text><xsl:value-of select="."/><xsl:text>}}}</xsl:text>
96</xsl:template>
97
98<xsl:template match="d:para/d:command">
99 <xsl:text>{{{</xsl:text><xsl:value-of select="."/><xsl:text>}}}</xsl:text>
100</xsl:template>
101
102<xsl:template match="d:filename">
103 <xsl:choose>
104  <xsl:when test="local-name(..)='userinput'">
105   <xsl:value-of select="."/>
106  </xsl:when>
107  <xsl:otherwise>
108   <xsl:text>{{{</xsl:text><xsl:value-of select="."/><xsl:text>}}}</xsl:text>
109  </xsl:otherwise>
110 </xsl:choose>
111</xsl:template>
112
113<xsl:template match="d:varname">
114 <xsl:text>{{{</xsl:text><xsl:value-of select="."/><xsl:text>}}}</xsl:text>
115</xsl:template>
116
117<xsl:template match="d:literallayout">
118 <xsl:text>{{{</xsl:text><xsl:apply-templates/><xsl:text>}}}</xsl:text>
119</xsl:template>
120
121<xsl:template match="d:screen">
122 <!--
123we open an HTML block because it is not possible to have font effect (bold, italic)
124using TracWiki
125 -->
126 <xsl:text>&#xA;</xsl:text>
127 <xsl:text>{{{</xsl:text>
128 <xsl:text>&#xA;</xsl:text>
129 <xsl:text>#!html</xsl:text>
130 <xsl:text>&#xA;</xsl:text>
131 <pre class="screen">
132 <xsl:apply-templates/>
133 </pre>
134 <xsl:text>&#xA;</xsl:text>
135 <xsl:text>}}}</xsl:text>
136 <xsl:text>&#xA;</xsl:text>
137</xsl:template>
138
139<xsl:template match="d:screen/d:prompt">
140<code class="prompt"><xsl:value-of select="."/></code>
141</xsl:template>
142
143<xsl:template match="d:screen/d:userinput">
144<strong class="userinput"><code><xsl:apply-templates/></code></strong>
145</xsl:template>
146
147<xsl:template match="d:screen/d:userinput/d:command">
148<span><strong class="command"><xsl:value-of select="."/></strong></span>
149</xsl:template>
150
151<xsl:template match="d:screen/d:userinput/d:option">
152<code class="option"><xsl:value-of select="."/></code>
153</xsl:template>
154
155<xsl:template match="d:screen/d:computeroutput">
156<code class="computeroutput"><xsl:value-of select="."/></code>
157</xsl:template>
158
159<xsl:template match="d:screen/d:userinput/d:parameter">
160<em class="parameter"><code><xsl:apply-templates/></code></em>
161</xsl:template>
162
163<xsl:template match="d:screen/d:userinput/d:parameter/d:replaceable">
164<code class="replaceable"><xsl:value-of select="."/></code>
165</xsl:template>
166
167
168<xsl:template match="d:blockquote">
169  <xsl:text>  </xsl:text><xsl:apply-templates/>
170</xsl:template>
171
172<xsl:template match="d:itemizedlist/d:listitem/d:simpara/d:link[@xl:href]">
173 <xsl:text>&#xA;</xsl:text>
174 <xsl:text> [</xsl:text><xsl:value-of select="@xl:href"/> <xsl:text> </xsl:text><xsl:value-of select="."/> <xsl:text>]</xsl:text>
175</xsl:template>
176
177<xsl:template match="d:variablelist/">
178 <xsl:text>&#xA;</xsl:text>
179 <xsl:apply-templates/>
180</xsl:template>
181
182<xsl:template match="d:variablelist/d:varlistentry/d:listitem/d:simpara/d:link[@xl:href]">
183 <xsl:text>&#xA;</xsl:text>
184 <xsl:text> [</xsl:text><xsl:value-of select="@xl:href"/> <xsl:text> </xsl:text><xsl:value-of select="."/> <xsl:text>]</xsl:text>
185</xsl:template>
186
187<xsl:template match="d:quote">
188  <xsl:text>"</xsl:text><xsl:value-of select="."/><xsl:text>"</xsl:text>
189</xsl:template>
190
191<xsl:template match="d:itemizedlist/d:listitem">
192 <xsl:text>&#xA;</xsl:text>
193 <xsl:text> @star@ </xsl:text><xsl:apply-templates/>
194</xsl:template>
195
196<xsl:template match="d:imagedata[@fileref]">
197<!--
198ex : [[Image(source:/trunk/SRC/Documentation/xmldoc/images/showfig.png)]]
199-->
200<xsl:text>[[Image(source:/trunk/SRC/Documentation/xmldoc/</xsl:text><xsl:value-of select="@fileref"/><xsl:text>)]]</xsl:text>
201</xsl:template>
202
203<xsl:template match="d:link[contains(@xl:href,'idldoc_html_output')]">
204 <xsl:text>[http://forge.ipsl.jussieu.fr/saxo/download/idldoc_html_output/</xsl:text>
205<xsl:message><xsl:value-of select="substring-after(@xl:href,'idldoc_html_output/')"/></xsl:message>
206<xsl:message>++Download</xsl:message>
207<!-- ++
208<xsl:value-of select="substring-after(@xl:href,'idldoc_html_output/')"/>
209-->
210<xsl:text>]</xsl:text>
211</xsl:template>
212
213<xsl:template match="d:link[contains(@xl:href,'idlfiles/')]">
214 <xsl:message>++idlfiles</xsl:message>
215 <xsl:text>[source:/trunk/SRC/Documentation/idlfiles/</xsl:text><xsl:value-of select="substring-after(@xl:href,'idlfiles/')"/> <xsl:value-of select="normalize-space(.)"/><xsl:text>]</xsl:text>
216</xsl:template>
217
218
219<xsl:template match="d:para/d:link[@xl:href]">
220<xsl:variable name="wikilink">
221 <xsl:choose>
222  <xsl:when test="contains(@xl:href,'firststeps.html')">
223   <xsl:text>wiki:FirstSteps</xsl:text>
224  </xsl:when>
225  <xsl:when test="contains(@xl:href,'all_plots.html')">
226   <xsl:text>wiki:AllPlots</xsl:text>
227  </xsl:when>
228  <xsl:when test="contains(@xl:href,'faqsaxo.html')">
229   <xsl:text>wiki:FaqSaxo</xsl:text>
230  </xsl:when>
231  <xsl:when test="contains(@xl:href,'getsaxo.html')">
232   <xsl:text>wiki:GetSaxo</xsl:text>
233  </xsl:when>
234  <xsl:when test="contains(@xl:href,'infoupdatecm.html')">
235   <xsl:text>wiki:InfoUpdateCm</xsl:text>
236  </xsl:when>
237  <xsl:when test="contains(@xl:href,'infoupdatekwd.html')">
238   <xsl:text>wiki:InfoUpdateKwd</xsl:text>
239  </xsl:when>
240  <xsl:when test="contains(@xl:href,'mailing.html')">
241   <xsl:text>wiki:Mailing</xsl:text>
242  </xsl:when>
243  <xsl:when test="contains(@xl:href,'mini_notice.html')">
244   <xsl:text>wiki:MiniNotice</xsl:text>
245  </xsl:when>
246  <xsl:when test="contains(@xl:href,'tiplink.html')">
247   <xsl:text>wiki:TipLink</xsl:text>
248  </xsl:when>
249  <xsl:when test="contains(@xl:href,'updatesaxo.html')">
250   <xsl:text>wiki:UpdateSaxo</xsl:text>
251  </xsl:when>
252  <xsl:when test="contains(@xl:href,'whatissaxo.html')">
253   <xsl:text>wiki:WhatisSaxo</xsl:text>
254  </xsl:when>
255  <xsl:when test="contains(@xl:href,'whatsnew.html')">
256   <xsl:text>wiki:WhatsNew</xsl:text>
257  </xsl:when>
258  <xsl:when test="contains(@xl:href,'websaxo.html')">
259   <xsl:text>wiki:WikiStart</xsl:text>
260  </xsl:when>
261  <xsl:otherwise>
262   <xsl:value-of select="@xl:href"/>
263  </xsl:otherwise>
264 </xsl:choose>
265</xsl:variable>
266<xsl:text>[</xsl:text><xsl:value-of select="$wikilink"/> <xsl:text> </xsl:text><xsl:value-of select="."/> <xsl:text>]</xsl:text>
267</xsl:template>
268
269<xsl:template match="d:quote">
270  <xsl:text>"</xsl:text><xsl:value-of select="."/><xsl:text>"</xsl:text>
271</xsl:template>
272
273<xsl:template match="d:email">
274<xsl:text>[mailto:</xsl:text><xsl:value-of select="."/> <xsl:text> </xsl:text><xsl:value-of select="."/> <xsl:text>]</xsl:text>
275</xsl:template>
276
277<xsl:template match="d:variablelist/d:varlistentry/d:term">
278 <xsl:text>'''</xsl:text><xsl:value-of select="normalize-space(.)"/><xsl:text>'''</xsl:text>
279</xsl:template>
280
281<xsl:template match="d:emphasis">
282  <xsl:text>''</xsl:text><xsl:value-of select="."/><xsl:text>''</xsl:text>
283</xsl:template>
284
285<xsl:template match="d:emphasis[@role='bold']">
286 <xsl:text>'''</xsl:text><xsl:value-of select="."/><xsl:text>'''</xsl:text>
287</xsl:template>
288
289
290<xsl:template match="d:replaceable">
291<!--
292+++ pas de ''' dans un truc qui est entre {{{...}}}
293-->
294  <xsl:text>'''''</xsl:text><xsl:value-of select="."/><xsl:text>'''''</xsl:text>
295</xsl:template>
296
297<xsl:template match="d:superscript">
298  <xsl:text>^</xsl:text><xsl:value-of select="."/><xsl:text>^</xsl:text>
299</xsl:template>
300
301<xsl:template match="d:subscript">
302  <xsl:text>,,</xsl:text><xsl:value-of select="."/><xsl:text>,,</xsl:text>
303</xsl:template>
304
305<xsl:template match="d:simplelist">
306<!-- but beware of links inside -->
307 <xsl:text>&#xA;</xsl:text>
308 <xsl:text>{{{</xsl:text>
309 <xsl:text>&#xA;</xsl:text>
310 <xsl:text>#!docbook</xsl:text>
311 <xsl:text>&#xA;</xsl:text>
312 <xsl:copy-of select="."/>
313 <xsl:text>&#xA;</xsl:text>
314 <xsl:text>}}}</xsl:text>
315 <xsl:text>&#xA;</xsl:text>
316</xsl:template>
317
318<xsl:template match="d:informaltable">
319<!-- but beware of links inside -->
320 <xsl:text>&#xA;</xsl:text>
321 <xsl:text>{{{</xsl:text>
322 <xsl:text>&#xA;</xsl:text>
323 <xsl:text>#!docbook</xsl:text>
324 <xsl:text>&#xA;</xsl:text>
325 <xsl:copy-of select="."/>
326 <xsl:text>&#xA;</xsl:text>
327 <xsl:text>}}}</xsl:text>
328 <xsl:text>&#xA;</xsl:text>
329</xsl:template>
330
331<xsl:template match="d:xref"> 
332  <xsl:variable name="target" select="key('id',@linkend)[1]"/>
333  <xsl:text>[#</xsl:text><xsl:value-of select="normalize-space(//d:sect1[normalize-space(@xml:id='$target')]/d:title)"/><xsl:text>]</xsl:text>
334</xsl:template>
335
336<!-- do not reproduce the followings elements -->
337<xsl:template match="d:mediaobject/d:textobject"/>
338<xsl:template match="d:info/d:authorgroup"/>
339<xsl:template match="d:info/d:revhistory"/>
340<xsl:template match="d:info/d:pubdate"/>
341<xsl:template match="d:keywordset"/>
342
343</xsl:stylesheet> 
Note: See TracBrowser for help on using the repository browser.