~ubuntu.cat/ubuntaires/ajuda

« back to all changes in this revision

Viewing changes to intrepid/teamstuff/docbook2moin/lists.xslt

  • Committer: Arnau Alcázar Lleopart
  • Date: 2009-07-17 11:09:35 UTC
  • Revision ID: arnau@alcalleop.net-20090717110935-gnslz4lobcm7wj8y
Afegit la traducció de la intrepid

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="UTF-8"?>
 
2
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 
3
 
 
4
<!-- XSLT for db2mm
 
5
    This file is part of db2mm, see db2mm.xslt for details
 
6
 
 
7
    Copyright 2005, 2006 by Jeff Schering (jeffschering@gmail.com)
 
8
        Copyright 2006 by Mikko Virkkilä (mvirkkil@cc.hut.fi)
 
9
 
 
10
    This program is free software; you can redistribute it and/or modify
 
11
    it under the terms of the GNU General Public License as published by
 
12
    the Free Software Foundation; either version 2 of the License, or
 
13
    (at your option) any later version.
 
14
 
 
15
    This program is distributed in the hope that it will be useful,
 
16
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
17
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
18
    GNU General Public License for more details.
 
19
 
 
20
    You should have received a copy of the GNU General Public License
 
21
    along with this program; if not, write to the Free Software
 
22
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
23
 
 
24
  
 
25
-->
 
26
 
 
27
<!--
 
28
### Lists ###
 
29
-->
 
30
 
 
31
 
 
32
<xsl:template match="variablelist">
 
33
        <xsl:apply-templates select="varlistentry"/>
 
34
        <xsl:value-of select="$newline" />
 
35
</xsl:template>
 
36
 
 
37
<xsl:template match="varlistentry">
 
38
        <xsl:apply-templates />
 
39
</xsl:template>
 
40
 
 
41
<xsl:template match="varlistentry/term">
 
42
        <xsl:call-template name="listdepth" /><xsl:text>. '''</xsl:text>
 
43
        <xsl:value-of select="text()"/>
 
44
        <xsl:text>'''</xsl:text>
 
45
        <xsl:value-of select="$newline" />
 
46
</xsl:template>
 
47
 
 
48
<xsl:template match="glosslist">
 
49
        <xsl:apply-templates />
 
50
        <xsl:value-of select="$newline"/>
 
51
</xsl:template>
 
52
 
 
53
<xsl:template match="glossterm">
 
54
        <xsl:value-of select="."/>
 
55
</xsl:template>
 
56
 
 
57
 
 
58
<xsl:template match="glosslist/glossentry">
 
59
        <xsl:text> </xsl:text>
 
60
        <xsl:apply-templates select="glossterm" /><xsl:text>::</xsl:text>
 
61
        
 
62
        <xsl:variable name="count">
 
63
                <xsl:value-of select="count(glossdef/para)" />
 
64
        </xsl:variable>
 
65
        
 
66
        <xsl:for-each select="glossdef/para">
 
67
                <xsl:if test="$count>1">
 
68
                        <xsl:value-of select="$newline" />
 
69
                        <xsl:text> ::</xsl:text>
 
70
                </xsl:if>
 
71
 
 
72
            <xsl:text> </xsl:text>              
 
73
                <xsl:variable name="var">
 
74
                        <xsl:apply-templates/>
 
75
            </xsl:variable>
 
76
            <xsl:value-of select="normalize-space($var)"/>
 
77
 
 
78
        </xsl:for-each>
 
79
        <xsl:value-of select="$newline" />
 
80
        <xsl:value-of select="$newline" />
 
81
        
 
82
</xsl:template>
 
83
 
 
84
 
 
85
<xsl:template match="orderedlist|itemizedlist|procedure|substeps">
 
86
  <xsl:apply-templates select="itemizedlist|orderedlist|listitem|procedure|step|substeps"/>
 
87
  
 
88
  <!-- extra newline if end of list, to make things pretty -->
 
89
  <!--<xsl:if test="count(ancestor::itemizedlist|ancestor::orderedlist|ancestor::procedure|ancestor::substeps)=0">
 
90
        <xsl:value-of select="$newline" />
 
91
  </xsl:if>-->
 
92
</xsl:template>
 
93
 
 
94
<xsl:template name="listdepth">
 
95
        <xsl:for-each select="ancestor-or-self::listitem">
 
96
                <xsl:value-of select="$space" />
 
97
        </xsl:for-each>
 
98
        <xsl:for-each select="ancestor-or-self::step">
 
99
                <xsl:value-of select="$space" />
 
100
        </xsl:for-each>
 
101
        <xsl:for-each select="ancestor-or-self::varlistentry">
 
102
                <xsl:value-of select="$space" />
 
103
        </xsl:for-each>
 
104
</xsl:template>
 
105
 
 
106
<xsl:template name="listnumeration">
 
107
        <!-- gets first parent with the numeration attribute. Variable will be "" if none is found-->
 
108
        <xsl:variable name="numeration" select="ancestor::*[@numeration][1]/@numeration" />
 
109
 
 
110
        <xsl:choose>
 
111
                <!--
 
112
                                '1': "arabic", (default)
 
113
                                'a': "loweralpha", 
 
114
                                'A': "upperalpha",
 
115
                                'i': "lowerroman",
 
116
                                'I': "upperroman"
 
117
                -->
 
118
                <xsl:when test="$numeration='loweralpha'">
 
119
                        <xsl:text>a. </xsl:text>
 
120
                </xsl:when>
 
121
                <xsl:when test="$numeration='upperalpha'">
 
122
                        <xsl:text>A. </xsl:text>
 
123
                </xsl:when>
 
124
                <xsl:when test="$numeration='lowerroman'">
 
125
                        <xsl:text>i. </xsl:text>
 
126
                </xsl:when>
 
127
                <xsl:when test="$numeration='upperroman'">
 
128
                        <xsl:text>I. </xsl:text>
 
129
                </xsl:when>
 
130
                <xsl:otherwise>
 
131
                        <xsl:text>1. </xsl:text>
 
132
                </xsl:otherwise>
 
133
        </xsl:choose>
 
134
</xsl:template>
 
135
 
 
136
 
 
137
<xsl:template match="listitem/para|step/para">
 
138
  <xsl:if test="position()>1">
 
139
          <xsl:text>[[BR]][[BR]]</xsl:text>
 
140
  </xsl:if>
 
141
  
 
142
  <xsl:variable name="var">
 
143
        <xsl:apply-templates/>
 
144
  </xsl:variable>
 
145
  <xsl:value-of select="normalize-space($var)"/>
 
146
 
 
147
</xsl:template>
 
148
 
 
149
 
 
150
 
 
151
<xsl:template match="orderedlist/listitem|step">
 
152
        <xsl:call-template name="listdepth"/>
 
153
        <xsl:call-template name="listnumeration" />
 
154
        
 
155
        <xsl:variable name="var">
 
156
                <xsl:apply-templates select="para"/>
 
157
        </xsl:variable>
 
158
        <xsl:value-of select="normalize-space($var)"/>
 
159
        <xsl:value-of select="$newline"/>
 
160
        <xsl:apply-templates select="itemizedlist|varlistentry|orderedlist|step"/>
 
161
        
 
162
</xsl:template>
 
163
 
 
164
 
 
165
<xsl:template match="itemizedlist/listitem|varlistentry/listitem">
 
166
        <xsl:call-template name="listdepth"/><xsl:text>* </xsl:text>
 
167
        <xsl:variable name="var">
 
168
                <xsl:apply-templates select="para"/>
 
169
    </xsl:variable>
 
170
        <xsl:value-of select="normalize-space($var)"/>
 
171
        <xsl:value-of select="$newline"/>
 
172
        <xsl:apply-templates select="itemizedlist|varlistentry|orderedlist|step"/>
 
173
 
 
174
</xsl:template>
 
175
 
 
176
 
 
177
</xsl:stylesheet>