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('
')"/> <!-- \n -->
8 <xsl:apply-templates select=
"dictionary"/>
11 <xsl:template match=
"dictionary">
12 <dictionary><xsl:value-of select=
"string('
')"/><!-- \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('
')"/><!-- \n -->
20 <xsl:template name=
"alpha" match=
"alphabet">
22 <xsl:apply-templates />
23 </alphabet><xsl:value-of select=
"string('
')"/> <!-- \n -->
26 <xsl:template match=
"sdefs">
28 <xsl:apply-templates />
32 <xsl:template match=
"sdef">
33 <xsl:copy-of select=
"."/>
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('
')"/><!-- \n -->
43 <pardefs><xsl:value-of select=
"string('
')"/><!-- \n -->
45 <!-- Copy the dictionary original paradigms -->
46 <xsl:apply-templates />
47 <xsl:value-of select=
"string('
')"/><!-- \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('
')"/><!-- \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]"/>
71 <xsl:value-of select=
"string('
')"/><!-- \n -->
74 </pardefs><!--<xsl:value-of select="string('
')"/>--><!-- \n -->
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('
')"/><!-- \n -->
87 <xsl:apply-templates/>
89 <xsl:value-of select=
"string('
')"/><!-- \n -->
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('
')"/> <!-- \n -->
105 <!-- *** Copy the rest of the dictionary deleting "prm" atribute from <par> nodes ** -->
106 <xsl:template match=
"section">
107 <xsl:copy-of select=
"."/>
110 <xsl:template match=
"section">
111 <xsl:value-of select=
"string('
')"/><!-- \n -->
112 <section id='{@id}' type='{@type}'
>
113 <xsl:apply-templates />
114 </section><xsl:value-of select=
"string('
')"/><!-- \n -->
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(' ')"/>
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('
')"/> <!-- \n -->
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(' ')"/>
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('
')"/> <!-- \n -->
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('
')"/> <!-- \n -->
154 <!-- If the <par> node have "prm" atribute delete it -->
155 <xsl:template match=
"par[@prm]">
156 <par n='{ concat(@n,
"__",@prm) }'
/>
158 <!-- If the <par> node have "sa" atribute delete it, otherwise copy -->
159 <xsl:template match=
"par[@sa]">
160 <par n='{ concat(@n,
"__",@sa) }'
/>
162 <xsl:template match=
"par[not(@prm|@sa)]">
163 <xsl:copy-of select=
"."/>
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>
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>
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>
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>
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>
223 <xsl:template match=
"re|s|a|b|j">
224 <xsl:copy-of select=
"."/>
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"/>
235 <xsl:when test=
"$type='text'">
236 <xsl:value-of select=
"$parametro"/>
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>