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