More af monodix entries and a few bidix fixes
[apertium.git] / apertium-es-ca / translate-to-default-equivalent.xsl
blob1174230d922cf472078c592909b3a8b1781f4ce0
1 <?xml version="1.0" encoding="ISO-8859-1"?><!-- -*- xml-*- -->
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 <!--
21 ==========================================================================
22 | File..........: convert.xsl
23 | Author........: Marco A. Montava
24 | Date..........: 29-Jul-2006
25 | Description...: Conversor de diccionaris amb polisemia a tractament simple
26 ==========================================================================
27 -->
29 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
30 <xsl:output method="xml" encoding="ISO-8859-1" indent="no"/>
32 <xsl:template match="/">
33 <xsl:value-of select="string('&#xa;')"/><!-- \n -->
34 <xsl:apply-templates select="dictionary"/>
35 </xsl:template>
37 <xsl:template match="dictionary">
38 <dictionary><xsl:value-of select="string('&#xa;')"/><!-- \n -->
39 <xsl:copy-of select="alphabet"/> <xsl:value-of select="string('&#xa;')"/><!-- \n -->
40 <xsl:copy-of select="sdefs"/> <xsl:value-of select="string('&#xa;')"/><!-- \n -->
41 <xsl:copy-of select="pardefs"/> <xsl:value-of select="string('&#xa;')"/><!-- \n -->
42 <xsl:apply-templates select="section"/>
43 </dictionary><xsl:value-of select="string('&#xa;')"/><!-- \n -->
44 </xsl:template>
46 <xsl:template match="section">
47 <xsl:value-of select="string('&#xa;')"/><!-- \n -->
48 <section id='{@id}' type='{@type}'><xsl:value-of select="string('&#xa;')"/><!-- \n -->
49 <xsl:apply-templates />
50 </section><xsl:value-of select="string('&#xa;')"/><!-- \n -->
51 </xsl:template>
56 <xsl:template match="e[@slr|@srl]"> <!-- si te problemes de polisemia -->
57 <xsl:choose>
58 <!-- si te conflicte L-R y R-L -->
59 <xsl:when test="./@slr!='' and ./@srl!='' ">
60 <xsl:choose>
61 <!-- si es per Defecte R-L i L-R-->
62 <xsl:when test="substring(./@srl,(string-length(./@srl)-1),2)=' D' and substring(./@slr,(string-length(./@slr)-1),2)=' D' ">
63 <e><xsl:value-of select="string('&#xa;')"/><!-- \n -->
64 <xsl:copy-of select="*"/>
65 <xsl:value-of select="string('&#xa;')"/><!-- \n -->
66 </e>
67 </xsl:when>
68 <!-- si es per Defecte L-R -->
69 <xsl:when test="substring(./@slr,(string-length(./@slr)-1),2)=' D'">
70 <e r="LR"><xsl:value-of select="string('&#xa;')"/><!-- \n -->
71 <xsl:copy-of select="*"/>
72 <xsl:value-of select="string('&#xa;')"/><!-- \n -->
73 </e>
74 </xsl:when>
75 <!-- si es per Defecte R-L -->
76 <xsl:when test="substring(./@srl,(string-length(./@srl)-1),2)=' D'">
77 <e r="RL"><xsl:value-of select="string('&#xa;')"/><!-- \n -->
78 <xsl:copy-of select="*"/>
79 <xsl:value-of select="string('&#xa;')"/><!-- \n -->
80 </e>
81 </xsl:when>
82 <!-- **** si no es per defecte cap, llavors s'elimina, s'ignora **** -->
83 </xsl:choose>
84 </xsl:when>
85 <!-- si sols te conflicte R-L -->
86 <xsl:when test="./@srl!='' ">
87 <xsl:choose>
88 <!-- si es la solucio per Defecte R-L i te restriccio RL-->
89 <xsl:when test="substring(./@srl,(string-length(./@srl)-1),2)=' D' and ./@r='RL'">
90 <e r="RL"><xsl:value-of select="string('&#xa;')"/><!-- \n -->
91 <xsl:copy-of select="*"/>
92 <xsl:value-of select="string('&#xa;')"/><!-- \n -->
93 </e>
94 </xsl:when>
95 <!-- si es la solucio per Defecte R-L -->
96 <xsl:when test="substring(./@srl,(string-length(./@srl)-1),2)=' D' ">
97 <e><xsl:value-of select="string('&#xa;')"/><!-- \n -->
98 <xsl:copy-of select="*"/>
99 <xsl:value-of select="string('&#xa;')"/><!-- \n -->
100 </e>
101 </xsl:when>
102 <!-- si no es la solucio per Defecte R-L i te restriccio RL-->
103 <xsl:when test="@r='RL' ">
104 <!-- L'ELIMINEM -->
105 </xsl:when>
106 <!-- si no es la solucio per Defecte R-L -->
107 <xsl:otherwise>
108 <e r="LR"><xsl:value-of select="string('&#xa;')"/><!-- \n -->
109 <xsl:copy-of select="*"/>
110 <xsl:value-of select="string('&#xa;')"/><!-- \n -->
111 </e>
112 </xsl:otherwise>
113 </xsl:choose>
114 </xsl:when>
115 <!-- si sols te conflicte L-R -->
116 <xsl:when test="./@slr!=''">
117 <xsl:choose>
118 <!-- si es la solucio per Defecte L-R i te restriccio LR-->
119 <xsl:when test="substring(./@slr,(string-length(./@slr)-1),2)=' D' and ./@r='LR'">
120 <e r="LR"><xsl:value-of select="string('&#xa;')"/><!-- \n -->
121 <xsl:copy-of select="*"/>
122 <xsl:value-of select="string('&#xa;')"/><!-- \n -->
123 </e>
124 </xsl:when>
125 <!-- si es la solucio per Defecte L-R -->
126 <xsl:when test="substring(./@slr,(string-length(./@slr)-1),2)=' D' ">
127 <e><xsl:value-of select="string('&#xa;')"/><!-- \n -->
128 <xsl:copy-of select="*"/>
129 <xsl:value-of select="string('&#xa;')"/><!-- \n -->
130 </e>
131 </xsl:when>
132 <!-- si no es la solucio per Defecte L-R i te restriccio LR-->
133 <xsl:when test="@r='LR' ">
134 <!-- L'ELIMINEM -->
135 </xsl:when>
136 <!-- si no es la solucio per Defecte L-R -->
137 <xsl:otherwise>
138 <e r="RL"><xsl:value-of select="string('&#xa;')"/><!-- \n -->
139 <xsl:copy-of select="*"/>
140 <xsl:value-of select="string('&#xa;')"/><!-- \n -->
141 </e>
142 </xsl:otherwise>
143 </xsl:choose>
144 </xsl:when>
145 </xsl:choose>
146 </xsl:template>
148 <xsl:template match="e[not(@slr|@srl)]"> <!-- elements sense polisemia -->
149 <xsl:copy-of select ="."/>
150 </xsl:template>
153 </xsl:stylesheet>