svghmi/gen_index_xhtml.xslt
branchsvghmi
changeset 2867 901c89c0cc08
parent 2865 545902730141
child 2869 d9eb50c015d1
equal deleted inserted replaced
2866:59a855c17aa6 2867:901c89c0cc08
    31   <xsl:variable name="_categories">
    31   <xsl:variable name="_categories">
    32     <noindex>
    32     <noindex>
    33       <xsl:text>HMI_ROOT</xsl:text>
    33       <xsl:text>HMI_ROOT</xsl:text>
    34     </noindex>
    34     </noindex>
    35     <noindex>
    35     <noindex>
    36       <xsl:text>HMI_NODE</xsl:text>
       
    37     </noindex>
       
    38     <noindex>
       
    39       <xsl:text>HMI_PLC_STATUS</xsl:text>
    36       <xsl:text>HMI_PLC_STATUS</xsl:text>
    40     </noindex>
    37     </noindex>
    41     <noindex>
    38     <noindex>
    42       <xsl:text>HMI_CURRENT_PAGE</xsl:text>
    39       <xsl:text>HMI_CURRENT_PAGE</xsl:text>
    43     </noindex>
    40     </noindex>
    44   </xsl:variable>
    41   </xsl:variable>
    45   <xsl:variable name="categories" select="exsl:node-set($_categories)"/>
    42   <xsl:variable name="categories" select="exsl:node-set($_categories)"/>
    46   <xsl:variable name="_indexed_hmitree">
       
    47     <xsl:apply-templates mode="index" select="$hmitree"/>
       
    48   </xsl:variable>
       
    49   <xsl:variable name="indexed_hmitree" select="exsl:node-set($_indexed_hmitree)"/>
       
    50   <func:function name="func:refered_elements">
    43   <func:function name="func:refered_elements">
    51     <xsl:param name="elems"/>
    44     <xsl:param name="elems"/>
    52     <xsl:variable name="descend" select="$elems/descendant-or-self::svg:*"/>
    45     <xsl:variable name="descend" select="$elems/descendant-or-self::svg:*"/>
    53     <xsl:variable name="clones" select="$descend[self::svg:use]"/>
    46     <xsl:variable name="clones" select="$descend[self::svg:use]"/>
    54     <xsl:variable name="originals" select="//svg:*[concat('#',@id) = $clones/@xlink:href]"/>
    47     <xsl:variable name="originals" select="//svg:*[concat('#',@id) = $clones/@xlink:href]"/>
   145       </xsl:otherwise>
   138       </xsl:otherwise>
   146     </xsl:choose>
   139     </xsl:choose>
   147   </func:function>
   140   </func:function>
   148   <xsl:variable name="_detachable_elements" select="func:detachable_elements($hmi_pages)"/>
   141   <xsl:variable name="_detachable_elements" select="func:detachable_elements($hmi_pages)"/>
   149   <xsl:variable name="detachable_elements" select="$_detachable_elements[not(ancestor::*/@id = $_detachable_elements/@id)]"/>
   142   <xsl:variable name="detachable_elements" select="$_detachable_elements[not(ancestor::*/@id = $_detachable_elements/@id)]"/>
       
   143   <xsl:variable name="_indexed_hmitree">
       
   144     <xsl:apply-templates mode="index" select="$hmitree"/>
       
   145   </xsl:variable>
       
   146   <xsl:variable name="indexed_hmitree" select="exsl:node-set($_indexed_hmitree)"/>
   150   <xsl:template mode="index" match="*">
   147   <xsl:template mode="index" match="*">
   151     <xsl:param name="index" select="0"/>
   148     <xsl:param name="index" select="0"/>
   152     <xsl:param name="parentpath" select="''"/>
   149     <xsl:param name="parentpath" select="''"/>
   153     <xsl:variable name="content">
   150     <xsl:variable name="content">
   154       <xsl:variable name="path">
   151       <xsl:variable name="path">
   174             </xsl:attribute>
   171             </xsl:attribute>
   175             <xsl:for-each select="@*">
   172             <xsl:for-each select="@*">
   176               <xsl:copy/>
   173               <xsl:copy/>
   177             </xsl:for-each>
   174             </xsl:for-each>
   178           </xsl:copy>
   175           </xsl:copy>
       
   176           <xsl:apply-templates mode="index" select="*[1]">
       
   177             <xsl:with-param name="index" select="$index + 1"/>
       
   178             <xsl:with-param name="parentpath">
       
   179               <xsl:value-of select="$path"/>
       
   180             </xsl:with-param>
       
   181           </xsl:apply-templates>
   179         </xsl:when>
   182         </xsl:when>
   180         <xsl:otherwise>
   183         <xsl:otherwise>
   181           <xsl:apply-templates mode="index" select="*[1]">
   184           <xsl:apply-templates mode="index" select="*[1]">
   182             <xsl:with-param name="index" select="$index"/>
   185             <xsl:with-param name="index" select="$index"/>
   183             <xsl:with-param name="parentpath">
   186             <xsl:with-param name="parentpath">
   783 </xsl:text>
   786 </xsl:text>
   784     <xsl:text>        switch_visible_page(current_subscribed_page);
   787     <xsl:text>        switch_visible_page(current_subscribed_page);
   785 </xsl:text>
   788 </xsl:text>
   786     <xsl:text>    }
   789     <xsl:text>    }
   787 </xsl:text>
   790 </xsl:text>
   788     <xsl:text>    console.log("no page switch");
       
   789 </xsl:text>
       
   790     <xsl:text>    apply_updates();
   791     <xsl:text>    apply_updates();
   791 </xsl:text>
   792 </xsl:text>
   792     <xsl:text>    requestAnimationFrameID = null;
   793     <xsl:text>    requestAnimationFrameID = null;
   793 </xsl:text>
   794 </xsl:text>
   794     <xsl:text>}
   795     <xsl:text>}
  1357   <xsl:template mode="testtree" match="*">
  1358   <xsl:template mode="testtree" match="*">
  1358     <xsl:param name="indent" select="''"/>
  1359     <xsl:param name="indent" select="''"/>
  1359     <xsl:value-of select="$indent"/>
  1360     <xsl:value-of select="$indent"/>
  1360     <xsl:text> </xsl:text>
  1361     <xsl:text> </xsl:text>
  1361     <xsl:value-of select="local-name()"/>
  1362     <xsl:value-of select="local-name()"/>
       
  1363     <xsl:text> </xsl:text>
  1362     <xsl:for-each select="@*">
  1364     <xsl:for-each select="@*">
  1363       <xsl:value-of select="local-name()"/>
  1365       <xsl:value-of select="local-name()"/>
  1364       <xsl:text>=</xsl:text>
  1366       <xsl:text>="</xsl:text>
  1365       <xsl:value-of select="."/>
  1367       <xsl:value-of select="."/>
       
  1368       <xsl:text>" </xsl:text>
  1366     </xsl:for-each>
  1369     </xsl:for-each>
  1367     <xsl:text>
  1370     <xsl:text>
  1368 </xsl:text>
  1371 </xsl:text>
  1369     <xsl:apply-templates mode="testtree" select="*">
  1372     <xsl:apply-templates mode="testtree" select="*">
  1370       <xsl:with-param name="indent">
  1373       <xsl:with-param name="indent">
  1616   </xsl:template>
  1619   </xsl:template>
  1617   <xsl:template mode="widget_defs" match="widget[@type='Jump']">
  1620   <xsl:template mode="widget_defs" match="widget[@type='Jump']">
  1618     <xsl:param name="hmi_element"/>
  1621     <xsl:param name="hmi_element"/>
  1619     <xsl:text>    on_click: function(evt) {
  1622     <xsl:text>    on_click: function(evt) {
  1620 </xsl:text>
  1623 </xsl:text>
  1621     <xsl:text>        console.log(evt);
       
  1622 </xsl:text>
       
  1623     <xsl:text>        switch_page(this.args[0]);
  1624     <xsl:text>        switch_page(this.args[0]);
  1624 </xsl:text>
  1625 </xsl:text>
  1625     <xsl:text>    },
  1626     <xsl:text>    },
  1626 </xsl:text>
  1627 </xsl:text>
  1627     <xsl:text>    init: function() {
  1628     <xsl:text>    init: function() {