I am trying to create a winform application that searches through an XML document. for my search, I need to convert the XML attribute in the xpath condition to lowercase using the lowercase () xpath function. this causes a problem with the function namespace.
I tried adding the namespace manually:
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 an exception: XsltContext is needed for this request due to an unknown function.
c # xpath
sdfgdfg
source share