// HMI Tree computed from VARIABLES.CSV in svghmi.py
const "hmitree", "ns:GetHMITree()";
noindex > HMI_CURRENT_PAGE
const "categories", "exsl:node-set($_categories)";
const "_indexed_hmitree" apply "$hmitree", mode="index";
const "indexed_hmitree", "exsl:node-set($_indexed_hmitree)";
template "*", mode="index" {
param "parentpath", "''";
when "local-name() = 'HMI_ROOT'" > «$parentpath»
otherwise > «$parentpath»/«@name»
when "not(local-name() = $categories/noindex)" {
attrib "index" > «$index»
attrib "hmipath" > «$path»
apply "*[1]", mode="index"{
with "index", "$index + 1";
with "parentpath" > «$path»
apply "*[1]", mode="index"{
with "parentpath" > «$path»
apply "following-sibling::*[1]", mode="index" {
with "index", "$index + count(exsl:node-set($content)/*)";
with "parentpath" > «$parentpath»
const "description", "substring-after($label,'HMI:')";
const "_args", "substring-before($description,'@')";
when "$_args" value "$_args";
otherwise value "$description";
const "_type", "substring-before($args,':')";
when "$_type" value "$_type";
const "ast" if "$type" widget {
foreach "str:split(substring-after($args, ':'), ':')" {
const "paths", "substring-after($description,'@')";
foreach "str:split($paths, '@')" {
if "string-length(.) > 0" path {
const "item", "$indexed_hmitree/*[@hmipath = $path]";
attrib "index" > «$item/@index»
result "exsl:node-set($ast)";
template "*", mode="testtree"{
> «$indent» «local-name()»
foreach "@*" > «local-name()»="«.»"
apply "*", mode="testtree" {
with "indent" value "concat($indent,'>')"
function "debug_hmitree" {
apply "$hmitree", mode="testtree";
apply "$indexed_hmitree", mode="testtree";
!debug_output_calls.append("debug_hmitree")