public QilNode Function(string prefix, string name, IList<QilNode> args) {
Debug.Assert(prefix.Length == 0);
QilIterator i = f.For(fixupNode);
QilNode matches;
if (name == "id") {
Debug.Assert(
args.Count == 1 && args[0].NodeType == QilNodeType.LiteralString,
"Function id() must have one literal string argument"
);
matches = f.Id(i, args[0]);
} else {
Debug.Assert(name == "key", "Unexpected function");
Debug.Assert(
args.Count == 2 &&
args[0].NodeType == QilNodeType.LiteralString && args[1].NodeType == QilNodeType.LiteralString,
"Function key() must have two literal string arguments"
);
matches = environment.ResolveFunction(prefix, name, args, new XsltFunctionFocus(i));
}
QilIterator j;
QilLoop result = f.BaseFactory.Filter(i, f.Not(f.IsEmpty(f.Filter(j = f.For(matches), f.Is(j, i)))));
SetPriority(result, 0.5);
SetLastParent(result, result);
return result;
}