- don't use xsl:for-each, use xsl:apply-templates
- don't use named templates, use xsl:apply-templates with a mode
- if a template just contains a choose/when, separate out the branches into individual templates
- instead of xsl:value-of use xsl:apply-templates
- one large template is bad, lots of specific small templates is good
so for example:
you could do:
or you could do:
both will output the same result.
Now if a requirement comes in to wrap the type in <b>, but only if its 'beer', if you have used apply-templates you can just add the
...and then go home. However if you have use value-of earlier on,
you would need to go and modify that template first to change it to an apply-templates anyway.