svghmi/gen_index_xhtml.xslt
branchsvghmi
changeset 2779 75c6a31caca6
parent 2763 ce04d79b8e57
child 2782 723e420dfe72
equal deleted inserted replaced
2778:cdf23b10b8f7 2779:75c6a31caca6
     1 <?xml version="1.0"?>
     1 <?xml version="1.0"?>
     2 <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: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">
     2 <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">
     3   <xsl:output method="xml"/>
     3   <xsl:output method="xml" cdata-section-elements="script"/>
     4   <xsl:variable name="geometry" select="ns:GetSVGGeometry()"/>
     4   <xsl:variable name="geometry" select="ns:GetSVGGeometry()"/>
     5   <xsl:variable name="hmitree" select="ns:GetHMITree()"/>
     5   <xsl:variable name="hmitree" select="ns:GetHMITree()"/>
     6   <xsl:template match="@* | node()">
     6   <xsl:template match="@* | node()">
     7     <xsl:copy>
     7     <xsl:copy>
     8       <xsl:apply-templates select="@* | node()"/>
     8       <xsl:apply-templates select="@* | node()"/>
     9     </xsl:copy>
     9     </xsl:copy>
    10   </xsl:template>
    10   </xsl:template>
    11   <xsl:template match="/">
    11   <xsl:template match="/">
    12     <xsl:copy>
    12     <html xmlns="http://www.w3.org/1999/xhtml">
    13       <xsl:comment>
    13       <head/>
    14         <xsl:apply-templates mode="testgeo" select="$geometry"/>
    14       <body style="margin:0;">
    15       </xsl:comment>
    15         <xsl:copy>
    16       <xsl:comment>
    16           <xsl:comment>
    17         <xsl:text>blah
    17             <xsl:apply-templates mode="testgeo" select="$geometry"/>
       
    18           </xsl:comment>
       
    19           <xsl:comment>
       
    20             <xsl:apply-templates mode="testtree" select="$hmitree"/>
       
    21           </xsl:comment>
       
    22           <xsl:apply-templates select="@* | node()"/>
       
    23         </xsl:copy>
       
    24         <script>
       
    25           <xsl:text>(function(){
    18 </xsl:text>
    26 </xsl:text>
    19         <xsl:apply-templates mode="testtree" select="$hmitree"/>
    27           <xsl:text>    var relative_URI = window.location.href.replace(/^http(s?:\/\/[^\/]*)\/.*$/, 'ws$1/ws');
    20       </xsl:comment>
    28 </xsl:text>
    21       <xsl:apply-templates select="@* | node()"/>
    29           <xsl:text>    var ws = new WebSocket(relative_URI);
    22     </xsl:copy>
    30 </xsl:text>
       
    31           <xsl:text>    ws.onmessage = function (evt) {
       
    32 </xsl:text>
       
    33           <xsl:text>        var received_msg = evt.data;
       
    34 </xsl:text>
       
    35           <xsl:text>        alert("Message is received..."+received_msg); 
       
    36 </xsl:text>
       
    37           <xsl:text>    };
       
    38 </xsl:text>
       
    39           <xsl:text>    ws.onopen = function (evt) {
       
    40 </xsl:text>
       
    41           <xsl:text>        ws.send("test");
       
    42 </xsl:text>
       
    43           <xsl:text>    };
       
    44 </xsl:text>
       
    45           <xsl:text>})();
       
    46 </xsl:text>
       
    47         </script>
       
    48       </body>
       
    49     </html>
    23   </xsl:template>
    50   </xsl:template>
    24   <xsl:template mode="testgeo" match="bbox">
    51   <xsl:template mode="testgeo" match="bbox">
    25     <xsl:text>ID: </xsl:text>
    52     <xsl:text>ID: </xsl:text>
    26     <xsl:value-of select="@Id"/>
    53     <xsl:value-of select="@Id"/>
    27     <xsl:text> x: </xsl:text>
    54     <xsl:text> x: </xsl:text>