W3C home > Mailing lists > Public > www-xpath-comments@w3.org > January to March 2002

Basic conversion rules and singleton node sequences

From: Jeni Tennison <jeni@jenitennison.com>
Date: Tue, 15 Jan 2002 14:49:54 +0000
Message-ID: <5713537282.20020115144954@jenitennison.com>
To: www-xpath-comments@w3.org
Hi,

The basic conversion rules don't address the situation where the
required type is a (possibly optional) single node. For example, the
signature for the name() function is:

  xf:name(node? $node) => xs:QName?

I think that the basic conversion rules should treat a required type
of a node or an optional node in much the same way as they treat a
required type of a simple typed value or an optional simple typed
value (except without any conversion to a simple typed value of
course!) -- so raise a type exception if there are too many items in
the sequence, or not enough (if it's not optional) or if the singleton
item isn't a node (of the requisite type, and can't be converted to
that type).

Actually, the F&O WD isn't clear whether the signature of the
xf:name() function is as above or if the node argument is required. If
the latter, then perhaps the fallback conversions should have another
condition added to them - if the required type is a node and the given
value is an empty sequence, then use the context node. Just a thought.

Cheers,

Jeni
---
Jeni Tennison
http://www.jenitennison.com/
Received on Tuesday, 15 January 2002 10:40:07 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 3 October 2007 16:05:54 GMT