svghmi/gen_index_xhtml.xslt
branchsvghmi
changeset 2949 e50908ddec60
parent 2944 2a20038fbea9
child 2954 b5dccd0d99ac
equal deleted inserted replaced
2948:faaf677ea99d 2949:e50908ddec60
     1 <?xml version="1.0"?>
     1 <?xml version="1.0"?>
     2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" xmlns:regexp="http://exslt.org/regular-expressions" xmlns:str="http://exslt.org/strings" xmlns:func="http://exslt.org/functions" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:debug="debug" xmlns:preamble="preamble" xmlns:declarations="declarations" xmlns:definitions="definitions" xmlns:epilogue="epilogue" xmlns:ns="beremiz" version="1.0" extension-element-prefixes="ns func exsl regexp str dyn" exclude-result-prefixes="ns func exsl regexp str dyn debug preamble epilogue declarations definitions">
     2 <xsl:stylesheet xmlns:ns="beremiz" xmlns:definitions="definitions" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:func="http://exslt.org/functions" xmlns:epilogue="epilogue" xmlns:preamble="preamble" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:svg="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:str="http://exslt.org/strings" xmlns:regexp="http://exslt.org/regular-expressions" xmlns:exsl="http://exslt.org/common" xmlns:declarations="declarations" xmlns:debug="debug" exclude-result-prefixes="ns func exsl regexp str dyn debug preamble epilogue declarations definitions" extension-element-prefixes="ns func exsl regexp str dyn" version="1.0">
     3   <xsl:output cdata-section-elements="xhtml:script" method="xml"/>
     3   <xsl:output method="xml" cdata-section-elements="xhtml:script"/>
     4   <xsl:variable name="svg" select="/svg:svg"/>
     4   <xsl:variable name="svg" select="/svg:svg"/>
     5   <xsl:variable name="hmi_elements" select="//svg:*[starts-with(@inkscape:label, 'HMI:')]"/>
     5   <xsl:variable name="hmi_elements" select="//svg:*[starts-with(@inkscape:label, 'HMI:')]"/>
     6   <xsl:variable name="hmitree" select="ns:GetHMITree()"/>
     6   <xsl:variable name="hmitree" select="ns:GetHMITree()"/>
     7   <xsl:variable name="_categories">
     7   <xsl:variable name="_categories">
     8     <noindex>
     8     <noindex>
    17     <xsl:apply-templates mode="index" select="$hmitree"/>
    17     <xsl:apply-templates mode="index" select="$hmitree"/>
    18   </xsl:variable>
    18   </xsl:variable>
    19   <xsl:variable name="indexed_hmitree" select="exsl:node-set($_indexed_hmitree)"/>
    19   <xsl:variable name="indexed_hmitree" select="exsl:node-set($_indexed_hmitree)"/>
    20   <preamble:hmi-tree/>
    20   <preamble:hmi-tree/>
    21   <xsl:template match="preamble:hmi-tree">
    21   <xsl:template match="preamble:hmi-tree">
       
    22     <xsl:text>
       
    23 </xsl:text>
       
    24     <xsl:text>/* </xsl:text>
       
    25     <xsl:value-of select="local-name()"/>
       
    26     <xsl:text> */
       
    27 </xsl:text>
       
    28     <xsl:text>
       
    29 </xsl:text>
    22     <xsl:text>var hmi_hash = [</xsl:text>
    30     <xsl:text>var hmi_hash = [</xsl:text>
    23     <xsl:value-of select="$hmitree/@hash"/>
    31     <xsl:value-of select="$hmitree/@hash"/>
    24     <xsl:text>];
    32     <xsl:text>];
    25 </xsl:text>
    33 </xsl:text>
    26     <xsl:text>
    34     <xsl:text>
    46       </xsl:if>
    54       </xsl:if>
    47       <xsl:text>
    55       <xsl:text>
    48 </xsl:text>
    56 </xsl:text>
    49     </xsl:for-each>
    57     </xsl:for-each>
    50     <xsl:text>]
    58     <xsl:text>]
       
    59 </xsl:text>
       
    60     <xsl:text>
    51 </xsl:text>
    61 </xsl:text>
    52     <xsl:text>
    62     <xsl:text>
    53 </xsl:text>
    63 </xsl:text>
    54   </xsl:template>
    64   </xsl:template>
    55   <xsl:template mode="index" match="*">
    65   <xsl:template mode="index" match="*">
   213       </xsl:with-param>
   223       </xsl:with-param>
   214     </xsl:apply-templates>
   224     </xsl:apply-templates>
   215   </xsl:template>
   225   </xsl:template>
   216   <debug:hmi-tree/>
   226   <debug:hmi-tree/>
   217   <xsl:template match="debug:hmi-tree">
   227   <xsl:template match="debug:hmi-tree">
       
   228     <xsl:text>
       
   229 </xsl:text>
       
   230     <xsl:text>/* </xsl:text>
       
   231     <xsl:value-of select="local-name()"/>
       
   232     <xsl:text> */
       
   233 </xsl:text>
       
   234     <xsl:text>
       
   235 </xsl:text>
   218     <xsl:text>Raw HMI tree
   236     <xsl:text>Raw HMI tree
   219 </xsl:text>
   237 </xsl:text>
   220     <xsl:apply-templates mode="testtree" select="$hmitree"/>
   238     <xsl:apply-templates mode="testtree" select="$hmitree"/>
   221     <xsl:text>
   239     <xsl:text>
   222 </xsl:text>
   240 </xsl:text>
   227 </xsl:text>
   245 </xsl:text>
   228     <xsl:text>Parsed Widgets
   246     <xsl:text>Parsed Widgets
   229 </xsl:text>
   247 </xsl:text>
   230     <xsl:copy-of select="_parsed_widgets"/>
   248     <xsl:copy-of select="_parsed_widgets"/>
   231     <xsl:apply-templates mode="testtree" select="$parsed_widgets"/>
   249     <xsl:apply-templates mode="testtree" select="$parsed_widgets"/>
       
   250     <xsl:text>
       
   251 </xsl:text>
   232   </xsl:template>
   252   </xsl:template>
   233   <xsl:variable name="geometry" select="ns:GetSVGGeometry()"/>
   253   <xsl:variable name="geometry" select="ns:GetSVGGeometry()"/>
   234   <debug:geometry/>
   254   <debug:geometry/>
   235   <xsl:template match="debug:geometry">
   255   <xsl:template match="debug:geometry">
       
   256     <xsl:text>
       
   257 </xsl:text>
       
   258     <xsl:text>/* </xsl:text>
       
   259     <xsl:value-of select="local-name()"/>
       
   260     <xsl:text> */
       
   261 </xsl:text>
       
   262     <xsl:text>
       
   263 </xsl:text>
   236     <xsl:text>ID, x, y, w, h
   264     <xsl:text>ID, x, y, w, h
   237 </xsl:text>
   265 </xsl:text>
   238     <xsl:for-each select="$geometry">
   266     <xsl:for-each select="$geometry">
   239       <xsl:text> </xsl:text>
   267       <xsl:text> </xsl:text>
   240       <xsl:value-of select="@Id"/>
   268       <xsl:value-of select="@Id"/>
   247       <xsl:text> </xsl:text>
   275       <xsl:text> </xsl:text>
   248       <xsl:value-of select="@h"/>
   276       <xsl:value-of select="@h"/>
   249       <xsl:text>
   277       <xsl:text>
   250 </xsl:text>
   278 </xsl:text>
   251     </xsl:for-each>
   279     </xsl:for-each>
       
   280     <xsl:text>
       
   281 </xsl:text>
   252   </xsl:template>
   282   </xsl:template>
   253   <func:function name="func:intersect_1d">
   283   <func:function name="func:intersect_1d">
   254     <xsl:param name="a0"/>
   284     <xsl:param name="a0"/>
   255     <xsl:param name="a1"/>
   285     <xsl:param name="a1"/>
   256     <xsl:param name="b0"/>
   286     <xsl:param name="b0"/>
   320   </xsl:variable>
   350   </xsl:variable>
   321   <preamble:default-page/>
   351   <preamble:default-page/>
   322   <xsl:template match="preamble:default-page">
   352   <xsl:template match="preamble:default-page">
   323     <xsl:text>
   353     <xsl:text>
   324 </xsl:text>
   354 </xsl:text>
       
   355     <xsl:text>/* </xsl:text>
       
   356     <xsl:value-of select="local-name()"/>
       
   357     <xsl:text> */
       
   358 </xsl:text>
       
   359     <xsl:text>
       
   360 </xsl:text>
       
   361     <xsl:text>
       
   362 </xsl:text>
   325     <xsl:text>var default_page = "</xsl:text>
   363     <xsl:text>var default_page = "</xsl:text>
   326     <xsl:value-of select="$default_page"/>
   364     <xsl:value-of select="$default_page"/>
   327     <xsl:text>";
   365     <xsl:text>";
       
   366 </xsl:text>
       
   367     <xsl:text>
   328 </xsl:text>
   368 </xsl:text>
   329   </xsl:template>
   369   </xsl:template>
   330   <xsl:variable name="keypads_descs" select="$parsed_widgets/widget[@type = 'Keypad']"/>
   370   <xsl:variable name="keypads_descs" select="$parsed_widgets/widget[@type = 'Keypad']"/>
   331   <xsl:variable name="keypads" select="$hmi_elements[@id = $keypads_descs/@id]"/>
   371   <xsl:variable name="keypads" select="$hmi_elements[@id = $keypads_descs/@id]"/>
   332   <func:function name="func:refered_elements">
   372   <func:function name="func:refered_elements">
   385   <xsl:variable name="detachable_elements" select="$_detachable_elements[not(ancestor::*/@id = $_detachable_elements/@id)]"/>
   425   <xsl:variable name="detachable_elements" select="$_detachable_elements[not(ancestor::*/@id = $_detachable_elements/@id)]"/>
   386   <declarations:detachable-elements/>
   426   <declarations:detachable-elements/>
   387   <xsl:template match="declarations:detachable-elements">
   427   <xsl:template match="declarations:detachable-elements">
   388     <xsl:text>
   428     <xsl:text>
   389 </xsl:text>
   429 </xsl:text>
       
   430     <xsl:text>/* </xsl:text>
       
   431     <xsl:value-of select="local-name()"/>
       
   432     <xsl:text> */
       
   433 </xsl:text>
       
   434     <xsl:text>
       
   435 </xsl:text>
       
   436     <xsl:text>
       
   437 </xsl:text>
   390     <xsl:text>var detachable_elements = {
   438     <xsl:text>var detachable_elements = {
   391 </xsl:text>
   439 </xsl:text>
   392     <xsl:for-each select="$detachable_elements">
   440     <xsl:for-each select="$detachable_elements">
   393       <xsl:text>    "</xsl:text>
   441       <xsl:text>    "</xsl:text>
   394       <xsl:value-of select="@id"/>
   442       <xsl:value-of select="@id"/>
   402       </xsl:if>
   450       </xsl:if>
   403       <xsl:text>
   451       <xsl:text>
   404 </xsl:text>
   452 </xsl:text>
   405     </xsl:for-each>
   453     </xsl:for-each>
   406     <xsl:text>}
   454     <xsl:text>}
       
   455 </xsl:text>
       
   456     <xsl:text>
   407 </xsl:text>
   457 </xsl:text>
   408   </xsl:template>
   458   </xsl:template>
   409   <xsl:variable name="forEach_widgets_ids" select="$parsed_widgets/widget[@type = 'ForEach']/@id"/>
   459   <xsl:variable name="forEach_widgets_ids" select="$parsed_widgets/widget[@type = 'ForEach']/@id"/>
   410   <xsl:variable name="forEach_widgets" select="$hmi_elements[@id = $forEach_widgets_ids]"/>
   460   <xsl:variable name="forEach_widgets" select="$hmi_elements[@id = $forEach_widgets_ids]"/>
   411   <xsl:variable name="in_forEach_widget_ids" select="func:refered_elements($forEach_widgets)[not(@id = $forEach_widgets_ids)]/@id"/>
   461   <xsl:variable name="in_forEach_widget_ids" select="func:refered_elements($forEach_widgets)[not(@id = $forEach_widgets_ids)]/@id"/>
   529   </xsl:template>
   579   </xsl:template>
   530   <declarations:page-desc/>
   580   <declarations:page-desc/>
   531   <xsl:template match="declarations:page-desc">
   581   <xsl:template match="declarations:page-desc">
   532     <xsl:text>
   582     <xsl:text>
   533 </xsl:text>
   583 </xsl:text>
       
   584     <xsl:text>/* </xsl:text>
       
   585     <xsl:value-of select="local-name()"/>
       
   586     <xsl:text> */
       
   587 </xsl:text>
       
   588     <xsl:text>
       
   589 </xsl:text>
       
   590     <xsl:text>
       
   591 </xsl:text>
   534     <xsl:text>var page_desc = {
   592     <xsl:text>var page_desc = {
   535 </xsl:text>
   593 </xsl:text>
   536     <xsl:apply-templates mode="page_desc" select="$hmi_pages"/>
   594     <xsl:apply-templates mode="page_desc" select="$hmi_pages"/>
   537     <xsl:text>}
   595     <xsl:text>}
       
   596 </xsl:text>
       
   597     <xsl:text>
   538 </xsl:text>
   598 </xsl:text>
   539   </xsl:template>
   599   </xsl:template>
   540   <xsl:template mode="per_page_widget_template" match="*"/>
   600   <xsl:template mode="per_page_widget_template" match="*"/>
   541   <debug:detachable-pages/>
   601   <debug:detachable-pages/>
   542   <xsl:template match="debug:detachable-pages">
   602   <xsl:template match="debug:detachable-pages">
       
   603     <xsl:text>
       
   604 </xsl:text>
       
   605     <xsl:text>/* </xsl:text>
       
   606     <xsl:value-of select="local-name()"/>
       
   607     <xsl:text> */
       
   608 </xsl:text>
       
   609     <xsl:text>
       
   610 </xsl:text>
   543     <xsl:text>
   611     <xsl:text>
   544 </xsl:text>
   612 </xsl:text>
   545     <xsl:text>DETACHABLES:
   613     <xsl:text>DETACHABLES:
   546 </xsl:text>
   614 </xsl:text>
   547     <xsl:for-each select="$detachable_elements">
   615     <xsl:for-each select="$detachable_elements">
   556       <xsl:text> </xsl:text>
   624       <xsl:text> </xsl:text>
   557       <xsl:value-of select="."/>
   625       <xsl:value-of select="."/>
   558       <xsl:text>
   626       <xsl:text>
   559 </xsl:text>
   627 </xsl:text>
   560     </xsl:for-each>
   628     </xsl:for-each>
       
   629     <xsl:text>
       
   630 </xsl:text>
   561   </xsl:template>
   631   </xsl:template>
   562   <xsl:template mode="inline_svg" match="@* | node()">
   632   <xsl:template mode="inline_svg" match="@* | node()">
   563     <xsl:if test="not(@id = $discardable_elements/@id)">
   633     <xsl:if test="not(@id = $discardable_elements/@id)">
   564       <xsl:copy>
   634       <xsl:copy>
   565         <xsl:apply-templates mode="inline_svg" select="@* | node()"/>
   635         <xsl:apply-templates mode="inline_svg" select="@* | node()"/>
   670     <xsl:apply-templates mode="inline_svg" select="/"/>
   740     <xsl:apply-templates mode="inline_svg" select="/"/>
   671   </xsl:variable>
   741   </xsl:variable>
   672   <xsl:variable name="result_svg_ns" select="exsl:node-set($result_svg)"/>
   742   <xsl:variable name="result_svg_ns" select="exsl:node-set($result_svg)"/>
   673   <preamble:inline-svg/>
   743   <preamble:inline-svg/>
   674   <xsl:template match="preamble:inline-svg">
   744   <xsl:template match="preamble:inline-svg">
       
   745     <xsl:text>
       
   746 </xsl:text>
       
   747     <xsl:text>/* </xsl:text>
       
   748     <xsl:value-of select="local-name()"/>
       
   749     <xsl:text> */
       
   750 </xsl:text>
       
   751     <xsl:text>
       
   752 </xsl:text>
   675     <xsl:text>let id = document.getElementById.bind(document);
   753     <xsl:text>let id = document.getElementById.bind(document);
   676 </xsl:text>
   754 </xsl:text>
   677     <xsl:text>var svg_root = id("</xsl:text>
   755     <xsl:text>var svg_root = id("</xsl:text>
   678     <xsl:value-of select="$svg/@id"/>
   756     <xsl:value-of select="$svg/@id"/>
   679     <xsl:text>");
   757     <xsl:text>");
   680 </xsl:text>
   758 </xsl:text>
       
   759     <xsl:text>
       
   760 </xsl:text>
   681   </xsl:template>
   761   </xsl:template>
   682   <debug:clone-unlinking/>
   762   <debug:clone-unlinking/>
   683   <xsl:template match="debug:clone-unlinking">
   763   <xsl:template match="debug:clone-unlinking">
       
   764     <xsl:text>
       
   765 </xsl:text>
       
   766     <xsl:text>/* </xsl:text>
       
   767     <xsl:value-of select="local-name()"/>
       
   768     <xsl:text> */
       
   769 </xsl:text>
       
   770     <xsl:text>
       
   771 </xsl:text>
   684     <xsl:text>
   772     <xsl:text>
   685 </xsl:text>
   773 </xsl:text>
   686     <xsl:text>Unlinked :
   774     <xsl:text>Unlinked :
   687 </xsl:text>
   775 </xsl:text>
   688     <xsl:for-each select="$to_unlink">
   776     <xsl:for-each select="$to_unlink">
   689       <xsl:value-of select="@id"/>
   777       <xsl:value-of select="@id"/>
   690       <xsl:text>
   778       <xsl:text>
   691 </xsl:text>
   779 </xsl:text>
   692     </xsl:for-each>
   780     </xsl:for-each>
       
   781     <xsl:text>
       
   782 </xsl:text>
   693   </xsl:template>
   783   </xsl:template>
   694   <xsl:template mode="hmi_elements" match="svg:*">
   784   <xsl:template mode="hmi_elements" match="svg:*">
   695     <xsl:variable name="widget" select="func:widget(@id)"/>
   785     <xsl:variable name="widget" select="func:widget(@id)"/>
   696     <xsl:variable name="eltid" select="@id"/>
   786     <xsl:variable name="eltid" select="@id"/>
   697     <xsl:text>  "</xsl:text>
   787     <xsl:text>  "</xsl:text>
   698     <xsl:value-of select="@id"/>
   788     <xsl:value-of select="@id"/>
   699     <xsl:text>": {
   789     <xsl:text>": new </xsl:text>
   700 </xsl:text>
       
   701     <xsl:text>    type: "</xsl:text>
       
   702     <xsl:value-of select="$widget/@type"/>
   790     <xsl:value-of select="$widget/@type"/>
   703     <xsl:text>",
   791     <xsl:text>Widget ({
   704 </xsl:text>
   792 </xsl:text>
   705     <xsl:text>    args: [
   793     <xsl:text>    args: [
   706 </xsl:text>
   794 </xsl:text>
   707     <xsl:for-each select="$widget/arg">
   795     <xsl:for-each select="$widget/arg">
   708       <xsl:text>        "</xsl:text>
   796       <xsl:text>        "</xsl:text>
   757       <xsl:with-param name="hmi_element" select="."/>
   845       <xsl:with-param name="hmi_element" select="."/>
   758     </xsl:apply-templates>
   846     </xsl:apply-templates>
   759     <xsl:apply-templates mode="widget_subscribe" select="$widget">
   847     <xsl:apply-templates mode="widget_subscribe" select="$widget">
   760       <xsl:with-param name="hmi_element" select="."/>
   848       <xsl:with-param name="hmi_element" select="."/>
   761     </xsl:apply-templates>
   849     </xsl:apply-templates>
   762     <xsl:text>  }</xsl:text>
   850     <xsl:text>  })</xsl:text>
   763     <xsl:if test="position()!=last()">
   851     <xsl:if test="position()!=last()">
   764       <xsl:text>,</xsl:text>
   852       <xsl:text>,</xsl:text>
   765     </xsl:if>
   853     </xsl:if>
   766     <xsl:text>
   854     <xsl:text>
   767 </xsl:text>
   855 </xsl:text>
   768   </xsl:template>
   856   </xsl:template>
       
   857   <func:function name="func:unique_types">
       
   858     <xsl:param name="elts_with_type"/>
       
   859     <xsl:choose>
       
   860       <xsl:when test="count($elts_with_type) &gt; 1">
       
   861         <xsl:variable name="prior_results" select="func:unique_types($elts_with_type[position()!=last()])"/>
       
   862         <xsl:choose>
       
   863           <xsl:when test="$elts_with_type[last()][@type = $prior_results/@type]">
       
   864             <func:result select="$prior_results"/>
       
   865           </xsl:when>
       
   866           <xsl:otherwise>
       
   867             <func:result select="$prior_results | $elts_with_type[last()]"/>
       
   868           </xsl:otherwise>
       
   869         </xsl:choose>
       
   870       </xsl:when>
       
   871       <xsl:otherwise>
       
   872         <func:result select="$elts_with_type"/>
       
   873       </xsl:otherwise>
       
   874     </xsl:choose>
       
   875   </func:function>
       
   876   <preamble:widget-base-class/>
       
   877   <xsl:template match="preamble:widget-base-class">
       
   878     <xsl:text>
       
   879 </xsl:text>
       
   880     <xsl:text>/* </xsl:text>
       
   881     <xsl:value-of select="local-name()"/>
       
   882     <xsl:text> */
       
   883 </xsl:text>
       
   884     <xsl:text>
       
   885 </xsl:text>
       
   886     <xsl:text>class Widget {
       
   887 </xsl:text>
       
   888     <xsl:text>    constructor(members){
       
   889 </xsl:text>
       
   890     <xsl:text>        Object.keys(members).forEach(prop =&gt; this[prop]=members[prop]);
       
   891 </xsl:text>
       
   892     <xsl:text>    }
       
   893 </xsl:text>
       
   894     <xsl:text>}
       
   895 </xsl:text>
       
   896     <xsl:text>
       
   897 </xsl:text>
       
   898   </xsl:template>
       
   899   <preamble:hmi-classes/>
       
   900   <xsl:template match="preamble:hmi-classes">
       
   901     <xsl:text>
       
   902 </xsl:text>
       
   903     <xsl:text>/* </xsl:text>
       
   904     <xsl:value-of select="local-name()"/>
       
   905     <xsl:text> */
       
   906 </xsl:text>
       
   907     <xsl:text>
       
   908 </xsl:text>
       
   909     <xsl:variable name="used_widget_types" select="func:unique_types($parsed_widgets/widget)"/>
       
   910     <xsl:apply-templates mode="widget_class" select="$used_widget_types"/>
       
   911     <xsl:text>
       
   912 </xsl:text>
       
   913   </xsl:template>
       
   914   <xsl:template mode="widget_class" match="widget">
       
   915     <xsl:text>class </xsl:text>
       
   916     <xsl:value-of select="@type"/>
       
   917     <xsl:text>Widget extends Widget{
       
   918 </xsl:text>
       
   919     <xsl:text>    /* empty class, as </xsl:text>
       
   920     <xsl:value-of select="@type"/>
       
   921     <xsl:text> widget didn't provide any */
       
   922 </xsl:text>
       
   923     <xsl:text>}
       
   924 </xsl:text>
       
   925   </xsl:template>
   769   <preamble:hmi-elements/>
   926   <preamble:hmi-elements/>
   770   <xsl:template match="preamble:hmi-elements">
   927   <xsl:template match="preamble:hmi-elements">
       
   928     <xsl:text>
       
   929 </xsl:text>
       
   930     <xsl:text>/* </xsl:text>
       
   931     <xsl:value-of select="local-name()"/>
       
   932     <xsl:text> */
       
   933 </xsl:text>
       
   934     <xsl:text>
       
   935 </xsl:text>
   771     <xsl:text>var hmi_widgets = {
   936     <xsl:text>var hmi_widgets = {
   772 </xsl:text>
   937 </xsl:text>
   773     <xsl:apply-templates mode="hmi_elements" select="$hmi_elements"/>
   938     <xsl:apply-templates mode="hmi_elements" select="$hmi_elements"/>
   774     <xsl:text>}
   939     <xsl:text>}
       
   940 </xsl:text>
       
   941     <xsl:text>
   775 </xsl:text>
   942 </xsl:text>
   776   </xsl:template>
   943   </xsl:template>
   777   <xsl:template mode="widget_subscribe" match="widget">
   944   <xsl:template mode="widget_subscribe" match="widget">
   778     <xsl:text>    sub: subscribe,
   945     <xsl:text>    sub: subscribe,
   779 </xsl:text>
   946 </xsl:text>
  1669     <xsl:text>    apply_cache: foreach_apply_cache,
  1836     <xsl:text>    apply_cache: foreach_apply_cache,
  1670 </xsl:text>
  1837 </xsl:text>
  1671   </xsl:template>
  1838   </xsl:template>
  1672   <definitions:foreach/>
  1839   <definitions:foreach/>
  1673   <xsl:template match="definitions:foreach">
  1840   <xsl:template match="definitions:foreach">
       
  1841     <xsl:text>
       
  1842 </xsl:text>
       
  1843     <xsl:text>/* </xsl:text>
       
  1844     <xsl:value-of select="local-name()"/>
       
  1845     <xsl:text> */
       
  1846 </xsl:text>
       
  1847     <xsl:text>
       
  1848 </xsl:text>
  1674     <xsl:text>function foreach_unsubscribe(){
  1849     <xsl:text>function foreach_unsubscribe(){
  1675 </xsl:text>
  1850 </xsl:text>
  1676     <xsl:text>    for(let item of this.items){
  1851     <xsl:text>    for(let item of this.items){
  1677 </xsl:text>
  1852 </xsl:text>
  1678     <xsl:text>        for(let widget of item) {
  1853     <xsl:text>        for(let widget of item) {
  1772     <xsl:text>    jumps_need_update = true;
  1947     <xsl:text>    jumps_need_update = true;
  1773 </xsl:text>
  1948 </xsl:text>
  1774     <xsl:text>    requestHMIAnimation();
  1949     <xsl:text>    requestHMIAnimation();
  1775 </xsl:text>
  1950 </xsl:text>
  1776     <xsl:text>}
  1951     <xsl:text>}
       
  1952 </xsl:text>
       
  1953     <xsl:text>
  1777 </xsl:text>
  1954 </xsl:text>
  1778     <xsl:text>
  1955     <xsl:text>
  1779 </xsl:text>
  1956 </xsl:text>
  1780   </xsl:template>
  1957   </xsl:template>
  1781   <xsl:template mode="widget_defs" match="widget[@type='Input']">
  1958   <xsl:template mode="widget_defs" match="widget[@type='Input']">
  2081       </xsl:if>
  2258       </xsl:if>
  2082     </xsl:if>
  2259     </xsl:if>
  2083   </xsl:template>
  2260   </xsl:template>
  2084   <declarations:jump/>
  2261   <declarations:jump/>
  2085   <xsl:template match="declarations:jump">
  2262   <xsl:template match="declarations:jump">
       
  2263     <xsl:text>
       
  2264 </xsl:text>
       
  2265     <xsl:text>/* </xsl:text>
       
  2266     <xsl:value-of select="local-name()"/>
       
  2267     <xsl:text> */
       
  2268 </xsl:text>
       
  2269     <xsl:text>
       
  2270 </xsl:text>
  2086     <xsl:text>var jumps_need_update = false;
  2271     <xsl:text>var jumps_need_update = false;
  2087 </xsl:text>
  2272 </xsl:text>
  2088     <xsl:text>var jump_history = [[default_page, undefined]];
  2273     <xsl:text>var jump_history = [[default_page, undefined]];
  2089 </xsl:text>
  2274 </xsl:text>
  2090     <xsl:text>
  2275     <xsl:text>
  2094     <xsl:text>    page_desc[current_visible_page].jumps.map(w=&gt;w.notify_page_change(current_visible_page,current_page_index));
  2279     <xsl:text>    page_desc[current_visible_page].jumps.map(w=&gt;w.notify_page_change(current_visible_page,current_page_index));
  2095 </xsl:text>
  2280 </xsl:text>
  2096     <xsl:text>    jumps_need_update = false;
  2281     <xsl:text>    jumps_need_update = false;
  2097 </xsl:text>
  2282 </xsl:text>
  2098     <xsl:text>};
  2283     <xsl:text>};
       
  2284 </xsl:text>
       
  2285     <xsl:text>
  2099 </xsl:text>
  2286 </xsl:text>
  2100     <xsl:text>
  2287     <xsl:text>
  2101 </xsl:text>
  2288 </xsl:text>
  2102   </xsl:template>
  2289   </xsl:template>
  2103   <declarations:keypad/>
  2290   <declarations:keypad/>
  2104   <xsl:template match="declarations:keypad">
  2291   <xsl:template match="declarations:keypad">
       
  2292     <xsl:text>
       
  2293 </xsl:text>
       
  2294     <xsl:text>/* </xsl:text>
       
  2295     <xsl:value-of select="local-name()"/>
       
  2296     <xsl:text> */
       
  2297 </xsl:text>
       
  2298     <xsl:text>
       
  2299 </xsl:text>
  2105     <xsl:text>
  2300     <xsl:text>
  2106 </xsl:text>
  2301 </xsl:text>
  2107     <xsl:text>var keypads = {
  2302     <xsl:text>var keypads = {
  2108 </xsl:text>
  2303 </xsl:text>
  2109     <xsl:for-each select="$keypads_descs">
  2304     <xsl:for-each select="$keypads_descs">
  2121         <xsl:text>],
  2316         <xsl:text>],
  2122 </xsl:text>
  2317 </xsl:text>
  2123       </xsl:for-each>
  2318       </xsl:for-each>
  2124     </xsl:for-each>
  2319     </xsl:for-each>
  2125     <xsl:text>}
  2320     <xsl:text>}
       
  2321 </xsl:text>
       
  2322     <xsl:text>
  2126 </xsl:text>
  2323 </xsl:text>
  2127   </xsl:template>
  2324   </xsl:template>
  2128   <xsl:template mode="widget_defs" match="widget[@type='Keypad']">
  2325   <xsl:template mode="widget_defs" match="widget[@type='Keypad']">
  2129     <xsl:param name="hmi_element"/>
  2326     <xsl:param name="hmi_element"/>
  2130     <xsl:call-template name="defs_by_labels">
  2327     <xsl:call-template name="defs_by_labels">
  2451   </xsl:template>
  2648   </xsl:template>
  2452   <xsl:template match="/">
  2649   <xsl:template match="/">
  2453     <xsl:comment>
  2650     <xsl:comment>
  2454       <xsl:text>Made with SVGHMI. https://beremiz.org</xsl:text>
  2651       <xsl:text>Made with SVGHMI. https://beremiz.org</xsl:text>
  2455     </xsl:comment>
  2652     </xsl:comment>
  2456     <xsl:for-each select="document('')/*/debug:*">
  2653     <xsl:comment>
  2457       <xsl:comment>
  2654       <xsl:apply-templates select="document('')/*/debug:*"/>
  2458         <xsl:value-of select="local-name()"/>
  2655     </xsl:comment>
  2459         <xsl:text> :
  2656     <html xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/1999/xhtml">
  2460 </xsl:text>
       
  2461         <xsl:apply-templates select="."/>
       
  2462       </xsl:comment>
       
  2463     </xsl:for-each>
       
  2464     <html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
       
  2465       <head/>
  2657       <head/>
  2466       <body style="margin:0;overflow:hidden;">
  2658       <body style="margin:0;overflow:hidden;">
  2467         <xsl:copy-of select="$result_svg"/>
  2659         <xsl:copy-of select="$result_svg"/>
  2468         <script>
  2660         <script>
  2469           <xsl:text>
  2661           <xsl:text>