Modify attribute of certain XML elements
Posted
by hgpc
on Stack Overflow
See other posts from Stack Overflow
or by hgpc
Published on 2010-06-10T17:58:39Z
Indexed on
2010/06/10
18:02 UTC
Read the original article
Hit count: 209
I would like to modify an attribute of a very long xml like this:
<element index="0">
<subelement bla="asdf" />
<subelement bla="asdf" />
</element>
<element index="1">
<subelement bla="asdf" />
<subelement bla="asdf" />
</element>
...
I need to add N the value of each index attribute. Say N=5. The result would be:
<element index="5">
<subelement bla="asdf" />
<subelement bla="asdf" />
</element>
<element index="6">
<subelement bla="asdf" />
<subelement bla="asdf" />
</element>
...
What's the easiest way to do this? I presume it would be with XSLT, but I don't know how to do it.
Thanks!
© Stack Overflow or respective owner