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 copy from the dictionary -->
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 -->
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('
')"/><!-- \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]"/>
70 <xsl:value-of select=
"string('
')"/><!-- \n -->
73 </pardefs><!--<xsl:value-of select="string('
')"/>--><!-- \n -->
81 <xsl:template match="pardef">
82 <xsl:copy-of select="."/>
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=
"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('
')"/> <!-- \n -->
103 <!-- Copy the rest of the dictionary deleting "prm" atribute from <par> nodes-->
104 <xsl:template match=
"section">
105 <xsl:copy-of select=
"."/>
108 <xsl:template match=
"section">
109 <xsl:value-of select=
"string('
')"/><!-- \n -->
110 <section id='{@id}' type='{@type}'
>
111 <xsl:apply-templates />
112 </section><xsl:value-of select=
"string('
')"/><!-- \n -->
117 <xsl:template match=
"e[@lm]"> <!-- with 'lm' atribute-->
118 <xsl:param name=
"parametro"/>
119 <xsl:value-of select=
"string(' ')"/>
121 <xsl:apply-templates>
122 <xsl:with-param name=
"parametro" select=
"$parametro"/>
123 </xsl:apply-templates>
124 </e> <xsl:value-of select=
"string('
')"/> <!-- \n -->
126 <xsl:template match=
"e[@r]"> <!-- with 'r' atribute-->
127 <xsl:param name=
"parametro"/>
128 <xsl:value-of select=
"string(' ')"/>
130 <xsl:apply-templates>
131 <xsl:with-param name=
"parametro" select=
"$parametro"/>
132 </xsl:apply-templates>
133 </e> <xsl:value-of select=
"string('
')"/> <!-- \n -->
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('
')"/> <!-- \n -->
146 <!-- If the <par> node have "prm" atribute delete it, otherwise copy -->
147 <xsl:template match=
"par[@prm]">
148 <par n='{ concat(@n,
"__",@prm) }'
/>
151 <xsl:template match=
"par[not(@prm)]">
152 <xsl:copy-of select=
"."/>
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>
168 <xsl:template match=
"p|re|s|a|b|j">
169 <xsl:copy-of select=
"."/>
172 <xsl:template match=
"prm">
173 <xsl:param name=
"parametro"/>
174 <xsl:value-of select=
"$parametro"/>