svghmi/gen_index_xhtml.xslt
branchsvghmi
changeset 3170 aaa203270ab0
parent 3165 2db69e2c5673
child 3175 b2ba6eeb61ec
equal deleted inserted replaced
3169:91207ee5b6af 3170:aaa203270ab0
     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>
   439         <func:result select="$descend"/>
   439         <func:result select="$descend"/>
   440       </xsl:otherwise>
   440       </xsl:otherwise>
   441     </xsl:choose>
   441     </xsl:choose>
   442   </func:function>
   442   </func:function>
   443   <xsl:variable name="_overlapping_geometry">
   443   <xsl:variable name="_overlapping_geometry">
   444     <xsl:variable name="k" select="'overlapping'"/>
       
   445     <xsl:variable name="m" select="'computing belonging of widgets to pages'"/>
       
   446     <xsl:value-of select="ns:ProgressStart($k, $m)"/>
       
   447     <xsl:for-each select="$hmi_pages | $keypads">
   444     <xsl:for-each select="$hmi_pages | $keypads">
   448       <xsl:variable name="k2" select="concat('overlapping:', @id)"/>
   445       <xsl:variable name="k" select="concat('overlapping:', @id)"/>
   449       <xsl:variable name="m2" select="concat('collecting membership of ', @inkscape:label)"/>
   446       <xsl:value-of select="ns:ProgressStart($k, concat('collecting membership of ', @inkscape:label))"/>
   450       <xsl:value-of select="ns:ProgressStart($k2, $m2)"/>
       
   451       <elt>
   447       <elt>
   452         <xsl:attribute name="id">
   448         <xsl:attribute name="id">
   453           <xsl:value-of select="@id"/>
   449           <xsl:value-of select="@id"/>
   454         </xsl:attribute>
   450         </xsl:attribute>
   455         <xsl:copy-of select="func:overlapping_geometry(.)"/>
   451         <xsl:copy-of select="func:overlapping_geometry(.)"/>
   456       </elt>
   452       </elt>
   457       <xsl:value-of select="ns:ProgressEnd($k2, $m2)"/>
   453       <xsl:value-of select="ns:ProgressEnd($k)"/>
   458     </xsl:for-each>
   454     </xsl:for-each>
   459     <xsl:value-of select="ns:ProgressEnd($k, $m)"/>
       
   460   </xsl:variable>
   455   </xsl:variable>
   461   <xsl:variable name="overlapping_geometry" select="exsl:node-set($_overlapping_geometry)"/>
   456   <xsl:variable name="overlapping_geometry" select="exsl:node-set($_overlapping_geometry)"/>
   462   <func:function name="func:all_related_elements">
   457   <func:function name="func:all_related_elements">
   463     <xsl:param name="page"/>
   458     <xsl:param name="page"/>
   464     <xsl:variable name="page_overlapping_geometry" select="$overlapping_geometry/elt[@id = $page/@id]/*"/>
   459     <xsl:variable name="page_overlapping_geometry" select="$overlapping_geometry/elt[@id = $page/@id]/*"/>
   542         <xsl:value-of select="@id"/>
   537         <xsl:value-of select="@id"/>
   543         <xsl:text> is nested in another HMI:Page</xsl:text>
   538         <xsl:text> is nested in another HMI:Page</xsl:text>
   544       </xsl:message>
   539       </xsl:message>
   545     </xsl:if>
   540     </xsl:if>
   546     <xsl:variable name="desc" select="func:widget(@id)"/>
   541     <xsl:variable name="desc" select="func:widget(@id)"/>
   547     <xsl:variable name="msg" select="concat('generating page description ', $desc/arg[1]/@value)"/>
   542     <xsl:variable name="pagename" select="$desc/arg[1]/@value"/>
   548     <xsl:value-of select="ns:ProgressStart($msg)"/>
   543     <xsl:variable name="msg" select="concat('generating page description ', $pagename)"/>
       
   544     <xsl:value-of select="ns:ProgressStart($pagename, $msg)"/>
   549     <xsl:variable name="page" select="."/>
   545     <xsl:variable name="page" select="."/>
   550     <xsl:variable name="p" select="$geometry[@Id = $page/@id]"/>
   546     <xsl:variable name="p" select="$geometry[@Id = $page/@id]"/>
   551     <xsl:variable name="page_all_elements" select="func:all_related_elements($page)"/>
   547     <xsl:variable name="page_all_elements" select="func:all_related_elements($page)"/>
   552     <xsl:variable name="all_page_widgets" select="$hmi_widgets[@id = $page_all_elements/@id and @id != $page/@id]"/>
   548     <xsl:variable name="all_page_widgets" select="$hmi_widgets[@id = $page_all_elements/@id and @id != $page/@id]"/>
   553     <xsl:variable name="page_managed_widgets" select="$all_page_widgets[not(@id=$in_forEach_widget_ids)]"/>
   549     <xsl:variable name="page_managed_widgets" select="$all_page_widgets[not(@id=$in_forEach_widget_ids)]"/>
   554     <xsl:variable name="page_relative_widgets" select="$page_managed_widgets[func:is_descendant_path(func:widget(@id)/path/@value, $desc/path/@value)]"/>
   550     <xsl:variable name="page_relative_widgets" select="$page_managed_widgets[func:is_descendant_path(func:widget(@id)/path/@value, $desc/path/@value)]"/>
   555     <xsl:variable name="sumarized_page" select="func:sumarized_elements($page_all_elements)"/>
   551     <xsl:variable name="sumarized_page" select="func:sumarized_elements($page_all_elements)"/>
   556     <xsl:variable name="required_detachables" select="$sumarized_page/&#10;           ancestor-or-self::*[@id = $detachable_elements/@id]"/>
   552     <xsl:variable name="required_detachables" select="$sumarized_page/&#10;           ancestor-or-self::*[@id = $detachable_elements/@id]"/>
   557     <xsl:text>  "</xsl:text>
   553     <xsl:text>  "</xsl:text>
   558     <xsl:value-of select="$desc/arg[1]/@value"/>
   554     <xsl:value-of select="$pagename"/>
   559     <xsl:text>": {
   555     <xsl:text>": {
   560 </xsl:text>
   556 </xsl:text>
   561     <xsl:text>    bbox: [</xsl:text>
   557     <xsl:text>    bbox: [</xsl:text>
   562     <xsl:value-of select="$p/@x"/>
   558     <xsl:value-of select="$p/@x"/>
   563     <xsl:text>, </xsl:text>
   559     <xsl:text>, </xsl:text>
   644     <xsl:if test="position()!=last()">
   640     <xsl:if test="position()!=last()">
   645       <xsl:text>,</xsl:text>
   641       <xsl:text>,</xsl:text>
   646     </xsl:if>
   642     </xsl:if>
   647     <xsl:text>
   643     <xsl:text>
   648 </xsl:text>
   644 </xsl:text>
   649     <xsl:value-of select="ns:ProgressEnd($msg)"/>
   645     <xsl:value-of select="ns:ProgressEnd($pagename)"/>
   650   </xsl:template>
   646   </xsl:template>
   651   <definitions:page-desc/>
   647   <definitions:page-desc/>
   652   <xsl:template match="definitions:page-desc">
   648   <xsl:template match="definitions:page-desc">
   653     <xsl:text>
   649     <xsl:text>
   654 </xsl:text>
   650 </xsl:text>
  1695 </xsl:text>
  1691 </xsl:text>
  1696     <xsl:text>
  1692     <xsl:text>
  1697 </xsl:text>
  1693 </xsl:text>
  1698   </xsl:template>
  1694   </xsl:template>
  1699   <xsl:variable name="excluded_types" select="str:split('Page VarInit VarInitPersistent')"/>
  1695   <xsl:variable name="excluded_types" select="str:split('Page VarInit VarInitPersistent')"/>
  1700   <xsl:key name="TypesKey" match="widget" use="@type"/>
  1696   <xsl:key use="@type" name="TypesKey" match="widget"/>
  1701   <declarations:hmi-classes/>
  1697   <declarations:hmi-classes/>
  1702   <xsl:template match="declarations:hmi-classes">
  1698   <xsl:template match="declarations:hmi-classes">
  1703     <xsl:text>
  1699     <xsl:text>
  1704 </xsl:text>
  1700 </xsl:text>
  1705     <xsl:text>/* </xsl:text>
  1701     <xsl:text>/* </xsl:text>
  6789       <xsl:text>Made with SVGHMI. https://beremiz.org</xsl:text>
  6785       <xsl:text>Made with SVGHMI. https://beremiz.org</xsl:text>
  6790     </xsl:comment>
  6786     </xsl:comment>
  6791     <xsl:comment>
  6787     <xsl:comment>
  6792       <xsl:apply-templates select="document('')/*/debug:*"/>
  6788       <xsl:apply-templates select="document('')/*/debug:*"/>
  6793     </xsl:comment>
  6789     </xsl:comment>
  6794     <html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  6790     <html xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/1999/xhtml">
  6795       <head/>
  6791       <head/>
  6796       <body style="margin:0;overflow:hidden;user-select:none;touch-action:none;">
  6792       <body style="margin:0;overflow:hidden;user-select:none;touch-action:none;">
  6797         <xsl:copy-of select="$result_svg"/>
  6793         <xsl:copy-of select="$result_svg"/>
  6798         <script>
  6794         <script>
  6799           <xsl:text>
  6795           <xsl:text>