Removing +x bit on two dices
[apertium.git] / apertium-en-ca / principal.xsl
blob9a72449b57878541ec07c182f2981eeec8a11933
1 <?xml version="1.0" encoding="UTF-8"?>
2 <xsl:stylesheet version="1.0"
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
4 <xsl:output method="xml" encoding="UTF-8"/>
6 <xsl:template match="/">
7 <xsl:value-of select="string('&#xa;')"/> <!-- \n -->
8 <xsl:apply-templates select="dictionary"/>
9 </xsl:template>
11 <xsl:template match="dictionary">
12 <dictionary><xsl:value-of select="string('&#xa;')"/><!-- \n -->
13 <xsl:apply-templates select="alphabet"/>
14 <xsl:apply-templates select="sdefs"/>
15 <xsl:apply-templates select="pardefs"/>
16 <xsl:apply-templates select="section"/>
17 </dictionary><xsl:value-of select="string('&#xa;')"/><!-- \n -->
18 </xsl:template>
20 <xsl:template name="alpha" match="alphabet">
21 <alphabet>
22 <xsl:apply-templates />
23 </alphabet><xsl:value-of select="string('&#xa;')"/> <!-- \n -->
24 </xsl:template>
26 <xsl:template match="sdefs">
27 <sdefs>
28 <xsl:apply-templates />
29 </sdefs>
30 </xsl:template>
32 <xsl:template match="sdef">
33 <xsl:copy-of select="."/>
34 </xsl:template>
35 <!-- ** Since here, a simple copy from the dictionary ** -->
39 <!-- *************************************** -->
40 <!-- Generates the new paradigms from pardef -->
41 <xsl:template match="pardefs">
42 <xsl:value-of select="string('&#xa;')"/><!-- \n -->
43 <pardefs><xsl:value-of select="string('&#xa;')"/><!-- \n -->
45 <!-- Copy the dictionary original paradigms -->
46 <xsl:apply-templates />
47 <xsl:value-of select="string('&#xa;')"/><!-- \n -->
49 <!-- in variable mypardef we save the pardefs nodes of the dictionary-->
50 <xsl:variable name="mypardefs" select="//pardefs"/>
52 <!-- ** Generates the news paradigms ** -->
53 <xsl:for-each select="$paradigms">
54 <!-- Here the body of each new paradigm -->
55 <pardef n='{ concat(@name,"__",@prm) }'> <xsl:value-of select="string('&#xa;')"/><!-- \n -->
57 <!-- In the variable $paradigmname we save the name of the basic paradigm for expansion -->
58 <xsl:variable name="paradigmname" select="./@name"/>
59 <!-- in the variable $paradigmtype we save the type of expansion we need -->
60 <xsl:variable name="paradigmtype" select="./@type"/>
61 <!-- and in the variable $paradigmprm we save the name of the parameter for expansion -->
62 <xsl:variable name="paradigmprm" select="./@prm"/>
64 <xsl:call-template name="pardef-generated" select="$mypardefs/pardef[./@n=$paradigmname]">
65 <xsl:with-param name="parametro" select="$paradigmprm"/>
66 <xsl:with-param name="type" select="$paradigmtype"/>
67 <xsl:with-param name="ambito" select="$mypardefs/pardef[./@n=$paradigmname]"/>
68 </xsl:call-template>
70 </pardef>
71 <xsl:value-of select="string('&#xa;')"/><!-- \n -->
72 </xsl:for-each>
74 </pardefs><!--<xsl:value-of select="string('&#xa;')"/>--><!-- \n -->
75 </xsl:template>
76 <!-- *************************************** -->
81 <!-- ********* Works with the pardef nodes ********* -->
82 <!-- <xsl:template match="pardef"><xsl:copy-of select="."/></xsl:template>-->
85 <xsl:template match="pardef">
86 <pardef n='{@n}'> <xsl:value-of select="string('&#xa;')"/><!-- \n -->
87 <xsl:apply-templates/>
88 </pardef>
89 <xsl:value-of select="string('&#xa;')"/><!-- \n -->
90 </xsl:template>
92 <xsl:template name='pardef-generated'>
93 <xsl:param name="parametro"/>
94 <xsl:param name="type"/>
95 <xsl:param name="ambito"/>
96 <xsl:apply-templates select="$ambito/e">
97 <xsl:with-param name="parametro" select="$parametro"/>
98 <xsl:with-param name="type" select="$type"/>
99 </xsl:apply-templates>
100 <xsl:value-of select="string('&#xa;')"/> <!-- \n -->
101 </xsl:template>
105 <!-- *** Copy the rest of the dictionary deleting "prm" atribute from <par> nodes ** -->
106 <xsl:template match="section">
107 <xsl:copy-of select="."/>
108 </xsl:template>
110 <xsl:template match="section">
111 <xsl:value-of select="string('&#xa;')"/><!-- \n -->
112 <section id='{@id}' type='{@type}'>
113 <xsl:apply-templates />
114 </section><xsl:value-of select="string('&#xa;')"/><!-- \n -->
115 </xsl:template>
119 <xsl:template match="e[@lm]"> <!-- with 'lm' atribute-->
120 <xsl:param name="parametro"/>
121 <xsl:param name="type"/>
122 <xsl:value-of select="string(' ')"/>
123 <e lm='{@lm}'>
124 <xsl:apply-templates>
125 <xsl:with-param name="parametro" select="$parametro"/>
126 <xsl:with-param name="type" select="$type"/>
127 </xsl:apply-templates>
128 </e> <xsl:value-of select="string('&#xa;')"/> <!-- \n -->
129 </xsl:template>
130 <xsl:template match="e[@r]"> <!-- with 'r' atribute-->
131 <xsl:param name="parametro"/>
132 <xsl:param name="type"/>
133 <xsl:value-of select="string(' ')"/>
134 <e r='{@r}'>
135 <xsl:apply-templates>
136 <xsl:with-param name="parametro" select="$parametro"/>
137 <xsl:with-param name="type" select="$type"/>
138 </xsl:apply-templates>
139 </e> <xsl:value-of select="string('&#xa;')"/> <!-- \n -->
140 </xsl:template>
141 <xsl:template match="e[not(@r|@lm)]">
142 <xsl:param name="parametro"/>
143 <xsl:param name="type"/>
144 <xsl:value-of select="string(' ')"/>
146 <xsl:apply-templates>
147 <xsl:with-param name="parametro" select="$parametro"/>
148 <xsl:with-param name="type" select="$type"/>
149 </xsl:apply-templates>
150 </e> <xsl:value-of select="string('&#xa;')"/> <!-- \n -->
151 </xsl:template>
154 <!-- If the <par> node have "prm" atribute delete it -->
155 <xsl:template match="par[@prm]">
156 <par n='{ concat(@n,"__",@prm) }' />
157 </xsl:template>
158 <!-- If the <par> node have "sa" atribute delete it, otherwise copy -->
159 <xsl:template match="par[@sa]">
160 <par n='{ concat(@n,"__",@sa) }' />
161 </xsl:template>
162 <xsl:template match="par[not(@prm|@sa)]">
163 <xsl:copy-of select="."/>
164 </xsl:template>
165 <!-- *********************************************** -->
168 <xsl:template match="i">
169 <xsl:param name="parametro"/>
170 <xsl:param name="type"/>
172 <xsl:apply-templates>
173 <xsl:with-param name="parametro" select="$parametro"/>
174 <xsl:with-param name="type" select="$type"/>
175 </xsl:apply-templates>
176 </i>
177 </xsl:template>
179 <xsl:template match="p">
180 <xsl:param name="parametro"/>
181 <xsl:param name="type"/>
183 <xsl:apply-templates>
184 <xsl:with-param name="parametro" select="$parametro"/>
185 <xsl:with-param name="type" select="$type"/>
186 </xsl:apply-templates>
187 </p>
188 </xsl:template>
189 <xsl:template match="l">
190 <xsl:param name="parametro"/>
191 <xsl:param name="type"/>
193 <xsl:apply-templates>
194 <xsl:with-param name="parametro" select="$parametro"/>
195 <xsl:with-param name="type" select="$type"/>
196 </xsl:apply-templates>
197 </l>
198 </xsl:template>
199 <xsl:template match="r">
200 <xsl:param name="parametro"/>
201 <xsl:param name="type"/>
203 <xsl:apply-templates>
204 <xsl:with-param name="parametro" select="$parametro"/>
205 <xsl:with-param name="type" select="$type"/>
206 </xsl:apply-templates>
207 </r>
208 </xsl:template>
209 <xsl:template match="g">
210 <xsl:param name="parametro"/>
211 <xsl:param name="type"/>
213 <xsl:apply-templates>
214 <xsl:with-param name="parametro" select="$parametro"/>
215 <xsl:with-param name="type" select="$type"/>
216 </xsl:apply-templates>
217 </g>
218 </xsl:template>
223 <xsl:template match="re|s|a|b|j">
224 <xsl:copy-of select="."/>
225 </xsl:template>
228 <!-- ******* Treatement of the parameter label ******** -->
229 <!-- "prm" is the label for a text insertion ($type=text) -->
230 <!-- "sa" is the label for a tag insertion ($type=tag) -->
231 <xsl:template match="prm|sa">
232 <xsl:param name="parametro"/>
233 <xsl:param name="type"/>
234 <xsl:choose>
235 <xsl:when test="$type='text'">
236 <xsl:value-of select="$parametro"/>
237 </xsl:when>
238 <xsl:when test="$type='tag'">
239 <xsl:text disable-output-escaping="yes"><![CDATA[<s n="]]></xsl:text>
240 <xsl:value-of select="$parametro"/>
241 <xsl:text disable-output-escaping="yes"><![CDATA["/>]]></xsl:text>
242 </xsl:when>
243 </xsl:choose>
244 </xsl:template>
247 </xsl:stylesheet>