How to set attribute in XML using XSLT?
<xsl:template match="Party"> <Party role="{some/xpath/path}"> <xsl:apply-templates select="@* | node()"/> </Party></xsl:template>
should do. As an alternative
<xsl:template match="Party"> <xsl:copy> <xsl:attribute name="role" select="some/xpath/path"/> <xsl:apply-templates select="@* | node()"/> </xsl:copy></xsl:template>
Of course the apply-templates is only necessary if there are attribute and/or child nodes you also want to be processed (for example to be copied by an identity transformation template).