# HG changeset patch # User Edouard Tisserant # Date 1598531640 -7200 # Node ID d7b009e49e8769bc5065de31f0b839178d98a816 # Parent ed43facc7137629fe79e2082fd527784860f8ed6 SVGHMI: JsonTable now ignores elements and groups starting with # diff -r ed43facc7137 -r d7b009e49e87 svghmi/gen_index_xhtml.xslt --- a/svghmi/gen_index_xhtml.xslt Thu Aug 27 09:59:35 2020 +0200 +++ b/svghmi/gen_index_xhtml.xslt Thu Aug 27 14:34:00 2020 +0200 @@ -3587,10 +3587,22 @@ + + + + + + + + + + + + - + @@ -3598,6 +3610,7 @@ + obj_ @@ -3648,8 +3661,7 @@ "); - - + @@ -3692,7 +3704,7 @@ console.log(range,position,jdata); - + diff -r ed43facc7137 -r d7b009e49e87 svghmi/widget_jsontable.ysl2 --- a/svghmi/widget_jsontable.ysl2 Thu Aug 27 09:59:35 2020 +0200 +++ b/svghmi/widget_jsontable.ysl2 Thu Aug 27 14:34:00 2020 +0200 @@ -70,7 +70,7 @@ choose { when "contains($suffix,'=')" { const "name", "substring-before($suffix,'=')"; - if "$expr/@name[. != $name]" + if "$expr/@name[. != $name]" error > JsonTable : missplaced '=' or inconsistent names in Json data expressions. attrib "name" value "$name"; attrib "content" > «$expr/@content»«substring-after($suffix,'=')» @@ -144,18 +144,32 @@ result "$widget_elts[@id=$eltid]/@inkscape:label"; } +template "svg:*", mode="json_table_render_except_comments"{ + param "expressions"; + param "widget_elts"; + + const "label", "func:filter_non_widget_label(., $widget_elts)"; + // filter out "# commented" elements + if "not(starts-with($label,'#'))" + apply ".", mode="json_table_render"{ + with "expressions", "$expressions"; + with "widget_elts", "$widget_elts"; + with "label", "$label"; + } +} + template "svg:*", mode="json_table_render" { param "expressions"; param "widget_elts"; - const "label", "func:filter_non_widget_label(., $widget_elts)"; - apply ".", mode="json_table_elt_render" { + param "label"; + apply ".", mode="json_table_elt_render" with "expressions", "func:json_expressions($expressions, $label)"; - } } template "svg:g", mode="json_table_render" { param "expressions"; param "widget_elts"; + param "label"; const "gid", "@id"; // use intermediate variables for optimization @@ -179,8 +193,7 @@ // revert hiding in case it did happen before | id("«@id»").setAttribute("style", "«@style»"); - const "label", "func:filter_non_widget_label(., $widget_elts)"; - apply "*", mode="json_table_render" { + apply "*", mode="json_table_render_except_comments" { with "expressions", "func:json_expressions(exsl:node-set($new_expressions), $label)"; with "widget_elts", "$widget_elts"; } @@ -200,7 +213,7 @@ | this.apply_hmi_value(1, range); | this.apply_hmi_value(2, position); | console.log(range,position,jdata); - apply "$data_elt/*", mode="json_table_render" { + apply "$data_elt", mode="json_table_render_except_comments" { with "expressions","$initexpr_ns"; with "widget_elts","$hmi_element/*[@inkscape:label = 'data']/descendant::svg:*"; }