include yslt_noindent.yml2
istylesheet xmlns:ppx="http://www.plcopen.org/xml/tc6_0201"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
extension-element-prefixes="ns"
exclude-result-prefixes="ns" {
template "ppx:pou[ppx:body]|ppx:transition[ppx:body]|ppx:action[ppx:body]" {
apply "ppx:body/*[self::ppx:FBD or self::ppx:LD or self::ppx:SFC]/*";
function "add_instance" {
value "ns:AddBlockInstance($type, @localId, ppx:position/@x, ppx:position/@y, @width, @height)";
function "execution_order" {
when "@executionOrderId" > «@executionOrderId»
function "ConnectionInfos" {
value "ns:AddInstanceConnection($type, $formalParameter, $negated, $edge, ppx:relPosition/@x, ppx:relPosition/@y)";
template "ppx:position" {
value "ns:AddLinkPoint(@x, @y)";
template "ppx:connection" {
value "ns:AddConnectionLink(@refLocalId, @formalParameter)";
template "ppx:connectionPointIn" {
with "negated" > «$negated»
with "formalParameter" > «$formalParameter»
template "ppx:connectionPointOut" {
with "negated" > «$negated»
with "formalParameter" > «$formalParameter»
template "ppx:connectionPointOutAction" {
value "ns:SetSpecificValues(ppx:content/xhtml:p/text())";
with "type" > «local-name()»
variable "execution_order" {
value "ns:SetSpecificValues(@instanceName, $execution_order)";
with "type" > «@typeName»
foreach "ppx:inputVariables/ppx:variable" {
apply "ppx:connectionPointIn" {
with "negated", "@negated";
with "formalParameter", "@formalParameter";
foreach "ppx:outputVariables/ppx:variable" {
apply "ppx:connectionPointOut" {
with "negated", "@negated";
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" {
value "ns:SetSpecificValues($expression, $value_type, $execution_order)";
apply "ppx:connectionPointIn" {
with "negated", "@negatedIn";
apply "ppx:connectionPointOut" {
with "negated", "@negatedOut";
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" {
value "ns:SetSpecificValues(@name)";
with "type" > «local-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)»
value "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" {
value "ns:SetSpecificValues(ppx:variable/text(), @negated, @edge, $storage, $execution_order)";
apply "ppx:connectionPointIn";
apply "ppx:connectionPointOut";
value "ns:SetSpecificValues(@name, @initialStep)";
apply "ppx:connectionPointOutAction" {
with "negated", "@negated";
with "type" > «local-name()»
apply "ppx:connectionPointIn";
apply "ppx:connectionPointOut";
template "ppx:transition" {
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:condition/ppx:reference" > «ppx:condition/ppx:reference/@name»
when "ppx:condition/ppx:inline" > «ppx:condition/ppx:inline/ppx:ST/xhtml:p/text()»
value "ns:SetSpecificValues($priority, $condition_type, $condition)";
apply "ppx:condition/ppx:connectionPointIn" {
with "negated", "ppx:condition/@negated";
with "type" > «local-name()»
apply "ppx:connectionPointIn";
apply "ppx:connectionPointOut";
template "ppx:selectionDivergence|ppx:selectionConvergence|ppx:simultaneousDivergence|ppx:simultaneousConvergence" {
variable "type" > «local-name()»
when "$type='selectionDivergence' or $type='simultaneousDivergence'" {
> «count(ppx:connectionPointOut)»
otherwise > «count(ppx:connectionPointIn)»
value "ns:SetSpecificValues($connectors)";
apply "ppx:connectionPointIn";
apply "ppx:connectionPointOut";
template "ppx:jumpStep" {
value "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»
value "ns:AddAction($qualifier, $type, $value, @duration, @indicator)";
template "ppx:actionBlock" {
value "ns:SetSpecificValues()";
with "type" > «local-name()»
apply "ppx:connectionPointIn" {
with "negated", "@negated";