using System;
using System.Collections;
+using System.IO;
using System.Xml;
using System.Xml.XPath;
using System.Xml.Xsl;
-namespace Mono.Xml.Xsl.Operations {
- internal class XslMessage : XslCompiledElement {
+namespace Mono.Xml.Xsl.Operations
+{
+ internal class XslMessage : XslCompiledElement
+ {
+ static TextWriter output;
+
+ static XslMessage ()
+ {
+ switch (Environment.GetEnvironmentVariable ("MONO_XSLT_MESSAGE_OUTPUT")) {
+ case "none":
+ output = TextWriter.Null;
+ break;
+ case "stderr":
+ output = Console.Error;
+ break;
+ default:
+ output = Console.Out;
+ break;
+ }
+ }
+
bool terminate;
XslOperation children;
protected override void Compile (Compiler c)
{
+ if (c.Debugger != null)
+ c.Debugger.DebugCompile (this.DebugInput);
+
+ c.CheckExtraAttributes ("message", "terminate");
+
terminate = c.ParseYesNoAttribute ("terminate", false);
if (!c.Input.MoveToFirstChild ()) return;
public override void Evaluate (XslTransformProcessor p)
{
+ if (p.Debugger != null)
+ p.Debugger.DebugExecute (p, this.DebugInput);
+
if (children != null)
- Console.Write (children.EvaluateAsString (p));
+ output.Write (children.EvaluateAsString (p));
if (terminate)
throw new XsltException ("Transformation terminated.", null, p.CurrentNode);
}