As a quick and relayable way to solve your problem I suggest you to create a factory method, that will give you initialised Worklog
instance by issue key.
In that case, you will be able process xml same as you do, with minor changes. Below is a draft of code, to process worklogs.
def worklogs = [:]
def createWorklog(String id) {
if (!worklogs.containsKey(id))
worklogs[id] = new Worklog()
return worklogs[id]
}
worklogs.worklog.each {node ->
wklog = createWorklog(node.issue_key); // creates, or give created, and save it to list.
// It don't know, what do you want to do with different dates or usernames.
// If you want, you can have a list of them, and add value to list here, or consolidate whole change structures to list.
wklog.hours += node.hours // aggregate hours.
}