G
George Durzi
I know this has changed greatly since v1.0. I'm converting a small portion
of my application where I do a transformation.
The error happens on this line:
oXslTransform.Load(XslPath + DataSourceName + ".xsl", oXmlUrlResolver);
ex.Message gives me: "Invalid Site"
ex.InnerException is empty
I've verified that XslPath + DataSourceName + ".xsl" is giving me the
correct path to the stylesheet in the format:
\\servername\e$\XslPath\StylesheetName.xsl
Here's my code
string ReportPath = ReportsFilePath + DataSourceName + TimePeriodSuffix
+ PreferredEmailFormat;
// Create a FileStream to write with
System.IO.FileStream oFileStream = new System.IO.FileStream(ReportPath,
System.IO.FileMode.Create);
// Create an XmlTextWriter for the FileStream
System.Xml.XmlTextWriter oXmlTextWriter = new
System.Xml.XmlTextWriter(oFileStream, System.Text.Encoding.Unicode);
try
{
// Create an XmlDataDocument from the ReportData DataSet parameter
XmlDataDocument oXmlDataDocument = new XmlDataDocument(ReportData);
// Set up the transformation
System.Xml.Xsl.XslTransform oXslTransform = new
System.Xml.Xsl.XslTransform();
// Load the Xsl and Transform
XmlUrlResolver oXmlUrlResolver = new XmlUrlResolver();
oXmlUrlResolver.Credentials = CredentialCache.DefaultCredentials;
oXslTransform.Load(XslPath + DataSourceName + ".xsl", oXmlUrlResolver);
// Xsl Path is class variable
oXslTransform.Transform(oXmlDataDocument, null, oXmlTextWriter,
oXmlUrlResolver);
// Close the XmlTextWriter object
oXmlTextWriter.Close();
return ReportPath;
}
catch (System.Exception ex)
{
oXmlTextWriter.Close();
System.IO.File.Delete(ReportPath);
throw (ex);
}
of my application where I do a transformation.
The error happens on this line:
oXslTransform.Load(XslPath + DataSourceName + ".xsl", oXmlUrlResolver);
ex.Message gives me: "Invalid Site"
ex.InnerException is empty
I've verified that XslPath + DataSourceName + ".xsl" is giving me the
correct path to the stylesheet in the format:
\\servername\e$\XslPath\StylesheetName.xsl
Here's my code
string ReportPath = ReportsFilePath + DataSourceName + TimePeriodSuffix
+ PreferredEmailFormat;
// Create a FileStream to write with
System.IO.FileStream oFileStream = new System.IO.FileStream(ReportPath,
System.IO.FileMode.Create);
// Create an XmlTextWriter for the FileStream
System.Xml.XmlTextWriter oXmlTextWriter = new
System.Xml.XmlTextWriter(oFileStream, System.Text.Encoding.Unicode);
try
{
// Create an XmlDataDocument from the ReportData DataSet parameter
XmlDataDocument oXmlDataDocument = new XmlDataDocument(ReportData);
// Set up the transformation
System.Xml.Xsl.XslTransform oXslTransform = new
System.Xml.Xsl.XslTransform();
// Load the Xsl and Transform
XmlUrlResolver oXmlUrlResolver = new XmlUrlResolver();
oXmlUrlResolver.Credentials = CredentialCache.DefaultCredentials;
oXslTransform.Load(XslPath + DataSourceName + ".xsl", oXmlUrlResolver);
// Xsl Path is class variable
oXslTransform.Transform(oXmlDataDocument, null, oXmlTextWriter,
oXmlUrlResolver);
// Close the XmlTextWriter object
oXmlTextWriter.Close();
return ReportPath;
}
catch (System.Exception ex)
{
oXmlTextWriter.Close();
System.IO.File.Delete(ReportPath);
throw (ex);
}