У меня xml как ниже,
<?xml version="1.0" encoding="utf-16" ?>
<AllResidentAndUnitInfo xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
i:type="ResidentsByUnitInfo" xmlns="http://schemas.datacontract.org/2004/07/FSRSchema">
<BillingAddresses>
<BillingAddress>
<billing_address1>Some address</billing_address1>
<billing_address2 />
<billing_city>Gilbert</billing_city>
<billing_country i:nil="true"/>
<billing_dtmmodified>2010-12-08T01:37:41+05:30</billing_dtmmodified>
<billing_state>AZ</billing_state>
<billing_zipcode>23233</billing_zipcode>
</BillingAddress>
<BillingAddress>
<ResidentsByUnitInfoPropertyUnitBillingAddress>
<billing_address1>Some address</billing_address1>
<billing_address2 />
<billing_city>Gilbert</billing_city>
<billing_country i:nil="true"/>
<billing_dtmmodified>2010-12-08T01:37:41+05:30</billing_dtmmodified>
<billing_state>AZ</billing_state>
<billing_zipcode>23233</billing_zipcode>
</ResidentsByUnitInfoPropertyUnitBillingAddress>
</BillingAddress>
....
</AllResidentAndUnitInfo>
Я преобразую в другой XML-формат в C # с помощью XslCompiledTransform,
<?xml version='1.0' ?>
<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
xmlns:msxsl='urn:schemas-microsoft-com:xslt'
xmlns:i='http://www.w3.org/2001/XMLSchema-instance' exclude-result-prefixes='msxsl
i' version='1.0'>
<xsl:output method='xml' indent='yes'/>
<xsl:template match='/AllResidentAndUnitInfo/BillingAddresses/BillingAddress'>
<Root>
<Address1>..</Address2>
...
</Root>
</xsl:template>
</xsl:stylesheet>
Я получаю сообщение об ошибке «Token Text в состоянии Start приведет к недопустимому XML-документу. Убедитесь, что для параметра ConformanceLevel установлено значение ConformanceLevel.Fragment или ConformanceLevel.Auto, если вы хотите записать фрагмент XML. «Я понял, что проблема связана с атрибутами i: nil в xml. Хотя я включил их пространство имен в XSLT все еще получаю сообщение об ошибке.