# HG changeset patch
# User Edouard Tisserant <edouard.tisserant@gmail.com>
# Date 1700833634 -3600
# Node ID ecb947e5bbb4df44a2bdcb48484360212827e5b1
# Parent  7d83cd94e3cc6e1a3700600342dfa3ba1f00f240
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

diff -r 7d83cd94e3cc -r ecb947e5bbb4 svghmi/detachable_pages.ysl2
--- 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)
diff -r 7d83cd94e3cc -r ecb947e5bbb4 svghmi/gen_index_xhtml.xslt
--- 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>