how to copy XML and change attributes?

T

ted

Hello,

I'm trying to copy a node and all its descendants and also change all the id
attributes.

<book>
<chapter id="c1">
<verse id="v1">Hello World</verse>
<verse id="v2">Goodbye World</verse>
</chapter>
<biblio id="b1">
<ref>reference one</ref>
</biblio>
</book>

I've been working on this little sample and can't get anywhere. I'd like to
be able to copy the chapter and make it output this:

<chapter id="c1-1">
<verse id="v1-1">Hello World</verse>
<verse id="v2-1">Goodbye World</verse>
</chapter>

Any help appreciated.

TIA,
Ted
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,221
Latest member
TrinidadKa

Latest Threads

Top