1. For �...@attr > ‘5’ cast as xsd:integer”, @attr will be cast into xsd:double. You cannot just use the DoubleDV to compare an integer and a double. According to the type promotion rules, you have to cast the integer to a double and then compare the doubles. There is no better way than this. You have to first perform all explicit casts defined in the expression. Think about what happens for �...@attr > ‘5.2’ cast as xsd:integer”. If you do not perform the integer cast, and directly do a comparison, you will be testing whether the attribute value is greater than 5.2 and not 5. And according to type promotion and subtype substitution rules, when you compare a double to an integer, you have to cast the integer to a double.
2. Yeah, the validate method doesn’t really perform casts as you expect. As the method name implies, it only validates whether the value is valid for the data type, nowhere does it say it performs casting. A simple solution is to perform checking before validation – check if the resulting type is integer, if so, validate the value without any decimals. There are other cases like this, like the date types, casting from a double to a float, float to an integer, etc. Regards and Merry Christmas, John -- View this message in context: http://www.nabble.com/Type-Alternatives%3A-XPath-Evaluation-tp21155338p21177809.html Sent from the Xerces - J - Dev mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
