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

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

some improvements in wiki production

  • Property snv:keywords set to Id
File size: 10.6 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:text>{{{</xsl:text><xsl:value-of select="."/><xsl:text>}}}</xsl:text>
104</xsl:template>
105
106<xsl:template match="d:varname">
107 <xsl:text>{{{</xsl:text><xsl:value-of select="."/><xsl:text>}}}</xsl:text>
108</xsl:template>
109
110<xsl:template match="d:literallayout">
111 <xsl:text>{{{</xsl:text><xsl:apply-templates/><xsl:text>}}}</xsl:text>
112</xsl:template>
113
114<xsl:template match="d:screen">
115 <!--
116we open an HTML block because it is not possible to have font effect (bold, italic)
117using TracWiki
118 -->
119 <xsl:text>{{{</xsl:text>
120 <xsl:text>&#xA;</xsl:text>
121 <xsl:text>#!html</xsl:text>
122 <xsl:text>&#xA;</xsl:text>
123 <pre class="screen">
124 <xsl:apply-templates/>
125 </pre>
126 <xsl:text>&#xA;</xsl:text>
127 <xsl:text>}}}</xsl:text>
128 <xsl:text>&#xA;</xsl:text>
129</xsl:template>
130
131<xsl:template match="d:screen/d:prompt">
132<code class="prompt"><xsl:value-of select="."/></code>
133</xsl:template>
134
135<xsl:template match="d:screen/d:userinput">
136<strong class="userinput"><code><xsl:apply-templates/></code></strong>
137</xsl:template>
138
139<xsl:template match="d:screen/d:userinput/d:command">
140<span><strong class="command"><xsl:value-of select="."/></strong></span>
141</xsl:template>
142
143<xsl:template match="d:screen/d:userinput/d:option">
144<code class="option"><xsl:value-of select="."/></code>
145</xsl:template>
146
147<xsl:template match="d:screen/d:computeroutput">
148<code class="computeroutput"><xsl:value-of select="."/></code>
149</xsl:template>
150
151<xsl:template match="d:screen/d:userinput/d:parameter">
152<em class="parameter"><code><xsl:apply-templates/></code></em>
153</xsl:template>
154
155<xsl:template match="d:screen/d:userinput/d:parameter/d:replaceable">
156<code class="replaceable"><xsl:value-of select="."/></code>
157</xsl:template>
158
159
160<xsl:template match="d:blockquote">
161  <xsl:text>  </xsl:text><xsl:apply-templates/>
162</xsl:template>
163
164<xsl:template match="d:itemizedlist/d:listitem/d:simpara/d:link[@xl:href]">
165 <xsl:text> [</xsl:text><xsl:value-of select="@xl:href"/> <xsl:text> </xsl:text><xsl:value-of select="."/> <xsl:text>]</xsl:text>
166</xsl:template>
167
168<xsl:template match="d:variablelist/d:varlistentry/d:listitem/d:simpara/d:link[@xl:href]">
169 <xsl:text> [</xsl:text><xsl:value-of select="@xl:href"/> <xsl:text> </xsl:text><xsl:value-of select="."/> <xsl:text>]</xsl:text>
170</xsl:template>
171
172<xsl:template match="d:quote">
173  <xsl:text>"</xsl:text><xsl:value-of select="."/><xsl:text>"</xsl:text>
174</xsl:template>
175
176<xsl:template match="d:itemizedlist/d:listitem">
177 <xsl:text> @star@ </xsl:text><xsl:apply-templates/>
178</xsl:template>
179
180<xsl:template match="d:imagedata[@fileref]">
181<!--
182ex : [[Image(source:/trunk/SRC/Documentation/xmldoc/images/showfig.png)]]
183-->
184<xsl:text>[[Image(source:/trunk/SRC/Documentation/xmldoc/</xsl:text><xsl:value-of select="@fileref"/><xsl:text>)]]</xsl:text>
185</xsl:template>
186
187<xsl:template match="d:link[contains(@xl:href,'idldoc_html_output')]">
188 <xsl:text>[http://forge.ipsl.jussieu.fr/saxo/download/idldoc_html_output/</xsl:text>
189<xsl:message><xsl:value-of select="substring-after(@xl:href,'idldoc_html_output/')"/></xsl:message>
190<xsl:message>++Download</xsl:message>
191<!-- ++
192<xsl:value-of select="substring-after(@xl:href,'idldoc_html_output/')"/>
193-->
194<xsl:text>]</xsl:text>
195</xsl:template>
196
197<xsl:template match="d:link[contains(@xl:href,'idlfiles/')]">
198 <xsl:message>++idlfiles</xsl:message>
199 <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>
200</xsl:template>
201
202
203<xsl:template match="d:para/d:link[@xl:href]">
204<xsl:variable name="wikilink">
205 <xsl:choose>
206  <xsl:when test="contains(@xl:href,'firststeps.html')">
207   <xsl:text>wiki:FirstSteps</xsl:text>
208  </xsl:when>
209  <xsl:when test="contains(@xl:href,'all_plots.html')">
210   <xsl:text>wiki:AllPlots</xsl:text>
211  </xsl:when>
212  <xsl:when test="contains(@xl:href,'faqsaxo.html')">
213   <xsl:text>wiki:FaqSaxo</xsl:text>
214  </xsl:when>
215  <xsl:when test="contains(@xl:href,'getsaxo.html')">
216   <xsl:text>wiki:GetSaxo</xsl:text>
217  </xsl:when>
218  <xsl:when test="contains(@xl:href,'infoupdatecm.html')">
219   <xsl:text>wiki:InfoUpdateCm</xsl:text>
220  </xsl:when>
221  <xsl:when test="contains(@xl:href,'infoupdatekwd.html')">
222   <xsl:text>wiki:InfoUpdateKwd</xsl:text>
223  </xsl:when>
224  <xsl:when test="contains(@xl:href,'mailing.html')">
225   <xsl:text>wiki:Mailing</xsl:text>
226  </xsl:when>
227  <xsl:when test="contains(@xl:href,'mini_notice.html')">
228   <xsl:text>wiki:MiniNotice</xsl:text>
229  </xsl:when>
230  <xsl:when test="contains(@xl:href,'tiplink.html')">
231   <xsl:text>wiki:TipLink</xsl:text>
232  </xsl:when>
233  <xsl:when test="contains(@xl:href,'updatesaxo.html')">
234   <xsl:text>wiki:UpdateSaxo</xsl:text>
235  </xsl:when>
236  <xsl:when test="contains(@xl:href,'whatissaxo.html')">
237   <xsl:text>wiki:WhatisSaxo</xsl:text>
238  </xsl:when>
239  <xsl:when test="contains(@xl:href,'whatsnew.html')">
240   <xsl:text>wiki:WhatsNew</xsl:text>
241  </xsl:when>
242  <xsl:when test="contains(@xl:href,'websaxo.html')">
243   <xsl:text>wiki:WikiStart</xsl:text>
244  </xsl:when>
245  <xsl:otherwise>
246   <xsl:value-of select="@xl:href"/>
247  </xsl:otherwise>
248 </xsl:choose>
249</xsl:variable>
250<xsl:text>[</xsl:text><xsl:value-of select="$wikilink"/> <xsl:text> </xsl:text><xsl:value-of select="."/> <xsl:text>]</xsl:text>
251</xsl:template>
252
253<xsl:template match="d:quote">
254  <xsl:text>"</xsl:text><xsl:value-of select="."/><xsl:text>"</xsl:text>
255</xsl:template>
256
257<xsl:template match="d:email">
258<xsl:text>[mailto:</xsl:text><xsl:value-of select="."/> <xsl:text> </xsl:text><xsl:value-of select="."/> <xsl:text>]</xsl:text>
259</xsl:template>
260
261
262<xsl:template match="d:variablelist/d:varlistentry/d:term">
263 <xsl:text>'''</xsl:text><xsl:value-of select="normalize-space(.)"/><xsl:text>'''</xsl:text>
264</xsl:template>
265
266<xsl:template match="d:emphasis">
267  <xsl:text>''</xsl:text><xsl:value-of select="."/><xsl:text>''</xsl:text>
268</xsl:template>
269
270<xsl:template match="d:replaceable">
271<!--
272+++ pas de ''' dans un truc qui est entre {{{...}}}
273-->
274  <xsl:text>'''''</xsl:text><xsl:value-of select="."/><xsl:text>'''''</xsl:text>
275</xsl:template>
276
277<xsl:template match="d:superscript">
278  <xsl:text>^</xsl:text><xsl:value-of select="."/><xsl:text>^</xsl:text>
279</xsl:template>
280
281<xsl:template match="d:subscript">
282  <xsl:text>,,</xsl:text><xsl:value-of select="."/><xsl:text>,,</xsl:text>
283</xsl:template>
284
285<xsl:template match="d:simplelist">
286<!-- but beware of links inside -->
287 <xsl:text>{{{</xsl:text>
288 <xsl:text>&#xA;</xsl:text>
289 <xsl:text>#!docbook</xsl:text>
290 <xsl:text>&#xA;</xsl:text>
291 <xsl:copy-of select="."/>
292 <xsl:text>&#xA;</xsl:text>
293 <xsl:text>}}}</xsl:text>
294 <xsl:text>&#xA;</xsl:text>
295</xsl:template>
296
297<xsl:template match="d:informaltable">
298<!-- but beware of links inside -->
299 <xsl:text>{{{</xsl:text>
300 <xsl:text>&#xA;</xsl:text>
301 <xsl:text>#!docbook</xsl:text>
302 <xsl:text>&#xA;</xsl:text>
303 <xsl:copy-of select="."/>
304 <xsl:text>&#xA;</xsl:text>
305 <xsl:text>}}}</xsl:text>
306 <xsl:text>&#xA;</xsl:text>
307</xsl:template>
308
309<xsl:template match="d:xref"> 
310  <xsl:variable name="target" select="key('id',@linkend)[1]"/>
311  <xsl:text>[#</xsl:text><xsl:value-of select="normalize-space(//d:sect1[normalize-space(@xml:id='$target')]/d:title)"/><xsl:text>]</xsl:text>
312</xsl:template>
313
314<!-- do not reproduce the followings elements -->
315<xsl:template match="d:mediaobject/d:textobject"/>
316<xsl:template match="d:info/d:authorgroup"/>
317<xsl:template match="d:info/d:revhistory"/>
318<xsl:template match="d:info/d:pubdate"/>
319<xsl:template match="d:keywordset"/>
320
321</xsl:stylesheet> 
Note: See TracBrowser for help on using the repository browser.