svghmi/gen_index_xhtml.xslt
branchsvghmi
changeset 2904 92d115d8828d
parent 2903 881d0248b3ce
child 2905 3d7e3866cc51
equal deleted inserted replaced
2903:881d0248b3ce 2904:92d115d8828d
     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:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" 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:xhtml="http://www.w3.org/1999/xhtml" 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:dc="http://purl.org/dc/elements/1.1/" extension-element-prefixes="ns func exsl regexp str dyn" version="1.0" exclude-result-prefixes="ns str regexp exsl func dyn">
     2 <xsl:stylesheet xmlns:func="http://exslt.org/functions" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" 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:xhtml="http://www.w3.org/1999/xhtml" xmlns:reflect="reflect" 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:dc="http://purl.org/dc/elements/1.1/" extension-element-prefixes="ns func exsl regexp str dyn" version="1.0" exclude-result-prefixes="ns str regexp exsl func dyn reflect">
     3   <xsl:output method="xml" cdata-section-elements="xhtml:script"/>
     3   <xsl:output method="xml" cdata-section-elements="xhtml:script"/>
     4   <xsl:variable name="hmi_elements" select="//svg:*[starts-with(@inkscape:label, 'HMI:')]"/>
     4   <xsl:variable name="hmi_elements" select="//svg:*[starts-with(@inkscape:label, 'HMI:')]"/>
     5   <xsl:variable name="hmitree" select="ns:GetHMITree()"/>
     5   <xsl:variable name="hmitree" select="ns:GetHMITree()"/>
     6   <xsl:variable name="_categories">
     6   <xsl:variable name="_categories">
     7     <noindex>
     7     <noindex>
   152     <xsl:param name="b"/>
   152     <xsl:param name="b"/>
   153     <xsl:variable name="class_a" select="$indexed_hmitree/*[@hmipath = $a]/@class"/>
   153     <xsl:variable name="class_a" select="$indexed_hmitree/*[@hmipath = $a]/@class"/>
   154     <xsl:variable name="class_b" select="$indexed_hmitree/*[@hmipath = $b]/@class"/>
   154     <xsl:variable name="class_b" select="$indexed_hmitree/*[@hmipath = $b]/@class"/>
   155     <func:result select="$class_a and $class_b and $class_a = $class_b"/>
   155     <func:result select="$class_a and $class_b and $class_a = $class_b"/>
   156   </func:function>
   156   </func:function>
       
   157   <reflect:hmi-tree/>
   157   <xsl:template mode="testtree" match="*">
   158   <xsl:template mode="testtree" match="*">
   158     <xsl:param name="indent" select="''"/>
   159     <xsl:param name="indent" select="''"/>
   159     <xsl:value-of select="$indent"/>
   160     <xsl:value-of select="$indent"/>
   160     <xsl:text> </xsl:text>
   161     <xsl:text> </xsl:text>
   161     <xsl:value-of select="local-name()"/>
   162     <xsl:value-of select="local-name()"/>
   172       <xsl:with-param name="indent">
   173       <xsl:with-param name="indent">
   173         <xsl:value-of select="concat($indent,'&gt;')"/>
   174         <xsl:value-of select="concat($indent,'&gt;')"/>
   174       </xsl:with-param>
   175       </xsl:with-param>
   175     </xsl:apply-templates>
   176     </xsl:apply-templates>
   176   </xsl:template>
   177   </xsl:template>
   177   <xsl:template name="debug_hmitree">
   178   <xsl:template mode="debug" match="reflect:hmi-tree">
   178     <xsl:text>Raw HMI tree
   179     <xsl:text>Raw HMI tree
   179 </xsl:text>
   180 </xsl:text>
   180     <xsl:apply-templates mode="testtree" select="$hmitree"/>
   181     <xsl:apply-templates mode="testtree" select="$hmitree"/>
   181     <xsl:text>
   182     <xsl:text>
   182 </xsl:text>
   183 </xsl:text>
   189 </xsl:text>
   190 </xsl:text>
   190     <xsl:copy-of select="_parsed_widgets"/>
   191     <xsl:copy-of select="_parsed_widgets"/>
   191     <xsl:apply-templates mode="testtree" select="$parsed_widgets"/>
   192     <xsl:apply-templates mode="testtree" select="$parsed_widgets"/>
   192   </xsl:template>
   193   </xsl:template>
   193   <xsl:variable name="geometry" select="ns:GetSVGGeometry()"/>
   194   <xsl:variable name="geometry" select="ns:GetSVGGeometry()"/>
   194   <xsl:template name="debug_geometry">
   195   <reflect:geometry/>
       
   196   <xsl:template mode="debug" match="reflect:geometry">
   195     <xsl:text>ID, x, y, w, h
   197     <xsl:text>ID, x, y, w, h
   196 </xsl:text>
   198 </xsl:text>
   197     <xsl:for-each select="$geometry">
   199     <xsl:for-each select="$geometry">
   198       <xsl:text> </xsl:text>
   200       <xsl:text> </xsl:text>
   199       <xsl:value-of select="@Id"/>
   201       <xsl:value-of select="@Id"/>
   451     </xsl:if>
   453     </xsl:if>
   452     <xsl:text>
   454     <xsl:text>
   453 </xsl:text>
   455 </xsl:text>
   454   </xsl:template>
   456   </xsl:template>
   455   <xsl:template mode="per_page_widget_template" match="*"/>
   457   <xsl:template mode="per_page_widget_template" match="*"/>
   456   <xsl:template name="debug_detachables">
   458   <reflect:detachable-pages/>
       
   459   <xsl:template mode="debug" match="reflect:detachable-pages">
   457     <xsl:text>DETACHABLES:
   460     <xsl:text>DETACHABLES:
   458 </xsl:text>
   461 </xsl:text>
   459     <xsl:for-each select="$detachable_elements">
   462     <xsl:for-each select="$detachable_elements">
   460       <xsl:text> </xsl:text>
   463       <xsl:text> </xsl:text>
   461       <xsl:value-of select="@id"/>
   464       <xsl:value-of select="@id"/>
   580   </xsl:template>
   583   </xsl:template>
   581   <xsl:variable name="result_svg">
   584   <xsl:variable name="result_svg">
   582     <xsl:apply-templates mode="inline_svg" select="/"/>
   585     <xsl:apply-templates mode="inline_svg" select="/"/>
   583   </xsl:variable>
   586   </xsl:variable>
   584   <xsl:variable name="result_svg_ns" select="exsl:node-set($result_svg)"/>
   587   <xsl:variable name="result_svg_ns" select="exsl:node-set($result_svg)"/>
   585   <xsl:template name="debug_unlink">
   588   <reflect:inline-svg/>
       
   589   <xsl:template mode="debug" match="reflect:inline-svg">
       
   590     <xsl:text>Unlinked :
       
   591 </xsl:text>
   586     <xsl:for-each select="$to_unlink">
   592     <xsl:for-each select="$to_unlink">
   587       <xsl:value-of select="@id"/>
   593       <xsl:value-of select="@id"/>
   588       <xsl:text>
   594       <xsl:text>
   589 </xsl:text>
   595 </xsl:text>
   590     </xsl:for-each>
   596     </xsl:for-each>
  1164 </xsl:text>
  1170 </xsl:text>
  1165     </xsl:for-each>
  1171     </xsl:for-each>
  1166     <xsl:text>    ],
  1172     <xsl:text>    ],
  1167 </xsl:text>
  1173 </xsl:text>
  1168   </xsl:template>
  1174   </xsl:template>
       
  1175   <xsl:template mode="debug_as_comment" match="*[namespace-uri()='reflect']">
       
  1176     <xsl:comment>
       
  1177       <xsl:value-of select="local-name()"/>
       
  1178       <xsl:text> :
       
  1179 </xsl:text>
       
  1180       <xsl:apply-templates mode="debug" select="."/>
       
  1181     </xsl:comment>
       
  1182   </xsl:template>
  1169   <xsl:template match="/">
  1183   <xsl:template match="/">
  1170     <xsl:comment>
  1184     <xsl:comment>
  1171       <xsl:text>Made with SVGHMI. https://beremiz.org</xsl:text>
  1185       <xsl:text>Made with SVGHMI. https://beremiz.org</xsl:text>
  1172     </xsl:comment>
       
  1173     <xsl:comment>
       
  1174       <xsl:text>
       
  1175 </xsl:text>
       
  1176       <xsl:text>debug_hmitree:
       
  1177 </xsl:text>
       
  1178       <xsl:call-template name="debug_hmitree"/>
       
  1179       <xsl:text>
       
  1180 </xsl:text>
       
  1181     </xsl:comment>
       
  1182     <xsl:comment>
       
  1183       <xsl:text>
       
  1184 </xsl:text>
       
  1185       <xsl:text>debug_geometry:
       
  1186 </xsl:text>
       
  1187       <xsl:call-template name="debug_geometry"/>
       
  1188       <xsl:text>
       
  1189 </xsl:text>
       
  1190     </xsl:comment>
       
  1191     <xsl:comment>
       
  1192       <xsl:text>
       
  1193 </xsl:text>
       
  1194       <xsl:text>debug_detachables:
       
  1195 </xsl:text>
       
  1196       <xsl:call-template name="debug_detachables"/>
       
  1197       <xsl:text>
       
  1198 </xsl:text>
       
  1199     </xsl:comment>
       
  1200     <xsl:comment>
       
  1201       <xsl:text>
       
  1202 </xsl:text>
       
  1203       <xsl:text>debug_unlink:
       
  1204 </xsl:text>
       
  1205       <xsl:call-template name="debug_unlink"/>
       
  1206       <xsl:text>
       
  1207 </xsl:text>
       
  1208     </xsl:comment>
  1186     </xsl:comment>
  1209     <html xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/1999/xhtml">
  1187     <html xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/1999/xhtml">
  1210       <head/>
  1188       <head/>
  1211       <body style="margin:0;overflow:hidden;">
  1189       <body style="margin:0;overflow:hidden;">
  1212         <xsl:copy-of select="$result_svg"/>
  1190         <xsl:copy-of select="$result_svg"/>