One of the things that I spend a little too much time working on was how to setup a more streamlined version of resolving entities and ignoring entities. The key has to do with avoiding a call to the XMLValidateNavigator object, and using the XMLTextReader gives you more granularity over the process. Here’s an example:
/*=====================================================
* Function/sub: TransformXSLT
* Description: Does the XSLT translation
* ====================================================*/public int TransformXSLT(string sSource,
string sDest,
string sXSLT,
bool bRemote)
{System.Xml.XmlTextReader reader = new System.Xml.XmlTextReader(sSource);
if (bRemote==false) {
reader.XmlResolver = null;
} System.Text.UTF8Encoding Encoding = new System.Text.UTF8Encoding(false);
System.IO.StreamWriter writer = new System.IO.StreamWriter(sDest, false, Encoding);
try
{ System.Xml.XPath.XPathDocument doc = new System.Xml.XPath.XPathDocument(reader);
System.Xml.Xsl.XslTransform xslt = new System.Xml.Xsl.XslTransform();
xslt.Load(sXSLT);
xslt.Transform(doc, null, writer, null);
writer.Close();
reader.Close();
} catch (System.Exception eee) {
this.sXSLTError = eee.ToString();
writer.Close();
reader.Close();
return mengine60.ERR_XSLT_ERROR;
}
return 0;
}
–TR