~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to data/tips/fortunes.xsl

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-05-02 16:33:03 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070502163303-bvzhjzbpw8qglc4y
Tags: 2.3.16-1ubuntu1
* Resynchronized with Debian, remaining Ubuntu changes:
  - debian/rules: i18n magic.
* debian/control.in:
  - Maintainer: Ubuntu Core Developers <ubuntu-devel@lists.ubuntu.com>
* debian/patches/02_help-message.patch,
  debian/patches/03_gimp.desktop.in.in.patch,
  debian/patches/10_dont_show_wizard.patch: updated.
* debian/patches/04_composite-signedness.patch,
  debian/patches/05_add-letter-spacing.patch: dropped, used upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="utf-8"?>
 
2
 
 
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. -->
 
6
 
 
7
<xsl:stylesheet version="1.0"
 
8
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 
9
 
 
10
  <!-- Pass this stylesheet a lang parameter in order to select a language. -->
 
11
  <xsl:param name="lang" />
 
12
 
 
13
  <xsl:output method="text" />
 
14
 
 
15
  <xsl:template match="/">
 
16
    <xsl:apply-templates select="//thetip[lang($lang)]" />
 
17
  </xsl:template>
 
18
 
 
19
  <xsl:template match="thetip">
 
20
 * <xsl:apply-templates />
 
21
  </xsl:template>
 
22
 
 
23
  <xsl:template match="tt">
 
24
    <xsl:text>{{{</xsl:text>
 
25
    <xsl:apply-templates />
 
26
    <xsl:text>}}}</xsl:text>
 
27
  </xsl:template>
 
28
 
 
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="'&#xa;    '" />
 
34
      <xsl:with-param name="replace-string" select="' '" />
 
35
    </xsl:call-template>
 
36
  </xsl:template>   
 
37
 
 
38
  <xsl:template name="search-and-replace">
 
39
    <xsl:param name="input" />
 
40
    <xsl:param name="search-string" />
 
41
    <xsl:param name="replace-string" />
 
42
    <xsl:choose>
 
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" />
 
51
        </xsl:call-template>
 
52
      </xsl:when>
 
53
      <xsl:otherwise>
 
54
        <xsl:value-of select="$input" />
 
55
      </xsl:otherwise>
 
56
    </xsl:choose>
 
57
  </xsl:template>
 
58
 
 
59
</xsl:stylesheet>