This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
The XPathEvaluator_evaluate_TYPE_ERR selects the document root and asks for a number result. This is a completely valid conversion in XPath and shouldn't raise the TYPE_ERR exception. The number function converts a nodeset to a string as if by a call to the string function and then converts the resulting string. The string function converts a nodeset to the string-value of the node in the node-set that is first in document order. See http://www.w3.org/TR/xpath#function-number and http://www.w3.org/TR/xpath#function-string One way to get a TYPE_ERR is for example trying to get a node iterator or a snapshot or a node from an expression that returns a string or a number or a boolean (eg. "string(something)" and evaluate that to FIRST_ORDERED_NODE_TYPE). The inverse doesn't seem possible since the string(), boolean and number() functions defined in http://www.w3.org/TR/xpath#corelib are used to convert the result to the requested type for STRING_TYPE, NUMBER_TYPE and BOOLEAN_TYPE. As you can see those conversions are defined for converting from all other result types.
Created attachment 300 [details] Changed test per comment