On 4 February 2015 at 08:15, ankit kumar wrote:
Hi,
let $a := <a>123.4</a> let $b := <a>12.34E1</a> return deep-equal($a,$b)
Expected : true Output : false
I expect it to return false. The elements are not typed, so their respective string values are compared to each other. Which indeed are different (they are not the same character sequences).
But if you validate the elements so they are typed as xs:double say, then the expression returns true. Given the following schema in ankit.xsd:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xs:element name="a" type="xs:double"/> </xs:schema>
the following query returns qhat you expect:
xquery version "3.0";
import schema default element namespace "" at "ankit.xsd";
let $a := validate { <a>123.4</a> } let $b := validate { <a>12.34E1</a> } return deep-equal($a, $b)
Regards,