Re: Question regarding the typehirarchy

Hi Daniel,

> don't know whether this is the right place for the question. If not,
> please take my apologies.

Questions about XPath or XSLT can be asked on XSL-List (see
http://www.mulberrytech.com/xsl/xsl-list). Questions about XQuery
should probably go to XQuery-Talk (see
http://xquery.com/mailman/listinfo/talk).

> I wonder about the XQuery type hierarchy. There are a lot of
> documents around but I did not really find some kind of implicit
> conversion rule for types.

Conversion rules can be found in the XQuery language document. Your
example:

  "20" > 1000

uses the > operator, and the conversion rules for that can be found
in:

  http://www.w3.org/TR/xquery/#id-general-comparisons

This directs you to the "gt" operator; the conversion rules for that
can be found in:

  http://www.w3.org/TR/xquery/#id-value-comparisons

This directs you to the Appendix B.2 Operator Mapping at:

  http://www.w3.org/TR/xquery/#mapping

to determine whether the types of the two operands are comparable.
They aren't (there's no listing for A gt B where A is a xs:string and
B is numeric), so you will get a type error.

It's generally the case in XPath 2.0/XQuery that the only implicit
conversion rules are from the xdt:untypedAtomic type to other types.
xdt:untypedAtomic values only really arise in unvalidated documents.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

Received on Tuesday, 23 March 2004 08:53:23 UTC