xn/Parser/Elements/ExpressionPart.cs
Dominic Höglinger 154647083c fix: port transformation layer from XmlDocument to XDocument
- Thread runtime Context through expression trees via ParameterExpression
  instead of baking a parse-time constant (Node was always null)
- Fix ExpressionPart to compile Func<Context,string> and invoke with live ctx
- Coerce double arithmetic expressions to string before lambda wrapping
- Remove HasAttributes guard in attr() that blocked new attribute creation
- Replace GetLevel(XmlNode) with XElement.Parent-based implementation
- Add cdata()/cdata(txt) functions to read/write CDATA nodes in place,
  preserving the XCData wrapper that SetValue() would destroy

Clanker: claude-sonnet_4.6
2026-04-24 04:44:59 +02:00

14 lines
301 B
C#

using System.Linq.Expressions;
namespace XNeedle.Parser.Elements
{
public class ExpressionPart : Part
{
public required Expression<Func<Context, string>> Expr { get; set; }
public override void Operate(Context ctx)
{
Expr.Compile()(ctx);
}
}
}