2003-08-14 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
[mono.git] / mcs / class / System.XML / Mono.Xml.Xsl.Operations / XslValueOf.cs
1 //
2 // XslValueOf.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 XslValueOf : XslCompiledElement {
20                 XPathExpression select;
21                 bool disableOutputEscaping;
22
23                 public XslValueOf (Compiler c) : base (c) {}
24
25                 protected override void Compile (Compiler c)
26                 {
27                         c.AssertAttribute ("select");
28                         select = c.CompileExpression (c.GetAttribute ("select"));
29                         disableOutputEscaping = c.ParseYesNoAttribute ("disable-output-escaping", false);
30                 }
31                 
32                 public override void Evaluate (XslTransformProcessor p)
33                 {
34                         if (!disableOutputEscaping)
35                                 p.Out.WriteString (p.EvaluateString (select));
36                         else
37                                 p.Out.WriteRaw (p.EvaluateString (select));
38                 }
39         }
40 }