I've tried SetError too.

The XSLT is definitely generating a message. If I set terminate to yes on the message the code quite happily errors at the expected point.

The offending code is below - it's basically running a sequence of transformations set up in xsltTransformers ... if anyone can spot a blooper I'd be very grateful - I've stared at it for several hours now with no luck.



private bool ProcessSaxon(string sourceURI)


XdmNode sourceNode = processor.NewDocumentBuilder().Build(new Uri(sourceURI));

Serializer serializer = new Serializer();

serializer.SetOutputStream(new FileStream("c:/temp/schematofo/SaxonTest.xml", FileMode.Create, FileAccess.Write));

XdmDestination results = new XdmDestination();

int transformCount = 1;

TextWriter consoleOut = Console.Out;

TextWriter consoleError = Console.Error;

TextWriter saxonOutput = new StringWriter();

TextWriter saxonErrorOutput = new StringWriter();



foreach (XsltTransformer transformer in xsltTransformers)


saxonOutput.WriteLine("Processing XSLT: " + transformCount);

saxonErrorOutput.WriteLine("Error stream ...");

transformer.InitialContextNode = sourceNode;

if (transformCount != xsltTransformers.Count)



sourceNode = results.XdmNode;







saxonErrorOutput.WriteLine("End of error stream ...");







return true;


From: Michael Kay [mailto:mike@saxonica.com]
Sent: 22 April 2008 13:51
To: 'Mailing list for the SAXON XSLT and XQuery processor'
Subject: Re: [saxon] xsl:message and .Net

By default, xsl:message output goes to System.Console.Error, not to System.Console.Out.
I'm planning to add a MessageListener property to the XsltTransformer class in the next release, to allow more sophisticated application control over xsl:message output.
Michael Kay

From: saxon-help-bounces@lists.sourceforge.net [mailto:saxon-help-bounces@lists.sourceforge.net] On Behalf Of Appleby, Paul
Sent: 22 April 2008 12:58
To: saxon-help@lists.sourceforge.net
Subject: [saxon] xsl:message and .Net

I'm just starting to implement Saxon.Net and am trying to retrieve the output from xsl:message (terminate set to 'no'). Am I correct in thinking this should go to System.Console? I'm redirecting this to a stream using .SetOut but nothing is appearing in the stream other than text I'm outputting to the console before and after the transformation.
Am I barking up the wrong tree?
Paul Appleby

Technical Data Consultant

The Stationery Office

Tel:  +44 (0) 1603 695898

Email: paul.appleby@tso.co.uk

Web:  www.tso.co.uk

Orders:  www.tsoshop.co.uk


TSO Information and Publishing Solutions

Part of the Williams Lea Group www.williamslea.com


Every day, decisions are made that affect you – do you know enough to have your say?

Keep up with Official Publishing at: www.haveyoursayonline.net

 P Please consider the environment before printing this e-mail



This email, including any attachment, is confidential and may be legally privileged. If you are not the intended recipient or if you have received this email in error, please inform the sender immediately by reply and delete all copies from your system. Do not retain, copy, disclose, distribute or otherwise use any of its contents.


Whilst we have taken reasonable precautions to ensure that this email has been swept for computer viruses, we cannot guarantee that this email does not contain such material and we therefore advise you to carry out your own virus checks. We do not accept liability for any damage or losses sustained as a result of such material.


Please note that incoming and outgoing email communications passing through our IT systems may be monitored and/or intercepted by us solely to determine whether the content is business related and compliant with company standards.


The Stationery Office Limited is registered in England No. 3049649 at Clifton House, Worship Street, London, EC2A 2EJ.