Lot's of 'when' clauses ...
This is a bit of a design question and so I hope that someone can give me a second opinion and maybe some tips?
There is a lot of grouping/summing so the first action is to call (one of a number of) the following ...
<xsl:apply-templates select="rep_base[generate-id()=generate-id(key('kteam', team)]" mode="dteam">
[? Possible match location ?]
[other when statements]
This in turn, then calls the following:
<xsl:template match="rep_base" mode="dteam">
<td><xsl:value-of select="team" />
<td ALIGN="RIGHT"><xsl:value-of select="sum(key('kteam', team)[plant_code=$pfiltfld]/GOODS_CNT)" />
All this works fine but now it is becoming extremely complicated with a whole stack of 'when' statements calling various templates presenting various views of the data.
I then thought I would try putting the 'template' inside the 'apply-templates select' clause but the syntax was not accepted.
So my question here is: How can I best tidy up all these 'when' clauses and make clear blocks of functionality which enable easier maintenance. i.e. it is very difficult to jump between the apply-template clause and the actual template display.
Anyway, any tips on how to keep 'mushrooming' code under control would be a great help.