By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,382 Members | 1,973 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,382 IT Pros & Developers. It's quick & easy.

Convert an HTML DOM node to XML Document for XSLT in browser via javascript

P: n/a
I'm wondering if anyone has any ideas about a way to quickly convert an
HTML DOM Node into an XML Document. The goal is that I want to perform
XSLT on the Node, which is coded correctly as XHTML. In Mozillae, it
works to parse the serializeToString output, but this functionality
doesn't exist for IE.

I've made one function that loops through all the nodes & attributes
and constructs a string that can be successfully parsed into xml, but
it is pretty slow. I can't imagine creating a XML Document object and
then doing the same loop to add on objects via XML DOM would be faster.

I don't want to send the html up to a server (to be tidied or whatever)
and it just seems like there might be some magick way to do this that I
can't come up with.

Any ideas?

Jul 22 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a


elsigh wrote:
I'm wondering if anyone has any ideas about a way to quickly convert an
HTML DOM Node into an XML Document. The goal is that I want to perform
XSLT on the Node, which is coded correctly as XHTML. In Mozillae, it
works to parse the serializeToString output,
Mozilla's XSLT processor and Opera 9's XSLT processor can do
transformation on HTML DOM nodes so I don't see why you would want to
make some transition to XHTML with JavaScript to then feed the node to
the XSLT processor. You can as well directly feed the node to the XSLT
processor.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 22 '06 #2

P: n/a
Mozilla's XSLT processor and Opera 9's XSLT processor can do
transformation on HTML DOM nodes so I don't see why you would want to
make some transition to XHTML with JavaScript to then feed the node to
the XSLT processor. You can as well directly feed the node to the XSLT
processor.

Martin Honnen
http://JavaScript.FAQTs.com/
Right, but my issue is with being able to do this in IE (6). It's
neither slow nor difficult in Firefox.

Jul 22 '06 #3

P: n/a
Hi elsigh,

sorry for my english, I'm french...
congratulation for your reorganisable Datagrid, it's impressive.

perhaps, this can help you:
http://erik.eae.net/archives/2005/07/03/20.19.18/
and this :
http://www.pascarello.com/TestHTMLXMLfromserver.htm

Jul 22 '06 #4

P: n/a
Thanks petitevache!

Thing is - both of those examples involve using Ajax to solve the
problem - by getting something down from the server as XML. I'm
currently using parseFromString after creating a string in IE - looping
through the DOM an assembling the string piece by piece - which is
really slow, but seems to be the only way to get well formed xhtml from
the html DOM in IE. But if there was a faster way, or a way to get an
XML Document somehow more readily from an HTML DOM node, that would
really be perfect. Maybe there is just no way.
-l

petitevache wrote:
Hi elsigh,

sorry for my english, I'm french...
congratulation for your reorganisable Datagrid, it's impressive.

perhaps, this can help you:
http://erik.eae.net/archives/2005/07/03/20.19.18/
and this :
http://www.pascarello.com/TestHTMLXMLfromserver.htm
Jul 22 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.