Customizing xpath generation

I have created another post where I tried to propose a solution to this issue.