RE: Adding a childnode to a DataIsland

Subject: RE: Adding a childnode to a DataIsland
From: "Chris Bayes" <Chris@xxxxxxxxxxx>
Date: Wed, 2 Aug 2000 18:37:25 +0100
Can you use
lastRoom.insertAdjacentHTML("afterEnd", strNewRoom);
Can't try it at the moment.

Otherwise you will have to recurse 2 doms
creating nodes in the island for each encountered in the
newDom.loadXML(strNewRoom)
You can't copy a node from one dom to another unfortunately.

Failing that it might be easier to add a an <xsl:copy-of select="/" /> in
the island where you want to insert the new room then do something like

newXsl = "<?xml version=\"1.0\"?>" +
"<xsl:template match=\"/\" >" +
roomsXML.xml +
"</xsl:template>"

roomsXML.innerHTML =
newDom.loadXML(strNewRoom).transformNode(xsl.loadXML(newXsl))


Ciao Chris

>-----Original Message-----
>From: owner-xsl-list@xxxxxxxxxxxxxxxx
>[mailto:owner-xsl-list@xxxxxxxxxxxxxxxx]On Behalf Of Sunny
>Sent: 02 August 2000 11:40
>To: xsl-list@xxxxxxxxxxxxxxxx
>Subject: Re: Adding a childnode to a DataIsland
>
>
>Chris: I need to be able to add a childnode.
>implying that roomsXML had 2 <room> tags - now, i'll need it to have three.
>
>
>----- Original Message -----
>From: Chris Bayes <Chris@xxxxxxxxxxx>
>To: <xsl-list@xxxxxxxxxxxxxxxx>
>Sent: Wednesday, August 02, 2000 4:09 AM
>Subject: RE: Adding a childnode to a DataIsland
>
>
>> Maybe
>> roomsXML.innerHTML = strNewRoom;
>>
>> Ciao Chris
>>
>> >-----Original Message-----
>> >From: owner-xsl-list@xxxxxxxxxxxxxxxx
>> >[mailto:owner-xsl-list@xxxxxxxxxxxxxxxx]On Behalf Of Sunny
>> >Sent: 02 August 2000 06:54
>> >To: xsl-list@xxxxxxxxxxxxxxxx
>> >Subject: Adding a childnode to a DataIsland
>> >
>> >
>> >Hi ! I have an XML dataisland that looks like this -
>> >
>> ><body>
>> ><xml id=roomsXML>
>> ><rooms>
>> >    <room id=101>
>> >        <features> <feature name='a/c'><feature name='bar'></features>
>> >        <properties> <property name='abc' value='105'> <property
>name='xyz'
>> >value='187'></properties>
>> >    </room>
>> >    <room id=102>
>> >        <features> <feature name='jacuzzi'><feature
>> >name='poolside'></features>
>> >        <properties> <property id='31' value='107'> <property id='33'
>> >value='109'></properties>
>> >    </room>
>> ></rooms>
>> ></xml>
>> ></body>
>> >
>> >I also have a string variable somewhere in the script that does:
>> ><begin_code>
>> >    .....
>> >    .....
>> >    var strNewRoom=xmlhttp.responseText (i can use responseXML if you
>need
>> >me to)
>> ></begin_code>
>> >So now, strNewRoom would have the following value returned by a XMLHttp
>> >call:
>> >"<room id=102><features> <feature name='jacuzzi'><feature
>> >name='poolside'></features> <properties> <property id='31' value='107'>
>> ><property id='33' value='109'></properties></room>"
>> >
>> >
>> >How do I add the contents of this variable as a childNode to roomsXML ?
>> >Is it better if I fill in strNewRoom with xmlhttp.responseXML instead ?
>How
>> >would I add it to the dataisland then ?
>> >
>> >tia, Sunny.
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>>
>>
>>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>
>
> XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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


Current Thread