[xsl] Problem Copying an element, always getting first in the list

Subject: [xsl] Problem Copying an element, always getting first in the list
From: "Sian Mace" <sianmace@xxxxxxxxxxx>
Date: Tue, 08 Feb 2005 15:52:03 +0000
<Tests>
	<Test>
	<ASIN>12334</ASIN>
	<Attributes>
		<Name>Sian</Name>
		<Type>th</Type>
	</Attributes>
	</Test>
	<Test>
	<ASIN>54321</ASIN>
	<Attributes>
		<Name>JIM</Name>
		<Type>th</Type>
	</Attributes>
	</Test>
</Tests>

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:output method="xml"/>

<xsl:template match="@*|node()">
       <xsl:copy>
           <xsl:apply-templates select="@*|node()"/>
       </xsl:copy>
</xsl:template>

<xsl:template match="/Tests/Test/Attributes">
   <xsl:copy>
           <xsl:apply-templates select="@*|node()"/>
       <asin><xsl:value-of select="/Tests/Test/ASIN"/></asin>
       </xsl:copy>
   </xsl:template>

</xsl:stylesheet>

I would like the output to be the following

<Tests>
	<Test>
	  <Attributes>
		<Name>Sian</Name>
		<Type>th</Type>
                               <ASIN>12334</ASIN>
	  </Attributes>
	</Test>
	<Test>
	  <Attributes>
		<Name>JIM</Name>
		<Type>th</Type>
	                <ASIN>54321</ASIN>
	  </Attributes>
	</Test>
</Tests>

but im getting
<Tests>
	<Test>
	  <Attributes>
		<Name>Sian</Name>
		<Type>th</Type>
                               <ASIN>12334</ASIN>
	  </Attributes>
	</Test>
	<Test>
	  <Attributes>
		<Name>JIM</Name>
		<Type>th</Type>
	                <ASIN>12334</ASIN>
	  </Attributes>
	</Test>
</Tests>

You can see that the ASIN is copying the first one in the iteration each time, and not the correct one for example Jims ASIN wich is 54321!!

Please help me.

Current Thread