Below is the input XML (Little Big) sorry for the bigger input XML and as well as output xml
chapter unit
If you just want to remove the "~", use translate(xxx, '~', '')
Beyond that, I'm afraid you're not making your requirements clear. For example, I don't understand this clause:
if there is no value in by default it has to displayed unit 10