I need a pythonscript where i can update an attribute field from an already defined XML-file.

I'll make a little step by step to what happens to better illustrate the problem:

1. I have a Javascript/HTML page which shows a dynamic form.
2. Form data sent to pythonscript which makes a XML file out of it.
3 The XML file is presented as a question form on another page after XSLT transformation.

4. The data from the previous form will need to update an attribute field through a python script.

I need help with point 4. The attribute we're talking about is a numeric which i want to increase by one if that questions answer has been chosen in the form. I was hoping there maybe was a function which would do this for me without too much trouble.

Hope anyone can help me or lead me on the right way!