It may be me – since I’m no XPath (or XSLT) pro, but the following is in my book a bug – or at least an annoyance category 3:
Given the following XML document loaded into an XDocument:
<?xml version="1.0" encoding="utf-8"?> <Elements> <Element Id="1" /> <Element Id="2" /> <Element Id="3" /> <Element Id="4" /> <Element Id="5" /> </Elements>
The following XPath should yield the first element of the list:
"//Element[@Id = '1']"
Guess what? If use the .XPathSelectElement() extension method, the result will be null – nada!
"//Element[@Id='1']"
The same query without the whitespace around the equal sign will give you the right result.
If you’re an XPath pro I would like your opinion on the matter – or else I’m turning this issue over to http://connect.microsoft.com/
Sigh.
