2003-08-14 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
[mono.git] / mcs / class / System.XML / Mono.Xml.Xsl.Operations / XslText.cs
1 //
2 // XslText.cs
3 //
4 // Authors:
5 //      Ben Maurer (bmaurer@users.sourceforge.net)
6 //      Atsushi Enomoto (ginga@kit.hi-ho.ne.jp)
7 //      
8 // (C) 2003 Ben Maurer
9 // (C) 2003 Atsushi Enomoto
10 //
11
12 using System;
13 using System.Collections;
14 using System.Xml;
15 using System.Xml.XPath;
16 using System.Xml.Xsl;
17
18 namespace Mono.Xml.Xsl.Operations {
19         public class XslText : XslCompiledElement {
20                 bool disableOutputEscaping = false;
21                 string text = "";
22                 
23                 public XslText (Compiler c) : base (c) {}
24
25                 protected override void Compile (Compiler c)
26                 {
27                         this.text = c.Input.Value;
28                         
29                         if (c.Input.NodeType == XPathNodeType.Element)
30                                 this.disableOutputEscaping = c.ParseYesNoAttribute ("disable-output-escaping", false);
31                 }
32                 
33
34                 public override void Evaluate (XslTransformProcessor p)
35                 {
36                         if (!disableOutputEscaping)
37                                 p.Out.WriteString (text);
38                         else
39                                 p.Out.WriteRaw (text);
40                 }
41         }
42 }