Start New Discussion within our Software Development Community

HI guys,
i have split and xml in two parts, and in the root element element of the second one(which in this case is the output) want to add an attribute...but do not have any idea how to do this...
my XML:

<DataSet>
<Input>
<Order OrderNo="tesco10" DocumentTYpe="0001"/>
</Input>
<Output>
<Order OrderNo="Order1" CompanyCode="ABCD" OrderType="Sales">
<OrderLines>
<OrderLine PrimeLine="1"/>
</OrderLines>
</Order>
</Output>
</DataSet>

my xsl:

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/DataSet/Output/Order">
<xsl:copy-of select="."/>
<xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>

the output:

<?xml version="1.0" encoding="UTF-16"?><Order OrderNo="Order1" CompanyCode="ABCD" OrderType="Sales">
<OrderLines>
<OrderLine PrimeLine="1" />
</OrderLines>
</Order>

desired output:

<?xml version="1.0" encoding="UTF-16"?>
<Order OrderNo="Order1" CompanyCode="ABCD" OrderType="Sales" Value="10USD">
<OrderLines>
<OrderLine PrimeLine="1" />
</OrderLines>
</Order>

thanks in advance....

Please try with the below:

<xsl:template match="/DataSet/Output/Order">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:attribute name="test">test</xsl:attribute>
<xsl:copy-of select="*"/>
</xsl:copy>
<xsl:apply-templates/>
</xsl:template>
This article has been dead for over six months. Start a new discussion instead.