Re: [xsl] html inside xml

Subject: Re: [xsl] html inside xml
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Mon, 15 Oct 2001 16:08:43 +0100
Hi Henry,

>      Set innernode = xmldoc.createNode("element","value","")
>     ??? ???
>
> Here I want to append htmlDom to the value node, but I am not sure
> how to do it. I have a play with Chris Bayes's domtodom.js but have
> no idea how to implement his javascript functions into my case here.
> If you can go through a little more detail in this topic here, it
> will be very very helpful.

The point that's addressed in the domtodom.js functions is that, the
way the DOM API is designed, a node in one DOM cannot be directly
copied into another DOM. So you have to look at the node you want to
copy in the HTMLDOM and create a new node in the xmldoc DOM that looks
exactly the same.

You should be able to create the equivalent of Chris' copyNode() and
copyAttributes() functions in VB just by changing the syntax a bit
(you have access to exactly the same methods and properties as Chris
does in Javascript, since you're both using MSXML).

You can then call the copyNode() function with something like:

  copyNode(HTMLDOM.documentElement, innernode, HTMLDOM, xmldoc)

The function goes through all the children of the node passed as the
first argument and creates new equivalent nodes as a children of the
node passed as the second argument, which is in the document passed as
the fourth argument. The third argument isn't used at all as far as I
can tell.

Once you've copied the contents of the HTMLDOM onto the innernode
element that you've created, remember to add the innernode (value)
element to the xmldoc DOM that you're generating, using the same
syntax as you've used to add the other elements, with the
appendChild() method.

I hope that helps,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


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


Current Thread