W3C home > Mailing lists > Public > www-svg@w3.org > June 2000

Replacing an SVG node with a parser XML node?

From: Justin Friedl <justin.friedl@aspentech.com>
Date: Mon, 12 Jun 2000 15:49:31 -0400
Message-ID: <B1612D837360D111A9C000805FBBCCC901E87D18@geoffrey.sea.aspentech.com>
To: "'www-svg@w3.org'" <www-svg@w3.org>
  I'm using XML as my data source and SVG as presentation.  I want to take
different views of the data by re-applying different XSLT style sheets to
the XML data that is cached on the browser. (the XSLT style sheet transforms
the XML into SVG-XML data)  I then want to replace the currently viewed SVG
image with the new SVG data the was outputted from the XSLT transformation.
I'm trying to do this within the confines of IE5 (ie MSXML3 xml parser)
browser. below is code within a web page that I tried.  It fails when I try
to replace the old SVG with the new SVG.  
any suggestions?
thanks in advance
Justin

<html>
<head>
<title>Untitled Document</title>
<script language="javascript">
  function putXML()
  {
  // Load the XML 
  var source = new ActiveXObject("MSXML2.DOMDocument");
  source.async = false;
  source.load("http://friedlj1/xslXml/xslxml/gantt.xml");

  // Load the XSLT
  var style = new ActiveXObject("MSXML2.DOMDocument");
  style.async = false;
  style.load("http://friedlj1/xslXml/xslxml/ganttHeader.xsl");
  var svgSource = new ActiveXObject("MSXML2.DOMDocument");
  
  // Transform XML to SVG output
  source.transformNodeToObject(style, svgSource);
  
  var svgdoc = window.gantt.getSVGDocument();
  
  var svgNodeFromSVG = svgdoc.getFirstChild(); 
  var svgNodeFromXML = svgSource.selectSingleNode("svg");
  var svgNode = svgdoc.replaceChild(svgNodeFromXML,svgNodeFromSVG);   //
this line throws a type mismatch error
  }
</script>
</head>
<body onload="putXML()" bgcolor="#ffffff">
<span id="header1"></span>
<embed id="gantt" src="../svg/dummy.svg" height="100%" width="100%" 
type="image/svg-xml" pluginspage="http://www.adobe.com/svg/viewer/install/">
</embed>
</body>
</html>
Received on Monday, 12 June 2000 15:49:40 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:18 GMT