plcopen/instances_path.ysl2
author Edouard Tisserant <edouard.tisserant@gmail.com>
Tue, 02 Mar 2021 09:42:50 +0100
branchsvghmi
changeset 3173 f85ecfa0916c
parent 2626 39d78c530cbb
permissions -rw-r--r--
IDE: Process Logging : Add annotation in log so that user can see build is still alive and how long external process takes.
1936
b85b13b1c2ec YSLT auto indent trick is useless here, added yslt_noindent.yml2, regenerated XSLT files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 1352
diff changeset
     1
include yslt_noindent.yml2
b85b13b1c2ec YSLT auto indent trick is useless here, added yslt_noindent.yml2, regenerated XSLT files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 1352
diff changeset
     2
istylesheet xmlns:ppx="http://www.plcopen.org/xml/tc6_0201"
1350
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
     3
            xmlns:xhtml="http://www.w3.org/1999/xhtml"
1939
db478d17bc3a Added a class to speedup all XSLT queries. WIP, now only for instances_path.xslt / GetInstanceList()
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 1938
diff changeset
     4
            xmlns:ns="beremiz" 
1350
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
     5
            extension-element-prefixes="ns" 
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
     6
            exclude-result-prefixes="ns" {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
     7
    
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
     8
    param "instance_type";
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
     9
    
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    10
    template "text()";
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    11
    
1937
986dbad48ab7 This should really help GetInstanceList to perform better: resolver removed, no more deepcopy, no more useless xml serialization, no more node-set() calls.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 1936
diff changeset
    12
    variable "project", "ns:GetProject()";
1350
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    13
    
1937
986dbad48ab7 This should really help GetInstanceList to perform better: resolver removed, no more deepcopy, no more useless xml serialization, no more node-set() calls.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 1936
diff changeset
    14
    variable "stdlib", "ns:GetStdLibs()";
986dbad48ab7 This should really help GetInstanceList to perform better: resolver removed, no more deepcopy, no more useless xml serialization, no more node-set() calls.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 1936
diff changeset
    15
986dbad48ab7 This should really help GetInstanceList to perform better: resolver removed, no more deepcopy, no more useless xml serialization, no more node-set() calls.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 1936
diff changeset
    16
    variable "extensions", "ns:GetExtensions()";
986dbad48ab7 This should really help GetInstanceList to perform better: resolver removed, no more deepcopy, no more useless xml serialization, no more node-set() calls.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 1936
diff changeset
    17
1949
c266fbaae0f6 Better writing of some xpath added in previous commits about XSLT optimization.
Edouard Tisserant
parents: 1946
diff changeset
    18
    variable "all_types", "($project | $stdlib | $extensions)/ppx:types";
1939
db478d17bc3a Added a class to speedup all XSLT queries. WIP, now only for instances_path.xslt / GetInstanceList()
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 1938
diff changeset
    19
1350
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    20
    template "ppx:project" {
1938
87136f8697e3 Stripped useless node creation in instances_path stylesheet.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 1937
diff changeset
    21
        apply "ppx:instances/ppx:configurations/ppx:configuration";
1350
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    22
    }
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    23
    
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    24
    template "ppx:configuration" {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    25
        apply "ppx:globalVars/ppx:variable[ppx:type/ppx:derived] | ppx:resource" {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    26
            with "parent_path" > «@name»
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    27
        }
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    28
    }
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    29
    
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    30
    template "ppx:resource" {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    31
        param "parent_path";
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    32
        variable "resource_path" > «$parent_path».«@name»
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    33
        apply "ppx:globalVars/ppx:variable[ppx:type/ppx:derived] | ppx:pouInstance | ppx:task/ppx:pouInstance" {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    34
            with "parent_path" > «$resource_path»
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    35
        }
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    36
    }
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    37
    
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    38
    template "ppx:pouInstance" {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    39
        param "parent_path";
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    40
        variable "pou_instance_path" > «$parent_path».«@name»
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    41
        choose {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    42
            when "@typeName=$instance_type" {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    43
                value "ns:AddInstance($pou_instance_path)";
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    44
            }
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    45
            otherwise {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    46
                variable "type_name" > «@typeName»
1949
c266fbaae0f6 Better writing of some xpath added in previous commits about XSLT optimization.
Edouard Tisserant
parents: 1946
diff changeset
    47
                apply """$all_types/ppx:pous/ppx:pou[@name=$type_name] | \
c266fbaae0f6 Better writing of some xpath added in previous commits about XSLT optimization.
Edouard Tisserant
parents: 1946
diff changeset
    48
                         $all_types/ppx:dataTypes/ppx:dataType[@name=$type_name]""" {
1350
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    49
                    with "instance_path" > «$pou_instance_path»
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    50
                }
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    51
            }
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    52
        }
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    53
    }
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    54
    
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    55
    template "ppx:pou" {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    56
        param "instance_path";
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    57
        apply "ppx:interface/*/ppx:variable[ppx:type/ppx:derived]" {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    58
            with "parent_path" > «$instance_path»
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    59
        }
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    60
    }
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    61
    
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    62
    template "ppx:dataType" {
2626
39d78c530cbb Fixed unitialized parameter in instances_path stylesheet, leading to
Edouard Tisserant
parents: 1949
diff changeset
    63
        param "instance_path","concat('#',@name)";
1350
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    64
        apply "ppx:baseType/*[self::ppx:derived or self::ppx:struct or self::ppx:array]" {
2626
39d78c530cbb Fixed unitialized parameter in instances_path stylesheet, leading to
Edouard Tisserant
parents: 1949
diff changeset
    65
            with "variable_path" > «$instance_path»
1350
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    66
        }
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    67
    }
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    68
    
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    69
    template "ppx:variable" {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    70
        param "parent_path";
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    71
        variable "variable_path" > «$parent_path».«@name»
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    72
        apply "ppx:type/ppx:derived" {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    73
            with "variable_path" > «$variable_path»
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    74
        }
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    75
    }
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    76
    
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    77
    template "ppx:derived" {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    78
        param "variable_path";
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    79
        choose {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    80
            when "@name=$instance_type" {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    81
                value "ns:AddInstance($variable_path)";
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    82
            }
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    83
            otherwise {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    84
                variable "type_name" > «@name»
1949
c266fbaae0f6 Better writing of some xpath added in previous commits about XSLT optimization.
Edouard Tisserant
parents: 1946
diff changeset
    85
                apply """$all_types/ppx:pous/ppx:pou[@name=$type_name] | \
c266fbaae0f6 Better writing of some xpath added in previous commits about XSLT optimization.
Edouard Tisserant
parents: 1946
diff changeset
    86
                         $all_types/ppx:dataTypes/ppx:dataType[@name=$type_name]""" {
1350
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    87
                    with "instance_path" > «$variable_path»
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    88
                }
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    89
            }
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    90
        }
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    91
    }
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    92
    
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    93
    template "ppx:struct" {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    94
        param "variable_path";
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    95
        foreach "ppx:variable[ppx:type/ppx:derived or ppx:type/ppx:struct or ppx:type/ppx:array]" {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    96
            variable "element_path" > «$variable_path».«@name»
2626
39d78c530cbb Fixed unitialized parameter in instances_path stylesheet, leading to
Edouard Tisserant
parents: 1949
diff changeset
    97
            apply "ppx:type/*[self::ppx:derived or self::ppx:struct or self::ppx:array]" {
39d78c530cbb Fixed unitialized parameter in instances_path stylesheet, leading to
Edouard Tisserant
parents: 1949
diff changeset
    98
                with "variable_path" > «$element_path»
39d78c530cbb Fixed unitialized parameter in instances_path stylesheet, leading to
Edouard Tisserant
parents: 1949
diff changeset
    99
            }
1350
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
   100
        }
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
   101
    }
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
   102
    
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
   103
    template "ppx:array" {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
   104
        param "variable_path";
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
   105
        apply "ppx:baseType/*[self::ppx:derived or self::ppx:struct or self::ppx:array]" {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
   106
            with "variable_path" > «$variable_path»
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
   107
        }
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
   108
    }
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
   109
    
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
   110
}