# HG changeset patch # User Edouard Tisserant # Date 1651739476 -7200 # Node ID a0bd2c4cb8f7688cae5bdd327e9c8dc357a81461 # Parent 302efcf746e0fcc089dc3630a1570cf5d865cd51 SVGHMI: allow designating widget's sub-elements as main element child rather than descendant. Names staring with "/" in yslt call to labels() only match direct widget childs. diff -r 302efcf746e0 -r a0bd2c4cb8f7 svghmi/widgets_common.ysl2 --- a/svghmi/widgets_common.ysl2 Thu May 05 10:24:56 2022 +0200 +++ b/svghmi/widgets_common.ysl2 Thu May 05 10:31:16 2022 +0200 @@ -395,8 +395,10 @@ param "hmi_element"; const "widget_type","@type"; foreach "str:split($labels)" { - const "name","."; - const "elt","$result_widgets[@id = $hmi_element/@id]//*[@inkscape:label=$name][1]"; + const "absolute", "starts-with(., '/')"; + const "name","substring(.,number($absolute)+1)"; + const "widget","$result_widgets[@id = $hmi_element/@id]"; + const "elt","($widget//*[not($absolute) and @inkscape:label=$name] | $widget/*[$absolute and @inkscape:label=$name])[1]"; choose { when "not($elt/@id)" { if "$mandatory='yes'" {