XML на регулярках… ненене.
# coding: utf-8
import codecs
from lxml import etree
ENCODING = 'utf-8'
XML_SOURCE_FILE = 'source.xml'
XML_OUT_FILE = 'source.out.xml'
VALUE = -120
TAG_NAME = 'id'
with codecs.open(XML_SOURCE_FILE, encoding = ENCODING) as xml_source:
root = etree.parse(xml_source).getroot()
for tag in root.iter(TAG_NAME):
tag.text = str(int(tag.text) + VALUE)
with codecs.open(XML_OUT_FILE, 'w', encoding = ENCODING) as xml_out:
xml_out.write(etree.tostring(root, pretty_print = True, encoding = ENCODING, xml_declaration = True))
И xmllint для профилактики не забудьте.