--- a/svghmi/detachable_pages.ysl2 Fri Mar 27 14:25:24 2020 +0100
+++ b/svghmi/detachable_pages.ysl2 Sun Mar 29 16:11:21 2020 +0200
@@ -153,7 +153,11 @@
template "*", mode="per_page_widget_template";
-function "debug_detachables" {
+reflect:detachable_pages; +template "reflect:detachable-pages", mode="debug" { foreach "$detachable_elements"{
@@ -163,4 +167,3 @@
-!debug_output_calls.append("debug_detachables")
--- a/svghmi/gen_index_xhtml.xslt Fri Mar 27 14:25:24 2020 +0100
+++ b/svghmi/gen_index_xhtml.xslt Sun Mar 29 16:11:21 2020 +0200
@@ -1,5 +1,5 @@
-<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">
+<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"> <xsl:output method="xml" cdata-section-elements="xhtml:script"/>
<xsl:variable name="hmi_elements" select="//svg:*[starts-with(@inkscape:label, 'HMI:')]"/>
<xsl:variable name="hmitree" select="ns:GetHMITree()"/>
@@ -154,6 +154,7 @@
<xsl:variable name="class_b" select="$indexed_hmitree/*[@hmipath = $b]/@class"/>
<func:result select="$class_a and $class_b and $class_a = $class_b"/>
<xsl:template mode="testtree" match="*">
<xsl:param name="indent" select="''"/>
<xsl:value-of select="$indent"/>
@@ -174,7 +175,7 @@
- <xsl:template name="debug_hmitree">
+ <xsl:template mode="debug" match="reflect:hmi-tree"> <xsl:apply-templates mode="testtree" select="$hmitree"/>
@@ -191,7 +192,8 @@
<xsl:apply-templates mode="testtree" select="$parsed_widgets"/>
<xsl:variable name="geometry" select="ns:GetSVGGeometry()"/>
- <xsl:template name="debug_geometry">
+ <xsl:template mode="debug" match="reflect:geometry"> <xsl:for-each select="$geometry">
@@ -453,7 +455,8 @@
<xsl:template mode="per_page_widget_template" match="*"/>
- <xsl:template name="debug_detachables">
+ <reflect:detachable-pages/> + <xsl:template mode="debug" match="reflect:detachable-pages"> <xsl:for-each select="$detachable_elements">
@@ -582,7 +585,10 @@
<xsl:apply-templates mode="inline_svg" select="/"/>
<xsl:variable name="result_svg_ns" select="exsl:node-set($result_svg)"/>
- <xsl:template name="debug_unlink">
+ <xsl:template mode="debug" match="reflect:inline-svg"> <xsl:for-each select="$to_unlink">
<xsl:value-of select="@id"/>
@@ -1166,46 +1172,18 @@
+ <xsl:template mode="debug_as_comment" match="*[namespace-uri()='reflect']"> + <xsl:value-of select="local-name()"/> + <xsl:apply-templates mode="debug" select="."/> <xsl:text>Made with SVGHMI. https://beremiz.org</xsl:text>
- <xsl:text>debug_hmitree:
- <xsl:call-template name="debug_hmitree"/>
- <xsl:text>debug_geometry:
- <xsl:call-template name="debug_geometry"/>
- <xsl:text>debug_detachables:
- <xsl:call-template name="debug_detachables"/>
- <xsl:text>debug_unlink:
- <xsl:call-template name="debug_unlink"/>
<html xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/1999/xhtml">
<body style="margin:0;overflow:hidden;">
--- a/svghmi/gen_index_xhtml.ysl2 Fri Mar 27 14:25:24 2020 +0100
+++ b/svghmi/gen_index_xhtml.ysl2 Sun Mar 29 16:11:21 2020 +0200
@@ -17,22 +17,6 @@
in xsl decl svgtmpl(match, xmlns="http://www.w3.org/2000/svg") alias template;
in xsl decl svgfunc(name, xmlns="http://www.w3.org/2000/svg") alias template;
- # '&bug' is a workaround for pyPEG that choke on
- # yml2 python results not parsing down into a single yml2 call
- }"""%(n,n) for n in debug_output_calls])+
xmlns:dc="http://purl.org/dc/elements/1.1/"
@@ -43,11 +27,12 @@
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:reflect="reflect" /* Our namespace to invoke python code */
extension-element-prefixes="ns func exsl regexp str dyn"
- exclude-result-prefixes="ns str regexp exsl func dyn" {
+ exclude-result-prefixes="ns str regexp exsl func dyn reflect" { const "hmi_elements", "//svg:*[starts-with(@inkscape:label, 'HMI:')]";
@@ -64,11 +49,18 @@
+ template "*[namespace-uri()='reflect']", mode="debug_as_comment" { + apply ".", mode="debug"; comment > Made with SVGHMI. https://beremiz.org
- // use python to call all debug output from included definitions
- python gen_debug_calls;
+ // all debug output from included definitions, as comments + // apply "document('')/*/reflect:*", mode="debug_as_comment"; html xmlns="http://www.w3.org/1999/xhtml"
xmlns:svg="http://www.w3.org/2000/svg"
--- a/svghmi/geometry.ysl2 Fri Mar 27 14:25:24 2020 +0100
+++ b/svghmi/geometry.ysl2 Sun Mar 29 16:11:21 2020 +0200
@@ -7,13 +7,14 @@
// <bbox x="0" y="0" w="42" h="42">
const "geometry", "ns:GetSVGGeometry()";
-function "debug_geometry" {
+template "reflect:geometry", mode="debug" { | «@Id» «@x» «@y» «@w» «@h»
-!debug_output_calls.append("debug_geometry")
// Rates 1D intersection of 2 segments A and B
// described respectively with a0,a1 and b0,b1
--- a/svghmi/hmi_tree.ysl2 Fri Mar 27 14:25:24 2020 +0100
+++ b/svghmi/hmi_tree.ysl2 Sun Mar 29 16:11:21 2020 +0200
@@ -124,6 +124,8 @@
result "$class_a and $class_b and $class_a = $class_b";
template "*", mode="testtree"{
@@ -134,7 +136,7 @@
with "indent" value "concat($indent,'>')"
-function "debug_hmitree" {
+template "reflect:hmi-tree", mode="debug" { apply "$hmitree", mode="testtree";
@@ -145,4 +147,3 @@
apply "$parsed_widgets", mode="testtree";
-!debug_output_calls.append("debug_hmitree")
--- a/svghmi/inline_svg.ysl2 Fri Mar 27 14:25:24 2020 +0100
+++ b/svghmi/inline_svg.ysl2 Sun Mar 29 16:11:21 2020 +0200
@@ -112,9 +112,10 @@
const "result_svg" apply "/", mode="inline_svg";
const "result_svg_ns", "exsl:node-set($result_svg)";
-function "debug_unlink" {
+template "reflect:inline-svg", mode="debug" { -!debug_output_calls.append("debug_unlink")