public override object Evaluate(XPathExpression xpath, object context) { var item = context as IXPathItem; if (item == null) { return null; } switch (Name.ToLowerInvariant()) { case "@name": return item.ItemName; case "@key": return item.ItemName.ToLowerInvariant(); case "@id": return item.ItemId; case "@templatename": return item.TemplateName; case "@templatekey": return item.TemplateName.ToLowerInvariant(); case "@templateid": return item.TemplateId; case "@path": return item.ItemPath; default: return item[Name]; } }
private object Evaluate([Diagnostics.NotNull] string query) { var context = Project.ProjectItems.FirstOrDefault(i => i.QualifiedName == "/sitecore/content/Home/XmlItem"); var q = new XPathExpression(Services.XPathService); q.Parse(query); return q.Evaluate(context); }
public override object Evaluate(XPathExpression xpath, object context) { object result; if (xpath.Parameters.TryGetValue(Name, out result)) { return result; } return null; }
public override object Evaluate(XPathExpression xpath, object context) { return Text; }