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.
--- 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'" {