how can i convert the following XML
_______________ _______________ _______________ _____
<?xml version="1.0" encoding="UTF-8"?>
<object type="company" action="C">
<property name="howmanynu mbers" action="Create" >
<value>1</value>
<value>2</value>
<value>3</value>
</property>
<property name="howmanynu mbers" action="Delete" >
<value>a</value>
<value>b</value>
<value>c</value>
</property>
<property name="numbers" action="Update" >
<value>123456 </value>
<value>234567 </value>
</property>
</object>
_______________ _______________ _______________ ___________
when iam using the XSLT i prepared something like this
<?xml version="1.0"?>
<xsl:styleshe et xmlns:xsl="http ://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match = "/">
<xsl:element name="Header">
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<xsl:template match ="object">
<xsl:text disable-output-escaping="yes"> <</xsl:text>
<xsl:value-of select="@type"/>
<xsl:text disable-output-escaping="yes"> ></xsl:text>
<xsl:element name="action">
<xsl:value-of select="@action "/>
</xsl:element>
<xsl:apply-templates select = "property" />
<xsl:apply-templates select = "object" />
<xsl:text disable-output-escaping="yes"> </</xsl:text>
<xsl:value-of select ="@type"/>
<xsl:text disable-output-escaping="yes"> ></xsl:text>
</xsl:template>
<xsl:template match = "property">
<xsl:text disable-output-escaping="yes"> <</xsl:text>
<xsl:value-of select="@name"/>
<xsl:text disable-output-escaping="yes"> ></xsl:text>
<xsl:element name="action">
<xsl:value-of select="@action "/>
</xsl:element>
<xsl:element name="value">
<xsl:value-of select="value"/>
</xsl:element>
<xsl:text disable-output-escaping="yes" ></</xsl:text>
<xsl:value-of select="@name"/>
<xsl:text disable-output-escaping="yes"> > </xsl:text>
</xsl:template>
</xsl:stylesheet>
Iam getting the o/p like dis....
<?xml version="1.0" encoding="UTF-16"?><Header><c ompany><action> C</action><howmany numbers><action >Create</action><value>1 </value></howmanynumbers > <howmanynumbers ><action>Delete </action><value>a </value></howmanynumbers > <numbers><actio n>Update</action><value>1 23456</value></numbers > </company></Header>
But the value is not repeated only the first value in each property it is giving can anyone suggest the modification in stylesheet so that i will get the full output like dis
<howmanynumbers ><value>1</value><value>2</value><value>3</value><action>D elete</action></howmanynumbers >
Thanks in advance
KuttanKuttan
_______________ _______________ _______________ _____
<?xml version="1.0" encoding="UTF-8"?>
<object type="company" action="C">
<property name="howmanynu mbers" action="Create" >
<value>1</value>
<value>2</value>
<value>3</value>
</property>
<property name="howmanynu mbers" action="Delete" >
<value>a</value>
<value>b</value>
<value>c</value>
</property>
<property name="numbers" action="Update" >
<value>123456 </value>
<value>234567 </value>
</property>
</object>
_______________ _______________ _______________ ___________
when iam using the XSLT i prepared something like this
<?xml version="1.0"?>
<xsl:styleshe et xmlns:xsl="http ://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match = "/">
<xsl:element name="Header">
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<xsl:template match ="object">
<xsl:text disable-output-escaping="yes"> <</xsl:text>
<xsl:value-of select="@type"/>
<xsl:text disable-output-escaping="yes"> ></xsl:text>
<xsl:element name="action">
<xsl:value-of select="@action "/>
</xsl:element>
<xsl:apply-templates select = "property" />
<xsl:apply-templates select = "object" />
<xsl:text disable-output-escaping="yes"> </</xsl:text>
<xsl:value-of select ="@type"/>
<xsl:text disable-output-escaping="yes"> ></xsl:text>
</xsl:template>
<xsl:template match = "property">
<xsl:text disable-output-escaping="yes"> <</xsl:text>
<xsl:value-of select="@name"/>
<xsl:text disable-output-escaping="yes"> ></xsl:text>
<xsl:element name="action">
<xsl:value-of select="@action "/>
</xsl:element>
<xsl:element name="value">
<xsl:value-of select="value"/>
</xsl:element>
<xsl:text disable-output-escaping="yes" ></</xsl:text>
<xsl:value-of select="@name"/>
<xsl:text disable-output-escaping="yes"> > </xsl:text>
</xsl:template>
</xsl:stylesheet>
Iam getting the o/p like dis....
<?xml version="1.0" encoding="UTF-16"?><Header><c ompany><action> C</action><howmany numbers><action >Create</action><value>1 </value></howmanynumbers > <howmanynumbers ><action>Delete </action><value>a </value></howmanynumbers > <numbers><actio n>Update</action><value>1 23456</value></numbers > </company></Header>
But the value is not repeated only the first value in each property it is giving can anyone suggest the modification in stylesheet so that i will get the full output like dis
<howmanynumbers ><value>1</value><value>2</value><value>3</value><action>D elete</action></howmanynumbers >
Thanks in advance
KuttanKuttan
Comment