I want to select a node based on an attribute value. I am using C# program to derive on the attribute value which is stored in a variable. The below code returns null. How can I compare the attribute value against a variable?

     string posSecond = "test";
     SelectSingleNode("//viewentries/viewentry[@position=posSecond]");

Thanks!

SelectSingleNode(string.Format("//viewentries/viewentry[@position='{0}']", posSecond));

should work, assuming the position attribute contains a string value.

Spot on! Yes, the variable is defined as string.
Thanks!