plcopen/pou_variables.ysl2
changeset 1943 9dc0e38552b2
parent 1936 b85b13b1c2ec
child 1945 90bf6bd94b94
equal deleted inserted replaced
1942:a4382ae1ba82 1943:9dc0e38552b2
     1 include yslt_noindent.yml2
     1 include yslt_noindent.yml2
     2 istylesheet xmlns:ppx="http://www.plcopen.org/xml/tc6_0201"
     2 istylesheet xmlns:ppx="http://www.plcopen.org/xml/tc6_0201"
     3             xmlns:xhtml="http://www.w3.org/1999/xhtml"
     3             xmlns:xhtml="http://www.w3.org/1999/xhtml"
     4             xmlns:ns="pou_vars_ns" 
     4             xmlns:ns="beremiz" 
     5             extension-element-prefixes="ns" 
     5             extension-element-prefixes="ns" 
     6             exclude-result-prefixes="ns" {
     6             exclude-result-prefixes="ns" {
     7     
     7     
     8     template "text()";
     8     template "text()";
     9     template "text()", mode="var_class";
     9     template "text()", mode="var_class";
    10     template "text()", mode="var_type";
    10     template "text()", mode="var_type";
    11     template "text()", mode="var_edit";
    11     template "text()", mode="var_edit";
    12     template "text()", mode="var_debug";
    12     template "text()", mode="var_debug";
    13     
    13     
    14     variable "project" {
    14     variable "project", "ns:GetProject()";
    15         copy "document('project')/project/*";
    15     
    16     }
    16     variable "stdlib", "ns:GetStdLibs()";
    17     
    17 
    18     variable "stdlib" {
    18     variable "extensions", "ns:GetExtensions()";
    19         copy "document('stdlib')/stdlib/*";
       
    20     }
       
    21     variable "extensions" {
       
    22         copy "document('extensions')/extensions/*";
       
    23     }
       
    24     
    19     
    25     function "add_root" {
    20     function "add_root" {
    26         param "class";
    21         param "class";
    27         param "type";
    22         param "type";
    28         param "edit" > true
    23         param "edit" > true
   174     }
   169     }
   175     
   170     
   176     template "*[self::ppx:type or self::ppx:baseType]/ppx:derived", mode="var_class" {
   171     template "*[self::ppx:type or self::ppx:baseType]/ppx:derived", mode="var_class" {
   177         param "default_class";
   172         param "default_class";
   178         variable "type_name", "@name";
   173         variable "type_name", "@name";
   179         variable "pou_infos" {
   174         variable "pou_infos", "($project|$stdlib|$extensions)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name]";
   180             copy """exsl:node-set($project)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name] |
       
   181                     exsl:node-set($stdlib)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name] |
       
   182                     exsl:node-set($extensions)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name]""";
       
   183         }
       
   184         choose {
   175         choose {
   185             when "$pou_infos != ''" {
   176             when "$pou_infos" {
   186                 apply "exsl:node-set($pou_infos)", mode="var_class";
   177                 apply "$pou_infos", mode="var_class";
   187             }
   178             }
   188             otherwise {
   179             otherwise {
   189                 value "$default_class"
   180                 value "$default_class"
   190             }
   181             }
   191         }
   182         }
   225         > «local-name()»
   216         > «local-name()»
   226     }
   217     }
   227     
   218     
   228     template "*[self::ppx:type or self::ppx:baseType]/ppx:derived", mode="var_edit" {
   219     template "*[self::ppx:type or self::ppx:baseType]/ppx:derived", mode="var_edit" {
   229         variable "type_name", "@name";
   220         variable "type_name", "@name";
   230         variable "pou_infos" {
   221         variable "pou_infos", "$project/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name]";
   231             copy "exsl:node-set($project)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name]";
       
   232         }
       
   233         choose {
   222         choose {
   234             when "$pou_infos != ''" > true
   223             when "$pou_infos" > true
   235             otherwise > false
   224             otherwise > false
   236         }
   225         }
   237     }
   226     }
   238     
   227     
   239     template "*[self::ppx:type or self::ppx:baseType]/ppx:array", mode="var_edit" {
   228     template "*[self::ppx:type or self::ppx:baseType]/ppx:array", mode="var_edit" {
   244         > false
   233         > false
   245     }
   234     }
   246     
   235     
   247     template "*[self::ppx:type or self::ppx:baseType]/ppx:derived", mode="var_debug" {
   236     template "*[self::ppx:type or self::ppx:baseType]/ppx:derived", mode="var_debug" {
   248         variable "type_name", "@name";
   237         variable "type_name", "@name";
   249         variable "datatype_infos" {
   238         variable "datatype_infos", "($project|$stdlib|$extensions)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name]";
   250             copy """exsl:node-set($project)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name] |
       
   251                     exsl:node-set($project)/ppx:project/ppx:types/ppx:dataTypes/ppx:dataType[@name=$type_name] |
       
   252                     exsl:node-set($stdlib)/ppx:project/ppx:types/ppx:dataTypes/ppx:dataType[@name=$type_name] |
       
   253                     exsl:node-set($extensions)/ppx:project/ppx:types/ppx:dataTypes/ppx:dataType[@name=$type_name]""";
       
   254         }
       
   255         choose {
   239         choose {
   256             when "$datatype_infos != ''" {
   240             when "$datatype_infos != ''" {
   257                 apply "exsl:node-set($datatype_infos)", mode="var_debug";
   241                 apply "$datatype_infos", mode="var_debug";
   258             }
   242             }
   259             otherwise > false
   243             otherwise > false
   260         }
   244         }
   261     }
   245     }
   262     
   246