[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Problem Copying an element, always getting first in th
<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.
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|