estylesheet xmlns:ppx="http://www.plcopen.org/xml/tc6_0201"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:ns="pou_block_instances_ns"
extension-element-prefixes="ns"
exclude-result-prefixes="ns" {
apply "ppx:body/*[self::ppx:FBD or self::ppx:LD or self::ppx:SFC]/*";
function "add_instance" {
> «ns:AddBlockInstance($type, @localId, ppx:position/@x, ppx:position/@y, @width, @height)»
function "execution_order" {
when "@executionOrderId" > «@executionOrderId»
function "ConnectionInfos" {
when "$modifiers='input'" > «@negatedIn»
when "$modifiers='output'" > «@negatedOut»
when "$modifiers='input'" > «@edgeIn»
when "$modifiers='output'" > «@edgeOut»
variable "instance_connection" {
> «ns:AddInstanceConnection($type, $formalParameter, $negated, $edge, ppx:relPosition/@x, ppx:relPosition/@y)»
template "ppx:position" {
> «ns:AddLinkPoint(@x, @y)»
template "ppx:connection" {
variable "connection_link" {
> «ns:AddConnectionLink(@refLocalId, @formalParameter)»
template "ppx:connectionPointIn" {
with "modifiers" > «$modifiers»
with "formalParameter" > «$formalParameter»
template "ppx:connectionPointOut" {
with "modifiers" > «$modifiers»
with "formalParameter" > «$formalParameter»
template "ppx:connectionPointOutAction" {
variable "type" > «local-name()»
variable "instance_specific_values" {
> «ns:SetSpecificValues(ppx:content/xhtml:p/text())»
variable "execution_order" {
variable "instance_specific_values" {
> «ns:SetSpecificValues(@instanceName, $execution_order)»
with "type" > «@typeName»
foreach "ppx:inputVariables/ppx:variable" {
apply "ppx:connectionPointIn" {
with "formalParameter" > «@formalParameter»
foreach "ppx:outputVariables/ppx:variable" {
apply "ppx:connectionPointOut" {
with "formalParameter" > «@formalParameter»
template "*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:derived" {
template "*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:string" {
template "*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/ppx:wstring" {
template "*[self::ppx:type or self::ppx:baseType or self::ppx:returnType]/*" {
function "VariableBlockInfos" {
variable "expression" > «ppx:expression/text()»
when "ancestor::ppx:transition[@name=$expression]" > BOOL
when "ancestor::ppx:pou[@name=$expression]" {
apply "ancestor::ppx:pou/child::ppx:interface/ppx:returnType"
apply "ancestor::ppx:pou/child::ppx:interface/*/ppx:variable[@name=$expression]/ppx:type"
variable "execution_order" {
variable "instance_specific_values" {
> «ns:SetSpecificValues($expression, $value_type, $execution_order)»
apply "ppx:connectionPointIn" {
when "$type='inout'" > input
apply "ppx:connectionPointOut" {
when "$type='inout'" > output
template "ppx:inVariable" {
call "VariableBlockInfos" with "type", "'input'";
template "ppx:outVariable" {
call "VariableBlockInfos" with "type", "'output'";
template "ppx:inOutVariable" {
call "VariableBlockInfos" with "type", "'inout'";
template "ppx:connector|ppx:continuation" {
variable "type" > «local-name()»
variable "instance_specific_values" {
> «ns:SetSpecificValues(@name)»
apply "ppx:connectionPointIn";
apply "ppx:connectionPointOut";
template "ppx:leftPowerRail|ppx:rightPowerRail" {
variable "type" > «local-name()»
when "$type='leftPowerRail'" > «count(ppx:connectionPointOut)»
otherwise > «count(ppx:connectionPointIn)»
variable "instance_specific_values" {
> «ns:SetSpecificValues($connectors)»
when "$type='leftPowerRail'" {
apply "ppx:connectionPointOut";
apply "ppx:connectionPointIn";
template "ppx:contact|ppx:coil" {
variable "type" > «local-name()»
when "$type='coil'" > «@storage»
variable "execution_order" {
variable "instance_specific_values" {
> «ns:SetSpecificValues(ppx:variable/text(), @negated, @edge, $storage, $execution_order)»
apply "ppx:connectionPointIn";
apply "ppx:connectionPointOut";
variable "type" > «local-name()»
variable "instance_specific_values" {
> «ns:SetSpecificValues(@name, @initialStep)»
apply "ppx:connectionPointOutAction";
apply "ppx:connectionPointIn";
apply "ppx:connectionPointOut";
template "ppx:transition" {
variable "type" > «local-name()»
when "@priority" > «@priority»
variable "condition_type" {
when "ppx:condition/ppx:connectionPointIn" > connection
when "ppx:condition/ppx:reference" > reference
when "ppx:condition/ppx:inline" > inline
when "ppx:reference" > «ppx:condition/ppx:reference/@name»
when "ppx:inline" > «ppx:condition/ppx:inline/ppx:body/ppx:ST/xhtml:p/text()»
variable "instance_specific_values" {
> «ns:SetSpecificValues($priority, $condition_type, $condition)»
apply "ppx:condition/ppx:connectionPointIn";
apply "ppx:connectionPointIn";
apply "ppx:connectionPointOut";
template "ppx:selectionDivergence|ppx:selectionConvergence|ppx:simultaneousDivergence|ppx:simultaneousConvergence" {
variable "type" > «local-name()»
when "ppx:selectionDivergence|ppx:simultaneousDivergence" {
> «count(ppx:connectionPointOut)»
otherwise > «count(ppx:connectionPointIn)»
variable "instance_specific_values" {
> «ns:SetSpecificValues($connectors)»
apply "ppx:connectionPointIn";
apply "ppx:connectionPointOut";
template "ppx:jumpStep" {
variable "instance_specific_values" {
> «ns:SetSpecificValues(@targetName)»
apply "ppx:connectionPointIn";
when "ppx:reference" > reference
when "ppx:inline" > inline
when "ppx:reference" > «ppx:reference/@name»
when "ppx:inline" > «ppx:inline/ppx:ST/xhtml:p/text()»
when "@qualifier" > «@qualifier»
variable "actionBlock_action" {
> «ns:AddAction($qualifier, $type, $value, @duration, @indicator)»
template "ppx:actionBlock" {
variable "type" > «local-name()»
variable "instance_specific_values" {
> «ns:SetSpecificValues()»
apply "ppx:connectionPointIn";