svghmi/gen_index_xhtml.ysl2
branchsvghmi
changeset 2782 723e420dfe72
parent 2780 e468f18df200
child 2783 5ee6967f721d
--- 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 */
     template "/" 
       html xmlns="http://www.w3.org/1999/xhtml" {
@@ -48,16 +50,34 @@
                   apply "@* | node()";
               }
               script{
+                  variable "midmark" > \n«$mark»
+                  apply """//*[contains(child::svg:desc, $midmark) or \
+                               starts-with(child::svg:desc, $mark)]""", 
+                        mode="code_from_descs";
+                  |
+
                   /*TODO add :
                     - pages content
                       + with ref to elt ?
                     - widgets parameters
                   */
+
                   include text svghmi.js
               }
           }
     }
 
+    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»
     }