Laurent@1350: include yslt.yml2 Laurent@1350: estylesheet xmlns:ppx="http://www.plcopen.org/xml/tc6_0201" Laurent@1350: xmlns:xhtml="http://www.w3.org/1999/xhtml" Laurent@1350: xmlns:ns="instances_ns" Laurent@1350: extension-element-prefixes="ns" Laurent@1350: exclude-result-prefixes="ns" { Laurent@1350: Laurent@1350: param "instance_type"; Laurent@1350: Laurent@1350: template "text()"; Laurent@1350: Laurent@1350: variable "project" { Laurent@1350: copy "document('project')/project/*"; Laurent@1350: } Laurent@1350: Laurent@1350: variable "stdlib" { Laurent@1350: copy "document('stdlib')/stdlib/*"; Laurent@1350: } Laurent@1350: variable "extensions" { Laurent@1350: copy "document('extensions')/extensions/*"; Laurent@1350: } Laurent@1350: Laurent@1350: template "ppx:project" { Laurent@1350: instances { Laurent@1350: apply "ppx:instances/ppx:configurations/ppx:configuration"; Laurent@1350: } Laurent@1350: } Laurent@1350: Laurent@1350: template "ppx:configuration" { Laurent@1350: apply "ppx:globalVars/ppx:variable[ppx:type/ppx:derived] | ppx:resource" { Laurent@1350: with "parent_path" > «@name» Laurent@1350: } Laurent@1350: } Laurent@1350: Laurent@1350: template "ppx:resource" { Laurent@1350: param "parent_path"; Laurent@1350: variable "resource_path" > «$parent_path».«@name» Laurent@1350: apply "ppx:globalVars/ppx:variable[ppx:type/ppx:derived] | ppx:pouInstance | ppx:task/ppx:pouInstance" { Laurent@1350: with "parent_path" > «$resource_path» Laurent@1350: } Laurent@1350: } Laurent@1350: Laurent@1350: template "ppx:pouInstance" { Laurent@1350: param "parent_path"; Laurent@1350: variable "pou_instance_path" > «$parent_path».«@name» Laurent@1350: choose { Laurent@1350: when "@typeName=$instance_type" { Laurent@1350: value "ns:AddInstance($pou_instance_path)"; Laurent@1350: } Laurent@1350: otherwise { Laurent@1350: variable "type_name" > «@typeName» Laurent@1350: apply """exsl:node-set($project)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name] | Laurent@1350: exsl:node-set($project)/ppx:project/ppx:types/ppx:dataTypes/ppx:dataType[@name=$type_name] | Laurent@1350: exsl:node-set($stdlib)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name] | Laurent@1350: exsl:node-set($stdlib)/ppx:project/ppx:types/ppx:dataTypes/ppx:dataType[@name=$type_name] | Laurent@1350: exsl:node-set($extensions)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name] | Laurent@1350: exsl:node-set($extensions)/ppx:project/ppx:types/ppx:dataTypes/ppx:dataType[@name=$type_name]""" { Laurent@1350: with "instance_path" > «$pou_instance_path» Laurent@1350: } Laurent@1350: } Laurent@1350: } Laurent@1350: } Laurent@1350: Laurent@1350: template "ppx:pou" { Laurent@1350: param "instance_path"; Laurent@1350: apply "ppx:interface/*/ppx:variable[ppx:type/ppx:derived]" { Laurent@1350: with "parent_path" > «$instance_path» Laurent@1350: } Laurent@1350: } Laurent@1350: Laurent@1350: template "ppx:dataType" { Laurent@1350: param "instance_path"; Laurent@1350: apply "ppx:baseType/*[self::ppx:derived or self::ppx:struct or self::ppx:array]" { Laurent@1350: with "parent_path" > «$instance_path» Laurent@1350: } Laurent@1350: } Laurent@1350: Laurent@1350: template "ppx:variable" { Laurent@1350: param "parent_path"; Laurent@1350: variable "variable_path" > «$parent_path».«@name» Laurent@1350: apply "ppx:type/ppx:derived" { Laurent@1350: with "variable_path" > «$variable_path» Laurent@1350: } Laurent@1350: } Laurent@1350: Laurent@1350: template "ppx:derived" { Laurent@1350: param "variable_path"; Laurent@1350: choose { Laurent@1350: when "@name=$instance_type" { Laurent@1350: value "ns:AddInstance($variable_path)"; Laurent@1350: } Laurent@1350: otherwise { Laurent@1350: variable "type_name" > «@name» Laurent@1350: apply """exsl:node-set($project)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name] | Laurent@1350: exsl:node-set($project)/ppx:project/ppx:types/ppx:dataTypes/ppx:dataType[@name=$type_name] | Laurent@1350: exsl:node-set($stdlib)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name] | Laurent@1350: exsl:node-set($stdlib)/ppx:project/ppx:types/ppx:dataTypes/ppx:dataType[@name=$type_name] | Laurent@1350: exsl:node-set($extensions)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name] | Laurent@1350: exsl:node-set($extensions)/ppx:project/ppx:types/ppx:dataTypes/ppx:dataType[@name=$type_name]""" { Laurent@1350: with "instance_path" > «$variable_path» Laurent@1350: } Laurent@1350: } Laurent@1350: } Laurent@1350: } Laurent@1350: Laurent@1350: template "ppx:struct" { Laurent@1350: param "variable_path"; Laurent@1350: foreach "ppx:variable[ppx:type/ppx:derived or ppx:type/ppx:struct or ppx:type/ppx:array]" { Laurent@1350: variable "element_path" > «$variable_path».«@name» Laurent@1350: } Laurent@1350: apply "ppx:type/*[self::ppx:derived or self::ppx:struct or self::ppx:array]" { Laurent@1350: with "variable_path" > «$element_path» Laurent@1350: } Laurent@1350: } Laurent@1350: Laurent@1350: template "ppx:array" { Laurent@1350: param "variable_path"; Laurent@1350: apply "ppx:baseType/*[self::ppx:derived or self::ppx:struct or self::ppx:array]" { Laurent@1350: with "variable_path" > «$variable_path» Laurent@1350: } Laurent@1350: } Laurent@1350: Laurent@1350: }