Quote:
quote:Originally posted by g_srihari9
Hi,
I got a problem in getting node names. here is the example XML.
<DataKey>
<accountNo>12234</accountNo>
<Amount>+12344.99</Amount>
<Date>03/23/2003</Date>
<DataKey>
I want the output as followes.
<DataKey>
<Data Name"accountNo">12234</Data>
<Data Name"Amount">+12344.99</Data>
<Data Name"Date">03/23/2003</Data>
<DataKey>
Could any one please send me xsl format for this??
Thanks in advance.
Regards,
Srihari
Srihari
|
You wanna try it with this?
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes" method="xml"/>
<xsl:template match="/" >
<xsl:apply-templates />
</xsl:template>
<xsl:template match="DataKey" >
<DataKey>
<xsl:apply-templates />
</DataKey>
</xsl:template>
<xsl:template match="*" >
<xsl:element name="Data" >
<xsl:attribute name="Name" >
<xsl:value-of select="name()" />
</xsl:attribute>
<xsl:value-of select="." />
</xsl:element>
</xsl:template>
</xsl:stylesheet>
Regards