plcopen/instances_path.ysl2
author Andrey Skvortsov <andrej.skvortzov@gmail.com>
Wed, 11 Jan 2017 12:57:40 +0300
changeset 1624 bc84d659894f
parent 1352 9ec4ac8e2955
child 1936 b85b13b1c2ec
permissions -rw-r--r--
move code in mki18n.py generated translation strings from custom files into separate function
1350
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
     1
include yslt.yml2
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
     2
estylesheet xmlns:ppx="http://www.plcopen.org/xml/tc6_0201"
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
     3
            xmlns:xhtml="http://www.w3.org/1999/xhtml"
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
     4
            xmlns:ns="instances_ns" 
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
    
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    12
    variable "project" {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    13
        copy "document('project')/project/*";
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    14
    }
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    15
    
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    16
    variable "stdlib" {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    17
        copy "document('stdlib')/stdlib/*";
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    18
    }
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    19
    variable "extensions" {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    20
        copy "document('extensions')/extensions/*";
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    21
    }
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
    template "ppx:project" {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    24
        instances {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    25
            apply "ppx:instances/ppx:configurations/ppx:configuration";
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    26
        }
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
    template "ppx:configuration" {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    30
        apply "ppx:globalVars/ppx:variable[ppx:type/ppx:derived] | ppx:resource" {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    31
            with "parent_path" > «@name»
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    32
        }
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    33
    }
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    34
    
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    35
    template "ppx:resource" {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    36
        param "parent_path";
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    37
        variable "resource_path" > «$parent_path».«@name»
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    38
        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
    39
            with "parent_path" > «$resource_path»
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    40
        }
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    41
    }
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    42
    
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    43
    template "ppx:pouInstance" {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    44
        param "parent_path";
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    45
        variable "pou_instance_path" > «$parent_path».«@name»
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    46
        choose {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    47
            when "@typeName=$instance_type" {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    48
                value "ns:AddInstance($pou_instance_path)";
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    49
            }
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    50
            otherwise {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    51
                variable "type_name" > «@typeName»
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    52
                apply """exsl:node-set($project)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name] |
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    53
                         exsl:node-set($project)/ppx:project/ppx:types/ppx:dataTypes/ppx:dataType[@name=$type_name] |
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    54
                         exsl:node-set($stdlib)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name] |
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    55
                         exsl:node-set($stdlib)/ppx:project/ppx:types/ppx:dataTypes/ppx:dataType[@name=$type_name] |
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    56
                         exsl:node-set($extensions)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name] |
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    57
                         exsl:node-set($extensions)/ppx:project/ppx:types/ppx:dataTypes/ppx:dataType[@name=$type_name]""" {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    58
                    with "instance_path" > «$pou_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
    }
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    63
    
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    64
    template "ppx:pou" {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    65
        param "instance_path";
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    66
        apply "ppx:interface/*/ppx:variable[ppx:type/ppx:derived]" {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    67
            with "parent_path" > «$instance_path»
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
    }
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    70
    
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    71
    template "ppx:dataType" {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    72
        param "instance_path";
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    73
        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
    74
            with "parent_path" > «$instance_path»
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
    
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    78
    template "ppx:variable" {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    79
        param "parent_path";
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    80
        variable "variable_path" > «$parent_path».«@name»
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    81
        apply "ppx:type/ppx:derived" {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    82
            with "variable_path" > «$variable_path»
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    83
        }
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    84
    }
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    85
    
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    86
    template "ppx:derived" {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    87
        param "variable_path";
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    88
        choose {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    89
            when "@name=$instance_type" {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    90
                value "ns:AddInstance($variable_path)";
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
            otherwise {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    93
                variable "type_name" > «@name»
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    94
                apply """exsl:node-set($project)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name] |
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    95
                         exsl:node-set($project)/ppx:project/ppx:types/ppx:dataTypes/ppx:dataType[@name=$type_name] |
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    96
                         exsl:node-set($stdlib)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name] |
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    97
                         exsl:node-set($stdlib)/ppx:project/ppx:types/ppx:dataTypes/ppx:dataType[@name=$type_name] |
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    98
                         exsl:node-set($extensions)/ppx:project/ppx:types/ppx:pous/ppx:pou[@name=$type_name] |
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
    99
                         exsl:node-set($extensions)/ppx:project/ppx:types/ppx:dataTypes/ppx:dataType[@name=$type_name]""" {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
   100
                    with "instance_path" > «$variable_path»
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
        }
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
   104
    }
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
   105
    
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
   106
    template "ppx:struct" {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
   107
        param "variable_path";
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
   108
        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
   109
            variable "element_path" > «$variable_path».«@name»
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
   110
        }
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
   111
        apply "ppx:type/*[self::ppx:derived or self::ppx:struct or self::ppx:array]" {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
   112
            with "variable_path" > «$element_path»
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
   113
        }
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
   114
    }
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
   115
    
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
   116
    template "ppx:array" {
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
   117
        param "variable_path";
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
   118
        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
   119
            with "variable_path" > «$variable_path»
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
   120
        }
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
   121
    }
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
   122
    
7280349a3375 Fixed pou instance path list computing stylesheet
Laurent Bessard
parents:
diff changeset
   123
}