svghmi/hmi_tree.ysl2
branchsvghmi
changeset 2873 022db76c3bff
parent 2872 83adf8859c55
child 2874 b67af0b8dc72
equal deleted inserted replaced
2872:83adf8859c55 2873:022db76c3bff
       
     1 // hmi_tree.ysl2
       
     2 
       
     3 
       
     4 // HMI Tree computed from VARIABLES.CSV in svghmi.py
       
     5 const "hmitree", "ns:GetHMITree()";
       
     6 
       
     7 
       
     8 // HMI Tree Index
       
     9 const "_indexed_hmitree" apply "$hmitree", mode="index";
       
    10 const "indexed_hmitree", "exsl:node-set($_indexed_hmitree)";
       
    11 
       
    12 template "*", mode="index" {
       
    13     param "index", "0";
       
    14     param "parentpath", "''";
       
    15     const "content" {
       
    16         const "path"
       
    17             choose {
       
    18                 when "local-name() = 'HMI_ROOT'" > «$parentpath»
       
    19                 otherwise > «$parentpath»/«@name»
       
    20             }
       
    21         choose {
       
    22             when "not(local-name() = $categories/noindex)" {
       
    23                 xsl:copy {
       
    24                     attrib "index" > «$index»
       
    25                     attrib "hmipath" > «$path»
       
    26                     foreach "@*" xsl:copy;
       
    27                 }
       
    28                 apply "*[1]", mode="index"{
       
    29                      with "index", "$index + 1";
       
    30                      with "parentpath" > «$path»
       
    31                 }
       
    32             }
       
    33             otherwise {
       
    34                 apply "*[1]", mode="index"{
       
    35                     with "index", "$index";
       
    36                     with "parentpath" > «$path»
       
    37                 }
       
    38             }
       
    39         }
       
    40     }
       
    41 
       
    42     copy "$content";
       
    43     apply "following-sibling::*[1]", mode="index" {
       
    44         with "index", "$index + count(exsl:node-set($content)/*)";
       
    45         with "parentpath" > «$parentpath»
       
    46     }
       
    47 }