When I run this:
XmlDocument xmlResponse = new XmlDocument();
XmlNamespaceManager nsmgr = new XmlNamespaceManager(xmlResponse.NameTable);
nsmgr.AddNamespace("fn", " http://www.w3.org/2005/xpath-functions");
xmlResponse.LoadXml(
"<LIST>" +
"<ITEM NUMBER='3' TEXT='C'/>" +
"<ITEM NUMBER='2' TEXT='B'/>" +
"<ITEM NUMBER='1' TEXT='A'/>" +
"</LIST>");
XmlNode xmlNode = xmlResponse.SelectSingleNode("//ITEM[fn:max(@NUMBER)]", nsmgr);
I get an exception "XsltContext is needed for this query because of an unknown function." on the final line. I am trying to select the ITEM element with the highest NUMBER attribute. Is this possible using XPATH?
I am using .Net 2.0 and Linq is not an option.
Thanks