If you donβt want to consider things like getting to know developers, I would say almost always, assuming you have XSLT 2.0 or at least EXSLT, since XSLT 1.0 is pretty limited (if you only need structural transformations, 1.0 is enough, but if you need to do something with the content, you want to stay away from 1.0). XSLT is specifically designed for XML conversion, and I have found it much better for this task than general purpose XML libraries.
Of course, everyone assumes that you only need to convert the input XML to some other form. In the real world, requirements are changing, and suddenly you have to not only convert XML, but also perform some operations based on it. Although XSLT is Turing-complete, it is not a universal programming language, so it may be safer to use another language to provide future validation. However, I would probably implement the first version in XSLT, because I find it faster and more understandable, and only if XSLT later proves unsuitable, I would consider something else.
Jaakkok
source share