File: doap2text.xsl

package info (click to toggle)
gimp-help 3.0.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 289,540 kB
  • sloc: xml: 115,826; sh: 3,852; python: 1,004; makefile: 585; perl: 134
file content (97 lines) | stat: -rw-r--r-- 3,523 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<?xml version="1.0" encoding="UTF-8"?>
<!--
    Simple XSL transformation to create MAINTAINERS text version from
    gimp-help.doap.

    This file is part of the gimp-help project and is
    (C) 2010 The GIMP Documentation Team (License: GPL).
-->
<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                xmlns:doap="http://usefulinc.com/ns/doap#"
                xmlns:foaf="http://xmlns.com/foaf/0.1/"
                xmlns:gnome="http://api.gnome.org/doap-extensions#">

  <xsl:output method="text"/>

  <!-- valid mode: 'maintainers' (we may add 'authors' in the future) -->
  <xsl:param name="doap2text.mode" select="'maintainers'"/>
  <!-- not used yet -->
  <xsl:param name="doap2text.debug" select="0"/>
  <!-- add an "automatically generated" note? -->
  <xsl:param name="doap2text.maintainers.add-footnote" select="1"/>


  <!--=======================================================-->
  <xsl:template match="/doap:Project">
  <!--=======================================================-->
    <xsl:variable name="doap2text.target">
      <xsl:value-of select="$doap2text.mode"/>
    </xsl:variable>
    <xsl:choose>
      <xsl:when test="$doap2text.target='maintainers'">
        <xsl:text>Currently active maintainers
----------------------------
</xsl:text>
        <xsl:apply-templates select="doap:maintainer/foaf:Person"
          mode="maintainers"/>
        <xsl:if test="$doap2text.maintainers.add-footnote=1">
          <xsl:text>
(This file was generated automatically
from "gimp-help.doap". Do not edit.)
</xsl:text>
        </xsl:if>
      </xsl:when>
      <xsl:when test="$doap2text.target='authors'">
        <xsl:message terminate="yes">
          <xsl:text>Error: Generating AUTHORS from gimp-help.doap is </xsl:text>
          <xsl:text>not implemented yet.</xsl:text>
        </xsl:message>
      </xsl:when>
      <xsl:when test="$doap2text.target=''">
        <xsl:message terminate="yes">
          <xsl:text>Error: 'doap2text.mode' parameter not set.</xsl:text>
        </xsl:message>
      </xsl:when>
      <xsl:otherwise>
        <xsl:message terminate="yes">
          <xsl:text>Error: Unknown doap2text.mode specified: </xsl:text>
          <xsl:value-of select="$doap2text.target"/>
        </xsl:message>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!--===============================================================-->
  <xsl:template match="doap:maintainer/foaf:Person" mode="maintainers">
  <!--===============================================================-->
    <xsl:text>
</xsl:text>
    <xsl:value-of select="foaf:name"/>
    <xsl:text>
E-mail: </xsl:text>
    <xsl:variable name="mbox">
      <xsl:choose>
        <xsl:when test="contains(foaf:mbox/@rdf:resource,'mailto:')">
          <xsl:value-of select="substring-after(foaf:mbox/@rdf:resource,':')"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="foaf:mbox/@rdf:resource"/>
          <xsl:message>
            <xsl:text>doap2text.xsl: warning: missing "mailto:" in "</xsl:text>
            <xsl:value-of select="foaf:mbox/@rdf:resource"/>
            <xsl:text>"</xsl:text>
          </xsl:message>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <xsl:value-of select="$mbox"/>
    <xsl:text>
Userid: </xsl:text>
    <xsl:value-of select="gnome:userid"/>
    <xsl:text>
</xsl:text>
  </xsl:template>

</xsl:stylesheet>