|
1 include yslt.yml2 |
|
2 estylesheet xmlns:ppx="http://www.plcopen.org/xml/tc6_0201" |
|
3 xmlns:xhtml="http://www.w3.org/1999/xhtml" |
|
4 xmlns:ns="pou_block_instances_ns" |
|
5 extension-element-prefixes="ns" |
|
6 exclude-result-prefixes="ns" { |
|
7 |
|
8 template "text()"; |
|
9 |
|
10 template "ppx:pou" { |
|
11 apply "ppx:body/*[self::ppx:FBD or self::ppx:LD or self::ppx:SFC]/*"; |
|
12 } |
|
13 |
|
14 function "add_instance" { |
|
15 param "type"; |
|
16 variable "instance" { |
|
17 > «ns:AddBlockInstance($type, @localId, ppx:position/@x, ppx:position/@y, @width, @height)» |
|
18 } |
|
19 } |
|
20 |
|
21 function "execution_order" { |
|
22 choose { |
|
23 when "@executionOrderId" > «@executionOrderId» |
|
24 otherwise > 0 |
|
25 } |
|
26 } |
|
27 |
|
28 function "ConnectionInfos" { |
|
29 param "type"; |
|
30 param "modifiers"; |
|
31 param "formalParameter"; |
|
32 variable "negated" { |
|
33 choose { |
|
34 when "$modifiers='input'" > «@negatedIn» |
|
35 when "$modifiers='output'" > «@negatedOut» |
|
36 otherwise > «@negated» |
|
37 } |
|
38 } |
|
39 variable "edge" { |
|
40 choose { |
|
41 when "$modifiers='input'" > «@edgeIn» |
|
42 when "$modifiers='output'" > «@edgeOut» |
|
43 otherwise > «@edge» |
|
44 } |
|
45 } |
|
46 variable "instance_connection" { |
|
47 > «ns:AddInstanceConnection($type, $formalParameter, $negated, $edge, ppx:relPosition/@x, ppx:relPosition/@y)» |
|
48 } |
|
49 } |
|
50 |
|
51 template "ppx:position" { |
|
52 variable "link_point" { |
|
53 > «ns:AddLinkPoint(@x, @y)» |
|
54 } |
|
55 } |
|
56 |
|
57 template "ppx:connection" { |
|
58 variable "connection_link" { |
|
59 > «ns:AddConnectionLink(@refLocalId, @formalParameter)» |
|
60 } |
|
61 apply "ppx:position"; |
|
62 } |
|
63 |
|
64 template "ppx:connectionPointIn" { |
|
65 param "modifiers"; |
|
66 param "formalParameter"; |
|
67 call "ConnectionInfos" { |
|
68 with "type" > input |
|
69 with "modifiers" > «$modifiers» |
|
70 with "formalParameter" > «$formalParameter» |
|
71 } |
|
72 apply "ppx:connection"; |
|
73 } |
|
74 |
|
75 template "ppx:connectionPointOut" { |
|
76 param "modifiers"; |
|
77 param "formalParameter"; |
|
78 call "ConnectionInfos" { |
|
79 with "type" > output |
|
80 with "modifiers" > «$modifiers» |
|
81 with "formalParameter" > «$formalParameter» |
|
82 } |
|
83 } |
|
84 |
|
85 template "ppx:connectionPointOutAction" { |
|
86 call "ConnectionInfos" { |
|
87 with "type" > output |
|
88 } |
|
89 } |
|
90 |
|
91 template "ppx:comment" { |
|
92 variable "type" > «local-name()» |
|
93 variable "instance_specific_values" { |
|
94 > «ns:SetSpecificValues(ppx:content/xhtml:p/text())» |
|
95 } |
|
96 call "add_instance" { |
|
97 with "type" > «$type» |
|
98 } |
|
99 } |
|
100 |
|
101 template "ppx:block" { |
|
102 variable "execution_order" { |
|
103 call "execution_order"; |
|
104 } |
|
105 variable "instance_specific_values" { |
|
106 > «ns:SetSpecificValues(@instanceName, $execution_order)» |
|
107 } |
|
108 call "add_instance" { |
|
109 with "type" > «@typeName» |
|
110 } |
|
111 foreach "ppx:inputVariables/ppx:variable" { |
|
112 apply "ppx:connectionPointIn" { |
|
113 with "formalParameter" > «@formalParameter» |
|
114 } |
|
115 } |
|
116 foreach "ppx:outputVariables/ppx:variable" { |
|
117 apply "ppx:connectionPointOut" { |
|
118 with "formalParameter" > «@formalParameter» |
|
119 } |
|
120 } |
|
121 } |
|
122 |
|
123 template "*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:derived" { |
|
124 > «@name» |
|
125 } |
|
126 |
|
127 template "*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:string" { |
|
128 > STRING |
|
129 } |
|
130 |
|
131 template "*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:wstring" { |
|
132 > WSTRING |
|
133 } |
|
134 |
|
135 template "*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/*" { |
|
136 > «local-name()» |
|
137 } |
|
138 |
|
139 function "VariableBlockInfos" { |
|
140 param "type"; |
|
141 variable "expression" > «ppx:expression/text()» |
|
142 variable "value_type" { |
|
143 choose { |
|
144 when "ancestor::ppx:transition[@name=$expression]" > BOOL |
|
145 when "ancestor::ppx:pou[@name=$expression]" { |
|
146 apply "ancestor::ppx:pou/child::ppx:interface/ppx:returnType" |
|
147 } |
|
148 otherwise { |
|
149 apply "ancestor::ppx:pou/child::ppx:interface/*/ppx:variable[@name=$expression]/ppx:type" |
|
150 } |
|
151 } |
|
152 } |
|
153 variable "execution_order" { |
|
154 call "execution_order"; |
|
155 } |
|
156 variable "instance_specific_values" { |
|
157 > «ns:SetSpecificValues($expression, $value_type, $execution_order)» |
|
158 } |
|
159 call "add_instance" { |
|
160 with "type" > «$type» |
|
161 } |
|
162 apply "ppx:connectionPointIn" { |
|
163 with "modifiers" { |
|
164 choose { |
|
165 when "$type='inout'" > input |
|
166 otherwise > |
|
167 } |
|
168 } |
|
169 } |
|
170 apply "ppx:connectionPointOut" { |
|
171 with "modifiers" { |
|
172 choose { |
|
173 when "$type='inout'" > output |
|
174 otherwise > |
|
175 } |
|
176 } |
|
177 } |
|
178 } |
|
179 |
|
180 template "ppx:inVariable" { |
|
181 call "VariableBlockInfos" with "type", "'input'"; |
|
182 } |
|
183 |
|
184 template "ppx:outVariable" { |
|
185 call "VariableBlockInfos" with "type", "'output'"; |
|
186 } |
|
187 |
|
188 template "ppx:inOutVariable" { |
|
189 call "VariableBlockInfos" with "type", "'inout'"; |
|
190 } |
|
191 |
|
192 template "ppx:connector|ppx:continuation" { |
|
193 variable "type" > «local-name()» |
|
194 variable "instance_specific_values" { |
|
195 > «ns:SetSpecificValues(@name)» |
|
196 } |
|
197 call "add_instance" { |
|
198 with "type" > «$type» |
|
199 } |
|
200 apply "ppx:connectionPointIn"; |
|
201 apply "ppx:connectionPointOut"; |
|
202 } |
|
203 |
|
204 template "ppx:leftPowerRail|ppx:rightPowerRail" { |
|
205 variable "type" > «local-name()» |
|
206 variable "connectors" { |
|
207 choose { |
|
208 when "$type='leftPowerRail'" > «count(ppx:connectionPointOut)» |
|
209 otherwise > «count(ppx:connectionPointIn)» |
|
210 } |
|
211 } |
|
212 variable "instance_specific_values" { |
|
213 > «ns:SetSpecificValues($connectors)» |
|
214 } |
|
215 call "add_instance" { |
|
216 with "type" > «$type» |
|
217 } |
|
218 choose { |
|
219 when "$type='leftPowerRail'" { |
|
220 apply "ppx:connectionPointOut"; |
|
221 } |
|
222 otherwise { |
|
223 apply "ppx:connectionPointIn"; |
|
224 } |
|
225 } |
|
226 } |
|
227 |
|
228 template "ppx:contact|ppx:coil" { |
|
229 variable "type" > «local-name()» |
|
230 variable "storage" { |
|
231 choose { |
|
232 when "$type='coil'" > «@storage» |
|
233 otherwise > |
|
234 } |
|
235 } |
|
236 variable "execution_order" { |
|
237 call "execution_order"; |
|
238 } |
|
239 variable "instance_specific_values" { |
|
240 > «ns:SetSpecificValues(ppx:variable/text(), @negated, @edge, $storage, $execution_order)» |
|
241 } |
|
242 call "add_instance" { |
|
243 with "type" > «$type» |
|
244 } |
|
245 apply "ppx:connectionPointIn"; |
|
246 apply "ppx:connectionPointOut"; |
|
247 } |
|
248 |
|
249 template "ppx:step" { |
|
250 variable "type" > «local-name()» |
|
251 variable "instance_specific_values" { |
|
252 > «ns:SetSpecificValues(@name, @initialStep)» |
|
253 } |
|
254 apply "ppx:connectionPointOutAction"; |
|
255 call "add_instance" { |
|
256 with "type" > «$type» |
|
257 } |
|
258 apply "ppx:connectionPointIn"; |
|
259 apply "ppx:connectionPointOut"; |
|
260 } |
|
261 |
|
262 template "ppx:transition" { |
|
263 variable "type" > «local-name()» |
|
264 variable "priority" { |
|
265 choose { |
|
266 when "@priority" > «@priority» |
|
267 otherwise > 0 |
|
268 } |
|
269 } |
|
270 variable "condition_type" { |
|
271 choose { |
|
272 when "ppx:condition/ppx:connectionPointIn" > connection |
|
273 when "ppx:condition/ppx:reference" > reference |
|
274 when "ppx:condition/ppx:inline" > inline |
|
275 otherwise > |
|
276 } |
|
277 } |
|
278 variable "condition" { |
|
279 choose { |
|
280 when "ppx:reference" > «ppx:condition/ppx:reference/@name» |
|
281 when "ppx:inline" > «ppx:condition/ppx:inline/ppx:body/ppx:ST/xhtml:p/text()» |
|
282 otherwise > |
|
283 } |
|
284 } |
|
285 variable "instance_specific_values" { |
|
286 > «ns:SetSpecificValues($priority, $condition_type, $condition)» |
|
287 } |
|
288 apply "ppx:condition/ppx:connectionPointIn"; |
|
289 call "add_instance" { |
|
290 with "type" > «$type» |
|
291 } |
|
292 apply "ppx:connectionPointIn"; |
|
293 apply "ppx:connectionPointOut"; |
|
294 } |
|
295 |
|
296 template "ppx:selectionDivergence|ppx:selectionConvergence|ppx:simultaneousDivergence|ppx:simultaneousConvergence" { |
|
297 variable "type" > «local-name()» |
|
298 variable "connectors" { |
|
299 choose { |
|
300 when "ppx:selectionDivergence|ppx:simultaneousDivergence" { |
|
301 > «count(ppx:connectionPointOut)» |
|
302 } |
|
303 otherwise > «count(ppx:connectionPointIn)» |
|
304 } |
|
305 } |
|
306 variable "instance_specific_values" { |
|
307 > «ns:SetSpecificValues($connectors)» |
|
308 } |
|
309 call "add_instance" { |
|
310 with "type" > «$type» |
|
311 } |
|
312 apply "ppx:connectionPointIn"; |
|
313 apply "ppx:connectionPointOut"; |
|
314 } |
|
315 |
|
316 template "ppx:jumpStep" { |
|
317 variable "type" > jump |
|
318 variable "instance_specific_values" { |
|
319 > «ns:SetSpecificValues(@targetName)» |
|
320 } |
|
321 call "add_instance" { |
|
322 with "type" > «$type» |
|
323 } |
|
324 apply "ppx:connectionPointIn"; |
|
325 } |
|
326 |
|
327 template "ppx:action" { |
|
328 variable "type" { |
|
329 choose { |
|
330 when "ppx:reference" > reference |
|
331 when "ppx:inline" > inline |
|
332 otherwise > |
|
333 } |
|
334 } |
|
335 variable "value" { |
|
336 choose { |
|
337 when "ppx:reference" > «ppx:reference/@name» |
|
338 when "ppx:inline" > «ppx:inline/ppx:ST/xhtml:p/text()» |
|
339 otherwise > |
|
340 } |
|
341 } |
|
342 variable "actionBlock_action" { |
|
343 > «ns:AddAction(@qualifier, $type, $value, @duration, @indicator)» |
|
344 } |
|
345 } |
|
346 |
|
347 template "ppx:actionBlock" { |
|
348 variable "type" > «local-name()» |
|
349 variable "instance_specific_values" { |
|
350 > «ns:SetSpecificValues()» |
|
351 } |
|
352 apply "ppx:action"; |
|
353 call "add_instance" { |
|
354 with "type" > «$type» |
|
355 } |
|
356 apply "ppx:connectionPointIn"; |
|
357 } |
|
358 } |