Subject: Re: [xsl] Casting single-item sequences to atomic values From: Wendell Piez <wapiez@xxxxxxxxxxxxxxx> Date: Tue, 8 Apr 2014 09:42:17 -0400 |
Christian, This is easy to find in the spec ... if you look at the right spec. :-) http://www.w3.org/TR/xpath-datamodel/#sequences Cheers, Wendell On Mon, Apr 7, 2014 at 8:31 PM, Christian Roth <roth@xxxxxxxxxxxxxx> wrote: > 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 valueb& > > Does not apply. > >> 3. If the result of atomization is an empty sequence: b& > > Does not apply. > >> 4. If the result of atomization is a single atomic valueb& > > 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 > -- Wendell Piez | http://www.wendellpiez.com XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Casting single-item seque, David Carlisle | Thread | Re: [xsl] Casting single-item seque, Christian Roth |
Re: [xsl] nested groups from flat f, Imsieke, Gerrit, le- | Date | Re: [xsl] Casting single-item seque, Christian Roth |
Month |