One way is to count the elements as in
Code:
<xsl:template match="contentSWA">
<xsl:variable name="pos" select="count(../../(., preceding-sibling::document))"/>
<xsl:variable name="attachment" select="doc($manifest)/manifest/attachments/attachment[$pos]"/>
<xsl:copy>
<xsl:copy-of select="$attachment"/>
</xsl:copy>
</xsl:template>