xml - XPATH, XSLT: transformation failed due to incorrect schema -


i have incoming xml need transform. 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 transform xml error. found transformation completes if first scheme changed 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 beginning xmlns="http://tempuri.org/exportdataset.xsd" changed xmlns:d2p1="http://www.w3.org/2001/xmlschema" i'm using standart xslt file generated 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 way modify xslt file process original xml without applying changes it? in advance!

so everyone, had declare new schema http://tempuri.org/exportdataset.xsd using prefix , use prefix nodes:

<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"                 xmlns:tmp="http://tempuri.org/exportdataset.xsd">     <xsl:output method="xml" indent="yes"/>    <xsl:template match="tmp:exportdataset" >     <xsl:element name="declarations">       <xsl:apply-templates select="tmp:document" />     </xsl:element>   </xsl:template>    <xsl:template match="tmp:document"> 

now transformation works fine.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -