internal static void CheckXsltValue(IList <XPathItem> val) { // IsDocOrderDistinct is not always set to true even if the node-set is ordered // Debug.Assert(val.Count <= 1 || val.IsDocOrderDistinct, "All node-sets must be ordered"); if (val.Count == 1) { XsltFunctions.EXslObjectType(val); } else { // Every item must be a node, but for performance reasons we check only // the first two and the last two items int count = val.Count; for (int idx = 0; idx < count; idx++) { if (!val[idx].IsNode) { Debug.Fail("Invalid XSLT value"); break; } if (idx == 1) { idx += Math.Max(count - 4, 0); } } } }