Hi,

I am trying to reorder XML elements using XSL but my XSL doesnt work.
Can you please help?

Below are the input XML, input XSLs and the output XML I got. I am using a Java utility to covert XML to another XML.

Input XML

<?xml version="1.0" encoding="ISO-8859-1"?>
<MAIN>
<SUBMSG recordno="0001" reference="00000000000000000001" typeref="ACP" status="NONE">
<EREF type="AA1" extref="100001" />
<DATE day="SUNDAY" datewil="2011-09-11" time="00:00:00" />
</SUBMSG>
</MAIN>

Input XSL

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlnssl="http://www.w3.org/1999/XSL/Transform">
<xslutput method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<MAIN>
<xsl:template match="MAIN/SUBMSG">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:copy-of select="DATE"/>
<xsl:copy-of select="EREF"/>
</xsl:copy>
</xsl:template>
</MAIN>
</xsl:stylesheet>

Desired Output

<?xml version="1.0" encoding="ISO-8859-1"?>
<MAIN>
<SUBMSG recordno="0001" reference="00000000000000000001" typeref="ACP" status="NONE">
<DATE day="SUNDAY" datewil="2011-09-11" time="00:00:00" />
<EREF type="AA1" extref="100001" />
</SUBMSG>
</MAIN>

Output XML I got

<?xml version="1.0" encoding="UTF-8"?>

Thanks
Ahalya