--- a/svghmi/gen_index_xhtml.xslt Thu Sep 19 10:41:39 2019 +0200
+++ b/svghmi/gen_index_xhtml.xslt Thu Sep 19 15:32:36 2019 +0200
@@ -1,5 +1,5 @@
-<xsl:stylesheet xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/1999/xhtml" xmlns:exsl="http://exslt.org/common" xmlns:ns="beremiz" xmlns:cc="http://creativecommons.org/ns#" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dc="http://purl.org/dc/elements/1.1/" extension-element-prefixes="ns" version="1.0" exclude-result-prefixes="ns">
+<xsl:stylesheet xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns="beremiz" xmlns:cc="http://creativecommons.org/ns#" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/1999/xhtml" xmlns:str="http://exslt.org/strings" xmlns:regexp="http://exslt.org/regular-expressions" xmlns:exsl="http://exslt.org/common" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" exclude-result-prefixes="ns" extension-element-prefixes="ns" version="1.0"> <xsl:output method="xml" cdata-section-elements="script"/>
<xsl:variable name="geometry" select="ns:GetSVGGeometry()"/>
<xsl:variable name="hmitree" select="ns:GetHMITree()"/>
@@ -8,6 +8,10 @@
<xsl:apply-templates select="@* | node()"/>
+ <xsl:variable name="mark"> <html xmlns="http://www.w3.org/1999/xhtml">
@@ -22,6 +26,14 @@
<xsl:apply-templates select="@* | node()"/>
+ <xsl:variable name="midmark"> + <xsl:value-of select="$mark"/> + <xsl:apply-templates mode="code_from_descs" select="//*[contains(child::svg:desc, $midmark) or starts-with(child::svg:desc, $mark)]"/> <xsl:text> var relative_URI = window.location.href.replace(/^http(s?:\/\/[^\/]*)\/.*$/, 'ws$1/ws');
@@ -48,6 +60,23 @@
+ <xsl:template mode="code_from_descs" match="*"> + <xsl:text>function js_</xsl:text> + <xsl:value-of select="@id"/> + <xsl:text>var path, role, path, priv; + <xsl:value-of select="substring-after(svg:desc, $mark)"/> <xsl:template mode="testgeo" match="bbox">
<xsl:text>ID: </xsl:text>
<xsl:value-of select="@Id"/>
--- a/svghmi/gen_index_xhtml.ysl2 Thu Sep 19 10:41:39 2019 +0200
+++ b/svghmi/gen_index_xhtml.ysl2 Thu Sep 19 15:32:36 2019 +0200
@@ -33,6 +33,8 @@
xsl:copy apply "@* | node()";
+ variable "mark" > =HMI=\n /* copy root node and add geometry as comment for a test */
html xmlns="http://www.w3.org/1999/xhtml" {
@@ -48,16 +50,34 @@
+ variable "midmark" > \n«$mark» + apply """//*[contains(child::svg:desc, $midmark) or \ + starts-with(child::svg:desc, $mark)]""", + mode="code_from_descs"; + template "*", mode="code_from_descs" { + | function js_«@id»() { + | var path, role, path, priv; + value "substring-after(svg:desc, $mark)"; template "bbox", mode="testgeo"{
| ID: «@Id» x: «@x» y: «@y» w: «@w» h: «@h»
--- a/yslt_noindent.yml2 Thu Sep 19 10:41:39 2019 +0200
+++ b/yslt_noindent.yml2 Thu Sep 19 15:32:36 2019 +0200
@@ -10,7 +10,9 @@
xmlns:xsl="http://www.w3.org/1999/XSL/Transform",
xmlns:exsl='http://exslt.org/common',
- extension-element-prefixes='exsl'
+ xmlns:regexp="http://exslt.org/regular-expressions", + xmlns:str="http://exslt.org/strings", + extension-element-prefixes='exsl regexp str'