edouard@1936: include yslt_noindent.yml2
edouard@1936: istylesheet xmlns:ppx="http://www.plcopen.org/xml/tc6_0201"
Laurent@1338:             xmlns:xhtml="http://www.w3.org/1999/xhtml"
Edouard@1957:             xmlns:ns="beremiz" 
Laurent@1338:             extension-element-prefixes="ns" 
Laurent@1338:             exclude-result-prefixes="ns" {
Laurent@1345:     
Laurent@1338:     template "text()";
Laurent@1338:     
edouard@3868:     template "ppx:pou[ppx:body]|ppx:transition[ppx:body]|ppx:action[ppx:body]" {
Laurent@1338:         apply "ppx:body/*[self::ppx:FBD or self::ppx:LD or self::ppx:SFC]/*";
Laurent@1338:     }
Laurent@1338:     
Laurent@1338:     function "add_instance" {
Laurent@1338:         param "type";
Laurent@1345:         value "ns:AddBlockInstance($type, @localId, ppx:position/@x, ppx:position/@y, @width, @height)";
Laurent@1338:     }
Laurent@1338:     
Laurent@1338:     function "execution_order" {
Laurent@1338:         choose {
Laurent@1338:             when "@executionOrderId" > «@executionOrderId»
Laurent@1338:             otherwise > 0
Laurent@1338:         }
Laurent@1338:     }
Laurent@1338:     
Laurent@1338:     function "ConnectionInfos" {
Laurent@1338:         param "type";
Laurent@1344:         param "negated";
Laurent@1344:         param "edge";
Laurent@1338:         param "formalParameter";
Laurent@1345:         value "ns:AddInstanceConnection($type, $formalParameter, $negated, $edge, ppx:relPosition/@x, ppx:relPosition/@y)";
Laurent@1338:     }
Laurent@1338:     
Laurent@1338:     template "ppx:position" {
Laurent@1345:         value "ns:AddLinkPoint(@x, @y)";
Laurent@1338:     }
Laurent@1338:     
Laurent@1338:     template "ppx:connection" {
Laurent@1345:         value "ns:AddConnectionLink(@refLocalId, @formalParameter)";
Laurent@1338:         apply "ppx:position";
Laurent@1338:     }
Laurent@1338:     
Laurent@1338:     template "ppx:connectionPointIn" {
Laurent@1344:         param "negated";
Laurent@1344:         param "edge";
Laurent@1338:         param "formalParameter";
Laurent@1338:         call "ConnectionInfos" {
Laurent@1338:             with "type" > input
Laurent@1344:             with "negated" > «$negated»
Laurent@1344:             with "edge" > «$edge»
Laurent@1338:             with "formalParameter" > «$formalParameter»
Laurent@1338:         }
Laurent@1338:         apply "ppx:connection";
Laurent@1338:     }
Laurent@1338:     
Laurent@1338:     template "ppx:connectionPointOut" {
Laurent@1344:         param "negated";
Laurent@1344:         param "edge";
Laurent@1338:         param "formalParameter";
Laurent@1338:         call "ConnectionInfos" {
Laurent@1338:             with "type" > output
Laurent@1344:             with "negated" > «$negated»
Laurent@1344:             with "edge" > «$edge»
Laurent@1338:             with "formalParameter" > «$formalParameter»
Laurent@1338:         }
Laurent@1338:     }
Laurent@1338:     
Laurent@1338:     template "ppx:connectionPointOutAction" {
Laurent@1338:         call "ConnectionInfos" {
Laurent@1338:             with "type" > output
Laurent@1338:         }
Laurent@1338:     }
Laurent@1338:     
Laurent@1338:     template "ppx:comment" {
Laurent@1345:         value "ns:SetSpecificValues(ppx:content/xhtml:p/text())";
Laurent@1345:         call "add_instance" {
Laurent@1345:             with "type" > «local-name()»
Laurent@1338:         }
Laurent@1338:     }
Laurent@1338:     
Laurent@1338:     template "ppx:block" {
Laurent@1338:         variable "execution_order" {
Laurent@1338:             call "execution_order";
Laurent@1338:         }
Laurent@1345:         value "ns:SetSpecificValues(@instanceName, $execution_order)";
Laurent@1338:         call "add_instance" {
Laurent@1338:             with "type" > «@typeName»
Laurent@1338:         }
Laurent@1338:         foreach "ppx:inputVariables/ppx:variable" {
Laurent@1338:             apply "ppx:connectionPointIn" {
Laurent@1345:                 with "negated", "@negated";
Laurent@1345:                 with "edge", "@edge";
Laurent@1345:                 with "formalParameter", "@formalParameter";
Laurent@1338:             }
Laurent@1338:         }
Laurent@1338:         foreach "ppx:outputVariables/ppx:variable" {
Laurent@1338:             apply "ppx:connectionPointOut" {
Laurent@1345:                 with "negated", "@negated";
Laurent@1345:                 with "edge", "@edge";
Laurent@1345:                 with "formalParameter", "@formalParameter";
Laurent@1338:             }
Laurent@1338:         }
Laurent@1338:     }
Laurent@1338:     
Laurent@1338:     template "*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:derived" {
Laurent@1338:         > «@name»
Laurent@1338:     }
Laurent@1338:   
Laurent@1338:     template "*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:string" {
Laurent@1338:         > STRING
Laurent@1338:     }
Laurent@1338:   
Laurent@1338:     template "*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:wstring" {
Laurent@1338:         > WSTRING
Laurent@1338:     }
Laurent@1338:     
Laurent@1338:     template "*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/*" {
Laurent@1338:         > «local-name()»
Laurent@1338:     }
Laurent@1338:     
Laurent@1338:     function "VariableBlockInfos" {
Laurent@1338:         param "type";
Laurent@1338:         variable "expression" > «ppx:expression/text()»
Laurent@1338:         variable "value_type" {
Laurent@1338:             choose {
Laurent@1338:                 when "ancestor::ppx:transition[@name=$expression]" > BOOL
Laurent@1338:                 when "ancestor::ppx:pou[@name=$expression]" {
Laurent@1338:                     apply "ancestor::ppx:pou/child::ppx:interface/ppx:returnType"
Laurent@1338:                 }
Laurent@1338:                 otherwise {
Laurent@1338:                     apply "ancestor::ppx:pou/child::ppx:interface/*/ppx:variable[@name=$expression]/ppx:type"
Laurent@1338:                 }
Laurent@1338:             }
Laurent@1338:         }
Laurent@1338:         variable "execution_order" {
Laurent@1338:             call "execution_order";
Laurent@1338:         }
Laurent@1345:         value "ns:SetSpecificValues($expression, $value_type, $execution_order)";
Laurent@1338:         call "add_instance" {
Laurent@1338:             with "type" > «$type»
Laurent@1338:         }
Laurent@1338:         apply "ppx:connectionPointIn" {
Laurent@1345:             with "negated", "@negatedIn";
Laurent@1345:             with "edge", "@edgeIn";
Laurent@1338:         }
Laurent@1338:         apply "ppx:connectionPointOut" {
Laurent@1345:             with "negated", "@negatedOut";
Laurent@1345:             with "edge", "@edgeOut";
Laurent@1338:         }
Laurent@1338:     }
Laurent@1338:     
Laurent@1338:     template "ppx:inVariable" {
Laurent@1338:         call "VariableBlockInfos" with "type", "'input'";
Laurent@1338:     }
Laurent@1338:     
Laurent@1338:     template "ppx:outVariable" {
Laurent@1338:         call "VariableBlockInfos" with "type", "'output'";
Laurent@1338:     }
Laurent@1338:     
Laurent@1338:     template "ppx:inOutVariable" {
Laurent@1338:         call "VariableBlockInfos" with "type", "'inout'";
Laurent@1338:     }
Laurent@1338:     
Laurent@1338:     template "ppx:connector|ppx:continuation" {
Laurent@1345:         value "ns:SetSpecificValues(@name)";
Laurent@1345:         call "add_instance" {
Laurent@1345:             with "type" > «local-name()»
Laurent@1338:         }
Laurent@1338:         apply "ppx:connectionPointIn";
Laurent@1338:         apply "ppx:connectionPointOut";
Laurent@1338:     }
Laurent@1338:     
Laurent@1338:     template "ppx:leftPowerRail|ppx:rightPowerRail" {
Laurent@1345:         variable "type", "local-name()";
Laurent@1338:         variable "connectors" {
Laurent@1338:             choose {
Laurent@1338:                 when "$type='leftPowerRail'" > «count(ppx:connectionPointOut)»
Laurent@1338:                 otherwise > «count(ppx:connectionPointIn)»
Laurent@1338:             }
Laurent@1338:         }
Laurent@1345:         value "ns:SetSpecificValues($connectors)";
Laurent@1338:         call "add_instance" {
Laurent@1338:             with "type" > «$type»
Laurent@1338:         }
Laurent@1338:         choose {
Laurent@1338:             when "$type='leftPowerRail'" {
Laurent@1338:                 apply "ppx:connectionPointOut";
Laurent@1338:             }
Laurent@1338:             otherwise {
Laurent@1338:                 apply "ppx:connectionPointIn";
Laurent@1338:             }
Laurent@1338:         }
Laurent@1338:     }
Laurent@1338:     
Laurent@1338:     template "ppx:contact|ppx:coil" {
Laurent@1345:         variable "type", "local-name()";
Laurent@1338:         variable "storage" {
Laurent@1338:             choose {
Laurent@1338:                 when "$type='coil'" > «@storage»
Laurent@1338:             }
Laurent@1338:         }
Laurent@1338:         variable "execution_order" {
Laurent@1338:             call "execution_order";
Laurent@1338:         }
Laurent@1345:         value "ns:SetSpecificValues(ppx:variable/text(), @negated, @edge, $storage, $execution_order)";
Laurent@1338:         call "add_instance" {
Laurent@1338:             with "type" > «$type»
Laurent@1338:         }
Laurent@1338:         apply "ppx:connectionPointIn";
Laurent@1338:         apply "ppx:connectionPointOut";
Laurent@1338:     }
Laurent@1338:     
Laurent@1338:     template "ppx:step" {
Laurent@1345:         value "ns:SetSpecificValues(@name, @initialStep)";
Laurent@1344:         apply "ppx:connectionPointOutAction" {
Laurent@1345:             with "negated", "@negated";
Laurent@1345:         }
Laurent@1345:         call "add_instance" {
Laurent@1345:             with "type" > «local-name()»
Laurent@1338:         }
Laurent@1338:         apply "ppx:connectionPointIn";
Laurent@1338:         apply "ppx:connectionPointOut";
Laurent@1338:     }
Laurent@1338:     
Laurent@1338:     template "ppx:transition" {
Laurent@1338:         variable "priority" {
Laurent@1338:             choose {
Laurent@1338:                 when "@priority" > «@priority»
Laurent@1338:                 otherwise > 0
Laurent@1338:             }
Laurent@1338:         }
Laurent@1338:         variable "condition_type" {
Laurent@1338:             choose {
Laurent@1338:                 when "ppx:condition/ppx:connectionPointIn" > connection
Laurent@1338:                 when "ppx:condition/ppx:reference" > reference
Laurent@1338:                 when "ppx:condition/ppx:inline" > inline
Laurent@1338:             }
Laurent@1338:         }
Laurent@1338:         variable "condition" {
Laurent@1338:             choose {
Laurent@1382:                 when "ppx:condition/ppx:reference" > «ppx:condition/ppx:reference/@name»
Laurent@1382:                 when "ppx:condition/ppx:inline" > «ppx:condition/ppx:inline/ppx:ST/xhtml:p/text()»
Laurent@1345:             }
Laurent@1345:         }
Laurent@1345:         value "ns:SetSpecificValues($priority, $condition_type, $condition)";
Laurent@1344:         apply "ppx:condition/ppx:connectionPointIn" {
Laurent@1345:             with "negated", "ppx:condition/@negated";
Laurent@1345:         }
Laurent@1345:         call "add_instance" {
Laurent@1345:             with "type" > «local-name()»
Laurent@1338:         }
Laurent@1338:         apply "ppx:connectionPointIn";
Laurent@1338:         apply "ppx:connectionPointOut";
Laurent@1338:     }
Laurent@1338:     
Laurent@1338:     template "ppx:selectionDivergence|ppx:selectionConvergence|ppx:simultaneousDivergence|ppx:simultaneousConvergence" {
Laurent@1338:         variable "type" > «local-name()»
Laurent@1338:         variable "connectors" {
Laurent@1338:             choose {
Laurent@1345:                 when "$type='selectionDivergence' or $type='simultaneousDivergence'" {
Laurent@1338:                     > «count(ppx:connectionPointOut)»
Laurent@1338:                 }
Laurent@1338:                 otherwise > «count(ppx:connectionPointIn)»
Laurent@1338:             }
Laurent@1338:         }
Laurent@1345:         value "ns:SetSpecificValues($connectors)";
Laurent@1338:         call "add_instance" {
Laurent@1338:             with "type" > «$type»
Laurent@1338:         }
Laurent@1338:         apply "ppx:connectionPointIn";
Laurent@1338:         apply "ppx:connectionPointOut";
Laurent@1338:     }
Laurent@1338:     
Laurent@1338:     template "ppx:jumpStep" {
Laurent@1338:         variable "type" > jump
Laurent@1345:         value "ns:SetSpecificValues(@targetName)";
Laurent@1338:         call "add_instance" {
Laurent@1338:             with "type" > «$type»
Laurent@1338:         }
Laurent@1338:         apply "ppx:connectionPointIn";
Laurent@1338:     }
Laurent@1338:     
Laurent@1338:     template "ppx:action" {
Laurent@1338:         variable "type" {
Laurent@1338:             choose {
Laurent@1338:                 when "ppx:reference" > reference
Laurent@1338:                 when "ppx:inline" > inline
Laurent@1338:             }
Laurent@1338:         }
Laurent@1338:         variable "value" {
Laurent@1338:             choose {
Laurent@1338:                 when "ppx:reference" > «ppx:reference/@name»
Laurent@1338:                 when "ppx:inline" > «ppx:inline/ppx:ST/xhtml:p/text()»
Laurent@1338:             }
Laurent@1338:         }
Laurent@1339:         variable "qualifier" {
Laurent@1339:             choose {
Laurent@1339:                 when "@qualifier" > «@qualifier»
Laurent@1339:                 otherwise > N
Laurent@1339:             }
Laurent@1339:         }
Laurent@1345:         value "ns:AddAction($qualifier, $type, $value, @duration, @indicator)";
Laurent@1338:     }
Laurent@1338:     
Laurent@1338:     template "ppx:actionBlock" {
Laurent@1345:         value "ns:SetSpecificValues()";
Laurent@1338:         apply "ppx:action";
Laurent@1338:         call "add_instance" {
Laurent@1345:             with "type" > «local-name()»
Laurent@1338:         }
Laurent@1344:         apply "ppx:connectionPointIn" {
Laurent@1345:             with "negated", "@negated";
Laurent@1344:         }
Laurent@1338:     }
edouard@1936: }