svghmi/gen_index_xhtml.xslt
branchsvghmi
changeset 3186 1e9b9d7451cd
parent 3181 50d0fef791d5
child 3187 ba8ff21fd82b
equal deleted inserted replaced
3181:50d0fef791d5 3186:1e9b9d7451cd
     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>
   470       <xsl:otherwise>
   470       <xsl:otherwise>
   471         <func:result select="/.."/>
   471         <func:result select="/.."/>
   472       </xsl:otherwise>
   472       </xsl:otherwise>
   473     </xsl:choose>
   473     </xsl:choose>
   474   </func:function>
   474   </func:function>
   475   <xsl:variable name="required_elements" select="//svg:defs/descendant-or-self::svg:*&#10;       | func:required_elements($hmi_pages | $keypads)/ancestor-or-self::svg:*"/>
   475   <xsl:variable name="required_page_elements" select="func:required_elements($hmi_pages | $keypads)/ancestor-or-self::svg:*"/>
       
   476   <xsl:variable name="hmi_lists_descs" select="$parsed_widgets/widget[@type = 'List']"/>
       
   477   <xsl:variable name="hmi_lists" select="$hmi_elements[@id = $hmi_lists_descs/@id]"/>
       
   478   <xsl:variable name="required_list_elements" select="func:refered_elements($hmi_lists[@id = $required_page_elements/@id])"/>
       
   479   <xsl:variable name="required_elements" select="//svg:defs/descendant-or-self::svg:*&#10;       | $required_list_elements&#10;       | $required_page_elements"/>
   476   <xsl:variable name="discardable_elements" select="//svg:*[not(@id = $required_elements/@id)]"/>
   480   <xsl:variable name="discardable_elements" select="//svg:*[not(@id = $required_elements/@id)]"/>
   477   <func:function name="func:sumarized_elements">
   481   <func:function name="func:sumarized_elements">
   478     <xsl:param name="elements"/>
   482     <xsl:param name="elements"/>
   479     <xsl:variable name="short_list" select="$elements[not(ancestor::*/@id = $elements/@id)]"/>
   483     <xsl:variable name="short_list" select="$elements[not(ancestor::*/@id = $elements/@id)]"/>
   480     <xsl:variable name="filled_groups" select="$short_list/parent::*[&#10;        not(child::*[&#10;            not(@id = $discardable_elements/@id) and&#10;            not(@id = $short_list/@id)&#10;        ])]"/>
   484     <xsl:variable name="filled_groups" select="$short_list/parent::*[&#10;        not(child::*[&#10;            not(@id = $discardable_elements/@id) and&#10;            not(@id = $short_list/@id)&#10;        ])]"/>
   738   <xsl:template xmlns="http://www.w3.org/2000/svg" mode="inline_svg" match="svg:text/@inkscape:label[starts-with(., '_')]">
   742   <xsl:template xmlns="http://www.w3.org/2000/svg" mode="inline_svg" match="svg:text/@inkscape:label[starts-with(., '_')]">
   739     <xsl:attribute name="{name()}">
   743     <xsl:attribute name="{name()}">
   740       <xsl:value-of select="substring(., 2)"/>
   744       <xsl:value-of select="substring(., 2)"/>
   741     </xsl:attribute>
   745     </xsl:attribute>
   742   </xsl:template>
   746   </xsl:template>
   743   <xsl:variable name="hmi_lists_descs" select="$parsed_widgets/widget[@type = 'List']"/>
       
   744   <xsl:variable name="hmi_lists" select="$hmi_elements[@id = $hmi_lists_descs/@id]"/>
       
   745   <xsl:variable name="targets_not_to_unlink" select="$hmi_lists/descendant-or-self::svg:*"/>
   747   <xsl:variable name="targets_not_to_unlink" select="$hmi_lists/descendant-or-self::svg:*"/>
   746   <xsl:variable name="to_unlink" select="$hmi_elements[not(@id = $hmi_pages/@id)]/descendant-or-self::svg:use"/>
   748   <xsl:variable name="to_unlink" select="$hmi_elements[not(@id = $hmi_pages/@id)]/descendant-or-self::svg:use"/>
   747   <func:function name="func:is_unlinkable">
   749   <func:function name="func:is_unlinkable">
   748     <xsl:param name="targetid"/>
   750     <xsl:param name="targetid"/>
   749     <xsl:param name="eltid"/>
   751     <xsl:param name="eltid"/>
  1691 </xsl:text>
  1693 </xsl:text>
  1692     <xsl:text>
  1694     <xsl:text>
  1693 </xsl:text>
  1695 </xsl:text>
  1694   </xsl:template>
  1696   </xsl:template>
  1695   <xsl:variable name="excluded_types" select="str:split('Page VarInit VarInitPersistent')"/>
  1697   <xsl:variable name="excluded_types" select="str:split('Page VarInit VarInitPersistent')"/>
  1696   <xsl:key name="TypesKey" match="widget" use="@type"/>
  1698   <xsl:key use="@type" name="TypesKey" match="widget"/>
  1697   <declarations:hmi-classes/>
  1699   <declarations:hmi-classes/>
  1698   <xsl:template match="declarations:hmi-classes">
  1700   <xsl:template match="declarations:hmi-classes">
  1699     <xsl:text>
  1701     <xsl:text>
  1700 </xsl:text>
  1702 </xsl:text>
  1701     <xsl:text>/* </xsl:text>
  1703     <xsl:text>/* </xsl:text>
  6806       <xsl:text>Made with SVGHMI. https://beremiz.org</xsl:text>
  6808       <xsl:text>Made with SVGHMI. https://beremiz.org</xsl:text>
  6807     </xsl:comment>
  6809     </xsl:comment>
  6808     <xsl:comment>
  6810     <xsl:comment>
  6809       <xsl:apply-templates select="document('')/*/debug:*"/>
  6811       <xsl:apply-templates select="document('')/*/debug:*"/>
  6810     </xsl:comment>
  6812     </xsl:comment>
  6811     <html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  6813     <html xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/1999/xhtml">
  6812       <head/>
  6814       <head/>
  6813       <body style="margin:0;overflow:hidden;user-select:none;touch-action:none;">
  6815       <body style="margin:0;overflow:hidden;user-select:none;touch-action:none;">
  6814         <xsl:copy-of select="$result_svg"/>
  6816         <xsl:copy-of select="$result_svg"/>
  6815         <script>
  6817         <script>
  6816           <xsl:text>
  6818           <xsl:text>