Edouard@2753: include yslt_noindent.yml2 Edouard@2779: Edouard@2779: // overrides yslt's output function to set CDATA Edouard@2779: decl output(method, cdata-section-elements="script"); Edouard@2753: istylesheet Edouard@2753: /* From Inkscape */ Edouard@2753: xmlns:dc="http://purl.org/dc/elements/1.1/" Edouard@2753: xmlns:cc="http://creativecommons.org/ns#" Edouard@2753: xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" Edouard@2753: xmlns:svg="http://www.w3.org/2000/svg" Edouard@2753: xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" Edouard@2753: xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" Edouard@2779: xmlns="http://www.w3.org/1999/xhtml" Edouard@2753: Edouard@2753: /* Our namespace to invoke python code */ Edouard@2753: xmlns:ns="beremiz" Edouard@2753: extension-element-prefixes="ns" Edouard@2753: exclude-result-prefixes="ns" { Edouard@2753: Edouard@2753: /* This retrieves geometry obtained through "inkscape -S" Edouard@2753: * already parsed by python and presented as a list of Edouard@2753: * Edouard@2753: */ Edouard@2753: variable "geometry", "ns:GetSVGGeometry()"; Edouard@2763: variable "hmitree", "ns:GetHMITree()"; Edouard@2753: Edouard@2753: /* Identity template : Edouard@2753: * - copy every attributes Edouard@2753: * - copy every sub-elements Edouard@2753: */ Edouard@2753: template "@* | node()" { Edouard@2753: /* use real xsl:copy instead copy-of alias from yslt.yml2 */ Edouard@2753: xsl:copy apply "@* | node()"; Edouard@2753: } Edouard@2753: Edouard@2753: /* copy root node and add geometry as comment for a test */ Edouard@2779: template "/" Edouard@2779: html xmlns="http://www.w3.org/1999/xhtml" { Edouard@2779: head; Edouard@2779: body style="margin:0;" { Edouard@2779: xsl:copy { Edouard@2779: comment { Edouard@2779: apply "$geometry", mode="testgeo"; Edouard@2779: } Edouard@2779: comment { Edouard@2779: apply "$hmitree", mode="testtree"; Edouard@2779: } Edouard@2779: apply "@* | node()"; Edouard@2779: } Edouard@2779: script Edouard@2779: || Edouard@2779: (function(){ Edouard@2779: var relative_URI = window.location.href.replace(/^http(s?:\/\/[^\/]*)\/.*$/, 'ws$1/ws'); Edouard@2779: var ws = new WebSocket(relative_URI); Edouard@2779: ws.onmessage = function (evt) { Edouard@2779: var received_msg = evt.data; Edouard@2779: alert("Message is received..."+received_msg); Edouard@2779: }; Edouard@2779: ws.onopen = function (evt) { Edouard@2779: ws.send("test"); Edouard@2779: }; Edouard@2779: })(); Edouard@2779: || Edouard@2763: } Edouard@2753: } Edouard@2753: Edouard@2753: template "bbox", mode="testgeo"{ Edouard@2763: | ID: «@Id» x: «@x» y: «@y» w: «@w» h: «@h» Edouard@2763: } Edouard@2763: Edouard@2763: template "*", mode="testtree"{ Edouard@2763: param "indent", "''"; Edouard@2763: | «$indent» «local-name()» «@name» «@type» «@path» Edouard@2763: apply "*", mode="testtree" { Edouard@2763: with "indent" value "concat($indent,'>')" Edouard@2763: }; Edouard@2753: } Edouard@2753: }