如何使用saxon评估.net中的以下Xpath表达式?我需要能够传入一个变量并将结果输入一整套代码。
SchematronTestText = "not(count($CTR17) > 0)"
答案 0 :(得分:1)
Processor processor = new Processor(true);
XPathCompiler compiler = processor.NewXPathCompiler();
compiler.DeclareVariable(new QName("aaa"));
XPathSelector selector = compiler.Compile("not(count($aaa) > 0)").load();
selector.SetVariable(new QName("aaa"), new XdmAtomicValue('sample'));
var result = selector.EvaluateSingle().ToString();