Code:
<xsl:template match="*">
<xsl:copy>
<xsl:copy-of select="@*/>
<xsl:attribute name="name">work</xsl:attribute>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
might do what you want.
Your attempt does try to create the attribute first (without having any element to create an attribute for), then processes any child elements, then makes a deep copy of the element and all its content.