Page 1 of 1

Add attribute with value

Posted: Wed Jan 17, 2018 2:59 pm
by bee123
Hello,

I have several files where I need to add an attribute with values.
I have a file that looks similar to this:

<text id="124" title="abc" start="1">
<text id="125" title="xyz" start="4">
<text id="126" title="zgh" start="18">
<text id="127" title="jda" start="332">

and i need to add a "end"-attribute with a value of the next element's start attribute's value MINUS 1, so for the the element with the id it would be 3 (because 4-1)
it should look like this:

<text id="124" title="abc" start="1" end="3">
<text id="125" title="xyz" start="4" end="17">
<text id="126" title="zgh" start="18" end="331">
<text id="127" title="jda" start="332" end="">

any ideas or tipps how i could do that fast and easy?
THANK YOU