SVGHMI: Optimize sumarized_elements xslt function, taking most of SVGHMI build time. svghmi
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Tue, 23 Feb 2021 10:07:21 +0100
branchsvghmi
changeset 3161 edd558965f58
parent 3160 cecfd6bb4593
child 3162 fbe1ffaa56cf
child 3163 7cf38cd0d820
SVGHMI: Optimize sumarized_elements xslt function, taking most of SVGHMI build time.
svghmi/detachable_pages.ysl2
svghmi/gen_index_xhtml.xslt
--- a/svghmi/detachable_pages.ysl2	Mon Feb 22 10:09:57 2021 +0100
+++ b/svghmi/detachable_pages.ysl2	Tue Feb 23 10:07:21 2021 +0100
@@ -73,14 +73,13 @@
 def "func:sumarized_elements" {
     param "elements";
     const "short_list", "$elements[not(ancestor::*/@id = $elements/@id)]";
-    const "filled_groups", """$short_list/parent::svg:*[
-        not(descendant::*[
-            not(self::svg:g) and
+    const "filled_groups", """$short_list/parent::*[
+        not(child::*[
             not(@id = $discardable_elements/@id) and
-            not(@id = $short_list/descendant-or-self::*[not(self::svg:g)]/@id)
+            not(@id = $short_list/@id)
         ])]""";
     const "groups_to_add", "$filled_groups[not(ancestor::*/@id = $filled_groups/@id)]";
-    result "$groups_to_add | $short_list[not(ancestor::svg:g/@id = $filled_groups/@id)]";
+    result "$groups_to_add | $short_list[not(ancestor::*/@id = $filled_groups/@id)]";
 }
 
 def "func:detachable_elements" {
--- a/svghmi/gen_index_xhtml.xslt	Mon Feb 22 10:09:57 2021 +0100
+++ b/svghmi/gen_index_xhtml.xslt	Tue Feb 23 10:07:21 2021 +0100
@@ -471,9 +471,9 @@
   <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::svg:*[&#10;        not(descendant::*[&#10;            not(self::svg:g) and&#10;            not(@id = $discardable_elements/@id) and&#10;            not(@id = $short_list/descendant-or-self::*[not(self::svg:g)]/@id)&#10;        ])]"/>
+    <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="groups_to_add" select="$filled_groups[not(ancestor::*/@id = $filled_groups/@id)]"/>
-    <func:result select="$groups_to_add | $short_list[not(ancestor::svg:g/@id = $filled_groups/@id)]"/>
+    <func:result select="$groups_to_add | $short_list[not(ancestor::*/@id = $filled_groups/@id)]"/>
   </func:function>
   <func:function name="func:detachable_elements">
     <xsl:param name="pages"/>