[xsl] HTML page to connect the xml to xsl and svg

Subject: [xsl] HTML page to connect the xml to xsl and svg
From: "meidan" <asafmei@xxxxxxxxxxxx>
Date: Mon, 3 Nov 2003 11:22:50 +0200
Hi,
I am trying to write an HTML page, which will connect XML file and XSL file.
Inside the stylesheet I have SVG code. I tried 2 kind of HTML pages. With
the first html page, there is no problem with the xml transformation, but no
svg shown on screen. With the second html page no problem with the xml
transformation and the SVG objects are rendered on the screen,
But I cant operate SVG events(onclick etc.) and SVG DOM manipulations
I guess I miss something at the processor definitions at the html page.
(I use IE5+ msxml3.0+ and svg3)
The first option for HTML page:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<script language="JavaScript" type="text/javascript">
<!--
type="text/javascript">
function transformandsvg(){
var xslt = new ActiveXObject("Msxml2.XSLTemplate.4.0");
var xslDoc = new ActiveXObject("Msxml2.FreeThreadedDOMDocument.4.0");
var xslProc;
xslDoc.async = false;
xslDoc.load("test.xsl");
xslt.stylesheet = xslDoc;
var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.4.0");
xmlDoc.async = false;
xmlDoc.load("test.xml");
xslProc = xslt.createProcessor();
xslProc.input = xmlDoc;
xslProc.transform();
document.write(xslProc.output);
}
//-->
</script>
</head>
<body id="connect" onload="transformandsvg()">
</body>
</html>
The second option for HTML page (using asv3)
<?xml version="1.0"?>
  <html xmlns="http://www.w3.org/1999/xhtml";
      xmlns:asv="http://www.adobe.com/svg"; >
      <head>
          <object id="asv"
            classid="clsid:78156a80-c6a1-4bbf-8e6a-3cd390eeb4e2">
          </object>
          <?import namespace="asv" implementation="#asv"?>
    </head>
    <body>
     <script type="text/JavaScript">
         var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
      var xslDoc = new ActiveXObject("Microsoft.XMLDOM");
                  xmlDoc.async = xslDoc.async = false;
xmlDoc.load("test.xml")
              xslDoc.load("test.xsl");
               var strSVG = new String(xmlDoc.transformNode(xslDoc));
     document.write(strSVG.substring(39));
    </script>
    </body>
   </html>
With the second HTML file above the xsl transformations are ok, the svg
objects are rendered to the screen, but the SVG is static(cant make events
and DOM manipulations.Didnt find any solution so far.
Many thanks for any help!!!
Udi



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread