Re: [xsl] is () a node or an atomic?

Subject: Re: [xsl] is () a node or an atomic?
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Mon, 03 Oct 2011 13:11:04 +0100
On 03/10/2011 11:40, Andrew Welch wrote:
More empty sequence 'fun':

What is the base type of (), is it a node or an atomic, or something else?
() is not a type, so it does not have a base type.

A sequence in itself does not carry a type label; only items carry type information. A sequence is tested against a sequence type by comparing the items in the sequence against the item type, and the length of the sequence against the cardinality.

I can specify empty-sequence() as the sequence type:


<xs:variable name="foo" select="()" as="empty-sequence()"/>
It's convenient to think of empty-sequence() as being a SequenceType whose item type is item() and whose cardinality is "exactly zero".

...but its not mentioned in the type hierarchy:


http://www.w3.org/TR/xquery-operators/#datatypes


That diagram (which I hate) actually shows two type hierarchies: the hierarchy of XDM item types (rooted at item()), and the hierarchy of XSD schema types (rooted at xs:anyType). It doesn't show SequenceTypes.

Michael Kay
Saxonica

Current Thread