There are basically two ways of doing a multiphase transformation: the single stylesheet approach and the multiple stylesheet approach. For big applications, writing one stylesheet per phase has many benefits - it keeps the code simpler, and makes it more reusable; the downside is that you need some extra machinery (e.g. a pipeline processor such as Orbeon) to manage the pipeline.
The single stylesheet approach, which you are attempting, takes the general form:
<xsl:variable name="phase-1-output">
<xsl:apply-templates mode="phase-1"/>
</xsl:variable>
<xsl:variable name="phase-2-output">
<xsl:apply-templates select="xx:node-set($phase-1-output)" mode="phase-2"/>
</xsl:variable>
<xsl:template match="/">
<xsl:apply-templates select="xx:node-set($phase-2-output)" mode="phase-3"/>
</xsl:template>
With an XSLT 2.0 processor the call on xx:node-set() is no longer needed.
Without seeing your code I can't see where you are getting stuck but hope this coding pattern will help you.
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference