SVGHMI: fix JS error loading empty single page
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Fri, 24 Nov 2023 14:47:14 +0100
changeset 3877 ecb947e5bbb4
parent 3876 7d83cd94e3cc
child 3878 58bce98b9ac6
SVGHMI: fix JS error loading empty single page

svg:svg tag should not be considered as a detachable group,
so filter only svg:g elements
svghmi/detachable_pages.ysl2
svghmi/gen_index_xhtml.xslt
--- a/svghmi/detachable_pages.ysl2	Fri Nov 24 14:44:08 2023 +0100
+++ b/svghmi/detachable_pages.ysl2	Fri Nov 24 14:47:14 2023 +0100
@@ -112,7 +112,7 @@
 def "func:sumarized_elements" {
     param "elements";
     const "short_list", "$elements[not(ancestor::*/@id = $elements/@id)]";
-    const "filled_groups", """$short_list/parent::*[
+    const "filled_groups", """$short_list/parent::svg:g[
         not(child::*[
             not(@id = $discardable_elements/@id) and
             not(@id = $short_list/@id)
--- a/svghmi/gen_index_xhtml.xslt	Fri Nov 24 14:44:08 2023 +0100
+++ b/svghmi/gen_index_xhtml.xslt	Fri Nov 24 14:47:14 2023 +0100
@@ -717,7 +717,7 @@
   <func:function name="func:sumarized_elements">
     <xsl:param name="elements"/>
     <xsl:variable name="short_list" select="$elements[not(ancestor::*/@id = $elements/@id)]"/>
-    <xsl:variable name="filled_groups" select="$short_list/parent::*[&#10;        not(child::*[&#10;            not(@id = $discardable_elements/@id) and&#10;            not(@id = $short_list/@id)&#10;        ])]"/>
+    <xsl:variable name="filled_groups" select="$short_list/parent::svg:g[&#10;        not(child::*[&#10;            not(@id = $discardable_elements/@id) and&#10;            not(@id = $short_list/@id)&#10;        ])]"/>
     <xsl:variable name="groups_to_add" select="$filled_groups[not(ancestor::*/@id = $filled_groups/@id)]"/>
     <func:result select="$groups_to_add | $short_list[not(ancestor::*/@id = $filled_groups/@id)]"/>
   </func:function>