svghmi/hmi_tree.ysl2
branchsvghmi
changeset 2894 4cf9ad35e6d0
parent 2893 d57a12b8f5db
child 2900 3ef217f525ff
--- a/svghmi/hmi_tree.ysl2	Mon Mar 23 15:13:36 2020 +0100
+++ b/svghmi/hmi_tree.ysl2	Mon Mar 23 21:44:28 2020 +0100
@@ -52,36 +52,6 @@
     }
 }
 
-def "func:get_hmi_tree_elt" {
-    param "path";
-    param "root", "$hmitree";
-    message > get_hmi_tree_elt «$path»
-    if "not(starts-with($path, '/'))" error > Given path "«$path»" should start with a "/"
-    const "stripped", "substring($path, 2)";
-    const "token" choose {
-        when "contains($stripped, '/')" value "substring-before($stripped, '/')";
-        otherwise value "$stripped";
-    }
-
-    choose {
-        when "string-length($token) = 0"{
-            result "$root";
-        }
-        otherwise{
-            const "rest", "substring-after($stripped, $token)";
-            const "match", "$root/*[@name = $token]";
-            choose {
-                when "string-length($rest) > 0"{
-                    result "func:get_hmi_tree_el($rest, $match)";
-                }
-                otherwise{
-                    result "$match";
-                }
-            }
-        }
-    }
-}
-
 //  Parses:
 //  "HMI:WidgetType:param1:param2@path1@path2"
 //
@@ -139,6 +109,14 @@
 }
 
 
+def "func:is_descendant_path" {
+    param "descend";
+    param "ancest";
+    // TODO : use HMI tree to answer more accurately
+    result "string-length($ancest) > 0 and starts-with($descend,$ancest)";
+}
+
+
 // Debug data
 template "*", mode="testtree"{
     param "indent", "''";