SVGHMI: unsignificant changes or changes in generated code svghmi
authorEdouard Tisserant
Thu, 12 Mar 2020 13:15:54 +0100
branchsvghmi
changeset 2867 901c89c0cc08
parent 2866 59a855c17aa6
child 2868 8d9757191f05
SVGHMI: unsignificant changes or changes in generated code
svghmi/gen_index_xhtml.xslt
svghmi/gen_index_xhtml.ysl2
svghmi/svghmi.js
--- a/svghmi/gen_index_xhtml.xslt	Thu Mar 12 13:14:38 2020 +0100
+++ b/svghmi/gen_index_xhtml.xslt	Thu Mar 12 13:15:54 2020 +0100
@@ -33,9 +33,6 @@
       <xsl:text>HMI_ROOT</xsl:text>
     </noindex>
     <noindex>
-      <xsl:text>HMI_NODE</xsl:text>
-    </noindex>
-    <noindex>
       <xsl:text>HMI_PLC_STATUS</xsl:text>
     </noindex>
     <noindex>
@@ -43,10 +40,6 @@
     </noindex>
   </xsl:variable>
   <xsl:variable name="categories" select="exsl:node-set($_categories)"/>
-  <xsl:variable name="_indexed_hmitree">
-    <xsl:apply-templates mode="index" select="$hmitree"/>
-  </xsl:variable>
-  <xsl:variable name="indexed_hmitree" select="exsl:node-set($_indexed_hmitree)"/>
   <func:function name="func:refered_elements">
     <xsl:param name="elems"/>
     <xsl:variable name="descend" select="$elems/descendant-or-self::svg:*"/>
@@ -147,6 +140,10 @@
   </func:function>
   <xsl:variable name="_detachable_elements" select="func:detachable_elements($hmi_pages)"/>
   <xsl:variable name="detachable_elements" select="$_detachable_elements[not(ancestor::*/@id = $_detachable_elements/@id)]"/>
+  <xsl:variable name="_indexed_hmitree">
+    <xsl:apply-templates mode="index" select="$hmitree"/>
+  </xsl:variable>
+  <xsl:variable name="indexed_hmitree" select="exsl:node-set($_indexed_hmitree)"/>
   <xsl:template mode="index" match="*">
     <xsl:param name="index" select="0"/>
     <xsl:param name="parentpath" select="''"/>
@@ -176,6 +173,12 @@
               <xsl:copy/>
             </xsl:for-each>
           </xsl:copy>
+          <xsl:apply-templates mode="index" select="*[1]">
+            <xsl:with-param name="index" select="$index + 1"/>
+            <xsl:with-param name="parentpath">
+              <xsl:value-of select="$path"/>
+            </xsl:with-param>
+          </xsl:apply-templates>
         </xsl:when>
         <xsl:otherwise>
           <xsl:apply-templates mode="index" select="*[1]">
@@ -785,8 +788,6 @@
 </xsl:text>
     <xsl:text>    }
 </xsl:text>
-    <xsl:text>    console.log("no page switch");
-</xsl:text>
     <xsl:text>    apply_updates();
 </xsl:text>
     <xsl:text>    requestAnimationFrameID = null;
@@ -1359,10 +1360,12 @@
     <xsl:value-of select="$indent"/>
     <xsl:text> </xsl:text>
     <xsl:value-of select="local-name()"/>
+    <xsl:text> </xsl:text>
     <xsl:for-each select="@*">
       <xsl:value-of select="local-name()"/>
-      <xsl:text>=</xsl:text>
+      <xsl:text>="</xsl:text>
       <xsl:value-of select="."/>
+      <xsl:text>" </xsl:text>
     </xsl:for-each>
     <xsl:text>
 </xsl:text>
@@ -1618,8 +1621,6 @@
     <xsl:param name="hmi_element"/>
     <xsl:text>    on_click: function(evt) {
 </xsl:text>
-    <xsl:text>        console.log(evt);
-</xsl:text>
     <xsl:text>        switch_page(this.args[0]);
 </xsl:text>
     <xsl:text>    },
--- a/svghmi/gen_index_xhtml.ysl2	Thu Mar 12 13:14:38 2020 +0100
+++ b/svghmi/gen_index_xhtml.ysl2	Thu Mar 12 13:15:54 2020 +0100
@@ -69,8 +69,6 @@
         noindex > HMI_CURRENT_PAGE
     }
     const "categories", "exsl:node-set($_categories)";
-    const "_indexed_hmitree" apply "$hmitree", mode="index";
-    const "indexed_hmitree", "exsl:node-set($_indexed_hmitree)";
 
 
     // returns all directly or indirectly refered elements
@@ -263,8 +261,12 @@
     const "_detachable_elements", "func:detachable_elements($hmi_pages)";
     const "detachable_elements", "$_detachable_elements[not(ancestor::*/@id = $_detachable_elements/@id)]";
 
+
     //////////////// HMI Tree Index
 
+    const "_indexed_hmitree" apply "$hmitree", mode="index";
+    const "indexed_hmitree", "exsl:node-set($_indexed_hmitree)";
+
     template "*", mode="index" {
         param "index", "0";
         param "parentpath", "''";
@@ -822,7 +824,6 @@
     template "widget[@type='Jump']", mode="widget_defs" {
         param "hmi_element";
         |     on_click: function(evt) {
-        |         console.log(evt);
         |         switch_page(this.args[0]);
         |     },
         |     init: function() {
--- a/svghmi/svghmi.js	Thu Mar 12 13:14:38 2020 +0100
+++ b/svghmi/svghmi.js	Thu Mar 12 13:15:54 2020 +0100
@@ -82,7 +82,6 @@
     if(current_subscribed_page != current_visible_page){
         switch_visible_page(current_subscribed_page);
     }
-    console.log("no page switch");
     apply_updates();
     requestAnimationFrameID = null;
 }