There isn't currently a straightforward means to do this. However you could create a new node at the same level. Insert your new node (<dummy/>) under it, then cut/paste any existing nodes from the old location into the new location. Finally rename your newm node to be the node name you want. Not nice, but it'll get you there.

I'm thinking currently about 'ordered' insertsbut I don't want to implement anything just yet until I've thought through the consequences.

Brian

Maarten Coene wrote:
Hi,

I want to insert an element at the first position under an element "<root>".

I tried the following:
<insert path="/root" position="under"><![CDATA[<dummy />]]></insert>
-> this inserts the element at the last position

<insert path="/root/*[position() = 1]" position="before"><![CDATA[<dummy />]]></insert>
-> this inserts the element at the first position, but it doesn't work if the <root> element is empty

I would need something like this:
<insert path="/root" position="under-first"><![CDATA[<dummy />]]></insert>

any suggestions?

regards,
Maarten

-- 
Brian Agnew                  http://www.oopsconsultancy.com
OOPS Consultancy Ltd         brian @ oopsconsultancy.com
Tel: +44 (0)7720 397526
Fax: +44 (0)20 8682 0012


Reply via email to