- From: Frederick C. Lee <fclee@highstream.net>
- Date: Wed, 16 May 2007 10:38:31 -0600
- To: www-talk@w3.org
- Message-Id: <D269D5F5-9132-4FBE-B054-20316F01E498@highstream.net>
Environment: Mozilla/Firefox 2.0; JavaScript 1.7
My Machine: MacBook Pro running OS X (10.4.9)
Greetings:
My apology if this is the wrong forum.
I've been searching for a way to allow the user to delete a specific
xml element/node/property given its ID.
For example:
var pt =
<periodictable id="0" name="mytable">
<project id="1" name="myproject"/>
<information id="2" name="myInfo"/>
<elements>
<element id="3" type="gas">
<name id='4'>Helium</name>
</element>
<element id="5" type="solid">
<name id="6">Lithium</name>
</element>
</elements>
</periodictable>;
Normally you could delete the element 'Helium' like this:
pt.elements.element[0];
However, I want to be able to dynamically delete a node (element) per
id:
var myID = '3';
delete pt..*.(function::attribute("id")==myID);
But this doesn't work.
Question: How can I dynamically delete an element given its id?
I can't find any info on the internet.
Regards,
Ric.
Windows: "Where do you want to go today?"
Linux: "Where do you want to go tomorrow?"
FreeBSD: "Are you guys coming, or what?"
Received on Wednesday, 16 May 2007 16:41:17 UTC