Refactored XSL transformation