[xsl] Re: Re: An issue with XPath 2.0 sequences (Was Re: RE: Muenchian method, and keys 'n stuff)

Subject: [xsl] Re: Re: An issue with XPath 2.0 sequences (Was Re: RE: Muenchian method, and keys 'n stuff)
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Thu, 31 Jan 2002 02:49:49 -0800 (PST)
Joerg Pietschmann <joerg dot pietschmann at zkb dot ch> wrote:

> Dimitre Novatchev <dnovatchev@xxxxxxxxx> wrote:
> > Several people already expressed their curiosity about what was the
> > reason to forbid a sequence to have an element-sequence.
> 
> Well, i can see people getting uneasy about sequences containing
> empty sequences. In particular there may be conflicting expectations
> how to interpret a sequence containing an empty sequence in various 
> boolean contexts. In my LISP days i've seen quite a few people
> hunting bugs ultimately caused by the difference between NIL
> and '(NIL). There may be also problems in how to handle empty
> sequences in unions and other functionality: should the result
> of (())|(()) be (()) or (()()) or even ()? 
This shouldn't be a problem. However, it will be more correct to speak
about concatenation of sequences, not union, because sequences are not
sets, sequences are ordered and sequences can haverepeating identical
elements. Sequences, whose elements may be sequences are
straightforward to model with node-sets (trees):

(())|(()) 

is the same as 

$S1 | $S2,

where $S1 and $S2 each contain:

<el>
   <el/>
<el>


The result of their concatenation (not union!) will be:

<el>
   <el/>
   <el/>
<el>

> Should sum((1 () 2))
> result in 3 or NaN?

In a strongly typed system this results in error, because the sum()
function is defined over sequences of numbers, and the second element
of(1 () 2) is not a number. 


> Having said that, i still think it would be much cleaner to
> allow sequences containing sequences, even if it breaks some
> existing style sheets.

As Mike pointed out, the decision to have sequences only of
simple-valued elements closely reflected the XML-Schema datatypes.

It must be noted, that sequences without such restriction cover
completely the XML-Schema-type sequences, so their use in XPath will
not lead to any contradiction with XML-Schema.

Cheers,
Dimitre Novatchev.




__________________________________________________
Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions! 
http://auctions.yahoo.com

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread