all groups > dotnet xml > march 2006 >
You're in the

dotnet xml

group:

Implementing xsl:message with .Net 1.1


Implementing xsl:message with .Net 1.1 Alok Sathaye
3/24/2006 12:00:00 AM
dotnet xml:
Hi,
I have an XSLT which outputs an <xsl:message>

How can I handle it using .net framework 1.1
I know 2.0 has provided an event to trp the message. Is something similiar
possible in 1.1 also?

Thanks,
Alok

Re: Implementing xsl:message with .Net 1.1 Martin Honnen
3/24/2006 3:49:12 PM

[quoted text, click to view]

If you have <xsl:message terminate="yes"> then you can use exception
handling e.g. C# alike
try {
xslTransformInstance.Transform(...);
}
catch (System.Xml.Xsl.XsltException e) {
// handle exception here
}


--

Martin Honnen --- MVP XML
Re: Implementing xsl:message with .Net 1.1 Martin Honnen
3/24/2006 4:17:43 PM


[quoted text, click to view]

xsl:message terminate="no" in a NET 1.1 console application goes to
Console.Out so you could redirect that and read it out e.g.

XslTransform xsltProcessor = new XslTransform();
xsltProcessor.Load(args[0]);
TextWriter standardOut = Console.Out;
StringWriter messages = new StringWriter();
Console.SetOut(messages);
xsltProcessor.Transform(args[1], args[2], null);
Console.SetOut(standardOut);
Console.WriteLine("XSLT messages:\r\n{0}", messages.ToString());


--

Martin Honnen --- MVP XML
AddThis Social Bookmark Button