1 <?xml version="1.0"?> |
1 <?xml version="1.0"?> |
2 <xsl:stylesheet xmlns:exsl="http://exslt.org/common" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:ppx="http://www.plcopen.org/xml/tc6_0201" xmlns:ns="pou_vars_ns" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" extension-element-prefixes="ns" version="1.0" exclude-result-prefixes="ns"> |
2 <xsl:stylesheet xmlns:exsl="http://exslt.org/common" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:ppx="http://www.plcopen.org/xml/tc6_0201" xmlns:ns="beremiz" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" extension-element-prefixes="ns" version="1.0" exclude-result-prefixes="ns"> |
3 <xsl:output method="xml"/> |
3 <xsl:output method="xml"/> |
4 <xsl:template match="text()"/> |
4 <xsl:template match="text()"/> |
5 <xsl:template mode="var_class" match="text()"/> |
5 <xsl:template mode="var_class" match="text()"/> |
6 <xsl:template mode="var_type" match="text()"/> |
6 <xsl:template mode="var_type" match="text()"/> |
7 <xsl:template mode="var_edit" match="text()"/> |
7 <xsl:template mode="var_edit" match="text()"/> |
8 <xsl:template mode="var_debug" match="text()"/> |
8 <xsl:template mode="var_debug" match="text()"/> |
9 <xsl:variable name="project"> |
9 <xsl:variable name="project" select="ns:GetProject()"/> |
10 <xsl:copy-of select="document('project')/project/*"/> |
10 <xsl:variable name="stdlib" select="ns:GetStdLibs()"/> |
11 </xsl:variable> |
11 <xsl:variable name="extensions" select="ns:GetExtensions()"/> |
12 <xsl:variable name="stdlib"> |
|
13 <xsl:copy-of select="document('stdlib')/stdlib/*"/> |
|
14 </xsl:variable> |
|
15 <xsl:variable name="extensions"> |
|
16 <xsl:copy-of select="document('extensions')/extensions/*"/> |
|
17 </xsl:variable> |
|
18 <xsl:template name="add_root"> |
12 <xsl:template name="add_root"> |
19 <xsl:param name="class"/> |
13 <xsl:param name="class"/> |
20 <xsl:param name="type"/> |
14 <xsl:param name="type"/> |
21 <xsl:param name="edit"> |
15 <xsl:param name="edit"> |
22 <xsl:text>true</xsl:text> |
16 <xsl:text>true</xsl:text> |
208 </xsl:call-template> |
202 </xsl:call-template> |
209 </xsl:template> |
203 </xsl:template> |
210 <xsl:template mode="var_class" match="*[self::ppx:type or self::ppx:baseType]/ppx:derived"> |
204 <xsl:template mode="var_class" match="*[self::ppx:type or self::ppx:baseType]/ppx:derived"> |
211 <xsl:param name="default_class"/> |
205 <xsl:param name="default_class"/> |
212 <xsl:variable name="type_name" select="@name"/> |
206 <xsl:variable name="type_name" select="@name"/> |
213 <xsl:variable name="pou_infos"> |
207 <xsl:variable name="pou_infos" select="($project|$stdlib|$extensions)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name]"/> |
214 <xsl:copy-of select="exsl:node-set($project)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name] | exsl:node-set($stdlib)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name] | exsl:node-set($extensions)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name]"/> |
|
215 </xsl:variable> |
|
216 <xsl:choose> |
208 <xsl:choose> |
217 <xsl:when test="$pou_infos != ''"> |
209 <xsl:when test="$pou_infos"> |
218 <xsl:apply-templates mode="var_class" select="exsl:node-set($pou_infos)"/> |
210 <xsl:apply-templates mode="var_class" select="$pou_infos"/> |
219 </xsl:when> |
211 </xsl:when> |
220 <xsl:otherwise> |
212 <xsl:otherwise> |
221 <xsl:value-of select="$default_class"/> |
213 <xsl:value-of select="$default_class"/> |
222 </xsl:otherwise> |
214 </xsl:otherwise> |
223 </xsl:choose> |
215 </xsl:choose> |
251 <xsl:template mode="var_type" match="*[self::ppx:type or self::ppx:baseType]/*"> |
243 <xsl:template mode="var_type" match="*[self::ppx:type or self::ppx:baseType]/*"> |
252 <xsl:value-of select="local-name()"/> |
244 <xsl:value-of select="local-name()"/> |
253 </xsl:template> |
245 </xsl:template> |
254 <xsl:template mode="var_edit" match="*[self::ppx:type or self::ppx:baseType]/ppx:derived"> |
246 <xsl:template mode="var_edit" match="*[self::ppx:type or self::ppx:baseType]/ppx:derived"> |
255 <xsl:variable name="type_name" select="@name"/> |
247 <xsl:variable name="type_name" select="@name"/> |
256 <xsl:variable name="pou_infos"> |
248 <xsl:variable name="pou_infos" select="$project/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name]"/> |
257 <xsl:copy-of select="exsl:node-set($project)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name]"/> |
|
258 </xsl:variable> |
|
259 <xsl:choose> |
249 <xsl:choose> |
260 <xsl:when test="$pou_infos != ''"> |
250 <xsl:when test="$pou_infos"> |
261 <xsl:text>true</xsl:text> |
251 <xsl:text>true</xsl:text> |
262 </xsl:when> |
252 </xsl:when> |
263 <xsl:otherwise> |
253 <xsl:otherwise> |
264 <xsl:text>false</xsl:text> |
254 <xsl:text>false</xsl:text> |
265 </xsl:otherwise> |
255 </xsl:otherwise> |
271 <xsl:template mode="var_edit" match="*[self::ppx:type or self::ppx:baseType]/*"> |
261 <xsl:template mode="var_edit" match="*[self::ppx:type or self::ppx:baseType]/*"> |
272 <xsl:text>false</xsl:text> |
262 <xsl:text>false</xsl:text> |
273 </xsl:template> |
263 </xsl:template> |
274 <xsl:template mode="var_debug" match="*[self::ppx:type or self::ppx:baseType]/ppx:derived"> |
264 <xsl:template mode="var_debug" match="*[self::ppx:type or self::ppx:baseType]/ppx:derived"> |
275 <xsl:variable name="type_name" select="@name"/> |
265 <xsl:variable name="type_name" select="@name"/> |
276 <xsl:variable name="datatype_infos"> |
266 <xsl:variable name="datatype_infos" select="($project|$stdlib|$extensions)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name]"/> |
277 <xsl:copy-of select="exsl:node-set($project)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name] | exsl:node-set($project)/ppx:project/ppx:types/ppx:dataTypes/ppx:dataType[@name=$type_name] | exsl:node-set($stdlib)/ppx:project/ppx:types/ppx:dataTypes/ppx:dataType[@name=$type_name] | exsl:node-set($extensions)/ppx:project/ppx:types/ppx:dataTypes/ppx:dataType[@name=$type_name]"/> |
|
278 </xsl:variable> |
|
279 <xsl:choose> |
267 <xsl:choose> |
280 <xsl:when test="$datatype_infos != ''"> |
268 <xsl:when test="$datatype_infos != ''"> |
281 <xsl:apply-templates mode="var_debug" select="exsl:node-set($datatype_infos)"/> |
269 <xsl:apply-templates mode="var_debug" select="$datatype_infos"/> |
282 </xsl:when> |
270 </xsl:when> |
283 <xsl:otherwise> |
271 <xsl:otherwise> |
284 <xsl:text>false</xsl:text> |
272 <xsl:text>false</xsl:text> |
285 </xsl:otherwise> |
273 </xsl:otherwise> |
286 </xsl:choose> |
274 </xsl:choose> |