W3C home > Mailing lists > Public > public-qt-comments@w3.org > March 2004

Re: Question regarding the typehirarchy

From: Jeni Tennison <jeni@jenitennison.com>
Date: Tue, 23 Mar 2004 13:53:02 +0000
Message-ID: <2810678935.20040323135302@jenitennison.com>
To: "Kirmse, Daniel" <daniel.kirmse@sap.com>
Cc: "'public-qt-comments@w3.org'" <public-qt-comments@w3.org>

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:14:07 GMT