Re: [xsl] 99 bottles of beer

Subject: Re: [xsl] 99 bottles of beer
From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx>
Date: Tue, 6 Feb 2007 10:18:21 +0000
On 2/5/07, Abel Braaksma <abel.online@xxxxxxxxx> 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

Current Thread