[xsl] javascript access to XML DOM in IE5+

Subject: [xsl] javascript access to XML DOM in IE5+
From: Steve Rosenberry <Steve.Rosenberry@xxxxxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 22 Apr 2002 00:15:10 -0400
(with apologies for the length and to those who monitor both the XML and
XSLT list...)

If I give my IE5 browser the URL of an XML file, IE is kind enough to
load it, discover the XSLT PI inside, and display the resulting
user-interface that I want.  No problems so far, but now I would like to
trigger client-side javascript XML DOM edit functions from buttons
placed on said form (e.g. insert, modify, or remove elements) and
hopefully have the new XML DOM tree re-displayed.

The general consensus on comp.lang.javascript (see [1] for all the gory
details) was that the original XML DOM tree has been flushed in the
above scenario, and I was left with three choices if I actually wanted
to manipulate the XML after displaying it:

1) Use an HTML wrapper that includes the javascript to load, transform,
display, and manipulate the XML.  Aesthetically, theoretically, and
fundamentally this just seems wrong, but has the distinct advantage of
being well-documented.

2) Include the above javascript in an XSLT transform that loads the XML
a second time for manipulation.  Again this seems wrong.  It seems
inefficient and silly to have to load the XML once just to transform it
into the above HTML wrapper to load it a second time so I can manipulate
it. 

3) Use XSLT to copy the original XML to a data island in the HTML output
and access it through the standard javascript document object.  Once
more, I seem to be missing the point of having an XML aware browser.


Is it truly the case that after Internet Explorer goes to all the
trouble of parsing the XML, finding the XSLT PI, and displaying the
resulting output, it just flushes the XML DOM tree down the nearest
ground pin?  I apparently can get to the HTML elements through the
document interface after the transformation, but I can't believe that
the XML has not been tied to a document property or accessible through a
document method.

Please tell me the XML universe is a more beautiful place than this...

[1] http://groups.google.com/groups?th=a99356fbdbf1fa35

-- 
Steve Rosenberry
Sr. Partner

Electronic Solutions Company -- For the Home of Integration
http://ElectronicSolutionsCo.com

http://BetterGoBids.com -- The Premier Overture (formerly GoTo) 
                           Bid Management Tool

(610) 670-1710

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


Current Thread