Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Nov 05, 2006 10:10 AM by olegt
Nov 03, 2006 12:43 AM|LINK
If I want to select book has name ABCD , I can writee elem.SelectSingleNode( @""book[ @Name = ""ABCD""]"");
BUT IF I want to select book has name A'B'C"D" how to select ?
Please help me ,thank you very very much.
the XPATH standard says:
Nov 03, 2006 09:31 AM|LINK
need to use the translate function
try reading this first
Nov 05, 2006 10:10 AM|LINK
XPath is designed to be embedded language. It delegates such issues to the host language - be it XSLT or C#. Usual way to solve such convolute problems is to have key value in a variable.
In XSLT it would look like
In .NET there is support for variables in XPath selections, but it's quite convolute. Much easier is to use handy Mvp.Xml XPathCache class:
XmlNode book = XPathCache.SelectSingleNode("//book[title=$title]",
doc, new XPathVariable("title", "A'B'C\"D\""));
You can get Mvp.Xml library at