1
<?xml version="1.0" encoding="utf-8"?>
3
<!-- This simple XSL transformation creates a text version from
4
gimp-tips.xml.in which can then be used to seed
5
http://wiki.gimp.org/gimp/FortuneCookies in the GIMP Wiki. -->
7
<xsl:stylesheet version="1.0"
8
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
10
<!-- Pass this stylesheet a lang parameter in order to select a language. -->
11
<xsl:param name="lang" />
13
<xsl:output method="text" />
15
<xsl:template match="/">
16
<xsl:apply-templates select="//thetip[lang($lang)]" />
19
<xsl:template match="thetip">
20
* <xsl:apply-templates />
23
<xsl:template match="tt">
24
<xsl:text>{{{</xsl:text>
25
<xsl:apply-templates />
26
<xsl:text>}}}</xsl:text>
29
<!-- This sucks, but I don't seem to get xsl:strip-space to work. -->
30
<xsl:template match="text()">
31
<xsl:call-template name="search-and-replace">
32
<xsl:with-param name="input" select="." />
33
<xsl:with-param name="search-string" select="'
 '" />
34
<xsl:with-param name="replace-string" select="' '" />
38
<xsl:template name="search-and-replace">
39
<xsl:param name="input" />
40
<xsl:param name="search-string" />
41
<xsl:param name="replace-string" />
43
<xsl:when test="$search-string and contains($input, $search-string)">
44
<xsl:value-of select="substring-before($input, $search-string)" />
45
<xsl:value-of select="$replace-string" />
46
<xsl:call-template name="search-and-replace">
47
<xsl:with-param name="input"
48
select="substring-after($input, $search-string)" />
49
<xsl:with-param name="search-string" select="$search-string" />
50
<xsl:with-param name="replace-string" select="$replace-string" />
54
<xsl:value-of select="$input" />