According to XPath specificationnumber(string(/node)) and number(/node) should behave identical, but that does not work. I agree that the spec is not very concise.
[Fact]
public void XPath2_number()
{
var xml = new XmlDocument
{
InnerXml = @"
<root num='134'>
<numeric>456</numeric>
</root>"
};
// asserts below succeed currently
Assert.Equal((double)134, xml.XPath2Evaluate("number(string(/root/@num))"));
Assert.Equal((double)456, xml.XPath2Evaluate("number(string(/root/numeric))"));
// asserts below fail currently
Assert.Equal((double)134, xml.XPath2Evaluate("number(/root/@num)"));
Assert.Equal((double)456, xml.XPath2Evaluate("number(/root/numeric)"));
}
According to XPath specification number(string(/node)) and number(/node) should behave identical, but that does not work. I agree that the spec is not very concise.