Moving tags
[apertium.git] / tags / apertium-fr-ca / release-1.0.0 / principal.xsl
blob4850b058029c58b0156ec36840d72faf4af3bc09
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 copy from the dictionary -->
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 -->
50 <!-- Generates the news paradigms -->
52 <!-- in variable mypardef we save the pardefs nodes of the dictionary-->
53 <xsl:variable name="mypardefs" select="//pardefs"/>
55 <xsl:for-each select="$paradigms">
56 <!-- Here the body of each new paradigm -->
57 <pardef n='{ concat(@name,"__",@prm) }'> <xsl:value-of select="string('&#xa;')"/><!-- \n -->
59 <!-- In the variable $paradigmname we save the name of the basic paradigm for expansion -->
60 <xsl:variable name="paradigmname" select="./@name"/>
61 <!-- and in the variable $paradigmprm we save the name of the variable part 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="ambito" select="$mypardefs/pardef[./@n=$paradigmname]"/>
67 </xsl:call-template>
69 </pardef>
70 <xsl:value-of select="string('&#xa;')"/><!-- \n -->
71 </xsl:for-each>
73 </pardefs><!--<xsl:value-of select="string('&#xa;')"/>--><!-- \n -->
74 </xsl:template>
80 <!--
81 <xsl:template match="pardef">
82 <xsl:copy-of select="."/>
83 </xsl:template>
84 -->
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="ambito"/>
95 <xsl:apply-templates select="$ambito/e">
96 <xsl:with-param name="parametro" select="$parametro"/>
97 </xsl:apply-templates>
98 <xsl:value-of select="string('&#xa;')"/> <!-- \n -->
99 </xsl:template>
103 <!-- Copy the rest of the dictionary deleting "prm" atribute from <par> nodes-->
104 <xsl:template match="section">
105 <xsl:copy-of select="."/>
106 </xsl:template>
108 <xsl:template match="section">
109 <xsl:value-of select="string('&#xa;')"/><!-- \n -->
110 <section id='{@id}' type='{@type}'>
111 <xsl:apply-templates />
112 </section><xsl:value-of select="string('&#xa;')"/><!-- \n -->
113 </xsl:template>
117 <xsl:template match="e[@lm]"> <!-- with 'lm' atribute-->
118 <xsl:param name="parametro"/>
119 <xsl:value-of select="string(' ')"/>
120 <e lm='{@lm}'>
121 <xsl:apply-templates>
122 <xsl:with-param name="parametro" select="$parametro"/>
123 </xsl:apply-templates>
124 </e> <xsl:value-of select="string('&#xa;')"/> <!-- \n -->
125 </xsl:template>
126 <xsl:template match="e[@r]"> <!-- with 'r' atribute-->
127 <xsl:param name="parametro"/>
128 <xsl:value-of select="string(' ')"/>
129 <e r='{@r}'>
130 <xsl:apply-templates>
131 <xsl:with-param name="parametro" select="$parametro"/>
132 </xsl:apply-templates>
133 </e> <xsl:value-of select="string('&#xa;')"/> <!-- \n -->
134 </xsl:template>
135 <xsl:template match="e[not(@*)]">
136 <xsl:param name="parametro"/>
137 <xsl:value-of select="string(' ')"/>
139 <xsl:apply-templates>
140 <xsl:with-param name="parametro" select="$parametro"/>
141 </xsl:apply-templates>
142 </e> <xsl:value-of select="string('&#xa;')"/> <!-- \n -->
143 </xsl:template>
146 <!-- If the <par> node have "prm" atribute delete it, otherwise copy -->
147 <xsl:template match="par[@prm]">
148 <par n='{ concat(@n,"__",@prm) }' />
149 </xsl:template>
151 <xsl:template match="par[not(@prm)]">
152 <xsl:copy-of select="."/>
153 </xsl:template>
154 <!-- ********************************************************** -->
157 <xsl:template match="i">
158 <xsl:param name="parametro"/>
160 <xsl:apply-templates>
161 <xsl:with-param name="parametro" select="$parametro"/>
162 </xsl:apply-templates>
163 </i>
164 </xsl:template>
168 <xsl:template match="p|re|s|a|b|j">
169 <xsl:copy-of select="."/>
170 </xsl:template>
172 <xsl:template match="prm">
173 <xsl:param name="parametro"/>
174 <xsl:value-of select="$parametro"/>
175 </xsl:template>
178 </xsl:stylesheet>