The following XSLT guildelines should be followed for the development of XSL stylesheets.
First, and most obvious, indent (and do it with tabs, not spaces). The standard practice is to add one tab of indent for each enclosing tag.
Comment the code liberally. If you feel like you’re putting in too many comments,it’s probably just enough. Specifically, be sure to give explanations of the purpose of any variables you use, and the function of each template.
Try to keep your XPath statements simple. These are the statements that appear with select=”…” sections. When these statements get too long they can be very hard to decipher, so it’s best to simplify as much as possible.
Avoid XSLT named templates; Use Template Match instead as it gives procedural feel to the code. When you have a stylesheet with lots of template matches, (and modes) it gets a lot easier to read, and cuts a LOT of code, especially when calling/applying these templates.
Use XSLT named templates for utility functions.
Use the element name itself rather than
xsl:element for e.g.