I am trying to remove the line from my non well - XML. But while reading the XML using the below tried XSLT, it gives me error in reading the same.
Source XML : This has two xml version declarations.
<?xml version="1.0" encoding="UTF-8"?>
<root>
<?xml version="1.0" encoding="utf-8"?>
<test xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<data>hello</data>
</test>
</root>
Tried XSL :
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="UTF-8"/>
<xsl:template match="/">
<xsl:copy-of select="*" />
</xsl:template>
</xsl:stylesheet>
Expected Output :
<?xml version="1.0" encoding="UTF-8"?>
<root>
<test>
<data>hello</data>
</test>
</root>
But i am getting error that the input XML cannot be read by XSLT. Can someone please let me know is there a way that we can adjust the xslt to read the same.
Thank you.