xsl-list
[Top] [All Lists]

Re: [xsl] 99 bottles of beer

2007-02-06 03:18:38
On 2/5/07, Abel Braaksma <abel(_dot_)online(_at_)xs4all(_dot_)nl> wrote:
Andrew Welch wrote:
>
> The difference there is that (1 to 2) != 10 returns a sequence of 2
> items "true true", whereas (1,2) != 10 returns a single "true".  I
> would have to look it up but I think anything other than a single
> "true" converts to false, so "true true" returns false.
>
> You could rewrite it as ((1 to 2) != 10) = false() to check the values
> in the sequence for any occurance of false(), and return a single
> true/false.

I read an reread it, and in either case misread it. But now I see my
mistake, and it is pretty simple really (well, it took me a couple of
hours, hope that others grasp it quicker ;)  Let's put my thoughts to paper.

Yes, sorry about that, I got that wrong.  I should do a couple hours
of spec reading too as punishment...


Thanks Andrew, for the mind exercise, it was fun getting the grips
(almost) to some less-than-obvious stuff.

:) I'm glad you didn't see it the other way and get really annoyed
with the misinformation.


Note that the trick you mentioned, does not work, because the first part
(before '= false()') does not return a sequence of all false/true
values, it returns, as I see it, a sequence of one item.

((1 , 3) != 4) = false()

returns the opposite of

((1 , 3) != 4) = true()

for all tests above (replace (1, 3) with (1 to 3) to see the effect).

Yes, I was basing all this on:

for $i in (1 to 3) return $i != 4

which I thought was equivalent to:

(1 to 3) != 4

and based on my incorrect assumptions of the above producing a
sequence of booleans I thought it could be rewritten to:

((1 to 3) != 4) = true()

whereas it must be:

(for $i in (1 to 3) return $i != 4) = true()

Again, sorry about that.

cheers
andrew

--~------------------------------------------------------------------
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>