--- a/svghmi/gen_index_xhtml.xslt Fri Mar 20 10:46:15 2020 +0100
+++ b/svghmi/gen_index_xhtml.xslt Mon Mar 23 10:16:38 2020 +0100
@@ -680,8 +680,29 @@
+ <xsl:template mode="widget_defs" match="widget[@type='Display']"> + <xsl:param name="hmi_element"/> + <xsl:text> frequency: 5, + <xsl:text> dispatch: function(value) { + <xsl:when test="$hmi_element[self::svg:text]"> + <xsl:text> this.element.textContent = String(value); + <xsl:message terminate="no"> + <xsl:text>Display widget as a group not implemented</xsl:text> <xsl:template mode="widget_defs" match="widget[@type='ForEach']">
<xsl:param name="hmi_element"/>
+ <xsl:variable name="widgets" select="func:refered_elements($forEach_widgets)[not(@id = $forEach_widgets_ids)]"/> <xsl:text> dispatch: function(value) {
@@ -710,6 +731,34 @@
+ <xsl:variable name="labels_regex" select="concat('^',arg[1]/@value,':[0-9]+')"/> + <xsl:for-each select="$hmi_element/*[regexp:test(@inkscape:label, $labels_regex)]"> + <xsl:text> [ /* </xsl:text> + <xsl:value-of select="@inkscape:label"/> + <xsl:variable name="elt" select="."/> + <xsl:for-each select="func:refered_elements(.)[@id = $hmi_elements/@id][not(@id = $elt/@id)]"> + <xsl:text> hmi_widgets["</xsl:text> + <xsl:value-of select="@id"/> + <xsl:text>"]</xsl:text> + <xsl:if test="position()!=last()"> + <xsl:text> ]</xsl:text> + <xsl:if test="position()!=last()"> <xsl:template mode="widget_subscribe" match="widget[@type='ForEach']">
<xsl:text> sub: function(off){
@@ -725,26 +774,6 @@
- <xsl:template mode="widget_defs" match="widget[@type='Display']">
- <xsl:param name="hmi_element"/>
- <xsl:text> frequency: 5,
- <xsl:text> dispatch: function(value) {
- <xsl:when test="$hmi_element[self::svg:text]">
- <xsl:text> this.element.textContent = String(value);
- <xsl:message terminate="no">
- <xsl:text>Display widget as a group not implemented</xsl:text>
<xsl:template mode="widget_defs" match="widget[@type='Input']">
<xsl:param name="hmi_element"/>
<xsl:variable name="value_elt">
--- a/svghmi/widget_foreach.ysl2 Fri Mar 20 10:46:15 2020 +0100
+++ b/svghmi/widget_foreach.ysl2 Mon Mar 23 10:16:38 2020 +0100
@@ -1,6 +1,7 @@
template "widget[@type='ForEach']", mode="widget_defs" {
+ const "widgets", "func:refered_elements($forEach_widgets)[not(@id = $forEach_widgets_ids)]"; | dispatch: function(value) {
@@ -14,15 +15,30 @@
+ const "labels_regex","concat('^',arg[1]/@value,':[0-9]+')"; + foreach "$hmi_element/*[regexp:test(@inkscape:label, $labels_regex)]" { + | [ /* «@inkscape:label» */ + //foreach "$hmi_elements[ancestor::svg:*/@id = $_id]" { + foreach "func:refered_elements(.)[@id = $hmi_elements/@id][not(@id = $elt/@id)]" { + | hmi_widgets["«@id»"]`if "position()!=last()" > ,` + | ]`if "position()!=last()" > ,` template "widget[@type='ForEach']", mode="widget_subscribe"{
- | subscribe.call(this,off)
+ | subscribe.call(this,off); - | unsubscribe.call(this)
+ | unsubscribe.call(this);