Few more
[apertium.git] / apertium-es-pt / filter.xsl
blob5b699bbaa5d5a34760f211ec1e25db2bce1118d6
1 <?xml version="1.0" encoding="UTF-8"?> <!-- -*- nxml -*- -->
2 <!--
3 Copyright (C) 2005 Universitat d'Alacant / Universidad de Alicante
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
18 02111-1307, USA.
19 -->
20 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
21 <xsl:output method="xml" encoding="UTF-8"/>
22 <xsl:param name="lang"/> <!-- language of the variant being generated -->
23 <xsl:param name="side"/> <!-- one of 'left' or 'right' -->
25 <xsl:template match="alphabet">
26 <alphabet><xsl:apply-templates/></alphabet>
27 </xsl:template>
29 <xsl:template match="sdefs">
30 <sdefs>
31 <xsl:apply-templates/>
32 </sdefs>
33 </xsl:template>
35 <xsl:template match="sdef">
36 <sdef n="{./@n}"/>
37 </xsl:template>
39 <xsl:template match="pardefs">
40 <pardefs>
41 <xsl:apply-templates/>
42 </pardefs>
43 </xsl:template>
45 <xsl:template match="pardef">
46 <pardef n="{./@n}">
47 <xsl:apply-templates/>
48 </pardef>
49 </xsl:template>
51 <xsl:template match="e">
52 <xsl:choose>
53 <xsl:when test="./@v=$lang">
54 <xsl:choose>
55 <xsl:when test="count(./@r)=0">
56 <e>
57 <xsl:apply-templates/>
58 </e>
59 </xsl:when>
60 <xsl:otherwise>
61 <e r="{./@r}">
62 <xsl:apply-templates/>
63 </e>
64 </xsl:otherwise>
65 </xsl:choose>
66 </xsl:when>
67 <xsl:when test="not(count(./@v)=0) and not(./@v=$lang)">
68 <xsl:choose>
69 <xsl:when test="$side=string('left')">
70 <e r="LR">
71 <xsl:apply-templates/>
72 </e>
73 </xsl:when>
74 <xsl:otherwise>
75 <xsl:if test="not(./@r=string('LR'))">
76 <e r="RL">
77 <xsl:apply-templates/>
78 </e>
79 </xsl:if>
80 </xsl:otherwise>
81 </xsl:choose>
82 </xsl:when>
83 <xsl:otherwise>
84 <xsl:choose>
85 <xsl:when test="not(count(./@r))=0">
86 <e r="{./@r}">
87 <xsl:apply-templates/>
88 </e>
89 </xsl:when>
90 <xsl:otherwise>
91 <e>
92 <xsl:apply-templates/>
93 </e>
94 </xsl:otherwise>
95 </xsl:choose>
96 </xsl:otherwise>
97 </xsl:choose>
98 </xsl:template>
100 <xsl:template match="p">
102 <xsl:apply-templates/>
103 </p>
104 </xsl:template>
106 <xsl:template match="l">
107 <l><xsl:apply-templates/></l>
108 </xsl:template>
110 <xsl:template match="r">
111 <r><xsl:apply-templates/></r>
112 </xsl:template>
114 <xsl:template match="s">
115 <s n="{./@n}"/>
116 </xsl:template>
118 <xsl:template match="b">
119 <b/>
120 </xsl:template>
122 <xsl:template match="j">
123 <j/>
124 </xsl:template>
126 <xsl:template match="a">
127 <a/>
128 </xsl:template>
130 <xsl:template match="re">
131 <re><xsl:apply-templates/></re>
132 </xsl:template>
134 <xsl:template match="section">
135 <section id="{./@id}" type="{./@type}">
136 <xsl:apply-templates/>
137 </section>
138 </xsl:template>
140 <xsl:template match="i">
142 <xsl:apply-templates/>
143 </i>
144 </xsl:template>
146 <xsl:template match="g"><g><xsl:apply-templates/></g></xsl:template>
148 <xsl:template match="par">
149 <par n="{./@n}"/>
150 </xsl:template>
152 <xsl:template match="dictionary">
153 <dictionary>
154 <xsl:apply-templates/>
155 </dictionary>
156 </xsl:template>
160 </xsl:stylesheet>