I know about Console.SetOut
, but can't figure out what I should pass to this method.
views:
40answers:
1
+1
A:
Console.SetOut
will set stream for console outputs.
Use XsltMessageEncountered
event of XsltArgumentList
class and write the message to Trace listenres using Trace.Write
.
void TestTransform()
{
XsltArgumentList xsltargs = new XsltArgumentList();
xsltargs.XsltMessageEncountered += new XsltMessageEncounteredEventHandler(OnXsltMessageEncountered);
XslCompiledTransform transform = new XslCompiledTransform();
//....some code to load xslt and other stuffs. Pass the xsltargs to transform
}
void OnXsltMessageEncountered(object sender, XsltMessageEncounteredEventArgs e)
{
//write the message to Trace.
Trace.Write(e.Message);
}
gp
2010-01-19 17:59:15
Yeah, I've already found this solution. This is supported by XslCompiledTransform only. Console.SetOut is the only way to do this with XslTransform.
thorn
2010-01-20 11:10:03