I have a project that errors on:
xslt.Load(New XmlTextReader(New StringReader(sXLST.ToString)))
I am passing a string, but it appears that the function is trying a access a file.
Here is the code, follow by the error...
Public Function xFrmTlogs(ByVal sXLST As String, ByVal sXML As String) As String
Dim xslt As New XslCompiledTransform()
Dim HTMLoutput As String
Dim writer As New StringWriter()
Try
xslt.Load(New XmlTextReader(New StringReader(sXLST.ToString)))
Catch ex As Exception
xFrmTlogs = ex.ToString
End Try
Dim sourceReader As System.Xml.XmlReader = System.Xml.XmlReader.Create(New System.IO.StringReader(sXML))
Try
xslt.Transform(sourceReader, Nothing, writer)
Catch ex As Exception
xFrmTlogs = ex.ToString
End Try
HTMLoutput = writer.ToString()
writer.Close()
xFrmTlogs = HTMLoutput
End Function
The output for the error is:
System.Xml.Xsl.XslLoadException: XSLT compile error. An error occurred at (3,2). --- System.IO.DirectoryNotFoundException: Could not find a part of the path 'H:\Program Files\common\tr_period.xsl'. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize) at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials) at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn) at System.Xml.Xsl.Xslt.XsltLoader.CreateReader(Uri uri, XmlResolver xmlResolver) at System.Xml.Xsl.Xslt.XsltLoader.LoadStylesheet(Uri uri, Boolean include) at System.Xml.Xsl.Xslt.XsltLoader.LoadInclude() at System.Xml.Xsl.Xslt.XsltLoader.LoadRealStylesheet() at System.Xml.Xsl.Xslt.XsltLoader.LoadDocument() at System.Xml.Xsl.Xslt.XsltLoader.LoadStylesheet(XmlReader reader, Boolean include) --- End of inner exception stack trace --- at System.Xml.Xsl.Xslt.XsltLoader.LoadStylesheet(XmlReader reader, Boolean include) at System.Xml.Xsl.Xslt.XsltLoader.Load(Compiler compiler, Object stylesheet, XmlResolver xmlResolver) at System.Xml.Xsl.Xslt.Compiler.Compile(Object stylesheet, XmlResolver xmlResolver, QilExpression& qil) at System.Xml.Xsl.XslCompiledTransform.CompileXsltToQil(Object stylesheet, XsltSettings settings, XmlResolver stylesheetResolver) at System.Xml.Xsl.XslCompiledTransform.LoadInternal(Object stylesheet, XsltSettings settings, XmlResolver stylesheetResolver) at System.Xml.Xsl.XslCompiledTransform.Load(XmlReader stylesheet) at VfiSapphire.COMWrapper.xFrmTlogs(String sXLST, String sXML) in H:\Documents and Settings\xxx\My Documents\Visual Studio2008\ProgramName\ModuleName\PdkBo.vb:line 709