WIP: Miscellaneous fixes for XSL template