Basic conversion rules and singleton node sequences

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 UTC