So you want to transform the part of the input up to the first item that matches some condition C.
So find the first item that matches C:
Code:
<xsl:variable name="finalItem" select="/*/item[C][1]"/>
and then transform everything that comes before this item:
Code:
<xsl:apply-templates select="$finalItem/preceding-sibling::*"/>
Of course that's just a sketch, you'll have to adapt it to your actual input.