SVGHMI: Naive implementation of widget path substitution in widget DnD: considers widget always have only one variable, and no type checking. svghmi
authorEdouard Tisserant
Tue, 06 Apr 2021 16:05:58 +0200
branchsvghmi
changeset 3225 cfa5690c8c15
parent 3224 507dd7bc8cb5
child 3226 60a8531efa45
SVGHMI: Naive implementation of widget path substitution in widget DnD: considers widget always have only one variable, and no type checking.
svghmi/gen_dnd_widget_svg.xslt
svghmi/gen_dnd_widget_svg.ysl2
--- a/svghmi/gen_dnd_widget_svg.xslt	Tue Apr 06 14:04:08 2021 +0200
+++ b/svghmi/gen_dnd_widget_svg.xslt	Tue Apr 06 16:05:58 2021 +0200
@@ -131,7 +131,11 @@
     <xsl:copy/>
   </xsl:template>
   <xsl:template xmlns="http://www.w3.org/2000/svg" mode="inline_svg" match="@inkscape:label[starts-with(., 'HMI:')]">
-    <xsl:copy/>
+    <xsl:attribute name="inkscape:label">
+      <xsl:value-of select="substring-before(., '@')"/>
+      <xsl:text>@</xsl:text>
+      <xsl:value-of select="$hmi_path"/>
+    </xsl:attribute>
   </xsl:template>
   <xsl:template mode="inline_svg" match="node()">
     <xsl:copy>
--- a/svghmi/gen_dnd_widget_svg.ysl2	Tue Apr 06 14:04:08 2021 +0200
+++ b/svghmi/gen_dnd_widget_svg.ysl2	Tue Apr 06 16:05:58 2021 +0200
@@ -38,7 +38,7 @@
     svgtmpl "@*", mode="inline_svg" xsl:copy;
 
     svgtmpl "@inkscape:label[starts-with(., 'HMI:')]", mode="inline_svg" {
-        xsl:copy;
+        attrib "inkscape:label" > «substring-before(., '@')»@«$hmi_path»
     }
 
     template "node()", mode="inline_svg" {