svghmi/hmi_tree.ysl2
branchsvghmi
changeset 2941 ef13a4007538
parent 2940 034b6ce4f885
child 3017 15e2df3e5610
equal deleted inserted replaced
2940:034b6ce4f885 2941:ef13a4007538
    11 const "categories", "exsl:node-set($_categories)";
    11 const "categories", "exsl:node-set($_categories)";
    12 
    12 
    13 // HMI Tree Index
    13 // HMI Tree Index
    14 const "_indexed_hmitree" apply "$hmitree", mode="index";
    14 const "_indexed_hmitree" apply "$hmitree", mode="index";
    15 const "indexed_hmitree", "exsl:node-set($_indexed_hmitree)";
    15 const "indexed_hmitree", "exsl:node-set($_indexed_hmitree)";
       
    16 
       
    17 emit "preamble:hmi-tree" {
       
    18     | var hmi_hash = [«$hmitree/@hash»];
       
    19     |
       
    20     | var heartbeat_index = «$indexed_hmitree/*[@hmipath = '/HEARTBEAT']/@index»;
       
    21     |
       
    22     | var hmitree_types = [
       
    23 
       
    24     foreach "$indexed_hmitree/*" 
       
    25     |     /* «@index»  «@hmipath» */ "«substring(local-name(), 5)»"`if "position()!=last()" > ,`
       
    26 
       
    27     | ]
       
    28     |
       
    29 }
    16 
    30 
    17 template "*", mode="index" {
    31 template "*", mode="index" {
    18     param "index", "0";
    32     param "index", "0";
    19     param "parentpath", "''";
    33     param "parentpath", "''";
    20     const "content" {
    34     const "content" {
   108 def "func:widget" {
   122 def "func:widget" {
   109     param "id";
   123     param "id";
   110     result "$parsed_widgets/widget[@id = $id]";
   124     result "$parsed_widgets/widget[@id = $id]";
   111 }
   125 }
   112 
   126 
   113 
       
   114 def "func:is_descendant_path" {
   127 def "func:is_descendant_path" {
   115     param "descend";
   128     param "descend";
   116     param "ancest";
   129     param "ancest";
   117     // TODO : use HMI tree to answer more accurately
   130     // TODO : use HMI tree to answer more accurately
   118     result "string-length($ancest) > 0 and starts-with($descend,$ancest)";
   131     result "string-length($ancest) > 0 and starts-with($descend,$ancest)";
   134     > \n
   147     > \n
   135     apply "*", mode="testtree" {
   148     apply "*", mode="testtree" {
   136         with "indent" value "concat($indent,'>')"
   149         with "indent" value "concat($indent,'>')"
   137     };
   150     };
   138 }
   151 }
       
   152 
   139 emit "debug:hmi-tree" {
   153 emit "debug:hmi-tree" {
   140     | Raw HMI tree
   154     | Raw HMI tree
   141     apply "$hmitree", mode="testtree";
   155     apply "$hmitree", mode="testtree";
   142     |
   156     |
   143     | Indexed HMI tree
   157     | Indexed HMI tree