--- a/svghmi/inline_svg.ysl2 Mon Aug 17 10:00:25 2020 +0200
+++ b/svghmi/inline_svg.ysl2 Thu Aug 20 13:52:00 2020 +0200
@@ -10,7 +10,10 @@
// - copy every attributes
// - copy every sub-elements
-template "@* | node()", mode="inline_svg" {
+svgtmpl "@*", mode="inline_svg" xsl:copy; +template "node()", mode="inline_svg" { // use real xsl:copy instead copy-of alias from yslt.yml2
if "not(@id = $discardable_elements/@id)"
xsl:copy apply "@* | node()", mode="inline_svg";
@@ -51,19 +54,22 @@
const "hmi_lists", "$hmi_elements[@id = $hmi_lists_descs/@id]";
const "targets_not_to_unlink", "$hmi_lists/descendant-or-self::svg:*";
const "to_unlink", "$hmi_elements[not(@id = $hmi_pages/@id)]/descendant-or-self::svg:use";
-svgtmpl "svg:use", mode="inline_svg"
+def "func:is_unlinkable" { + result "$eltid = $to_unlink/@id and not($targetid = $targets_not_to_unlink/@id)"; +svgtmpl "svg:use", mode="inline_svg"{ const "targetid","substring-after(@xlink:href,'#')";
- when "@id = $to_unlink/@id and not($targetid = $targets_not_to_unlink/@id)" {
+ when "func:is_unlinkable($targetid, @id)" { with "targetid", "$targetid";
- xsl:copy apply "@* | node()", mode="inline_svg";
+ otherwise xsl:copy apply "@*", mode="inline_svg"; @@ -87,11 +93,16 @@
const "target", "//svg:*[@id = $targetid]";
- const "seeded_id","concat($seed, @id)";
+ const "seeded_id" choose { + when "string-length($seed) > 0" > «$seed»_«@id» attrib "id" value "$seeded_id";
+ attrib "original" value "@id"; when "$target[self::svg:g]" {
foreach "@*[not(local-name() = $excluded_use_attrs/name | $merge_use_attrs)]"
@@ -112,7 +123,7 @@
apply "$target/*", mode="unlink_clone"{
- with "seed","concat($seed, @id)";
+ with "seed","$seeded_id"; @@ -121,7 +132,7 @@
apply "$target", mode="unlink_clone"{
- with "seed","concat($seed, @id)";
+ with "seed","$seeded_id"; @@ -133,13 +144,25 @@
svgtmpl "@id", mode="unlink_clone" {
attrib "id" > «$seed»_«.»
+ attrib "original" > «.» svgtmpl "@*", mode="unlink_clone" xsl:copy;
svgtmpl "svg:use", mode="unlink_clone" {
- apply "." mode="inline_svg" with "seed","concat($seed, '_')";
+ const "targetid","substring-after(@xlink:href,'#')"; + when "func:is_unlinkable($targetid, @id)" { + with "targetid", "$targetid"; + otherwise xsl:copy apply "@*", mode="unlink_clone" { // copying widgets would have unwanted effect