--- a/svghmi/gen_index_xhtml.xslt Thu May 14 17:48:58 2020 +0200
+++ b/svghmi/gen_index_xhtml.xslt Thu May 14 17:49:20 2020 +0200
@@ -658,7 +658,7 @@
<xsl:text>All units must be set to "px" in Inkscape's document properties</xsl:text>
- <xsl:variable name="to_unlink" select="$hmi_elements[not(@id = $hmi_pages)]//svg:use"/>
+ <xsl:variable name="to_unlink" select="$hmi_elements[not(@id = $hmi_pages)]/descendant-or-self::svg:use"/> <xsl:template xmlns="http://www.w3.org/2000/svg" mode="inline_svg" match="svg:use">
<xsl:when test="@id = $to_unlink/@id">
@@ -689,17 +689,59 @@
<xsl:variable name="excluded_use_attrs" select="exsl:node-set($_excluded_use_attrs)"/>
+ <xsl:variable name="_merge_use_attrs"> + <xsl:text>transform</xsl:text> + <xsl:text>style</xsl:text> + <xsl:variable name="merge_use_attrs" select="exsl:node-set($_merge_use_attrs)"/> <xsl:template xmlns="http://www.w3.org/2000/svg" name="unlink_clone">
+ <xsl:variable name="targetid" select="substring-after(@xlink:href,'#')"/> + <xsl:variable name="target" select="//svg:*[@id = $targetid]"/> - <xsl:for-each select="@*[not(local-name() = $excluded_use_attrs/name)]">
- <xsl:attribute name="{name()}">
- <xsl:value-of select="."/>
- <xsl:variable name="targetid" select="substring-after(@xlink:href,'#')"/>
- <xsl:apply-templates mode="unlink_clone" select="//svg:*[@id = $targetid]">
- <xsl:with-param name="seed" select="@id"/>
+ <xsl:when test="$target[self::svg:g]"> + <xsl:for-each select="@*[not(local-name() = $excluded_use_attrs/name | $merge_use_attrs)]"> + <xsl:attribute name="{name()}"> + <xsl:value-of select="."/> + <xsl:if test="@style | $target/@style"> + <xsl:attribute name="style"> + <xsl:value-of select="@style"/> + <xsl:if test="@style and $target/@style"> + <xsl:value-of select="$target/@style"/> + <xsl:if test="@transform | $target/@transform"> + <xsl:attribute name="transform"> + <xsl:value-of select="@transform"/> + <xsl:if test="@transform and $target/@transform"> + <xsl:value-of select="$target/@transform"/> + <xsl:apply-templates mode="unlink_clone" select="$target/*"> + <xsl:with-param name="seed" select="@id"/> + <xsl:for-each select="@*[not(local-name() = $excluded_use_attrs/name)]"> + <xsl:attribute name="{name()}"> + <xsl:value-of select="."/> + <xsl:apply-templates mode="unlink_clone" select="$target"> + <xsl:with-param name="seed" select="@id"/> <xsl:template xmlns="http://www.w3.org/2000/svg" mode="unlink_clone" match="@id">
@@ -1117,10 +1159,6 @@
- <xsl:text> // TODO : use attributes to allow interaction through svg:use
- <xsl:text> // TODO : deal with dragging
<xsl:text> this.element.addEventListener(
@@ -2629,7 +2667,7 @@
<xsl:variable name="regex" select="'^("[^"].*"|\-?[0-9]+|false|true)(#.*)?$'"/>
- <xsl:for-each select="$hmi_element/*[regexp:test(@inkscape:label,$regex)]">
+ <xsl:for-each select="$result_svg_ns//*[@id = $hmi_element/@id]//*[regexp:test(@inkscape:label,$regex)]"> <xsl:variable name="literal" select="regexp:match(@inkscape:label,$regex)[2]"/>
--- a/svghmi/widget_switch.ysl2 Thu May 14 17:48:58 2020 +0200
+++ b/svghmi/widget_switch.ysl2 Thu May 14 17:49:20 2020 +0200
@@ -20,7 +20,7 @@
const "regex",!"'^(\"[^\"].*\"|\-?[0-9]+|false|true)(#.*)?$'"!;
- foreach "$hmi_element/*[regexp:test(@inkscape:label,$regex)]" {
+ foreach "$result_svg_ns//*[@id = $hmi_element/@id]//*[regexp:test(@inkscape:label,$regex)]" { const "literal", "regexp:match(@inkscape:label,$regex)[2]";