svghmi/gen_index_xhtml.xslt
branchsvghmi
changeset 2783 5ee6967f721d
parent 2782 723e420dfe72
child 2788 2ed9ff826d03
equal deleted inserted replaced
2782:723e420dfe72 2783:5ee6967f721d
    24             <xsl:apply-templates mode="testtree" select="$hmitree"/>
    24             <xsl:apply-templates mode="testtree" select="$hmitree"/>
    25           </xsl:comment>
    25           </xsl:comment>
    26           <xsl:apply-templates select="@* | node()"/>
    26           <xsl:apply-templates select="@* | node()"/>
    27         </xsl:copy>
    27         </xsl:copy>
    28         <script>
    28         <script>
       
    29           <xsl:text>function evaluate_js_from_descriptions() {
       
    30 </xsl:text>
       
    31           <xsl:text>    var Page;
       
    32 </xsl:text>
       
    33           <xsl:text>    var Input;
       
    34 </xsl:text>
       
    35           <xsl:text>    var Display;
       
    36 </xsl:text>
       
    37           <xsl:text>    var res = [];
       
    38 </xsl:text>
    29           <xsl:variable name="midmark">
    39           <xsl:variable name="midmark">
    30             <xsl:text>
    40             <xsl:text>
    31 </xsl:text>
    41 </xsl:text>
    32             <xsl:value-of select="$mark"/>
    42             <xsl:value-of select="$mark"/>
    33           </xsl:variable>
    43           </xsl:variable>
    34           <xsl:apply-templates mode="code_from_descs" select="//*[contains(child::svg:desc, $midmark) or                                starts-with(child::svg:desc, $mark)]"/>
    44           <xsl:apply-templates mode="code_from_descs" select="//*[contains(child::svg:desc, $midmark) or                                starts-with(child::svg:desc, $mark)]"/>
    35           <xsl:text>
    45           <xsl:text>    return res;
       
    46 </xsl:text>
       
    47           <xsl:text>}
    36 </xsl:text>
    48 </xsl:text>
    37           <xsl:text>(function(){
    49           <xsl:text>(function(){
    38 </xsl:text>
    50 </xsl:text>
    39           <xsl:text>    var relative_URI = window.location.href.replace(/^http(s?:\/\/[^\/]*)\/.*$/, 'ws$1/ws');
    51           <xsl:text>    var relative_URI = window.location.href.replace(/^http(s?:\/\/[^\/]*)\/.*$/, 'ws$1/ws');
    40 </xsl:text>
    52 </xsl:text>
    59         </script>
    71         </script>
    60       </body>
    72       </body>
    61     </html>
    73     </html>
    62   </xsl:template>
    74   </xsl:template>
    63   <xsl:template mode="code_from_descs" match="*">
    75   <xsl:template mode="code_from_descs" match="*">
    64     <xsl:text>function js_</xsl:text>
    76     <xsl:text>{
       
    77 </xsl:text>
       
    78     <xsl:text>    var path, role, name, priv;
       
    79 </xsl:text>
       
    80     <xsl:text>    var id = "</xsl:text>
    65     <xsl:value-of select="@id"/>
    81     <xsl:value-of select="@id"/>
    66     <xsl:text>() {
    82     <xsl:text>";
    67 </xsl:text>
    83 </xsl:text>
    68     <xsl:text>var path, role, path, priv;
    84     <xsl:if test="&#xAB;@inkscape:label&#xBB;">
       
    85       <xsl:text>name = "</xsl:text>
       
    86       <xsl:value-of select="@inkscape:label"/>
       
    87       <xsl:text>";
    69 </xsl:text>
    88 </xsl:text>
    70     <xsl:text>
    89     </xsl:if>
       
    90     <xsl:text>/* -------------- */
    71 </xsl:text>
    91 </xsl:text>
    72     <xsl:value-of select="substring-after(svg:desc, $mark)"/>
    92     <xsl:value-of select="substring-after(svg:desc, $mark)"/>
    73     <xsl:text>
    93     <xsl:text>
    74 </xsl:text>
    94 </xsl:text>
       
    95     <xsl:text>    /* -------------- */
       
    96 </xsl:text>
       
    97     <xsl:text>    res.push({
       
    98 </xsl:text>
       
    99     <xsl:text>        path:path,
       
   100 </xsl:text>
       
   101     <xsl:text>        role:role,
       
   102 </xsl:text>
       
   103     <xsl:text>        name:name,
       
   104 </xsl:text>
       
   105     <xsl:text>        priv:priv
       
   106 </xsl:text>
       
   107     <xsl:text>    })
       
   108 </xsl:text>
    75     <xsl:text>}
   109     <xsl:text>}
    76 </xsl:text>
       
    77     <xsl:text>
       
    78 </xsl:text>
   110 </xsl:text>
    79   </xsl:template>
   111   </xsl:template>
    80   <xsl:template mode="testgeo" match="bbox">
   112   <xsl:template mode="testgeo" match="bbox">
    81     <xsl:text>ID: </xsl:text>
   113     <xsl:text>ID: </xsl:text>
    82     <xsl:value-of select="@Id"/>
   114     <xsl:value-of select="@Id"/>