Laurent@1338: include yslt.yml2 Laurent@1338: estylesheet xmlns:ppx="http://www.plcopen.org/xml/tc6_0201" Laurent@1338: xmlns:xhtml="http://www.w3.org/1999/xhtml" Laurent@1338: xmlns:ns="pou_block_instances_ns" Laurent@1338: extension-element-prefixes="ns" Laurent@1338: exclude-result-prefixes="ns" { Laurent@1338: Laurent@1338: template "text()"; Laurent@1338: Laurent@1338: template "ppx:pou" { 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@1338: variable "instance" { Laurent@1338: > «ns:AddBlockInstance($type, @localId, ppx:position/@x, ppx:position/@y, @width, @height)» Laurent@1338: } 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@1338: param "modifiers"; Laurent@1338: param "formalParameter"; Laurent@1338: variable "negated" { Laurent@1338: choose { Laurent@1338: when "$modifiers='input'" > «@negatedIn» Laurent@1338: when "$modifiers='output'" > «@negatedOut» Laurent@1338: otherwise > «@negated» Laurent@1338: } Laurent@1338: } Laurent@1338: variable "edge" { Laurent@1338: choose { Laurent@1338: when "$modifiers='input'" > «@edgeIn» Laurent@1338: when "$modifiers='output'" > «@edgeOut» Laurent@1338: otherwise > «@edge» Laurent@1338: } Laurent@1338: } Laurent@1338: variable "instance_connection" { Laurent@1338: > «ns:AddInstanceConnection($type, $formalParameter, $negated, $edge, ppx:relPosition/@x, ppx:relPosition/@y)» Laurent@1338: } Laurent@1338: } Laurent@1338: Laurent@1338: template "ppx:position" { Laurent@1338: variable "link_point" { Laurent@1338: > «ns:AddLinkPoint(@x, @y)» Laurent@1338: } Laurent@1338: } Laurent@1338: Laurent@1338: template "ppx:connection" { Laurent@1338: variable "connection_link" { Laurent@1338: > «ns:AddConnectionLink(@refLocalId, @formalParameter)» Laurent@1338: } Laurent@1338: apply "ppx:position"; Laurent@1338: } Laurent@1338: Laurent@1338: template "ppx:connectionPointIn" { Laurent@1338: param "modifiers"; Laurent@1338: param "formalParameter"; Laurent@1338: call "ConnectionInfos" { Laurent@1338: with "type" > input Laurent@1338: with "modifiers" > «$modifiers» Laurent@1338: with "formalParameter" > «$formalParameter» Laurent@1338: } Laurent@1338: apply "ppx:connection"; Laurent@1338: } Laurent@1338: Laurent@1338: template "ppx:connectionPointOut" { Laurent@1338: param "modifiers"; Laurent@1338: param "formalParameter"; Laurent@1338: call "ConnectionInfos" { Laurent@1338: with "type" > output Laurent@1338: with "modifiers" > «$modifiers» 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@1338: variable "type" > «local-name()» Laurent@1338: variable "instance_specific_values" { Laurent@1338: > «ns:SetSpecificValues(ppx:content/xhtml:p/text())» Laurent@1338: } Laurent@1338: call "add_instance" { Laurent@1338: with "type" > «$type» Laurent@1338: } Laurent@1338: } Laurent@1338: Laurent@1338: template "ppx:block" { Laurent@1338: variable "execution_order" { Laurent@1338: call "execution_order"; Laurent@1338: } Laurent@1338: variable "instance_specific_values" { Laurent@1338: > «ns:SetSpecificValues(@instanceName, $execution_order)» Laurent@1338: } 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@1338: with "formalParameter" > «@formalParameter» Laurent@1338: } Laurent@1338: } Laurent@1338: foreach "ppx:outputVariables/ppx:variable" { Laurent@1338: apply "ppx:connectionPointOut" { Laurent@1338: 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@1338: variable "instance_specific_values" { Laurent@1338: > «ns:SetSpecificValues($expression, $value_type, $execution_order)» Laurent@1338: } Laurent@1338: call "add_instance" { Laurent@1338: with "type" > «$type» Laurent@1338: } Laurent@1338: apply "ppx:connectionPointIn" { Laurent@1338: with "modifiers" { Laurent@1338: choose { Laurent@1338: when "$type='inout'" > input Laurent@1338: otherwise > Laurent@1338: } Laurent@1338: } Laurent@1338: } Laurent@1338: apply "ppx:connectionPointOut" { Laurent@1338: with "modifiers" { Laurent@1338: choose { Laurent@1338: when "$type='inout'" > output Laurent@1338: otherwise > Laurent@1338: } Laurent@1338: } 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@1338: variable "type" > «local-name()» Laurent@1338: variable "instance_specific_values" { Laurent@1338: > «ns:SetSpecificValues(@name)» Laurent@1338: } 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:leftPowerRail|ppx:rightPowerRail" { Laurent@1338: 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@1338: variable "instance_specific_values" { Laurent@1338: > «ns:SetSpecificValues($connectors)» Laurent@1338: } 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@1338: variable "type" > «local-name()» Laurent@1338: variable "storage" { Laurent@1338: choose { Laurent@1338: when "$type='coil'" > «@storage» Laurent@1338: otherwise > Laurent@1338: } Laurent@1338: } Laurent@1338: variable "execution_order" { Laurent@1338: call "execution_order"; Laurent@1338: } Laurent@1338: variable "instance_specific_values" { Laurent@1338: > «ns:SetSpecificValues(ppx:variable/text(), @negated, @edge, $storage, $execution_order)» Laurent@1338: } 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@1338: variable "type" > «local-name()» Laurent@1338: variable "instance_specific_values" { Laurent@1338: > «ns:SetSpecificValues(@name, @initialStep)» Laurent@1338: } Laurent@1338: apply "ppx:connectionPointOutAction"; 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:transition" { Laurent@1338: variable "type" > «local-name()» 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: otherwise > Laurent@1338: } Laurent@1338: } Laurent@1338: variable "condition" { Laurent@1338: choose { Laurent@1338: when "ppx:reference" > «ppx:condition/ppx:reference/@name» Laurent@1338: when "ppx:inline" > «ppx:condition/ppx:inline/ppx:body/ppx:ST/xhtml:p/text()» Laurent@1338: otherwise > Laurent@1338: } Laurent@1338: } Laurent@1338: variable "instance_specific_values" { Laurent@1338: > «ns:SetSpecificValues($priority, $condition_type, $condition)» Laurent@1338: } Laurent@1338: apply "ppx:condition/ppx:connectionPointIn"; 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:selectionDivergence|ppx:selectionConvergence|ppx:simultaneousDivergence|ppx:simultaneousConvergence" { Laurent@1338: variable "type" > «local-name()» Laurent@1338: variable "connectors" { Laurent@1338: choose { Laurent@1338: when "ppx:selectionDivergence|ppx:simultaneousDivergence" { Laurent@1338: > «count(ppx:connectionPointOut)» Laurent@1338: } Laurent@1338: otherwise > «count(ppx:connectionPointIn)» Laurent@1338: } Laurent@1338: } Laurent@1338: variable "instance_specific_values" { Laurent@1338: > «ns:SetSpecificValues($connectors)» Laurent@1338: } 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@1338: variable "instance_specific_values" { Laurent@1338: > «ns:SetSpecificValues(@targetName)» Laurent@1338: } 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: otherwise > 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: otherwise > Laurent@1338: } Laurent@1338: } Laurent@1338: variable "actionBlock_action" { Laurent@1338: > «ns:AddAction(@qualifier, $type, $value, @duration, @indicator)» Laurent@1338: } Laurent@1338: } Laurent@1338: Laurent@1338: template "ppx:actionBlock" { Laurent@1338: variable "type" > «local-name()» Laurent@1338: variable "instance_specific_values" { Laurent@1338: > «ns:SetSpecificValues()» Laurent@1338: } Laurent@1338: apply "ppx:action"; Laurent@1338: call "add_instance" { Laurent@1338: with "type" > «$type» Laurent@1338: } Laurent@1338: apply "ppx:connectionPointIn"; Laurent@1338: } Laurent@1338: }