I have incoming xml that I need to transform. The xml begins:
<?xml version="1.0" encoding="utf-8"?>
<ExportDataSet xmlns="http://tempuri.org/ExportDataSet.xsd">
<xs:schema id="ExportDataSet" targetNamespace="http://tempuri.org/ExportDataSet.xsd" xmlns:mstns="http://tempuri.org/ExportDataSet.xsd" xmlns="http://tempuri.org/ExportDataSet.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" attributeFormDefault="qualified" elementFormDefault="qualified">
<xs:element name="ExportDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="Document">
Trying to transform this xml I get an error. I found that transformation completes successfully if the first scheme is changed to look like:
<?xml version="1.0" encoding="utf-8"?>
<ExportDataSet xmlns:d2p1="http://www.w3.org/2001/XMLSchema">
<xs:schema id="ExportDataSet" targetNamespace="http://tempuri.org/ExportDataSet.xsd" xmlns:mstns="http://tempuri.org/ExportDataSet.xsd" xmlns="http://tempuri.org/ExportDataSet.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" attributeFormDefault="qualified" elementFormDefault="qualified">
<xs:element name="ExportDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
So in the beginning xmlns="http://tempuri.org/ExportDataSet.xsd" is changed to xmlns:d2p1="http://www.w3.org/2001/XMLSchema" I'm using a standart XSLT file generated by Visual Studio. in begins with:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="ExportDataSet" >
<xsl:element name="Declarations">
<xsl:apply-templates select="Document" />
</xsl:element>
</xsl:template>
<xsl:template match="Document">
...
Is there any way to modify my XSLT file to process the original XML without applying any changes to it? Thanks for help in advance!