There's some very strange code here.
This:
<xsl:for-each select=".[.//UsedByProduct = $implSource]">
is equivalent to
<xsl:if test=".//UsedByProduct = $implSource">
which is surely clearer. Moreover, that condition seems to be always true, because if it weren't true then the template wouldn't match.
Similarly most people would write
<xsl:for-each select=".[matches($currRow//TL1Commands[@cmdType='RetrieveIn'], '^M.*$')]">
as <xsl:if test="matches(....)">
Moreover the three branches of the xsl:choose are so similar that they could surely be turned into a function with a single parameter.
As for the actual question: position()=last() within a template rule is probably not a particularly good idea, because its meaning depends on the set of things selected by the corresponding apply-templates call, which you haven't shown us. If you want to use position()=last(), then in the apply-templates that invokes this template rule you should only select the elements you want to process: that is, you should filter out those that are (to use your term) "null".
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer's Reference