I am trying to create a winform application that searches through an XML doc. for my search I need to convert the the XML attribute in the xpath condition to lower case, by using lower-case() xpath function. this causes a problem related to the function namespace.
I have tried to add the namespace manualy:
XmlNamespaceManager nsMgr = new XmlNamespaceManager(prs.Doc.NameTable); nsMgr.AddNamespace('fn', 'http://www.w3.org/2005/02/xpath-functions'); XmlNodeList results = prs.Doc.SelectNodes('//function[starts-with(fn:lower-case(@name),'' + txtSearch.Text + '')]',nsMgr);
but still I get exception: XsltContext is needed for this query because of an unknown function.
fn:lower-case is defined in XQuery 1.0 and XPath 2.0. XSLT 2.0 works with XPATH 2.0.
AFAIK, .NET hasn’t support XPATH 2.0 yet. and the XSLT version from .NET is 1.0 as well not 2.0 yet.