xsl-list
[Top] [All Lists]

[xsl] Casting single-item sequences to atomic values

2014-04-07 19:32:13
Hi,

why is

  (1) cast as xs:integer == 1 

Or is it?

I hit upon this while trying to understand why this works:

  subsequence( ('a','b'), (1), 1)

subsequence() expects an xs:double as its second parameter, but not a 
single-item _sequence_ of xs:double's. Because it works, "(1) cast as 
xs:double" must be equivalent to "1 cast as xs:double", and therefore "(1) = 
1". 

Why I got that much confused is my following thinking on the description of 
"cast" at <http://www.w3.org/TR/xpath20/#id-cast>.

It says: 

1. Atomization is performed on the input expression.

With fn:data( (1) ) returning the sequence of atomized values of each of its 
input sequence's members, this IMO yields (1).

2. If the result of atomization is a sequence of more than one atomic value…

Does not apply.

3. If the result of atomization is an empty sequence: …

Does not apply.

4. If the result of atomization is a single atomic value…

Also does not apply in my thinking, as I get a _sequence_ of a single atomic 
value. There's no step that tackles the case where the result of atomization is 
a sequence of a single atomic value.

Therefore, I guess that a single-atomic-valued-item sequence is the same (or 
equivalent?) as its single atomic member. I vaguely remember reading that long 
time ago somewhere in the spec, but cannot find it now. Can someone please 
point me to the relevant section? Thanks!

Regards
Christian
--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


<Prev in Thread] Current Thread [Next in Thread>