diff -r f398896b7ebf -r 6c82fad8be65 svghmi/hmi_tree.ysl2 --- a/svghmi/hmi_tree.ysl2 Wed Mar 18 12:06:50 2020 +0100 +++ b/svghmi/hmi_tree.ysl2 Thu Mar 19 09:31:07 2020 +0100 @@ -63,8 +63,8 @@ // path value="path2"; // } // -def "func:parselabel" { - param "label"; +template "*", mode="parselabel" { + const "label","@inkscape:label"; const "description", "substring-after($label,'HMI:')"; const "_args", "substring-before($description,'@')"; @@ -79,7 +79,8 @@ otherwise value "$args"; } - const "ast" if "$type" widget { + if "$type" widget { + attrib "id" > «@id» attrib "type" > «$type» foreach "str:split(substring-after($args, ':'), ':')" { arg { @@ -97,22 +98,17 @@ } } } - - result "exsl:node-set($ast)"; } -def "func:parselabels" { - param "nodes"; - choose{ - when "$nodes"{ - result """func:parselabel($nodes[1]/@inkscape:label) - | func:parselabels($nodes[position()!=1])"""; - }otherwise{ - result "/.."; - } - } +const "_parsed_widgets" apply "$hmi_elements", mode="parselabel"; +const "parsed_widgets","exsl:node-set($_parsed_widgets)"; + +def "func:widget" { + param "id"; + result "$parsed_widgets/widget[@id = $id]"; } + // Debug data template "*", mode="testtree"{ param "indent", "''"; @@ -129,5 +125,9 @@ | | Indexed HMI tree apply "$indexed_hmitree", mode="testtree"; + | + | Parsed Widgets + copy "_parsed_widgets"; + apply "$parsed_widgets", mode="testtree"; } !debug_output_calls.append("debug_hmitree")