svghmi/gen_index_xhtml.ysl2
branchsvghmi
changeset 2790 8fab1886ebec
parent 2789 ba0dd2ec6dc4
child 2791 d022523cb621
equal deleted inserted replaced
2789:ba0dd2ec6dc4 2790:8fab1886ebec
     8             xmlns:cc="http://creativecommons.org/ns#"
     8             xmlns:cc="http://creativecommons.org/ns#"
     9             xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
     9             xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    10             xmlns:svg="http://www.w3.org/2000/svg"
    10             xmlns:svg="http://www.w3.org/2000/svg"
    11             xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
    11             xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
    12             xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
    12             xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
    13             xmlns="http://www.w3.org/1999/xhtml"
    13             xmlns:xhtml="http://www.w3.org/1999/xhtml"
    14 
    14 
    15             /* Our namespace to invoke python code */
    15             /* Our namespace to invoke python code */
    16             xmlns:ns="beremiz"
    16             xmlns:ns="beremiz"
    17             extension-element-prefixes="ns" 
    17             extension-element-prefixes="ns" 
    18             exclude-result-prefixes="ns" {
    18             exclude-result-prefixes="ns" {
    21      * already parsed by python and presented as a list of 
    21      * already parsed by python and presented as a list of 
    22      * <bbox x="0" y="0" w="42" h="42">
    22      * <bbox x="0" y="0" w="42" h="42">
    23      */
    23      */
    24     variable "geometry", "ns:GetSVGGeometry()";
    24     variable "geometry", "ns:GetSVGGeometry()";
    25     variable "hmitree", "ns:GetHMITree()";
    25     variable "hmitree", "ns:GetHMITree()";
    26    
    26 
       
    27     variable "_categories" {
       
    28         noindex > HMI_ROOT
       
    29         noindex > HMI_LABEL
       
    30         noindex > HMI_CLASS
       
    31         noindex > HMI_PLC_STATUS
       
    32         noindex > HMI_CURRENT_PAGE
       
    33     }
       
    34     variable "categories", "exsl:node-set($_categories)";
       
    35     //variable "indexed_hmitree", "$hmitree[not(local-name() = $categories/noindex/text())]";
       
    36     variable "indexed_hmitree" apply "$hmitree", mode="index";
       
    37 
       
    38     template "node()", mode="index"{
       
    39         param "index", "0";
       
    40         variable "content" {
       
    41             choose {
       
    42                 when "not(local-name() = $categories/noindex)" {
       
    43                     xsl:copy {
       
    44                         attrib "index" > «$index»
       
    45                         foreach "@*" xsl:copy;
       
    46                     }
       
    47                     /* no node expected below value nodes */
       
    48                 }
       
    49                 otherwise {
       
    50                     apply "*[1]", mode="index"{
       
    51                         with "index", "$index";
       
    52                     }
       
    53                 }
       
    54             }
       
    55         }
       
    56 
       
    57         copy "$content";
       
    58         apply "following-sibling::*[1]", mode="index" {
       
    59             with "index", "$index + count(exsl:node-set($content)/*)";
       
    60         }
       
    61     }
       
    62 
    27     /* Identity template :
    63     /* Identity template :
    28      *  - copy every attributes 
    64      *  - copy every attributes 
    29      *  - copy every sub-elements
    65      *  - copy every sub-elements
    30      */
    66      */
    31     template "@* | node()" {
    67     template "@* | node()" {
    45                       apply "$geometry", mode="testgeo";
    81                       apply "$geometry", mode="testgeo";
    46                   }
    82                   }
    47                   comment {
    83                   comment {
    48                       apply "$hmitree", mode="testtree";
    84                       apply "$hmitree", mode="testtree";
    49                   }
    85                   }
       
    86                   comment {
       
    87                       apply "exsl:node-set($indexed_hmitree)", mode="testtree";
       
    88                   }
    50                   apply "@* | node()";
    89                   apply "@* | node()";
    51               }
    90               }
    52               script{
    91               script{
    53                   /* TODO : paste hmitree hash stored in hmi tree root node */
    92                   /* TODO : paste hmitree hash stored in hmi tree root node */
    54 
    93 
       
    94                   /* TODO re-enable
    55                   ||
    95                   ||
    56                   function evaluate_js_from_descriptions() {
    96                   function evaluate_js_from_descriptions() {
    57                       var Page;
    97                       var Page;
    58                       var Input;
    98                       var Input;
    59                       var Display;
    99                       var Display;
    65                         mode="code_from_descs";
   105                         mode="code_from_descs";
    66                   ||
   106                   ||
    67                       return res;
   107                       return res;
    68                   }
   108                   }
    69                   ||
   109                   ||
       
   110                   */
    70 
   111 
    71                   /*TODO add :
   112                   /*TODO add :
    72                     - pages content
   113                     - pages content
    73                       + with ref to elt ?
   114                       + with ref to elt ?
    74                     - widgets parameters
   115                     - widgets parameters
    75                   */
   116                   */
    76 
   117 
       
   118                   ||
       
   119                   var subscriptions = {
       
   120                   ||
       
   121                   //    apply "$hmitree", mode="subscription_";
       
   122                   ||
       
   123                       return res;
       
   124                   }
       
   125                   ||
    77                   include text svghmi.js
   126                   include text svghmi.js
    78               }
   127               }
    79           }
   128           }
    80     }
   129     }
    81 
   130 
   114         | ID: «@Id» x: «@x» y: «@y» w: «@w» h: «@h»
   163         | ID: «@Id» x: «@x» y: «@y» w: «@w» h: «@h»
   115     }
   164     }
   116 
   165 
   117     template "*", mode="testtree"{
   166     template "*", mode="testtree"{
   118         param "indent", "''";
   167         param "indent", "''";
   119         | «$indent» «local-name()» «@name» «@type» «@path»
   168         > «$indent» «local-name()» 
       
   169         foreach "@*" > «local-name()»=«.» 
       
   170         > \n
   120         apply "*", mode="testtree" {
   171         apply "*", mode="testtree" {
   121             with "indent" value "concat($indent,'>')"
   172             with "indent" value "concat($indent,'>')"
   122         };
   173         };
   123     }
   174     }
   124 }
   175 }