I have two XML files. One is the main XML file and the other one is used as a lookup table. Here is the main XML:
I would do it like this (assuming XSLT 2.0):
[edit] Here is an XSLT 1.0 rewrite of the above XSLT 2.0 stylesheet: