svghmi/hmi_tree.ysl2
changeset 4024 f9c6bbf66eea
parent 3579 c5070b6973ba
equal deleted inserted replaced
4023:b344393859df 4024:f9c6bbf66eea
     3 // Location identifies uniquely SVGHMI instance
     3 // Location identifies uniquely SVGHMI instance
     4 param "instance_name";
     4 param "instance_name";
     5 
     5 
     6 // HMI Tree computed from VARIABLES.CSV in svghmi.py
     6 // HMI Tree computed from VARIABLES.CSV in svghmi.py
     7 const "hmitree", "ns:GetHMITree()";
     7 const "hmitree", "ns:GetHMITree()";
     8 
       
     9 const "_categories" {
       
    10     noindex > HMI_PLC_STATUS
       
    11     noindex > HMI_CURRENT_PAGE
       
    12 }
       
    13 const "categories", "exsl:node-set($_categories)";
       
    14 
     8 
    15 // HMI Tree Index
     9 // HMI Tree Index
    16 const "_indexed_hmitree" apply "$hmitree", mode="index";
    10 const "_indexed_hmitree" apply "$hmitree", mode="index";
    17 const "indexed_hmitree", "exsl:node-set($_indexed_hmitree)";
    11 const "indexed_hmitree", "exsl:node-set($_indexed_hmitree)";
    18 
    12 
    47 
    41 
    48 template "*", mode="index" {
    42 template "*", mode="index" {
    49     param "index", "0";
    43     param "index", "0";
    50     param "parentpath", "''";
    44     param "parentpath", "''";
    51     const "content" {
    45     const "content" {
    52         const "path"
    46         const "path" choose {
    53             choose {
    47             when "count(ancestor::*)=0" > /
    54                 when "count(ancestor::*)=0" > /
    48             when "count(ancestor::*)=1" > /«@name»
    55                 when "count(ancestor::*)=1" > /«@name»
    49             otherwise > «$parentpath»/«@name»
    56                 otherwise > «$parentpath»/«@name»
    50         }
    57             }
    51         xsl:copy {
    58         choose {
    52             attrib "index" > «$index»
    59             when "not(local-name() = $categories/noindex)" {
    53             attrib "hmipath" > «$path»
    60                 xsl:copy {
    54             foreach "@*" xsl:copy;
    61                     attrib "index" > «$index»
    55         }
    62                     attrib "hmipath" > «$path»
    56         apply "*[1]", mode="index"{
    63                     foreach "@*" xsl:copy;
    57              with "index", "$index + 1";
    64                 }
    58              with "parentpath" > «$path»
    65                 apply "*[1]", mode="index"{
       
    66                      with "index", "$index + 1";
       
    67                      with "parentpath" > «$path»
       
    68                 }
       
    69             }
       
    70             otherwise {
       
    71                 apply "*[1]", mode="index"{
       
    72                     with "index", "$index";
       
    73                     with "parentpath" > «$path»
       
    74                 }
       
    75             }
       
    76         }
    59         }
    77     }
    60     }
    78 
    61 
    79     copy "$content";
    62     copy "$content";
    80     apply "following-sibling::*[1]", mode="index" {
    63     apply "following-sibling::*[1]", mode="index" {