svghmi/gen_index_xhtml.xslt
branchsvghmi
changeset 2943 304e88bae115
parent 2942 b07ad97e6019
child 2944 2a20038fbea9
equal deleted inserted replaced
2942:b07ad97e6019 2943:304e88bae115
     1 <?xml version="1.0"?>
     1 <?xml version="1.0"?>
     2 <xsl:stylesheet xmlns:func="http://exslt.org/functions" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:epilogue="epilogue" xmlns:svg="http://www.w3.org/2000/svg" xmlns:str="http://exslt.org/strings" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:exsl="http://exslt.org/common" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:preamble="preamble" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ns="beremiz" xmlns:cc="http://creativecommons.org/ns#" xmlns:regexp="http://exslt.org/regular-expressions" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:debug="debug" xmlns:dc="http://purl.org/dc/elements/1.1/" extension-element-prefixes="ns func exsl regexp str dyn" version="1.0" exclude-result-prefixes="ns func exsl regexp str dyn debug preamble epilogue">
     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 method="xml" cdata-section-elements="xhtml:script"/>
     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">
   381       </xsl:otherwise>
   381       </xsl:otherwise>
   382     </xsl:choose>
   382     </xsl:choose>
   383   </func:function>
   383   </func:function>
   384   <xsl:variable name="_detachable_elements" select="func:detachable_elements($hmi_pages | $keypads)"/>
   384   <xsl:variable name="_detachable_elements" select="func:detachable_elements($hmi_pages | $keypads)"/>
   385   <xsl:variable name="detachable_elements" select="$_detachable_elements[not(ancestor::*/@id = $_detachable_elements/@id)]"/>
   385   <xsl:variable name="detachable_elements" select="$_detachable_elements[not(ancestor::*/@id = $_detachable_elements/@id)]"/>
   386   <epilogue:detachable-elements/>
   386   <declarations:detachable-elements/>
   387   <xsl:template match="epilogue:detachable-elements">
   387   <xsl:template match="declarations:detachable-elements">
   388     <xsl:text>
   388     <xsl:text>
   389 </xsl:text>
   389 </xsl:text>
   390     <xsl:text>var detachable_elements = {
   390     <xsl:text>var detachable_elements = {
   391 </xsl:text>
   391 </xsl:text>
   392     <xsl:for-each select="$detachable_elements">
   392     <xsl:for-each select="$detachable_elements">
   525       <xsl:text>,</xsl:text>
   525       <xsl:text>,</xsl:text>
   526     </xsl:if>
   526     </xsl:if>
   527     <xsl:text>
   527     <xsl:text>
   528 </xsl:text>
   528 </xsl:text>
   529   </xsl:template>
   529   </xsl:template>
   530   <epilogue:page-desc/>
   530   <declarations:page-desc/>
   531   <xsl:template match="epilogue:page-desc">
   531   <xsl:template match="declarations:page-desc">
   532     <xsl:text>
   532     <xsl:text>
   533 </xsl:text>
   533 </xsl:text>
   534     <xsl:text>var page_desc = {
   534     <xsl:text>var page_desc = {
   535 </xsl:text>
   535 </xsl:text>
   536     <xsl:apply-templates mode="page_desc" select="$hmi_pages"/>
   536     <xsl:apply-templates mode="page_desc" select="$hmi_pages"/>
  1542     <xsl:text>    unsub: foreach_unsubscribe,
  1542     <xsl:text>    unsub: foreach_unsubscribe,
  1543 </xsl:text>
  1543 </xsl:text>
  1544     <xsl:text>    apply_cache: foreach_apply_cache,
  1544     <xsl:text>    apply_cache: foreach_apply_cache,
  1545 </xsl:text>
  1545 </xsl:text>
  1546   </xsl:template>
  1546   </xsl:template>
  1547   <epilogue:foreach/>
  1547   <definitions:foreach/>
  1548   <xsl:template match="epilogue:foreach">
  1548   <xsl:template match="definitions:foreach">
  1549     <xsl:text>function foreach_unsubscribe(){
  1549     <xsl:text>function foreach_unsubscribe(){
  1550 </xsl:text>
  1550 </xsl:text>
  1551     <xsl:text>    for(let item of this.items){
  1551     <xsl:text>    for(let item of this.items){
  1552 </xsl:text>
  1552 </xsl:text>
  1553     <xsl:text>        for(let widget of item) {
  1553     <xsl:text>        for(let widget of item) {
  1954           <xsl:text>")</xsl:text>
  1954           <xsl:text>")</xsl:text>
  1955         </xsl:message>
  1955         </xsl:message>
  1956       </xsl:if>
  1956       </xsl:if>
  1957     </xsl:if>
  1957     </xsl:if>
  1958   </xsl:template>
  1958   </xsl:template>
  1959   <epilogue:jump/>
  1959   <declarations:jump/>
  1960   <xsl:template match="epilogue:jump">
  1960   <xsl:template match="declarations:jump">
  1961     <xsl:text>var jumps_need_update = false;
  1961     <xsl:text>var jumps_need_update = false;
  1962 </xsl:text>
  1962 </xsl:text>
  1963     <xsl:text>var jump_history = [[default_page, undefined]];
  1963     <xsl:text>var jump_history = [[default_page, undefined]];
  1964 </xsl:text>
  1964 </xsl:text>
  1965     <xsl:text>
  1965     <xsl:text>
  1973     <xsl:text>};
  1973     <xsl:text>};
  1974 </xsl:text>
  1974 </xsl:text>
  1975     <xsl:text>
  1975     <xsl:text>
  1976 </xsl:text>
  1976 </xsl:text>
  1977   </xsl:template>
  1977   </xsl:template>
  1978   <epilogue:keypad/>
  1978   <declarations:keypad/>
  1979   <xsl:template match="epilogue:keypad">
  1979   <xsl:template match="declarations:keypad">
  1980     <xsl:text>
  1980     <xsl:text>
  1981 </xsl:text>
  1981 </xsl:text>
  1982     <xsl:text>var keypads = {
  1982     <xsl:text>var keypads = {
  1983 </xsl:text>
  1983 </xsl:text>
  1984     <xsl:for-each select="$keypads_descs">
  1984     <xsl:for-each select="$keypads_descs">
  2339     <html xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/1999/xhtml">
  2339     <html xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/1999/xhtml">
  2340       <head/>
  2340       <head/>
  2341       <body style="margin:0;overflow:hidden;">
  2341       <body style="margin:0;overflow:hidden;">
  2342         <xsl:copy-of select="$result_svg"/>
  2342         <xsl:copy-of select="$result_svg"/>
  2343         <script>
  2343         <script>
       
  2344           <xsl:text>
       
  2345 //
       
  2346 //
       
  2347 // Early independent declarations 
       
  2348 //
       
  2349 //
       
  2350 </xsl:text>
  2344           <xsl:apply-templates select="document('')/*/preamble:*"/>
  2351           <xsl:apply-templates select="document('')/*/preamble:*"/>
       
  2352           <xsl:text>
       
  2353 //
       
  2354 //
       
  2355 // Declarations depending on preamble 
       
  2356 //
       
  2357 //
       
  2358 </xsl:text>
       
  2359           <xsl:apply-templates select="document('')/*/declarations:*"/>
       
  2360           <xsl:text>
       
  2361 //
       
  2362 //
       
  2363 // Order independent declaration and code 
       
  2364 //
       
  2365 //
       
  2366 </xsl:text>
       
  2367           <xsl:apply-templates select="document('')/*/definitions:*"/>
       
  2368           <xsl:text>
       
  2369 //
       
  2370 //
       
  2371 // Statements that needs to be at the end 
       
  2372 //
       
  2373 //
       
  2374 </xsl:text>
  2345           <xsl:apply-templates select="document('')/*/epilogue:*"/>
  2375           <xsl:apply-templates select="document('')/*/epilogue:*"/>
  2346           <xsl:text>// svghmi.js
  2376           <xsl:text>// svghmi.js
  2347 </xsl:text>
  2377 </xsl:text>
  2348           <xsl:text>
  2378           <xsl:text>
  2349 </xsl:text>
  2379 </xsl:text>